Commit 29282ac0 authored by Ingo Molnar's avatar Ingo Molnar

Merge tag 'efi-urgent' of...

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: default avatarIngo Molnar <mingo@kernel.org>
parents 0cacbfbe 115c6628
......@@ -33,8 +33,7 @@ VMLINUX_OBJS = $(obj)/vmlinux.lds $(obj)/head_$(BITS).o $(obj)/misc.o \
$(obj)/eboot.o: KBUILD_CFLAGS += -fshort-wchar -mno-red-zone
ifeq ($(CONFIG_EFI_STUB), y)
VMLINUX_OBJS += $(obj)/eboot.o $(obj)/efi_stub_$(BITS).o \
$(objtree)/drivers/firmware/efi/libstub/lib.a
VMLINUX_OBJS += $(obj)/eboot.o $(obj)/efi_stub_$(BITS).o
endif
$(obj)/vmlinux: $(VMLINUX_OBJS) FORCE
......
......@@ -19,7 +19,10 @@
static efi_system_table_t *sys_table;
struct efi_config *efi_early;
static struct efi_config *efi_early;
#define efi_call_early(f, ...) \
efi_early->call(efi_early->f, __VA_ARGS__);
#define BOOT_SERVICES(bits) \
static void setup_boot_services##bits(struct efi_config *c) \
......@@ -265,21 +268,25 @@ void efi_char16_printk(efi_system_table_t *table, efi_char16_t *str)
offset = offsetof(typeof(*out), output_string);
output_string = efi_early->text_output + offset;
out = (typeof(out))(unsigned long)efi_early->text_output;
func = (u64 *)output_string;
efi_early->call(*func, efi_early->text_output, str);
efi_early->call(*func, out, str);
} else {
struct efi_simple_text_output_protocol_32 *out;
u32 *func;
offset = offsetof(typeof(*out), output_string);
output_string = efi_early->text_output + offset;
out = (typeof(out))(unsigned long)efi_early->text_output;
func = (u32 *)output_string;
efi_early->call(*func, efi_early->text_output, str);
efi_early->call(*func, out, str);
}
}
#include "../../../../drivers/firmware/efi/libstub/efi-stub-helper.c"
static void find_bits(unsigned long mask, u8 *pos, u8 *size)
{
u8 first, len;
......@@ -360,7 +367,7 @@ __setup_efi_pci32(efi_pci_io_protocol_32 *pci, struct pci_setup_rom **__rom)
return status;
}
static efi_status_t
static void
setup_efi_pci32(struct boot_params *params, void **pci_handle,
unsigned long size)
{
......@@ -403,8 +410,6 @@ setup_efi_pci32(struct boot_params *params, void **pci_handle,
data = (struct setup_data *)rom;
}
return status;
}
static efi_status_t
......@@ -463,7 +468,7 @@ __setup_efi_pci64(efi_pci_io_protocol_64 *pci, struct pci_setup_rom **__rom)
}
static efi_status_t
static void
setup_efi_pci64(struct boot_params *params, void **pci_handle,
unsigned long size)
{
......@@ -506,11 +511,18 @@ setup_efi_pci64(struct boot_params *params, void **pci_handle,
data = (struct setup_data *)rom;
}
return status;
}
static efi_status_t setup_efi_pci(struct boot_params *params)
/*
* There's no way to return an informative status from this function,
* because any analysis (and printing of error messages) needs to be
* done directly at the EFI function call-site.
*
* For example, EFI_INVALID_PARAMETER could indicate a bug or maybe we
* just didn't find any PCI devices, but there's no way to tell outside
* the context of the call.
*/
static void setup_efi_pci(struct boot_params *params)
{
efi_status_t status;
void **pci_handle = NULL;
......@@ -527,7 +539,7 @@ static efi_status_t setup_efi_pci(struct boot_params *params)
size, (void **)&pci_handle);
if (status != EFI_SUCCESS)
return status;
return;
status = efi_call_early(locate_handle,
EFI_LOCATE_BY_PROTOCOL, &pci_proto,
......@@ -538,13 +550,12 @@ static efi_status_t setup_efi_pci(struct boot_params *params)
goto free_handle;
if (efi_early->is64)
status = setup_efi_pci64(params, pci_handle, size);
setup_efi_pci64(params, pci_handle, size);
else
status = setup_efi_pci32(params, pci_handle, size);
setup_efi_pci32(params, pci_handle, size);
free_handle:
efi_call_early(free_pool, pci_handle);
return status;
}
static void
......@@ -1380,10 +1391,7 @@ struct boot_params *efi_main(struct efi_config *c,
setup_graphics(boot_params);
status = setup_efi_pci(boot_params);
if (status != EFI_SUCCESS) {
efi_printk(sys_table, "setup_efi_pci() failed!\n");
}
setup_efi_pci(boot_params);
status = efi_call_early(allocate_pool, EFI_LOADER_DATA,
sizeof(*gdt), (void **)&gdt);
......
......@@ -103,4 +103,20 @@ struct efi_uga_draw_protocol {
void *blt;
};
struct efi_config {
u64 image_handle;
u64 table;
u64 allocate_pool;
u64 allocate_pages;
u64 get_memory_map;
u64 free_pool;
u64 free_pages;
u64 locate_handle;
u64 handle_protocol;
u64 exit_boot_services;
u64 text_output;
efi_status_t (*call)(unsigned long, ...);
bool is64;
} __packed;
#endif /* BOOT_COMPRESSED_EBOOT_H */
......@@ -159,30 +159,6 @@ static inline efi_status_t efi_thunk_set_virtual_address_map(
}
#endif /* CONFIG_EFI_MIXED */
/* arch specific definitions used by the stub code */
struct efi_config {
u64 image_handle;
u64 table;
u64 allocate_pool;
u64 allocate_pages;
u64 get_memory_map;
u64 free_pool;
u64 free_pages;
u64 locate_handle;
u64 handle_protocol;
u64 exit_boot_services;
u64 text_output;
efi_status_t (*call)(unsigned long, ...);
bool is64;
} __packed;
extern struct efi_config *efi_early;
#define efi_call_early(f, ...) \
efi_early->call(efi_early->f, __VA_ARGS__);
extern bool efi_reboot_required(void);
#else
......
......@@ -7,4 +7,4 @@ obj-$(CONFIG_EFI_VARS_PSTORE) += efi-pstore.o
obj-$(CONFIG_UEFI_CPER) += cper.o
obj-$(CONFIG_EFI_RUNTIME_MAP) += runtime-map.o
obj-$(CONFIG_EFI_RUNTIME_WRAPPERS) += runtime-wrappers.o
obj-$(CONFIG_EFI_STUB) += libstub/
obj-$(CONFIG_EFI_ARM_STUB) += libstub/
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment