Browse Source

[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>
tags/v1.20.1
Michael Brown 12 years ago
parent
commit
1a79f6f37a
1 changed files with 22 additions and 5 deletions
  1. 22
    5
      src/interface/efi/efi_driver.c

+ 22
- 5
src/interface/efi/efi_driver.c View File

90
  */
90
  */
91
 static EFI_STATUS EFIAPI
91
 static EFI_STATUS EFIAPI
92
 efi_driver_get_controller_name ( EFI_COMPONENT_NAME2_PROTOCOL *wtf __unused,
92
 efi_driver_get_controller_name ( EFI_COMPONENT_NAME2_PROTOCOL *wtf __unused,
93
-				 EFI_HANDLE device __unused,
94
-				 EFI_HANDLE child __unused,
95
-				 CHAR8 *language __unused,
96
-				 CHAR16 **controller_name __unused ) {
93
+				 EFI_HANDLE device, EFI_HANDLE child,
94
+				 CHAR8 *language, CHAR16 **controller_name ) {
95
+	EFI_BOOT_SERVICES *bs = efi_systab->BootServices;
96
+	union {
97
+		EFI_COMPONENT_NAME2_PROTOCOL *name2;
98
+		void *interface;
99
+	} name2;
100
+	EFI_STATUS efirc;
101
+
102
+	/* Delegate to the EFI_COMPONENT_NAME2_PROTOCOL instance
103
+	 * installed on child handle, if present.
104
+	 */
105
+	if ( ( child != NULL ) &&
106
+	     ( ( efirc = bs->OpenProtocol (
107
+			  child, &efi_component_name2_protocol_guid,
108
+			  &name2.interface, NULL, NULL,
109
+			  EFI_OPEN_PROTOCOL_GET_PROTOCOL ) ) == 0 ) ) {
110
+		return name2.name2->GetControllerName ( name2.name2, device,
111
+							child, language,
112
+							controller_name );
113
+	}
97
 
114
 
98
-	/* Just let EFI use the default Device Path Name */
115
+	/* Otherwise, let EFI use the default Device Path Name */
99
 	return EFI_UNSUPPORTED;
116
 	return EFI_UNSUPPORTED;
100
 }
117
 }
101
 
118
 

Loading…
Cancel
Save