xref: /freebsd/stand/efi/include/efi.h (revision 8ccc0d235c226d84112561d453c49904398d085c)
1 /*++
2 
3 Copyright (c)  1999 - 2002 Intel Corporation. All rights reserved
4 This software and associated documentation (if any) is furnished
5 under a license and may only be used or copied in accordance
6 with the terms of the license. Except as permitted by such
7 license, no part of this software or documentation may be
8 reproduced, stored in a retrieval system, or transmitted in any
9 form or by any means without the express written consent of
10 Intel Corporation.
11 
12 Module Name:
13 
14     efi.h
15 
16 Abstract:
17 
18     Public EFI header files
19 
20 
21 
22 Revision History
23 
24 --*/
25 
26 //
27 // Build flags on input
28 //  EFI32
29 //  EFI_DEBUG               - Enable debugging code
30 //  EFI_NT_EMULATOR         - Building for running under NT
31 //
32 
33 
34 #ifndef _EFI_INCLUDE_
35 #define _EFI_INCLUDE_
36 
37 #define EFI_FIRMWARE_VENDOR         L"INTEL"
38 #define EFI_FIRMWARE_MAJOR_REVISION 14
39 #define EFI_FIRMWARE_MINOR_REVISION 62
40 #define EFI_FIRMWARE_REVISION ((EFI_FIRMWARE_MAJOR_REVISION <<16) | (EFI_FIRMWARE_MINOR_REVISION))
41 
42 //
43 // Basic EFI types of various widths.
44 //
45 
46 #include <sys/efi-edk2.h>
47 #include <Uefi.h>
48 #include <Protocol/LoadedImage.h>
49 
50 /* old efierr.h */
51 #define DECODE_ERROR(a)   (unsigned long)(a & ~MAX_BIT)
52 
53 /* old efidevp.h */
54 #define EFI_DP_TYPE_MASK                    0x7F
55 #define EFI_DP_TYPE_UNPACKED                0x80
56 
57 #define END_DEVICE_PATH_TYPE                0x7f
58 
59 #define END_INSTANCE_DEVICE_PATH_SUBTYPE    0x01
60 #define END_DEVICE_PATH_LENGTH              (sizeof(EFI_DEVICE_PATH))
61 
62 
63 #define DP_IS_END_TYPE(a)
64 #define DP_IS_END_SUBTYPE(a)        ( ((a)->SubType == END_ENTIRE_DEVICE_PATH_SUBTYPE )
65 
66 #define DevicePathType(a)           ( ((a)->Type) & EFI_DP_TYPE_MASK )
67 #define DevicePathSubType(a)        ( (a)->SubType )
68 #define DevicePathNodeLength(a)     ((size_t)(((a)->Length[0]) | ((a)->Length[1] << 8)))
69 #define NextDevicePathNode(a)       ( (EFI_DEVICE_PATH *) ( ((UINT8 *) (a)) + DevicePathNodeLength(a)))
70 #define IsDevicePathType(a, t)      ( DevicePathType(a) == t )
71 #define IsDevicePathEndType(a)      IsDevicePathType(a, END_DEVICE_PATH_TYPE)
72 #define IsDevicePathEndSubType(a)   ( (a)->SubType == END_ENTIRE_DEVICE_PATH_SUBTYPE )
73 #define IsDevicePathEnd(a)          ( IsDevicePathEndType(a) && IsDevicePathEndSubType(a) )
74 #define IsDevicePathUnpacked(a)     ( (a)->Type & EFI_DP_TYPE_UNPACKED )
75 
76 
77 #define SetDevicePathNodeLength(a,l) {                  \
78             (a)->Length[0] = (UINT8) (l);               \
79             (a)->Length[1] = (UINT8) ((l) >> 8);        \
80             }
81 
82 #define SetDevicePathEndNode(a)  {                      \
83             (a)->Type = END_DEVICE_PATH_TYPE;           \
84             (a)->SubType = END_ENTIRE_DEVICE_PATH_SUBTYPE;     \
85             (a)->Length[0] = sizeof(EFI_DEVICE_PATH);   \
86             (a)->Length[1] = 0;                         \
87             }
88 
89 #define NextMemoryDescriptor(Ptr,Size)  ((EFI_MEMORY_DESCRIPTOR *) (((UINT8 *) Ptr) + Size))
90 #include <sys/types.h>
91 
92 /*
93  * Global variables
94  */
95 extern EFI_LOADED_IMAGE *boot_img;
96 extern bool boot_services_active;
97 
98 /*
99  * FreeBSD UUID
100  */
101 #define FREEBSD_BOOT_VAR_GUID \
102 	{ 0xCFEE69AD, 0xA0DE, 0x47A9, {0x93, 0xA8, 0xF6, 0x31, 0x06, 0xF8, 0xAE, 0x99} }
103 
104 #endif
105