summaryrefslogtreecommitdiff
path: root/arch
diff options
context:
space:
mode:
authorTom Rini <trini@konsulko.com>2022-01-15 15:39:09 +0300
committerTom Rini <trini@konsulko.com>2022-01-15 15:39:09 +0300
commitd71dbe657c3c22f50ecb3df133e5cdd884daae7d (patch)
treea7c4e1c7c88dfc3a06e5cea82570c7214988c6cc /arch
parent0962da92a1dfb210eef8c936e33862812fa1b208 (diff)
parent6b3873c5eaf6486db086df51d4cd61a933668f7b (diff)
downloadu-boot-d71dbe657c3c22f50ecb3df133e5cdd884daae7d.tar.xz
Merge tag 'efi-2022-04-rc1' of https://source.denx.de/u-boot/custodians/u-boot-efi
Pull request for efi-2022-04-rc1 Documentation: * Fix building HTML documentation of readthedocs.io * Add ARM Juno board documentation * Build requirements for Alpine Linux * Include DM headers in API documentation UEFI: * Fix section alignment of EFI binaries * Fix header length of RISC-V EFI binaries allowing to run them on EDK II * Remove kaslr-seed from device tree if the EFI_RNG_PROTOCOL is provided Other: * Let 'part list' show all 128 GPT partitions
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/lib/crt0_aarch64_efi.S5
-rw-r--r--arch/arm/lib/crt0_arm_efi.S5
-rw-r--r--arch/arm/lib/elf_aarch64_efi.lds4
-rw-r--r--arch/arm/lib/elf_arm_efi.lds4
-rw-r--r--arch/riscv/lib/crt0_riscv_efi.S15
-rw-r--r--arch/riscv/lib/elf_riscv32_efi.lds4
-rw-r--r--arch/riscv/lib/elf_riscv64_efi.lds4
-rw-r--r--arch/x86/config.mk15
-rw-r--r--arch/x86/cpu/config.mk2
-rw-r--r--arch/x86/cpu/efi/payload.c8
-rw-r--r--arch/x86/cpu/x86_64/cpu.c5
-rw-r--r--arch/x86/lib/Makefile5
-rw-r--r--arch/x86/lib/elf_x86_64_efi.lds5
-rw-r--r--arch/x86/lib/relocate.c2
14 files changed, 47 insertions, 36 deletions
diff --git a/arch/arm/lib/crt0_aarch64_efi.S b/arch/arm/lib/crt0_aarch64_efi.S
index 492195f765..7f38465359 100644
--- a/arch/arm/lib/crt0_aarch64_efi.S
+++ b/arch/arm/lib/crt0_aarch64_efi.S
@@ -47,8 +47,8 @@ optional_header:
extra_header_fields:
.quad 0 /* ImageBase */
- .long 0x20 /* SectionAlignment */
- .long 0x8 /* FileAlignment */
+ .long 0x200 /* SectionAlignment */
+ .long 0x200 /* FileAlignment */
.short 0 /* MajorOperatingSystemVersion */
.short 0 /* MinorOperatingSystemVersion */
.short 0 /* MajorImageVersion */
@@ -117,6 +117,7 @@ section_table:
.short 0 /* NumberOfLineNumbers (0 for executables) */
.long 0xe0500020 /* Characteristics (section flags) */
+ .align 9
_start:
stp x29, x30, [sp, #-32]!
mov x29, sp
diff --git a/arch/arm/lib/crt0_arm_efi.S b/arch/arm/lib/crt0_arm_efi.S
index cc8a115f31..75ee37b7d3 100644
--- a/arch/arm/lib/crt0_arm_efi.S
+++ b/arch/arm/lib/crt0_arm_efi.S
@@ -47,8 +47,8 @@ optional_header:
extra_header_fields:
.long 0 /* image_base */
- .long 0x20 /* SectionAlignment */
- .long 0x8 /* FileAlignment */
+ .long 0x200 /* SectionAlignment */
+ .long 0x200 /* FileAlignment */
.short 0 /* MajorOperatingSystemVersion */
.short 0 /* MinorOperatingSystemVersion */
.short 0 /* MajorImageVersion */
@@ -115,6 +115,7 @@ section_table:
.short 0 /* NumberOfLineNumbers (0 for executables) */
.long 0xe0500020 /* Characteristics (section flags) */
+ .align 9
_start:
stmfd sp!, {r0-r2, lr}
diff --git a/arch/arm/lib/elf_aarch64_efi.lds b/arch/arm/lib/elf_aarch64_efi.lds
index 90af469f48..c0604dad46 100644
--- a/arch/arm/lib/elf_aarch64_efi.lds
+++ b/arch/arm/lib/elf_aarch64_efi.lds
@@ -18,7 +18,7 @@ SECTIONS
*(.gnu.linkonce.t.*)
*(.srodata)
*(.rodata*)
- . = ALIGN(16);
+ . = ALIGN(512);
}
_etext = .;
_text_size = . - _text;
@@ -44,7 +44,7 @@ SECTIONS
*(.bss)
*(.bss.*)
*(COMMON)
- . = ALIGN(16);
+ . = ALIGN(512);
_bss_end = .;
_edata = .;
}
diff --git a/arch/arm/lib/elf_arm_efi.lds b/arch/arm/lib/elf_arm_efi.lds
index d6d742e868..767ebda635 100644
--- a/arch/arm/lib/elf_arm_efi.lds
+++ b/arch/arm/lib/elf_arm_efi.lds
@@ -18,7 +18,7 @@ SECTIONS
*(.gnu.linkonce.t.*)
*(.srodata)
*(.rodata*)
- . = ALIGN(16);
+ . = ALIGN(512);
}
_etext = .;
_text_size = . - _text;
@@ -44,7 +44,7 @@ SECTIONS
*(.bss)
*(.bss.*)
*(COMMON)
- . = ALIGN(16);
+ . = ALIGN(512);
_bss_end = .;
_edata = .;
}
diff --git a/arch/riscv/lib/crt0_riscv_efi.S b/arch/riscv/lib/crt0_riscv_efi.S
index b0a7a39a72..a01e08a3c6 100644
--- a/arch/riscv/lib/crt0_riscv_efi.S
+++ b/arch/riscv/lib/crt0_riscv_efi.S
@@ -71,8 +71,8 @@ extra_header_fields:
#else
.quad 0 /* ImageBase */
#endif
- .long 0x20 /* SectionAlignment */
- .long 0x8 /* FileAlignment */
+ .long 0x200 /* SectionAlignment */
+ .long 0x200 /* FileAlignment */
.short 0 /* MajorOperatingSystemVersion */
.short 0 /* MinorOperatingSystemVersion */
.short 1 /* MajorImageVersion */
@@ -110,16 +110,6 @@ extra_header_fields:
.quad 0 /* ExceptionTable */
.quad 0 /* CertificationTable */
.quad 0 /* BaseRelocationTable */
- .quad 0 /* Debug */
- .quad 0 /* Architecture */
- .quad 0 /* Global Ptr */
- .quad 0 /* TLS Table */
- .quad 0 /* Load Config Table */
- .quad 0 /* Bound Import */
- .quad 0 /* IAT */
- .quad 0 /* Delay Import Descriptor */
- .quad 0 /* CLR Runtime Header */
- .quad 0 /* Reserved */
/* Section table */
section_table:
@@ -158,6 +148,7 @@ section_table:
.short 0 /* NumberOfLineNumbers (0 for executables) */
.long 0xe0500020 /* Characteristics (section flags) */
+ .align 9
_start:
addi sp, sp, -(SIZE_LONG * 3)
SAVE_LONG(a0, 0)
diff --git a/arch/riscv/lib/elf_riscv32_efi.lds b/arch/riscv/lib/elf_riscv32_efi.lds
index 629705fc28..c3e0d20d57 100644
--- a/arch/riscv/lib/elf_riscv32_efi.lds
+++ b/arch/riscv/lib/elf_riscv32_efi.lds
@@ -20,7 +20,7 @@ SECTIONS
*(.gnu.linkonce.t.*)
*(.srodata)
*(.rodata*)
- . = ALIGN(16);
+ . = ALIGN(512);
}
_etext = .;
_text_size = . - _text;
@@ -46,7 +46,7 @@ SECTIONS
*(.bss)
*(.bss.*)
*(COMMON)
- . = ALIGN(16);
+ . = ALIGN(512);
_bss_end = .;
_edata = .;
}
diff --git a/arch/riscv/lib/elf_riscv64_efi.lds b/arch/riscv/lib/elf_riscv64_efi.lds
index aece030c37..ecb9139548 100644
--- a/arch/riscv/lib/elf_riscv64_efi.lds
+++ b/arch/riscv/lib/elf_riscv64_efi.lds
@@ -20,7 +20,7 @@ SECTIONS
*(.gnu.linkonce.t.*)
*(.srodata)
*(.rodata*)
- . = ALIGN(16);
+ . = ALIGN(512);
}
_etext = .;
_text_size = . - _text;
@@ -46,7 +46,7 @@ SECTIONS
*(.bss)
*(.bss.*)
*(COMMON)
- . = ALIGN(16);
+ . = ALIGN(512);
_bss_end = .;
_edata = .;
}
diff --git a/arch/x86/config.mk b/arch/x86/config.mk
index 589f2aed2b..889497b6bd 100644
--- a/arch/x86/config.mk
+++ b/arch/x86/config.mk
@@ -20,6 +20,11 @@ IS_32BIT := y
endif
endif
+EFI_IS_32BIT := $(IS_32BIT)
+ifdef CONFIG_EFI_STUB_64BIT
+EFI_IS_32BIT :=
+endif
+
ifeq ($(IS_32BIT),y)
PLATFORM_CPPFLAGS += -march=i386 -m32
else
@@ -44,8 +49,14 @@ CFLAGS_EFI := -fpic -fshort-wchar
# Compiler flags to be removed when building UEFI applications
CFLAGS_NON_EFI := -mregparm=3 -fstack-protector-strong
-ifeq ($(CONFIG_EFI_STUB_64BIT),)
+ifeq ($(IS_32BIT),y)
+EFIPAYLOAD_BFDARCH = i386
+else
CFLAGS_EFI += $(call cc-option, -mno-red-zone)
+EFIPAYLOAD_BFDARCH = x86_64
+endif
+
+ifeq ($(EFI_IS_32BIT),y)
EFIARCH = ia32
EFIPAYLOAD_BFDTARGET = elf32-i386
else
@@ -53,8 +64,6 @@ EFIARCH = x86_64
EFIPAYLOAD_BFDTARGET = elf64-x86-64
endif
-EFIPAYLOAD_BFDARCH = i386
-
LDSCRIPT_EFI := $(srctree)/arch/x86/lib/elf_$(EFIARCH)_efi.lds
EFISTUB := crt0_$(EFIARCH)_efi.o reloc_$(EFIARCH)_efi.o
OBJCOPYFLAGS_EFI += --target=efi-app-$(EFIARCH)
diff --git a/arch/x86/cpu/config.mk b/arch/x86/cpu/config.mk
index d3033b4160..87e242a206 100644
--- a/arch/x86/cpu/config.mk
+++ b/arch/x86/cpu/config.mk
@@ -9,7 +9,7 @@ LDPPFLAGS += -DRESET_VEC_LOC=$(CONFIG_RESET_VEC_LOC)
LDPPFLAGS += -DSTART_16=$(CONFIG_SYS_X86_START16)
ifdef CONFIG_X86_64
-ifndef CONFIG_SPL_BUILD
+ifeq ($(CONFIG_SPL_BUILD)$(CONFIG_EFI_APP),)
LDSCRIPT = $(srctree)/arch/x86/cpu/u-boot-64.lds
endif
endif
diff --git a/arch/x86/cpu/efi/payload.c b/arch/x86/cpu/efi/payload.c
index 04ce1880b4..b7778565b1 100644
--- a/arch/x86/cpu/efi/payload.c
+++ b/arch/x86/cpu/efi/payload.c
@@ -51,7 +51,7 @@ ulong board_get_usable_ram_top(ulong total_size)
end = (struct efi_mem_desc *)((ulong)map + size);
desc = map->desc;
- for (; desc < end; desc = efi_get_next_mem_desc(map, desc)) {
+ for (; desc < end; desc = efi_get_next_mem_desc(desc, map->desc_size)) {
if (desc->type != EFI_CONVENTIONAL_MEMORY ||
desc->physical_start >= 1ULL << 32)
continue;
@@ -89,7 +89,7 @@ int dram_init(void)
end = (struct efi_mem_desc *)((ulong)map + size);
gd->ram_size = 0;
desc = map->desc;
- for (; desc < end; desc = efi_get_next_mem_desc(map, desc)) {
+ for (; desc < end; desc = efi_get_next_mem_desc(desc, map->desc_size)) {
if (desc->type < EFI_MMAP_IO)
gd->ram_size += desc->num_pages << EFI_PAGE_SHIFT;
}
@@ -114,7 +114,7 @@ int dram_init_banksize(void)
desc = map->desc;
for (num_banks = 0;
desc < end && num_banks < CONFIG_NR_DRAM_BANKS;
- desc = efi_get_next_mem_desc(map, desc)) {
+ desc = efi_get_next_mem_desc(desc, map->desc_size)) {
/*
* We only use conventional memory and ignore
* anything less than 1MB.
@@ -197,7 +197,7 @@ unsigned int install_e820_map(unsigned int max_entries,
end = (struct efi_mem_desc *)((ulong)map + size);
for (desc = map->desc; desc < end;
- desc = efi_get_next_mem_desc(map, desc)) {
+ desc = efi_get_next_mem_desc(desc, map->desc_size)) {
if (desc->num_pages == 0)
continue;
diff --git a/arch/x86/cpu/x86_64/cpu.c b/arch/x86/cpu/x86_64/cpu.c
index a3674e8e29..6a38761291 100644
--- a/arch/x86/cpu/x86_64/cpu.c
+++ b/arch/x86/cpu/x86_64/cpu.c
@@ -45,3 +45,8 @@ int cpu_phys_address_size(void)
{
return CONFIG_CPU_ADDR_BITS;
}
+
+int x86_cpu_init_f(void)
+{
+ return 0;
+}
diff --git a/arch/x86/lib/Makefile b/arch/x86/lib/Makefile
index 18757b29aa..e5235b7c4f 100644
--- a/arch/x86/lib/Makefile
+++ b/arch/x86/lib/Makefile
@@ -65,9 +65,8 @@ endif
lib-$(CONFIG_USE_PRIVATE_LIBGCC) += div64.o
-ifeq ($(CONFIG_$(SPL_)X86_64),)
-obj-$(CONFIG_EFI_APP) += crt0_ia32_efi.o reloc_ia32_efi.o
-endif
+obj-$(CONFIG_EFI_APP_32BIT) += crt0_ia32_efi.o reloc_ia32_efi.o
+obj-$(CONFIG_EFI_APP_64BIT) += crt0_x86_64_efi.o reloc_x86_64_efi.o
ifneq ($(CONFIG_EFI_STUB),)
diff --git a/arch/x86/lib/elf_x86_64_efi.lds b/arch/x86/lib/elf_x86_64_efi.lds
index b436429b33..75727400aa 100644
--- a/arch/x86/lib/elf_x86_64_efi.lds
+++ b/arch/x86/lib/elf_x86_64_efi.lds
@@ -63,6 +63,7 @@ SECTIONS
*(.rela.data*)
*(.rela.got)
*(.rela.stab)
+ *(.rela.u_boot_list*)
}
. = ALIGN(4096);
@@ -70,9 +71,11 @@ SECTIONS
. = ALIGN(4096);
.dynstr : { *(.dynstr) }
. = ALIGN(4096);
+
+ /DISCARD/ : { *(.eh_frame) }
+
.ignored.reloc : {
*(.rela.reloc)
- *(.eh_frame)
*(.note.GNU-stack)
}
diff --git a/arch/x86/lib/relocate.c b/arch/x86/lib/relocate.c
index 6fe5151647..9060d19d46 100644
--- a/arch/x86/lib/relocate.c
+++ b/arch/x86/lib/relocate.c
@@ -35,6 +35,7 @@ int copy_uboot_to_ram(void)
return 0;
}
+#ifndef CONFIG_EFI_APP
int clear_bss(void)
{
ulong dst_addr = (ulong)&__bss_start + gd->reloc_off;
@@ -46,6 +47,7 @@ int clear_bss(void)
return 0;
}
+#endif
#if CONFIG_IS_ENABLED(X86_64)
static void do_elf_reloc_fixups64(unsigned int text_base, uintptr_t size,