From 1f3f0357aa79212e06fadf2149a85e0fa435a8eb Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Mon, 7 Nov 2016 08:47:03 -0700 Subject: x86: Correct a build warning in x86 tables There is a build warning for three x86 boards since write_smbios_table_wrapper() is not used. Fix it. Fixes: e824cf3f (smbios: Allow compilation on 64bit systems) Signed-off-by: Simon Glass Signed-off-by: Alexander Graf --- arch/x86/lib/tables.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'arch/x86/lib') diff --git a/arch/x86/lib/tables.c b/arch/x86/lib/tables.c index 025b183d6b..5966e5862a 100644 --- a/arch/x86/lib/tables.c +++ b/arch/x86/lib/tables.c @@ -12,10 +12,12 @@ #include #include +#ifdef CONFIG_GENERATE_SMBIOS_TABLE static u32 write_smbios_table_wrapper(u32 addr) { return write_smbios_table(addr); } +#endif /** * Function prototype to write a specific configuration table -- cgit From d36badfdc6a47ae1377dde809c9ea6f6249f5c15 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Mon, 7 Nov 2016 08:47:13 -0700 Subject: x86: Move efi .lds files into the 'lib' directory These files now need to be in a standard place so that they can be located by generic Makefile rules. Move them to the 'lib' directory. Signed-off-by: Simon Glass Signed-off-by: Alexander Graf --- arch/x86/lib/elf_ia32_efi.lds | 94 +++++++++++++++++++++++++++++++++++++++++ arch/x86/lib/elf_x86_64_efi.lds | 83 ++++++++++++++++++++++++++++++++++++ 2 files changed, 177 insertions(+) create mode 100644 arch/x86/lib/elf_ia32_efi.lds create mode 100644 arch/x86/lib/elf_x86_64_efi.lds (limited to 'arch/x86/lib') diff --git a/arch/x86/lib/elf_ia32_efi.lds b/arch/x86/lib/elf_ia32_efi.lds new file mode 100644 index 0000000000..cd3b0a982d --- /dev/null +++ b/arch/x86/lib/elf_ia32_efi.lds @@ -0,0 +1,94 @@ +/* + * U-Boot EFI linker script + * + * SPDX-License-Identifier: BSD-2-Clause + * + * Modified from usr/lib32/elf_ia32_efi.lds in gnu-efi + */ + +#include + +OUTPUT_FORMAT("elf32-i386", "elf32-i386", "elf32-i386") +OUTPUT_ARCH(i386) +ENTRY(_start) +SECTIONS +{ + image_base = .; + .hash : { *(.hash) } /* this MUST come first, EFI expects it */ + . = ALIGN(4096); + .text : + { + *(.text) + *(.text.*) + *(.gnu.linkonce.t.*) + } + . = ALIGN(4096); + .sdata : + { + *(.got.plt) + *(.got) + *(.srodata) + *(.sdata) + *(.sbss) + *(.scommon) + } + . = ALIGN(4096); + .data : + { + *(.rodata*) + *(.data) + *(.data1) + *(.data.*) + *(.sdata) + *(.got.plt) + *(.got) + /* + * the EFI loader doesn't seem to like a .bss section, so we + * stick it all into .data: + */ + *(.sbss) + *(.scommon) + *(.dynbss) + *(.bss) + *(COMMON) + + /* U-Boot lists and device tree */ + . = ALIGN(8); + *(SORT(.u_boot_list*)); + . = ALIGN(8); + *(.dtb*); + } + + . = ALIGN(4096); + .dynamic : { *(.dynamic) } + . = ALIGN(4096); + .rel : + { + *(.rel.data) + *(.rel.data.*) + *(.rel.got) + *(.rel.stab) + *(.data.rel.ro.local) + *(.data.rel.local) + *(.data.rel.ro) + *(.data.rel*) + *(.rel.u_boot_list*) + } + . = ALIGN(4096); + .reloc : /* This is the PECOFF .reloc section! */ + { + *(.reloc) + } + . = ALIGN(4096); + .dynsym : { *(.dynsym) } + . = ALIGN(4096); + .dynstr : { *(.dynstr) } + . = ALIGN(4096); + /DISCARD/ : + { + *(.rel.reloc) + *(.eh_frame) + *(.note.GNU-stack) + } + .comment 0 : { *(.comment) } +} diff --git a/arch/x86/lib/elf_x86_64_efi.lds b/arch/x86/lib/elf_x86_64_efi.lds new file mode 100644 index 0000000000..9d9f05774a --- /dev/null +++ b/arch/x86/lib/elf_x86_64_efi.lds @@ -0,0 +1,83 @@ +/* + * U-Boot EFI linker script + * + * SPDX-License-Identifier: BSD-2-Clause + * + * Modified from usr/lib32/elf_x86_64_efi.lds in gnu-efi + */ + +#include + +OUTPUT_FORMAT("elf64-x86-64", "elf64-x86-64", "elf64-x86-64") +OUTPUT_ARCH(i386:x86-64) +ENTRY(_start) +SECTIONS +{ + image_base = .; + .hash : { *(.hash) } /* this MUST come first, EFI expects it */ + . = ALIGN(4096); + .eh_frame : { + *(.eh_frame) + } + + . = ALIGN(4096); + + .text : { + *(.text) + *(.text.*) + *(.gnu.linkonce.t.*) + } + + . = ALIGN(4096); + + .reloc : { + *(.reloc) + } + + . = ALIGN(4096); + + .data : { + *(.rodata*) + *(.got.plt) + *(.got) + *(.data*) + *(.sdata) + /* the EFI loader doesn't seem to like a .bss section, so we stick + * it all into .data: */ + *(.sbss) + *(.scommon) + *(.dynbss) + *(.bss) + *(COMMON) + *(.rel.local) + + /* U-Boot lists and device tree */ + . = ALIGN(8); + *(SORT(.u_boot_list*)); + . = ALIGN(8); + *(.dtb*); + } + + . = ALIGN(4096); + .dynamic : { *(.dynamic) } + . = ALIGN(4096); + + .rela : { + *(.rela.data*) + *(.rela.got) + *(.rela.stab) + } + + . = ALIGN(4096); + .dynsym : { *(.dynsym) } + . = ALIGN(4096); + .dynstr : { *(.dynstr) } + . = ALIGN(4096); + .ignored.reloc : { + *(.rela.reloc) + *(.eh_frame) + *(.note.GNU-stack) + } + + .comment 0 : { *(.comment) } +} -- cgit From 2dcd4e9ee1b6dc0f0ba1d89a7af3987ea47dda23 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Mon, 7 Nov 2016 08:47:14 -0700 Subject: x86: Move efi .S files into the 'lib' directory These files now need to be in a standard place so that they can be located by generic Makefile rules. Move them to the 'lib' directory. Signed-off-by: Simon Glass Signed-off-by: Alexander Graf --- arch/x86/lib/Makefile | 18 ++++++++++ arch/x86/lib/crt0_ia32_efi.S | 52 +++++++++++++++++++++++++++ arch/x86/lib/crt0_x86_64_efi.S | 51 +++++++++++++++++++++++++++ arch/x86/lib/efi/Makefile | 18 ---------- arch/x86/lib/efi/crt0-efi-ia32.S | 52 --------------------------- arch/x86/lib/efi/crt0-efi-x86_64.S | 51 --------------------------- arch/x86/lib/efi/reloc_ia32.c | 72 -------------------------------------- arch/x86/lib/efi/reloc_x86_64.c | 66 ---------------------------------- arch/x86/lib/reloc_ia32_efi.c | 72 ++++++++++++++++++++++++++++++++++++++ arch/x86/lib/reloc_x86_64_efi.c | 66 ++++++++++++++++++++++++++++++++++ 10 files changed, 259 insertions(+), 259 deletions(-) create mode 100644 arch/x86/lib/crt0_ia32_efi.S create mode 100644 arch/x86/lib/crt0_x86_64_efi.S delete mode 100644 arch/x86/lib/efi/crt0-efi-ia32.S delete mode 100644 arch/x86/lib/efi/crt0-efi-x86_64.S delete mode 100644 arch/x86/lib/efi/reloc_ia32.c delete mode 100644 arch/x86/lib/efi/reloc_x86_64.c create mode 100644 arch/x86/lib/reloc_ia32_efi.c create mode 100644 arch/x86/lib/reloc_x86_64_efi.c (limited to 'arch/x86/lib') diff --git a/arch/x86/lib/Makefile b/arch/x86/lib/Makefile index b9c29226bd..aad6555a71 100644 --- a/arch/x86/lib/Makefile +++ b/arch/x86/lib/Makefile @@ -44,3 +44,21 @@ NORMAL_LIBGCC = $(shell $(CC) $(PLATFORM_CPPFLAGS) -print-libgcc-file-name) OBJCOPYFLAGS := --prefix-symbols=__normal_ $(obj)/lib.a: $(NORMAL_LIBGCC) FORCE $(call if_changed,objcopy) + +obj-$(CONFIG_EFI_APP) += crt0_ia32_efi.o reloc_ia32_efi.o + +ifneq ($(CONFIG_EFI_STUB),) + +CFLAGS_REMOVE_reloc_ia32_efi.o += -mregparm=3 +CFLAGS_reloc_ia32_efi.o += -fpic -fshort-wchar + +# When building for 64-bit we must remove the i386-specific flags +CFLAGS_REMOVE_reloc_x86_64_efi.o += -mregparm=3 -march=i386 -m32 +CFLAGS_reloc_x86_64_efi.o += -fpic -fshort-wchar + +AFLAGS_REMOVE_crt0_x86_64_efi.o += -mregparm=3 -march=i386 -m32 +AFLAGS_crt0_x86_64_efi.o += -fpic -fshort-wchar + +extra-$(CONFIG_EFI_STUB_32BIT) += crt0_ia32_efi.o reloc_ia32_efi.o +extra-$(CONFIG_EFI_STUB_64BIT) += crt0_x86_64_efi.o reloc_x86_64_efi.o +endif diff --git a/arch/x86/lib/crt0_ia32_efi.S b/arch/x86/lib/crt0_ia32_efi.S new file mode 100644 index 0000000000..30e5eb0c1a --- /dev/null +++ b/arch/x86/lib/crt0_ia32_efi.S @@ -0,0 +1,52 @@ +/* + * crt0-efi-ia32.S - x86 EFI startup code. + * + * Copyright (C) 1999 Hewlett-Packard Co. + * Contributed by David Mosberger . + * All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + + .text + .align 4 + + .globl _start +_start: + pushl %ebp + movl %esp,%ebp + + pushl 12(%ebp) # copy "image" argument + pushl 8(%ebp) # copy "systab" argument + + call 0f +0: popl %eax + movl %eax,%ebx + + addl $image_base-0b,%eax # %eax = ldbase + addl $_DYNAMIC-0b,%ebx # %ebx = _DYNAMIC + + pushl %ebx # pass _DYNAMIC as second argument + pushl %eax # pass ldbase as first argument + call _relocate + popl %ebx + popl %ebx + testl %eax,%eax + jne .exit + call efi_main # call app with "image" and "systab" argument + +.exit: leave + ret + + /* + * hand-craft a dummy .reloc section so EFI knows it's a relocatable + * executable: + */ + .data +dummy: .long 0 + +#define IMAGE_REL_ABSOLUTE 0 + .section .reloc + .long dummy /* Page RVA */ + .long 10 /* Block Size (2*4+2) */ + .word (IMAGE_REL_ABSOLUTE << 12) + 0 /* reloc for dummy */ diff --git a/arch/x86/lib/crt0_x86_64_efi.S b/arch/x86/lib/crt0_x86_64_efi.S new file mode 100644 index 0000000000..c5cbf4108b --- /dev/null +++ b/arch/x86/lib/crt0_x86_64_efi.S @@ -0,0 +1,51 @@ +/* + * crt0-efi-x86_64.S - x86_64 EFI startup code. + * Copyright (C) 1999 Hewlett-Packard Co. + * Contributed by David Mosberger . + * Copyright (C) 2005 Intel Co. + * Contributed by Fenghua Yu . + * + * All rights reserved. + * SPDX-License-Identifier: BSD-3-Clause + */ + .text + .align 4 + + .globl _start +_start: + subq $8, %rsp + pushq %rcx + pushq %rdx + +0: + lea image_base(%rip), %rdi + lea _DYNAMIC(%rip), %rsi + + popq %rcx + popq %rdx + pushq %rcx + pushq %rdx + call _relocate + + popq %rdi + popq %rsi + + call efi_main + addq $8, %rsp + +.exit: + ret + + /* + * hand-craft a dummy .reloc section so EFI knows it's a relocatable + * executable: + */ + .data +dummy: .long 0 + +#define IMAGE_REL_ABSOLUTE 0 + .section .reloc, "a" +label1: + .long dummy-label1 /* Page RVA */ + .long 10 /* Block Size (2*4+2) */ + .word (IMAGE_REL_ABSOLUTE << 12) + 0 /* reloc for dummy */ diff --git a/arch/x86/lib/efi/Makefile b/arch/x86/lib/efi/Makefile index af4503e1c2..43aadfc996 100644 --- a/arch/x86/lib/efi/Makefile +++ b/arch/x86/lib/efi/Makefile @@ -7,21 +7,3 @@ obj-$(CONFIG_EFI_STUB) += car.o obj-$(CONFIG_EFI_STUB) += efi.o - -obj-$(CONFIG_EFI_APP) += crt0-efi-ia32.o reloc_ia32.o - -ifneq ($(CONFIG_EFI_STUB),) - -CFLAGS_REMOVE_reloc_ia32.o += -mregparm=3 -CFLAGS_reloc_ia32.o += -fpic -fshort-wchar - -# When building for 64-bit we must remove the i386-specific flags -CFLAGS_REMOVE_reloc_x86_64.o += -mregparm=3 -march=i386 -m32 -CFLAGS_reloc_x86_64.o += -fpic -fshort-wchar - -AFLAGS_REMOVE_crt0-efi-x86_64.o += -mregparm=3 -march=i386 -m32 -AFLAGS_crt0-efi-x86_64.o += -fpic -fshort-wchar - -extra-$(CONFIG_EFI_STUB_32BIT) += crt0-efi-ia32.o reloc_ia32.o -extra-$(CONFIG_EFI_STUB_64BIT) += crt0-efi-x86_64.o reloc_x86_64.o -endif diff --git a/arch/x86/lib/efi/crt0-efi-ia32.S b/arch/x86/lib/efi/crt0-efi-ia32.S deleted file mode 100644 index 30e5eb0c1a..0000000000 --- a/arch/x86/lib/efi/crt0-efi-ia32.S +++ /dev/null @@ -1,52 +0,0 @@ -/* - * crt0-efi-ia32.S - x86 EFI startup code. - * - * Copyright (C) 1999 Hewlett-Packard Co. - * Contributed by David Mosberger . - * All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - - .text - .align 4 - - .globl _start -_start: - pushl %ebp - movl %esp,%ebp - - pushl 12(%ebp) # copy "image" argument - pushl 8(%ebp) # copy "systab" argument - - call 0f -0: popl %eax - movl %eax,%ebx - - addl $image_base-0b,%eax # %eax = ldbase - addl $_DYNAMIC-0b,%ebx # %ebx = _DYNAMIC - - pushl %ebx # pass _DYNAMIC as second argument - pushl %eax # pass ldbase as first argument - call _relocate - popl %ebx - popl %ebx - testl %eax,%eax - jne .exit - call efi_main # call app with "image" and "systab" argument - -.exit: leave - ret - - /* - * hand-craft a dummy .reloc section so EFI knows it's a relocatable - * executable: - */ - .data -dummy: .long 0 - -#define IMAGE_REL_ABSOLUTE 0 - .section .reloc - .long dummy /* Page RVA */ - .long 10 /* Block Size (2*4+2) */ - .word (IMAGE_REL_ABSOLUTE << 12) + 0 /* reloc for dummy */ diff --git a/arch/x86/lib/efi/crt0-efi-x86_64.S b/arch/x86/lib/efi/crt0-efi-x86_64.S deleted file mode 100644 index c5cbf4108b..0000000000 --- a/arch/x86/lib/efi/crt0-efi-x86_64.S +++ /dev/null @@ -1,51 +0,0 @@ -/* - * crt0-efi-x86_64.S - x86_64 EFI startup code. - * Copyright (C) 1999 Hewlett-Packard Co. - * Contributed by David Mosberger . - * Copyright (C) 2005 Intel Co. - * Contributed by Fenghua Yu . - * - * All rights reserved. - * SPDX-License-Identifier: BSD-3-Clause - */ - .text - .align 4 - - .globl _start -_start: - subq $8, %rsp - pushq %rcx - pushq %rdx - -0: - lea image_base(%rip), %rdi - lea _DYNAMIC(%rip), %rsi - - popq %rcx - popq %rdx - pushq %rcx - pushq %rdx - call _relocate - - popq %rdi - popq %rsi - - call efi_main - addq $8, %rsp - -.exit: - ret - - /* - * hand-craft a dummy .reloc section so EFI knows it's a relocatable - * executable: - */ - .data -dummy: .long 0 - -#define IMAGE_REL_ABSOLUTE 0 - .section .reloc, "a" -label1: - .long dummy-label1 /* Page RVA */ - .long 10 /* Block Size (2*4+2) */ - .word (IMAGE_REL_ABSOLUTE << 12) + 0 /* reloc for dummy */ diff --git a/arch/x86/lib/efi/reloc_ia32.c b/arch/x86/lib/efi/reloc_ia32.c deleted file mode 100644 index 4d6825515d..0000000000 --- a/arch/x86/lib/efi/reloc_ia32.c +++ /dev/null @@ -1,72 +0,0 @@ -/* - * reloc_ia32.c - position independent x86 ELF shared object relocator - * Copyright (C) 1999 Hewlett-Packard Co. - * Contributed by David Mosberger . - * - * All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - -#include -#include -#include -#include - -efi_status_t _relocate(long ldbase, Elf32_Dyn *dyn, efi_handle_t image, - struct efi_system_table *systab) -{ - long relsz = 0, relent = 0; - Elf32_Rel *rel = 0; - unsigned long *addr; - int i; - - for (i = 0; dyn[i].d_tag != DT_NULL; ++i) { - switch (dyn[i].d_tag) { - case DT_REL: - rel = (Elf32_Rel *)((unsigned long)dyn[i].d_un.d_ptr + - ldbase); - break; - - case DT_RELSZ: - relsz = dyn[i].d_un.d_val; - break; - - case DT_RELENT: - relent = dyn[i].d_un.d_val; - break; - - case DT_RELA: - break; - - default: - break; - } - } - - if (!rel && relent == 0) - return EFI_SUCCESS; - - if (!rel || relent == 0) - return EFI_LOAD_ERROR; - - while (relsz > 0) { - /* apply the relocs */ - switch (ELF32_R_TYPE(rel->r_info)) { - case R_386_NONE: - break; - - case R_386_RELATIVE: - addr = (unsigned long *)(ldbase + rel->r_offset); - *addr += ldbase; - break; - - default: - break; - } - rel = (Elf32_Rel *)((char *)rel + relent); - relsz -= relent; - } - - return EFI_SUCCESS; -} diff --git a/arch/x86/lib/efi/reloc_x86_64.c b/arch/x86/lib/efi/reloc_x86_64.c deleted file mode 100644 index 5f71f2ac8a..0000000000 --- a/arch/x86/lib/efi/reloc_x86_64.c +++ /dev/null @@ -1,66 +0,0 @@ -/* - * reloc_x86_64.c - position independent x86_64 ELF shared object relocator - * Copyright (C) 1999 Hewlett-Packard Co. - * Contributed by David Mosberger . - * Copyright (C) 2005 Intel Co. - * Contributed by Fenghua Yu . - * - * All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - -#include -#include -#include -#include - -efi_status_t _relocate(long ldbase, Elf64_Dyn *dyn, efi_handle_t image, - struct efi_system_table *systab) -{ - long relsz = 0, relent = 0; - Elf64_Rel *rel = 0; - unsigned long *addr; - int i; - - for (i = 0; dyn[i].d_tag != DT_NULL; ++i) { - switch (dyn[i].d_tag) { - case DT_RELA: - rel = (Elf64_Rel *) - ((unsigned long)dyn[i].d_un.d_ptr + ldbase); - break; - case DT_RELASZ: - relsz = dyn[i].d_un.d_val; - break; - case DT_RELAENT: - relent = dyn[i].d_un.d_val; - break; - default: - break; - } - } - - if (!rel && relent == 0) - return EFI_SUCCESS; - - if (!rel || relent == 0) - return EFI_LOAD_ERROR; - - while (relsz > 0) { - /* apply the relocs */ - switch (ELF64_R_TYPE(rel->r_info)) { - case R_X86_64_NONE: - break; - case R_X86_64_RELATIVE: - addr = (unsigned long *)(ldbase + rel->r_offset); - *addr += ldbase; - break; - default: - break; - } - rel = (Elf64_Rel *)((char *)rel + relent); - relsz -= relent; - } - - return EFI_SUCCESS; -} diff --git a/arch/x86/lib/reloc_ia32_efi.c b/arch/x86/lib/reloc_ia32_efi.c new file mode 100644 index 0000000000..4d6825515d --- /dev/null +++ b/arch/x86/lib/reloc_ia32_efi.c @@ -0,0 +1,72 @@ +/* + * reloc_ia32.c - position independent x86 ELF shared object relocator + * Copyright (C) 1999 Hewlett-Packard Co. + * Contributed by David Mosberger . + * + * All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +#include +#include +#include +#include + +efi_status_t _relocate(long ldbase, Elf32_Dyn *dyn, efi_handle_t image, + struct efi_system_table *systab) +{ + long relsz = 0, relent = 0; + Elf32_Rel *rel = 0; + unsigned long *addr; + int i; + + for (i = 0; dyn[i].d_tag != DT_NULL; ++i) { + switch (dyn[i].d_tag) { + case DT_REL: + rel = (Elf32_Rel *)((unsigned long)dyn[i].d_un.d_ptr + + ldbase); + break; + + case DT_RELSZ: + relsz = dyn[i].d_un.d_val; + break; + + case DT_RELENT: + relent = dyn[i].d_un.d_val; + break; + + case DT_RELA: + break; + + default: + break; + } + } + + if (!rel && relent == 0) + return EFI_SUCCESS; + + if (!rel || relent == 0) + return EFI_LOAD_ERROR; + + while (relsz > 0) { + /* apply the relocs */ + switch (ELF32_R_TYPE(rel->r_info)) { + case R_386_NONE: + break; + + case R_386_RELATIVE: + addr = (unsigned long *)(ldbase + rel->r_offset); + *addr += ldbase; + break; + + default: + break; + } + rel = (Elf32_Rel *)((char *)rel + relent); + relsz -= relent; + } + + return EFI_SUCCESS; +} diff --git a/arch/x86/lib/reloc_x86_64_efi.c b/arch/x86/lib/reloc_x86_64_efi.c new file mode 100644 index 0000000000..5f71f2ac8a --- /dev/null +++ b/arch/x86/lib/reloc_x86_64_efi.c @@ -0,0 +1,66 @@ +/* + * reloc_x86_64.c - position independent x86_64 ELF shared object relocator + * Copyright (C) 1999 Hewlett-Packard Co. + * Contributed by David Mosberger . + * Copyright (C) 2005 Intel Co. + * Contributed by Fenghua Yu . + * + * All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +#include +#include +#include +#include + +efi_status_t _relocate(long ldbase, Elf64_Dyn *dyn, efi_handle_t image, + struct efi_system_table *systab) +{ + long relsz = 0, relent = 0; + Elf64_Rel *rel = 0; + unsigned long *addr; + int i; + + for (i = 0; dyn[i].d_tag != DT_NULL; ++i) { + switch (dyn[i].d_tag) { + case DT_RELA: + rel = (Elf64_Rel *) + ((unsigned long)dyn[i].d_un.d_ptr + ldbase); + break; + case DT_RELASZ: + relsz = dyn[i].d_un.d_val; + break; + case DT_RELAENT: + relent = dyn[i].d_un.d_val; + break; + default: + break; + } + } + + if (!rel && relent == 0) + return EFI_SUCCESS; + + if (!rel || relent == 0) + return EFI_LOAD_ERROR; + + while (relsz > 0) { + /* apply the relocs */ + switch (ELF64_R_TYPE(rel->r_info)) { + case R_X86_64_NONE: + break; + case R_X86_64_RELATIVE: + addr = (unsigned long *)(ldbase + rel->r_offset); + *addr += ldbase; + break; + default: + break; + } + rel = (Elf64_Rel *)((char *)rel + relent); + relsz -= relent; + } + + return EFI_SUCCESS; +} -- cgit From 5bd828b5329ed9b7c85beae1e532daa710f22168 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Mon, 7 Nov 2016 08:47:15 -0700 Subject: efi: x86: Adjust EFI files support efi_loader Add compiler flags and make a few minor adjustments to support the efi loader. Signed-off-by: Simon Glass [agraf: Add Kconfig dep] Signed-off-by: Alexander Graf --- arch/x86/lib/Makefile | 5 +++++ arch/x86/lib/elf_ia32_efi.lds | 2 -- arch/x86/lib/elf_x86_64_efi.lds | 2 -- 3 files changed, 5 insertions(+), 4 deletions(-) (limited to 'arch/x86/lib') diff --git a/arch/x86/lib/Makefile b/arch/x86/lib/Makefile index aad6555a71..ff402dc578 100644 --- a/arch/x86/lib/Makefile +++ b/arch/x86/lib/Makefile @@ -61,4 +61,9 @@ AFLAGS_crt0_x86_64_efi.o += -fpic -fshort-wchar extra-$(CONFIG_EFI_STUB_32BIT) += crt0_ia32_efi.o reloc_ia32_efi.o extra-$(CONFIG_EFI_STUB_64BIT) += crt0_x86_64_efi.o reloc_x86_64_efi.o + +endif + +ifneq ($(CONFIG_EFI_STUB)$(CONFIG_CMD_BOOTEFI_HELLO),) +extra-y += $(EFI_CRT0) $(EFI_RELOC) endif diff --git a/arch/x86/lib/elf_ia32_efi.lds b/arch/x86/lib/elf_ia32_efi.lds index cd3b0a982d..174d36f758 100644 --- a/arch/x86/lib/elf_ia32_efi.lds +++ b/arch/x86/lib/elf_ia32_efi.lds @@ -6,8 +6,6 @@ * Modified from usr/lib32/elf_ia32_efi.lds in gnu-efi */ -#include - OUTPUT_FORMAT("elf32-i386", "elf32-i386", "elf32-i386") OUTPUT_ARCH(i386) ENTRY(_start) diff --git a/arch/x86/lib/elf_x86_64_efi.lds b/arch/x86/lib/elf_x86_64_efi.lds index 9d9f05774a..70c7c52332 100644 --- a/arch/x86/lib/elf_x86_64_efi.lds +++ b/arch/x86/lib/elf_x86_64_efi.lds @@ -6,8 +6,6 @@ * Modified from usr/lib32/elf_x86_64_efi.lds in gnu-efi */ -#include - OUTPUT_FORMAT("elf64-x86-64", "elf64-x86-64", "elf64-x86-64") OUTPUT_ARCH(i386:x86-64) ENTRY(_start) -- cgit From b7b8410a8fee9eda7b062a86a07dda0b97c49f8a Mon Sep 17 00:00:00 2001 From: Alexander Graf Date: Thu, 17 Nov 2016 01:02:57 +0100 Subject: ls2080: Exit dpaa only right before exiting U-Boot On ls2080 we have a separate network fabric component which we need to shut down before we enter Linux (or any other OS). Along with that also comes configuration of the fabric using a description file. Today we always stop and configure the fabric in the boot script and (again) exit it on device tree generation. This works ok for the normal booti case, but with bootefi the payload we're running may still want to access the network. So let's add a new fsl_mc command that defers configuration and stopping the hardware to when we actually exit U-Boot, so that we can still use the fabric from an EFI payload. For existing boot scripts, nothing should change with this patch. Signed-off-by: Alexander Graf Reviewed-by: York Sun [agraf: Fix x86 build] --- arch/x86/lib/bootm.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'arch/x86/lib') diff --git a/arch/x86/lib/bootm.c b/arch/x86/lib/bootm.c index 7cf9de4d7b..80fadef34e 100644 --- a/arch/x86/lib/bootm.c +++ b/arch/x86/lib/bootm.c @@ -26,6 +26,10 @@ DECLARE_GLOBAL_DATA_PTR; #define COMMAND_LINE_OFFSET 0x9000 +__weak void board_quiesce_devices(void) +{ +} + void bootm_announce_and_cleanup(void) { printf("\nStarting kernel ...\n\n"); -- cgit From 95b62b2e28dbc3419f49eeae2e4fdccc862fccea Mon Sep 17 00:00:00 2001 From: Alexander Graf Date: Thu, 17 Nov 2016 22:40:10 +0100 Subject: efi_loader: Allow to compile helloworld.efi w/o bundling it Today we can compile a self-contained hello world efi test binary that allows us to quickly verify whether the EFI loader framwork works. We can use that binary outside of the self-contained test case though, by providing it to a to-be-tested system via tftp. This patch separates compilation of the helloworld.efi file from including it in the u-boot binary for "bootefi hello". It also modifies the efi_loader test case to enable travis to pick up the compiled file. Because we're now no longer bloating the resulting u-boot binary, we can enable compilation always, giving us good travis test coverage. Signed-off-by: Alexander Graf Reviewed-by: Tom Rini --- arch/x86/lib/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'arch/x86/lib') diff --git a/arch/x86/lib/Makefile b/arch/x86/lib/Makefile index ff402dc578..723288f7b2 100644 --- a/arch/x86/lib/Makefile +++ b/arch/x86/lib/Makefile @@ -64,6 +64,6 @@ extra-$(CONFIG_EFI_STUB_64BIT) += crt0_x86_64_efi.o reloc_x86_64_efi.o endif -ifneq ($(CONFIG_EFI_STUB)$(CONFIG_CMD_BOOTEFI_HELLO),) +ifneq ($(CONFIG_EFI_STUB)$(CONFIG_CMD_BOOTEFI_HELLO_COMPILE),) extra-y += $(EFI_CRT0) $(EFI_RELOC) endif -- cgit