]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
Dump type and vendor specific data when printing device path.
authorVladimir Serbinenko <phcoder@gmail.com>
Tue, 24 Dec 2013 13:05:48 +0000 (14:05 +0100)
committerVladimir Serbinenko <phcoder@gmail.com>
Tue, 24 Dec 2013 13:05:48 +0000 (14:05 +0100)
ChangeLog
grub-core/kern/efi/efi.c
include/grub/efi/api.h

index 8ad7bcd9fb428f3f84c201f67709019ec865634f..21106903c5df89838bddad990d3bf0a164319906 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -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.
index c2a5c32ff259bb394ab473d55d8f5cdce520d102..e1c9356ae989f9d5993ce76b614c3dd176c888b4 100644 (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:
              {
index a0dfec72ea17b9ddc794cabc30c12b4ce39cb09d..233e792a584550ec33413a95b528621f4040cf8d 100644 (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