summaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2021-04-15 14:01:56 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2021-04-15 14:01:56 +0200
commitb463adfd95354b4603544215eada98284f2be090 (patch)
treea44bff3dadaeb9218ba581d4a9f135877c14a7eb /arch
parente61c75c259af8601a671e14237b464e0d49fd0df (diff)
parent94f2da7d81cfd83685af24967e89347e7aea2ccb (diff)
downloadbarebox-b463adfd95354b4603544215eada98284f2be090.tar.gz
barebox-b463adfd95354b4603544215eada98284f2be090.tar.xz
Merge branch 'for-next/misc'
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/boards/Makefile1
-rw-r--r--arch/arm/boards/skov-arm9cpu/Makefile2
-rw-r--r--arch/arm/boards/skov-arm9cpu/board.c84
-rw-r--r--arch/arm/boards/skov-arm9cpu/lowlevel.c127
-rw-r--r--arch/arm/configs/at91_multi_defconfig1
-rw-r--r--arch/arm/cpu/uncompress.c1
-rw-r--r--arch/arm/dts/Makefile1
-rw-r--r--arch/arm/dts/at91-skov-arm9cpu.dts451
-rw-r--r--arch/arm/mach-at91/Kconfig11
-rw-r--r--arch/sandbox/board/env/init/state9
-rw-r--r--arch/sandbox/board/env/nv/autoboot1
-rw-r--r--arch/x86/Kconfig63
-rw-r--r--arch/x86/Makefile32
-rw-r--r--arch/x86/bios/Makefile3
-rw-r--r--arch/x86/bios/bios_disk.S57
-rw-r--r--arch/x86/bios/memory16.S54
-rw-r--r--arch/x86/bios/traveler.S166
-rw-r--r--arch/x86/boards/x86_generic/Makefile4
-rw-r--r--arch/x86/boards/x86_generic/disk_bios_drive.c33
-rw-r--r--arch/x86/boards/x86_generic/env/bin/boot37
-rw-r--r--arch/x86/boards/x86_generic/env/bin/init15
-rw-r--r--arch/x86/boards/x86_generic/env/config31
-rw-r--r--arch/x86/boards/x86_generic/envsector.h24
-rw-r--r--arch/x86/boards/x86_generic/generic_pc.c18
-rw-r--r--arch/x86/boards/x86_generic/intf_platform_ide.c80
-rw-r--r--arch/x86/boards/x86_generic/serial_ns16550.c35
-rw-r--r--arch/x86/boot/Kconfig20
-rw-r--r--arch/x86/boot/Makefile13
-rw-r--r--arch/x86/boot/a20.c166
-rw-r--r--arch/x86/boot/bioscall.S90
-rw-r--r--arch/x86/boot/boot.h189
-rw-r--r--arch/x86/boot/boot_hdisk.S170
-rw-r--r--arch/x86/boot/boot_main.S39
-rw-r--r--arch/x86/boot/main_entry.c24
-rw-r--r--arch/x86/boot/pmjump.S82
-rw-r--r--arch/x86/boot/prepare_uboot.c80
-rw-r--r--arch/x86/boot/regs.c29
-rw-r--r--arch/x86/boot/tty.c41
-rw-r--r--arch/x86/configs/generic_defconfig26
-rw-r--r--arch/x86/include/asm/syslib.h13
-rw-r--r--arch/x86/lib/.gitignore1
-rw-r--r--arch/x86/lib/Makefile9
-rw-r--r--arch/x86/lib/asm-offsets.c6
-rw-r--r--arch/x86/lib/barebox.lds.S161
-rw-r--r--arch/x86/lib/gdt.c38
-rw-r--r--arch/x86/lib/linux_start.S55
-rw-r--r--arch/x86/lib/memory.c49
-rw-r--r--arch/x86/mach-efi/elf_x86_64_efi.lds.S3
-rw-r--r--arch/x86/mach-i386/Kconfig13
-rw-r--r--arch/x86/mach-i386/Makefile2
-rw-r--r--arch/x86/mach-i386/include/mach/barebox.lds.h82
-rw-r--r--arch/x86/mach-i386/pit_timer.c53
52 files changed, 700 insertions, 2095 deletions
diff --git a/arch/arm/boards/Makefile b/arch/arm/boards/Makefile
index 0c1c077f00..1441264dfa 100644
--- a/arch/arm/boards/Makefile
+++ b/arch/arm/boards/Makefile
@@ -180,3 +180,4 @@ obj-$(CONFIG_MACH_WAGO_PFC_AM35XX) += wago-pfc-am35xx/
obj-$(CONFIG_MACH_LS1046ARDB) += ls1046ardb/
obj-$(CONFIG_MACH_TQMLS1046A) += tqmls1046a/
obj-$(CONFIG_MACH_MNT_REFORM) += mnt-reform/
+obj-$(CONFIG_MACH_SKOV_ARM9CPU) += skov-arm9cpu/
diff --git a/arch/arm/boards/skov-arm9cpu/Makefile b/arch/arm/boards/skov-arm9cpu/Makefile
new file mode 100644
index 0000000000..01c7a259e9
--- /dev/null
+++ b/arch/arm/boards/skov-arm9cpu/Makefile
@@ -0,0 +1,2 @@
+obj-y += board.o
+lwl-y += lowlevel.o
diff --git a/arch/arm/boards/skov-arm9cpu/board.c b/arch/arm/boards/skov-arm9cpu/board.c
new file mode 100644
index 0000000000..8d5eadbb9a
--- /dev/null
+++ b/arch/arm/boards/skov-arm9cpu/board.c
@@ -0,0 +1,84 @@
+// SPDX-License-Identifier: GPL-2.0+
+// SPDX-FileCopyrightText: 2017 Sam Ravnborg <sam@ravnborg.org>
+
+#include <common.h>
+#include <globalvar.h>
+#include <magicvar.h>
+#include <envfs.h>
+#include <init.h>
+#include <gpio.h>
+
+#include <linux/sizes.h>
+
+#include <mach/at91sam9263_matrix.h>
+#include <mach/at91sam9_sdramc.h>
+#include <mach/at91sam9_smc.h>
+#include <mach/hardware.h>
+#include <mach/iomux.h>
+
+static struct sam9_smc_config ek_nand_smc_config = {
+ .ncs_read_setup = 0,
+ .nrd_setup = 1,
+ .ncs_write_setup = 0,
+ .nwe_setup = 1,
+
+ .ncs_read_pulse = 3,
+ .nrd_pulse = 3,
+ .ncs_write_pulse = 3,
+ .nwe_pulse = 3,
+
+ .read_cycle = 5,
+ .write_cycle = 5,
+
+ .mode = AT91_SMC_READMODE | AT91_SMC_WRITEMODE |
+ AT91_SMC_EXNWMODE_DISABLE,
+ .tdf_cycles = 2,
+};
+
+BAREBOX_MAGICVAR(board.mem, "The detected memory size in MiB");
+
+static int mem;
+
+/*
+ * Initialize of SMC must come after we
+ * probe the at91sam9_smc_driver.
+ * But is required before we start the other drives.
+ * Use device_initcall() to maintain this order.
+ */
+static int skov_arm9_probe(struct device_d *dev)
+{
+ unsigned long csa;
+
+ add_generic_device("at91sam9-smc", 0, NULL, AT91SAM9263_BASE_SMC0, 0x200,
+ IORESOURCE_MEM, NULL);
+ add_generic_device("at91sam9-smc", 1, NULL, AT91SAM9263_BASE_SMC1, 0x200,
+ IORESOURCE_MEM, NULL);
+
+ csa = readl(AT91SAM9263_BASE_MATRIX + AT91SAM9263_MATRIX_EBI0CSA);
+ csa |= AT91SAM9263_MATRIX_EBI0_CS3A_SMC_SMARTMEDIA;
+ writel(csa, AT91SAM9263_BASE_MATRIX + AT91SAM9263_MATRIX_EBI0CSA);
+
+ /* configure chip-select 3 (NAND) */
+ sam9_smc_configure(0, 3, &ek_nand_smc_config);
+
+ mem = at91_get_sdram_size(IOMEM(AT91SAM9263_BASE_SDRAMC0));
+ mem = mem / SZ_1M;
+ globalvar_add_simple_int("board.mem", &mem, "%u");
+
+ return 0;
+}
+
+static __maybe_unused struct of_device_id skov_arm9_ids[] = {
+ {
+ .compatible = "skov,arm9-cpu",
+ }, {
+ /* sentinel */
+ }
+};
+
+static struct driver_d skov_arm9_driver = {
+ .name = "skov-arm9",
+ .probe = skov_arm9_probe,
+ .of_compatible = DRV_OF_COMPAT(skov_arm9_ids),
+};
+device_platform_driver(skov_arm9_driver);
diff --git a/arch/arm/boards/skov-arm9cpu/lowlevel.c b/arch/arm/boards/skov-arm9cpu/lowlevel.c
new file mode 100644
index 0000000000..d335953a73
--- /dev/null
+++ b/arch/arm/boards/skov-arm9cpu/lowlevel.c
@@ -0,0 +1,127 @@
+// SPDX-License-Identifier: GPL-2.0
+// PDX-FileCopyrightText: 2018 Sam Ravnborg <sam@ravnborg.org>
+
+#include <linux/sizes.h>
+
+#include <asm/barebox-arm.h>
+
+#include <mach/at91sam926x_board_init.h>
+#include <mach/at91sam9263_matrix.h>
+
+#define MASTER_PLL_MUL 171
+#define MASTER_PLL_DIV 14
+
+static void __bare_init skovarm9cpu_board_config(struct at91sam926x_board_cfg *cfg)
+{
+ /* Disable Watchdog */
+ cfg->wdt_mr =
+ AT91_WDT_WDIDLEHLT | AT91_WDT_WDDBGHLT |
+ AT91_WDT_WDV |
+ AT91_WDT_WDDIS |
+ AT91_WDT_WDD;
+
+ /* define PDC[31:16] as DATA[31:16] */
+ cfg->ebi_pio_pdr = 0xFFFF0000;
+ /* no pull-up for D[31:16] */
+ cfg->ebi_pio_ppudr = 0xFFFF0000;
+ /* EBI0_CSA, CS1 SDRAM, CS3 NAND Flash, 3.3V memories */
+ cfg->ebi_csa =
+ AT91SAM9263_MATRIX_EBI0_DBPUC | AT91SAM9263_MATRIX_EBI0_VDDIOMSEL_3_3V |
+ AT91SAM9263_MATRIX_EBI0_CS1A_SDRAMC;
+
+ cfg->smc_cs = 0;
+ cfg->smc_mode =
+ AT91_SMC_READMODE | AT91_SMC_WRITEMODE |
+ AT91_SMC_DBW_16 |
+ AT91_SMC_TDFMODE |
+ AT91_SMC_TDF_(6);
+ cfg->smc_cycle =
+ AT91_SMC_NWECYCLE_(22) | AT91_SMC_NRDCYCLE_(22);
+ cfg->smc_pulse =
+ AT91_SMC_NWEPULSE_(11) | AT91_SMC_NCS_WRPULSE_(11) |
+ AT91_SMC_NRDPULSE_(11) | AT91_SMC_NCS_RDPULSE_(11);
+ cfg->smc_setup =
+ AT91_SMC_NWESETUP_(10) | AT91_SMC_NCS_WRSETUP_(10) |
+ AT91_SMC_NRDSETUP_(10) | AT91_SMC_NCS_RDSETUP_(10);
+
+ cfg->pmc_mor =
+ AT91_PMC_MOSCEN |
+ (255 << 8); /* Main Oscillator Start-up Time */
+ cfg->pmc_pllar =
+ AT91_PMC_PLLA_WR_ERRATA | /* Bit 29 must be 1 when prog */
+ AT91_PMC_OUT |
+ AT91_PMC_PLLCOUNT | /* PLL Counter */
+ (2 << 28) | /* PLL Clock Frequency Range */
+ ((MASTER_PLL_MUL - 1) << 16) | (MASTER_PLL_DIV);
+ /* PCK/2 = MCK Master Clock from PLLA */
+ cfg->pmc_mckr1 =
+ AT91_PMC_CSS_SLOW |
+ AT91_PMC_PRES_1 |
+ AT91SAM9_PMC_MDIV_2 |
+ AT91_PMC_PDIV_1;
+ /* PCK/2 = MCK Master Clock from PLLA */
+ cfg->pmc_mckr2 =
+ AT91_PMC_CSS_PLLA |
+ AT91_PMC_PRES_1 |
+ AT91SAM9_PMC_MDIV_2 |
+ AT91_PMC_PDIV_1;
+
+ /* SDRAM */
+ /* SDRAMC_TR - Refresh Timer register */
+ cfg->sdrc_tr1 = 0x13C;
+ /* SDRAMC_CR - Configuration register*/
+ cfg->sdrc_cr =
+ AT91_SDRAMC_NC_10 | /* Assume 128MiB */
+ AT91_SDRAMC_NR_13 |
+ AT91_SDRAMC_NB_4 |
+ AT91_SDRAMC_CAS_3 |
+ AT91_SDRAMC_DBW_32 |
+ (1 << 8) | /* Write Recovery Delay */
+ (7 << 12) | /* Row Cycle Delay */
+ (2 << 16) | /* Row Precharge Delay */
+ (2 << 20) | /* Row to Column Delay */
+ (5 << 24) | /* Active to Precharge Delay */
+ (1 << 28); /* Exit Self Refresh to Active Delay */
+
+ /* Memory Device Register -> SDRAM */
+ cfg->sdrc_mdr = AT91_SDRAMC_MD_SDRAM;
+ /* SDRAM_TR */
+ cfg->sdrc_tr2 = 1200;
+
+ /* user reset enable */
+ cfg->rstc_rmr =
+ AT91_RSTC_KEY |
+ AT91_RSTC_PROCRST |
+ AT91_RSTC_RSTTYP_WAKEUP |
+ AT91_RSTC_RSTTYP_WATCHDOG;
+}
+
+static void __bare_init skov_arm9cpu_init(void *fdt)
+{
+ struct at91sam926x_board_cfg cfg;
+
+ cfg.pio = IOMEM(AT91SAM9263_BASE_PIOD);
+ cfg.sdramc = IOMEM(AT91SAM9263_BASE_SDRAMC0);
+ cfg.ebi_pio_is_peripha = true;
+ cfg.matrix_csa = IOMEM(AT91SAM9263_BASE_MATRIX + AT91SAM9263_MATRIX_EBI0CSA);
+
+ skovarm9cpu_board_config(&cfg);
+ at91sam9263_board_init(&cfg);
+
+ barebox_arm_entry(AT91_CHIPSELECT_1, at91_get_sdram_size(cfg.sdramc),
+ fdt);
+}
+
+extern char __dtb_at91_skov_arm9cpu_start[];
+
+ENTRY_FUNCTION(start_skov_arm9cpu, r0, r1, r2)
+{
+ void *fdt;
+
+ arm_cpu_lowlevel_init();
+
+ arm_setup_stack(AT91SAM9263_SRAM0_BASE + AT91SAM9263_SRAM0_SIZE);
+ fdt = __dtb_at91_skov_arm9cpu_start + get_runtime_offset();
+
+ skov_arm9cpu_init(fdt);
+}
diff --git a/arch/arm/configs/at91_multi_defconfig b/arch/arm/configs/at91_multi_defconfig
index e6a554e87f..f0a4812f0c 100644
--- a/arch/arm/configs/at91_multi_defconfig
+++ b/arch/arm/configs/at91_multi_defconfig
@@ -1,4 +1,5 @@
CONFIG_AT91_MULTI_BOARDS=y
+CONFIG_MACH_SKOV_ARM9CPU=y
CONFIG_MACH_AT91SAM9263EK=y
CONFIG_MACH_AT91SAM9X5EK=y
CONFIG_MACH_MICROCHIP_KSZ9477_EVB=y
diff --git a/arch/arm/cpu/uncompress.c b/arch/arm/cpu/uncompress.c
index db0fe98e0d..2250b8ccd3 100644
--- a/arch/arm/cpu/uncompress.c
+++ b/arch/arm/cpu/uncompress.c
@@ -52,6 +52,7 @@ void __noreturn barebox_pbl_start(unsigned long membase, unsigned long memsize,
void *pg_start, *pg_end;
unsigned long pc = get_pc();
+ /* piggy data is not relocated, so determine the bounds now */
pg_start = input_data + global_variable_offset();
pg_end = input_data_end + global_variable_offset();
diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
index c032f0391f..a637869fb6 100644
--- a/arch/arm/dts/Makefile
+++ b/arch/arm/dts/Makefile
@@ -112,6 +112,7 @@ lwl-$(CONFIG_MACH_SOLIDRUN_MICROSOM) += imx6dl-hummingboard.dtb.o imx6q-hummingb
imx6dl-hummingboard2.dtb.o imx6q-hummingboard2.dtb.o \
imx6q-h100.dtb.o
lwl-$(CONFIG_MACH_SKOV_IMX6) += imx6dl-skov-imx6.dtb.o imx6q-skov-imx6.dtb.o
+lwl-$(CONFIG_MACH_SKOV_ARM9CPU) += at91-skov-arm9cpu.dtb.o
lwl-$(CONFIG_MACH_SEEED_ODYSSEY) += stm32mp157c-odyssey.dtb.o
lwl-$(CONFIG_MACH_STM32MP15XX_DKX) += stm32mp157c-dk2.dtb.o stm32mp157a-dk1.dtb.o
lwl-$(CONFIG_MACH_LXA_MC1) += stm32mp157c-lxa-mc1.dtb.o
diff --git a/arch/arm/dts/at91-skov-arm9cpu.dts b/arch/arm/dts/at91-skov-arm9cpu.dts
new file mode 100644
index 0000000000..8e4fddfd3f
--- /dev/null
+++ b/arch/arm/dts/at91-skov-arm9cpu.dts
@@ -0,0 +1,451 @@
+// SPDX-License-Identifier: GPL-2.0
+// SPDX-FileCopyrightText: 2018 Sam Ravnborg <sam@ravnborg.org>
+
+/*
+ * Device Tree file for SKOV ARM9 CPU board with 128 MB RAM and
+ * Logic Technology Display
+ */
+
+/dts-v1/;
+
+#include "arm/at91sam9263.dtsi"
+
+/ {
+ model = "SKOV ARM9 CPU";
+ compatible = "skov,arm9-cpu", "atmel,at91sam9263", "atmel,at91sam9";
+
+ chosen {
+ stdout-path = "serial0:115200n8";
+
+ environment {
+ compatible = "barebox,environment";
+ device-path = &environment_nor;
+ };
+ };
+
+ flash: nor_flash@10000000 {
+ compatible = "cfi-flash";
+ reg = <0x10000000 0x4000000>;
+ linux,mtd-name = "physmap-flash.0";
+ bank-width = <2>;
+ #address-cells = <1>;
+ #size-cells = <1>;
+
+ partitions {
+ compatible = "fixed-partitions";
+ #address-cells = <1>;
+ #size-cells = <1>;
+
+ barebox@0 {
+ label = "bootloader";
+ reg = <0x00000 0x80000>;
+ };
+
+ environment_nor: env@80000 {
+ label = "environment";
+ reg = <0x80000 0x20000>;
+ };
+
+ linux@a0000 {
+ label = "linux";
+ reg = <0xa0000 0x2a0000>;
+ };
+
+ rootfs@340000 {
+ label = "rootfs";
+ reg = <0x340000 0x3cc0000>;
+ };
+ };
+ };
+
+ leds {
+ compatible = "gpio-leds";
+
+ D0 {
+ label = "D0";
+ gpios = <&pioD 0 GPIO_ACTIVE_LOW>;
+ linux,default-trigger = "heartbeat";
+ };
+
+ D1 {
+ label = "D1";
+ gpios = <&pioD 1 GPIO_ACTIVE_LOW>;
+ linux,default-trigger = "mmc0";
+ };
+
+ D2 {
+ label = "D2";
+ gpios = <&pioD 7 GPIO_ACTIVE_LOW>;
+ };
+
+ led_0 {
+ label = "led_0";
+ gpios = <&pioB 14 GPIO_ACTIVE_LOW>;
+ };
+
+ led_1 {
+ label = "led_1";
+ gpios = <&pioB 23 GPIO_ACTIVE_LOW>;
+ };
+
+ led_2 {
+ label = "led_2";
+ gpios = <&pioB 18 GPIO_ACTIVE_LOW>;
+ };
+
+ led_3 {
+ label = "led_3";
+ gpios = <&pioB 22 GPIO_ACTIVE_LOW>;
+ };
+
+ led_4 {
+ label = "led_4";
+ gpios = <&pioA 22 GPIO_ACTIVE_LOW>;
+ };
+
+ led_5 {
+ label = "led_5";
+ gpios = <&pioA 23 GPIO_ACTIVE_LOW>;
+ };
+
+ led_6 {
+ label = "led_6";
+ gpios = <&pioA 24 GPIO_ACTIVE_LOW>;
+ };
+
+ led_7 {
+ label = "led_7";
+ gpios = <&pioA 20 GPIO_ACTIVE_LOW>;
+ };
+ };
+
+ i2c-gpio-0 {
+ status = "okay";
+
+ 24c512@50 {
+ compatible = "24c512";
+ reg = <0x50>;
+ pagesize = <128>;
+ };
+ };
+
+ rotary-encoder {
+ compatible = "rotary-encoder";
+ gpios = <&pioB 19 GPIO_ACTIVE_LOW>, <&pioB 20 GPIO_ACTIVE_LOW>;
+ linux,axis = <0>; /* REL_X */
+ rotary-encoder,steps-per-period = <4>;
+ rotary-encoder,relative-axis;
+ };
+
+ gpio-keys {
+ compatible = "gpio-keys";
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ rotary_button {
+ label = "rotary_button";
+ gpios = <&pioB 15 GPIO_ACTIVE_LOW>;
+ debounce-interval = <10>;
+ linux,code = <28>; /* enter */
+ };
+ };
+
+ matrix-keypad-6x5 {
+ compatible = "gpio-matrix-keypad";
+ debounce-delay-ms = <10>;
+ col-scan-delay-us = <10>;
+
+ row-gpios = <&pioB 25 GPIO_ACTIVE_HIGH /* 1 */
+ &pioB 21 GPIO_ACTIVE_HIGH /* 2 */
+ &pioB 16 GPIO_ACTIVE_HIGH /* 3 */
+ &pioB 24 GPIO_ACTIVE_HIGH /* 4 */
+ &pioB 12 GPIO_ACTIVE_HIGH>; /* 5 */
+
+ col-gpios = <&pioB 13 GPIO_ACTIVE_HIGH /* 1 */
+ &pioB 17 GPIO_ACTIVE_HIGH /* 2 */
+ &pioA 25 GPIO_ACTIVE_HIGH /* 3 */
+ &pioA 21 GPIO_ACTIVE_HIGH /* 4 */
+ &pioA 19 GPIO_ACTIVE_HIGH /* 5 */
+ &pioA 18 GPIO_ACTIVE_HIGH>; /* 6 */
+
+
+ linux,keymap = <
+ 0x00000011 /* col0 row0 KEY_W */
+ 0x01000021 /* col0 row1 KEY_F */
+ 0x02000031 /* col0 row2 KEY_N */
+ 0x03000041 /* col0 row3 KEY_F7 */
+ 0x04000051 /* col0 row4 KEY_KP3 */
+ 0x00010012 /* col1 row0 KEY_E */
+ 0x01010022 /* col1 row1 KEY_G */
+ 0x02010032 /* col1 row2 KEY_M */
+ 0x03010042 /* col1 row3 KEY_F8 */
+ 0x04010052 /* col1 row4 KEY_KP0 */
+ 0x00020013 /* col2 row0 KEY_R */
+ 0x01020023 /* col2 row1 KEY_H */
+ 0x02020033 /* col2 row2 KEY_COMMA */
+ 0x03020043 /* col2 row3 KEY_F9 */
+ 0x04020053 /* col2 row4 KEY_F9 */
+ 0x00030014 /* col3 row0 KEY_T */
+ 0x01030024 /* col3 row1 KEY_J */
+ 0x02030034 /* col3 row2 KEY_DOT */
+ 0x03030044 /* col3 row3 KEY_NUMLOCK */
+ 0x04030054 /* col3 row4 */
+ 0x00040015 /* col4 row0 KEY_Y */
+ 0x01040025 /* col4 row1 KEY_K */
+ 0x02040035 /* col4 row2 KEY_SLASH */
+ 0x03040045 /* col4 row3 KEY_NUMLOCK */
+ 0x04040055 /* col4 row4 KEY_ZENKAKUHANKAKU */
+ 0x00050016 /* col5 row0 KEY_U */
+ 0x01050026 /* col5 row1 KEY_L */
+ 0x02050036 /* col5 row2 KEY_RIGH_SHIFT */
+ 0x03050046 /* col5 row3 KEY_SCROLLLOCK */
+ 0x04050056 /* col5 row4 KEY_102ND */
+ >;
+ };
+};
+
+&{/ahb/apb} {
+ pinctrl: pinctrl@fffff200 {
+ };
+
+ watchdog@fffffd40 {
+ status = "okay";
+ };
+};
+
+&dbgu {
+ status = "okay";
+};
+
+&fb0 {
+ status = "okay";
+ display = <&display0>;
+ display0: display0 {
+ bits-per-pixel = <16>;
+ atmel,lcdcon-backlight;
+ atmel,dmacon = <0x1>;
+ atmel,lcdcon2 = <0x80008002>;
+ atmel,guard-time = <1>;
+ atmel,lcd-wiring-mode = "BRG";
+ pinctrl-names = "default";
+ pinctrl-0 = <
+ &pinctrl_board_fb
+ &pinctrl_disp_type
+ &pinctrl_logic_type
+ >;
+
+ atmel,power-control-gpio = <&pioA 30 GPIO_ACTIVE_HIGH>;
+
+ display-timings {
+ native-mode = <&l2rt>;
+
+ l2rt: l2rt {
+ /* LTTD800480070-L2RT @ 55 */
+ clock-frequency = <30000000>;
+ hactive = <800>;
+ vactive = <480>;
+ /* Atmel calculation
+ * Horizontal =
+ * Hsync + left margin + picture + right_margin + 1
+ * (3 + 85 + 800 + 0 + 1 = 889)
+ */
+ hback-porch = <85>;
+ hfront-porch = <1>;
+ hsync-len = <3>;
+ /* Vertical =
+ * upper margin + picture + lower_margin
+ * (32 + 480 + 1 = 513) (25MHz / ( 889 * 513 ) = 54,8Hz
+ */
+ vback-porch = <32>;
+ vfront-porch = <1>;
+ vsync-len = <3>;
+ pixelclk-active = <1>;
+ hsync-active = <0>;
+ vsync-active = <0>;
+ de-active = <1>;
+ };
+
+ l6whrt: l6whrt {
+ clock-frequency = <33000000>;
+ hactive = <800>;
+ vactive = <480>;
+ hback-porch = <43>;
+ hfront-porch = <154>;
+ vback-porch = <20>;
+ vfront-porch = <47>;
+ hsync-len = <3>;
+ vsync-len = <3>;
+ pixelclk-active = <1>;
+ hsync-active = <0>;
+ vsync-active = <0>;
+ de-active = <1>;
+ };
+
+ seiko: seiko {
+ /* 70WVW2AZ0 @ 55 */
+ clock-frequency = <33000000>;
+ hactive = <800>;
+ vactive = <480>;
+ hback-porch = <0>;
+ hfront-porch = <256>;
+ vback-porch = <45>;
+ vfront-porch = <0>;
+ hsync-len = <0>;
+ vsync-len = <0>;
+ pixelclk-active = <1>;
+ hsync-active = <0>;
+ vsync-active = <0>;
+ de-active = <1>;
+ };
+ };
+ };
+};
+
+&macb0 {
+ status = "okay";
+ phy-mode = "rmii";
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ ethphy0: ethernet-phy@1 {
+ reg = <3>;
+ reset-gpios = <&pioE 17 GPIO_ACTIVE_LOW>;
+ reset-assert-us = <1000>;
+ reset-deassert-us = <100>;
+ };
+};
+
+&main_xtal {
+ clock-frequency = <16000000>;
+};
+
+&mmc1 {
+ status = "okay";
+ pinctrl-0 = <
+ &pinctrl_board_mmc1
+ &pinctrl_mmc1_clk
+ &pinctrl_mmc1_slot0_cmd_dat0
+ &pinctrl_mmc1_slot0_dat1_3>;
+ cd-gpios = <&pioE 18 GPIO_ACTIVE_HIGH>;
+ slot@0 {
+ reg = <0>;
+ bus-width = <4>;
+ cd-gpios = <&pioE 18 GPIO_ACTIVE_HIGH>;
+ wp-gpios = <&pioE 19 GPIO_ACTIVE_HIGH>;
+ };
+};
+
+&pinctrl {
+ mmc1 {
+ pinctrl_board_mmc1: mmc1-board {
+ atmel,pins =
+ <AT91_PIOE 18 AT91_PERIPH_GPIO
+ AT91_PINCTRL_PULL_UP_DEGLITCH /* PE18 gpio CD pin pull up and deglitch */
+ AT91_PIOE 19 AT91_PERIPH_GPIO AT91_PINCTRL_PULL_UP>; /* PE19 gpio WP pin pull up */
+ };
+ };
+
+ display_type_inputs {
+ pinctrl_disp_type: disp_type-0 {
+ /* Pull-up (HIGH) if Seiko display, otherwise Logic display */
+ atmel,pins =
+ <AT91_PIOD 2 AT91_PERIPH_GPIO AT91_PINCTRL_PULL_UP>;
+ };
+ pinctrl_logic_type: logic_type-0 {
+ /* Pull-down (LOW) if l6whrt display, otherwise l2rt display */
+ atmel,pins =
+ <AT91_PIOC 28 AT91_PERIPH_GPIO AT91_PINCTRL_PULL_UP>;
+ };
+ };
+
+ fb {
+ pinctrl_board_fb: fb-0 {
+ atmel,pins =
+ <AT91_PIOC 0 AT91_PERIPH_A AT91_PINCTRL_NONE /* LCDVSYNC */
+ AT91_PIOC 1 AT91_PERIPH_A AT91_PINCTRL_NONE /* LCDHSYNC */
+ AT91_PIOC 2 AT91_PERIPH_A AT91_PINCTRL_NONE /* LCDDOTCK */
+ AT91_PIOC 3 AT91_PERIPH_A AT91_PINCTRL_NONE /* LCDDEN */
+ AT91_PIOB 9 AT91_PERIPH_B AT91_PINCTRL_NONE /* LCDCC */
+ AT91_PIOC 6 AT91_PERIPH_A AT91_PINCTRL_NONE /* LCDD2 */
+ AT91_PIOC 7 AT91_PERIPH_A AT91_PINCTRL_NONE /* LCDD3 */
+ AT91_PIOC 8 AT91_PERIPH_A AT91_PINCTRL_NONE /* LCDD4 */
+ AT91_PIOC 9 AT91_PERIPH_A AT91_PINCTRL_NONE /* LCDD5 */
+ AT91_PIOC 10 AT91_PERIPH_A AT91_PINCTRL_NONE /* LCDD6 */
+ AT91_PIOC 11 AT91_PERIPH_A AT91_PINCTRL_NONE /* LCDD7 */
+ AT91_PIOC 14 AT91_PERIPH_A AT91_PINCTRL_NONE /* LCDD10 */
+ AT91_PIOC 15 AT91_PERIPH_A AT91_PINCTRL_NONE /* LCDD11 */
+ AT91_PIOC 16 AT91_PERIPH_A AT91_PINCTRL_NONE /* LCDD12 */
+ AT91_PIOC 12 AT91_PERIPH_B AT91_PINCTRL_NONE /* LCDD13 */
+ AT91_PIOC 18 AT91_PERIPH_A AT91_PINCTRL_NONE /* LCDD14 */
+ AT91_PIOC 19 AT91_PERIPH_A AT91_PINCTRL_NONE /* LCDD15 */
+ AT91_PIOC 22 AT91_PERIPH_A AT91_PINCTRL_NONE /* LCDD18 */
+ AT91_PIOC 23 AT91_PERIPH_A AT91_PINCTRL_NONE /* LCDD19 */
+ AT91_PIOC 24 AT91_PERIPH_A AT91_PINCTRL_NONE /* LCDD20 */
+ AT91_PIOC 17 AT91_PERIPH_B AT91_PINCTRL_NONE /* LCDD21 */
+ AT91_PIOC 26 AT91_PERIPH_A AT91_PINCTRL_NONE /* LCDD22 */
+ AT91_PIOC 27 AT91_PERIPH_A AT91_PINCTRL_NONE>; /* LCDD23 */
+ };
+ };
+
+ pwm0 {
+ pinctrl_pwm0: pwm0_pwm1 {
+ atmel,pins = <AT91_PIOB 8 AT91_PERIPH_B AT91_PINCTRL_NONE>;
+ };
+ };
+};
+
+&pwm0 {
+ status = "okay";
+ pinctrl-names = "default";
+ pinctrl-0 = <&pinctrl_pwm0>;
+};
+
+&slow_xtal {
+ clock-frequency = <32768>;
+};
+
+&spi0 {
+ status = "okay";
+ cs-gpios = <&pioA 3 0>, <&pioB 11 0>;
+
+ mcp3002@0 {
+ compatible = "microchip,mcp3002";
+ reg = <0>;
+ spi-max-frequency = <750000>;
+ };
+
+ tsc2046@1 {
+ compatible = "ti,tsc2046";
+ reg = <1>;
+ interrupts-extended = <&pioA 15 IRQ_TYPE_EDGE_BOTH>;
+ spi-max-frequency = <500000>;
+ pendown-gpio = <&pioA 15 GPIO_ACTIVE_LOW>;
+
+ ti,x-min = /bits/ 16 <800>;
+ ti,x-max = /bits/ 16 <3830>;
+ ti,y-min = /bits/ 16 <500>;
+ ti,y-max = /bits/ 16 <3830>;
+ ti,vref-delay-usecs = /bits/ 16 <300>;
+ ti,x-plate-ohms = /bits/ 16 <642>;
+ ti,y-plate-ohms = /bits/ 16 <295>;
+ ti,pressure-max = /bits/ 16 <1500>;
+ ti,debounce-rep = /bits/ 16 <8>;
+ ti,debounce-tol = /bits/ 16 <(~0)>;
+ ti,debounce-max = /bits/ 16 <100>;
+
+ wakeup-source;
+ };
+};
+
+&usart0 {
+ status = "okay";
+ pinctrl-0 = <
+ &pinctrl_usart0
+ &pinctrl_usart0_rts
+ &pinctrl_usart0_cts>;
+};
+
+&usb0 {
+ status = "okay";
+ num-ports = <2>;
+};
diff --git a/arch/arm/mach-at91/Kconfig b/arch/arm/mach-at91/Kconfig
index 52eefc7361..810c00d495 100644
--- a/arch/arm/mach-at91/Kconfig
+++ b/arch/arm/mach-at91/Kconfig
@@ -577,6 +577,17 @@ config AT91_MULTI_BOARDS
if AT91_MULTI_BOARDS
+config MACH_SKOV_ARM9CPU
+ bool "SKOV ARM9 CPU"
+ select SOC_AT91SAM9263
+ select OFDEVICE
+ select COMMON_CLK_OF_PROVIDER
+ select HAVE_AT91_USB_CLK
+ select HAVE_AT91_BOOTSTRAP
+ select AT91SAM926X_BOARD_INIT
+ help
+ Say y here if you are using SKOV's ARM9 CPU board
+
config MACH_AT91SAM9263EK
bool "Atmel AT91SAM9263-EK"
select SOC_AT91SAM9263
diff --git a/arch/sandbox/board/env/init/state b/arch/sandbox/board/env/init/state
index 0b8e40409f..b8a2b42a53 100644
--- a/arch/sandbox/board/env/init/state
+++ b/arch/sandbox/board/env/init/state
@@ -5,8 +5,9 @@ fi
source /env/data/ansi-colors
echo -e $CYAN
-echo "******************************************************************"
-echo "*** Inconsistent barebox state buckets detected on first boot ***"
-echo "*** barebox will repair them on next shutdown ***"
-echo "*****************************************************************"
+echo "*******************************************************"
+echo "*** Inconsistent barebox state buckets detected ***"
+echo "*** This is normal for a first boot ***"
+echo "*** barebox will repair them on next poweroff/reset ***"
+echo "*******************************************************"
echo -e -n $NC
diff --git a/arch/sandbox/board/env/nv/autoboot b/arch/sandbox/board/env/nv/autoboot
new file mode 100644
index 0000000000..f7d13fd046
--- /dev/null
+++ b/arch/sandbox/board/env/nv/autoboot
@@ -0,0 +1 @@
+abort
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index e942c79cbd..311c3d1a8e 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -9,17 +9,7 @@ config X86
config ARCH_TEXT_BASE
hex
- default 0x00007c00 if MACH_X86_GENERIC
- default 0x0 if MACH_EFI_GENERIC
-
-config BOARD_LINKER_SCRIPT
- bool
- default n
-
-config GENERIC_LINKER_SCRIPT
- bool
- default y
- depends on !BOARD_LINKER_SCRIPT
+ default 0x0
menu "ARCH specific settings"
@@ -45,51 +35,18 @@ config X86_64
endmenu
-config X86_BOOTLOADER
- bool
- select X86_32
- select HAS_MODULES
- select HAVE_CONFIGURABLE_MEMORY_LAYOUT
- select HAVE_CONFIGURABLE_TEXT_BASE
-
-choice
- prompt "Select your board"
-
-config MACH_X86_GENERIC
- bool "Generic x86"
- select X86_BOOTLOADER
- depends on !X86_EFI
- help
- Say Y here if you want barebox to be your BIOS based bootloader
-
config MACH_EFI_GENERIC
- bool "Generic EFI"
- depends on X86_EFI
+ def_bool y
+ depends on X86_EFI
select HAS_DEBUG_LL
help
Say Y here if you want barebox to be your EFI based bootloader
-endchoice
-
-choice
- prompt "Bring up type"
- config X86_EFI
- bool "EFI"
- select EFI_BOOTUP
- select EFI_GUID
- select EFI_DEVICEPATH
- select PRINTF_UUID
- select CLOCKSOURCE_EFI_X86
-
- config X86_BIOS_BRINGUP
- bool "16 bit BIOS"
- help
- Barebox will act as a BIOS based bootloader. This includes
- some 16 bit real mode code and some restrictions everyone knows
- from BIOS based systems.
-
-endchoice
-
-source "arch/x86/boot/Kconfig"
-source "arch/x86/mach-i386/Kconfig"
+config X86_EFI
+ def_bool y
+ select EFI_BOOTUP
+ select EFI_GUID
+ select EFI_DEVICEPATH
+ select PRINTF_UUID
+ select CLOCKSOURCE_EFI_X86
diff --git a/arch/x86/Makefile b/arch/x86/Makefile
index 61e51abc71..fd871ca214 100644
--- a/arch/x86/Makefile
+++ b/arch/x86/Makefile
@@ -1,12 +1,9 @@
-KBUILD_DEFCONFIG := generic_defconfig
+KBUILD_DEFCONFIG := efi_defconfig
KBUILD_CPPFLAGS += -D__X86__
-board-$(CONFIG_MACH_X86_GENERIC) := x86_generic
-
TEXT_BASE = $(CONFIG_TEXT_BASE)
-ifeq ($(CONFIG_X86_EFI),y)
machine-y := efi
KBUILD_CFLAGS += -fpic -fshort-wchar -mno-sse -mno-mmx
ifeq ($(CONFIG_X86_32),y)
@@ -14,13 +11,6 @@ ifeq ($(CONFIG_X86_32),y)
else
TARGET = efi-app-x86_64
endif
-else
-KBUILD_CPPFLAGS += -fno-strict-aliasing
-KBUILD_CPPFLAGS += -march=i386 -DTEXT_BASE=$(TEXT_BASE) \
- -fno-unwind-tables -fno-asynchronous-unwind-tables
-
-machine-y := i386
-endif
ifeq ($(CONFIG_X86_32),y)
UTS_MACHINE := i386
@@ -48,25 +38,17 @@ machdirs := $(patsubst %,arch/x86/mach-%/,$(machine-y))
KBUILD_CPPFLAGS += $(patsubst %,-I$(srctree)/%include,$(machdirs))
-ifneq ($(board-y),)
-BOARD := arch/x86/boards/$(board-y)/
-else
-BOARD :=
-endif
-
ifneq ($(machine-y),)
MACH := arch/x86/mach-$(machine-y)/
else
MACH :=
endif
-common-y += $(BOARD) $(MACH)
+common-y += $(MACH)
common-y += arch/x86/lib/
-common-$(CONFIG_X86_BIOS_BRINGUP) += arch/x86/bios/
# arch/x86/cpu/
-ifeq ($(CONFIG_X86_EFI),y)
lds-$(CONFIG_X86_32) := arch/x86/mach-efi/elf_ia32_efi.lds
lds-$(CONFIG_X86_64) := arch/x86/mach-efi/elf_x86_64_efi.lds
@@ -92,16 +74,6 @@ barebox.efi: $(KBUILD_BINARY) FORCE
KBUILD_IMAGE := barebox.efi
-else
-common-y += arch/x86/boot/
-
-lds-$(CONFIG_GENERIC_LINKER_SCRIPT) := arch/x86/lib/barebox.lds
-lds-$(CONFIG_BOARD_LINKER_SCRIPT) := $(BOARD)/barebox.lds
-
-endif
-
KBUILD_LDFLAGS += -m elf_$(UTS_MACHINE)
CLEAN_FILES += $(lds-y)
-CLEAN_FILES += arch/x86/lib/barebox.lds barebox.map barebox.S
-
diff --git a/arch/x86/bios/Makefile b/arch/x86/bios/Makefile
deleted file mode 100644
index 414ee42a4a..0000000000
--- a/arch/x86/bios/Makefile
+++ /dev/null
@@ -1,3 +0,0 @@
-obj-y += memory16.o
-obj-y += traveler.o
-obj-y += bios_disk.o
diff --git a/arch/x86/bios/bios_disk.S b/arch/x86/bios/bios_disk.S
deleted file mode 100644
index c2a824ed6e..0000000000
--- a/arch/x86/bios/bios_disk.S
+++ /dev/null
@@ -1,57 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0-or-later */
-/* SPDX-FileCopyrightText: 2009 Juergen Beisert, Pengutronix */
-/* SPDX-FileCopyrightText: 1999-2008 Free Software Foundation, Inc. */
-
-/* Mostly stolen from the GRUB2 project */
-
-/**
- * @file
- * @brief Do BIOS calls to load or save data from disks
- *
- * @note These functions are running in flat and real mode. Due to some
- * other restrictions these routines must running from an address
- * space below 0x10000
- */
-
-/*
- * int bios_disk_rw_int13_extensions (int ah, int drive, void *dap)
- *
- * Call IBM/MS INT13 Extensions (int 13 %ah=AH) for DRIVE. DAP
- * is passed for disk address packet. If an error occurs, return
- * non-zero, otherwise zero.
- */
- .section .boot.text.bios_disk_rw_int13_extensions, "ax"
- .code32
- .globl bios_disk_rw_int13_extensions
- .type bios_disk_rw_int13_extensions, @function
-
- .extern prot_to_real
- .extern real_to_prot
-
-bios_disk_rw_int13_extensions:
- pushl %ebp
- pushl %esi
-
- /* compute the address of disk_address_packet */
- movw %cx, %si
- xorw %cx, %cx
- shrl $4, %ecx /* save the segment to cx */
-
- movb %al, %dh
- call prot_to_real /* enter real mode right now */
-
- .code16
- movb %dh, %ah
- movw %cx, %ds
- int $0x13 /* do the operation */
- movb %ah, %dl /* save return value */
- /* back to protected mode */
- DATA32 call real_to_prot
-
- .code32
- movb %dl, %al /* return value in %eax */
-
- popl %esi
- popl %ebp
-
- ret
diff --git a/arch/x86/bios/memory16.S b/arch/x86/bios/memory16.S
deleted file mode 100644
index e4aef2f256..0000000000
--- a/arch/x86/bios/memory16.S
+++ /dev/null
@@ -1,54 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0-or-later */
-/* SPDX-FileCopyrightText: 2009 Juergen Beisert, Pengutronix */
-
-/* This code was inspired by the GRUB2 project. */
-
-/**
- * @file
- * @brief Query the memory layout information from the BIOS
- *
- * Note: This function is running in flat and real mode. Due to some
- * other restrictions it must running from an address space below 0x10000
- */
-
-/**
- * @fn unsigned short bios_get_memsize(void)
- * @brief Does a BIOS call "INT 15H, AH=88H" to get extended memory size
- * @return Extended memory size in KB
- *
- * @note This call is limited to 64 MiB. So, if the system provides more than
- * 64 MiB of memory, still 64 MiB are reported.
- *
- */
-
-
- .section .boot.text.bios_get_memsize, "ax"
- .code32
- .globl bios_get_memsize
- .type bios_get_memsize, @function
-
- .extern prot_to_real
-
-bios_get_memsize:
-
- pushl %ebp
-
- call prot_to_real /* enter real mode */
- .code16
-
- movb $0x88, %ah
- int $0x15
-
- movw %ax, %dx
-
- DATA32 call real_to_prot
-
- .code32
-
- movw %dx, %ax
-
- popl %ebp
- ret
-
- .size bios_get_memsize, .-bios_get_memsize
-
diff --git a/arch/x86/bios/traveler.S b/arch/x86/bios/traveler.S
deleted file mode 100644
index 1c11c9dc74..0000000000
--- a/arch/x86/bios/traveler.S
+++ /dev/null
@@ -1,166 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0-or-later */
-/* SPDX-FileCopyrightText: 2009 Juergen Beisert, Pengutronix */
-
-/* Mostly stolen from the GRUB2 project */
-
-/**
- * @file
- * @brief Switch from the flat mode world into the real mode world and vice versa
- *
- * Note: These functions are *called* and return in a different operating mode
- */
-
-/**
- * @fn void real_to_prot(void)
- * @brief Switch from temp. real mode back to flat mode
- *
- * Called from a 32 bit flat mode segment and returns into a 16 bit segment
- */
-
-/**
- * @fn void prot_to_real(void)
- * @brief Switch from flat mode to real mode
- *
- * Called from a 16 bit real mode segment and returns into a 32 bit segment
- */
-
-#include <asm/modes.h>
-
- .file "walkyrie.S"
-
-/* keep the current flat mode stack pointer, while playing in real mode */
- .section .boot.data.protstack
- .code32
-protstack: .long 4
-/* temp. store */
-return_addr: .long 4
-
-
- .section .boot.text.real_to_prot, "ax"
- .code16
- .globl real_to_prot
- .type real_to_prot, @function
-
-/* Note: This routine should not change any other standard registers than eax */
-real_to_prot:
- /*
- * Always disable the interrupts, when returning to flat mode
- */
- cli
-
- /* turn on protected mode */
- movl %cr0, %eax
- orl $0x00000001, %eax
- movl %eax, %cr0
-
- /* jump to relocation, flush prefetch queue, and reload %cs */
- DATA32 ljmp $__BOOT_CS, $return_to_flatmode
- .size real_to_prot, .-real_to_prot
-
-/* ----------------------------------------------------------------------- */
- .section .boot.text.return_to_flatmode, "ax"
- .type return_to_flatmode, @function
- .code32
-
-return_to_flatmode:
- /* reload other segment registers */
- movw $__BOOT_DS, %ax
- movw %ax, %ds
- movw %ax, %es
- movw %ax, %fs
- movw %ax, %gs
- movw %ax, %ss
-
- /* move the return address from the real mode to the flat mode stack */
- movl (%esp), %eax
- movl %eax, return_addr
-
- /* setup again the flat mode stack */
- movl protstack, %eax
- movl %eax, %esp
- movl %eax, %ebp
-
- movl return_addr, %eax
- movl %eax, (%esp)
-
- /* flag we returned happy here */
- xorl %eax, %eax
- ret
- .size return_to_flatmode, .-return_to_flatmode
-
-/* ------------------------------------------------------------------------ */
-
-/* Note: This routine should not change any other standard registers than eax */
-
- .section .boot.text.prot_to_real, "ax"
- .globl prot_to_real
- .type prot_to_real, @function
- .extern boot_stack
- .code32
-
-prot_to_real:
- /* save the protected mode stack */
- movl %esp, %eax
- movl %eax, protstack
-
- /* prepare the real mode stack */
- /* - address to call to the top of this stack */
- movl (%esp), %eax
- movl %eax, boot_stack - 4
-
- /* - the stack itself */
- movl $boot_stack - 4, %eax
- movl %eax, %esp
- movl %eax, %ebp
-
- /* prepare segments limits to 16 bit */
- movw $__REAL_DS, %ax
- movw %ax, %ds
- movw %ax, %es
- movw %ax, %fs
- movw %ax, %gs
- movw %ax, %ss
-
- /* at last, also limit the code segment to 16 bit */
- ljmp $__REAL_CS, $return_to_realmode
- .size prot_to_real, .-prot_to_real
-
-/* ----------------------------------------------------------------------- */
-
- .section .boot.text.return_to_realmode, "ax"
- .globl return_to_realmode
- .type return_to_realmode, @function
- .code16
-
-return_to_realmode:
- /* disable protected mode */
- movl %cr0, %eax
- andl $(~0x00000001), %eax
- movl %eax, %cr0
-
- /*
- * all the protected mode settings are still cached in the CPU.
- * Refresh them by re-loading all registers in realmode
- * Start with the CS, continue with the data registers
- */
- ljmp $0, $enter_realmode
-
-enter_realmode:
- xorl %eax, %eax
- movw %ax, %ds
- movw %ax, %es
- movw %ax, %fs
- movw %ax, %gs
- movw %ax, %ss
- /*
- * back in plain real mode now, we can play again with the BIOS
- */
-
- /* restore interrupts */
- sti
-
- /* return on realmode stack! */
- DATA32 ret
-
- .size return_to_realmode, .-return_to_realmode
-
diff --git a/arch/x86/boards/x86_generic/Makefile b/arch/x86/boards/x86_generic/Makefile
deleted file mode 100644
index fca707dd8b..0000000000
--- a/arch/x86/boards/x86_generic/Makefile
+++ /dev/null
@@ -1,4 +0,0 @@
-obj-y += generic_pc.o
-obj-$(CONFIG_DISK_INTF_PLATFORM_IDE) += intf_platform_ide.o
-obj-$(CONFIG_DISK_BIOS) += disk_bios_drive.o
-obj-$(CONFIG_DRIVER_SERIAL_NS16550) += serial_ns16550.o
diff --git a/arch/x86/boards/x86_generic/disk_bios_drive.c b/arch/x86/boards/x86_generic/disk_bios_drive.c
deleted file mode 100644
index c8e9ae8523..0000000000
--- a/arch/x86/boards/x86_generic/disk_bios_drive.c
+++ /dev/null
@@ -1,33 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-// SPDX-FileCopyrightText: 2009 Juergen Beisert, Pengutronix
-
-/**
- * @file
- * @brief Generic PC support for the BIOS disk interface
- */
-
-#include <common.h>
-#include <driver.h>
-#include <init.h>
-#include <linux/err.h>
-#include "envsector.h"
-
-static int bios_disk_init(void)
-{
- struct cdev *cdev;
-
- add_generic_device("biosdrive", DEVICE_ID_DYNAMIC, NULL, 0, 0,
- IORESOURCE_MEM, NULL);
-
- if (pers_env_size != PATCH_AREA_PERS_SIZE_UNUSED) {
- cdev = devfs_add_partition("biosdisk0",
- pers_env_storage * 512,
- (unsigned)pers_env_size * 512,
- DEVFS_PARTITION_FIXED, "env0");
- printf("Partition: %ld\n", IS_ERR(cdev) ? PTR_ERR(cdev) : 0);
- } else
- printf("No persistent storage defined\n");
-
- return 0;
-}
-device_initcall(bios_disk_init);
diff --git a/arch/x86/boards/x86_generic/env/bin/boot b/arch/x86/boards/x86_generic/env/bin/boot
deleted file mode 100644
index fcfffe3194..0000000000
--- a/arch/x86/boards/x86_generic/env/bin/boot
+++ /dev/null
@@ -1,37 +0,0 @@
-#!/bin/sh
-
-. /env/config
-
-if [ x$1 = xdisk ]; then
- root=disk
- kernel=disk
-fi
-
-if [ x$1 = xnet ]; then
- root=net
- kernel=net
-fi
-
-if [ x$ip = xdhcp ]; then
- bootargs="$bootargs ip=dhcp"
-else
- bootargs="$bootargs ip=$eth0.ipaddr:$eth0.serverip:$eth0.gateway:$eth0.netmask:::"
-fi
-
-if [ x$root = xdisk ]; then
- bootargs="$bootargs root=$rootpart_disk rootfstype=$rootpart_fs rw"
-else
- bootargs="$bootargs root=/dev/nfs nfsroot=$eth0.serverip:$nfsroot,v3,tcp rw"
-fi
-
-if [ $kernel = net ]; then
- if [ x$ip = xdhcp ]; then
- dhcp
- fi
- tftp $uimage uImage || exit 1
- bootm uImage
-else
- bootargs="BOOT_IMAGE=$kernel_device auto $bootargs"
- linux16 $kernel_device
-fi
-
diff --git a/arch/x86/boards/x86_generic/env/bin/init b/arch/x86/boards/x86_generic/env/bin/init
deleted file mode 100644
index 2924a4449a..0000000000
--- a/arch/x86/boards/x86_generic/env/bin/init
+++ /dev/null
@@ -1,15 +0,0 @@
-#!/bin/sh
-
-PATH=/env/bin
-export PATH
-
-. /env/config
-
-echo
-echo -n "Hit any key to stop autoboot: "
-timeout -a $autoboot_timeout
-if [ $? != 0 ]; then
- exit
-fi
-
-boot
diff --git a/arch/x86/boards/x86_generic/env/config b/arch/x86/boards/x86_generic/env/config
deleted file mode 100644
index dd57aad716..0000000000
--- a/arch/x86/boards/x86_generic/env/config
+++ /dev/null
@@ -1,31 +0,0 @@
-#
-# basic config
-#
-# boot source: 'disk' or 'net'
-kernel=disk
-root=disk
-
-# data for the NFS case
-nfsroot="/path/to/nfs_root"
-
-# data for the disk case
-kernel_device=/dev/biosdisk0.1
-rootpart_disk=/dev/sda1
-rootpart_fs=ext2
-
-baudrate=115200
-serial=ttyS0
-
-# use UART for console
-bootargs="console=$serial,$baudrate"
-
-autoboot_timeout=3
-
-# use 'dhcp' to do dhcp in uboot and in kernel
-# ip=dhcp
-# or set your networking parameters here
-# eth0.ipaddr=192.168.3.11
-# eth0.netmask=255.255.255.0
-# eth0.gateway=a.b.c.d
-# eth0.serverip=192.168.3.10
-# eth0.ethaddr=aa.bb.cc.dd.ee.ff
diff --git a/arch/x86/boards/x86_generic/envsector.h b/arch/x86/boards/x86_generic/envsector.h
deleted file mode 100644
index 57a6d2a21f..0000000000
--- a/arch/x86/boards/x86_generic/envsector.h
+++ /dev/null
@@ -1,24 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0-or-later */
-
-/**
- * @file
- * @brief x86 Generic PC common definitions
- */
-#ifndef __X86_ENVSECTOR_H
-#define __ENVSECTOR_H
-
-/*
- * These datas are from the MBR, created by the linker and filled by the
- * setup tool while installing barebox on the disk drive
- */
-extern uint64_t pers_env_storage;
-extern uint16_t pers_env_size;
-extern uint8_t pers_env_drive;
-
-/**
- * Persistent environment "not used" marker.
- * Note: Must be in accordance to the value the tool "setup_mbr" writes.
- */
-#define PATCH_AREA_PERS_SIZE_UNUSED 0x000
-
-#endif
diff --git a/arch/x86/boards/x86_generic/generic_pc.c b/arch/x86/boards/x86_generic/generic_pc.c
deleted file mode 100644
index 2f1db7aca1..0000000000
--- a/arch/x86/boards/x86_generic/generic_pc.c
+++ /dev/null
@@ -1,18 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-// SPDX-FileCopyrightText: 2009 Juergen Beisert, Pengutronix
-
-#include <common.h>
-#include <types.h>
-#include <driver.h>
-#include <init.h>
-#include <asm/syslib.h>
-#include <linux/err.h>
-
-static int devices_init(void)
-{
- /* extended memory only */
- add_mem_device("ram0", 0x0, bios_get_memsize() << 10,
- IORESOURCE_MEM_WRITEABLE);
- return 0;
-}
-device_initcall(devices_init);
diff --git a/arch/x86/boards/x86_generic/intf_platform_ide.c b/arch/x86/boards/x86_generic/intf_platform_ide.c
deleted file mode 100644
index 0db031484f..0000000000
--- a/arch/x86/boards/x86_generic/intf_platform_ide.c
+++ /dev/null
@@ -1,80 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-// SPDX-FileCopyrightText: 2014 Juergen Beisert, Pengutronix
-// SPDX-FileCopyrightText: 2014 Michel Stam, Fugro Intersite
-
-/**
- * @file
- * @brief Generic PC support for the IDE platform driver
- */
-
-#include <common.h>
-#include <driver.h>
-#include <init.h>
-#include <linux/err.h>
-#include <platform_data/ide.h>
-#include "envsector.h"
-
-static struct ide_port_info ide_plat = {
- .ioport_shift = 0,
- .dataif_be = 0,
-};
-
-static struct resource primary_ide_resources[] = {
- {
- .name = "base",
- .start = 0x1f0,
- .end = 0x1f7,
- .flags = IORESOURCE_IO
- },
- {
- .name = "alt",
- .start = 0x3f6,
- .end = 0x3f7,
- .flags = IORESOURCE_IO
- }
-};
-
-static struct resource secondary_ide_resources[] = {
- {
- .name = "base",
- .start = 0x170,
- .end = 0x177,
- .flags = IORESOURCE_IO
- },
-};
-
-static struct device_d primary_ide_device = {
- .name = "ide_intf",
- .id = 0,
- .platform_data = &ide_plat,
- .resource = primary_ide_resources,
- .num_resources = ARRAY_SIZE(primary_ide_resources),
-};
-
-static struct device_d secondary_ide_device = {
- .name = "ide_intf",
- .id = 1,
- .platform_data = &ide_plat,
- .resource = secondary_ide_resources,
- .num_resources = ARRAY_SIZE(secondary_ide_resources),
-};
-
-static int platform_ide_init(void)
-{
- struct cdev *cdev;
-
- platform_device_register(&primary_ide_device);
- platform_device_register(&secondary_ide_device);
-
- if (pers_env_size != PATCH_AREA_PERS_SIZE_UNUSED) {
- cdev = devfs_add_partition("ata0",
- pers_env_storage * 512,
- (unsigned)pers_env_size * 512,
- DEVFS_PARTITION_FIXED, "env0");
- printf("Partition: %ld\n", IS_ERR(cdev) ? PTR_ERR(cdev) : 0);
- } else
- printf("No persistent storage defined\n");
-
- return 0;
-}
-device_initcall(platform_ide_init);
diff --git a/arch/x86/boards/x86_generic/serial_ns16550.c b/arch/x86/boards/x86_generic/serial_ns16550.c
deleted file mode 100644
index 4159bc39fb..0000000000
--- a/arch/x86/boards/x86_generic/serial_ns16550.c
+++ /dev/null
@@ -1,35 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-// SPDX-FileCopyrightText: 2009 Juergen Beisert, Pengutronix
-// SPDX-FileCopyrightText: 2009 Michel Stam, Fugro Intersite
-
-/**
- * @file
- * @brief Generic PC support to let barebox acting as a boot loader
- */
-
-#include <common.h>
-#include <types.h>
-#include <driver.h>
-#include <init.h>
-#include <asm/syslib.h>
-#include <platform_data/serial-ns16550.h>
-#include <linux/err.h>
-
-static struct NS16550_plat serial_plat = {
- .clock = 1843200,
-};
-
-static int pc_console_init(void)
-{
- barebox_set_model("X86 generic barebox");
- barebox_set_hostname("x86");
-
- /* Register the serial port */
- add_ns16550_device(DEVICE_ID_DYNAMIC, 0x3f8, 8, IORESOURCE_IO,
- &serial_plat);
- add_ns16550_device(DEVICE_ID_DYNAMIC, 0x2f8, 8, IORESOURCE_IO,
- &serial_plat);
-
- return 0;
-}
-console_initcall(pc_console_init);
diff --git a/arch/x86/boot/Kconfig b/arch/x86/boot/Kconfig
deleted file mode 100644
index 8dba00d591..0000000000
--- a/arch/x86/boot/Kconfig
+++ /dev/null
@@ -1,20 +0,0 @@
-if X86_BIOS_BRINGUP
-
-menu "BIOS boot source"
-
-config X86_HDBOOT
- bool "HD boot"
- help
- Add code to boot from harddisk
-
-config X86_VESA
- bool
- default y if X86_GENERIC_HAS_VIDEO
-
-config X86_VGA
- bool
- default y if X86_GENERIC_HAS_VIDEO
-
-endmenu
-
-endif
diff --git a/arch/x86/boot/Makefile b/arch/x86/boot/Makefile
deleted file mode 100644
index 4a520a2a84..0000000000
--- a/arch/x86/boot/Makefile
+++ /dev/null
@@ -1,13 +0,0 @@
-
-KBUILD_CPPFLAGS += -D__I386__ -fno-strict-aliasing -m32 -g -Os -march=i386 \
- -mregparm=3 -fno-strict-aliasing -fomit-frame-pointer -ffreestanding \
- -fno-toplevel-reorder -fno-unit-at-a-time -fno-stack-protector \
- -mpreferred-stack-boundary=2
-
-obj-$(CONFIG_X86_HDBOOT) += boot_main.o boot_hdisk.o
-
-obj-$(CONFIG_X86_BIOS_BRINGUP) += prepare_uboot.o a20.o bioscall.o regs.o tty.o pmjump.o main_entry.o
-
-obj-$(CONFIG_X86_VESA) += console_vesa.o
-obj-$(CONFIG_X86_VGA) += console_vga.o
-obj-$(CONFIG_X86_SERIAL) += console_serial.o
diff --git a/arch/x86/boot/a20.c b/arch/x86/boot/a20.c
deleted file mode 100644
index f501feeedd..0000000000
--- a/arch/x86/boot/a20.c
+++ /dev/null
@@ -1,166 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-only
-// SPDX-FileCopyrightText: 1991,1992 Linus Torvalds
-// SPDX-FileCopyrightText: 2007-2008 rPath, Inc.
-// SPDX-FileCopyrightText: 2009 Intel Corporation
-
-/* Author: H. Peter Anvin and others */
-
-/*
- * Enable A20 gate (return -1 on failure)
- */
-
-#include <asm/segment.h>
-#include <io.h>
-#include "boot.h"
-
-#define MAX_8042_LOOPS 100000
-#define MAX_8042_FF 32
-
-/* be aware of: */
-THIS_IS_REALMODE_CODE
-
-static int __bootcode empty_8042(void)
-{
- u8 status;
- int loops = MAX_8042_LOOPS;
- int ffs = MAX_8042_FF;
-
- while (loops--) {
- io_delay();
-
- status = inb(0x64);
- if (status == 0xff) {
- /* FF is a plausible, but very unlikely status */
- if (!--ffs)
- return -1; /* Assume no KBC present */
- }
- if (status & 1) {
- /* Read and discard input data */
- io_delay();
- (void)inb(0x60);
- } else if (!(status & 2)) {
- /* Buffers empty, finished! */
- return 0;
- }
- }
-
- return -1;
-}
-
-/* Returns nonzero if the A20 line is enabled. The memory address
- used as a test is the int $0x80 vector, which should be safe. */
-
-#define A20_TEST_ADDR (4*0x80)
-#define A20_TEST_SHORT 32
-#define A20_TEST_LONG 2097152 /* 2^21 */
-
-static int __bootcode a20_test(int loops)
-{
- int ok = 0;
- int saved, ctr;
-
- set_fs(0x0000);
- set_gs(0xffff);
-
- saved = ctr = rdfs32(A20_TEST_ADDR);
-
- while (loops--) {
- wrfs32(++ctr, A20_TEST_ADDR);
- io_delay(); /* Serialize and make delay constant */
- ok = rdgs32(A20_TEST_ADDR+0x10) ^ ctr;
- if (ok)
- break;
- }
-
- wrfs32(saved, A20_TEST_ADDR);
- return ok;
-}
-
-/* Quick test to see if A20 is already enabled */
-static int __bootcode a20_test_short(void)
-{
- return a20_test(A20_TEST_SHORT);
-}
-
-/* Longer test that actually waits for A20 to come on line; this
- is useful when dealing with the KBC or other slow external circuitry. */
-static int __bootcode a20_test_long(void)
-{
- return a20_test(A20_TEST_LONG);
-}
-
-static void __bootcode enable_a20_bios(void)
-{
- struct biosregs ireg;
-
- initregs(&ireg);
- ireg.ax = 0x2401;
- intcall(0x15, &ireg, NULL);
-}
-
-static void __bootcode enable_a20_kbc(void)
-{
- empty_8042();
-
- outb(0xd1, 0x64); /* Command write */
- empty_8042();
-
- outb(0xdf, 0x60); /* A20 on */
- empty_8042();
-
- outb(0xff, 0x64); /* Null command, but UHCI wants it */
- empty_8042();
-}
-
-static void __bootcode enable_a20_fast(void)
-{
- u8 port_a;
-
- port_a = inb(0x92); /* Configuration port A */
- port_a |= 0x02; /* Enable A20 */
- port_a &= ~0x01; /* Do not reset machine */
- outb(port_a, 0x92);
-}
-
-/*
- * Actual routine to enable A20; return 0 on ok, -1 on failure
- */
-
-#define A20_ENABLE_LOOPS 255 /* Number of times to try */
-
-int __bootcode enable_a20(void)
-{
- int loops = A20_ENABLE_LOOPS;
- int kbc_err;
-
- while (loops--) {
- /* First, check to see if A20 is already enabled
- (legacy free, etc.) */
- if (a20_test_short())
- return 0;
-
- /* Next, try the BIOS (INT 0x15, AX=0x2401) */
- enable_a20_bios();
- if (a20_test_short())
- return 0;
-
- /* Try enabling A20 through the keyboard controller */
- kbc_err = empty_8042();
-
- if (a20_test_short())
- return 0; /* BIOS worked, but with delayed reaction */
-
- if (!kbc_err) {
- enable_a20_kbc();
- if (a20_test_long())
- return 0;
- }
-
- /* Finally, try enabling the "fast A20 gate" */
- enable_a20_fast();
- if (a20_test_long())
- return 0;
- }
-
- return -1;
-}
diff --git a/arch/x86/boot/bioscall.S b/arch/x86/boot/bioscall.S
deleted file mode 100644
index 6cda1eb40a..0000000000
--- a/arch/x86/boot/bioscall.S
+++ /dev/null
@@ -1,90 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0-or-later */
-/* SPDX-FileCopyrightText: 2009 Intel Corporation */
-
-/* Author: H. Peter Anvin */
-
-/*
- * "Glove box" for BIOS calls. Avoids the constant problems with BIOSes
- * touching registers they shouldn't be.
- */
-
- .file "bioscall.S"
- .code16
- .section .boot.text.intcall, "ax"
-
- .globl intcall
- .type intcall, @function
-intcall:
- /* Self-modify the INT instruction. Ugly, but works. */
- cmpb %al, 3f
- je 1f
- movb %al, 3f
- jmp 1f /* Synchronize pipeline */
-1:
- /* Save state */
- pushfl
- pushw %fs
- pushw %gs
- pushal
-
- /* Copy input state to stack frame */
- subw $44, %sp
- movw %dx, %si
- movw %sp, %di
- movw $11, %cx
- rep; movsd
-
- /* Pop full state from the stack */
- popal
- popw %gs
- popw %fs
- popw %es
- popw %ds
- popfl
-
- /* Actual INT */
- .byte 0xcd /* INT opcode */
-3: .byte 0
-
- /* Push full state to the stack */
- pushfl
- pushw %ds
- pushw %es
- pushw %fs
- pushw %gs
- pushal
-
- /* Re-establish C environment invariants */
- cld
- movzwl %sp, %esp
- movw %cs, %ax
- movw %ax, %ds
- movw %ax, %es
-
- /* Copy output state from stack frame */
- movw 68(%esp), %di /* Original %cx == 3rd argument */
- andw %di, %di
- jz 4f
- movw %sp, %si
- movw $11, %cx
- rep; movsd
-4: addw $44, %sp
-
- /* Restore state and return */
- popal
- popw %gs
- popw %fs
- popfl
- retl
- .size intcall, .-intcall
-
-/* ------------------------------------------------------------------------ */
- .code16
- .section .boot.text.die, "ax"
-
- .globl die
- .type die, @function
-die:
- hlt
- jmp die
- .size die, .-die
diff --git a/arch/x86/boot/boot.h b/arch/x86/boot/boot.h
deleted file mode 100644
index 54483c46c6..0000000000
--- a/arch/x86/boot/boot.h
+++ /dev/null
@@ -1,189 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0-only */
-/* SPDX-FileCopyrightText: 1991,1992 Linus Torvalds */
-/* SPDX-FileCopyrightText: 2007 rPath, Inc. */
-/* SPDX-FileCopyrightText: 2009 Intel Corporation */
-
-/* Author: H. Peter Anvin and others */
-
-/**
- * @file
- * @brief Main declarations for the real mode code
- */
-
-#ifndef BOOT_BOOT_H
-#define BOOT_BOOT_H
-
-#define STACK_SIZE 512 /* Minimum number of bytes for stack */
-
-/** Carry flag */
-#define X86_EFLAGS_CF 0x00000001
-
-/** PE flag */
-#define X86_CR0_PE 0x00000001
-
-#ifndef __ASSEMBLY__
-
-#include <types.h>
-
-/* we are still in real mode here! */
-#define THIS_IS_REALMODE_CODE asm(".code16gcc");
-
-struct biosregs {
- union {
- struct {
- uint32_t edi;
- uint32_t esi;
- uint32_t ebp;
- uint32_t _esp;
- uint32_t ebx;
- uint32_t edx;
- uint32_t ecx;
- uint32_t eax;
- uint32_t _fsgs;
- uint32_t _dses;
- uint32_t eflags;
- };
- struct {
- uint16_t di, hdi;
- uint16_t si, hsi;
- uint16_t bp, hbp;
- uint16_t _sp, _hsp;
- uint16_t bx, hbx;
- uint16_t dx, hdx;
- uint16_t cx, hcx;
- uint16_t ax, hax;
- uint16_t gs, fs;
- uint16_t es, ds;
- uint16_t flags, hflags;
- };
- struct {
- uint8_t dil, dih, edi2, edi3;
- uint8_t sil, sih, esi2, esi3;
- uint8_t bpl, bph, ebp2, ebp3;
- uint8_t _spl, _sph, _esp2, _esp3;
- uint8_t bl, bh, ebx2, ebx3;
- uint8_t dl, dh, edx2, edx3;
- uint8_t cl, ch, ecx2, ecx3;
- uint8_t al, ah, eax2, eax3;
- };
- };
-};
-
-/* functions in the realmode part */
-extern int enable_a20(void);
-extern void initregs(struct biosregs *regs);
-extern void intcall(uint8_t int_no, const struct biosregs *ireg, struct biosregs *oreg);
-extern void boot_puts(char*);
-extern void __attribute__((noreturn)) die(void);
-extern void __attribute__((noreturn)) protected_mode_jump(void);
-
-struct gdt_ptr {
- uint16_t len;
- uint32_t ptr;
-} __attribute__((packed));
-
-/* These functions are used to reference data in other segments. */
-
-static inline uint16_t ds(void)
-{
- uint16_t seg;
- asm("movw %%ds,%0" : "=rm" (seg));
- return seg;
-}
-
-static inline void set_fs(uint16_t seg)
-{
- asm volatile("movw %0,%%fs" : : "rm" (seg));
-}
-
-static inline uint16_t fs(void)
-{
- uint16_t seg;
- asm volatile("movw %%fs,%0" : "=rm" (seg));
- return seg;
-}
-
-static inline void set_gs(uint16_t seg)
-{
- asm volatile("movw %0,%%gs" : : "rm" (seg));
-}
-
-static inline uint16_t gs(void)
-{
- uint16_t seg;
- asm volatile("movw %%gs,%0" : "=rm" (seg));
- return seg;
-}
-
-typedef unsigned int addr_t;
-
-static inline uint8_t rdfs8(addr_t addr)
-{
- uint8_t v;
- asm volatile("movb %%fs:%1,%0" : "=q" (v) : "m" (*(uint8_t *)addr));
- return v;
-}
-static inline uint16_t rdfs16(addr_t addr)
-{
- uint16_t v;
- asm volatile("movw %%fs:%1,%0" : "=r" (v) : "m" (*(uint16_t *)addr));
- return v;
-}
-static inline uint32_t rdfs32(addr_t addr)
-{
- uint32_t v;
- asm volatile("movl %%fs:%1,%0" : "=r" (v) : "m" (*(uint32_t *)addr));
- return v;
-}
-
-static inline void wrfs8(uint8_t v, addr_t addr)
-{
- asm volatile("movb %1,%%fs:%0" : "+m" (*(uint8_t *)addr) : "qi" (v));
-}
-static inline void wrfs16(uint16_t v, addr_t addr)
-{
- asm volatile("movw %1,%%fs:%0" : "+m" (*(uint16_t *)addr) : "ri" (v));
-}
-static inline void wrfs32(uint32_t v, addr_t addr)
-{
- asm volatile("movl %1,%%fs:%0" : "+m" (*(uint32_t *)addr) : "ri" (v));
-}
-
-static inline uint8_t rdgs8(addr_t addr)
-{
- uint8_t v;
- asm volatile("movb %%gs:%1,%0" : "=q" (v) : "m" (*(uint8_t *)addr));
- return v;
-}
-static inline uint16_t rdgs16(addr_t addr)
-{
- uint16_t v;
- asm volatile("movw %%gs:%1,%0" : "=r" (v) : "m" (*(uint16_t *)addr));
- return v;
-}
-static inline uint32_t rdgs32(addr_t addr)
-{
- uint32_t v;
- asm volatile("movl %%gs:%1,%0" : "=r" (v) : "m" (*(uint32_t *)addr));
- return v;
-}
-
-static inline void wrgs8(uint8_t v, addr_t addr)
-{
- asm volatile("movb %1,%%gs:%0" : "+m" (*(uint8_t *)addr) : "qi" (v));
-}
-static inline void wrgs16(uint16_t v, addr_t addr)
-{
- asm volatile("movw %1,%%gs:%0" : "+m" (*(uint16_t *)addr) : "ri" (v));
-}
-static inline void wrgs32(uint32_t v, addr_t addr)
-{
- asm volatile("movl %1,%%gs:%0" : "+m" (*(uint32_t *)addr) : "ri" (v));
-}
-
-/** use the built in memset function for the real mode code */
-#define memset(d,c,l) __builtin_memset(d,c,l)
-
-#endif /* __ASSEMBLY__ */
-
-#endif /* BOOT_BOOT_H */
diff --git a/arch/x86/boot/boot_hdisk.S b/arch/x86/boot/boot_hdisk.S
deleted file mode 100644
index 6f98197512..0000000000
--- a/arch/x86/boot/boot_hdisk.S
+++ /dev/null
@@ -1,170 +0,0 @@
-/*
- * Copyright (C) 2009 Juergen Beisert, Pengutronix
- *
- * This code was inspired by the GRUB2 project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- *
- */
-
-/**
- * @file
- * @brief Loading the barebox image from a disk drive in LBA mode
- */
-
-/**
- * @fn void real_start(void)
- * @brief A very simple and small loader to fetch all required sectors
- * from the boot media.
- */
-
-
- .file "boot_hdisk.S"
- .code16
-
- /*
- * These symbols are generated by the linker, because they need a
- * special layout. This layout is needed to be able to setup this
- * bootloader by patching the binary when it gets stored into the
- * master boot record.
- */
- .extern indirect_sector_lba
- .extern boot_stack
- .extern start_pre_uboot
- .extern boot_disk
- .section .boot_code, "ax"
-
- .globl real_start
- .type real_start, @function
-
-real_start:
-
- xorw %ax, %ax /* set up %ds and %ss as offset from 0 */
- movw %ax, %ds
- movw %ax, %ss
-
- /* set up the REAL stack */
- movw $boot_stack, %sp
-
- sti /* we're safe again */
-
- /* save drive reference first thing! */
- movb %dl, boot_disk
- pushw %dx
-
- movw $notification_string, %si
- call output_message
-
- /*
- * This boot code only supports LBA. We fail here, if the BIOS
- * does not support LBA for the harddisk
- */
-
- /* check if LBA is supported */
- movb $0x41, %ah
- movw $0x55aa, %bx
- int $0x13
-
- /*
- * %dl may have been clobbered by INT 13, AH=41H.
- * This happens, for example, with AST BIOS 1.04.
- */
- popw %dx
- pushw %dx
-
- /* stop if no LBA support */
- jc no_lba
- cmpw $0xaa55, %bx
- jne no_lba
- andw $1, %cx
- jz no_lba
-
-lba_mode:
- /*
- * Load the indirect sector. Its content is ready for use,
- * provided by the installer
- */
- movw $indirect_sector_lba, %si
- movb $0x42, %ah
- int $0x13
- jc no_lba /* error? Then die */
-
- /*
- * Now loop through all valid entries in the indirect sector
- */
- movw $indirect_area, %si
-
-load_loop:
- /*
- * Stop if this "Disk Address Packet Structure" is invalid
- * We call it invalid, if the size member is zero. If it is invalid
- * we are optimistic and calling the loaded image
- */
- movw (%si), %ax
- cmpw $0x0000, %ax
- je start_main
-
- /*
- * Load this entry
- */
- movb $0x42, %ah
- int $0x13
- jc no_lba
-
- addw (%si), %si /* next entry */
- cmpw $indirect_area + 512, %si
- jne load_loop
- /*
- * fall through to start u-boot.
- */
-start_main:
- movw $jmp_string, %si
- call output_message
- jmp start_pre_uboot
-/*
- * die if there is no LBA support
- */
-no_lba: movw $chs_string, %si
- call output_message
- hlt
-
-/*
- * message: write the string pointed to by %si
- *
- * WARNING: trashes %si, %ax, and %bx
- */
-
-/*
- * Use BIOS "int 10H Function 0Eh" to write character in teletype mode
- * %ah = 0xe %al = character
- * %bh = page %bl = foreground color (graphics modes)
- */
-
-1:
- movw $0x0001, %bx
- movb $0xe, %ah
- int $0x10 /* display this char */
-
-output_message:
- lodsb
- cmpb $0, %al
- jne 1b /* if not end of string, next char */
- ret
-
-/* ---------------------------------------------------------------------- */
-
- .section .boot_data
-
-notification_string: .asciz "BAREBOX "
-chs_string: .asciz "CHS "
-jmp_string: .asciz "JMP "
-
diff --git a/arch/x86/boot/boot_main.S b/arch/x86/boot/boot_main.S
deleted file mode 100644
index 632b3f4ffa..0000000000
--- a/arch/x86/boot/boot_main.S
+++ /dev/null
@@ -1,39 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0-or-later */
-/* SPDX-FileCopyrightText: Juergen Beisert, Pengutronix */
-
-/* This code was inspired by the GRUB2 project. */
-
-/**
- * @file
- * @brief Common boot sector main routine to be entered by the BIOS
- */
-/**
- * @fn void _start(void)
- *
- * @brief Fix segment:offset settings of some buggy BIOSs
- */
-
-
- .file "boot_main.S"
- .code16
-
- .extern real_start
-
- .section .boot_start, "ax"
- .type _start, @function
-
- /*
- * The BIOS loads this code to address 0x00007c00.
- * The code should be called with CS:IP 0:0x7c00 (hopefully).
- */
- .globl _start
-_start:
- cli /* we're not safe here! */
- /*
- * It seems there are implementations in the wild which call this
- * code with CS:IP 0x07C0:0000 instead. We fix it immediately.
- */
- ljmp $0, $real_start
-
- .size _start, .-_start
-
diff --git a/arch/x86/boot/main_entry.c b/arch/x86/boot/main_entry.c
deleted file mode 100644
index b37aa38fca..0000000000
--- a/arch/x86/boot/main_entry.c
+++ /dev/null
@@ -1,24 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-// SPDX-FileCopyrightText: 2009 Juergen Beisert, Pengutronix
-
-/**
- * @file
- * @brief Start of the 32 bit flat mode
- */
-
-#include <string.h>
-#include <asm/sections.h>
-
-extern void x86_start_barebox(void);
-
-/**
- * Called plainly from assembler that switches from real to flat mode
- *
- * @note The C environment isn't initialized yet
- */
-void uboot_entry(void)
-{
- /* clear the BSS first */
- memset(__bss_start, 0x00, __bss_stop - __bss_start);
- x86_start_barebox();
-}
diff --git a/arch/x86/boot/pmjump.S b/arch/x86/boot/pmjump.S
deleted file mode 100644
index 4dd1881e65..0000000000
--- a/arch/x86/boot/pmjump.S
+++ /dev/null
@@ -1,82 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0-only */
-/* SPDX-FileCopyrightText: 1991,1992 Linus Torvalds */
-/* SPDX-FileCopyrightText: 2007 rPath, Inc. */
-
-/**
- * @file
- * @brief The actual transition into protected mode
- *
- * Note: This function is running in flat and real mode. Due to some
- * other restrictions it must running from an address space below 0x10000
- */
-
-/**
- * @fn void protected_mode_jump(void)
- * @brief Switches the first time from real mode to flat mode
- */
-
-#include <asm/modes.h>
-#include "boot.h"
-
- .file "pmjump.S"
- .code16
- .section .boot.text.protected_mode_jump, "ax"
-
- .globl protected_mode_jump
- .type protected_mode_jump, @function
-
-protected_mode_jump:
- jmp 1f /* Short jump to serialize on 386/486 */
-1:
-
- movw $__BOOT_DS, %cx
- movw $__BOOT_TSS, %di
-
- movl %cr0, %edx
- orb $X86_CR0_PE, %dl /* enable protected mode */
- movl %edx, %cr0
-
- /* Transition to 32-bit flat mode */
- data32 ljmp $__BOOT_CS, $in_pm32
- .size protected_mode_jump, .-protected_mode_jump
-
-/* ------------------------------------------------------------------------ */
-
- .section ".text.in_pm32","ax"
- .code32
-
- .extern uboot_entry
- .extern __bss_stop
-
- .type in_pm32, @function
-in_pm32:
- # Set up data segments for flat 32-bit mode
- movl %ecx, %ds
- movl %ecx, %es
- movl %ecx, %fs
- movl %ecx, %gs
- movl %ecx, %ss
-/*
- * Our flat mode code uses its own stack area behind the bss. With this we
- * are still able to return to real mode temporarely
- */
- movl $__bss_stop + 32768, %esp
-
- # Set up TR to make Intel VT happy
- ltr %di
-
- # Clear registers to allow for future extensions to the
- # 32-bit boot protocol
- xorl %ecx, %ecx
- xorl %edx, %edx
- xorl %ebx, %ebx
- xorl %ebp, %ebp
- xorl %edi, %edi
-
- # Set up LDTR to make Intel VT happy
- lldt %cx
-
- jmp uboot_entry
-
- .size in_pm32, .-in_pm32
-
diff --git a/arch/x86/boot/prepare_uboot.c b/arch/x86/boot/prepare_uboot.c
deleted file mode 100644
index 9cac594a46..0000000000
--- a/arch/x86/boot/prepare_uboot.c
+++ /dev/null
@@ -1,80 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-only
-// SPDX-FileCopyrightText: 1991,1992 Linus Torvalds
-// SPDX-FileCopyrightText: 2007 rPath, Inc.
-
-/*
- * Prepare the machine for transition to protected mode.
- */
-#include <asm/segment.h>
-#include <asm/modes.h>
-#include <io.h>
-#include "boot.h"
-
-/* be aware of: */
-THIS_IS_REALMODE_CODE
-
-/*
- * While we are in flat mode, we can't handle interrupts. But we can't
- * switch them off for ever in the PIC, because we need them again while
- * entering real mode code again and again....
- */
-static void __bootcode realmode_switch_hook(void)
-{
- asm volatile("cli");
- outb(0x80, 0x70); /* Disable NMI */
- io_delay();
-}
-
-/*
- * Reset IGNNE# if asserted in the FPU.
- */
-static void __bootcode reset_coprocessor(void)
-{
- outb(0, 0xf0);
- io_delay();
- outb(0, 0xf1);
- io_delay();
-}
-
-/**
- * Setup and register the global descriptor table (GDT)
- *
- * @note This is for the first time only
- */
-static void __bootcode setup_gdt(void)
-{
- /* Xen HVM incorrectly stores a pointer to the gdt_ptr, instead
- of the gdt_ptr contents. Thus, make it static so it will
- stay in memory, at least long enough that we switch to the
- proper kernel GDT. */
- static struct gdt_ptr __bootdata gdt_ptr;
-
- gdt_ptr.len = gdt_size - 1;
- gdt_ptr.ptr = (uint32_t)&gdt + (ds() << 4);
-
- asm volatile("lgdtl %0" : : "m" (gdt_ptr));
-}
-
-static char a20_message[] __bootdata = "A20 gate not responding, unable to boot...\n";
-
-/*
- * Actual invocation sequence
- */
-void __bootcode start_pre_uboot(void)
-{
- /* Hook before leaving real mode, also disables interrupts */
- realmode_switch_hook();
-
- /* Enable the A20 gate */
- if (enable_a20()) {
- boot_puts(a20_message);
- die();
- }
-
- /* Reset coprocessor (IGNNE#) */
- reset_coprocessor();
-
- setup_gdt();
- /* Actual transition to protected mode... */
- protected_mode_jump();
-}
diff --git a/arch/x86/boot/regs.c b/arch/x86/boot/regs.c
deleted file mode 100644
index 318b662175..0000000000
--- a/arch/x86/boot/regs.c
+++ /dev/null
@@ -1,29 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-// SPDX-FileCopyrightText: 2009 Intel Corporation
-
-/* Author: H. Peter Anvin */
-
-/**
- * @file
- * @brief Simple helper function for initializing a register set.
- *
- * Note that this sets EFLAGS_CF in the input register set; this
- * makes it easier to catch functions which do nothing but don't
- * explicitly set CF.
- */
-
-#include <asm/segment.h>
-#include "boot.h"
-
-/* be aware of: */
-THIS_IS_REALMODE_CODE
-
-void __bootcode initregs(struct biosregs *reg)
-{
- memset(reg, 0, sizeof *reg);
- reg->eflags |= X86_EFLAGS_CF;
- reg->ds = ds();
- reg->es = ds();
- reg->fs = fs();
- reg->gs = gs();
-}
diff --git a/arch/x86/boot/tty.c b/arch/x86/boot/tty.c
deleted file mode 100644
index 620197c677..0000000000
--- a/arch/x86/boot/tty.c
+++ /dev/null
@@ -1,41 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-only
-// SPDX-FileCopyrightText: 1991,1992 Linus Torvalds
-// SPDX-FileCopyrightText: 2007 rPath, Inc.
-// SPDX-FileCopyrightText: 2009 Intel Corporation
-
-/* Author: H. Peter Anvin and others */
-
-/**
- * @file
- * @brief Very simple screen I/O for the initialization stage
- *
- * @todo Probably should add very simple serial I/O?
- * @attention This is real mode code!
- */
-
-#include <asm/segment.h>
-#include "boot.h"
-
-/* be aware of: */
-THIS_IS_REALMODE_CODE
-
-static void __bootcode putchar(int ch)
-{
- struct biosregs ireg;
-
- if (ch == '\n')
- putchar('\r'); /* \n -> \r\n */
-
- initregs(&ireg);
- ireg.bx = 0x0007;
- ireg.cx = 0x0001;
- ireg.ah = 0x0e;
- ireg.al = ch;
- intcall(0x10, &ireg, NULL);
-}
-
-void __bootcode boot_puts(char *str)
-{
- while (*str)
- putchar(*str++);
-}
diff --git a/arch/x86/configs/generic_defconfig b/arch/x86/configs/generic_defconfig
deleted file mode 100644
index 4620280136..0000000000
--- a/arch/x86/configs/generic_defconfig
+++ /dev/null
@@ -1,26 +0,0 @@
-CONFIG_X86_BIOS_BRINGUP=y
-CONFIG_X86_HDBOOT=y
-CONFIG_STACK_SIZE=0x7000
-CONFIG_EXPERIMENTAL=y
-CONFIG_GLOB=y
-CONFIG_CMDLINE_EDITING=y
-CONFIG_AUTO_COMPLETE=y
-CONFIG_PARTITION=y
-CONFIG_DEFAULT_ENVIRONMENT_PATH="arch/x86/boards/x86_generic/env"
-CONFIG_LONGHELP=y
-CONFIG_CMD_MEMINFO=y
-# CONFIG_CMD_BOOTM is not set
-CONFIG_CMD_GO=y
-CONFIG_CMD_RESET=y
-CONFIG_CMD_EXPORT=y
-CONFIG_CMD_LOADENV=y
-CONFIG_CMD_PRINTENV=y
-CONFIG_CMD_SAVEENV=y
-# CONFIG_CMD_FALSE is not set
-CONFIG_CMD_SLEEP=y
-# CONFIG_CMD_TRUE is not set
-CONFIG_CMD_EDIT=y
-CONFIG_CMD_READLINE=y
-CONFIG_CMD_TIMEOUT=y
-CONFIG_DRIVER_SERIAL_NS16550=y
-# CONFIG_SPI is not set
diff --git a/arch/x86/include/asm/syslib.h b/arch/x86/include/asm/syslib.h
deleted file mode 100644
index 7e08cfd44e..0000000000
--- a/arch/x86/include/asm/syslib.h
+++ /dev/null
@@ -1,13 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0-or-later */
-/* SPDX-FileCopyrightText: 2009 Juergen Beisert, Pengutronix */
-
-#ifdef CONFIG_X86_BIOS_BRINGUP
-
-extern int bios_disk_rw_int13_extensions(int, int, void*) __attribute__((regparm(3)));
-extern uint16_t bios_get_memsize(void);
-
-#endif
-
-#ifdef CONFIG_CMD_LINUX16
-extern void bios_start_linux(unsigned) __attribute__((regparm(1)));
-#endif
diff --git a/arch/x86/lib/.gitignore b/arch/x86/lib/.gitignore
deleted file mode 100644
index d1165788c9..0000000000
--- a/arch/x86/lib/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-barebox.lds
diff --git a/arch/x86/lib/Makefile b/arch/x86/lib/Makefile
index 6a8fa7c0ff..360aebf569 100644
--- a/arch/x86/lib/Makefile
+++ b/arch/x86/lib/Makefile
@@ -1,11 +1,2 @@
-extra-$(CONFIG_GENERIC_LINKER_SCRIPT) += barebox.lds
-ifneq ($(CONFIG_X86_EFI),y)
-obj-y += memory.o
-obj-y += gdt.o
-endif
-
obj-$(CONFIG_X86_32) += setjmp_32.o
obj-$(CONFIG_X86_64) += setjmp_64.o
-
-# needed, when running via a 16 bit BIOS
-obj-$(CONFIG_CMD_LINUX16) += linux_start.o
diff --git a/arch/x86/lib/asm-offsets.c b/arch/x86/lib/asm-offsets.c
index 0f9c47eaa9..22f382b71e 100644
--- a/arch/x86/lib/asm-offsets.c
+++ b/arch/x86/lib/asm-offsets.c
@@ -6,13 +6,7 @@
#include <linux/kbuild.h>
-#ifdef CONFIG_EFI_BOOTUP
int main(void)
{
return 0;
}
-#else
-void common(void)
-{
-}
-#endif
diff --git a/arch/x86/lib/barebox.lds.S b/arch/x86/lib/barebox.lds.S
deleted file mode 100644
index b24c4807b5..0000000000
--- a/arch/x86/lib/barebox.lds.S
+++ /dev/null
@@ -1,161 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0-or-later */
-
-#undef i386
-#include <asm-generic/barebox.lds.h>
-
-OUTPUT_FORMAT("elf32-i386", "elf32-i386", "elf32-i386")
-OUTPUT_ARCH(i386)
-ENTRY(_start)
-
-MEMORY
-{
- mbr(rwx): ORIGIN = TEXT_BASE, LENGTH = 2 * SECTOR_SIZE
- barebox (rwx) : ORIGIN = TEXT_BASE + SECTOR_SIZE, LENGTH = (256 * 1024 * 1024)
-}
-
-SECTIONS
-{
-#ifdef CONFIG_X86_HDBOOT
-
- .ramlayout : {
- boot_stack = INDIRECT_AREA;
- indirect_area = INDIRECT_AREA;
- }
- /* describing the main boot sector */
- .bootsector : AT (0) {
- *(.boot_start)
-
- . = 0x00b;
- /*
- * Maybe later on occupied by a "BIOS parameter block". So,
- * keep it free from code.
- * - BytesPerSector dw@0x000B
- * - SectorsPerCluster db@0x000D
- * - ReservedSectors dw@0x000E
- * - FatCopies db@0x0010
- * - RootDirEntries dw@0x0011
- * - NumSectors dw@0x0013
- * - MediaType db@0x0015
- * - SectorsPerFAT dw@0x0016
- * - SectorsPerTrack dw@0x0018
- * - NumberOfHeads dw@0x001A
- * - HiddenSectors dd@0x001C
- * - SectorsBig dd@0x0020
- */
- LONG(0);
-
- . = 0x024;
- *(.boot_code)
- *(.boot_data)
-
- /*
- * embed one "Disk Address Packet Structure" into the boot sector
- * This DAPS points to the 'indirect' sector to give the boot code
- * an idea what and where to load. Its content must be adapted
- * to the system it should run on, so, this structure must be
- * located at a well known offset.
- */
- . = PATCH_AREA;
- indirect_sector_lba = .;
- SHORT(0x0010); /* size of this structure */
- SHORT(0x0001); /* one sector */
- SHORT(indirect_area); /* where to store: offset */
- SHORT(0x0000); /* where to store: segment */
- /* the following values are filled by the installer */
- LONG(0x00000000); /* LBA start lower */
- LONG(0x00000000); /* LBA start upper */
-
- /* boot disk number used by upper layers */
- . = PATCH_AREA + PATCH_AREA_BOOT_DEV;
- boot_disk = .;
- BYTE(0x00); /* boot disk number (provided by the BIOS)
-
- /* information about the persistent environment storage */
- . = PATCH_AREA + PATCH_AREA_PERS_START;
- pers_env_storage = .;
- LONG(0x00000000); /* LBA start lower */
- LONG(0x00000000); /* LBA start upper */
-
- . = PATCH_AREA + PATCH_AREA_PERS_SIZE;
- pers_env_size = .;
- SHORT(PATCH_AREA_PERS_SIZE_UNUSED); /* size of this area in sectors */
-
- . = PATCH_AREA + PATCH_AREA_PERS_DRIVE;
- pers_env_drive = .;
- BYTE(0x00); /* used drive */
-
- /* partition table area (fixed location) */
- . = OFFSET_OF_PARTITION_TABLE;
- /* create an empty one */
- LONG(0x00000000); LONG(0x00000000); LONG(0x00000000); LONG(0x00000000);
- LONG(0x00000000); LONG(0x00000000); LONG(0x00000000); LONG(0x00000000);
- LONG(0x00000000); LONG(0x00000000); LONG(0x00000000); LONG(0x00000000);
- LONG(0x00000000); LONG(0x00000000); LONG(0x00000000); LONG(0x00000000);
-
- /* boot sector signature */
- . = OFFSET_OF_SIGNATURE;
- BYTE(0x55);
- BYTE(0xAA);
- /* end of the first sector */
-
- /*
- * The indirect sector starts here
- */
- . = SECTOR_SIZE;
- BYTE(MARK_DAPS_INVALID); /* mark the first entry invalid */
- BYTE(0x00);
- . = SECTOR_SIZE + 496;
- BYTE(MARK_DAPS_INVALID); /* mark the last entry invalid */
- BYTE(0x00);
- . = SECTOR_SIZE + 508;
- LONG(0x00000000); /* LBA start upper */
- } > mbr
-
- /* some real mode bootstrapping */
- .bootstrapping : AT ( LOADADDR(.bootsector) + SIZEOF(.bootsector) ) {
- *(.boot.head)
- *(.boot.text*)
- *(.boot.rodata*)
- *(.boot.data*)
- . = ALIGN(4);
- RO_DATA_SECTION
- } > barebox
-#endif
-
- /* the main barebox part (32 bit) */
- .text : AT ( LOADADDR(.bootstrapping) + SIZEOF(.bootstrapping) ) {
- /* do not align here! It may fails with the LOADADDR! */
- _stext = .;
- _text = .;
- *(.text_entry*)
- __bare_init_start = .;
- *(.text_bare_init*)
- __bare_init_end = .;
- *(.text*)
- . = ALIGN(4);
- *(.rodata*)
- . = ALIGN(4);
- _etext = .; /* End of text and rodata section */
- } > barebox
- BAREBOX_BARE_INIT_SIZE
-
- _sdata = .;
- .data : AT ( LOADADDR(.text) + SIZEOF(.text) ) {
- *(.data*)
- . = ALIGN(4);
- } > barebox
-
- .got : AT ( LOADADDR(.data) + SIZEOF (.data) ) {
- *(.got*)
- . = ALIGN(4);
- } > barebox
-
- _edata = .;
- .bss : {
- __bss_start = .;
- *(.bss*);
- *( COMMON )
- __bss_stop = .;
- _end = .;
- } > barebox
-}
diff --git a/arch/x86/lib/gdt.c b/arch/x86/lib/gdt.c
deleted file mode 100644
index 4cd1622b6b..0000000000
--- a/arch/x86/lib/gdt.c
+++ /dev/null
@@ -1,38 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-// SPDX-FileCopyrightText: 2009 Juergen Beisert, Pengutronix
-
-/**
- * @file
- * @brief Definition of the Global Descriptor Table
- */
-
-#include <types.h>
-#include <asm/modes.h>
-#include <asm/segment.h>
-
-/**
- * The 'Global Descriptor Table' used in barebox
- *
- * Note: This table must reachable by real and flat mode code
- */
-uint64_t gdt[] __attribute__((aligned(16))) __bootdata = {
- /* CS: code, read/execute, 4 GB, base 0 */
- [GDT_ENTRY_BOOT_CS] = GDT_ENTRY(0xc09b, 0, 0xfffff),
- /* DS: data, read/write, 4 GB, base 0 */
- [GDT_ENTRY_BOOT_DS] = GDT_ENTRY(0xc093, 0, 0xfffff),
- /* CS: for real mode calls */
- [GDT_ENTRY_REAL_CS] = GDT_ENTRY(0x009E, 0, 0x0ffff),
- /* DS: for real mode calls */
- [GDT_ENTRY_REAL_DS] = GDT_ENTRY(0x0092, 0, 0x0ffff),
- /* TSS: 32-bit tss, 104 bytes, base 4096 */
- /* We only have a TSS here to keep Intel VT happy;
- we don't actually use it for anything. */
- [GDT_ENTRY_BOOT_TSS] = GDT_ENTRY(0x0089, 4096, 103),
-};
-
-/**
- * Size of the GDT must be known to load it
- *
- * Note: This varibale must reachable by real and flat mode code
- */
-unsigned gdt_size __bootdata = sizeof(gdt);
diff --git a/arch/x86/lib/linux_start.S b/arch/x86/lib/linux_start.S
deleted file mode 100644
index 07be37fed4..0000000000
--- a/arch/x86/lib/linux_start.S
+++ /dev/null
@@ -1,55 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0-or-later */
-/* SPDX-FileCopyrightText: 2009 Juergen Beisert, Pengutronix */
-/* SPDX-FileCopyrightText: 1999-2008 Free Software Foundation, Inc. */
-
-/* Mostly stolen from the GRUB2 project */
-
-/**
- * @file
- * @brief Start the Linux real mode setup code
- *
- * Note: These functions are running in flat and real mode. Due to some
- * other restrictions these routines must running from an address
- * space below 0x10000
- */
-
-/*
- * void bios_start_linux(unsigned segment)
- *
- */
-
- .section .boot.text.bios_start_linux, "ax"
- .code32
- .globl bios_start_linux
- .type bios_start_linux, @function
-
- .extern prot_to_real
-
-bios_start_linux:
- /* 'prot_to_real' eats our eax content */
- movl %eax, %ebx
- addl $0x20, %eax
- movw %ax, setup_seg
-
- call prot_to_real
-
- .code16
-
- cli
- /* all segment registers are using the same segment */
- movw %bx, %ss
- movw %bx, %ds
- movw %bx, %es
- movw %bx, %fs
- movw %bx, %gs
-
- /* stack for the setup code (end of heap) */
- movw $0x9000, %sp
-
- /* do an 'ljmp' and never return */
- .byte 0xea
- .word 0
-setup_seg:
- .word 0
-
- .code32
diff --git a/arch/x86/lib/memory.c b/arch/x86/lib/memory.c
deleted file mode 100644
index 64fbbb9300..0000000000
--- a/arch/x86/lib/memory.c
+++ /dev/null
@@ -1,49 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-// SPDX-FileCopyrightText: 2009 Juergen Beisert, Pengutronix
-
-/* This code was inspired by the GRUB2 project. */
-
-/**
- * @file
- * @brief Memory management
- */
-
-#include <common.h>
-#include <init.h>
-#include <stdio.h>
-#include <memory.h>
-#include <asm/syslib.h>
-#include <asm-generic/memory_layout.h>
-
-/**
- * Handling of free memory
- *
- * Topics:
- * - areas used by BIOS code
- * - The 0xa0000... 0xfffff hole
- * - memory above 0x100000
- */
-
-int x86_start_barebox(void)
-{
-#ifdef CONFIG_MEMORY_LAYOUT_DEFAULT
- unsigned long memory_size;
-
- memory_size = bios_get_memsize();
- memory_size <<= 10; /* BIOS reports in kiB */
-
- /*
- * We do not want to conflict with the kernel. So, we keep the
- * area from 0x100000 ... 0xFFFFFF free from usage
- */
- if (memory_size >= (15 * 1024 * 1024 + MALLOC_SIZE))
- mem_malloc_init((void*)(16 * 1024 * 1024),
- (void*)(16 * 1024 * 1024 + MALLOC_SIZE - 1));
- else
- return -1;
-#else
- mem_malloc_init((void *)MALLOC_BASE,
- (void *)(MALLOC_BASE + MALLOC_SIZE - 1));
-#endif
- start_barebox();
-}
diff --git a/arch/x86/mach-efi/elf_x86_64_efi.lds.S b/arch/x86/mach-efi/elf_x86_64_efi.lds.S
index ed79118a36..ab4a9e815c 100644
--- a/arch/x86/mach-efi/elf_x86_64_efi.lds.S
+++ b/arch/x86/mach-efi/elf_x86_64_efi.lds.S
@@ -42,6 +42,7 @@ SECTIONS
*(.got.plt)
*(.got)
*(.data*)
+ __bss_start = .;
*(.sdata)
/* the EFI loader doesn't seem to like a .bss section, so we stick
* it all into .data: */
@@ -51,7 +52,9 @@ SECTIONS
*(.bss)
*(COMMON)
*(.rel.local)
+ __bss_stop = .;
}
+ _edata = .;
. = ALIGN(4096);
.dynamic : { *(.dynamic) }
diff --git a/arch/x86/mach-i386/Kconfig b/arch/x86/mach-i386/Kconfig
deleted file mode 100644
index 2d0bfb4759..0000000000
--- a/arch/x86/mach-i386/Kconfig
+++ /dev/null
@@ -1,13 +0,0 @@
-
-menu "Board specific settings"
-
-if X86_BOOTLOADER
-
-config X86_GENERIC_HAS_VIDEO
- bool "video support"
- help
- Say Y here if the target supports a video output
-
-endif
-
-endmenu
diff --git a/arch/x86/mach-i386/Makefile b/arch/x86/mach-i386/Makefile
deleted file mode 100644
index 225b4811c5..0000000000
--- a/arch/x86/mach-i386/Makefile
+++ /dev/null
@@ -1,2 +0,0 @@
-# reference clocksource
-obj-y += pit_timer.o
diff --git a/arch/x86/mach-i386/include/mach/barebox.lds.h b/arch/x86/mach-i386/include/mach/barebox.lds.h
deleted file mode 100644
index 50f17340e4..0000000000
--- a/arch/x86/mach-i386/include/mach/barebox.lds.h
+++ /dev/null
@@ -1,82 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0-or-later */
-/* SPDX-FileCopyrightText: 2009 Juergen Beisert, Pengutronix */
-
-/**
- * @file
- * @brief Adapt linker script content in accordance to Kconfig settings
- */
-
-/**
- * Area in the MBR of the barebox basic boot code. This offset must be in
- * accordance to the 'indirect_sector_lba' label.
- */
-#define PATCH_AREA 400
-
-/**
- * Offset where to store the boot drive number (BIOS number, 1 byte)
- */
-#define PATCH_AREA_BOOT_DEV 16
-
-/**
- * Offset where to store information about the persistent environment storage
- * It points to an LBA number (8 bytes) and defines the first sector of this
- * storage on disk.
- */
-#define PATCH_AREA_PERS_START 20
-
-/**
- * Offset where to store information about the persistent environment storage
- * It points to a short number (2 bytes) and defines the sector count of this
- * storage on disk.
- */
-#define PATCH_AREA_PERS_SIZE 28
-
-/**
- * Offset where to store information about the persistent environment storage
- * drive number (BIOS number, 1 byte)
- */
-#define PATCH_AREA_PERS_DRIVE 30
-
-/**
- * Mark the persistent environment as not used
- */
-#define PATCH_AREA_PERS_SIZE_UNUSED 0x000
-
-/**
- * Mark a DAPS as unused/invalid
- */
-#define MARK_DAPS_INVALID 0x0000
-
-/**
- * Offset of the partition table in an MBR
- */
-#define OFFSET_OF_PARTITION_TABLE 446
-
-/**
- * Offset of the signature in an MBR
- */
-#define OFFSET_OF_SIGNATURE 510
-
-/**
- * Area where to store indirect sector to loop through. Keep this value
- * in accordance to the 'indirect_area' label. Note: .
- *
- * @attention These addresses are real mode ones (seg:offset)
- */
-#define INDIRECT_AREA 0x7A00
-#define INDIRECT_SEGMENT 0x0000
-
-/**
- * Area where to load sectors from disk to. They should start after the
- * MBR area and must be in accordance to the offset of the '.bootstrapping'
- * section in the linker file.
- *
- * @attention The address must be a multiple of 512.
- */
-#define LOAD_AREA 0x7e00
-#define LOAD_SEGMENT 0x0000
-
-/**
- * Size of one sector.
- */
-#define SECTOR_SIZE 512
diff --git a/arch/x86/mach-i386/pit_timer.c b/arch/x86/mach-i386/pit_timer.c
deleted file mode 100644
index d2da3b60d4..0000000000
--- a/arch/x86/mach-i386/pit_timer.c
+++ /dev/null
@@ -1,53 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-// SPDX-FileCopyrightText: 2009 Juergen Beisert, Pengutronix */
-
-/**
- * @file
- * @brief Clocksource based on the 'Programmable Interval Timer' PIT (8253)
- *
- * This timer should be available on almost all PCs. It also should be run
- * at a fixed frequency (1193181.8181 Hz) and not modified to use another
- * reload value than 0xFFFF. So, it always counts from 0xffff down to 0.
- *
- * @note: We can't reprogram the PIT, it will be still used by the BIOS. This
- * clocksource driver does not touch any PIT settings.
- */
-
-#include <init.h>
-#include <clock.h>
-#include <io.h>
-
-/** base address of the PIT in a standard PC */
-#define PIT 0x40
-
-static uint64_t pit_clocksource_read(void)
-{
- uint16_t val1, val2;
-
- outb(0x00, PIT + 3); /* latch counter 0 */
- outb(0x00, 0x80);
-
- val1 = inb(PIT);
- outb(0x00, 0x80);
-
- val2 = inb(PIT);
- val2 <<= 8;
-
- /* note: its a down counter */
- return 0xFFFFU - (val1 | val2);
-}
-
-static struct clocksource cs = {
- .read = pit_clocksource_read,
- .mask = CLOCKSOURCE_MASK(16),
- .shift = 10,
-};
-
-static int clocksource_init (void)
-{
- cs.mult = clocksource_hz2mult(1193182, cs.shift);
-
- return init_clock(&cs);
-}
-
-core_initcall(clocksource_init);