Home | History | Annotate | Download | only in DevicePath
      1 /*++
      2 
      3 Copyright (c) 2004, Intel Corporation. All rights reserved.<BR>
      4 This program and the accompanying materials
      5 are licensed and made available under the terms and conditions of the BSD License
      6 which accompanies this distribution.  The full text of the license may be found at
      7 http://opensource.org/licenses/bsd-license.php
      8 
      9 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
     10 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
     11 
     12 Module Name:
     13 
     14   DevicePath.h
     15 
     16 Abstract:
     17 
     18   The device path protocol as defined in EFI 1.0.
     19 
     20   The device path represents a programatic path to a device. It's the view
     21   from a software point of view. It also must persist from boot to boot, so
     22   it can not contain things like PCI bus numbers that change from boot to boot.
     23 
     24 
     25 --*/
     26 
     27 #ifndef _DEVICE_PATH_H_
     28 #define _DEVICE_PATH_H_
     29 
     30 //
     31 // Device Path protocol
     32 //
     33 #define EFI_DEVICE_PATH_PROTOCOL_GUID \
     34   { \
     35     0x9576e91, 0x6d3f, 0x11d2, {0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b} \
     36   }
     37 
     38 #pragma pack(1)
     39 
     40 typedef struct {
     41   UINT8 Type;
     42   UINT8 SubType;
     43   UINT8 Length[2];
     44 } EFI_DEVICE_PATH_PROTOCOL;
     45 
     46 #pragma pack()
     47 
     48 #define EFI_END_ENTIRE_DEVICE_PATH            0xff
     49 #define EFI_END_ENTIRE_DEVICE_PATH_SUBTYPE    0xff
     50 #define EFI_END_INSTANCE_DEVICE_PATH          0x01
     51 #define EFI_END_DEVICE_PATH_LENGTH            (sizeof (EFI_DEVICE_PATH_PROTOCOL))
     52 
     53 #define EfiDevicePathNodeLength(a)            (((a)->Length[0]) | ((a)->Length[1] << 8))
     54 #define EfiNextDevicePathNode(a)              ((EFI_DEVICE_PATH_PROTOCOL *) (((UINT8 *) (a)) + EfiDevicePathNodeLength (a)))
     55 
     56 #define EfiDevicePathType(a)                  (((a)->Type) & 0x7f)
     57 #define EfiIsDevicePathEndType(a)             (EfiDevicePathType (a) == 0x7f)
     58 
     59 #define EfiIsDevicePathEndSubType(a)          ((a)->SubType == EFI_END_ENTIRE_DEVICE_PATH_SUBTYPE)
     60 #define EfiIsDevicePathEndInstanceSubType(a)  ((a)->SubType == EFI_END_INSTANCE_DEVICE_PATH)
     61 
     62 #define EfiIsDevicePathEnd(a)                 (EfiIsDevicePathEndType (a) && EfiIsDevicePathEndSubType (a))
     63 #define EfiIsDevicePathEndInstance(a)         (EfiIsDevicePathEndType (a) && EfiIsDevicePathEndInstanceSubType (a))
     64 
     65 extern EFI_GUID gEfiDevicePathProtocolGuid;
     66 
     67 #endif
     68