summaryrefslogtreecommitdiffstats
path: root/src/interface/efi/efi_driver.c
diff options
context:
space:
mode:
authorMichael Brown2012-11-21 03:37:55 +0100
committerMichael Brown2012-11-21 04:26:45 +0100
commit1a79f6f37a4a3bf1876cbfa3162dfe903da212cc (patch)
tree89cb8eb81d4d305167c0b99a00728b2bd46093d8 /src/interface/efi/efi_driver.c
parent[bzimage] Allow initrds to be rearranged in place (diff)
downloadipxe-1a79f6f37a4a3bf1876cbfa3162dfe903da212cc.tar.gz
ipxe-1a79f6f37a4a3bf1876cbfa3162dfe903da212cc.tar.xz
ipxe-1a79f6f37a4a3bf1876cbfa3162dfe903da212cc.zip
[efi] Delegate to child device's EFI_COMPONENT_NAME2_PROTOCOL, if present
EFI's device naming model requires drivers to provide names for child devices. Allow the driver's GetControllerName() method to delegate to an instance of EFI_COMPONENT_NAME2_PROTOCOL installed on the child device itself (if present); this allows the SNP device to expose its own device name via the PCI driver's GetControllerName() method. Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/interface/efi/efi_driver.c')
-rw-r--r--src/interface/efi/efi_driver.c27
1 files changed, 22 insertions, 5 deletions
diff --git a/src/interface/efi/efi_driver.c b/src/interface/efi/efi_driver.c
index 476b3c32..deb3cf2c 100644
--- a/src/interface/efi/efi_driver.c
+++ b/src/interface/efi/efi_driver.c
@@ -90,12 +90,29 @@ efi_driver_get_driver_name ( EFI_COMPONENT_NAME2_PROTOCOL *wtf,
*/
static EFI_STATUS EFIAPI
efi_driver_get_controller_name ( EFI_COMPONENT_NAME2_PROTOCOL *wtf __unused,
- EFI_HANDLE device __unused,
- EFI_HANDLE child __unused,
- CHAR8 *language __unused,
- CHAR16 **controller_name __unused ) {
+ EFI_HANDLE device, EFI_HANDLE child,
+ CHAR8 *language, CHAR16 **controller_name ) {
+ EFI_BOOT_SERVICES *bs = efi_systab->BootServices;
+ union {
+ EFI_COMPONENT_NAME2_PROTOCOL *name2;
+ void *interface;
+ } name2;
+ EFI_STATUS efirc;
+
+ /* Delegate to the EFI_COMPONENT_NAME2_PROTOCOL instance
+ * installed on child handle, if present.
+ */
+ if ( ( child != NULL ) &&
+ ( ( efirc = bs->OpenProtocol (
+ child, &efi_component_name2_protocol_guid,
+ &name2.interface, NULL, NULL,
+ EFI_OPEN_PROTOCOL_GET_PROTOCOL ) ) == 0 ) ) {
+ return name2.name2->GetControllerName ( name2.name2, device,
+ child, language,
+ controller_name );
+ }
- /* Just let EFI use the default Device Path Name */
+ /* Otherwise, let EFI use the default Device Path Name */
return EFI_UNSUPPORTED;
}