#ifndef _DEVPATH_H
#define _DEVPATH_H
#include <Protocol/DevicePath.h>
#define EFI_DP_TYPE_MASK 0x7F
#define EFI_DP_TYPE_UNPACKED 0x80
#define END_DEVICE_PATH_LENGTH (sizeof (EFI_DEVICE_PATH))
#define DP_IS_END_TYPE(a)
#define DP_IS_END_SUBTYPE(a) \
(((a)->SubType == END_ENTIRE_DEVICE_PATH_SUBTYPE)
#define DevicePathType(a) (((a)->Type) & EFI_DP_TYPE_MASK)
#define DevicePathSubType(a) ((a)->SubType)
#define DevicePathNodeLength(a) \
((size_t)(((a)->Length[0]) |((a)->Length[1] << 8)))
#define NextDevicePathNode(a) \
((EFI_DEVICE_PATH *)(((UINT8 *)(a)) + DevicePathNodeLength(a)))
#define IsDevicePathType(a, t) (DevicePathType(a) == t)
#define IsDevicePathEndType(a) IsDevicePathType(a, END_DEVICE_PATH_TYPE)
#define IsDevicePathEndSubType(a) \
((a)->SubType == END_ENTIRE_DEVICE_PATH_SUBTYPE)
#define IsDevicePathEnd(a) \
(IsDevicePathEndType(a) && IsDevicePathEndSubType(a))
#define IsDevicePathUnpacked(a) ((a)->Type & EFI_DP_TYPE_UNPACKED)
#define SetDevicePathNodeLength(a, l) { \
(a)->Length[0] = (UINT8)(l); \
(a)->Length[1] = (UINT8)((l) >> 8); \
}
#define SetDevicePathEndNode(a) { \
(a)->Type = END_DEVICE_PATH_TYPE; \
(a)->SubType = END_ENTIRE_DEVICE_PATH_SUBTYPE; \
(a)->Length[0] = sizeof (EFI_DEVICE_PATH); \
(a)->Length[1] = 0; \
}
#endif