diff options
author | Ahmad Fatoum <a.fatoum@pengutronix.de> | 2021-03-23 08:50:34 +0100 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2021-03-25 13:25:51 +0100 |
commit | d44fdb7d9b8527c758deefc4262fedd6a121ffc6 (patch) | |
tree | 6d8f2c3218d1c745bda59eb6a9120c7ea6dadf3b /arch/x86/lib | |
parent | 41fd0332e797c0a3c6a0d9cbf14e7528f2a3209d (diff) | |
download | barebox-d44fdb7d9b8527c758deefc4262fedd6a121ffc6.tar.gz barebox-d44fdb7d9b8527c758deefc4262fedd6a121ffc6.tar.xz |
x86: drop legacy (PC BIOS) boot in favor of EFI
The 16-bit port has experienced bitrot and failed to compile with more
recent linkers for at least a year. Fixing the linker error is insufficient
to restore a barebox that can boot to shell. This continued breakage likely
means that there are no users interested in updating. As new x86 projects
should be using MACH_EFI_GENERIC anyway, retire support for 16-bit legacy
boot (MACH_X86_GENERIC).
Acked-by: Juergen Borleis <jbe@pengutronix.de>
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'arch/x86/lib')
-rw-r--r-- | arch/x86/lib/.gitignore | 1 | ||||
-rw-r--r-- | arch/x86/lib/Makefile | 9 | ||||
-rw-r--r-- | arch/x86/lib/asm-offsets.c | 6 | ||||
-rw-r--r-- | arch/x86/lib/barebox.lds.S | 161 | ||||
-rw-r--r-- | arch/x86/lib/gdt.c | 38 | ||||
-rw-r--r-- | arch/x86/lib/linux_start.S | 55 | ||||
-rw-r--r-- | arch/x86/lib/memory.c | 49 |
7 files changed, 0 insertions, 319 deletions
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(); -} |