summaryrefslogtreecommitdiff
path: root/MdePkg/Include/Library/DevicePathLib.h
diff options
context:
space:
mode:
authorklu2 <klu2@6f19259b-4bc3-4df7-8a09-765794883524>2008-11-11 15:39:02 +0000
committerklu2 <klu2@6f19259b-4bc3-4df7-8a09-765794883524>2008-11-11 15:39:02 +0000
commite5dab01618850f8c8be029336ad93dcd1680865f (patch)
treefa32c88c3b641fab583b082c475dcc593788b611 /MdePkg/Include/Library/DevicePathLib.h
parent96e1079fa412753e42edf293ce28adda88e68a45 (diff)
downloadedk2-platforms-e5dab01618850f8c8be029336ad93dcd1680865f.tar.xz
1, Move device path utility macros from protocol's header file to DevicePathLib library classes
2, Remove Unpack type git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@6455 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'MdePkg/Include/Library/DevicePathLib.h')
-rw-r--r--MdePkg/Include/Library/DevicePathLib.h18
1 files changed, 18 insertions, 0 deletions
diff --git a/MdePkg/Include/Library/DevicePathLib.h b/MdePkg/Include/Library/DevicePathLib.h
index 244e351400..8df025353b 100644
--- a/MdePkg/Include/Library/DevicePathLib.h
+++ b/MdePkg/Include/Library/DevicePathLib.h
@@ -15,6 +15,24 @@
#ifndef __DEVICE_PATH_LIB_H__
#define __DEVICE_PATH_LIB_H__
+#include <Library/BaseLib.h>
+
+#define END_DEVICE_PATH_LENGTH (sizeof (EFI_DEVICE_PATH_PROTOCOL))
+#define DevicePathNodeLength(Node) ReadUnaligned16 ((UINT16 *)&((EFI_DEVICE_PATH_PROTOCOL *)(Node))->Length[0])
+#define NextDevicePathNode(Node) ((EFI_DEVICE_PATH_PROTOCOL *)((UINT8 *)(Node) + DevicePathNodeLength(Node)))
+#define DevicePathType(Node) (((EFI_DEVICE_PATH_PROTOCOL *)(Node))->Type)
+#define DevicePathSubType(Node) (((EFI_DEVICE_PATH_PROTOCOL *)(Node))->SubType)
+#define IsDevicePathEndType(Node) (DevicePathType (Node) == END_DEVICE_PATH_TYPE)
+#define IsDevicePathEnd(Node) (IsDevicePathEndType (Node) && DevicePathSubType(Node) == END_ENTIRE_DEVICE_PATH_SUBTYPE)
+#define IsDevicePathEndInstance(Node) (IsDevicePathEndType (Node) && DevicePathSubType(Node) == END_INSTANCE_DEVICE_PATH_SUBTYPE)
+
+#define SetDevicePathNodeLength(Node,NodeLength) WriteUnaligned16 ((UINT16 *)&((EFI_DEVICE_PATH_PROTOCOL *)(Node))->Length[0], (UINT16)(NodeLength))
+#define SetDevicePathEndNode(Node) { \
+ DevicePathType (Node) = END_DEVICE_PATH_TYPE; \
+ DevicePathSubType (Node) = END_ENTIRE_DEVICE_PATH_SUBTYPE; \
+ SetDevicePathNodeLength ((Node), END_DEVICE_PATH_LENGTH); \
+ }
+
/**
Returns the size of a device path in bytes.