Dump type and vendor specific data when printing device path.

This commit is contained in:
Vladimir Serbinenko 2013-12-24 14:05:48 +01:00
parent 72f099578e
commit fba31b5f69
3 changed files with 38 additions and 55 deletions

View file

@ -1,3 +1,7 @@
2013-12-24 Vladimir Serbinenko <phcoder@gmail.com>
Dump type and vendor specific data when printing device path.
2013-12-23 Colin Watson <cjwatson@debian.org>
Update some documentation to refer to Git rather than Bazaar.

View file

@ -385,6 +385,34 @@ grub_efi_get_device_path (grub_efi_handle_t handle)
GRUB_EFI_OPEN_PROTOCOL_GET_PROTOCOL);
}
static void
dump_vendor_path (const char *type, grub_efi_vendor_device_path_t *vendor)
{
grub_uint32_t vendor_data_len = vendor->header.length - sizeof (*vendor);
grub_printf ("/%sVendor(%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x)[%x: ",
type,
(unsigned) vendor->vendor_guid.data1,
(unsigned) vendor->vendor_guid.data2,
(unsigned) vendor->vendor_guid.data3,
(unsigned) vendor->vendor_guid.data4[0],
(unsigned) vendor->vendor_guid.data4[1],
(unsigned) vendor->vendor_guid.data4[2],
(unsigned) vendor->vendor_guid.data4[3],
(unsigned) vendor->vendor_guid.data4[4],
(unsigned) vendor->vendor_guid.data4[5],
(unsigned) vendor->vendor_guid.data4[6],
(unsigned) vendor->vendor_guid.data4[7],
vendor_data_len);
if (vendor->header.length > sizeof (*vendor))
{
grub_uint32_t i;
for (i = 0; i < vendor_data_len; i++)
grub_printf ("%02x ", vendor->vendor_defined_data[i]);
}
grub_printf ("]");
}
/* Print the chain of Device Path nodes. This is mainly for debugging. */
void
grub_efi_print_device_path (grub_efi_device_path_t *dp)
@ -444,21 +472,8 @@ grub_efi_print_device_path (grub_efi_device_path_t *dp)
}
break;
case GRUB_EFI_VENDOR_DEVICE_PATH_SUBTYPE:
{
grub_efi_vendor_device_path_t *vendor = (grub_efi_vendor_device_path_t *) dp;
grub_printf ("/Vendor(%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x)",
(unsigned) vendor->vendor_guid.data1,
(unsigned) vendor->vendor_guid.data2,
(unsigned) vendor->vendor_guid.data3,
(unsigned) vendor->vendor_guid.data4[0],
(unsigned) vendor->vendor_guid.data4[1],
(unsigned) vendor->vendor_guid.data4[2],
(unsigned) vendor->vendor_guid.data4[3],
(unsigned) vendor->vendor_guid.data4[4],
(unsigned) vendor->vendor_guid.data4[5],
(unsigned) vendor->vendor_guid.data4[6],
(unsigned) vendor->vendor_guid.data4[7]);
}
dump_vendor_path ("Hardware",
(grub_efi_vendor_device_path_t *) dp);
break;
case GRUB_EFI_CONTROLLER_DEVICE_PATH_SUBTYPE:
{
@ -663,22 +678,8 @@ grub_efi_print_device_path (grub_efi_device_path_t *dp)
}
break;
case GRUB_EFI_VENDOR_MESSAGING_DEVICE_PATH_SUBTYPE:
{
grub_efi_vendor_messaging_device_path_t *vendor
= (grub_efi_vendor_messaging_device_path_t *) dp;
grub_printf ("/Vendor(%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x)",
(unsigned) vendor->vendor_guid.data1,
(unsigned) vendor->vendor_guid.data2,
(unsigned) vendor->vendor_guid.data3,
(unsigned) vendor->vendor_guid.data4[0],
(unsigned) vendor->vendor_guid.data4[1],
(unsigned) vendor->vendor_guid.data4[2],
(unsigned) vendor->vendor_guid.data4[3],
(unsigned) vendor->vendor_guid.data4[4],
(unsigned) vendor->vendor_guid.data4[5],
(unsigned) vendor->vendor_guid.data4[6],
(unsigned) vendor->vendor_guid.data4[7]);
}
dump_vendor_path ("Messaging",
(grub_efi_vendor_device_path_t *) dp);
break;
default:
grub_printf ("/UnknownMessaging(%x)", (unsigned) subtype);
@ -719,22 +720,8 @@ grub_efi_print_device_path (grub_efi_device_path_t *dp)
}
break;
case GRUB_EFI_VENDOR_MEDIA_DEVICE_PATH_SUBTYPE:
{
grub_efi_vendor_device_path_t *vendor = (grub_efi_vendor_device_path_t *) dp;
grub_printf ("/Vendor(%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x)",
(unsigned) vendor->vendor_guid.data1,
(unsigned) vendor->vendor_guid.data2,
(unsigned) vendor->vendor_guid.data3,
(unsigned) vendor->vendor_guid.data4[0],
(unsigned) vendor->vendor_guid.data4[1],
(unsigned) vendor->vendor_guid.data4[2],
(unsigned) vendor->vendor_guid.data4[3],
(unsigned) vendor->vendor_guid.data4[4],
(unsigned) vendor->vendor_guid.data4[5],
(unsigned) vendor->vendor_guid.data4[6],
(unsigned) vendor->vendor_guid.data4[7]);
}
dump_vendor_path ("Media",
(grub_efi_vendor_device_path_t *) dp);
break;
case GRUB_EFI_FILE_PATH_DEVICE_PATH_SUBTYPE:
{

View file

@ -815,14 +815,6 @@ typedef struct grub_efi_uart_device_path grub_efi_uart_device_path_t;
#define GRUB_EFI_VENDOR_MESSAGING_DEVICE_PATH_SUBTYPE 10
struct grub_efi_vendor_messaging_device_path
{
grub_efi_device_path_t header;
grub_efi_packed_guid_t vendor_guid;
grub_efi_uint8_t vendor_defined_data[0];
} GRUB_PACKED;
typedef struct grub_efi_vendor_messaging_device_path grub_efi_vendor_messaging_device_path_t;
/* Media Device Path. */
#define GRUB_EFI_MEDIA_DEVICE_PATH_TYPE 4