You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

UefiSpec.h 71KB

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