aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/boot
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2014-08-04 20:13:50 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2014-08-04 20:13:50 -0400
commit76f09aa464a1913efd596dd0edbf88f932fde08c (patch)
treece9aadc9a1c30597b9d61c7aac86bfb2e6caf961 /arch/x86/boot
parente9c9eecabaa898ff3fedd98813ee4ac1a00d006a (diff)
parent99a5603e2a1f146ac0c6414d8a3669aa749ccff8 (diff)
Merge branch 'x86-efi-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull EFI changes from Ingo Molnar: "Main changes in this cycle are: - arm64 efi stub fixes, preservation of FP/SIMD registers across firmware calls, and conversion of the EFI stub code into a static library - Ard Biesheuvel - Xen EFI support - Daniel Kiper - Support for autoloading the efivars driver - Lee, Chun-Yi - Use the PE/COFF headers in the x86 EFI boot stub to request that the stub be loaded with CONFIG_PHYSICAL_ALIGN alignment - Michael Brown - Consolidate all the x86 EFI quirks into one file - Saurabh Tangri - Additional error logging in x86 EFI boot stub - Ulf Winkelvos - Support loading initrd above 4G in EFI boot stub - Yinghai Lu - EFI reboot patches for ACPI hardware reduced platforms" * 'x86-efi-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (31 commits) efi/arm64: Handle missing virtual mapping for UEFI System Table arch/x86/xen: Silence compiler warnings xen: Silence compiler warnings x86/efi: Request desired alignment via the PE/COFF headers x86/efi: Add better error logging to EFI boot stub efi: Autoload efivars efi: Update stale locking comment for struct efivars arch/x86: Remove efi_set_rtc_mmss() arch/x86: Replace plain strings with constants xen: Put EFI machinery in place xen: Define EFI related stuff arch/x86: Remove redundant set_bit(EFI_MEMMAP) call arch/x86: Remove redundant set_bit(EFI_SYSTEM_TABLES) call efi: Introduce EFI_PARAVIRT flag arch/x86: Do not access EFI memory map if it is not available efi: Use early_mem*() instead of early_io*() arch/ia64: Define early_memunmap() x86/reboot: Add EFI reboot quirk for ACPI Hardware Reduced flag efi/reboot: Allow powering off machines using EFI efi/reboot: Add generic wrapper around EfiResetSystem() ...
Diffstat (limited to 'arch/x86/boot')
-rw-r--r--arch/x86/boot/compressed/Makefile3
-rw-r--r--arch/x86/boot/compressed/eboot.c48
-rw-r--r--arch/x86/boot/compressed/eboot.h16
-rw-r--r--arch/x86/boot/header.S2
4 files changed, 32 insertions, 37 deletions
diff --git a/arch/x86/boot/compressed/Makefile b/arch/x86/boot/compressed/Makefile
index 0fcd9133790c..7a801a310e37 100644
--- a/arch/x86/boot/compressed/Makefile
+++ b/arch/x86/boot/compressed/Makefile
@@ -33,7 +33,8 @@ VMLINUX_OBJS = $(obj)/vmlinux.lds $(obj)/head_$(BITS).o $(obj)/misc.o \
33$(obj)/eboot.o: KBUILD_CFLAGS += -fshort-wchar -mno-red-zone 33$(obj)/eboot.o: KBUILD_CFLAGS += -fshort-wchar -mno-red-zone
34 34
35ifeq ($(CONFIG_EFI_STUB), y) 35ifeq ($(CONFIG_EFI_STUB), y)
36 VMLINUX_OBJS += $(obj)/eboot.o $(obj)/efi_stub_$(BITS).o 36 VMLINUX_OBJS += $(obj)/eboot.o $(obj)/efi_stub_$(BITS).o \
37 $(objtree)/drivers/firmware/efi/libstub/lib.a
37endif 38endif
38 39
39$(obj)/vmlinux: $(VMLINUX_OBJS) FORCE 40$(obj)/vmlinux: $(VMLINUX_OBJS) FORCE
diff --git a/arch/x86/boot/compressed/eboot.c b/arch/x86/boot/compressed/eboot.c
index 0331d765c2bb..f277184e2ac1 100644
--- a/arch/x86/boot/compressed/eboot.c
+++ b/arch/x86/boot/compressed/eboot.c
@@ -19,10 +19,7 @@
19 19
20static efi_system_table_t *sys_table; 20static efi_system_table_t *sys_table;
21 21
22static struct efi_config *efi_early; 22struct efi_config *efi_early;
23
24#define efi_call_early(f, ...) \
25 efi_early->call(efi_early->f, __VA_ARGS__);
26 23
27#define BOOT_SERVICES(bits) \ 24#define BOOT_SERVICES(bits) \
28static void setup_boot_services##bits(struct efi_config *c) \ 25static void setup_boot_services##bits(struct efi_config *c) \
@@ -48,8 +45,7 @@ static void setup_boot_services##bits(struct efi_config *c) \
48BOOT_SERVICES(32); 45BOOT_SERVICES(32);
49BOOT_SERVICES(64); 46BOOT_SERVICES(64);
50 47
51static void efi_printk(efi_system_table_t *, char *); 48void efi_char16_printk(efi_system_table_t *, efi_char16_t *);
52static void efi_char16_printk(efi_system_table_t *, efi_char16_t *);
53 49
54static efi_status_t 50static efi_status_t
55__file_size32(void *__fh, efi_char16_t *filename_16, 51__file_size32(void *__fh, efi_char16_t *filename_16,
@@ -156,7 +152,7 @@ grow:
156 152
157 return status; 153 return status;
158} 154}
159static efi_status_t 155efi_status_t
160efi_file_size(efi_system_table_t *sys_table, void *__fh, 156efi_file_size(efi_system_table_t *sys_table, void *__fh,
161 efi_char16_t *filename_16, void **handle, u64 *file_sz) 157 efi_char16_t *filename_16, void **handle, u64 *file_sz)
162{ 158{
@@ -166,7 +162,7 @@ efi_file_size(efi_system_table_t *sys_table, void *__fh,
166 return __file_size32(__fh, filename_16, handle, file_sz); 162 return __file_size32(__fh, filename_16, handle, file_sz);
167} 163}
168 164
169static inline efi_status_t 165efi_status_t
170efi_file_read(void *handle, unsigned long *size, void *addr) 166efi_file_read(void *handle, unsigned long *size, void *addr)
171{ 167{
172 unsigned long func; 168 unsigned long func;
@@ -184,7 +180,7 @@ efi_file_read(void *handle, unsigned long *size, void *addr)
184 } 180 }
185} 181}
186 182
187static inline efi_status_t efi_file_close(void *handle) 183efi_status_t efi_file_close(void *handle)
188{ 184{
189 if (efi_early->is64) { 185 if (efi_early->is64) {
190 efi_file_handle_64_t *fh = handle; 186 efi_file_handle_64_t *fh = handle;
@@ -249,7 +245,7 @@ static inline efi_status_t __open_volume64(void *__image, void **__fh)
249 return status; 245 return status;
250} 246}
251 247
252static inline efi_status_t 248efi_status_t
253efi_open_volume(efi_system_table_t *sys_table, void *__image, void **__fh) 249efi_open_volume(efi_system_table_t *sys_table, void *__image, void **__fh)
254{ 250{
255 if (efi_early->is64) 251 if (efi_early->is64)
@@ -258,7 +254,7 @@ efi_open_volume(efi_system_table_t *sys_table, void *__image, void **__fh)
258 return __open_volume32(__image, __fh); 254 return __open_volume32(__image, __fh);
259} 255}
260 256
261static void efi_char16_printk(efi_system_table_t *table, efi_char16_t *str) 257void efi_char16_printk(efi_system_table_t *table, efi_char16_t *str)
262{ 258{
263 unsigned long output_string; 259 unsigned long output_string;
264 size_t offset; 260 size_t offset;
@@ -284,8 +280,6 @@ static void efi_char16_printk(efi_system_table_t *table, efi_char16_t *str)
284 } 280 }
285} 281}
286 282
287#include "../../../../drivers/firmware/efi/efi-stub-helper.c"
288
289static void find_bits(unsigned long mask, u8 *pos, u8 *size) 283static void find_bits(unsigned long mask, u8 *pos, u8 *size)
290{ 284{
291 u8 first, len; 285 u8 first, len;
@@ -1038,6 +1032,7 @@ struct boot_params *make_boot_params(struct efi_config *c)
1038 int i; 1032 int i;
1039 unsigned long ramdisk_addr; 1033 unsigned long ramdisk_addr;
1040 unsigned long ramdisk_size; 1034 unsigned long ramdisk_size;
1035 unsigned long initrd_addr_max;
1041 1036
1042 efi_early = c; 1037 efi_early = c;
1043 sys_table = (efi_system_table_t *)(unsigned long)efi_early->table; 1038 sys_table = (efi_system_table_t *)(unsigned long)efi_early->table;
@@ -1100,14 +1095,21 @@ struct boot_params *make_boot_params(struct efi_config *c)
1100 1095
1101 memset(sdt, 0, sizeof(*sdt)); 1096 memset(sdt, 0, sizeof(*sdt));
1102 1097
1098 if (hdr->xloadflags & XLF_CAN_BE_LOADED_ABOVE_4G)
1099 initrd_addr_max = -1UL;
1100 else
1101 initrd_addr_max = hdr->initrd_addr_max;
1102
1103 status = handle_cmdline_files(sys_table, image, 1103 status = handle_cmdline_files(sys_table, image,
1104 (char *)(unsigned long)hdr->cmd_line_ptr, 1104 (char *)(unsigned long)hdr->cmd_line_ptr,
1105 "initrd=", hdr->initrd_addr_max, 1105 "initrd=", initrd_addr_max,
1106 &ramdisk_addr, &ramdisk_size); 1106 &ramdisk_addr, &ramdisk_size);
1107 if (status != EFI_SUCCESS) 1107 if (status != EFI_SUCCESS)
1108 goto fail2; 1108 goto fail2;
1109 hdr->ramdisk_image = ramdisk_addr; 1109 hdr->ramdisk_image = ramdisk_addr & 0xffffffff;
1110 hdr->ramdisk_size = ramdisk_size; 1110 hdr->ramdisk_size = ramdisk_size & 0xffffffff;
1111 boot_params->ext_ramdisk_image = (u64)ramdisk_addr >> 32;
1112 boot_params->ext_ramdisk_size = (u64)ramdisk_size >> 32;
1111 1113
1112 return boot_params; 1114 return boot_params;
1113fail2: 1115fail2:
@@ -1374,7 +1376,10 @@ struct boot_params *efi_main(struct efi_config *c,
1374 1376
1375 setup_graphics(boot_params); 1377 setup_graphics(boot_params);
1376 1378
1377 setup_efi_pci(boot_params); 1379 status = setup_efi_pci(boot_params);
1380 if (status != EFI_SUCCESS) {
1381 efi_printk(sys_table, "setup_efi_pci() failed!\n");
1382 }
1378 1383
1379 status = efi_call_early(allocate_pool, EFI_LOADER_DATA, 1384 status = efi_call_early(allocate_pool, EFI_LOADER_DATA,
1380 sizeof(*gdt), (void **)&gdt); 1385 sizeof(*gdt), (void **)&gdt);
@@ -1401,16 +1406,20 @@ struct boot_params *efi_main(struct efi_config *c,
1401 hdr->init_size, hdr->init_size, 1406 hdr->init_size, hdr->init_size,
1402 hdr->pref_address, 1407 hdr->pref_address,
1403 hdr->kernel_alignment); 1408 hdr->kernel_alignment);
1404 if (status != EFI_SUCCESS) 1409 if (status != EFI_SUCCESS) {
1410 efi_printk(sys_table, "efi_relocate_kernel() failed!\n");
1405 goto fail; 1411 goto fail;
1412 }
1406 1413
1407 hdr->pref_address = hdr->code32_start; 1414 hdr->pref_address = hdr->code32_start;
1408 hdr->code32_start = bzimage_addr; 1415 hdr->code32_start = bzimage_addr;
1409 } 1416 }
1410 1417
1411 status = exit_boot(boot_params, handle, is64); 1418 status = exit_boot(boot_params, handle, is64);
1412 if (status != EFI_SUCCESS) 1419 if (status != EFI_SUCCESS) {
1420 efi_printk(sys_table, "exit_boot() failed!\n");
1413 goto fail; 1421 goto fail;
1422 }
1414 1423
1415 memset((char *)gdt->address, 0x0, gdt->size); 1424 memset((char *)gdt->address, 0x0, gdt->size);
1416 desc = (struct desc_struct *)gdt->address; 1425 desc = (struct desc_struct *)gdt->address;
@@ -1470,5 +1479,6 @@ struct boot_params *efi_main(struct efi_config *c,
1470 1479
1471 return boot_params; 1480 return boot_params;
1472fail: 1481fail:
1482 efi_printk(sys_table, "efi_main() failed!\n");
1473 return NULL; 1483 return NULL;
1474} 1484}
diff --git a/arch/x86/boot/compressed/eboot.h b/arch/x86/boot/compressed/eboot.h
index c88c31ecad12..d487e727f1ec 100644
--- a/arch/x86/boot/compressed/eboot.h
+++ b/arch/x86/boot/compressed/eboot.h
@@ -103,20 +103,4 @@ struct efi_uga_draw_protocol {
103 void *blt; 103 void *blt;
104}; 104};
105 105
106struct efi_config {
107 u64 image_handle;
108 u64 table;
109 u64 allocate_pool;
110 u64 allocate_pages;
111 u64 get_memory_map;
112 u64 free_pool;
113 u64 free_pages;
114 u64 locate_handle;
115 u64 handle_protocol;
116 u64 exit_boot_services;
117 u64 text_output;
118 efi_status_t (*call)(unsigned long, ...);
119 bool is64;
120} __packed;
121
122#endif /* BOOT_COMPRESSED_EBOOT_H */ 106#endif /* BOOT_COMPRESSED_EBOOT_H */
diff --git a/arch/x86/boot/header.S b/arch/x86/boot/header.S
index 7a6d43a554d7..16ef02596db2 100644
--- a/arch/x86/boot/header.S
+++ b/arch/x86/boot/header.S
@@ -154,7 +154,7 @@ extra_header_fields:
154#else 154#else
155 .quad 0 # ImageBase 155 .quad 0 # ImageBase
156#endif 156#endif
157 .long 0x20 # SectionAlignment 157 .long CONFIG_PHYSICAL_ALIGN # SectionAlignment
158 .long 0x20 # FileAlignment 158 .long 0x20 # FileAlignment
159 .word 0 # MajorOperatingSystemVersion 159 .word 0 # MajorOperatingSystemVersion
160 .word 0 # MinorOperatingSystemVersion 160 .word 0 # MinorOperatingSystemVersion