]> git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Include/Protocol/DevicePath.h
Update the Guid Value of Ext SCSI Pass Thru Protocol
[mirror_edk2.git] / MdePkg / Include / Protocol / DevicePath.h
1 /** @file
2 The device path protocol as defined in EFI 1.0.
3
4 The device path represents a programatic path to a device. It's the view
5 from a software point of view. It also must persist from boot to boot, so
6 it can not contain things like PCI bus numbers that change from boot to boot.
7
8 Copyright (c) 2006, Intel Corporation
9 All rights reserved. This program and the accompanying materials
10 are licensed and made available under the terms and conditions of the BSD License
11 which accompanies this distribution. The full text of the license may be found at
12 http://opensource.org/licenses/bsd-license.php
13
14 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
15 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
16
17 Module Name: DevicePath.h
18
19 **/
20
21 #ifndef __EFI_DEVICE_PATH_PROTOCOL_H__
22 #define __EFI_DEVICE_PATH_PROTOCOL_H__
23
24 //
25 // Device Path protocol
26 //
27 #define EFI_DEVICE_PATH_PROTOCOL_GUID \
28 { \
29 0x9576e91, 0x6d3f, 0x11d2, {0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b } \
30 }
31
32 #pragma pack(1)
33
34 typedef struct {
35 UINT8 Type;
36 UINT8 SubType;
37 UINT8 Length[2];
38 } EFI_DEVICE_PATH_PROTOCOL;
39
40 #pragma pack()
41
42 #define EFI_DP_TYPE_MASK 0x7F
43 #define EFI_DP_TYPE_UNPACKED 0x80
44 #define END_DEVICE_PATH_TYPE 0x7f
45
46 #define EFI_END_ENTIRE_DEVICE_PATH 0xff
47 #define EFI_END_ENTIRE_DEVICE_PATH_SUBTYPE 0xff
48 #define EFI_END_INSTANCE_DEVICE_PATH 0x01
49 #define END_ENTIRE_DEVICE_PATH_SUBTYPE EFI_END_ENTIRE_DEVICE_PATH_SUBTYPE
50 #define END_INSTANCE_DEVICE_PATH_SUBTYPE EFI_END_INSTANCE_DEVICE_PATH
51
52 #define EFI_END_DEVICE_PATH_LENGTH (sizeof (EFI_DEVICE_PATH_PROTOCOL))
53 #define END_DEVICE_PATH_LENGTH EFI_END_DEVICE_PATH_LENGTH
54
55 #define DP_IS_END_TYPE(a)
56 #define DP_IS_END_SUBTYPE(a) (((a)->SubType == END_ENTIRE_DEVICE_PATH_SUBTYPE)
57 #define DevicePathSubType(a) ((a)->SubType)
58 #define IsDevicePathUnpacked(a) ((a)->Type & EFI_DP_TYPE_UNPACKED)
59
60 #define EfiDevicePathNodeLength(a) (((a)->Length[0]) | ((a)->Length[1] << 8))
61 #define DevicePathNodeLength(a) (EfiDevicePathNodeLength(a))
62 #define EfiNextDevicePathNode(a) ((EFI_DEVICE_PATH_PROTOCOL *) (((UINT8 *) (a)) + EfiDevicePathNodeLength (a)))
63 #define NextDevicePathNode(a) (EfiNextDevicePathNode(a))
64
65 #define EfiDevicePathType(a) (((a)->Type) & EFI_DP_TYPE_MASK)
66 #define DevicePathType(a) (EfiDevicePathType(a))
67 #define EfiIsDevicePathEndType(a) (EfiDevicePathType (a) == END_DEVICE_PATH_TYPE)
68 #define IsDevicePathEndType(a) (EfiIsDevicePathEndType(a))
69
70
71 #define EfiIsDevicePathEndSubType(a) ((a)->SubType == EFI_END_ENTIRE_DEVICE_PATH_SUBTYPE)
72 #define IsDevicePathEndSubType(a) (EfiIsDevicePathEndSubType(a))
73 #define EfiIsDevicePathEndInstanceSubType(a) ((a)->SubType == EFI_END_INSTANCE_DEVICE_PATH)
74
75 #define EfiIsDevicePathEnd(a) (EfiIsDevicePathEndType (a) && EfiIsDevicePathEndSubType (a))
76 #define IsDevicePathEnd(a) (EfiIsDevicePathEnd(a))
77 #define EfiIsDevicePathEndInstance(a) (EfiIsDevicePathEndType (a) && EfiIsDevicePathEndInstanceSubType (a))
78
79
80 #define SetDevicePathNodeLength(a,l) { \
81 (a)->Length[0] = (UINT8) (l); \
82 (a)->Length[1] = (UINT8) ((l) >> 8); \
83 }
84
85 #define SetDevicePathEndNode(a) { \
86 (a)->Type = END_DEVICE_PATH_TYPE; \
87 (a)->SubType = END_ENTIRE_DEVICE_PATH_SUBTYPE; \
88 (a)->Length[0] = sizeof(EFI_DEVICE_PATH_PROTOCOL); \
89 (a)->Length[1] = 0; \
90 }
91
92 extern EFI_GUID gEfiDevicePathProtocolGuid;
93
94 #endif