]> git.proxmox.com Git - mirror_edk2.git/blobdiff - OldMdePkg/Include/Protocol/DevicePath.h
Moved the MdePkg to OldMdePkg so that new code in MdePkg does not break existing...
[mirror_edk2.git] / OldMdePkg / Include / Protocol / DevicePath.h
diff --git a/OldMdePkg/Include/Protocol/DevicePath.h b/OldMdePkg/Include/Protocol/DevicePath.h
new file mode 100644 (file)
index 0000000..d019999
--- /dev/null
@@ -0,0 +1,94 @@
+/** @file\r
+  The device path protocol as defined in EFI 1.0.\r
+\r
+  The device path represents a programatic path to a device. It's the view\r
+  from a software point of view. It also must persist from boot to boot, so \r
+  it can not contain things like PCI bus numbers that change from boot to boot.\r
+\r
+  Copyright (c) 2006, Intel Corporation                                                         \r
+  All rights reserved. This program and the accompanying materials                          \r
+  are licensed and made available under the terms and conditions of the BSD License         \r
+  which accompanies this distribution.  The full text of the license may be found at        \r
+  http://opensource.org/licenses/bsd-license.php                                            \r
+\r
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     \r
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             \r
+\r
+  Module Name:  DevicePath.h\r
+\r
+**/\r
+\r
+#ifndef __EFI_DEVICE_PATH_PROTOCOL_H__\r
+#define __EFI_DEVICE_PATH_PROTOCOL_H__\r
+\r
+//\r
+// Device Path protocol\r
+//\r
+#define EFI_DEVICE_PATH_PROTOCOL_GUID \\r
+  { \\r
+    0x9576e91, 0x6d3f, 0x11d2, {0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b } \\r
+  }\r
+\r
+#pragma pack(1)\r
+\r
+typedef struct {\r
+  UINT8 Type;\r
+  UINT8 SubType;\r
+  UINT8 Length[2];\r
+} EFI_DEVICE_PATH_PROTOCOL;\r
+\r
+#pragma pack()\r
+                                             \r
+#define EFI_DP_TYPE_MASK                     0x7F\r
+#define EFI_DP_TYPE_UNPACKED                 0x80\r
+#define END_DEVICE_PATH_TYPE                 0x7f\r
+                                             \r
+#define EFI_END_ENTIRE_DEVICE_PATH           0xff\r
+#define EFI_END_ENTIRE_DEVICE_PATH_SUBTYPE   0xff\r
+#define EFI_END_INSTANCE_DEVICE_PATH         0x01\r
+#define END_ENTIRE_DEVICE_PATH_SUBTYPE       EFI_END_ENTIRE_DEVICE_PATH_SUBTYPE\r
+#define END_INSTANCE_DEVICE_PATH_SUBTYPE     EFI_END_INSTANCE_DEVICE_PATH\r
+                                             \r
+#define EFI_END_DEVICE_PATH_LENGTH           (sizeof (EFI_DEVICE_PATH_PROTOCOL))\r
+#define END_DEVICE_PATH_LENGTH               EFI_END_DEVICE_PATH_LENGTH\r
+                                             \r
+#define DP_IS_END_TYPE(a)                    \r
+#define DP_IS_END_SUBTYPE(a)                 (((a)->SubType == END_ENTIRE_DEVICE_PATH_SUBTYPE)\r
+#define DevicePathSubType(a)                 ((a)->SubType)\r
+#define IsDevicePathUnpacked(a)              ((a)->Type & EFI_DP_TYPE_UNPACKED)\r
+                                             \r
+#define EfiDevicePathNodeLength(a)           (((a)->Length[0]) | ((a)->Length[1] << 8))\r
+#define DevicePathNodeLength(a)              (EfiDevicePathNodeLength(a))\r
+#define EfiNextDevicePathNode(a)             ((EFI_DEVICE_PATH_PROTOCOL *) (((UINT8 *) (a)) + EfiDevicePathNodeLength (a)))\r
+#define NextDevicePathNode(a)                (EfiNextDevicePathNode(a)) \r
+                                             \r
+#define EfiDevicePathType(a)                 (((a)->Type) & EFI_DP_TYPE_MASK)\r
+#define DevicePathType(a)                    (EfiDevicePathType(a))\r
+#define EfiIsDevicePathEndType(a)            (EfiDevicePathType (a) == END_DEVICE_PATH_TYPE)\r
+#define IsDevicePathEndType(a)               (EfiIsDevicePathEndType(a)) \r
+                                             \r
+                                             \r
+#define EfiIsDevicePathEndSubType(a)         ((a)->SubType == EFI_END_ENTIRE_DEVICE_PATH_SUBTYPE)\r
+#define IsDevicePathEndSubType(a)            (EfiIsDevicePathEndSubType(a))\r
+#define EfiIsDevicePathEndInstanceSubType(a) ((a)->SubType == EFI_END_INSTANCE_DEVICE_PATH)\r
+                                             \r
+#define EfiIsDevicePathEnd(a)                (EfiIsDevicePathEndType (a) && EfiIsDevicePathEndSubType (a))\r
+#define IsDevicePathEnd(a)                   (EfiIsDevicePathEnd(a))\r
+#define EfiIsDevicePathEndInstance(a)        (EfiIsDevicePathEndType (a) && EfiIsDevicePathEndInstanceSubType (a))\r
+\r
+\r
+#define SetDevicePathNodeLength(a,l) {                           \\r
+          (a)->Length[0] = (UINT8) (l);                          \\r
+          (a)->Length[1] = (UINT8) ((l) >> 8);                   \\r
+          }\r
+\r
+#define SetDevicePathEndNode(a)  {                               \\r
+          (a)->Type = END_DEVICE_PATH_TYPE;                      \\r
+          (a)->SubType = END_ENTIRE_DEVICE_PATH_SUBTYPE;         \\r
+          (a)->Length[0] = sizeof(EFI_DEVICE_PATH_PROTOCOL);     \\r
+          (a)->Length[1] = 0;                                    \\r
+          }\r
+\r
+extern EFI_GUID gEfiDevicePathProtocolGuid;\r
+\r
+#endif\r