提交 77e21e87 编写于 作者: A Andre Müller 提交者: Matt Fleming

x86/efi: Adding efi_printks on memory allocationa and pci.reads

All other calls to allocate memory seem to make some noise already, with the
exception of two calls (for gop, uga) in the setup_graphics path.

The purpose is to be noisy on worrysome errors immediately.

commit fb86b244 ("x86/efi: Add better error logging to EFI boot
stub") introduces printing false alarms for lots of hardware. Rather
than playing Whack a Mole with non-fatal exit conditions, try the other
way round.

This is per Matt Fleming's suggestion:

> Where I think we could improve things
> is by adding efi_printk() message in certain error paths. Clearly, not
> all error paths need such messages, e.g. the EFI_INVALID_PARAMETER path
> you highlighted above, but it makes sense for memory allocation and PCI
> read failures.

Link: http://article.gmane.org/gmane.linux.kernel.efi/4628Signed-off-by: NAndre Müller <andre.muller@web.de>
Cc: Ulf Winkelvos <ulf@winkelvos.de>
Signed-off-by: NMatt Fleming <matt.fleming@intel.com>
上级 4e78eb05
...@@ -323,8 +323,10 @@ __setup_efi_pci32(efi_pci_io_protocol_32 *pci, struct pci_setup_rom **__rom) ...@@ -323,8 +323,10 @@ __setup_efi_pci32(efi_pci_io_protocol_32 *pci, struct pci_setup_rom **__rom)
size = pci->romsize + sizeof(*rom); size = pci->romsize + sizeof(*rom);
status = efi_call_early(allocate_pool, EFI_LOADER_DATA, size, &rom); status = efi_call_early(allocate_pool, EFI_LOADER_DATA, size, &rom);
if (status != EFI_SUCCESS) if (status != EFI_SUCCESS) {
efi_printk(sys_table, "Failed to alloc mem for rom\n");
return status; return status;
}
memset(rom, 0, sizeof(*rom)); memset(rom, 0, sizeof(*rom));
...@@ -337,14 +339,18 @@ __setup_efi_pci32(efi_pci_io_protocol_32 *pci, struct pci_setup_rom **__rom) ...@@ -337,14 +339,18 @@ __setup_efi_pci32(efi_pci_io_protocol_32 *pci, struct pci_setup_rom **__rom)
status = efi_early->call(pci->pci.read, pci, EfiPciIoWidthUint16, status = efi_early->call(pci->pci.read, pci, EfiPciIoWidthUint16,
PCI_VENDOR_ID, 1, &(rom->vendor)); PCI_VENDOR_ID, 1, &(rom->vendor));
if (status != EFI_SUCCESS) if (status != EFI_SUCCESS) {
efi_printk(sys_table, "Failed to read rom->vendor\n");
goto free_struct; goto free_struct;
}
status = efi_early->call(pci->pci.read, pci, EfiPciIoWidthUint16, status = efi_early->call(pci->pci.read, pci, EfiPciIoWidthUint16,
PCI_DEVICE_ID, 1, &(rom->devid)); PCI_DEVICE_ID, 1, &(rom->devid));
if (status != EFI_SUCCESS) if (status != EFI_SUCCESS) {
efi_printk(sys_table, "Failed to read rom->devid\n");
goto free_struct; goto free_struct;
}
status = efi_early->call(pci->get_location, pci, &(rom->segment), status = efi_early->call(pci->get_location, pci, &(rom->segment),
&(rom->bus), &(rom->device), &(rom->function)); &(rom->bus), &(rom->device), &(rom->function));
...@@ -427,8 +433,10 @@ __setup_efi_pci64(efi_pci_io_protocol_64 *pci, struct pci_setup_rom **__rom) ...@@ -427,8 +433,10 @@ __setup_efi_pci64(efi_pci_io_protocol_64 *pci, struct pci_setup_rom **__rom)
size = pci->romsize + sizeof(*rom); size = pci->romsize + sizeof(*rom);
status = efi_call_early(allocate_pool, EFI_LOADER_DATA, size, &rom); status = efi_call_early(allocate_pool, EFI_LOADER_DATA, size, &rom);
if (status != EFI_SUCCESS) if (status != EFI_SUCCESS) {
efi_printk(sys_table, "Failed to alloc mem for rom\n");
return status; return status;
}
rom->data.type = SETUP_PCI; rom->data.type = SETUP_PCI;
rom->data.len = size - sizeof(struct setup_data); rom->data.len = size - sizeof(struct setup_data);
...@@ -439,14 +447,18 @@ __setup_efi_pci64(efi_pci_io_protocol_64 *pci, struct pci_setup_rom **__rom) ...@@ -439,14 +447,18 @@ __setup_efi_pci64(efi_pci_io_protocol_64 *pci, struct pci_setup_rom **__rom)
status = efi_early->call(pci->pci.read, pci, EfiPciIoWidthUint16, status = efi_early->call(pci->pci.read, pci, EfiPciIoWidthUint16,
PCI_VENDOR_ID, 1, &(rom->vendor)); PCI_VENDOR_ID, 1, &(rom->vendor));
if (status != EFI_SUCCESS) if (status != EFI_SUCCESS) {
efi_printk(sys_table, "Failed to read rom->vendor\n");
goto free_struct; goto free_struct;
}
status = efi_early->call(pci->pci.read, pci, EfiPciIoWidthUint16, status = efi_early->call(pci->pci.read, pci, EfiPciIoWidthUint16,
PCI_DEVICE_ID, 1, &(rom->devid)); PCI_DEVICE_ID, 1, &(rom->devid));
if (status != EFI_SUCCESS) if (status != EFI_SUCCESS) {
efi_printk(sys_table, "Failed to read rom->devid\n");
goto free_struct; goto free_struct;
}
status = efi_early->call(pci->get_location, pci, &(rom->segment), status = efi_early->call(pci->get_location, pci, &(rom->segment),
&(rom->bus), &(rom->device), &(rom->function)); &(rom->bus), &(rom->device), &(rom->function));
...@@ -526,8 +538,10 @@ static efi_status_t setup_efi_pci(struct boot_params *params) ...@@ -526,8 +538,10 @@ static efi_status_t setup_efi_pci(struct boot_params *params)
EFI_LOADER_DATA, EFI_LOADER_DATA,
size, (void **)&pci_handle); size, (void **)&pci_handle);
if (status != EFI_SUCCESS) if (status != EFI_SUCCESS) {
efi_printk(sys_table, "Failed to alloc mem for pci_handle\n");
return status; return status;
}
status = efi_call_early(locate_handle, status = efi_call_early(locate_handle,
EFI_LOCATE_BY_PROTOCOL, &pci_proto, EFI_LOCATE_BY_PROTOCOL, &pci_proto,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册