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