Commit 29282ac0bd6c0b0c4c893fe2c31863e50fea69f8

Authored by Ingo Molnar

Merge tag 'efi-urgent' of git://git.kernel.org/pub/scm/linux/kernel/git/mfleming/efi into x86/urgent

Pull EFI fixes from Matt Fleming:

  * Revert the static library changes from the merge window since they're
    causing issues for Macbooks and Fedora + Grub2 (Matt Fleming)

  * Delete the misleading "setup_efi_pci() failed!" message which some
    people are seeing when booting EFI (Matt Fleming)

  * Fix printing strings from the 32-bit EFI boot stub by only passing
    32-bit addresses to the firmware (Matt Fleming)

Signed-off-by: Ingo Molnar <mingo@kernel.org>

Showing 5 changed files Side-by-side Diff

arch/x86/boot/compressed/Makefile
... ... @@ -33,8 +33,7 @@
33 33 $(obj)/eboot.o: KBUILD_CFLAGS += -fshort-wchar -mno-red-zone
34 34  
35 35 ifeq ($(CONFIG_EFI_STUB), y)
36   - VMLINUX_OBJS += $(obj)/eboot.o $(obj)/efi_stub_$(BITS).o \
37   - $(objtree)/drivers/firmware/efi/libstub/lib.a
  36 + VMLINUX_OBJS += $(obj)/eboot.o $(obj)/efi_stub_$(BITS).o
38 37 endif
39 38  
40 39 $(obj)/vmlinux: $(VMLINUX_OBJS) FORCE
arch/x86/boot/compressed/eboot.c
... ... @@ -19,8 +19,11 @@
19 19  
20 20 static efi_system_table_t *sys_table;
21 21  
22   -struct efi_config *efi_early;
  22 +static struct efi_config *efi_early;
23 23  
  24 +#define efi_call_early(f, ...) \
  25 + efi_early->call(efi_early->f, __VA_ARGS__);
  26 +
24 27 #define BOOT_SERVICES(bits) \
25 28 static void setup_boot_services##bits(struct efi_config *c) \
26 29 { \
27 30  
28 31  
29 32  
30 33  
... ... @@ -265,21 +268,25 @@
265 268  
266 269 offset = offsetof(typeof(*out), output_string);
267 270 output_string = efi_early->text_output + offset;
  271 + out = (typeof(out))(unsigned long)efi_early->text_output;
268 272 func = (u64 *)output_string;
269 273  
270   - efi_early->call(*func, efi_early->text_output, str);
  274 + efi_early->call(*func, out, str);
271 275 } else {
272 276 struct efi_simple_text_output_protocol_32 *out;
273 277 u32 *func;
274 278  
275 279 offset = offsetof(typeof(*out), output_string);
276 280 output_string = efi_early->text_output + offset;
  281 + out = (typeof(out))(unsigned long)efi_early->text_output;
277 282 func = (u32 *)output_string;
278 283  
279   - efi_early->call(*func, efi_early->text_output, str);
  284 + efi_early->call(*func, out, str);
280 285 }
281 286 }
282 287  
  288 +#include "../../../../drivers/firmware/efi/libstub/efi-stub-helper.c"
  289 +
283 290 static void find_bits(unsigned long mask, u8 *pos, u8 *size)
284 291 {
285 292 u8 first, len;
... ... @@ -360,7 +367,7 @@
360 367 return status;
361 368 }
362 369  
363   -static efi_status_t
  370 +static void
364 371 setup_efi_pci32(struct boot_params *params, void **pci_handle,
365 372 unsigned long size)
366 373 {
... ... @@ -403,8 +410,6 @@
403 410 data = (struct setup_data *)rom;
404 411  
405 412 }
406   -
407   - return status;
408 413 }
409 414  
410 415 static efi_status_t
... ... @@ -463,7 +468,7 @@
463 468  
464 469 }
465 470  
466   -static efi_status_t
  471 +static void
