#define END_DEVICE_PATH_LENGTH (sizeof (EFI_DEVICE_PATH_PROTOCOL))\r
#define DevicePathNodeLength(Node) ReadUnaligned16 ((UINT16 *)&((EFI_DEVICE_PATH_PROTOCOL *)(Node))->Length[0])\r
#define NextDevicePathNode(Node) ((EFI_DEVICE_PATH_PROTOCOL *)((UINT8 *)(Node) + DevicePathNodeLength(Node)))\r
-#define DevicePathType(Node) (((EFI_DEVICE_PATH_PROTOCOL *)(Node))->Type) \r
+#define DevicePathType(Node) (((EFI_DEVICE_PATH_PROTOCOL *)(Node))->Type)\r
#define DevicePathSubType(Node) (((EFI_DEVICE_PATH_PROTOCOL *)(Node))->SubType)\r
-#define IsDevicePathEndType(Node) (DevicePathType (Node) == END_DEVICE_PATH_TYPE)\r
+#define IsDevicePathEndType(Node) ((DevicePathType (Node) & 0x7f) == END_DEVICE_PATH_TYPE)\r
#define IsDevicePathEnd(Node) (IsDevicePathEndType (Node) && DevicePathSubType(Node) == END_ENTIRE_DEVICE_PATH_SUBTYPE)\r
#define IsDevicePathEndInstance(Node) (IsDevicePathEndType (Node) && DevicePathSubType(Node) == END_INSTANCE_DEVICE_PATH_SUBTYPE)\r
\r
#define SetDevicePathEndNode(Node) { \\r
DevicePathType (Node) = END_DEVICE_PATH_TYPE; \\r
DevicePathSubType (Node) = END_ENTIRE_DEVICE_PATH_SUBTYPE; \\r
- SetDevicePathNodeLength ((Node), END_DEVICE_PATH_LENGTH); \\r
+ SetDevicePathNodeLength ((Node), END_DEVICE_PATH_LENGTH); \\r
}\r
\r
/**\r