1// Copyright 2016 The Fuchsia Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#pragma once
6
7#include <efi/types.h>
8
9#define EFI_DEVICE_PATH_PROTOCOL_GUID \
10    {0x09576e91, 0x6d3f, 0x11d2, {0x8e, 0x39, 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b}}
11extern efi_guid DevicePathProtocol;
12
13typedef struct efi_device_path_protocol {
14    uint8_t Type;
15    uint8_t SubType;
16    uint8_t Length[2];
17} efi_device_path_protocol;
18
19#define DEVICE_PATH_HARDWARE       0x01
20#define DEVICE_PATH_ACPI           0x02
21#define DEVICE_PATH_MESSAGING      0x03
22#define DEVICE_PATH_MEDIA          0x04
23#define DEVICE_PATH_BIOS_BOOT_SPEC 0x05
24#define DEVICE_PATH_END            0x7f
25
26#define DEVICE_PATH_INSTANCE_END 0x01
27#define DEVICE_PATH_ENTIRE_END   0xff
28
29#define DEVICE_PATH_HW_PCI        0x01
30#define DEVICE_PATH_HW_PCCARD     0x02
31#define DEVICE_PATH_HW_MEMMAP     0x03
32#define DEVICE_PATH_HW_VENDOR     0x04
33#define DEVICE_PATH_HW_CONTROLLER 0x05
34#define DEVICE_PATH_HW_BMC        0x06
35
36#define DEVICE_PATH_MESSAGING_ATAPI	    0x01
37#define DEVICE_PATH_MESSAGING_SCSI	    0x02
38#define DEVICE_PATH_MESSAGING_FIBRE_CHANNEL 0x03
39#define DEVICE_PATH_MESSAGING_1394	    0x04
40#define DEVICE_PATH_MESSAGING_USB	    0x05
41#define DEVICE_PATH_MESSAGING_I2O	    0x06
42#define DEVICE_PATH_MESSAGING_INFINIBAND    0x09
43#define DEVICE_PATH_MESSAGING_VENDOR	    0x0a
44#define DEVICE_PATH_MESSAGING_MAC	    0x0b
45#define DEVICE_PATH_MESSAGING_IPV4	    0x0c
46#define DEVICE_PATH_MESSAGING_IPV6	    0x0d
47#define DEVICE_PATH_MESSAGING_UART	    0x0e
48#define DEVICE_PATH_MESSAGING_USB_CLASS	    0x0f
49#define DEVICE_PATH_MESSAGING_USB_WWID	    0x10
50#define DEVICE_PATH_MESSAGING_USB_LUN	    0x11
51#define DEVICE_PATH_MESSAGING_SATA	    0x12
52#define DEVICE_PATH_MESSAGING_VLAN	    0x14
53#define DEVICE_PATH_MESSAGING_FIBRE_CHANNEL_EX 0x15
54
55// TODO: sub-types for other types (ACPI, etc)
56
57// DEVICE_PATH_MEDIA Types
58#define MEDIA_HARDDRIVE_DP              0x01
59#define MEDIA_CDROM_DP                  0x02
60#define MEDIA_VENDOR_DP                 0x03
61#define MEDIA_FILEPATH_DP               0x04
62#define MEDIA_PROTOCOL_DP               0x05
63
64// TODO: move this to another header? would break circular dependencies between
65// boot-services.h and this header, for efi_memory_type
66typedef struct {
67    efi_device_path_protocol Header;
68    efi_memory_type MemoryType;
69    efi_physical_addr StartAddress;
70    efi_physical_addr EndAddress;
71} efi_device_path_hw_memmap;
72