1 /* efi.c - generic EFI support */
3 * GRUB -- GRand Unified Bootloader
4 * Copyright (C) 2006,2007,2008 Free Software Foundation, Inc.
6 * GRUB is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
11 * GRUB is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with GRUB. If not, see <http://www.gnu.org/licenses/>.
20 #include <grub/misc.h>
21 #include <grub/efi/api.h>
22 #include <grub/efi/efi.h>
23 #include <grub/efi/console_control.h>
24 #include <grub/efi/pe32.h>
25 #include <grub/machine/time.h>
26 #include <grub/term.h>
27 #include <grub/kernel.h>
30 /* The handle of GRUB itself. Filled in by the startup code. */
31 grub_efi_handle_t grub_efi_image_handle
;
33 /* The pointer to a system table. Filled in by the startup code. */
34 grub_efi_system_table_t
*grub_efi_system_table
;
36 static grub_efi_guid_t console_control_guid
= GRUB_EFI_CONSOLE_CONTROL_GUID
;
37 static grub_efi_guid_t loaded_image_guid
= GRUB_EFI_LOADED_IMAGE_GUID
;
38 static grub_efi_guid_t device_path_guid
= GRUB_EFI_DEVICE_PATH_GUID
;
41 grub_efi_locate_protocol (grub_efi_guid_t
*protocol
, void *registration
)
44 grub_efi_status_t status
;
46 status
= efi_call_3 (grub_efi_system_table
->boot_services
->locate_protocol
,
47 protocol
, registration
, &interface
);
48 if (status
!= GRUB_EFI_SUCCESS
)
54 /* Return the array of handles which meet the requirement. If successful,
55 the number of handles is stored in NUM_HANDLES. The array is allocated
58 grub_efi_locate_handle (grub_efi_locate_search_type_t search_type
,
59 grub_efi_guid_t
*protocol
,
61 grub_efi_uintn_t
*num_handles
)
63 grub_efi_boot_services_t
*b
;
64 grub_efi_status_t status
;
65 grub_efi_handle_t
*buffer
;
66 grub_efi_uintn_t buffer_size
= 8 * sizeof (grub_efi_handle_t
);
68 buffer
= grub_malloc (buffer_size
);
72 b
= grub_efi_system_table
->boot_services
;
73 status
= efi_call_5 (b
->locate_handle
, search_type
, protocol
, search_key
,
74 &buffer_size
, buffer
);
75 if (status
== GRUB_EFI_BUFFER_TOO_SMALL
)
78 buffer
= grub_malloc (buffer_size
);
82 status
= efi_call_5 (b
->locate_handle
, search_type
, protocol
, search_key
,
83 &buffer_size
, buffer
);
86 if (status
!= GRUB_EFI_SUCCESS
)
92 *num_handles
= buffer_size
/ sizeof (grub_efi_handle_t
);
97 grub_efi_open_protocol (grub_efi_handle_t handle
,
98 grub_efi_guid_t
*protocol
,
99 grub_efi_uint32_t attributes
)
101 grub_efi_boot_services_t
*b
;
102 grub_efi_status_t status
;
105 b
= grub_efi_system_table
->boot_services
;
106 status
= efi_call_6 (b
->open_protocol
, handle
,
109 grub_efi_image_handle
,
112 if (status
!= GRUB_EFI_SUCCESS
)
119 grub_efi_set_text_mode (int on
)
121 grub_efi_console_control_protocol_t
*c
;
122 grub_efi_screen_mode_t mode
, new_mode
;
124 c
= grub_efi_locate_protocol (&console_control_guid
, 0);
126 /* No console control protocol instance available, assume it is
127 already in text mode. */
130 if (efi_call_4 (c
->get_mode
, c
, &mode
, 0, 0) != GRUB_EFI_SUCCESS
)
133 new_mode
= on
? GRUB_EFI_SCREEN_TEXT
: GRUB_EFI_SCREEN_GRAPHICS
;
134 if (mode
!= new_mode
)
135 if (efi_call_2 (c
->set_mode
, c
, new_mode
) != GRUB_EFI_SUCCESS
)
142 grub_efi_stall (grub_efi_uintn_t microseconds
)
144 efi_call_1 (grub_efi_system_table
->boot_services
->stall
, microseconds
);
147 grub_efi_loaded_image_t
*
148 grub_efi_get_loaded_image (grub_efi_handle_t image_handle
)
150 return grub_efi_open_protocol (image_handle
,
152 GRUB_EFI_OPEN_PROTOCOL_GET_PROTOCOL
);
159 efi_call_4 (grub_efi_system_table
->boot_services
->exit
,
160 grub_efi_image_handle
, GRUB_EFI_SUCCESS
, 0, 0);
167 efi_call_4 (grub_efi_system_table
->runtime_services
->reset_system
,
168 GRUB_EFI_RESET_COLD
, GRUB_EFI_SUCCESS
, 0, NULL
);
175 efi_call_4 (grub_efi_system_table
->runtime_services
->reset_system
,
176 GRUB_EFI_RESET_SHUTDOWN
, GRUB_EFI_SUCCESS
, 0, NULL
);
180 grub_efi_exit_boot_services (grub_efi_uintn_t map_key
)
182 grub_efi_boot_services_t
*b
;
183 grub_efi_status_t status
;
185 b
= grub_efi_system_table
->boot_services
;
186 status
= efi_call_2 (b
->exit_boot_services
, grub_efi_image_handle
, map_key
);
187 return status
== GRUB_EFI_SUCCESS
;
193 grub_efi_time_t time
;
194 grub_efi_runtime_services_t
*r
;
196 r
= grub_efi_system_table
->runtime_services
;
197 if (efi_call_2 (r
->get_time
, &time
, 0) != GRUB_EFI_SUCCESS
)
198 /* What is possible in this case? */
201 return (((time
.minute
* 60 + time
.second
) * 1000
202 + time
.nanosecond
/ 1000000)
203 * GRUB_TICKS_PER_SECOND
/ 1000);
206 /* Search the mods section from the PE32/PE32+ image. This code uses
207 a PE32 header, but should work with PE32+ as well. */
209 grub_arch_modules_addr (void)
211 grub_efi_loaded_image_t
*image
;
212 struct grub_pe32_header
*header
;
213 struct grub_pe32_coff_header
*coff_header
;
214 struct grub_pe32_section_table
*sections
;
215 struct grub_pe32_section_table
*section
;
216 struct grub_module_info
*info
;
219 image
= grub_efi_get_loaded_image (grub_efi_image_handle
);
223 header
= image
->image_base
;
224 coff_header
= &(header
->coff_header
);
226 = (struct grub_pe32_section_table
*) ((char *) coff_header
227 + sizeof (*coff_header
)
228 + coff_header
->optional_header_size
);
230 for (i
= 0, section
= sections
;
231 i
< coff_header
->num_sections
;
234 if (grub_strcmp (section
->name
, "mods") == 0)
238 if (i
== coff_header
->num_sections
)
241 info
= (struct grub_module_info
*) ((char *) image
->image_base
242 + section
->virtual_address
);
243 if (info
->magic
!= GRUB_MODULE_MAGIC
)
246 return (grub_addr_t
) info
;
250 grub_efi_get_filename (grub_efi_device_path_t
*dp
)
256 grub_efi_uint8_t type
= GRUB_EFI_DEVICE_PATH_TYPE (dp
);
257 grub_efi_uint8_t subtype
= GRUB_EFI_DEVICE_PATH_SUBTYPE (dp
);
259 if (type
== GRUB_EFI_END_DEVICE_PATH_TYPE
)
261 else if (type
== GRUB_EFI_MEDIA_DEVICE_PATH_TYPE
262 && subtype
== GRUB_EFI_FILE_PATH_DEVICE_PATH_SUBTYPE
)
264 grub_efi_file_path_device_path_t
*fp
;
265 grub_efi_uint16_t len
;
271 size
= grub_strlen (name
);
278 len
= ((GRUB_EFI_DEVICE_PATH_LENGTH (dp
) - 4)
279 / sizeof (grub_efi_char16_t
));
280 p
= grub_realloc (name
, size
+ len
* 4 + 1);
288 fp
= (grub_efi_file_path_device_path_t
*) dp
;
289 *grub_utf16_to_utf8 ((grub_uint8_t
*) name
+ size
,
290 fp
->path_name
, len
) = '\0';
293 dp
= GRUB_EFI_NEXT_DEVICE_PATH (dp
);
298 /* EFI breaks paths with backslashes. */
301 for (p
= name
; *p
; p
++)
309 grub_efi_device_path_t
*
310 grub_efi_get_device_path (grub_efi_handle_t handle
)
312 return grub_efi_open_protocol (handle
, &device_path_guid
,
313 GRUB_EFI_OPEN_PROTOCOL_GET_PROTOCOL
);
316 /* Print the chain of Device Path nodes. This is mainly for debugging. */
318 grub_efi_print_device_path (grub_efi_device_path_t
*dp
)
322 grub_efi_uint8_t type
= GRUB_EFI_DEVICE_PATH_TYPE (dp
);
323 grub_efi_uint8_t subtype
= GRUB_EFI_DEVICE_PATH_SUBTYPE (dp
);
324 grub_efi_uint16_t len
= GRUB_EFI_DEVICE_PATH_LENGTH (dp
);
328 case GRUB_EFI_END_DEVICE_PATH_TYPE
:
331 case GRUB_EFI_END_ENTIRE_DEVICE_PATH_SUBTYPE
:
332 grub_printf ("/EndEntire\n");
333 //grub_putchar ('\n');
335 case GRUB_EFI_END_THIS_DEVICE_PATH_SUBTYPE
:
336 grub_printf ("/EndThis\n");
337 //grub_putchar ('\n');
340 grub_printf ("/EndUnknown(%x)\n", (unsigned) subtype
);
345 case GRUB_EFI_HARDWARE_DEVICE_PATH_TYPE
:
348 case GRUB_EFI_PCI_DEVICE_PATH_SUBTYPE
:
350 grub_efi_pci_device_path_t pci
;
351 grub_memcpy (&pci
, dp
, len
);
352 grub_printf ("/PCI(%x,%x)",
353 (unsigned) pci
.function
, (unsigned) pci
.device
);
356 case GRUB_EFI_PCCARD_DEVICE_PATH_SUBTYPE
:
358 grub_efi_pccard_device_path_t pccard
;
359 grub_memcpy (&pccard
, dp
, len
);
360 grub_printf ("/PCCARD(%x)",
361 (unsigned) pccard
.function
);
364 case GRUB_EFI_MEMORY_MAPPED_DEVICE_PATH_SUBTYPE
:
366 grub_efi_memory_mapped_device_path_t mmapped
;
367 grub_memcpy (&mmapped
, dp
, len
);
368 grub_printf ("/MMap(%x,%llx,%llx)",
369 (unsigned) mmapped
.memory_type
,
370 (unsigned long long) mmapped
.start_address
,
371 (unsigned long long) mmapped
.end_address
);
374 case GRUB_EFI_VENDOR_DEVICE_PATH_SUBTYPE
:
376 grub_efi_vendor_device_path_t vendor
;
377 grub_memcpy (&vendor
, dp
, sizeof (vendor
));
378 grub_printf ("/Vendor(%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x)",
379 (unsigned) vendor
.vendor_guid
.data1
,
380 (unsigned) vendor
.vendor_guid
.data2
,
381 (unsigned) vendor
.vendor_guid
.data3
,
382 (unsigned) vendor
.vendor_guid
.data4
[0],
383 (unsigned) vendor
.vendor_guid
.data4
[1],
384 (unsigned) vendor
.vendor_guid
.data4
[2],
385 (unsigned) vendor
.vendor_guid
.data4
[3],
386 (unsigned) vendor
.vendor_guid
.data4
[4],
387 (unsigned) vendor
.vendor_guid
.data4
[5],
388 (unsigned) vendor
.vendor_guid
.data4
[6],
389 (unsigned) vendor
.vendor_guid
.data4
[7]);
392 case GRUB_EFI_CONTROLLER_DEVICE_PATH_SUBTYPE
:
394 grub_efi_controller_device_path_t controller
;
395 grub_memcpy (&controller
, dp
, len
);
396 grub_printf ("/Ctrl(%x)",
397 (unsigned) controller
.controller_number
);
401 grub_printf ("/UnknownHW(%x)", (unsigned) subtype
);
406 case GRUB_EFI_ACPI_DEVICE_PATH_TYPE
:
409 case GRUB_EFI_ACPI_DEVICE_PATH_SUBTYPE
:
411 grub_efi_acpi_device_path_t acpi
;
412 grub_memcpy (&acpi
, dp
, len
);
413 grub_printf ("/ACPI(%x,%x)",
415 (unsigned) acpi
.uid
);
418 case GRUB_EFI_EXPANDED_ACPI_DEVICE_PATH_SUBTYPE
:
420 grub_efi_expanded_acpi_device_path_t eacpi
;
421 grub_memcpy (&eacpi
, dp
, sizeof (eacpi
));
422 grub_printf ("/ACPI(");
424 if (GRUB_EFI_EXPANDED_ACPI_HIDSTR (dp
)[0] == '\0')
425 grub_printf ("%x,", (unsigned) eacpi
.hid
);
427 grub_printf ("%s,", GRUB_EFI_EXPANDED_ACPI_HIDSTR (dp
));
429 if (GRUB_EFI_EXPANDED_ACPI_UIDSTR (dp
)[0] == '\0')
430 grub_printf ("%x,", (unsigned) eacpi
.uid
);
432 grub_printf ("%s,", GRUB_EFI_EXPANDED_ACPI_UIDSTR (dp
));
434 if (GRUB_EFI_EXPANDED_ACPI_CIDSTR (dp
)[0] == '\0')
435 grub_printf ("%x)", (unsigned) eacpi
.cid
);
437 grub_printf ("%s)", GRUB_EFI_EXPANDED_ACPI_CIDSTR (dp
));
441 grub_printf ("/UnknownACPI(%x)", (unsigned) subtype
);
446 case GRUB_EFI_MESSAGING_DEVICE_PATH_TYPE
:
449 case GRUB_EFI_ATAPI_DEVICE_PATH_SUBTYPE
:
451 grub_efi_atapi_device_path_t atapi
;
452 grub_memcpy (&atapi
, dp
, len
);
453 grub_printf ("/ATAPI(%x,%x,%x)",
454 (unsigned) atapi
.primary_secondary
,
455 (unsigned) atapi
.slave_master
,
456 (unsigned) atapi
.lun
);
459 case GRUB_EFI_SCSI_DEVICE_PATH_SUBTYPE
:
461 grub_efi_scsi_device_path_t scsi
;
462 grub_memcpy (&scsi
, dp
, len
);
463 grub_printf ("/SCSI(%x,%x)",
465 (unsigned) scsi
.lun
);
468 case GRUB_EFI_FIBRE_CHANNEL_DEVICE_PATH_SUBTYPE
:
470 grub_efi_fibre_channel_device_path_t fc
;
471 grub_memcpy (&fc
, dp
, len
);
472 grub_printf ("/FibreChannel(%llx,%llx)",
473 (unsigned long long) fc
.wwn
,
474 (unsigned long long) fc
.lun
);
477 case GRUB_EFI_1394_DEVICE_PATH_SUBTYPE
:
479 grub_efi_1394_device_path_t firewire
;
480 grub_memcpy (&firewire
, dp
, len
);
481 grub_printf ("/1394(%llx)", (unsigned long long) firewire
.guid
);
484 case GRUB_EFI_USB_DEVICE_PATH_SUBTYPE
:
486 grub_efi_usb_device_path_t usb
;
487 grub_memcpy (&usb
, dp
, len
);
488 grub_printf ("/USB(%x,%x)",
489 (unsigned) usb
.parent_port_number
,
490 (unsigned) usb
.interface
);
493 case GRUB_EFI_USB_CLASS_DEVICE_PATH_SUBTYPE
:
495 grub_efi_usb_class_device_path_t usb_class
;
496 grub_memcpy (&usb_class
, dp
, len
);
497 grub_printf ("/USBClass(%x,%x,%x,%x,%x)",
498 (unsigned) usb_class
.vendor_id
,
499 (unsigned) usb_class
.product_id
,
500 (unsigned) usb_class
.device_class
,
501 (unsigned) usb_class
.device_subclass
,
502 (unsigned) usb_class
.device_protocol
);
505 case GRUB_EFI_I2O_DEVICE_PATH_SUBTYPE
:
507 grub_efi_i2o_device_path_t i2o
;
508 grub_memcpy (&i2o
, dp
, len
);
509 grub_printf ("/I2O(%x)", (unsigned) i2o
.tid
);
512 case GRUB_EFI_MAC_ADDRESS_DEVICE_PATH_SUBTYPE
:
514 grub_efi_mac_address_device_path_t mac
;
515 grub_memcpy (&mac
, dp
, len
);
516 grub_printf ("/MacAddr(%02x:%02x:%02x:%02x:%02x:%02x,%x)",
517 (unsigned) mac
.mac_address
[0],
518 (unsigned) mac
.mac_address
[1],
519 (unsigned) mac
.mac_address
[2],
520 (unsigned) mac
.mac_address
[3],
521 (unsigned) mac
.mac_address
[4],
522 (unsigned) mac
.mac_address
[5],
523 (unsigned) mac
.if_type
);
526 case GRUB_EFI_IPV4_DEVICE_PATH_SUBTYPE
:
528 grub_efi_ipv4_device_path_t ipv4
;
529 grub_memcpy (&ipv4
, dp
, len
);
530 grub_printf ("/IPv4(%u.%u.%u.%u,%u.%u.%u.%u,%u,%u,%x,%x)",
531 (unsigned) ipv4
.local_ip_address
[0],
532 (unsigned) ipv4
.local_ip_address
[1],
533 (unsigned) ipv4
.local_ip_address
[2],
534 (unsigned) ipv4
.local_ip_address
[3],
535 (unsigned) ipv4
.remote_ip_address
[0],
536 (unsigned) ipv4
.remote_ip_address
[1],
537 (unsigned) ipv4
.remote_ip_address
[2],
538 (unsigned) ipv4
.remote_ip_address
[3],
539 (unsigned) ipv4
.local_port
,
540 (unsigned) ipv4
.remote_port
,
541 (unsigned) ipv4
.protocol
,
542 (unsigned) ipv4
.static_ip_address
);
545 case GRUB_EFI_IPV6_DEVICE_PATH_SUBTYPE
:
547 grub_efi_ipv6_device_path_t ipv6
;
548 grub_memcpy (&ipv6
, dp
, len
);
549 grub_printf ("/IPv6(%x:%x:%x:%x:%x:%x:%x:%x,%x:%x:%x:%x:%x:%x:%x:%x,%u,%u,%x,%x)",
550 (unsigned) ipv6
.local_ip_address
[0],
551 (unsigned) ipv6
.local_ip_address
[1],
552 (unsigned) ipv6
.local_ip_address
[2],
553 (unsigned) ipv6
.local_ip_address
[3],
554 (unsigned) ipv6
.local_ip_address
[4],
555 (unsigned) ipv6
.local_ip_address
[5],
556 (unsigned) ipv6
.local_ip_address
[6],
557 (unsigned) ipv6
.local_ip_address
[7],
558 (unsigned) ipv6
.remote_ip_address
[0],
559 (unsigned) ipv6
.remote_ip_address
[1],
560 (unsigned) ipv6
.remote_ip_address
[2],
561 (unsigned) ipv6
.remote_ip_address
[3],
562 (unsigned) ipv6
.remote_ip_address
[4],
563 (unsigned) ipv6
.remote_ip_address
[5],
564 (unsigned) ipv6
.remote_ip_address
[6],
565 (unsigned) ipv6
.remote_ip_address
[7],
566 (unsigned) ipv6
.local_port
,
567 (unsigned) ipv6
.remote_port
,
568 (unsigned) ipv6
.protocol
,
569 (unsigned) ipv6
.static_ip_address
);
572 case GRUB_EFI_INFINIBAND_DEVICE_PATH_SUBTYPE
:
574 grub_efi_infiniband_device_path_t ib
;
575 grub_memcpy (&ib
, dp
, len
);
576 grub_printf ("/InfiniBand(%x,%llx,%llx,%llx)",
577 (unsigned) ib
.port_gid
[0], /* XXX */
578 (unsigned long long) ib
.remote_id
,
579 (unsigned long long) ib
.target_port_id
,
580 (unsigned long long) ib
.device_id
);
583 case GRUB_EFI_UART_DEVICE_PATH_SUBTYPE
:
585 grub_efi_uart_device_path_t uart
;
586 grub_memcpy (&uart
, dp
, len
);
587 grub_printf ("/UART(%llu,%u,%x,%x)",
588 (unsigned long long) uart
.baud_rate
,
594 case GRUB_EFI_VENDOR_MESSAGING_DEVICE_PATH_SUBTYPE
:
596 grub_efi_vendor_messaging_device_path_t vendor
;
597 grub_memcpy (&vendor
, dp
, sizeof (vendor
));
598 grub_printf ("/Vendor(%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x)",
599 (unsigned) vendor
.vendor_guid
.data1
,
600 (unsigned) vendor
.vendor_guid
.data2
,
601 (unsigned) vendor
.vendor_guid
.data3
,
602 (unsigned) vendor
.vendor_guid
.data4
[0],
603 (unsigned) vendor
.vendor_guid
.data4
[1],
604 (unsigned) vendor
.vendor_guid
.data4
[2],
605 (unsigned) vendor
.vendor_guid
.data4
[3],
606 (unsigned) vendor
.vendor_guid
.data4
[4],
607 (unsigned) vendor
.vendor_guid
.data4
[5],
608 (unsigned) vendor
.vendor_guid
.data4
[6],
609 (unsigned) vendor
.vendor_guid
.data4
[7]);
613 grub_printf ("/UnknownMessaging(%x)", (unsigned) subtype
);
618 case GRUB_EFI_MEDIA_DEVICE_PATH_TYPE
:
621 case GRUB_EFI_HARD_DRIVE_DEVICE_PATH_SUBTYPE
:
623 grub_efi_hard_drive_device_path_t hd
;
624 grub_memcpy (&hd
, dp
, len
);
625 grub_printf ("/HD(%u,%llx,%llx,%02x%02x%02x%02x%02x%02x%02x%02x,%x,%x)",
627 (unsigned long long) hd
.partition_start
,
628 (unsigned long long) hd
.partition_size
,
629 (unsigned) hd
.partition_signature
[0],
630 (unsigned) hd
.partition_signature
[1],
631 (unsigned) hd
.partition_signature
[2],
632 (unsigned) hd
.partition_signature
[3],
633 (unsigned) hd
.partition_signature
[4],
634 (unsigned) hd
.partition_signature
[5],
635 (unsigned) hd
.partition_signature
[6],
636 (unsigned) hd
.partition_signature
[7],
637 (unsigned) hd
.mbr_type
,
638 (unsigned) hd
.signature_type
);
641 case GRUB_EFI_CDROM_DEVICE_PATH_SUBTYPE
:
643 grub_efi_cdrom_device_path_t cd
;
644 grub_memcpy (&cd
, dp
, len
);
645 grub_printf ("/CD(%u,%llx,%llx)",
647 (unsigned long long) cd
.partition_start
,
648 (unsigned long long) cd
.partition_size
);
651 case GRUB_EFI_VENDOR_MEDIA_DEVICE_PATH_SUBTYPE
:
653 grub_efi_vendor_media_device_path_t vendor
;
654 grub_memcpy (&vendor
, dp
, sizeof (vendor
));
655 grub_printf ("/Vendor(%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x)",
656 (unsigned) vendor
.vendor_guid
.data1
,
657 (unsigned) vendor
.vendor_guid
.data2
,
658 (unsigned) vendor
.vendor_guid
.data3
,
659 (unsigned) vendor
.vendor_guid
.data4
[0],
660 (unsigned) vendor
.vendor_guid
.data4
[1],
661 (unsigned) vendor
.vendor_guid
.data4
[2],
662 (unsigned) vendor
.vendor_guid
.data4
[3],
663 (unsigned) vendor
.vendor_guid
.data4
[4],
664 (unsigned) vendor
.vendor_guid
.data4
[5],
665 (unsigned) vendor
.vendor_guid
.data4
[6],
666 (unsigned) vendor
.vendor_guid
.data4
[7]);
669 case GRUB_EFI_FILE_PATH_DEVICE_PATH_SUBTYPE
:
671 grub_efi_file_path_device_path_t
*fp
;
672 grub_uint8_t buf
[(len
- 4) * 2 + 1];
673 fp
= (grub_efi_file_path_device_path_t
*) dp
;
674 *grub_utf16_to_utf8 (buf
, fp
->path_name
,
675 (len
- 4) / sizeof (grub_efi_char16_t
))
677 grub_printf ("/File(%s)", buf
);
680 case GRUB_EFI_PROTOCOL_DEVICE_PATH_SUBTYPE
:
682 grub_efi_protocol_device_path_t proto
;
683 grub_memcpy (&proto
, dp
, sizeof (proto
));
684 grub_printf ("/Protocol(%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x)",
685 (unsigned) proto
.guid
.data1
,
686 (unsigned) proto
.guid
.data2
,
687 (unsigned) proto
.guid
.data3
,
688 (unsigned) proto
.guid
.data4
[0],
689 (unsigned) proto
.guid
.data4
[1],
690 (unsigned) proto
.guid
.data4
[2],
691 (unsigned) proto
.guid
.data4
[3],
692 (unsigned) proto
.guid
.data4
[4],
693 (unsigned) proto
.guid
.data4
[5],
694 (unsigned) proto
.guid
.data4
[6],
695 (unsigned) proto
.guid
.data4
[7]);
699 grub_printf ("/UnknownMedia(%x)", (unsigned) subtype
);
704 case GRUB_EFI_BIOS_DEVICE_PATH_TYPE
:
707 case GRUB_EFI_BIOS_DEVICE_PATH_SUBTYPE
:
709 grub_efi_bios_device_path_t bios
;
710 grub_memcpy (&bios
, dp
, sizeof (bios
));
711 grub_printf ("/BIOS(%x,%x,%s)",
712 (unsigned) bios
.device_type
,
713 (unsigned) bios
.status_flags
,
718 grub_printf ("/UnknownBIOS(%x)", (unsigned) subtype
);
724 grub_printf ("/UnknownType(%x,%x)\n",
731 if (GRUB_EFI_END_ENTIRE_DEVICE_PATH (dp
))
734 dp
= (grub_efi_device_path_t
*) ((char *) dp
+ len
);