[efi] Show all drivers claiming support for a handle in debug messages

UEFI assumes in several places that an image installs only a single
driver binding protocol instance, and that this is installed on the
image handle itself.  We therefore provide a single driver binding
protocol instance, which delegates to the various internal drivers
(for EFI_PCI_IO_PROTOCOL, EFI_USB_IO_PROTOCOL, etc) as appropriate.

The debug messages produced by our Supported() method can end up
slightly misleading, since they will report only the first internal
driver that claims support for a device.  In the common case of the
all-drivers build, there may be multiple drivers that claim support
for the same handle: for example, the PCI, NII, SNP, and MNP drivers
are all likely to initially find the protocols that they need on the
same device handle.

Report all internal drivers that claim support for a device, to avoid
confusing debug messages.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
pull/1437/head
Michael Brown 2025-03-29 15:11:57 +00:00
parent ea5762d9d0
commit be33224754
1 changed files with 12 additions and 5 deletions

View File

@ -167,6 +167,7 @@ static EFI_STATUS EFIAPI
efi_driver_supported ( EFI_DRIVER_BINDING_PROTOCOL *driver __unused,
EFI_HANDLE device, EFI_DEVICE_PATH_PROTOCOL *child ) {
struct efi_driver *efidrv;
unsigned int count;
int rc;
DBGCP ( device, "EFIDRV %s DRIVER_SUPPORTED",
@ -182,18 +183,24 @@ efi_driver_supported ( EFI_DRIVER_BINDING_PROTOCOL *driver __unused,
return EFI_ALREADY_STARTED;
}
/* Look for a driver claiming to support this device */
/* Count drivers claiming to support this device */
count = 0;
for_each_table_entry ( efidrv, EFI_DRIVERS ) {
if ( ( rc = efidrv->supported ( device ) ) == 0 ) {
DBGC ( device, "EFIDRV %s has driver \"%s\"\n",
efi_handle_name ( device ), efidrv->name );
return 0;
count++;
}
}
DBGCP ( device, "EFIDRV %s has no driver\n",
efi_handle_name ( device ) );
return EFI_UNSUPPORTED;
/* Check that we have at least one driver */
if ( ! count ) {
DBGCP ( device, "EFIDRV %s has no driver\n",
efi_handle_name ( device ) );
return EFI_UNSUPPORTED;
}
return 0;
}
/**