| 1 |
#ifndef _EFI_DEF_H |
| 2 |
#define _EFI_DEF_H |
| 3 |
|
| 4 |
/*++ |
| 5 |
|
| 6 |
Copyright (c) 1998 Intel Corporation |
| 7 |
|
| 8 |
Module Name: |
| 9 |
|
| 10 |
efidef.h |
| 11 |
|
| 12 |
Abstract: |
| 13 |
|
| 14 |
EFI definitions |
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
Revision History |
| 20 |
|
| 21 |
--*/ |
| 22 |
|
| 23 |
typedef unsigned char BOOLEAN; |
| 24 |
|
| 25 |
#ifndef CONST |
| 26 |
#define CONST const |
| 27 |
#endif |
| 28 |
#ifndef TRUE |
| 29 |
#define TRUE ((BOOLEAN) 1) |
| 30 |
#define FALSE ((BOOLEAN) 0) |
| 31 |
#endif |
| 32 |
|
| 33 |
#ifndef NULL |
| 34 |
#define NULL ((VOID *) 0) |
| 35 |
#endif |
| 36 |
|
| 37 |
typedef UINTN EFI_STATUS; |
| 38 |
typedef UINT64 EFI_LBA; |
| 39 |
typedef UINTN EFI_TPL; |
| 40 |
typedef VOID *EFI_HANDLE; |
| 41 |
typedef VOID *EFI_EVENT; |
| 42 |
|
| 43 |
|
| 44 |
// |
| 45 |
// Prototype argument decoration for EFI parameters to indicate |
| 46 |
// their direction |
| 47 |
// |
| 48 |
// IN - argument is passed into the function |
| 49 |
// OUT - argument (pointer) is returned from the function |
| 50 |
// OPTIONAL - argument is optional |
| 51 |
// |
| 52 |
|
| 53 |
#ifndef IN |
| 54 |
#define IN |
| 55 |
#define OUT |
| 56 |
#define OPTIONAL |
| 57 |
#endif |
| 58 |
|
| 59 |
|
| 60 |
// |
| 61 |
// A GUID |
| 62 |
// |
| 63 |
|
| 64 |
typedef struct { |
| 65 |
UINT32 Data1; |
| 66 |
UINT16 Data2; |
| 67 |
UINT16 Data3; |
| 68 |
UINT8 Data4[8]; |
| 69 |
} EFI_GUID; |
| 70 |
|
| 71 |
|
| 72 |
// |
| 73 |
// Time |
| 74 |
// |
| 75 |
|
| 76 |
typedef struct { |
| 77 |
UINT16 Year; // 1998 - 20XX |
| 78 |
UINT8 Month; // 1 - 12 |
| 79 |
UINT8 Day; // 1 - 31 |
| 80 |
UINT8 Hour; // 0 - 23 |
| 81 |
UINT8 Minute; // 0 - 59 |
| 82 |
UINT8 Second; // 0 - 59 |
| 83 |
UINT8 Pad1; |
| 84 |
UINT32 Nanosecond; // 0 - 999,999,999 |
| 85 |
INT16 TimeZone; // -1440 to 1440 or 2047 |
| 86 |
UINT8 Daylight; |
| 87 |
UINT8 Pad2; |
| 88 |
} EFI_TIME; |
| 89 |
|
| 90 |
// Bit definitions for EFI_TIME.Daylight |
| 91 |
#define EFI_TIME_ADJUST_DAYLIGHT 0x01 |
| 92 |
#define EFI_TIME_IN_DAYLIGHT 0x02 |
| 93 |
|
| 94 |
// Value definition for EFI_TIME.TimeZone |
| 95 |
#define EFI_UNSPECIFIED_TIMEZONE 0x07FF |
| 96 |
|
| 97 |
|
| 98 |
|
| 99 |
// |
| 100 |
// Networking |
| 101 |
// |
| 102 |
|
| 103 |
typedef struct { |
| 104 |
UINT8 Addr[4]; |
| 105 |
} EFI_IPv4_ADDRESS; |
| 106 |
|
| 107 |
typedef struct { |
| 108 |
UINT8 Addr[16]; |
| 109 |
} EFI_IPv6_ADDRESS; |
| 110 |
|
| 111 |
typedef struct { |
| 112 |
UINT8 Addr[32]; |
| 113 |
} EFI_MAC_ADDRESS; |
| 114 |
|
| 115 |
typedef struct { |
| 116 |
UINT32 ReceivedQueueTimeoutValue; |
| 117 |
UINT32 TransmitQueueTimeoutValue; |
| 118 |
UINT16 ProtocolTypeFilter; |
| 119 |
BOOLEAN EnableUnicastReceive; |
| 120 |
BOOLEAN EnableMulticastReceive; |
| 121 |
BOOLEAN EnableBroadcastReceive; |
| 122 |
BOOLEAN EnablePromiscuousReceive; |
| 123 |
BOOLEAN FlushQueuesOnReset; |
| 124 |
BOOLEAN EnableReceiveTimestamps; |
| 125 |
BOOLEAN DisableBackgroundPolling; |
| 126 |
} EFI_MANAGED_NETWORK_CONFIG_DATA; |
| 127 |
|
| 128 |
// |
| 129 |
// Memory |
| 130 |
// |
| 131 |
|
| 132 |
typedef UINT64 EFI_PHYSICAL_ADDRESS; |
| 133 |
typedef UINT64 EFI_VIRTUAL_ADDRESS; |
| 134 |
|
| 135 |
typedef enum { |
| 136 |
AllocateAnyPages, |
| 137 |
AllocateMaxAddress, |
| 138 |
AllocateAddress, |
| 139 |
MaxAllocateType |
| 140 |
} EFI_ALLOCATE_TYPE; |
| 141 |
|
| 142 |
//Preseve the attr on any range supplied. |
| 143 |
//ConventialMemory must have WB,SR,SW when supplied. |
| 144 |
//When allocating from ConventialMemory always make it WB,SR,SW |
| 145 |
//When returning to ConventialMemory always make it WB,SR,SW |
| 146 |
//When getting the memory map, or on RT for runtime types |
| 147 |
|
| 148 |
|
| 149 |
typedef enum { |
| 150 |
EfiReservedMemoryType, |
| 151 |
EfiLoaderCode, |
| 152 |
EfiLoaderData, |
| 153 |
EfiBootServicesCode, |
| 154 |
EfiBootServicesData, |
| 155 |
EfiRuntimeServicesCode, |
| 156 |
EfiRuntimeServicesData, |
| 157 |
EfiConventionalMemory, |
| 158 |
EfiUnusableMemory, |
| 159 |
EfiACPIReclaimMemory, |
| 160 |
EfiACPIMemoryNVS, |
| 161 |
EfiMemoryMappedIO, |
| 162 |
EfiMemoryMappedIOPortSpace, |
| 163 |
EfiPalCode, |
| 164 |
EfiMaxMemoryType |
| 165 |
} EFI_MEMORY_TYPE; |
| 166 |
|
| 167 |
// possible caching types for the memory range |
| 168 |
#define EFI_MEMORY_UC 0x0000000000000001 |
| 169 |
#define EFI_MEMORY_WC 0x0000000000000002 |
| 170 |
#define EFI_MEMORY_WT 0x0000000000000004 |
| 171 |
#define EFI_MEMORY_WB 0x0000000000000008 |
| 172 |
#define EFI_MEMORY_UCE 0x0000000000000010 |
| 173 |
#define EFI_MEMORY_WP 0x0000000000001000 |
| 174 |
|
| 175 |
// physical memory protection on range |
| 176 |
#define EFI_MEMORY_RP 0x0000000000002000 |
| 177 |
#define EFI_MEMORY_XP 0x0000000000004000 |
| 178 |
#define EFI_MEMORY_RO 0x0000000000020000 |
| 179 |
|
| 180 |
// range requires a runtime mapping |
| 181 |
#define EFI_MEMORY_RUNTIME 0x8000000000000000 |
| 182 |
|
| 183 |
#define EFI_MEMORY_DESCRIPTOR_VERSION 1 |
| 184 |
typedef struct { |
| 185 |
UINT32 Type; // Field size is 32 bits followed by 32 bit pad |
| 186 |
UINT32 Pad; |
| 187 |
EFI_PHYSICAL_ADDRESS PhysicalStart; // Field size is 64 bits |
| 188 |
EFI_VIRTUAL_ADDRESS VirtualStart; // Field size is 64 bits |
| 189 |
UINT64 NumberOfPages; // Field size is 64 bits |
| 190 |
UINT64 Attribute; // Field size is 64 bits |
| 191 |
} EFI_MEMORY_DESCRIPTOR; |
| 192 |
|
| 193 |
// |
| 194 |
// International Language |
| 195 |
// |
| 196 |
|
| 197 |
typedef CHAR8 ISO_639_2; |
| 198 |
#define ISO_639_2_ENTRY_SIZE 3 |
| 199 |
|
| 200 |
// |
| 201 |
// |
| 202 |
// |
| 203 |
|
| 204 |
#define EFI_PAGE_SIZE 4096 |
| 205 |
#define EFI_PAGE_MASK 0xFFF |
| 206 |
#define EFI_PAGE_SHIFT 12 |
| 207 |
|
| 208 |
#define EFI_SIZE_TO_PAGES(a) \ |
| 209 |
( ((a) >> EFI_PAGE_SHIFT) + ((a) & EFI_PAGE_MASK ? 1 : 0) ) |
| 210 |
|
| 211 |
#define EFI_OS_INDICATIONS_BOOT_TO_FW_UI 0x0000000000000001 |
| 212 |
#define EFI_OS_INDICATIONS_TIMESTAMP_REVOCATION 0x0000000000000002 |
| 213 |
#define EFI_OS_INDICATIONS_FILE_CAPSULE_DELIVERY_SUPPORTED \ |
| 214 |
0x0000000000000004 |
| 215 |
#define EFI_OS_INDICATIONS_FMP_CAPSULE_SUPPORTED \ |
| 216 |
0x0000000000000008 |
| 217 |
#define EFI_OS_INDICATIONS_CAPSULE_RESULT_VAR_SUPPORTED \ |
| 218 |
0x0000000000000010 |
| 219 |
|
| 220 |
#endif |