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