467 472 setup_efi_pci64(struct boot_params *params, void **pci_handle,
468 473 unsigned long size)
469 474 {
470 475  
... ... @@ -506,11 +511,18 @@
506 511 data = (struct setup_data *)rom;
507 512  
508 513 }
509   -
510   - return status;
511 514 }
512 515  
513   -static efi_status_t setup_efi_pci(struct boot_params *params)
  516 +/*
  517 + * There's no way to return an informative status from this function,
  518 + * because any analysis (and printing of error messages) needs to be
  519 + * done directly at the EFI function call-site.
  520 + *
  521 + * For example, EFI_INVALID_PARAMETER could indicate a bug or maybe we
  522 + * just didn't find any PCI devices, but there's no way to tell outside
  523 + * the context of the call.
  524 + */
  525 +static void setup_efi_pci(struct boot_params *params)
514 526 {
515 527 efi_status_t status;
516 528 void **pci_handle = NULL;
... ... @@ -527,7 +539,7 @@
527 539 size, (void **)&pci_handle);
528 540  
529 541 if (status != EFI_SUCCESS)
530   - return status;
  542 + return;
531 543  
532 544 status = efi_call_early(locate_handle,
533 545 EFI_LOCATE_BY_PROTOCOL, &pci_proto,
534 546  
535 547  
... ... @@ -538,13 +550,12 @@
538 550 goto free_handle;
539 551  
540 552 if (efi_early->is64)
541   - status = setup_efi_pci64(params, pci_handle, size);
  553 + setup_efi_pci64(params, pci_handle, size);
542 554 else
543   - status = setup_efi_pci32(params, pci_handle, size);
  555 + setup_efi_pci32(params, pci_handle, size);
544 556  
545 557 free_handle:
546 558 efi_call_early(free_pool, pci_handle);
547   - return status;
548 559 }
549 560  
550 561 static void
... ... @@ -1380,10 +1391,7 @@
1380 1391  
1381 1392 setup_graphics(boot_params);
1382 1393  
1383   - status = setup_efi_pci(boot_params);
1384   - if (status != EFI_SUCCESS) {
1385   - efi_printk(sys_table, "setup_efi_pci() failed!\n");
1386   - }
  1394 + setup_efi_pci(boot_params);
1387 1395  
1388 1396 status = efi_call_early(allocate_pool, EFI_LOADER_DATA,
1389 1397 sizeof(*gdt), (void **)&gdt);
arch/x86/boot/compressed/eboot.h
... ... @@ -103,5 +103,21 @@
103 103 void *blt;
104 104 };
105 105  
  106 +struct 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 +
106 122 #endif /* BOOT_COMPRESSED_EBOOT_H */
arch/x86/include/asm/efi.h
... ... @@ -159,30 +159,6 @@
159 159 }
160 160 #endif /* CONFIG_EFI_MIXED */
161 161  
162   -
163   -/* arch specific definitions used by the stub code */
164   -
165   -struct efi_config {
166   - u64 image_handle;
167   - u64 table;
168   - u64 allocate_pool;
169   - u64 allocate_pages;
170   - u64 get_memory_map;
171   - u64 free_pool;
172   - u64 free_pages;
173   - u64 locate_handle;
174   - u64 handle_protocol;
175   - u64 exit_boot_services;
176   - u64 text_output;
177   - efi_status_t (*call)(unsigned long, ...);
178   - bool is64;
179   -} __packed;
180   -
181   -extern struct efi_config *efi_early;
182   -
183   -#define efi_call_early(f, ...) \
184   - efi_early->call(efi_early->f, __VA_ARGS__);
185   -
186 162 extern bool efi_reboot_required(void);
187 163  
188 164 #else
drivers/firmware/efi/Makefile
... ... @@ -7,5 +7,5 @@
7 7 obj-$(CONFIG_UEFI_CPER) += cper.o
8 8 obj-$(CONFIG_EFI_RUNTIME_MAP) += runtime-map.o
9 9 obj-$(CONFIG_EFI_RUNTIME_WRAPPERS) += runtime-wrappers.o
10   -obj-$(CONFIG_EFI_STUB) += libstub/
  10 +obj-$(CONFIG_EFI_ARM_STUB) += libstub/