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