Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

UefiSpec.h 79KB

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