1 /** 2 Based on Uefi/UefiSpec.h, original notice: 3 4 Include file that supports UEFI. 5 6 This include file must contain things defined in the UEFI 2.5 specification. 7 If a code construct is defined in the UEFI 2.5 specification it must be included 8 by this include file. 9 10 Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved. 11 This program and the accompanying materials are licensed and made available under 12 the terms and conditions of the BSD License that accompanies this distribution. 13 The full text of the license may be found at 14 http://opensource.org/licenses/bsd-license.php. 15 16 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 17 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 18 19 **/ 20 module uefi.spec; 21 import uefi.base; 22 import uefi.base_type; 23 import uefi.protocols.devicepath; 24 import uefi.protocols.simpletextin; 25 import uefi.protocols.simpletextinex; 26 import uefi.protocols.simpletextout; 27 28 public: 29 extern (C): 30 /// Enumeration of EFI memory allocation types. 31 alias EFI_ALLOCATE_TYPE = UINT32; 32 enum : EFI_ALLOCATE_TYPE 33 { 34 /// 35 /// Allocate any available range of pages that satisfies the request. 36 /// 37 AllocateAnyPages, 38 /// 39 /// Allocate any available range of pages whose uppermost address is less than 40 /// or equal to a specified maximum address. 41 /// 42 AllocateMaxAddress, 43 /// 44 /// Allocate pages at a specified address. 45 /// 46 AllocateAddress, 47 /// 48 /// Maximum enumeration value that may be used for bounds checking. 49 /// 50 MaxAllocateType 51 } 52 enum EFI_TIME_ADJUST_DAYLIGHT = 0x01; 53 enum EFI_TIME_IN_DAYLIGHT = 0x02; 54 /// Value definition for EFI_TIME.TimeZone. 55 enum EFI_UNSPECIFIED_TIMEZONE = 0x07FF; 56 enum EFI_MEMORY_UC = 0x0000000000000001UL; 57 enum EFI_MEMORY_WC = 0x0000000000000002UL; 58 enum EFI_MEMORY_WT = 0x0000000000000004UL; 59 enum EFI_MEMORY_WB = 0x0000000000000008UL; 60 enum EFI_MEMORY_UCE = 0x0000000000000010UL; 61 enum EFI_MEMORY_WP = 0x0000000000001000UL; 62 enum EFI_MEMORY_RP = 0x0000000000002000UL; 63 enum EFI_MEMORY_XP = 0x0000000000004000UL; 64 enum EFI_MEMORY_RO = 0x0000000000020000UL; 65 enum EFI_MEMORY_NV = 0x0000000000008000UL; 66 enum EFI_MEMORY_MORE_RELIABLE = 0x0000000000010000UL; 67 enum EFI_MEMORY_RUNTIME = 0x8000000000000000UL; 68 /// Memory descriptor version number. 69 enum EFI_MEMORY_DESCRIPTOR_VERSION = 1; 70 /// Definition of an EFI memory descriptor. 71 struct EFI_MEMORY_DESCRIPTOR 72 { 73 /// 74 /// Type of the memory region. See EFI_MEMORY_TYPE. 75 /// 76 UINT32 Type; 77 /// 78 /// Physical address of the first byte of the memory region. Must aligned 79 /// on a 4 KB boundary. 80 /// 81 EFI_PHYSICAL_ADDRESS PhysicalStart; 82 /// 83 /// Virtual address of the first byte of the memory region. Must aligned 84 /// on a 4 KB boundary. 85 /// 86 EFI_VIRTUAL_ADDRESS VirtualStart; 87 /// 88 /// Number of 4KB pages in the memory region. 89 /// 90 UINT64 NumberOfPages; 91 /// 92 /// Attributes of the memory region that describe the bit mask of capabilities 93 /// for that memory region, and not necessarily the current settings for that 94 /// memory region. 95 /// 96 UINT64 Attribute; 97 } 98 /** 99 Allocates memory pages from the system. 100 101 @param[in] Type The type of allocation to perform. 102 @param[in] MemoryType The type of memory to allocate. 103 MemoryType values in the range 0x70000000..0x7FFFFFFF 104 are reserved for OEM use. MemoryType values in the range 105 0x80000000..0xFFFFFFFF are reserved for use by UEFI OS loaders 106 that are provided by operating system vendors. The only illegal 107 memory type values are those in the range EfiMaxMemoryType..0x6FFFFFFF. 108 @param[in] Pages The number of contiguous 4 KB pages to allocate. 109 @param[in, out] Memory The pointer to a physical address. On input, the way in which the address is 110 used depends on the value of Type. 111 112 @retval EFI_SUCCESS The requested pages were allocated. 113 @retval EFI_INVALID_PARAMETER 1) Type is not AllocateAnyPages or 114 AllocateMaxAddress or AllocateAddress. 115 2) MemoryType is in the range 116 EfiMaxMemoryType..0x6FFFFFFF. 117 3) Memory is NULL. 118 4) MemoryType was EfiPersistentMemory. 119 @retval EFI_OUT_OF_RESOURCES The pages could not be allocated. 120 @retval EFI_NOT_FOUND The requested pages could not be found. 121 122 **/ 123 alias EFI_ALLOCATE_PAGES = EFI_STATUS function(EFI_ALLOCATE_TYPE Type, 124 EFI_MEMORY_TYPE MemoryType, UINTN Pages, EFI_PHYSICAL_ADDRESS* Memory) @nogc nothrow; 125 /** 126 Frees memory pages. 127 128 @param[in] Memory The base physical address of the pages to be freed. 129 @param[in] Pages The number of contiguous 4 KB pages to free. 130 131 @retval EFI_SUCCESS The requested pages were freed. 132 @retval EFI_INVALID_PARAMETER Memory is not a page-aligned address or Pages is invalid. 133 @retval EFI_NOT_FOUND The requested memory pages were not allocated with 134 AllocatePages(). 135 136 **/ 137 alias EFI_FREE_PAGES = EFI_STATUS function(EFI_PHYSICAL_ADDRESS Memory, UINTN Pages) @nogc nothrow; 138 /** 139 Returns the current memory map. 140 141 @param[in, out] MemoryMapSize A pointer to the size, in bytes, of the MemoryMap buffer. 142 On input, this is the size of the buffer allocated by the caller. 143 On output, it is the size of the buffer returned by the firmware if 144 the buffer was large enough, or the size of the buffer needed to contain 145 the map if the buffer was too small. 146 @param[in, out] MemoryMap A pointer to the buffer in which firmware places the current memory 147 map. 148 @param[out] MapKey A pointer to the location in which firmware returns the key for the 149 current memory map. 150 @param[out] DescriptorSize A pointer to the location in which firmware returns the size, in bytes, of 151 an individual EFI_MEMORY_DESCRIPTOR. 152 @param[out] DescriptorVersion A pointer to the location in which firmware returns the version number 153 associated with the EFI_MEMORY_DESCRIPTOR. 154 155 @retval EFI_SUCCESS The memory map was returned in the MemoryMap buffer. 156 @retval EFI_BUFFER_TOO_SMALL The MemoryMap buffer was too small. The current buffer size 157 needed to hold the memory map is returned in MemoryMapSize. 158 @retval EFI_INVALID_PARAMETER 1) MemoryMapSize is NULL. 159 2) The MemoryMap buffer is not too small and MemoryMap is 160 NULL. 161 162 **/ 163 alias EFI_GET_MEMORY_MAP = EFI_STATUS function(UINTN* MemoryMapSize, 164 EFI_MEMORY_DESCRIPTOR* MemoryMap, UINTN* MapKey, UINTN* DescriptorSize, 165 UINT32* DescriptorVersion) @nogc nothrow; 166 /** 167 Allocates pool memory. 168 169 @param[in] PoolType The type of pool to allocate. 170 MemoryType values in the range 0x70000000..0x7FFFFFFF 171 are reserved for OEM use. MemoryType values in the range 172 0x80000000..0xFFFFFFFF are reserved for use by UEFI OS loaders 173 that are provided by operating system vendors. The only illegal 174 memory type values are those in the range EfiMaxMemoryType..0x6FFFFFFF. 175 @param[in] Size The number of bytes to allocate from the pool. 176 @param[out] Buffer A pointer to a pointer to the allocated buffer if the call succeeds; 177 undefined otherwise. 178 179 @retval EFI_SUCCESS The requested number of bytes was allocated. 180 @retval EFI_OUT_OF_RESOURCES The pool requested could not be allocated. 181 @retval EFI_INVALID_PARAMETER PoolType was invalid or Buffer is NULL. 182 PoolType was EfiPersistentMemory. 183 184 **/ 185 alias EFI_ALLOCATE_POOL = EFI_STATUS function(EFI_MEMORY_TYPE PoolType, UINTN Size, 186 void** Buffer) @nogc nothrow; 187 /** 188 Returns pool memory to the system. 189 190 @param[in] Buffer The pointer to the buffer to free. 191 192 @retval EFI_SUCCESS The memory was returned to the system. 193 @retval EFI_INVALID_PARAMETER Buffer was invalid. 194 195 **/ 196 alias EFI_FREE_POOL = EFI_STATUS function(void* Buffer) @nogc nothrow; 197 /** 198 Changes the runtime addressing mode of EFI firmware from physical to virtual. 199 200 @param[in] MemoryMapSize The size in bytes of VirtualMap. 201 @param[in] DescriptorSize The size in bytes of an entry in the VirtualMap. 202 @param[in] DescriptorVersion The version of the structure entries in VirtualMap. 203 @param[in] VirtualMap An array of memory descriptors which contain new virtual 204 address mapping information for all runtime ranges. 205 206 @retval EFI_SUCCESS The virtual address map has been applied. 207 @retval EFI_UNSUPPORTED EFI firmware is not at runtime, or the EFI firmware is already in 208 virtual address mapped mode. 209 @retval EFI_INVALID_PARAMETER DescriptorSize or DescriptorVersion is invalid. 210 @retval EFI_NO_MAPPING A virtual address was not supplied for a range in the memory 211 map that requires a mapping. 212 @retval EFI_NOT_FOUND A virtual address was supplied for an address that is not found 213 in the memory map. 214 215 **/ 216 alias EFI_SET_VIRTUAL_ADDRESS_MAP = EFI_STATUS function(UINTN MemoryMapSize, 217 UINTN DescriptorSize, UINT32 DescriptorVersion, EFI_MEMORY_DESCRIPTOR* VirtualMap) @nogc nothrow; 218 /** 219 Connects one or more drivers to a controller. 220 221 @param[in] ControllerHandle The handle of the controller to which driver(s) are to be connected. 222 @param[in] DriverImageHandle A pointer to an ordered list handles that support the 223 EFI_DRIVER_BINDING_PROTOCOL. 224 @param[in] RemainingDevicePath A pointer to the device path that specifies a child of the 225 controller specified by ControllerHandle. 226 @param[in] Recursive If TRUE, then ConnectController() is called recursively 227 until the entire tree of controllers below the controller specified 228 by ControllerHandle have been created. If FALSE, then 229 the tree of controllers is only expanded one level. 230 231 @retval EFI_SUCCESS 1) One or more drivers were connected to ControllerHandle. 232 2) No drivers were connected to ControllerHandle, but 233 RemainingDevicePath is not NULL, and it is an End Device 234 Path Node. 235 @retval EFI_INVALID_PARAMETER ControllerHandle is NULL. 236 @retval EFI_NOT_FOUND 1) There are no EFI_DRIVER_BINDING_PROTOCOL instances 237 present in the system. 238 2) No drivers were connected to ControllerHandle. 239 @retval EFI_SECURITY_VIOLATION 240 The user has no permission to start UEFI device drivers on the device path 241 associated with the ControllerHandle or specified by the RemainingDevicePath. 242 **/ 243 alias EFI_CONNECT_CONTROLLER = EFI_STATUS function(EFI_HANDLE ControllerHandle, 244 EFI_HANDLE* DriverImageHandle, EFI_DEVICE_PATH_PROTOCOL* RemainingDevicePath, BOOLEAN Recursive) @nogc nothrow; 245 /** 246 Disconnects one or more drivers from a controller. 247 248 @param[in] ControllerHandle The handle of the controller from which driver(s) are to be disconnected. 249 @param[in] DriverImageHandle The driver to disconnect from ControllerHandle. 250 If DriverImageHandle is NULL, then all the drivers currently managing 251 ControllerHandle are disconnected from ControllerHandle. 252 @param[in] ChildHandle The handle of the child to destroy. 253 If ChildHandle is NULL, then all the children of ControllerHandle are 254 destroyed before the drivers are disconnected from ControllerHandle. 255 256 @retval EFI_SUCCESS 1) One or more drivers were disconnected from the controller. 257 2) On entry, no drivers are managing ControllerHandle. 258 3) DriverImageHandle is not NULL, and on entry 259 DriverImageHandle is not managing ControllerHandle. 260 @retval EFI_INVALID_PARAMETER 1) ControllerHandle is NULL. 261 2) DriverImageHandle is not NULL, and it is not a valid EFI_HANDLE. 262 3) ChildHandle is not NULL, and it is not a valid EFI_HANDLE. 263 4) DriverImageHandle does not support the EFI_DRIVER_BINDING_PROTOCOL. 264 @retval EFI_OUT_OF_RESOURCES There are not enough resources available to disconnect any drivers from 265 ControllerHandle. 266 @retval EFI_DEVICE_ERROR The controller could not be disconnected because of a device error. 267 268 **/ 269 alias EFI_DISCONNECT_CONTROLLER = EFI_STATUS function(EFI_HANDLE ControllerHandle, 270 EFI_HANDLE DriverImageHandle, EFI_HANDLE ChildHandle) @nogc nothrow; 271 enum EFI_OPTIONAL_PTR = 0x00000001; 272 /** 273 Determines the new virtual address that is to be used on subsequent memory accesses. 274 275 @param[in] DebugDisposition Supplies type information for the pointer being converted. 276 @param[in, out] Address A pointer to a pointer that is to be fixed to be the value needed 277 for the new virtual address mappings being applied. 278 279 @retval EFI_SUCCESS The pointer pointed to by Address was modified. 280 @retval EFI_INVALID_PARAMETER 1) Address is NULL. 281 2) *Address is NULL and DebugDisposition does 282 not have the EFI_OPTIONAL_PTR bit set. 283 @retval EFI_NOT_FOUND The pointer pointed to by Address was not found to be part 284 of the current memory map. This is normally fatal. 285 286 **/ 287 alias EFI_CONVERT_POINTER = EFI_STATUS function(UINTN DebugDisposition, void** Address) @nogc nothrow; 288 enum EVT_TIMER = 0x80000000; 289 enum EVT_RUNTIME = 0x40000000; 290 enum EVT_NOTIFY_WAIT = 0x00000100; 291 enum EVT_NOTIFY_SIGNAL = 0x00000200; 292 enum EVT_SIGNAL_EXIT_BOOT_SERVICES = 0x00000201; 293 enum EVT_SIGNAL_VIRTUAL_ADDRESS_CHANGE = 0x60000202; 294 enum EVT_RUNTIME_CONTEXT = 0x20000000; 295 /** 296 Invoke a notification event 297 298 @param[in] Event Event whose notification function is being invoked. 299 @param[in] Context The pointer to the notification function's context, 300 which is implementation-dependent. 301 302 **/ 303 alias EFI_EVENT_NOTIFY = VOID function(EFI_EVENT Event, void* Context) @nogc nothrow; 304 /** 305 Creates an event. 306 307 @param[in] Type The type of event to create and its mode and attributes. 308 @param[in] NotifyTpl The task priority level of event notifications, if needed. 309 @param[in] NotifyFunction The pointer to the event's notification function, if any. 310 @param[in] NotifyContext The pointer to the notification function's context; corresponds to parameter 311 Context in the notification function. 312 @param[out] Event The pointer to the newly created event if the call succeeds; undefined 313 otherwise. 314 315 @retval EFI_SUCCESS The event structure was created. 316 @retval EFI_INVALID_PARAMETER One or more parameters are invalid. 317 @retval EFI_OUT_OF_RESOURCES The event could not be allocated. 318 319 **/ 320 alias EFI_CREATE_EVENT = EFI_STATUS function(UINT32 Type, EFI_TPL NotifyTpl, 321 EFI_EVENT_NOTIFY NotifyFunction, void* NotifyContext, EFI_EVENT* Event) @nogc nothrow; 322 /** 323 Creates an event in a group. 324 325 @param[in] Type The type of event to create and its mode and attributes. 326 @param[in] NotifyTpl The task priority level of event notifications,if needed. 327 @param[in] NotifyFunction The pointer to the event's notification function, if any. 328 @param[in] NotifyContext The pointer to the notification function's context; corresponds to parameter 329 Context in the notification function. 330 @param[in] EventGroup The pointer to the unique identifier of the group to which this event belongs. 331 If this is NULL, then the function behaves as if the parameters were passed 332 to CreateEvent. 333 @param[out] Event The pointer to the newly created event if the call succeeds; undefined 334 otherwise. 335 336 @retval EFI_SUCCESS The event structure was created. 337 @retval EFI_INVALID_PARAMETER One or more parameters are invalid. 338 @retval EFI_OUT_OF_RESOURCES The event could not be allocated. 339 340 **/ 341 alias EFI_CREATE_EVENT_EX = EFI_STATUS function(UINT32 Type, EFI_TPL NotifyTpl, 342 EFI_EVENT_NOTIFY NotifyFunction, const void* NotifyContext, 343 const EFI_GUID* EventGroup, EFI_EVENT* Event) @nogc nothrow; 344 /// Timer delay types 345 alias EFI_TIMER_DELAY = UINT32; 346 enum : EFI_TIMER_DELAY 347 { 348 /// 349 /// An event's timer settings is to be cancelled and not trigger time is to be set/ 350 /// 351 TimerCancel, 352 /// 353 /// An event is to be signaled periodically at a specified interval from the current time. 354 /// 355 TimerPeriodic, 356 /// 357 /// An event is to be signaled once at a specified interval from the current time. 358 /// 359 TimerRelative 360 } 361 /** 362 Sets the type of timer and the trigger time for a timer event. 363 364 @param[in] Event The timer event that is to be signaled at the specified time. 365 @param[in] Type The type of time that is specified in TriggerTime. 366 @param[in] TriggerTime The number of 100ns units until the timer expires. 367 A TriggerTime of 0 is legal. 368 If Type is TimerRelative and TriggerTime is 0, then the timer 369 event will be signaled on the next timer tick. 370 If Type is TimerPeriodic and TriggerTime is 0, then the timer 371 event will be signaled on every timer tick. 372 373 @retval EFI_SUCCESS The event has been set to be signaled at the requested time. 374 @retval EFI_INVALID_PARAMETER Event or Type is not valid. 375 376 **/ 377 alias EFI_SET_TIMER = EFI_STATUS function(EFI_EVENT Event, EFI_TIMER_DELAY Type, UINT64 TriggerTime) @nogc nothrow; 378 /** 379 Signals an event. 380 381 @param[in] Event The event to signal. 382 383 @retval EFI_SUCCESS The event has been signaled. 384 385 **/ 386 alias EFI_SIGNAL_EVENT = EFI_STATUS function(EFI_EVENT Event) @nogc nothrow; 387 /** 388 Stops execution until an event is signaled. 389 390 @param[in] NumberOfEvents The number of events in the Event array. 391 @param[in] Event An array of EFI_EVENT. 392 @param[out] Index The pointer to the index of the event which satisfied the wait condition. 393 394 @retval EFI_SUCCESS The event indicated by Index was signaled. 395 @retval EFI_INVALID_PARAMETER 1) NumberOfEvents is 0. 396 2) The event indicated by Index is of type 397 EVT_NOTIFY_SIGNAL. 398 @retval EFI_UNSUPPORTED The current TPL is not TPL_APPLICATION. 399 400 **/ 401 alias EFI_WAIT_FOR_EVENT = EFI_STATUS function(UINTN NumberOfEvents, EFI_EVENT* Event, 402 UINTN* Index) @nogc nothrow; 403 /** 404 Closes an event. 405 406 @param[in] Event The event to close. 407 408 @retval EFI_SUCCESS The event has been closed. 409 410 **/ 411 alias EFI_CLOSE_EVENT = EFI_STATUS function(EFI_EVENT Event) @nogc nothrow; 412 /** 413 Checks whether an event is in the signaled state. 414 415 @param[in] Event The event to check. 416 417 @retval EFI_SUCCESS The event is in the signaled state. 418 @retval EFI_NOT_READY The event is not in the signaled state. 419 @retval EFI_INVALID_PARAMETER Event is of type EVT_NOTIFY_SIGNAL. 420 421 **/ 422 alias EFI_CHECK_EVENT = EFI_STATUS function(EFI_EVENT Event) @nogc nothrow; 423 enum TPL_APPLICATION = 4; 424 enum TPL_CALLBACK = 8; 425 enum TPL_NOTIFY = 16; 426 enum TPL_HIGH_LEVEL = 31; 427 /** 428 Raises a task's priority level and returns its previous level. 429 430 @param[in] NewTpl The new task priority level. 431 432 @return Previous task priority level 433 434 **/ 435 alias EFI_RAISE_TPL = EFI_TPL function(EFI_TPL NewTpl) @nogc nothrow; 436 /** 437 Restores a task's priority level to its previous value. 438 439 @param[in] OldTpl The previous task priority level to restore. 440 441 **/ 442 alias EFI_RESTORE_TPL = VOID function(EFI_TPL OldTpl) @nogc nothrow; 443 /** 444 Returns the value of a variable. 445 446 @param[in] VariableName A Null-terminated string that is the name of the vendor's 447 variable. 448 @param[in] VendorGuid A unique identifier for the vendor. 449 @param[out] Attributes If not NULL, a pointer to the memory location to return the 450 attributes bitmask for the variable. 451 @param[in, out] DataSize On input, the size in bytes of the return Data buffer. 452 On output the size of data returned in Data. 453 @param[out] Data The buffer to return the contents of the variable. 454 455 @retval EFI_SUCCESS The function completed successfully. 456 @retval EFI_NOT_FOUND The variable was not found. 457 @retval EFI_BUFFER_TOO_SMALL The DataSize is too small for the result. 458 @retval EFI_INVALID_PARAMETER VariableName is NULL. 459 @retval EFI_INVALID_PARAMETER VendorGuid is NULL. 460 @retval EFI_INVALID_PARAMETER DataSize is NULL. 461 @retval EFI_INVALID_PARAMETER The DataSize is not too small and Data is NULL. 462 @retval EFI_DEVICE_ERROR The variable could not be retrieved due to a hardware error. 463 @retval EFI_SECURITY_VIOLATION The variable could not be retrieved due to an authentication failure. 464 465 **/ 466 alias EFI_GET_VARIABLE = EFI_STATUS function(CHAR16* VariableName, 467 EFI_GUID* VendorGuid, UINT32* Attributes, UINTN* DataSize, void* Data) @nogc nothrow; 468 /** 469 Enumerates the current variable names. 470 471 @param[in, out] VariableNameSize The size of the VariableName buffer. 472 @param[in, out] VariableName On input, supplies the last VariableName that was returned 473 by GetNextVariableName(). On output, returns the Nullterminated 474 string of the current variable. 475 @param[in, out] VendorGuid On input, supplies the last VendorGuid that was returned by 476 GetNextVariableName(). On output, returns the 477 VendorGuid of the current variable. 478 479 @retval EFI_SUCCESS The function completed successfully. 480 @retval EFI_NOT_FOUND The next variable was not found. 481 @retval EFI_BUFFER_TOO_SMALL The VariableNameSize is too small for the result. 482 @retval EFI_INVALID_PARAMETER VariableNameSize is NULL. 483 @retval EFI_INVALID_PARAMETER VariableName is NULL. 484 @retval EFI_INVALID_PARAMETER VendorGuid is NULL. 485 @retval EFI_DEVICE_ERROR The variable could not be retrieved due to a hardware error. 486 487 **/ 488 alias EFI_GET_NEXT_VARIABLE_NAME = EFI_STATUS function(UINTN* VariableNameSize, 489 CHAR16* VariableName, EFI_GUID* VendorGuid) @nogc nothrow; 490 /** 491 Sets the value of a variable. 492 493 @param[in] VariableName A Null-terminated string that is the name of the vendor's variable. 494 Each VariableName is unique for each VendorGuid. VariableName must 495 contain 1 or more characters. If VariableName is an empty string, 496 then EFI_INVALID_PARAMETER is returned. 497 @param[in] VendorGuid A unique identifier for the vendor. 498 @param[in] Attributes Attributes bitmask to set for the variable. 499 @param[in] DataSize The size in bytes of the Data buffer. Unless the EFI_VARIABLE_APPEND_WRITE, 500 EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS, or 501 EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS attribute is set, a size of zero 502 causes the variable to be deleted. When the EFI_VARIABLE_APPEND_WRITE attribute is 503 set, then a SetVariable() call with a DataSize of zero will not cause any change to 504 the variable value (the timestamp associated with the variable may be updated however 505 even if no new data value is provided,see the description of the 506 EFI_VARIABLE_AUTHENTICATION_2 descriptor below. In this case the DataSize will not 507 be zero since the EFI_VARIABLE_AUTHENTICATION_2 descriptor will be populated). 508 @param[in] Data The contents for the variable. 509 510 @retval EFI_SUCCESS The firmware has successfully stored the variable and its data as 511 defined by the Attributes. 512 @retval EFI_INVALID_PARAMETER An invalid combination of attribute bits, name, and GUID was supplied, or the 513 DataSize exceeds the maximum allowed. 514 @retval EFI_INVALID_PARAMETER VariableName is an empty string. 515 @retval EFI_OUT_OF_RESOURCES Not enough storage is available to hold the variable and its data. 516 @retval EFI_DEVICE_ERROR The variable could not be retrieved due to a hardware error. 517 @retval EFI_WRITE_PROTECTED The variable in question is read-only. 518 @retval EFI_WRITE_PROTECTED The variable in question cannot be deleted. 519 @retval EFI_SECURITY_VIOLATION The variable could not be written due to EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS 520 or EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACESS being set, but the AuthInfo 521 does NOT pass the validation check carried out by the firmware. 522 523 @retval EFI_NOT_FOUND The variable trying to be updated or deleted was not found. 524 525 **/ 526 alias EFI_SET_VARIABLE = EFI_STATUS function(CHAR16* VariableName, 527 EFI_GUID* VendorGuid, UINT32 Attributes, UINTN DataSize, void* Data) @nogc nothrow; 528 /// This provides the capabilities of the 529 /// real time clock device as exposed through the EFI interfaces. 530 struct EFI_TIME_CAPABILITIES 531 { 532 /// 533 /// Provides the reporting resolution of the real-time clock device in 534 /// counts per second. For a normal PC-AT CMOS RTC device, this 535 /// value would be 1 Hz, or 1, to indicate that the device only reports 536 /// the time to the resolution of 1 second. 537 /// 538 UINT32 Resolution; 539 /// 540 /// Provides the timekeeping accuracy of the real-time clock in an 541 /// error rate of 1E-6 parts per million. For a clock with an accuracy 542 /// of 50 parts per million, the value in this field would be 543 /// 50,000,000. 544 /// 545 UINT32 Accuracy; 546 /// 547 /// A TRUE indicates that a time set operation clears the device's 548 /// time below the Resolution reporting level. A FALSE 549 /// indicates that the state below the Resolution level of the 550 /// device is not cleared when the time is set. Normal PC-AT CMOS 551 /// RTC devices set this value to FALSE. 552 /// 553 BOOLEAN SetsToZero; 554 } 555 /** 556 Returns the current time and date information, and the time-keeping capabilities 557 of the hardware platform. 558 559 @param[out] Time A pointer to storage to receive a snapshot of the current time. 560 @param[out] Capabilities An optional pointer to a buffer to receive the real time clock 561 device's capabilities. 562 563 @retval EFI_SUCCESS The operation completed successfully. 564 @retval EFI_INVALID_PARAMETER Time is NULL. 565 @retval EFI_DEVICE_ERROR The time could not be retrieved due to hardware error. 566 567 **/ 568 alias EFI_GET_TIME = EFI_STATUS function(EFI_TIME* Time, EFI_TIME_CAPABILITIES* Capabilities) @nogc nothrow; 569 /** 570 Sets the current local time and date information. 571 572 @param[in] Time A pointer to the current time. 573 574 @retval EFI_SUCCESS The operation completed successfully. 575 @retval EFI_INVALID_PARAMETER A time field is out of range. 576 @retval EFI_DEVICE_ERROR The time could not be set due due to hardware error. 577 578 **/ 579 alias EFI_SET_TIME = EFI_STATUS function(EFI_TIME* Time) @nogc nothrow; 580 /** 581 Returns the current wakeup alarm clock setting. 582 583 @param[out] Enabled Indicates if the alarm is currently enabled or disabled. 584 @param[out] Pending Indicates if the alarm signal is pending and requires acknowledgement. 585 @param[out] Time The current alarm setting. 586 587 @retval EFI_SUCCESS The alarm settings were returned. 588 @retval EFI_INVALID_PARAMETER Enabled is NULL. 589 @retval EFI_INVALID_PARAMETER Pending is NULL. 590 @retval EFI_INVALID_PARAMETER Time is NULL. 591 @retval EFI_DEVICE_ERROR The wakeup time could not be retrieved due to a hardware error. 592 @retval EFI_UNSUPPORTED A wakeup timer is not supported on this platform. 593 594 **/ 595 alias EFI_GET_WAKEUP_TIME = EFI_STATUS function(BOOLEAN* Enabled, BOOLEAN* Pending, 596 EFI_TIME* Time) @nogc nothrow; 597 /** 598 Sets the system wakeup alarm clock time. 599 600 @param[in] Enable Enable or disable the wakeup alarm. 601 @param[in] Time If Enable is TRUE, the time to set the wakeup alarm for. 602 If Enable is FALSE, then this parameter is optional, and may be NULL. 603 604 @retval EFI_SUCCESS If Enable is TRUE, then the wakeup alarm was enabled. If 605 Enable is FALSE, then the wakeup alarm was disabled. 606 @retval EFI_INVALID_PARAMETER A time field is out of range. 607 @retval EFI_DEVICE_ERROR The wakeup time could not be set due to a hardware error. 608 @retval EFI_UNSUPPORTED A wakeup timer is not supported on this platform. 609 610 **/ 611 alias EFI_SET_WAKEUP_TIME = EFI_STATUS function(BOOLEAN Enable, EFI_TIME* Time) @nogc nothrow; 612 /** 613 Loads an EFI image into memory. 614 615 @param[in] BootPolicy If TRUE, indicates that the request originates from the boot 616 manager, and that the boot manager is attempting to load 617 FilePath as a boot selection. Ignored if SourceBuffer is 618 not NULL. 619 @param[in] ParentImageHandle The caller's image handle. 620 @param[in] DevicePath The DeviceHandle specific file path from which the image is 621 loaded. 622 @param[in] SourceBuffer If not NULL, a pointer to the memory location containing a copy 623 of the image to be loaded. 624 @param[in] SourceSize The size in bytes of SourceBuffer. Ignored if SourceBuffer is NULL. 625 @param[out] ImageHandle The pointer to the returned image handle that is created when the 626 image is successfully loaded. 627 628 @retval EFI_SUCCESS Image was loaded into memory correctly. 629 @retval EFI_NOT_FOUND Both SourceBuffer and DevicePath are NULL. 630 @retval EFI_INVALID_PARAMETER One or more parametes are invalid. 631 @retval EFI_UNSUPPORTED The image type is not supported. 632 @retval EFI_OUT_OF_RESOURCES Image was not loaded due to insufficient resources. 633 @retval EFI_LOAD_ERROR Image was not loaded because the image format was corrupt or not 634 understood. 635 @retval EFI_DEVICE_ERROR Image was not loaded because the device returned a read error. 636 @retval EFI_ACCESS_DENIED Image was not loaded because the platform policy prohibits the 637 image from being loaded. NULL is returned in *ImageHandle. 638 @retval EFI_SECURITY_VIOLATION Image was loaded and an ImageHandle was created with a 639 valid EFI_LOADED_IMAGE_PROTOCOL. However, the current 640 platform policy specifies that the image should not be started. 641 **/ 642 alias EFI_IMAGE_LOAD = EFI_STATUS function(BOOLEAN BootPolicy, 643 EFI_HANDLE ParentImageHandle, EFI_DEVICE_PATH_PROTOCOL* DevicePath, 644 void* SourceBuffer, UINTN SourceSize, EFI_HANDLE* ImageHandle) @nogc nothrow; 645 /** 646 Transfers control to a loaded image's entry point. 647 648 @param[in] ImageHandle Handle of image to be started. 649 @param[out] ExitDataSize The pointer to the size, in bytes, of ExitData. 650 @param[out] ExitData The pointer to a pointer to a data buffer that includes a Null-terminated 651 string, optionally followed by additional binary data. 652 653 @retval EFI_INVALID_PARAMETER ImageHandle is either an invalid image handle or the image 654 has already been initialized with StartImage. 655 @retval EFI_SECURITY_VIOLATION The current platform policy specifies that the image should not be started. 656 @return Exit code from image 657 658 **/ 659 alias EFI_IMAGE_START = EFI_STATUS function(EFI_HANDLE ImageHandle, 660 UINTN* ExitDataSize, CHAR16** ExitData) @nogc nothrow; 661 /** 662 Terminates a loaded EFI image and returns control to boot services. 663 664 @param[in] ImageHandle Handle that identifies the image. This parameter is passed to the 665 image on entry. 666 @param[in] ExitStatus The image's exit code. 667 @param[in] ExitDataSize The size, in bytes, of ExitData. Ignored if ExitStatus is EFI_SUCCESS. 668 @param[in] ExitData The pointer to a data buffer that includes a Null-terminated string, 669 optionally followed by additional binary data. The string is a 670 description that the caller may use to further indicate the reason 671 for the image's exit. ExitData is only valid if ExitStatus 672 is something other than EFI_SUCCESS. The ExitData buffer 673 must be allocated by calling AllocatePool(). 674 675 @retval EFI_SUCCESS The image specified by ImageHandle was unloaded. 676 @retval EFI_INVALID_PARAMETER The image specified by ImageHandle has been loaded and 677 started with LoadImage() and StartImage(), but the 678 image is not the currently executing image. 679 680 **/ 681 alias EFI_EXIT = EFI_STATUS function(EFI_HANDLE ImageHandle, 682 EFI_STATUS ExitStatus, UINTN ExitDataSize, CHAR16* ExitData) @nogc nothrow; 683 /** 684 Unloads an image. 685 686 @param[in] ImageHandle Handle that identifies the image to be unloaded. 687 688 @retval EFI_SUCCESS The image has been unloaded. 689 @retval EFI_INVALID_PARAMETER ImageHandle is not a valid image handle. 690 691 **/ 692 alias EFI_IMAGE_UNLOAD = EFI_STATUS function(EFI_HANDLE ImageHandle) @nogc nothrow; 693 /** 694 Terminates all boot services. 695 696 @param[in] ImageHandle Handle that identifies the exiting image. 697 @param[in] MapKey Key to the latest memory map. 698 699 @retval EFI_SUCCESS Boot services have been terminated. 700 @retval EFI_INVALID_PARAMETER MapKey is incorrect. 701 702 **/ 703 alias EFI_EXIT_BOOT_SERVICES = EFI_STATUS function(EFI_HANDLE ImageHandle, UINTN MapKey) @nogc nothrow; 704 /** 705 Induces a fine-grained stall. 706 707 @param[in] Microseconds The number of microseconds to stall execution. 708 709 @retval EFI_SUCCESS Execution was stalled at least the requested number of 710 Microseconds. 711 712 **/ 713 alias EFI_STALL = EFI_STATUS function(UINTN Microseconds) @nogc nothrow; 714 /** 715 Sets the system's watchdog timer. 716 717 @param[in] Timeout The number of seconds to set the watchdog timer to. 718 @param[in] WatchdogCode The numeric code to log on a watchdog timer timeout event. 719 @param[in] DataSize The size, in bytes, of WatchdogData. 720 @param[in] WatchdogData A data buffer that includes a Null-terminated string, optionally 721 followed by additional binary data. 722 723 @retval EFI_SUCCESS The timeout has been set. 724 @retval EFI_INVALID_PARAMETER The supplied WatchdogCode is invalid. 725 @retval EFI_UNSUPPORTED The system does not have a watchdog timer. 726 @retval EFI_DEVICE_ERROR The watchdog timer could not be programmed due to a hardware 727 error. 728 729 **/ 730 alias EFI_SET_WATCHDOG_TIMER = EFI_STATUS function(UINTN Timeout, 731 UINT64 WatchdogCode, UINTN DataSize, CHAR16* WatchdogData) @nogc nothrow; 732 /** 733 Resets the entire platform. 734 735 @param[in] ResetType The type of reset to perform. 736 @param[in] ResetStatus The status code for the reset. 737 @param[in] DataSize The size, in bytes, of WatchdogData. 738 @param[in] ResetData For a ResetType of EfiResetCold, EfiResetWarm, or 739 EfiResetShutdown the data buffer starts with a Null-terminated 740 string, optionally followed by additional binary data. 741 742 **/ 743 alias EFI_RESET_SYSTEM = VOID function(EFI_RESET_TYPE ResetType, 744 EFI_STATUS ResetStatus, UINTN DataSize, void* ResetData) @nogc nothrow; 745 /** 746 Returns a monotonically increasing count for the platform. 747 748 @param[out] Count The pointer to returned value. 749 750 @retval EFI_SUCCESS The next monotonic count was returned. 751 @retval EFI_INVALID_PARAMETER Count is NULL. 752 @retval EFI_DEVICE_ERROR The device is not functioning properly. 753 754 **/ 755 alias EFI_GET_NEXT_MONOTONIC_COUNT = EFI_STATUS function(UINT64* Count) @nogc nothrow; 756 /** 757 Returns the next high 32 bits of the platform's monotonic counter. 758 759 @param[out] HighCount The pointer to returned value. 760 761 @retval EFI_SUCCESS The next high monotonic count was returned. 762 @retval EFI_INVALID_PARAMETER HighCount is NULL. 763 @retval EFI_DEVICE_ERROR The device is not functioning properly. 764 765 **/ 766 alias EFI_GET_NEXT_HIGH_MONO_COUNT = EFI_STATUS function(UINT32* HighCount) @nogc nothrow; 767 /** 768 Computes and returns a 32-bit CRC for a data buffer. 769 770 @param[in] Data A pointer to the buffer on which the 32-bit CRC is to be computed. 771 @param[in] DataSize The number of bytes in the buffer Data. 772 @param[out] Crc32 The 32-bit CRC that was computed for the data buffer specified by Data 773 and DataSize. 774 775 @retval EFI_SUCCESS The 32-bit CRC was computed for the data buffer and returned in 776 Crc32. 777 @retval EFI_INVALID_PARAMETER Data is NULL. 778 @retval EFI_INVALID_PARAMETER Crc32 is NULL. 779 @retval EFI_INVALID_PARAMETER DataSize is 0. 780 781 **/ 782 alias EFI_CALCULATE_CRC32 = EFI_STATUS function(void* Data, UINTN DataSize, UINT32* Crc32) @nogc nothrow; 783 /** 784 Copies the contents of one buffer to another buffer. 785 786 @param[in] Destination The pointer to the destination buffer of the memory copy. 787 @param[in] Source The pointer to the source buffer of the memory copy. 788 @param[in] Length Number of bytes to copy from Source to Destination. 789 790 **/ 791 alias EFI_COPY_MEM = VOID function(void* Destination, void* Source, UINTN Length) @nogc nothrow; 792 /** 793 The SetMem() function fills a buffer with a specified value. 794 795 @param[in] Buffer The pointer to the buffer to fill. 796 @param[in] Size Number of bytes in Buffer to fill. 797 @param[in] Value Value to fill Buffer with. 798 799 **/ 800 alias EFI_SET_MEM = VOID function(void* Buffer, UINTN Size, UINT8 Value) @nogc nothrow; 801 /// Enumeration of EFI Interface Types 802 alias EFI_INTERFACE_TYPE = UINT32; 803 enum : EFI_INTERFACE_TYPE 804 { 805 /// 806 /// Indicates that the supplied protocol interface is supplied in native form. 807 /// 808 EFI_NATIVE_INTERFACE 809 } 810 /** 811 Installs a protocol interface on a device handle. If the handle does not exist, it is created and added 812 to the list of handles in the system. InstallMultipleProtocolInterfaces() performs 813 more error checking than InstallProtocolInterface(), so it is recommended that 814 InstallMultipleProtocolInterfaces() be used in place of 815 InstallProtocolInterface() 816 817 @param[in, out] Handle A pointer to the EFI_HANDLE on which the interface is to be installed. 818 @param[in] Protocol The numeric ID of the protocol interface. 819 @param[in] InterfaceType Indicates whether Interface is supplied in native form. 820 @param[in] Interface A pointer to the protocol interface. 821 822 @retval EFI_SUCCESS The protocol interface was installed. 823 @retval EFI_OUT_OF_RESOURCES Space for a new handle could not be allocated. 824 @retval EFI_INVALID_PARAMETER Handle is NULL. 825 @retval EFI_INVALID_PARAMETER Protocol is NULL. 826 @retval EFI_INVALID_PARAMETER InterfaceType is not EFI_NATIVE_INTERFACE. 827 @retval EFI_INVALID_PARAMETER Protocol is already installed on the handle specified by Handle. 828 829 **/ 830 alias EFI_INSTALL_PROTOCOL_INTERFACE = EFI_STATUS function(EFI_HANDLE* Handle, 831 EFI_GUID* Protocol, EFI_INTERFACE_TYPE InterfaceType, void* Interface) @nogc nothrow; 832 /** 833 Installs one or more protocol interfaces into the boot services environment. 834 835 @param[in, out] Handle The pointer to a handle to install the new protocol interfaces on, 836 or a pointer to NULL if a new handle is to be allocated. 837 @param ... A variable argument list containing pairs of protocol GUIDs and protocol 838 interfaces. 839 840 @retval EFI_SUCCESS All the protocol interface was installed. 841 @retval EFI_OUT_OF_RESOURCES There was not enough memory in pool to install all the protocols. 842 @retval EFI_ALREADY_STARTED A Device Path Protocol instance was passed in that is already present in 843 the handle database. 844 @retval EFI_INVALID_PARAMETER Handle is NULL. 845 @retval EFI_INVALID_PARAMETER Protocol is already installed on the handle specified by Handle. 846 847 **/ 848 alias EFI_INSTALL_MULTIPLE_PROTOCOL_INTERFACES = EFI_STATUS function(EFI_HANDLE* Handle, 849 ...) @nogc nothrow; 850 /** 851 Reinstalls a protocol interface on a device handle. 852 853 @param[in] Handle Handle on which the interface is to be reinstalled. 854 @param[in] Protocol The numeric ID of the interface. 855 @param[in] OldInterface A pointer to the old interface. NULL can be used if a structure is not 856 associated with Protocol. 857 @param[in] NewInterface A pointer to the new interface. 858 859 @retval EFI_SUCCESS The protocol interface was reinstalled. 860 @retval EFI_NOT_FOUND The OldInterface on the handle was not found. 861 @retval EFI_ACCESS_DENIED The protocol interface could not be reinstalled, 862 because OldInterface is still being used by a 863 driver that will not release it. 864 @retval EFI_INVALID_PARAMETER Handle is NULL. 865 @retval EFI_INVALID_PARAMETER Protocol is NULL. 866 867 **/ 868 alias EFI_REINSTALL_PROTOCOL_INTERFACE = EFI_STATUS function(EFI_HANDLE Handle, 869 EFI_GUID* Protocol, void* OldInterface, void* NewInterface) @nogc nothrow; 870 /** 871 Removes a protocol interface from a device handle. It is recommended that 872 UninstallMultipleProtocolInterfaces() be used in place of 873 UninstallProtocolInterface(). 874 875 @param[in] Handle The handle on which the interface was installed. 876 @param[in] Protocol The numeric ID of the interface. 877 @param[in] Interface A pointer to the interface. 878 879 @retval EFI_SUCCESS The interface was removed. 880 @retval EFI_NOT_FOUND The interface was not found. 881 @retval EFI_ACCESS_DENIED The interface was not removed because the interface 882 is still being used by a driver. 883 @retval EFI_INVALID_PARAMETER Handle is NULL. 884 @retval EFI_INVALID_PARAMETER Protocol is NULL. 885 886 **/ 887 alias EFI_UNINSTALL_PROTOCOL_INTERFACE = EFI_STATUS function(EFI_HANDLE Handle, 888 EFI_GUID* Protocol, void* Interface) @nogc nothrow; 889 /** 890 Removes one or more protocol interfaces into the boot services environment. 891 892 @param[in] Handle The handle to remove the protocol interfaces from. 893 @param ... A variable argument list containing pairs of protocol GUIDs and 894 protocol interfaces. 895 896 @retval EFI_SUCCESS All the protocol interfaces were removed. 897 @retval EFI_INVALID_PARAMETER One of the protocol interfaces was not previously installed on Handle. 898 899 **/ 900 alias EFI_UNINSTALL_MULTIPLE_PROTOCOL_INTERFACES = EFI_STATUS function(EFI_HANDLE Handle, 901 ...) @nogc nothrow; 902 /** 903 Queries a handle to determine if it supports a specified protocol. 904 905 @param[in] Handle The handle being queried. 906 @param[in] Protocol The published unique identifier of the protocol. 907 @param[out] Interface Supplies the address where a pointer to the corresponding Protocol 908 Interface is returned. 909 910 @retval EFI_SUCCESS The interface information for the specified protocol was returned. 911 @retval EFI_UNSUPPORTED The device does not support the specified protocol. 912 @retval EFI_INVALID_PARAMETER Handle is NULL. 913 @retval EFI_INVALID_PARAMETER Protocol is NULL. 914 @retval EFI_INVALID_PARAMETER Interface is NULL. 915 916 **/ 917 alias EFI_HANDLE_PROTOCOL = EFI_STATUS function(EFI_HANDLE Handle, 918 EFI_GUID* Protocol, void** Interface) @nogc nothrow; 919 enum EFI_OPEN_PROTOCOL_BY_HANDLE_PROTOCOL = 0x00000001; 920 enum EFI_OPEN_PROTOCOL_GET_PROTOCOL = 0x00000002; 921 enum EFI_OPEN_PROTOCOL_TEST_PROTOCOL = 0x00000004; 922 enum EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER = 0x00000008; 923 enum EFI_OPEN_PROTOCOL_BY_DRIVER = 0x00000010; 924 enum EFI_OPEN_PROTOCOL_EXCLUSIVE = 0x00000020; 925 /** 926 Queries a handle to determine if it supports a specified protocol. If the protocol is supported by the 927 handle, it opens the protocol on behalf of the calling agent. 928 929 @param[in] Handle The handle for the protocol interface that is being opened. 930 @param[in] Protocol The published unique identifier of the protocol. 931 @param[out] Interface Supplies the address where a pointer to the corresponding Protocol 932 Interface is returned. 933 @param[in] AgentHandle The handle of the agent that is opening the protocol interface 934 specified by Protocol and Interface. 935 @param[in] ControllerHandle If the agent that is opening a protocol is a driver that follows the 936 UEFI Driver Model, then this parameter is the controller handle 937 that requires the protocol interface. If the agent does not follow 938 the UEFI Driver Model, then this parameter is optional and may 939 be NULL. 940 @param[in] Attributes The open mode of the protocol interface specified by Handle 941 and Protocol. 942 943 @retval EFI_SUCCESS An item was added to the open list for the protocol interface, and the 944 protocol interface was returned in Interface. 945 @retval EFI_UNSUPPORTED Handle does not support Protocol. 946 @retval EFI_INVALID_PARAMETER One or more parameters are invalid. 947 @retval EFI_ACCESS_DENIED Required attributes can't be supported in current environment. 948 @retval EFI_ALREADY_STARTED Item on the open list already has requierd attributes whose agent 949 handle is the same as AgentHandle. 950 951 **/ 952 alias EFI_OPEN_PROTOCOL = EFI_STATUS function(EFI_HANDLE Handle, 953 EFI_GUID* Protocol, void** Interface, EFI_HANDLE AgentHandle, 954 EFI_HANDLE ControllerHandle, UINT32 Attributes) @nogc nothrow; 955 /** 956 Closes a protocol on a handle that was opened using OpenProtocol(). 957 958 @param[in] Handle The handle for the protocol interface that was previously opened 959 with OpenProtocol(), and is now being closed. 960 @param[in] Protocol The published unique identifier of the protocol. 961 @param[in] AgentHandle The handle of the agent that is closing the protocol interface. 962 @param[in] ControllerHandle If the agent that opened a protocol is a driver that follows the 963 UEFI Driver Model, then this parameter is the controller handle 964 that required the protocol interface. 965 966 @retval EFI_SUCCESS The protocol instance was closed. 967 @retval EFI_INVALID_PARAMETER 1) Handle is NULL. 968 2) AgentHandle is NULL. 969 3) ControllerHandle is not NULL and ControllerHandle is not a valid EFI_HANDLE. 970 4) Protocol is NULL. 971 @retval EFI_NOT_FOUND 1) Handle does not support the protocol specified by Protocol. 972 2) The protocol interface specified by Handle and Protocol is not 973 currently open by AgentHandle and ControllerHandle. 974 975 **/ 976 alias EFI_CLOSE_PROTOCOL = EFI_STATUS function(EFI_HANDLE Handle, 977 EFI_GUID* Protocol, EFI_HANDLE AgentHandle, EFI_HANDLE ControllerHandle) @nogc nothrow; 978 /// EFI Oprn Protocol Information Entry 979 struct EFI_OPEN_PROTOCOL_INFORMATION_ENTRY 980 { 981 EFI_HANDLE AgentHandle; 982 EFI_HANDLE ControllerHandle; 983 UINT32 Attributes; 984 UINT32 OpenCount; 985 } 986 /** 987 Retrieves the list of agents that currently have a protocol interface opened. 988 989 @param[in] Handle The handle for the protocol interface that is being queried. 990 @param[in] Protocol The published unique identifier of the protocol. 991 @param[out] EntryBuffer A pointer to a buffer of open protocol information in the form of 992 EFI_OPEN_PROTOCOL_INFORMATION_ENTRY structures. 993 @param[out] EntryCount A pointer to the number of entries in EntryBuffer. 994 995 @retval EFI_SUCCESS The open protocol information was returned in EntryBuffer, and the 996 number of entries was returned EntryCount. 997 @retval EFI_OUT_OF_RESOURCES There are not enough resources available to allocate EntryBuffer. 998 @retval EFI_NOT_FOUND Handle does not support the protocol specified by Protocol. 999 1000 **/ 1001 alias EFI_OPEN_PROTOCOL_INFORMATION = EFI_STATUS function(EFI_HANDLE Handle, 1002 EFI_GUID* Protocol, EFI_OPEN_PROTOCOL_INFORMATION_ENTRY** EntryBuffer, UINTN* EntryCount) @nogc nothrow; 1003 /** 1004 Retrieves the list of protocol interface GUIDs that are installed on a handle in a buffer allocated 1005 from pool. 1006 1007 @param[in] Handle The handle from which to retrieve the list of protocol interface 1008 GUIDs. 1009 @param[out] ProtocolBuffer A pointer to the list of protocol interface GUID pointers that are 1010 installed on Handle. 1011 @param[out] ProtocolBufferCount A pointer to the number of GUID pointers present in 1012 ProtocolBuffer. 1013 1014 @retval EFI_SUCCESS The list of protocol interface GUIDs installed on Handle was returned in 1015 ProtocolBuffer. The number of protocol interface GUIDs was 1016 returned in ProtocolBufferCount. 1017 @retval EFI_OUT_OF_RESOURCES There is not enough pool memory to store the results. 1018 @retval EFI_INVALID_PARAMETER Handle is NULL. 1019 @retval EFI_INVALID_PARAMETER Handle is not a valid EFI_HANDLE. 1020 @retval EFI_INVALID_PARAMETER ProtocolBuffer is NULL. 1021 @retval EFI_INVALID_PARAMETER ProtocolBufferCount is NULL. 1022 1023 **/ 1024 alias EFI_PROTOCOLS_PER_HANDLE = EFI_STATUS function(EFI_HANDLE Handle, 1025 EFI_GUID*** ProtocolBuffer, UINTN* ProtocolBufferCount) @nogc nothrow; 1026 /** 1027 Creates an event that is to be signaled whenever an interface is installed for a specified protocol. 1028 1029 @param[in] Protocol The numeric ID of the protocol for which the event is to be registered. 1030 @param[in] Event Event that is to be signaled whenever a protocol interface is registered 1031 for Protocol. 1032 @param[out] Registration A pointer to a memory location to receive the registration value. 1033 1034 @retval EFI_SUCCESS The notification event has been registered. 1035 @retval EFI_OUT_OF_RESOURCES Space for the notification event could not be allocated. 1036 @retval EFI_INVALID_PARAMETER Protocol is NULL. 1037 @retval EFI_INVALID_PARAMETER Event is NULL. 1038 @retval EFI_INVALID_PARAMETER Registration is NULL. 1039 1040 **/ 1041 alias EFI_REGISTER_PROTOCOL_NOTIFY = EFI_STATUS function(EFI_GUID* Protocol, 1042 EFI_EVENT Event, void** Registration) @nogc nothrow; 1043 /// Enumeration of EFI Locate Search Types 1044 alias EFI_LOCATE_SEARCH_TYPE = UINT32; 1045 enum : EFI_LOCATE_SEARCH_TYPE 1046 { 1047 /// 1048 /// Retrieve all the handles in the handle database. 1049 /// 1050 AllHandles, 1051 /// 1052 /// Retrieve the next handle fron a RegisterProtocolNotify() event. 1053 /// 1054 ByRegisterNotify, 1055 /// 1056 /// Retrieve the set of handles from the handle database that support a 1057 /// specified protocol. 1058 /// 1059 ByProtocol 1060 } 1061 /** 1062 Returns an array of handles that support a specified protocol. 1063 1064 @param[in] SearchType Specifies which handle(s) are to be returned. 1065 @param[in] Protocol Specifies the protocol to search by. 1066 @param[in] SearchKey Specifies the search key. 1067 @param[in, out] BufferSize On input, the size in bytes of Buffer. On output, the size in bytes of 1068 the array returned in Buffer (if the buffer was large enough) or the 1069 size, in bytes, of the buffer needed to obtain the array (if the buffer was 1070 not large enough). 1071 @param[out] Buffer The buffer in which the array is returned. 1072 1073 @retval EFI_SUCCESS The array of handles was returned. 1074 @retval EFI_NOT_FOUND No handles match the search. 1075 @retval EFI_BUFFER_TOO_SMALL The BufferSize is too small for the result. 1076 @retval EFI_INVALID_PARAMETER SearchType is not a member of EFI_LOCATE_SEARCH_TYPE. 1077 @retval EFI_INVALID_PARAMETER SearchType is ByRegisterNotify and SearchKey is NULL. 1078 @retval EFI_INVALID_PARAMETER SearchType is ByProtocol and Protocol is NULL. 1079 @retval EFI_INVALID_PARAMETER One or more matches are found and BufferSize is NULL. 1080 @retval EFI_INVALID_PARAMETER BufferSize is large enough for the result and Buffer is NULL. 1081 1082 **/ 1083 alias EFI_LOCATE_HANDLE = EFI_STATUS function(EFI_LOCATE_SEARCH_TYPE SearchType, 1084 EFI_GUID* Protocol, void* SearchKey, UINTN* BufferSize, EFI_HANDLE* Buffer) @nogc nothrow; 1085 /** 1086 Locates the handle to a device on the device path that supports the specified protocol. 1087 1088 @param[in] Protocol Specifies the protocol to search for. 1089 @param[in, out] DevicePath On input, a pointer to a pointer to the device path. On output, the device 1090 path pointer is modified to point to the remaining part of the device 1091 path. 1092 @param[out] Device A pointer to the returned device handle. 1093 1094 @retval EFI_SUCCESS The resulting handle was returned. 1095 @retval EFI_NOT_FOUND No handles match the search. 1096 @retval EFI_INVALID_PARAMETER Protocol is NULL. 1097 @retval EFI_INVALID_PARAMETER DevicePath is NULL. 1098 @retval EFI_INVALID_PARAMETER A handle matched the search and Device is NULL. 1099 1100 **/ 1101 alias EFI_LOCATE_DEVICE_PATH = EFI_STATUS function(EFI_GUID* Protocol, 1102 EFI_DEVICE_PATH_PROTOCOL** DevicePath, EFI_HANDLE* Device) @nogc nothrow; 1103 /** 1104 Adds, updates, or removes a configuration table entry from the EFI System Table. 1105 1106 @param[in] Guid A pointer to the GUID for the entry to add, update, or remove. 1107 @param[in] Table A pointer to the configuration table for the entry to add, update, or 1108 remove. May be NULL. 1109 1110 @retval EFI_SUCCESS The (Guid, Table) pair was added, updated, or removed. 1111 @retval EFI_NOT_FOUND An attempt was made to delete a nonexistent entry. 1112 @retval EFI_INVALID_PARAMETER Guid is NULL. 1113 @retval EFI_OUT_OF_RESOURCES There is not enough memory available to complete the operation. 1114 1115 **/ 1116 alias EFI_INSTALL_CONFIGURATION_TABLE = EFI_STATUS function(EFI_GUID* Guid, void* Table) @nogc nothrow; 1117 /** 1118 Returns an array of handles that support the requested protocol in a buffer allocated from pool. 1119 1120 @param[in] SearchType Specifies which handle(s) are to be returned. 1121 @param[in] Protocol Provides the protocol to search by. 1122 This parameter is only valid for a SearchType of ByProtocol. 1123 @param[in] SearchKey Supplies the search key depending on the SearchType. 1124 @param[in, out] NoHandles The number of handles returned in Buffer. 1125 @param[out] Buffer A pointer to the buffer to return the requested array of handles that 1126 support Protocol. 1127 1128 @retval EFI_SUCCESS The array of handles was returned in Buffer, and the number of 1129 handles in Buffer was returned in NoHandles. 1130 @retval EFI_NOT_FOUND No handles match the search. 1131 @retval EFI_OUT_OF_RESOURCES There is not enough pool memory to store the matching results. 1132 @retval EFI_INVALID_PARAMETER NoHandles is NULL. 1133 @retval EFI_INVALID_PARAMETER Buffer is NULL. 1134 1135 **/ 1136 alias EFI_LOCATE_HANDLE_BUFFER = EFI_STATUS function( 1137 EFI_LOCATE_SEARCH_TYPE SearchType, EFI_GUID* Protocol, void* SearchKey, 1138 UINTN* NoHandles, EFI_HANDLE** Buffer) @nogc nothrow; 1139 /** 1140 Returns the first protocol instance that matches the given protocol. 1141 1142 @param[in] Protocol Provides the protocol to search for. 1143 @param[in] Registration Optional registration key returned from 1144 RegisterProtocolNotify(). 1145 @param[out] Interface On return, a pointer to the first interface that matches Protocol and 1146 Registration. 1147 1148 @retval EFI_SUCCESS A protocol instance matching Protocol was found and returned in 1149 Interface. 1150 @retval EFI_NOT_FOUND No protocol instances were found that match Protocol and 1151 Registration. 1152 @retval EFI_INVALID_PARAMETER Interface is NULL. 1153 1154 **/ 1155 alias EFI_LOCATE_PROTOCOL = EFI_STATUS function(EFI_GUID* Protocol, 1156 void* Registration, void** Interface) @nogc nothrow; 1157 /// EFI Capsule Block Descriptor 1158 struct EFI_CAPSULE_BLOCK_DESCRIPTOR 1159 { 1160 /// 1161 /// Length in bytes of the data pointed to by DataBlock/ContinuationPointer. 1162 /// 1163 UINT64 Length; 1164 union Union 1165 { 1166 /// 1167 /// Physical address of the data block. This member of the union is 1168 /// used if Length is not equal to zero. 1169 /// 1170 EFI_PHYSICAL_ADDRESS DataBlock; 1171 /// 1172 /// Physical address of another block of 1173 /// EFI_CAPSULE_BLOCK_DESCRIPTOR structures. This 1174 /// member of the union is used if Length is equal to zero. If 1175 /// ContinuationPointer is zero this entry represents the end of the list. 1176 /// 1177 EFI_PHYSICAL_ADDRESS ContinuationPointer; 1178 } 1179 } 1180 /// EFI Capsule Header. 1181 struct EFI_CAPSULE_HEADER 1182 { 1183 /// 1184 /// A GUID that defines the contents of a capsule. 1185 /// 1186 EFI_GUID CapsuleGuid; 1187 /// 1188 /// The size of the capsule header. This may be larger than the size of 1189 /// the EFI_CAPSULE_HEADER since CapsuleGuid may imply 1190 /// extended header entries 1191 /// 1192 UINT32 HeaderSize; 1193 /// 1194 /// Bit-mapped list describing the capsule attributes. The Flag values 1195 /// of 0x0000 - 0xFFFF are defined by CapsuleGuid. Flag values 1196 /// of 0x10000 - 0xFFFFFFFF are defined by this specification 1197 /// 1198 UINT32 Flags; 1199 /// 1200 /// Size in bytes of the capsule. 1201 /// 1202 UINT32 CapsuleImageSize; 1203 } 1204 /// The EFI System Table entry must point to an array of capsules 1205 /// that contain the same CapsuleGuid value. The array must be 1206 /// prefixed by a UINT32 that represents the size of the array of capsules. 1207 struct EFI_CAPSULE_TABLE 1208 { 1209 /// 1210 /// the size of the array of capsules. 1211 /// 1212 UINT32 CapsuleArrayNumber; 1213 /// 1214 /// Point to an array of capsules that contain the same CapsuleGuid value. 1215 /// 1216 VOID*[1] CapsulePtr; 1217 } 1218 1219 enum CAPSULE_FLAGS_PERSIST_ACROSS_RESET = 0x00010000; 1220 enum CAPSULE_FLAGS_POPULATE_SYSTEM_TABLE = 0x00020000; 1221 enum CAPSULE_FLAGS_INITIATE_RESET = 0x00040000; 1222 /** 1223 Passes capsules to the firmware with both virtual and physical mapping. Depending on the intended 1224 consumption, the firmware may process the capsule immediately. If the payload should persist 1225 across a system reset, the reset value returned from EFI_QueryCapsuleCapabilities must 1226 be passed into ResetSystem() and will cause the capsule to be processed by the firmware as 1227 part of the reset process. 1228 1229 @param[in] CapsuleHeaderArray Virtual pointer to an array of virtual pointers to the capsules 1230 being passed into update capsule. 1231 @param[in] CapsuleCount Number of pointers to EFI_CAPSULE_HEADER in 1232 CaspuleHeaderArray. 1233 @param[in] ScatterGatherList Physical pointer to a set of 1234 EFI_CAPSULE_BLOCK_DESCRIPTOR that describes the 1235 location in physical memory of a set of capsules. 1236 1237 @retval EFI_SUCCESS Valid capsule was passed. If 1238 CAPSULE_FLAGS_PERSIT_ACROSS_RESET is not set, the 1239 capsule has been successfully processed by the firmware. 1240 @retval EFI_INVALID_PARAMETER CapsuleSize is NULL, or an incompatible set of flags were 1241 set in the capsule header. 1242 @retval EFI_INVALID_PARAMETER CapsuleCount is 0. 1243 @retval EFI_DEVICE_ERROR The capsule update was started, but failed due to a device error. 1244 @retval EFI_UNSUPPORTED The capsule type is not supported on this platform. 1245 @retval EFI_OUT_OF_RESOURCES When ExitBootServices() has been previously called this error indicates the capsule 1246 is compatible with this platform but is not capable of being submitted or processed 1247 in runtime. The caller may resubmit the capsule prior to ExitBootServices(). 1248 @retval EFI_OUT_OF_RESOURCES When ExitBootServices() has not been previously called then this error indicates 1249 the capsule is compatible with this platform but there are insufficient resources to process. 1250 1251 **/ 1252 alias EFI_UPDATE_CAPSULE = EFI_STATUS function( 1253 EFI_CAPSULE_HEADER** CapsuleHeaderArray, UINTN CapsuleCount, 1254 EFI_PHYSICAL_ADDRESS ScatterGatherList) @nogc nothrow; 1255 /** 1256 Returns if the capsule can be supported via UpdateCapsule(). 1257 1258 @param[in] CapsuleHeaderArray Virtual pointer to an array of virtual pointers to the capsules 1259 being passed into update capsule. 1260 @param[in] CapsuleCount Number of pointers to EFI_CAPSULE_HEADER in 1261 CaspuleHeaderArray. 1262 @param[out] MaxiumCapsuleSize On output the maximum size that UpdateCapsule() can 1263 support as an argument to UpdateCapsule() via 1264 CapsuleHeaderArray and ScatterGatherList. 1265 @param[out] ResetType Returns the type of reset required for the capsule update. 1266 1267 @retval EFI_SUCCESS Valid answer returned. 1268 @retval EFI_UNSUPPORTED The capsule type is not supported on this platform, and 1269 MaximumCapsuleSize and ResetType are undefined. 1270 @retval EFI_INVALID_PARAMETER MaximumCapsuleSize is NULL. 1271 @retval EFI_OUT_OF_RESOURCES When ExitBootServices() has been previously called this error indicates the capsule 1272 is compatible with this platform but is not capable of being submitted or processed 1273 in runtime. The caller may resubmit the capsule prior to ExitBootServices(). 1274 @retval EFI_OUT_OF_RESOURCES When ExitBootServices() has not been previously called then this error indicates 1275 the capsule is compatible with this platform but there are insufficient resources to process. 1276 1277 **/ 1278 alias EFI_QUERY_CAPSULE_CAPABILITIES = EFI_STATUS function( 1279 EFI_CAPSULE_HEADER** CapsuleHeaderArray, UINTN CapsuleCount, 1280 UINT64* MaximumCapsuleSize, EFI_RESET_TYPE* ResetType) @nogc nothrow; 1281 /** 1282 Returns information about the EFI variables. 1283 1284 @param[in] Attributes Attributes bitmask to specify the type of variables on 1285 which to return information. 1286 @param[out] MaximumVariableStorageSize On output the maximum size of the storage space 1287 available for the EFI variables associated with the 1288 attributes specified. 1289 @param[out] RemainingVariableStorageSize Returns the remaining size of the storage space 1290 available for the EFI variables associated with the 1291 attributes specified. 1292 @param[out] MaximumVariableSize Returns the maximum size of the individual EFI 1293 variables associated with the attributes specified. 1294 1295 @retval EFI_SUCCESS Valid answer returned. 1296 @retval EFI_INVALID_PARAMETER An invalid combination of attribute bits was supplied 1297 @retval EFI_UNSUPPORTED The attribute is not supported on this platform, and the 1298 MaximumVariableStorageSize, 1299 RemainingVariableStorageSize, MaximumVariableSize 1300 are undefined. 1301 1302 **/ 1303 alias EFI_QUERY_VARIABLE_INFO = EFI_STATUS function(UINT32 Attributes, 1304 UINT64* MaximumVariableStorageSize, UINT64* RemainingVariableStorageSize, 1305 UINT64* MaximumVariableSize) @nogc nothrow; 1306 enum EFI_OS_INDICATIONS_BOOT_TO_FW_UI = 0x0000000000000001; 1307 enum EFI_OS_INDICATIONS_TIMESTAMP_REVOCATION = 0x0000000000000002; 1308 enum EFI_OS_INDICATIONS_FILE_CAPSULE_DELIVERY_SUPPORTED = 0x0000000000000004; 1309 enum EFI_OS_INDICATIONS_FMP_CAPSULE_SUPPORTED = 0x0000000000000008; 1310 enum EFI_OS_INDICATIONS_CAPSULE_RESULT_VAR_SUPPORTED = 0x0000000000000010; 1311 enum EFI_SYSTEM_TABLE_SIGNATURE = SIGNATURE_64('I', 'B', 'I', ' ', 'S', 'Y', 'S', 'T'); 1312 enum EFI_2_50_SYSTEM_TABLE_REVISION = ((2 << 16) | (50)); 1313 enum EFI_2_40_SYSTEM_TABLE_REVISION = ((2 << 16) | (40)); 1314 enum EFI_2_31_SYSTEM_TABLE_REVISION = ((2 << 16) | (31)); 1315 enum EFI_2_30_SYSTEM_TABLE_REVISION = ((2 << 16) | (30)); 1316 enum EFI_2_20_SYSTEM_TABLE_REVISION = ((2 << 16) | (20)); 1317 enum EFI_2_10_SYSTEM_TABLE_REVISION = ((2 << 16) | (10)); 1318 enum EFI_2_00_SYSTEM_TABLE_REVISION = ((2 << 16) | (00)); 1319 enum EFI_1_10_SYSTEM_TABLE_REVISION = ((1 << 16) | (10)); 1320 enum EFI_1_02_SYSTEM_TABLE_REVISION = ((1 << 16) | (02)); 1321 enum EFI_SYSTEM_TABLE_REVISION = EFI_2_50_SYSTEM_TABLE_REVISION; 1322 enum EFI_SPECIFICATION_VERSION = EFI_SYSTEM_TABLE_REVISION; 1323 enum EFI_RUNTIME_SERVICES_SIGNATURE = SIGNATURE_64('R', 'U', 'N', 'T', 'S', 'E', 'R', 1324 'V'); 1325 enum EFI_RUNTIME_SERVICES_REVISION = EFI_SPECIFICATION_VERSION; 1326 /// EFI Runtime Services Table. 1327 struct EFI_RUNTIME_SERVICES 1328 { 1329 /// 1330 /// The table header for the EFI Runtime Services Table. 1331 /// 1332 EFI_TABLE_HEADER Hdr; 1333 1334 // 1335 // Time Services 1336 // 1337 EFI_GET_TIME GetTime; 1338 EFI_SET_TIME SetTime; 1339 EFI_GET_WAKEUP_TIME GetWakeupTime; 1340 EFI_SET_WAKEUP_TIME SetWakeupTime; 1341 1342 // 1343 // Virtual Memory Services 1344 // 1345 EFI_SET_VIRTUAL_ADDRESS_MAP SetVirtualAddressMap; 1346 EFI_CONVERT_POINTER ConvertPointer; 1347 1348 // 1349 // Variable Services 1350 // 1351 EFI_GET_VARIABLE GetVariable; 1352 EFI_GET_NEXT_VARIABLE_NAME GetNextVariableName; 1353 EFI_SET_VARIABLE SetVariable; 1354 1355 // 1356 // Miscellaneous Services 1357 // 1358 EFI_GET_NEXT_HIGH_MONO_COUNT GetNextHighMonotonicCount; 1359 EFI_RESET_SYSTEM ResetSystem; 1360 1361 // 1362 // UEFI 2.0 Capsule Services 1363 // 1364 EFI_UPDATE_CAPSULE UpdateCapsule; 1365 EFI_QUERY_CAPSULE_CAPABILITIES QueryCapsuleCapabilities; 1366 1367 // 1368 // Miscellaneous UEFI 2.0 Service 1369 // 1370 EFI_QUERY_VARIABLE_INFO QueryVariableInfo; 1371 } 1372 1373 enum EFI_BOOT_SERVICES_SIGNATURE = SIGNATURE_64('B', 'O', 'O', 'T', 'S', 'E', 'R', 1374 'V'); 1375 enum EFI_BOOT_SERVICES_REVISION = EFI_SPECIFICATION_VERSION; 1376 /// EFI Boot Services Table. 1377 struct EFI_BOOT_SERVICES 1378 { 1379 /// 1380 /// The table header for the EFI Boot Services Table. 1381 /// 1382 EFI_TABLE_HEADER Hdr; 1383 1384 // 1385 // Task Priority Services 1386 // 1387 EFI_RAISE_TPL RaiseTPL; 1388 EFI_RESTORE_TPL RestoreTPL; 1389 1390 // 1391 // Memory Services 1392 // 1393 EFI_ALLOCATE_PAGES AllocatePages; 1394 EFI_FREE_PAGES FreePages; 1395 EFI_GET_MEMORY_MAP GetMemoryMap; 1396 EFI_ALLOCATE_POOL AllocatePool; 1397 EFI_FREE_POOL FreePool; 1398 1399 // 1400 // Event & Timer Services 1401 // 1402 EFI_CREATE_EVENT CreateEvent; 1403 EFI_SET_TIMER SetTimer; 1404 EFI_WAIT_FOR_EVENT WaitForEvent; 1405 EFI_SIGNAL_EVENT SignalEvent; 1406 EFI_CLOSE_EVENT CloseEvent; 1407 EFI_CHECK_EVENT CheckEvent; 1408 1409 // 1410 // Protocol Handler Services 1411 // 1412 EFI_INSTALL_PROTOCOL_INTERFACE InstallProtocolInterface; 1413 EFI_REINSTALL_PROTOCOL_INTERFACE ReinstallProtocolInterface; 1414 EFI_UNINSTALL_PROTOCOL_INTERFACE UninstallProtocolInterface; 1415 EFI_HANDLE_PROTOCOL HandleProtocol; 1416 VOID* Reserved; 1417 EFI_REGISTER_PROTOCOL_NOTIFY RegisterProtocolNotify; 1418 EFI_LOCATE_HANDLE LocateHandle; 1419 EFI_LOCATE_DEVICE_PATH LocateDevicePath; 1420 EFI_INSTALL_CONFIGURATION_TABLE InstallConfigurationTable; 1421 1422 // 1423 // Image Services 1424 // 1425 EFI_IMAGE_LOAD LoadImage; 1426 EFI_IMAGE_START StartImage; 1427 EFI_EXIT Exit; 1428 EFI_IMAGE_UNLOAD UnloadImage; 1429 EFI_EXIT_BOOT_SERVICES ExitBootServices; 1430 1431 // 1432 // Miscellaneous Services 1433 // 1434 EFI_GET_NEXT_MONOTONIC_COUNT GetNextMonotonicCount; 1435 EFI_STALL Stall; 1436 EFI_SET_WATCHDOG_TIMER SetWatchdogTimer; 1437 1438 // 1439 // DriverSupport Services 1440 // 1441 EFI_CONNECT_CONTROLLER ConnectController; 1442 EFI_DISCONNECT_CONTROLLER DisconnectController; 1443 1444 // 1445 // Open and Close Protocol Services 1446 // 1447 EFI_OPEN_PROTOCOL OpenProtocol; 1448 EFI_CLOSE_PROTOCOL CloseProtocol; 1449 EFI_OPEN_PROTOCOL_INFORMATION OpenProtocolInformation; 1450 1451 // 1452 // Library Services 1453 // 1454 EFI_PROTOCOLS_PER_HANDLE ProtocolsPerHandle; 1455 EFI_LOCATE_HANDLE_BUFFER LocateHandleBuffer; 1456 EFI_LOCATE_PROTOCOL LocateProtocol; 1457 EFI_INSTALL_MULTIPLE_PROTOCOL_INTERFACES InstallMultipleProtocolInterfaces; 1458 EFI_UNINSTALL_MULTIPLE_PROTOCOL_INTERFACES UninstallMultipleProtocolInterfaces; 1459 1460 // 1461 // 32-bit CRC Services 1462 // 1463 EFI_CALCULATE_CRC32 CalculateCrc32; 1464 1465 // 1466 // Miscellaneous Services 1467 // 1468 EFI_COPY_MEM CopyMem; 1469 EFI_SET_MEM SetMem; 1470 EFI_CREATE_EVENT_EX CreateEventEx; 1471 } 1472 /// Contains a set of GUID/pointer pairs comprised of the ConfigurationTable field in the 1473 /// EFI System Table. 1474 struct EFI_CONFIGURATION_TABLE 1475 { 1476 /// 1477 /// The 128-bit GUID value that uniquely identifies the system configuration table. 1478 /// 1479 EFI_GUID VendorGuid; 1480 /// 1481 /// A pointer to the table associated with VendorGuid. 1482 /// 1483 VOID* VendorTable; 1484 } 1485 /// EFI System Table 1486 struct EFI_SYSTEM_TABLE 1487 { 1488 /// 1489 /// The table header for the EFI System Table. 1490 /// 1491 EFI_TABLE_HEADER Hdr; 1492 /// 1493 /// A pointer to a null terminated string that identifies the vendor 1494 /// that produces the system firmware for the platform. 1495 /// 1496 CHAR16* FirmwareVendor; 1497 /// 1498 /// A firmware vendor specific value that identifies the revision 1499 /// of the system firmware for the platform. 1500 /// 1501 UINT32 FirmwareRevision; 1502 /// 1503 /// The handle for the active console input device. This handle must support 1504 /// EFI_SIMPLE_TEXT_INPUT_PROTOCOL and EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL. 1505 /// 1506 EFI_HANDLE ConsoleInHandle; 1507 /// 1508 /// A pointer to the EFI_SIMPLE_TEXT_INPUT_PROTOCOL interface that is 1509 /// associated with ConsoleInHandle. 1510 /// 1511 EFI_SIMPLE_TEXT_INPUT_PROTOCOL* ConIn; 1512 /// 1513 /// The handle for the active console output device. 1514 /// 1515 EFI_HANDLE ConsoleOutHandle; 1516 /// 1517 /// A pointer to the EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL interface 1518 /// that is associated with ConsoleOutHandle. 1519 /// 1520 EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL* ConOut; 1521 /// 1522 /// The handle for the active standard error console device. 1523 /// This handle must support the EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL. 1524 /// 1525 EFI_HANDLE StandardErrorHandle; 1526 /// 1527 /// A pointer to the EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL interface 1528 /// that is associated with StandardErrorHandle. 1529 /// 1530 EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL* StdErr; 1531 /// 1532 /// A pointer to the EFI Runtime Services Table. 1533 /// 1534 EFI_RUNTIME_SERVICES* RuntimeServices; 1535 /// 1536 /// A pointer to the EFI Boot Services Table. 1537 /// 1538 EFI_BOOT_SERVICES* BootServices; 1539 /// 1540 /// The number of system configuration tables in the buffer ConfigurationTable. 1541 /// 1542 UINTN NumberOfTableEntries; 1543 /// 1544 /// A pointer to the system configuration tables. 1545 /// The number of entries in the table is NumberOfTableEntries. 1546 /// 1547 EFI_CONFIGURATION_TABLE* ConfigurationTable; 1548 } 1549 /** 1550 This is the declaration of an EFI image entry point. This entry point is 1551 the same for UEFI Applications, UEFI OS Loaders, and UEFI Drivers including 1552 both device drivers and bus drivers. 1553 1554 @param[in] ImageHandle The firmware allocated handle for the UEFI image. 1555 @param[in] SystemTable A pointer to the EFI System Table. 1556 1557 @retval EFI_SUCCESS The operation completed successfully. 1558 @retval Others An unexpected error occurred. 1559 **/ 1560 alias EFI_IMAGE_ENTRY_POINT = EFI_STATUS function(EFI_HANDLE ImageHandle, 1561 EFI_SYSTEM_TABLE* SystemTable) @nogc nothrow; 1562 struct EFI_LOAD_OPTION 1563 { 1564 /// 1565 /// The attributes for this load option entry. All unused bits must be zero 1566 /// and are reserved by the UEFI specification for future growth. 1567 /// 1568 UINT32 Attributes; 1569 /// 1570 /// Length in bytes of the FilePathList. OptionalData starts at offset 1571 /// sizeof(UINT32) + sizeof(UINT16) + StrSize(Description) + FilePathListLength 1572 /// of the EFI_LOAD_OPTION descriptor. 1573 /// 1574 UINT16 FilePathListLength; 1575 /// 1576 /// The user readable description for the load option. 1577 /// This field ends with a Null character. 1578 /// 1579 // CHAR16 Description[]; 1580 /// 1581 /// A packed array of UEFI device paths. The first element of the array is a 1582 /// device path that describes the device and location of the Image for this 1583 /// load option. The FilePathList[0] is specific to the device type. Other 1584 /// device paths may optionally exist in the FilePathList, but their usage is 1585 /// OSV specific. Each element in the array is variable length, and ends at 1586 /// the device path end structure. Because the size of Description is 1587 /// arbitrary, this data structure is not guaranteed to be aligned on a 1588 /// natural boundary. This data structure may have to be copied to an aligned 1589 /// natural boundary before it is used. 1590 /// 1591 // EFI_DEVICE_PATH_PROTOCOL FilePathList[]; 1592 /// 1593 /// The remaining bytes in the load option descriptor are a binary data buffer 1594 /// that is passed to the loaded image. If the field is zero bytes long, a 1595 /// NULL pointer is passed to the loaded image. The number of bytes in 1596 /// OptionalData can be computed by subtracting the starting offset of 1597 /// OptionalData from total size in bytes of the EFI_LOAD_OPTION. 1598 /// 1599 // UINT8 OptionalData[]; 1600 } 1601 1602 enum LOAD_OPTION_ACTIVE = 0x00000001; 1603 enum LOAD_OPTION_FORCE_RECONNECT = 0x00000002; 1604 enum LOAD_OPTION_HIDDEN = 0x00000008; 1605 enum LOAD_OPTION_CATEGORY = 0x00001F00; 1606 enum LOAD_OPTION_CATEGORY_BOOT = 0x00000000; 1607 enum LOAD_OPTION_CATEGORY_APP = 0x00000100; 1608 enum EFI_BOOT_OPTION_SUPPORT_KEY = 0x00000001; 1609 enum EFI_BOOT_OPTION_SUPPORT_APP = 0x00000002; 1610 enum EFI_BOOT_OPTION_SUPPORT_SYSPREP = 0x00000010; 1611 enum EFI_BOOT_OPTION_SUPPORT_COUNT = 0x00000300; 1612 /// EFI Boot Key Data 1613 union EFI_BOOT_KEY_DATA 1614 { 1615 struct Options 1616 { 1617 /*/// 1618 /// Indicates the revision of the EFI_KEY_OPTION structure. This revision level should be 0. 1619 /// 1620 UINT32 Revision : 8; 1621 /// 1622 /// Either the left or right Shift keys must be pressed (1) or must not be pressed (0). 1623 /// 1624 UINT32 ShiftPressed : 1; 1625 /// 1626 /// Either the left or right Control keys must be pressed (1) or must not be pressed (0). 1627 /// 1628 UINT32 ControlPressed : 1; 1629 /// 1630 /// Either the left or right Alt keys must be pressed (1) or must not be pressed (0). 1631 /// 1632 UINT32 AltPressed : 1; 1633 /// 1634 /// Either the left or right Logo keys must be pressed (1) or must not be pressed (0). 1635 /// 1636 UINT32 LogoPressed : 1; 1637 /// 1638 /// The Menu key must be pressed (1) or must not be pressed (0). 1639 /// 1640 UINT32 MenuPressed : 1; 1641 /// 1642 /// The SysReq key must be pressed (1) or must not be pressed (0). 1643 /// 1644 UINT32 SysReqPressed : 1; 1645 UINT32 Reserved : 16; 1646 /// 1647 /// Specifies the actual number of entries in EFI_KEY_OPTION.Keys, from 0-3. If 1648 /// zero, then only the shift state is considered. If more than one, then the boot option will 1649 /// only be launched if all of the specified keys are pressed with the same shift state. 1650 /// 1651 UINT32 InputKeyCount : 2;*/ 1652 UINT32 Flags; 1653 } 1654 1655 UINT32 PackedValue; 1656 } 1657 /// EFI Key Option. 1658 struct EFI_KEY_OPTION 1659 { 1660 /// 1661 /// Specifies options about how the key will be processed. 1662 /// 1663 EFI_BOOT_KEY_DATA KeyData; 1664 /// 1665 /// The CRC-32 which should match the CRC-32 of the entire EFI_LOAD_OPTION to 1666 /// which BootOption refers. If the CRC-32s do not match this value, then this key 1667 /// option is ignored. 1668 /// 1669 UINT32 BootOptionCrc; 1670 /// 1671 /// The Boot#### option which will be invoked if this key is pressed and the boot option 1672 /// is active (LOAD_OPTION_ACTIVE is set). 1673 /// 1674 UINT16 BootOption; 1675 /// 1676 /// The key codes to compare against those returned by the 1677 /// EFI_SIMPLE_TEXT_INPUT and EFI_SIMPLE_TEXT_INPUT_EX protocols. 1678 /// The number of key codes (0-3) is specified by the EFI_KEY_CODE_COUNT field in KeyOptions. 1679 /// 1680 //EFI_INPUT_KEY Keys[]; 1681 } 1682 1683 enum EFI_REMOVABLE_MEDIA_FILE_NAME_IA32 = "\\EFI\\BOOT\\BOOTIA32.EFI"w; 1684 enum EFI_REMOVABLE_MEDIA_FILE_NAME_IA64 = "\\EFI\\BOOT\\BOOTIA64.EFI"w; 1685 enum EFI_REMOVABLE_MEDIA_FILE_NAME_X64 = "\\EFI\\BOOT\\BOOTX64.EFI"w; 1686 enum EFI_REMOVABLE_MEDIA_FILE_NAME_ARM = "\\EFI\\BOOT\\BOOTARM.EFI"w; 1687 enum EFI_REMOVABLE_MEDIA_FILE_NAME_AARCH64 = "\\EFI\\BOOT\\BOOTAA64.EFI"w; 1688 // FIXME: INCLUDE <Uefi/UefiPxe.h> 1689 // FIXME: INCLUDE <Uefi/UefiGpt.h> 1690 // FIXME: INCLUDE <Uefi/UefiInternalFormRepresentation.h>