Explorar el Código

[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>
tags/v1.20.1
Michael Brown hace 10 años
padre
commit
102008f648
Se han modificado 1 ficheros con 34 adiciones y 1 borrados
  1. 34
    1
      src/interface/efi/efi_debug.c

+ 34
- 1
src/interface/efi/efi_debug.c Ver fichero

@@ -348,7 +348,37 @@ const char * efi_devpath_text ( EFI_DEVICE_PATH_PROTOCOL *path ) {
348 348
  * @v wtf		Component name protocol
349 349
  * @ret name		Driver name, or NULL
350 350
  */
351
-static const char * efi_driver_name ( EFI_COMPONENT_NAME2_PROTOCOL *wtf ) {
351
+static const char * efi_driver_name ( EFI_COMPONENT_NAME_PROTOCOL *wtf ) {
352
+	static char name[64];
353
+	CHAR16 *driver_name;
354
+	EFI_STATUS efirc;
355
+
356
+	/* Sanity check */
357
+	if ( ! wtf ) {
358
+		DBG ( "[NULL ComponentName]" );
359
+		return NULL;
360
+	}
361
+
362
+	/* Try "eng" first; if that fails then try the first language */
363
+	if ( ( ( efirc = wtf->GetDriverName ( wtf, "eng",
364
+					      &driver_name ) ) != 0 ) &&
365
+	     ( ( efirc = wtf->GetDriverName ( wtf, wtf->SupportedLanguages,
366
+					      &driver_name ) ) != 0 ) ) {
367
+		return NULL;
368
+	}
369
+
370
+	/* Convert name from CHAR16 to char */
371
+	snprintf ( name, sizeof ( name ), "%ls", driver_name );
372
+	return name;
373
+}
374
+
375
+/**
376
+ * Get driver name
377
+ *
378
+ * @v wtf		Component name protocol
379
+ * @ret name		Driver name, or NULL
380
+ */
381
+static const char * efi_driver_name2 ( EFI_COMPONENT_NAME2_PROTOCOL *wtf ) {
352 382
 	static char name[64];
353 383
 	CHAR16 *driver_name;
354 384
 	EFI_STATUS efirc;
@@ -559,6 +589,9 @@ static struct efi_handle_name_type efi_handle_name_types[] = {
559 589
 			       efi_devpath_text ),
560 590
 	/* Driver name (for driver image handles) */
561 591
 	EFI_HANDLE_NAME_TYPE ( &efi_component_name2_protocol_guid,
592
+			       efi_driver_name2 ),
593
+	/* Driver name (via obsolete original ComponentName protocol) */
594
+	EFI_HANDLE_NAME_TYPE ( &efi_component_name_protocol_guid,
562 595
 			       efi_driver_name ),
563 596
 	/* PE/COFF debug filename (for image handles) */
564 597
 	EFI_HANDLE_NAME_TYPE ( &efi_loaded_image_protocol_guid,

Loading…
Cancelar
Guardar