aboutsummaryrefslogtreecommitdiffstats
path: root/src/interface/efi/efi_debug.c
diff options
context:
space:
mode:
authorMichael Brown <mcb30@ipxe.org>2014-08-01 10:36:25 +0100
committerMichael Brown <mcb30@ipxe.org>2014-08-01 10:36:25 +0100
commit102008f648c6bf81a680a9dcb2d33fe9c15bfc16 (patch)
treeb677946cf18db1a044668be9390fdc6fd6d1513a /src/interface/efi/efi_debug.c
parentf2071769879dd2fe4a62a99f4816f09d960d5fe9 (diff)
downloadipxe-102008f648c6bf81a680a9dcb2d33fe9c15bfc16.tar.gz
[efi] Also try original ComponentName protocol for retrieving driver names
The ComponentName and ComponentName2 protocols differ only in the standard which is used for language name codes. Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/interface/efi/efi_debug.c')
-rw-r--r--src/interface/efi/efi_debug.c35
1 files changed, 34 insertions, 1 deletions
diff --git a/src/interface/efi/efi_debug.c b/src/interface/efi/efi_debug.c
index a3d2438fe..da8efb1ec 100644
--- a/src/interface/efi/efi_debug.c
+++ b/src/interface/efi/efi_debug.c
@@ -348,7 +348,37 @@ const char * efi_devpath_text ( EFI_DEVICE_PATH_PROTOCOL *path ) {
* @v wtf Component name protocol
* @ret name Driver name, or NULL
*/
-static const char * efi_driver_name ( EFI_COMPONENT_NAME2_PROTOCOL *wtf ) {
+static const char * efi_driver_name ( EFI_COMPONENT_NAME_PROTOCOL *wtf ) {
+ static char name[64];
+ CHAR16 *driver_name;
+ EFI_STATUS efirc;
+
+ /* Sanity check */
+ if ( ! wtf ) {
+ DBG ( "[NULL ComponentName]" );
+ return NULL;
+ }
+
+ /* Try "eng" first; if that fails then try the first language */
+ if ( ( ( efirc = wtf->GetDriverName ( wtf, "eng",
+ &driver_name ) ) != 0 ) &&
+ ( ( efirc = wtf->GetDriverName ( wtf, wtf->SupportedLanguages,
+ &driver_name ) ) != 0 ) ) {
+ return NULL;
+ }
+
+ /* Convert name from CHAR16 to char */
+ snprintf ( name, sizeof ( name ), "%ls", driver_name );
+ return name;
+}
+
+/**
+ * Get driver name
+ *
+ * @v wtf Component name protocol
+ * @ret name Driver name, or NULL
+ */
+static const char * efi_driver_name2 ( EFI_COMPONENT_NAME2_PROTOCOL *wtf ) {
static char name[64];
CHAR16 *driver_name;
EFI_STATUS efirc;
@@ -559,6 +589,9 @@ static struct efi_handle_name_type efi_handle_name_types[] = {
efi_devpath_text ),
/* Driver name (for driver image handles) */
EFI_HANDLE_NAME_TYPE ( &efi_component_name2_protocol_guid,
+ efi_driver_name2 ),
+ /* Driver name (via obsolete original ComponentName protocol) */
+ EFI_HANDLE_NAME_TYPE ( &efi_component_name_protocol_guid,
efi_driver_name ),
/* PE/COFF debug filename (for image handles) */
EFI_HANDLE_NAME_TYPE ( &efi_loaded_image_protocol_guid,