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