spec.h 80 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228
  1. /*++
  2. Copyright (c) 2014 Minoca Corp. All Rights Reserved
  3. Module Name:
  4. spec.h
  5. Abstract:
  6. This header contains the primary UEFI specification definitions. Protocol
  7. definitions are defined elsewhere.
  8. Author:
  9. Evan Green 7-Feb-2014
  10. --*/
  11. //
  12. // ------------------------------------------------------------------- Includes
  13. //
  14. #include <minoca/uefi/protocol/devpath.h>
  15. #include <minoca/uefi/protocol/stextin.h>
  16. #include <minoca/uefi/protocol/stextinx.h>
  17. #include <minoca/uefi/protocol/stextout.h>
  18. //
  19. // ---------------------------------------------------------------- Definitions
  20. //
  21. //
  22. // Define EFI variable attributes.
  23. //
  24. #define EFI_VARIABLE_NON_VOLATILE 0x00000001
  25. #define EFI_VARIABLE_BOOTSERVICE_ACCESS 0x00000002
  26. #define EFI_VARIABLE_RUNTIME_ACCESS 0x00000004
  27. //
  28. // Define the attribute for a hardware error record. This attribute is
  29. // identified by the mnemonic 'HR' elsewhere in the specification.
  30. //
  31. #define EFI_VARIABLE_HARDWARE_ERROR_RECORD 0x00000008
  32. //
  33. // Define attributes of the Authenticated Variable.
  34. //
  35. #define EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS 0x00000010
  36. #define EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS 0x00000020
  37. #define EFI_VARIABLE_APPEND_WRITE 0x00000040
  38. //
  39. // Define flags for the daylight saving member of the EFI_TIME structure.
  40. //
  41. #define EFI_TIME_ADJUST_DAYLIGHT 0x01
  42. #define EFI_TIME_IN_DAYLIGHT 0x02
  43. //
  44. // Define the unspecified timezone value used in the time zone member of the
  45. // EFI_TIME structure.
  46. //
  47. #define EFI_UNSPECIFIED_TIMEZONE 0x07FF
  48. //
  49. // Define memory cacheability attributes.
  50. //
  51. #define EFI_MEMORY_UC 0x0000000000000001ULL
  52. #define EFI_MEMORY_WC 0x0000000000000002ULL
  53. #define EFI_MEMORY_WT 0x0000000000000004ULL
  54. #define EFI_MEMORY_WB 0x0000000000000008ULL
  55. #define EFI_MEMORY_UCE 0x0000000000000010ULL
  56. //
  57. // Define physical memory protection attributes.
  58. //
  59. #define EFI_MEMORY_WP 0x0000000000001000ULL
  60. #define EFI_MEMORY_RP 0x0000000000002000ULL
  61. #define EFI_MEMORY_XP 0x0000000000004000ULL
  62. //
  63. // Define runtime memory attributes.
  64. //
  65. #define EFI_MEMORY_RUNTIME 0x8000000000000000ULL
  66. //
  67. // Define memory descriptor version number.
  68. //
  69. #define EFI_MEMORY_DESCRIPTOR_VERSION 1
  70. //
  71. // Define the DebugDisposition values for the ConvertPointer service.
  72. //
  73. #define EFI_OPTIONAL_PTR 0x00000001
  74. //
  75. // Define flags for events.
  76. //
  77. #define EVT_TIMER 0x80000000
  78. #define EVT_RUNTIME 0x40000000
  79. #define EVT_NOTIFY_WAIT 0x00000100
  80. #define EVT_NOTIFY_SIGNAL 0x00000200
  81. #define EVT_SIGNAL_EXIT_BOOT_SERVICES 0x00000201
  82. #define EVT_SIGNAL_VIRTUAL_ADDRESS_CHANGE 0x60000202
  83. //
  84. // This flag is set if the notify context pointer is a runtime memory address.
  85. // This event is deprecated in UEFI2.0 and later specifications.
  86. //
  87. #define EVT_RUNTIME_CONTEXT 0x20000000
  88. //
  89. // Define task priority levels.
  90. //
  91. #define TPL_APPLICATION 4
  92. #define TPL_CALLBACK 8
  93. #define TPL_NOTIFY 16
  94. #define TPL_HIGH_LEVEL 31
  95. //
  96. // Define flags to the open protocol function.
  97. //
  98. #define EFI_OPEN_PROTOCOL_BY_HANDLE_PROTOCOL 0x00000001
  99. #define EFI_OPEN_PROTOCOL_GET_PROTOCOL 0x00000002
  100. #define EFI_OPEN_PROTOCOL_TEST_PROTOCOL 0x00000004
  101. #define EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER 0x00000008
  102. #define EFI_OPEN_PROTOCOL_BY_DRIVER 0x00000010
  103. #define EFI_OPEN_PROTOCOL_EXCLUSIVE 0x00000020
  104. //
  105. // Define update capsule flags.
  106. //
  107. #define CAPSULE_FLAGS_PERSIST_ACROSS_RESET 0x00010000
  108. #define CAPSULE_FLAGS_POPULATE_SYSTEM_TABLE 0x00020000
  109. #define CAPSULE_FLAGS_INITIATE_RESET 0x00040000
  110. //
  111. // Define OS indications for update capsules.
  112. //
  113. #define EFI_OS_INDICATIONS_BOOT_TO_FW_UI 0x0000000000000001
  114. #define EFI_OS_INDICATIONS_TIMESTAMP_REVOCATION 0x0000000000000002
  115. #define EFI_OS_INDICATIONS_FILE_CAPSULE_DELIVERY_SUPPORTED 0x0000000000000004
  116. #define EFI_OS_INDICATIONS_FMP_CAPSULE_SUPPORTED 0x0000000000000008
  117. #define EFI_OS_INDICATIONS_CAPSULE_RESULT_VAR_SUPPORTED 0x0000000000000010
  118. //
  119. // Definitions used in the EFI Runtime Services Table
  120. //
  121. #define EFI_SYSTEM_TABLE_SIGNATURE 0x5453595320494249ULL
  122. #define EFI_2_40_SYSTEM_TABLE_REVISION ((2 << 16) | (40))
  123. #define EFI_2_31_SYSTEM_TABLE_REVISION ((2 << 16) | (31))
  124. #define EFI_2_30_SYSTEM_TABLE_REVISION ((2 << 16) | (30))
  125. #define EFI_2_20_SYSTEM_TABLE_REVISION ((2 << 16) | (20))
  126. #define EFI_2_10_SYSTEM_TABLE_REVISION ((2 << 16) | (10))
  127. #define EFI_2_00_SYSTEM_TABLE_REVISION ((2 << 16) | (00))
  128. #define EFI_1_10_SYSTEM_TABLE_REVISION ((1 << 16) | (10))
  129. #define EFI_1_02_SYSTEM_TABLE_REVISION ((1 << 16) | (02))
  130. #define EFI_SYSTEM_TABLE_REVISION EFI_2_40_SYSTEM_TABLE_REVISION
  131. #define EFI_SPECIFICATION_VERSION EFI_SYSTEM_TABLE_REVISION
  132. #define EFI_RUNTIME_SERVICES_SIGNATURE 0x56524553544E5552ULL
  133. #define EFI_RUNTIME_SERVICES_REVISION EFI_SPECIFICATION_VERSION
  134. //
  135. // Definitions used in the EFI Boot Services Table
  136. //
  137. #define EFI_BOOT_SERVICES_SIGNATURE 0x56524553544F4F42ULL
  138. #define EFI_BOOT_SERVICES_REVISION EFI_SPECIFICATION_VERSION
  139. //
  140. // Define EFI Load Options Attributes.
  141. //
  142. #define LOAD_OPTION_ACTIVE 0x00000001
  143. #define LOAD_OPTION_FORCE_RECONNECT 0x00000002
  144. #define LOAD_OPTION_HIDDEN 0x00000008
  145. #define LOAD_OPTION_CATEGORY 0x00001F00
  146. #define LOAD_OPTION_CATEGORY_BOOT 0x00000000
  147. #define LOAD_OPTION_CATEGORY_APP 0x00000100
  148. #define EFI_BOOT_OPTION_SUPPORT_KEY 0x00000001
  149. #define EFI_BOOT_OPTION_SUPPORT_APP 0x00000002
  150. #define EFI_BOOT_OPTION_SUPPORT_COUNT 0x00000300
  151. //
  152. // Define EFI File location to boot from on removable media devices.
  153. //
  154. #define EFI_REMOVABLE_MEDIA_FILE_NAME_IA32 L"\\EFI\\BOOT\\BOOTIA32.EFI"
  155. #define EFI_REMOVABLE_MEDIA_FILE_NAME_IA64 L"\\EFI\\BOOT\\BOOTIA64.EFI"
  156. #define EFI_REMOVABLE_MEDIA_FILE_NAME_X64 L"\\EFI\\BOOT\\BOOTX64.EFI"
  157. #define EFI_REMOVABLE_MEDIA_FILE_NAME_ARM L"\\EFI\\BOOT\\BOOTARM.EFI"
  158. #define EFI_REMOVABLE_MEDIA_FILE_NAME_AARCH64 L"\\EFI\\BOOT\\BOOTAA64.EFI"
  159. #if defined (EFI_X86)
  160. #define EFI_REMOVABLE_MEDIA_FILE_NAME EFI_REMOVABLE_MEDIA_FILE_NAME_IA32
  161. #elif defined (EFI_X64)
  162. #define EFI_REMOVABLE_MEDIA_FILE_NAME EFI_REMOVABLE_MEDIA_FILE_NAME_X64
  163. #elif defined (EFI_ARM)
  164. #define EFI_REMOVABLE_MEDIA_FILE_NAME EFI_REMOVABLE_MEDIA_FILE_NAME_ARM
  165. #elif defined (EFI_AARCH64)
  166. #define EFI_REMOVABLE_MEDIA_FILE_NAME EFI_REMOVABLE_MEDIA_FILE_NAME_AARCH64
  167. #else
  168. #error Unknown Processor Type
  169. #endif
  170. //
  171. // ------------------------------------------------------ Data Type Definitions
  172. //
  173. /*++
  174. Enumeration Description:
  175. This enumeration describes the memory types introduced in UEFI.
  176. Values:
  177. EfiReservedMemoryType - Indicates a reserved type that is not used.
  178. EfiLoaderCode - Indicates code portions of a loaded application. OS Loaders
  179. are UEFI applications.
  180. EfiLoaderData - Indicates data portions of a loaded application and the
  181. default allocation type used by an application to allocate pool memory.
  182. EfiBootServicesCode - Indicates the code portions of a loaded Boot Services
  183. Driver.
  184. EfiBootServicesData - Indicates the data portions of a loaded Boot Services
  185. Driver, and the default data allocation type used by a Boot Services
  186. Driver to allocate pool memory.
  187. EfiRuntimeServicesCode - Indicates the code portions of a loaded Runtime
  188. Services Driver.
  189. EfiRuntimeServicesData - Indicates the data portions of a loaded Runtime
  190. Services Driver and the default data allocation type used by a Runtime
  191. Services Driver to allocate pool memory.
  192. EfiConventionalMemory - Indicates free unallocated memory.
  193. EfiUnusableMemory - Indicates memory in which errors have been detected.
  194. EfiACPIReclaimMemory - Indicates memory that holds ACPI tables.
  195. EfiACPIMemoryNVS - Indicates address space reserved for use by the
  196. firmware.
  197. EfiMemoryMappedIO - Indicates a region used by system firmware to request
  198. that a memory-mapped I/O region be mapped by the OS to a virtual
  199. address so it can be accessed by EFI runtime services.
  200. EfiMemoryMappedIOPortSpace - Indicates a system memory-mapped I/O region
  201. that is used to translate memory cycles to I/O cycles by the processor.
  202. EfiPalCode - Indicates address space reserved by the firmware for code that
  203. is part of the processor.
  204. EfiMaxMemoryType - Indicates a type used to indicate the boundary of valid
  205. values.
  206. --*/
  207. typedef enum {
  208. EfiReservedMemoryType,
  209. EfiLoaderCode,
  210. EfiLoaderData,
  211. EfiBootServicesCode,
  212. EfiBootServicesData,
  213. EfiRuntimeServicesCode,
  214. EfiRuntimeServicesData,
  215. EfiConventionalMemory,
  216. EfiUnusableMemory,
  217. EfiACPIReclaimMemory,
  218. EfiACPIMemoryNVS,
  219. EfiMemoryMappedIO,
  220. EfiMemoryMappedIOPortSpace,
  221. EfiPalCode,
  222. EfiMaxMemoryType
  223. } EFI_MEMORY_TYPE;
  224. /*++
  225. Enumeration Description:
  226. This enumeration describes the allocation strategies that can be employed
  227. when allocating pages from UEFI.
  228. Values:
  229. AllocateAnyPages - Indicates to use any available pages that satisfy the
  230. request.
  231. AllocateMaxAddress - Indicates to allocate any range of pages whose
  232. uppermost address is less than or equal to the specified maximum
  233. address.
  234. AllocateAddress - Indicates to allocate pages at a specified address.
  235. MaxAllocateType - Indicates the maximum enumeration value, used only for
  236. bounds checking.
  237. --*/
  238. typedef enum {
  239. AllocateAnyPages,
  240. AllocateMaxAddress,
  241. AllocateAddress,
  242. MaxAllocateType
  243. } EFI_ALLOCATE_TYPE;
  244. /*++
  245. Enumeration Description:
  246. This enumeration describes timer delay types.
  247. Values:
  248. TimerCancel - Indicates an event should be cancelled.
  249. TimerPeriodic - Indicates the event is to be signaled periodically at a
  250. specified interval from the current time.
  251. TimerRelative - Indicates the event is to be singaled once at a specified
  252. interval from the current time.
  253. --*/
  254. typedef enum {
  255. TimerCancel,
  256. TimerPeriodic,
  257. TimerRelative
  258. } EFI_TIMER_DELAY;
  259. /*++
  260. Enumeration Description:
  261. This enumeration describes system reset types.
  262. Values:
  263. EfiResetCold - Indicates a system-wide reset. This sets all circuitry
  264. within the system to its initial state. This type of reset is
  265. asynchronous to system operation and operates without regard to cycle
  266. boundaries.
  267. EfiResetWarm - Indicates a system-wide initialization. The processors are
  268. set to their initial state, and pending cycles are not corrupted. If
  269. the system does not support this type, then a cold reset must be
  270. performed.
  271. EfiResetShutdown - Indicates entry into a power state equivalent to the
  272. ACPI G2/S5 or G3 state. If the system does not support this reset type,
  273. then when the system is rebooted, it should exhibit the cold reset
  274. attributes.
  275. EfiResetPlatformSpecific - Indicates a system-wide reset. The exact type of
  276. of reset is defined by the EFI_GUID that follows the null-terminated
  277. unicode string passed into the reset data. If a platform does not
  278. recognize the GUID in the reset data the platform must pick a supported
  279. reset type to perform. The platform may optionally log the parameters
  280. from any non-normal reset that occurs.
  281. --*/
  282. typedef enum {
  283. EfiResetCold,
  284. EfiResetWarm,
  285. EfiResetShutdown,
  286. EfiResetPlatformSpecific
  287. } EFI_RESET_TYPE;
  288. /*++
  289. Enumeration Description:
  290. This enumeration describes EFI interface types.
  291. Values:
  292. EFI_INTERFACE_NATIVE - Indicates the supplied protocol interface is
  293. supplied in native form.
  294. --*/
  295. typedef enum {
  296. EFI_NATIVE_INTERFACE
  297. } EFI_INTERFACE_TYPE;
  298. /*++
  299. Enumeration Description:
  300. This enumeration describes the EFI locate search types.
  301. Values:
  302. AllHandles - Indicates to retrieve all handles in the handle database.
  303. ByRegisterNotify - Indicates to retrieve the next handle from a
  304. RegisterProtocolNotify event.
  305. ByProtocol - Indicates to retrieve the set of handles that support a
  306. specified protocol.
  307. --*/
  308. typedef enum {
  309. AllHandles,
  310. ByRegisterNotify,
  311. ByProtocol
  312. } EFI_LOCATE_SEARCH_TYPE;
  313. /*++
  314. Structure Description:
  315. This structure describes the standard header that precedes all EFI tables.
  316. Members:
  317. Signature - Stores a 64-bit signature that identifies the type of table
  318. that follows.
  319. Revision - Stores the revision of the EFI specification to which this table
  320. conforms. The upper 16 bits contain the major revision, and the lower
  321. 16 bits contain the minor revision value. The minor revision values
  322. are limited to the range of 0 to 99, inclusive.
  323. HeaderSize - Stores the size, in bytes, of the entire table, including this
  324. header structure.
  325. CRC32 - Stores the 32-bit CRC for the entire table (whose length is defined
  326. in the header size field). This field is set to 0 during computation.
  327. Reserved - Stores a reserved field that must be set to zero.
  328. --*/
  329. typedef struct {
  330. UINT64 Signature;
  331. UINT32 Revision;
  332. UINT32 HeaderSize;
  333. UINT32 CRC32;
  334. UINT32 Reserved;
  335. } EFI_TABLE_HEADER;
  336. /*++
  337. Structure Description:
  338. This structure defines an EFI memory descriptor.
  339. Members:
  340. Type - Stores the type of memory. See the EFI_MEMORY_TYPE enum.
  341. Padding - Stores some padding to make the next member 8-byte aligned.
  342. PhysicalStart - Stores the physical address of the first byte of the memory
  343. region. This must be aligned on an EFI_PAGE_SIZE boundary.
  344. VirtualStart - Stores the virtual address of the first byte of the memory
  345. region. This must be aligned on an EFI_PAGE_SIZE boundary.
  346. NumberOfPages - Stores the number of pages described by the descriptor.
  347. Attribute - Stores a bitfield of memory attributes for that memory region.
  348. This is not necessarily the current settings for that region.
  349. --*/
  350. typedef struct {
  351. UINT32 Type;
  352. UINT32 Padding;
  353. EFI_PHYSICAL_ADDRESS PhysicalStart;
  354. EFI_VIRTUAL_ADDRESS VirtualStart;
  355. UINT64 NumberOfPages;
  356. UINT64 Attribute;
  357. } EFI_MEMORY_DESCRIPTOR;
  358. /*++
  359. Structure Description:
  360. This structure describes the capabilities of the real time clock device
  361. backing the get/set time services.
  362. Members:
  363. Resolution - Stores the reporting resolution of the real-time clock device
  364. in ticks per second. For a PC-AT CMOS RTC device, this value would be
  365. 1 Hz to indicate that the device reports timing to the nearest second.
  366. Accuracy - Stores the timekeeping accuracy of the real-time clock in an
  367. error rate of 1E-6 parts per million. For a clock with an accuracy of
  368. 50 parts per million, the value in this field would be 50 million.
  369. SetsToZero - Stores a boolean indicating that a time set operation clears
  370. the device's time below the reported resolution. If FALSE, the state
  371. below the reported resolution is not cleared when the time is set.
  372. PC-AT CMOS RTC devices set this value to FALSE.
  373. --*/
  374. typedef struct {
  375. UINT32 Resolution;
  376. UINT32 Accuracy;
  377. BOOLEAN SetsToZero;
  378. } EFI_TIME_CAPABILITIES;
  379. /*++
  380. Structure Description:
  381. This structure describes information about an open handle.
  382. Members:
  383. AgentHandle - Stores the handle of the agent that opened the handle.
  384. ControllerHandle - Stores the controller handle associated with the
  385. protocol.
  386. Attributes - Stores the attributes the handle was opened with.
  387. OpenCount - Stores the count of outstanding opens on these attributes.
  388. --*/
  389. typedef struct {
  390. EFI_HANDLE AgentHandle;
  391. EFI_HANDLE ControllerHandle;
  392. UINT32 Attributes;
  393. UINT32 OpenCount;
  394. } EFI_OPEN_PROTOCOL_INFORMATION_ENTRY;
  395. /*++
  396. Structure Description:
  397. This structure describes an EFI capsule block descriptor.
  398. Members:
  399. Length - Stores the length in bytes of the data pointed to by the
  400. data block or continuation pointer.
  401. DataBlock - Stores the physical address of the data block. This is used if
  402. the length is not zero.
  403. ContinuationPointer - Stores the physical address of another capsule block
  404. descriptor. This is used if the length is equal to zero. If this
  405. pointer is zero then this represents the end of the list.
  406. --*/
  407. typedef struct {
  408. UINT64 Length;
  409. union {
  410. EFI_PHYSICAL_ADDRESS DataBlock;
  411. EFI_PHYSICAL_ADDRESS ContinuationPointer;
  412. } Union;
  413. } EFI_CAPSULE_BLOCK_DESCRIPTOR;
  414. /*++
  415. Structure Description:
  416. This structure describes an EFI capsule header.
  417. Members:
  418. CapsuleGuid - Stores the GUID that defines the contents of the capsule.
  419. HeaderSize - Stores the size of the header, which can be bigger than the
  420. size of this structure if there are extended header entries.
  421. Flags - Stores a bitfield of flags describing the capsule attributes. The
  422. flag values 0x0000 - 0xFFFF are defined by the capsule GUID. Flag
  423. values of 0x10000 - 0xFFFFFFFF are defined by this specification.
  424. CapsuleImageSize - Stores the size in bytes of the capsule.
  425. --*/
  426. typedef struct {
  427. EFI_GUID CapsuleGuid;
  428. UINT32 HeaderSize;
  429. UINT32 Flags;
  430. UINT32 CapsuleImageSize;
  431. } EFI_CAPSULE_HEADER;
  432. /*++
  433. Structure Description:
  434. This structure an EFI capsule table. The EFI System Table entry must point
  435. to an array of capsules that contain the same capsule GUID value. The array
  436. must be prefixed by a UINT32 that represents the size of the array of
  437. capsules.
  438. Members:
  439. CapsuleArrayNumber - Stores the size of the array of capsules.
  440. CapsulePtr - Stores an array of capsules that contain the same capsule
  441. GUID value.
  442. --*/
  443. typedef struct {
  444. UINT32 CapsuleArrayNumber;
  445. VOID* CapsulePtr[1];
  446. } EFI_CAPSULE_TABLE;
  447. typedef
  448. EFI_STATUS
  449. (EFIAPI *EFI_ALLOCATE_PAGES) (
  450. EFI_ALLOCATE_TYPE Type,
  451. EFI_MEMORY_TYPE MemoryType,
  452. UINTN Pages,
  453. EFI_PHYSICAL_ADDRESS *Memory
  454. );
  455. /*++
  456. Routine Description:
  457. This routine allocates memory pages from the system.
  458. Arguments:
  459. Type - Supplies the allocation strategy to use.
  460. MemoryType - Supplies the memory type of the allocation.
  461. Pages - Supplies the number of contiguous EFI_PAGE_SIZE pages.
  462. Memory - Supplies a pointer that on input contains a physical address whose
  463. use depends on the allocation strategy. On output, the physical address
  464. of the allocation will be returned.
  465. Return Value:
  466. EFI_SUCCESS on success.
  467. EFI_INVALID_PARAMETER if the Type or MemoryType are invalid, or Memory is
  468. NULL.
  469. EFI_OUT_OF_RESOURCES if the pages could not be allocated.
  470. EFI_NOT_FOUND if the requested pages could not be found.
  471. --*/
  472. typedef
  473. EFI_STATUS
  474. (EFIAPI *EFI_FREE_PAGES) (
  475. EFI_PHYSICAL_ADDRESS Memory,
  476. UINTN Pages
  477. );
  478. /*++
  479. Routine Description:
  480. This routine frees memory pages back to the system.
  481. Arguments:
  482. Memory - Supplies the base physical address of the allocation to free.
  483. Pages - Supplies the number of pages to free.
  484. Return Value:
  485. EFI_SUCCESS on success.
  486. EFI_INVALID_PARAMETER if the memory is not page aligned or is invalid.
  487. EFI_NOT_FOUND if the requested pages were not allocated.
  488. --*/
  489. typedef
  490. EFI_STATUS
  491. (EFIAPI *EFI_GET_MEMORY_MAP) (
  492. UINTN *MemoryMapSize,
  493. EFI_MEMORY_DESCRIPTOR *MemoryMap,
  494. UINTN *MapKey,
  495. UINTN *DescriptorSize,
  496. UINT32 *DescriptorVersion
  497. );
  498. /*++
  499. Routine Description:
  500. This routine returns the current memory map.
  501. Arguments:
  502. MemoryMapSize - Supplies a pointer to the size, in bytes, of the memory
  503. map buffer. On input, this is the size of the buffer allocated by the
  504. caller. On output, this is the size of the buffer returned by the
  505. firmware if the buffer was large enough, or the size of the buffer
  506. needed if the buffer was too small.
  507. MemoryMap - Supplies a pointer to a caller-allocated buffer where the
  508. memory map will be written on success.
  509. MapKey - Supplies a pointer where the firmware returns the map key.
  510. DescriptorSize - Supplies a pointer where the firmware returns the size of
  511. the EFI_MEMORY_DESCRIPTOR structure.
  512. DescriptorVersion - Supplies a pointer where the firmware returns the
  513. version number associated with the EFI_MEMORY_DESCRIPTOR structure.
  514. Return Value:
  515. EFI_SUCCESS on success.
  516. EFI_BUFFER_TOO_SMALL if the supplied buffer was too small. The size needed
  517. is returned in the size parameter.
  518. EFI_INVALID_PARAMETER if the supplied size or memory map pointers are NULL.
  519. --*/
  520. typedef
  521. EFI_STATUS
  522. (EFIAPI *EFI_ALLOCATE_POOL) (
  523. EFI_MEMORY_TYPE PoolType,
  524. UINTN Size,
  525. VOID **Buffer
  526. );
  527. /*++
  528. Routine Description:
  529. This routine allocates memory from the heap.
  530. Arguments:
  531. PoolType - Supplies the type of pool to allocate.
  532. Size - Supplies the number of bytes to allocate from the pool.
  533. Buffer - Supplies a pointer where a pointer to the allocated buffer will
  534. be returned on success.
  535. Return Value:
  536. EFI_SUCCESS on success.
  537. EFI_OUT_OF_RESOURCES if memory could not be allocated.
  538. EFI_INVALID_PARAMETER if the pool type was invalid or the buffer is NULL.
  539. --*/
  540. typedef
  541. EFI_STATUS
  542. (EFIAPI *EFI_FREE_POOL) (
  543. VOID *Buffer
  544. );
  545. /*++
  546. Routine Description:
  547. This routine frees heap allocated memory.
  548. Arguments:
  549. Buffer - Supplies a pointer to the buffer to free.
  550. Return Value:
  551. EFI_SUCCESS on success.
  552. EFI_INVALID_PARAMETER if the buffer was invalid.
  553. --*/
  554. typedef
  555. EFI_STATUS
  556. (EFIAPI *EFI_SET_VIRTUAL_ADDRESS_MAP) (
  557. UINTN MemoryMapSize,
  558. UINTN DescriptorSize,
  559. UINT32 DescriptorVersion,
  560. EFI_MEMORY_DESCRIPTOR *VirtualMap
  561. );
  562. /*++
  563. Routine Description:
  564. This routine changes the runtime addressing mode of EFI firmware from
  565. physical to virtual.
  566. Arguments:
  567. MemoryMapSize - Supplies the size of the virtual map.
  568. DescriptorSize - Supplies the size of an entry in the virtual map.
  569. DescriptorVersion - Supplies the version of the structure entries in the
  570. virtual map.
  571. VirtualMap - Supplies the array of memory descriptors which contain the
  572. new virtual address mappings for all runtime ranges.
  573. Return Value:
  574. EFI_SUCCESS on success.
  575. EFI_UNSUPPORTED if the firmware is not at runtime, or the firmware is
  576. already in virtual address mapped mode.
  577. EFI_INVALID_PARAMETER if the descriptor size or version is invalid.
  578. EFI_NO_MAPPING if the virtual address was not supplied for a range in the
  579. memory map that requires a mapping.
  580. EFI_NOT_FOUND if a virtual address was supplied for an address that is not
  581. found in the memory map.
  582. --*/
  583. typedef
  584. EFI_STATUS
  585. (EFIAPI *EFI_CONNECT_CONTROLLER) (
  586. EFI_HANDLE ControllerHandle,
  587. EFI_HANDLE *DriverImageHandle,
  588. EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath,
  589. BOOLEAN Recursive
  590. );
  591. /*++
  592. Routine Description:
  593. This routine connects one or more drivers to a controller.
  594. Arguments:
  595. ControllerHandle - Supplies the handle of the controller which driver(s)
  596. are connecting to.
  597. DriverImageHandle - Supplies a pointer to an ordered list of handles that
  598. support the EFI_DRIVER_BINDING_PROTOCOL.
  599. RemainingDevicePath - Supplies an optional pointer to the device path that
  600. specifies a child of the controller specified by the controller handle.
  601. Recursive - Supplies a boolean indicating if this routine should be called
  602. recursively until the entire tree of controllers below the specified
  603. controller has been connected. If FALSE, then the tree of controllers
  604. is only expanded one level.
  605. Return Value:
  606. EFI_SUCCESS on success.
  607. EFI_INVALID_PARAMETER if the controller handle is NULL.
  608. EFI_NOT_FOUND if either there are no EFI_DRIVER_BINDING_PROTOCOL instances
  609. present in the system, or no drivers were connected to the controller
  610. handle.
  611. EFI_SECURITY_VIOLATION if the user has no permission to start UEFI device
  612. drivers on the device associated with the controller handle or specified
  613. by the remaining device path.
  614. --*/
  615. typedef
  616. EFI_STATUS
  617. (EFIAPI *EFI_DISCONNECT_CONTROLLER) (
  618. EFI_HANDLE ControllerHandle,
  619. EFI_HANDLE DriverImageHandle,
  620. EFI_HANDLE ChildHandle
  621. );
  622. /*++
  623. Routine Description:
  624. This routine disconnects one or more drivers to a controller.
  625. Arguments:
  626. ControllerHandle - Supplies the handle of the controller which driver(s)
  627. are disconnecting from.
  628. DriverImageHandle - Supplies an optional pointer to the driver to
  629. disconnect from the controller. If NULL, all drivers are disconnected.
  630. ChildHandle - Supplies an optional pointer to the handle of the child to
  631. destroy.
  632. Return Value:
  633. EFI_SUCCESS if one or more drivers were disconnected, no drivers are
  634. managing the handle, or a driver image handle was supplied and it is not
  635. controlling the given handle.
  636. EFI_INVALID_PARAMETER if the controller handle or driver handle is not a
  637. valid EFI handle, or the driver image handle doesn't support the
  638. EFI_DRIVER_BINDING_PROTOCOL.
  639. EFI_OUT_OF_RESOURCES if there are not enough resources are available to
  640. disconnect the controller(s).
  641. EFI_DEVICE_ERROR if the controller could not be disconnected because of a
  642. device error.
  643. --*/
  644. typedef
  645. EFI_STATUS
  646. (EFIAPI *EFI_CONVERT_POINTER) (
  647. UINTN DebugDisposition,
  648. VOID **Address
  649. );
  650. /*++
  651. Routine Description:
  652. This routine determines the new virtual address that is to be used on
  653. subsequent memory accesses.
  654. Arguments:
  655. DebugDisposition - Supplies type information for the pointer being
  656. converted.
  657. Address - Supplies a pointer to a pointer that is to be fixed to be the
  658. value needed for the new virtual address mappings being applied.
  659. Return Value:
  660. EFI_SUCCESS if the pointer was modified.
  661. EFI_INVALID_PARAMETER if the address is NULL or the value of Address is
  662. NULL and the debug disposition does not have the EFI_OPTIONAL_PTR bit set.
  663. EFI_NOT_FOUND if the pointer pointed to by the address parameter was not
  664. found to be part of the current memory map. This is normally fatal.
  665. --*/
  666. typedef
  667. VOID
  668. (EFIAPI *EFI_EVENT_NOTIFY) (
  669. EFI_EVENT Event,
  670. VOID *Context
  671. );
  672. /*++
  673. Routine Description:
  674. This routine invokes a notification event.
  675. Arguments:
  676. Event - Supplies a pointer to the event to invoke.
  677. Context - Supplies a pointer to the notification function's context.
  678. Return Value:
  679. None.
  680. --*/
  681. typedef
  682. EFI_STATUS
  683. (EFIAPI *EFI_CREATE_EVENT) (
  684. UINT32 Type,
  685. EFI_TPL NotifyTpl,
  686. EFI_EVENT_NOTIFY NotifyFunction,
  687. VOID *NotifyContext,
  688. EFI_EVENT *Event
  689. );
  690. /*++
  691. Routine Description:
  692. This routine creates an event.
  693. Arguments:
  694. Type - Supplies the type of event to create, as well as its mode and
  695. attributes.
  696. NotifyTpl - Supplies an optional task priority level of event notifications.
  697. NotifyFunction - Supplies an optional pointer to the event's notification
  698. function.
  699. NotifyContext - Supplies an optional context pointer that will be passed
  700. to the notify function when the event is signaled.
  701. Event - Supplies a pointer where the new event will be returned on success.
  702. Return Value:
  703. EFI_SUCCESS on success.
  704. EFI_INVALID_PARAMETER if one or more parameters are not valid.
  705. EFI_OUT_OF_RESOURCES if memory could not be allocated.
  706. --*/
  707. typedef
  708. EFI_STATUS
  709. (EFIAPI *EFI_CREATE_EVENT_EX) (
  710. UINT32 Type,
  711. EFI_TPL NotifyTpl,
  712. EFI_EVENT_NOTIFY NotifyFunction,
  713. VOID *NotifyContext,
  714. EFI_GUID *EventGroup,
  715. EFI_EVENT *Event
  716. );
  717. /*++
  718. Routine Description:
  719. This routine creates an event.
  720. Arguments:
  721. Type - Supplies the type of event to create, as well as its mode and
  722. attributes.
  723. NotifyTpl - Supplies an optional task priority level of event notifications.
  724. NotifyFunction - Supplies an optional pointer to the event's notification
  725. function.
  726. NotifyContext - Supplies an optional context pointer that will be passed
  727. to the notify function when the event is signaled.
  728. EventGroup - Supplies an optional pointer to the unique identifier of the
  729. group to which this event belongs. If this is NULL, the function
  730. behaves as if the parameters were passed to the original create event
  731. function.
  732. Event - Supplies a pointer where the new event will be returned on success.
  733. Return Value:
  734. EFI_SUCCESS on success.
  735. EFI_INVALID_PARAMETER if one or more parameters are not valid.
  736. EFI_OUT_OF_RESOURCES if memory could not be allocated.
  737. --*/
  738. typedef
  739. EFI_STATUS
  740. (EFIAPI *EFI_SET_TIMER) (
  741. EFI_EVENT Event,
  742. EFI_TIMER_DELAY Type,
  743. UINT64 TriggerTime
  744. );
  745. /*++
  746. Routine Description:
  747. This routine sets the type of timer and trigger time for a timer event.
  748. Arguments:
  749. Event - Supplies the timer to set.
  750. Type - Supplies the type of trigger to set.
  751. TriggerTime - Supplies the number of 100ns units until the timer expires.
  752. Zero is legal, and means the timer will be signaled on the next timer
  753. tick.
  754. Return Value:
  755. EFI_SUCCESS on success.
  756. EFI_INVALID_PARAMETER if the event or type is not valid.
  757. --*/
  758. typedef
  759. EFI_STATUS
  760. (EFIAPI *EFI_SIGNAL_EVENT) (
  761. EFI_EVENT Event
  762. );
  763. /*++
  764. Routine Description:
  765. This routine signals an event.
  766. Arguments:
  767. Event - Supplies the event to signal.
  768. Return Value:
  769. EFI_SUCCESS on success.
  770. EFI_INVALID_PARAMETER if the given event is not valid.
  771. --*/
  772. typedef
  773. EFI_STATUS
  774. (EFIAPI *EFI_WAIT_FOR_EVENT) (
  775. UINTN NumberOfEvents,
  776. EFI_EVENT *Event,
  777. UINTN *Index
  778. );
  779. /*++
  780. Routine Description:
  781. This routine stops execution until an event is signaled.
  782. Arguments:
  783. NumberOfEvents - Supplies the number of events in the event array.
  784. Event - Supplies the array of EFI_EVENTs.
  785. Index - Supplies a pointer where the index of the event which satisfied the
  786. wait will be returned.
  787. Return Value:
  788. EFI_SUCCESS on success.
  789. EFI_INVALID_PARAMETER if the number of events is zero, or the event
  790. indicated by the index return parameter is of type EVT_NOTIFY_SIGNAL.
  791. EFI_UNSUPPORTED if the current TPL is not TPL_APPLICATION.
  792. --*/
  793. typedef
  794. EFI_STATUS
  795. (EFIAPI *EFI_CLOSE_EVENT) (
  796. EFI_EVENT Event
  797. );
  798. /*++
  799. Routine Description:
  800. This routine closes an event.
  801. Arguments:
  802. Event - Supplies the event to close.
  803. Return Value:
  804. EFI_SUCCESS on success.
  805. EFI_INVALID_PARAMETER if the given event is invalid.
  806. --*/
  807. typedef
  808. EFI_STATUS
  809. (EFIAPI *EFI_CHECK_EVENT) (
  810. EFI_EVENT Event
  811. );
  812. /*++
  813. Routine Description:
  814. This routine checks whether or not an event is in the signaled state.
  815. Arguments:
  816. Event - Supplies the event to check.
  817. Return Value:
  818. EFI_SUCCESS on success.
  819. EFI_NOT_READY if the event is not signaled.
  820. EFI_INVALID_PARAMETER if the event is of type EVT_NOTIFY_SIGNAL.
  821. --*/
  822. typedef
  823. EFI_TPL
  824. (EFIAPI *EFI_RAISE_TPL) (
  825. EFI_TPL NewTpl
  826. );
  827. /*++
  828. Routine Description:
  829. This routine raises the current Task Priority Level.
  830. Arguments:
  831. NewTpl - Supplies the new TPL to set.
  832. Return Value:
  833. Returns the previous TPL.
  834. --*/
  835. typedef
  836. VOID
  837. (EFIAPI *EFI_RESTORE_TPL) (
  838. EFI_TPL OldTpl
  839. );
  840. /*++
  841. Routine Description:
  842. This routine restores the Task Priority Level back to its original value
  843. before it was raised.
  844. Arguments:
  845. OldTpl - Supplies the original TPL to restore back to.
  846. Return Value:
  847. None.
  848. --*/
  849. typedef
  850. EFI_STATUS
  851. (EFIAPI *EFI_GET_VARIABLE) (
  852. CHAR16 *VariableName,
  853. EFI_GUID *VendorGuid,
  854. UINT32 *Attributes,
  855. UINTN *DataSize,
  856. VOID *Data
  857. );
  858. /*++
  859. Routine Description:
  860. This routine returns the value of a variable.
  861. Arguments:
  862. VariableName - Supplies a pointer to a null-terminated string containing
  863. the name of the vendor's variable.
  864. VendorGuid - Supplies a pointer to the unique GUID for the vendor.
  865. Attributes - Supplies an optional pointer where the attribute mask for the
  866. variable will be returned.
  867. DataSize - Supplies a pointer that on input contains the size of the data
  868. buffer. On output, the actual size of the data will be returned.
  869. Data - Supplies a pointer where the variable value will be returned.
  870. Return Value:
  871. EFI_SUCCESS on success.
  872. EFI_NOT_FOUND if the variable was not found.
  873. EFI_BUFFER_TOO_SMALL if the supplied buffer is not big enough.
  874. EFI_INVALID_PARAMETER if the variable name, vendor GUID, or data size is
  875. NULL.
  876. EFI_DEVICE_ERROR if a hardware error occurred trying to read the variable.
  877. EFI_SECURITY_VIOLATION if the variable could not be retrieved due to an
  878. authentication failure.
  879. --*/
  880. typedef
  881. EFI_STATUS
  882. (EFIAPI *EFI_GET_NEXT_VARIABLE_NAME) (
  883. UINTN *VariableNameSize,
  884. CHAR16 *VariableName,
  885. EFI_GUID *VendorGuid
  886. );
  887. /*++
  888. Routine Description:
  889. This routine enumerates the current variable names.
  890. Arguments:
  891. VariableNameSize - Supplies a pointer that on input contains the size of
  892. the variable name buffer. On output, will contain the size of the
  893. variable name.
  894. VariableName - Supplies a pointer that on input contains the last variable
  895. name that was returned. On output, returns the null terminated string
  896. of the current variable.
  897. VendorGuid - Supplies a pointer that on input contains the last vendor GUID
  898. returned by this routine. On output, returns the vendor GUID of the
  899. current variable.
  900. Return Value:
  901. EFI_SUCCESS on success.
  902. EFI_NOT_FOUND if the next variable was not found.
  903. EFI_BUFFER_TOO_SMALL if the supplied buffer is not big enough.
  904. EFI_INVALID_PARAMETER if the variable name, vendor GUID, or data size is
  905. NULL.
  906. EFI_DEVICE_ERROR if a hardware error occurred trying to read the variable.
  907. --*/
  908. typedef
  909. EFI_STATUS
  910. (EFIAPI *EFI_SET_VARIABLE) (
  911. CHAR16 *VariableName,
  912. EFI_GUID *VendorGuid,
  913. UINT32 Attributes,
  914. UINTN DataSize,
  915. VOID *Data
  916. );
  917. /*++
  918. Routine Description:
  919. This routine sets the value of a variable.
  920. Arguments:
  921. VariableName - Supplies a pointer to a null-terminated string containing
  922. the name of the vendor's variable. Each variable name is unique for a
  923. particular vendor GUID. A variable name must be at least one character
  924. in length.
  925. VendorGuid - Supplies a pointer to the unique GUID for the vendor.
  926. Attributes - Supplies the attributes for this variable. See EFI_VARIABLE_*
  927. definitions.
  928. DataSize - Supplies the size of the data buffer. Unless the
  929. EFI_VARIABLE_APPEND_WRITE, EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS, or
  930. EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS attribute is set, a
  931. size of zero causes the variable to be deleted. When the
  932. EFI_VARIABLE_APPEND_WRITE attribute is set, then a set variable call
  933. with a data size of zero will not cause any change to the variable
  934. value (the timestamp associated with the variable may be updated
  935. however even if no new data value is provided,see the description of
  936. the EFI_VARIABLE_AUTHENTICATION_2 descriptor below. In this case the
  937. data size will not be zero since the EFI_VARIABLE_AUTHENTICATION_2
  938. descriptor will be populated).
  939. Data - Supplies the contents of the variable.
  940. Return Value:
  941. EFI_SUCCESS on success.
  942. EFI_NOT_FOUND if the variable being updated or deleted was not found.
  943. EFI_INVALID_PARAMETER if an invalid combination of attribute bits, name,
  944. and GUID was suplied, data size exceeds the maximum, or the variable name
  945. is an empty string.
  946. EFI_DEVICE_ERROR if a hardware error occurred trying to access the variable.
  947. EFI_WRITE_PROTECTED if the variable is read-only or cannot be deleted.
  948. EFI_SECURITY_VIOLATION if variable could not be written due to
  949. EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS or
  950. EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACESS being set, but the
  951. authorization information does NOT pass the validation check carried out by
  952. the firmware.
  953. --*/
  954. typedef
  955. EFI_STATUS
  956. (EFIAPI *EFI_GET_TIME) (
  957. EFI_TIME *Time,
  958. EFI_TIME_CAPABILITIES *Capabilities
  959. );
  960. /*++
  961. Routine Description:
  962. This routine returns the current time and dat information, and
  963. timekeeping capabilities of the hardware platform.
  964. Arguments:
  965. Time - Supplies a pointer where the current time will be returned.
  966. Capabilities - Supplies an optional pointer where the capabilities will be
  967. returned on success.
  968. Return Value:
  969. EFI_SUCCESS on success.
  970. EFI_INVALID_PARAMETER if the time parameter was NULL.
  971. EFI_DEVICE_ERROR if there was a hardware error accessing the device.
  972. --*/
  973. typedef
  974. EFI_STATUS
  975. (EFIAPI *EFI_SET_TIME) (
  976. EFI_TIME *Time
  977. );
  978. /*++
  979. Routine Description:
  980. This routine sets the current local time and date information.
  981. Arguments:
  982. Time - Supplies a pointer to the time to set.
  983. Return Value:
  984. EFI_SUCCESS on success.
  985. EFI_INVALID_PARAMETER if a time field is out of range.
  986. EFI_DEVICE_ERROR if there was a hardware error accessing the device.
  987. --*/
  988. typedef
  989. EFI_STATUS
  990. (EFIAPI *EFI_GET_WAKEUP_TIME) (
  991. BOOLEAN *Enabled,
  992. BOOLEAN *Pending,
  993. EFI_TIME *Time
  994. );
  995. /*++
  996. Routine Description:
  997. This routine gets the current wake alarm setting.
  998. Arguments:
  999. Enabled - Supplies a pointer that receives a boolean indicating if the
  1000. alarm is currently enabled or disabled.
  1001. Pending - Supplies a pointer that receives a boolean indicating if the
  1002. alarm signal is pending and requires acknowledgement.
  1003. Time - Supplies a pointer that receives the current wake time.
  1004. Return Value:
  1005. EFI_SUCCESS on success.
  1006. EFI_INVALID_PARAMETER if any parameter is NULL.
  1007. EFI_DEVICE_ERROR if there was a hardware error accessing the device.
  1008. EFI_UNSUPPORTED if the wakeup timer is not supported on this platform.
  1009. --*/
  1010. typedef
  1011. EFI_STATUS
  1012. (EFIAPI *EFI_SET_WAKEUP_TIME) (
  1013. BOOLEAN Enable,
  1014. EFI_TIME *Time
  1015. );
  1016. /*++
  1017. Routine Description:
  1018. This routine sets the current wake alarm setting.
  1019. Arguments:
  1020. Enable - Supplies a boolean enabling or disabling the wakeup timer.
  1021. Time - Supplies an optional pointer to the time to set. This parameter is
  1022. only optional if the enable parameter is FALSE.
  1023. Return Value:
  1024. EFI_SUCCESS on success.
  1025. EFI_INVALID_PARAMETER if a time field is out of range.
  1026. EFI_DEVICE_ERROR if there was a hardware error accessing the device.
  1027. EFI_UNSUPPORTED if the wakeup timer is not supported on this platform.
  1028. --*/
  1029. typedef
  1030. EFI_STATUS
  1031. (EFIAPI *EFI_IMAGE_LOAD) (
  1032. BOOLEAN BootPolicy,
  1033. EFI_HANDLE ParentImageHandle,
  1034. EFI_DEVICE_PATH_PROTOCOL *DevicePath,
  1035. VOID *SourceBuffer,
  1036. UINTN SourceSize,
  1037. EFI_HANDLE *ImageHandle
  1038. );
  1039. /*++
  1040. Routine Description:
  1041. This routine loads an EFI image into memory.
  1042. Arguments:
  1043. BootPolicy - Supplies a boolean indicating that the request originates
  1044. from the boot manager, and that the boot manager is attempting to load
  1045. the given file path as a boot selection. This is ignored if the source
  1046. buffer is NULL.
  1047. ParentImageHandle - Supplies the caller's image handle.
  1048. DevicePath - Supplies a pointer to the device path from which the image is
  1049. loaded.
  1050. SourceBuffer - Supplies an optional pointer to the memory location
  1051. containing a copy of the image to be loaded.
  1052. SourceSize - Supplies the size in bytes of the source buffer.
  1053. ImageHandle - Supplies a pointer where the loaded image handle will be
  1054. returned on success.
  1055. Return Value:
  1056. EFI_SUCCESS on success.
  1057. EFI_NOT_FOUND if both the source buffer and device path are NULL.
  1058. EFI_INVALID_PARAMETER if one or more parameters are not valid.
  1059. EFI_UNSUPPORTED if the image type is unsupported.
  1060. EFI_OUT_OF_RESOURCES if an allocation failed.
  1061. EFI_LOAD_ERROR if the image format was corrupt or not understood.
  1062. EFI_DEVICE_ERROR if the underlying device returned a read error.
  1063. EFI_ACCESS_DENIED if the platform policy prohibits the image from being
  1064. loaded.
  1065. EFI_SECURITY_VIOLATION if the image was successfully loaded, but the
  1066. platform policy indicates the image should not be started.
  1067. --*/
  1068. typedef
  1069. EFI_STATUS
  1070. (EFIAPI *EFI_IMAGE_START) (
  1071. EFI_HANDLE ImageHandle,
  1072. UINTN *ExitDataSize,
  1073. CHAR16 **ExitData
  1074. );
  1075. /*++
  1076. Routine Description:
  1077. This routine transfers control to a loaded image's entry point.
  1078. Arguments:
  1079. ImageHandle - Supplies the handle of the image to run.
  1080. ExitDataSize - Supplies a pointer to the size, in bytes, of the exit data.
  1081. ExitData - Supplies an optional pointer where a pointer will be returned
  1082. that includes a null-terminated string, optionally followed by
  1083. additional binary data.
  1084. Return Value:
  1085. EFI_INVALID_PARAMETER if the image handle is invalid or the image has
  1086. already been started.
  1087. EFI_SECURITY_VIOLATION if the platform policy specifies the image should
  1088. not be started.
  1089. Otherwise, returns the exit code from the image.
  1090. --*/
  1091. typedef
  1092. EFI_STATUS
  1093. (EFIAPI *EFI_EXIT) (
  1094. EFI_HANDLE ImageHandle,
  1095. EFI_STATUS ExitStatus,
  1096. UINTN ExitDataSize,
  1097. CHAR16 *ExitData
  1098. );
  1099. /*++
  1100. Routine Description:
  1101. This routine terminates an loaded EFI image and returns control to boot
  1102. services.
  1103. Arguments:
  1104. ImageHandle - Supplies the handle of the image passed upon entry.
  1105. ExitStatus - Supplies the exit code.
  1106. ExitDataSize - Supplies the size of the exit data. This is ignored if the
  1107. exit status code is EFI_SUCCESS.
  1108. ExitData - Supplies an optional pointer where a pointer will be returned
  1109. that includes a null-terminated string describing the reason the
  1110. application exited, optionally followed by additional binary data. This
  1111. buffer must be allocated from AllocatePool.
  1112. Return Value:
  1113. EFI_SUCCESS if the image was unloaded.
  1114. EFI_INVALID_PARAMETER if the image has been loaded and started with
  1115. LoadImage and StartImage, but the image is not currently executing.
  1116. --*/
  1117. typedef
  1118. EFI_STATUS
  1119. (EFIAPI *EFI_IMAGE_UNLOAD) (
  1120. EFI_HANDLE ImageHandle
  1121. );
  1122. /*++
  1123. Routine Description:
  1124. This routine unloads an image.
  1125. Arguments:
  1126. ImageHandle - Supplies the handle of the image to unload.
  1127. ExitStatus - Supplies the exit code.
  1128. ExitDataSize - Supplies the size of the exit data. This is ignored if the
  1129. exit status code is EFI_SUCCESS.
  1130. ExitData - Supplies an optional pointer where a pointer will be returned
  1131. that includes a null-terminated string describing the reason the
  1132. application exited, optionally followed by additional binary data. This
  1133. buffer must be allocated from AllocatePool.
  1134. Return Value:
  1135. EFI_SUCCESS if the image was unloaded.
  1136. EFI_INVALID_PARAMETER if the image handle is not valid.
  1137. --*/
  1138. typedef
  1139. EFI_STATUS
  1140. (EFIAPI *EFI_EXIT_BOOT_SERVICES) (
  1141. EFI_HANDLE ImageHandle,
  1142. UINTN MapKey
  1143. );
  1144. /*++
  1145. Routine Description:
  1146. This routine terminates all boot services.
  1147. Arguments:
  1148. ImageHandle - Supplies the handle that identifies the exiting image.
  1149. MapKey - Supplies the latest memory map key.
  1150. Return Value:
  1151. EFI_SUCCESS on success.
  1152. EFI_INVALID_PARAMETER if the map key is incorrect.
  1153. --*/
  1154. typedef
  1155. EFI_STATUS
  1156. (EFIAPI *EFI_STALL) (
  1157. UINTN Microseconds
  1158. );
  1159. /*++
  1160. Routine Description:
  1161. This routine induces a fine-grained delay.
  1162. Arguments:
  1163. Microseconds - Supplies the number of microseconds to stall execution for.
  1164. Return Value:
  1165. EFI_SUCCESS on success.
  1166. --*/
  1167. typedef
  1168. EFI_STATUS
  1169. (EFIAPI *EFI_SET_WATCHDOG_TIMER) (
  1170. UINTN Timeout,
  1171. UINT64 WatchdogCode,
  1172. UINTN DataSize,
  1173. CHAR16 *WatchdogData
  1174. );
  1175. /*++
  1176. Routine Description:
  1177. This routine sets the system's watchdog timer.
  1178. Arguments:
  1179. Timeout - Supplies the number of seconds to set the timer for.
  1180. WatchdogCode - Supplies a numeric code to log on a watchdog timeout event.
  1181. DataSize - Supplies the size of the watchdog data.
  1182. WatchdogData - Supplies an optional buffer that includes a null-terminated
  1183. string, optionally followed by additional binary data.
  1184. Return Value:
  1185. EFI_SUCCESS on success.
  1186. EFI_INVALID_PARAMETER if the supplied watchdog code is invalid.
  1187. EFI_UNSUPPORTED if there is no watchdog timer.
  1188. EFI_DEVICE_ERROR if an error occurred accessing the device hardware.
  1189. --*/
  1190. typedef
  1191. VOID
  1192. (EFIAPI *EFI_RESET_SYSTEM) (
  1193. EFI_RESET_TYPE ResetType,
  1194. EFI_STATUS ResetStatus,
  1195. UINTN DataSize,
  1196. VOID *ResetData
  1197. );
  1198. /*++
  1199. Routine Description:
  1200. This routine resets the entire platform.
  1201. Arguments:
  1202. ResetType - Supplies the type of reset to perform.
  1203. ResetStatus - Supplies the status code for this reset.
  1204. DataSize - Supplies the size of the reset data.
  1205. ResetData - Supplies an optional pointer for reset types of cold, warm, or
  1206. shutdown to a null-terminated string, optionally followed by additional
  1207. binary data.
  1208. Return Value:
  1209. None. This routine does not return.
  1210. --*/
  1211. typedef
  1212. EFI_STATUS
  1213. (EFIAPI *EFI_GET_NEXT_MONOTONIC_COUNT) (
  1214. UINT64 *Count
  1215. );
  1216. /*++
  1217. Routine Description:
  1218. This routine returns a monotonically increasing count for the platform.
  1219. Arguments:
  1220. Count - Supplies a pointer where the next count is returned.
  1221. Return Value:
  1222. EFI_SUCCESS on success.
  1223. EFI_INVALID_PARAMETER if the count is NULL.
  1224. EFI_DEVICE_ERROR if the device is not functioning properly.
  1225. --*/
  1226. typedef
  1227. EFI_STATUS
  1228. (EFIAPI *EFI_GET_NEXT_HIGH_MONO_COUNT) (
  1229. UINT32 *HighCount
  1230. );
  1231. /*++
  1232. Routine Description:
  1233. This routine returns the next high 32 bits of the platform's monotonic
  1234. counter.
  1235. Arguments:
  1236. HighCount - Supplies a pointer where the value is returned.
  1237. Return Value:
  1238. EFI_SUCCESS on success.
  1239. EFI_INVALID_PARAMETER if the count is NULL.
  1240. EFI_DEVICE_ERROR if the device is not functioning properly.
  1241. --*/
  1242. typedef
  1243. EFI_STATUS
  1244. (EFIAPI *EFI_CALCULATE_CRC32) (
  1245. VOID *Data,
  1246. UINTN DataSize,
  1247. UINT32 *Crc32
  1248. );
  1249. /*++
  1250. Routine Description:
  1251. This routine computes the 32-bit CRC for a data buffer.
  1252. Arguments:
  1253. Data - Supplies a pointer to the buffer to compute the CRC on.
  1254. DataSize - Supplies the size of the data buffer in bytes.
  1255. Crc32 - Supplies a pointer where the 32-bit CRC will be returned.
  1256. Return Value:
  1257. EFI_SUCCESS on success.
  1258. EFI_INVALID_PARAMETER if any parameter is NULL, or the data size is zero.
  1259. --*/
  1260. typedef
  1261. VOID
  1262. (EFIAPI *EFI_COPY_MEM) (
  1263. VOID *Destination,
  1264. VOID *Source,
  1265. UINTN Length
  1266. );
  1267. /*++
  1268. Routine Description:
  1269. This routine copies the contents of one buffer to another.
  1270. Arguments:
  1271. Destination - Supplies a pointer to the destination of the copy.
  1272. Source - Supplies a pointer to the source of the copy.
  1273. Length - Supplies the number of bytes to copy.
  1274. Return Value:
  1275. None.
  1276. --*/
  1277. typedef
  1278. VOID
  1279. (EFIAPI *EFI_SET_MEM) (
  1280. VOID *Buffer,
  1281. UINTN Size,
  1282. UINT8 Value
  1283. );
  1284. /*++
  1285. Routine Description:
  1286. This routine fills a buffer with a specified value.
  1287. Arguments:
  1288. Buffer - Supplies a pointer to the buffer to fill.
  1289. Size - Supplies the size of the buffer in bytes.
  1290. Value - Supplies the value to fill the buffer with.
  1291. Return Value:
  1292. None.
  1293. --*/
  1294. typedef
  1295. EFI_STATUS
  1296. (EFIAPI *EFI_INSTALL_PROTOCOL_INTERFACE) (
  1297. EFI_HANDLE *Handle,
  1298. EFI_GUID *Protocol,
  1299. EFI_INTERFACE_TYPE InterfaceType,
  1300. VOID *Interface
  1301. );
  1302. /*++
  1303. Routine Description:
  1304. This routine installs a protocol interface on a device handle. If the
  1305. handle does not exist, it is created and added to the list of handles in
  1306. the system. InstallMultipleProtocolInterfaces performs more error checking
  1307. than this routine, so it is recommended to be used in place of this
  1308. routine.
  1309. Arguments:
  1310. Handle - Supplies a pointer to the EFI handle on which the interface is to
  1311. be installed.
  1312. Protocol - Supplies a pointer to the numeric ID of the protocol interface.
  1313. InterfaceType - Supplies the interface type.
  1314. Interface - Supplies a pointer to the protocol interface.
  1315. Return Value:
  1316. EFI_SUCCESS on success.
  1317. EFI_OUT_OF_RESOURCES if memory could not be allocated.
  1318. EFI_INVALID_PARAMETER if the handle or protocol is NULL, the interface type
  1319. is not native, or the protocol is already install on the given handle.
  1320. --*/
  1321. typedef
  1322. EFI_STATUS
  1323. (EFIAPI *EFI_INSTALL_MULTIPLE_PROTOCOL_INTERFACES) (
  1324. EFI_HANDLE *Handle,
  1325. ...
  1326. );
  1327. /*++
  1328. Routine Description:
  1329. This routine installs one or more protocol interface into the boot
  1330. services environment.
  1331. Arguments:
  1332. Handle - Supplies a pointer to the EFI handle on which the interface is to
  1333. be installed, or a pointer to NULL if a new handle is to be allocated.
  1334. ... - Supplies a variable argument list containing pairs of protocol GUIDs
  1335. and protocol interfaces.
  1336. Return Value:
  1337. EFI_SUCCESS on success.
  1338. EFI_OUT_OF_RESOURCES if memory could not be allocated.
  1339. EFI_ALREADY_STARTED if a device path protocol instance was passed in that
  1340. is already present in the handle database.
  1341. EFI_INVALID_PARAMETER if the handle is NULL or the protocol is already
  1342. installed on the given handle.
  1343. --*/
  1344. typedef
  1345. EFI_STATUS
  1346. (EFIAPI *EFI_REINSTALL_PROTOCOL_INTERFACE) (
  1347. EFI_HANDLE Handle,
  1348. EFI_GUID *Protocol,
  1349. VOID *OldInterface,
  1350. VOID *NewInterface
  1351. );
  1352. /*++
  1353. Routine Description:
  1354. This routine reinstalls a protocol interface on a device handle.
  1355. Arguments:
  1356. Handle - Supplies the device handle on which the interface is to be
  1357. reinstalled.
  1358. Protocol - Supplies a pointer to the numeric ID of the interface.
  1359. OldInterface - Supplies a pointer to the old interface. NULL can be used if
  1360. a structure is not associated with the protocol.
  1361. NewInterface - Supplies a pointer to the new interface.
  1362. Return Value:
  1363. EFI_SUCCESS on success.
  1364. EFI_NOT_FOUND if the old interface was not found.
  1365. EFI_ACCESS_DENIED if the protocl interface could not be reinstalled because
  1366. the old interface is still being used by a driver that will not release it.
  1367. EFI_INVALID_PARAMETER if the handle or protocol is NULL.
  1368. --*/
  1369. typedef
  1370. EFI_STATUS
  1371. (EFIAPI *EFI_UNINSTALL_PROTOCOL_INTERFACE) (
  1372. EFI_HANDLE Handle,
  1373. EFI_GUID *Protocol,
  1374. VOID *Interface
  1375. );
  1376. /*++
  1377. Routine Description:
  1378. This routine removes a protocol interface from a device handle. It is
  1379. recommended that UninstallMultipleProtocolInterfaces be used in place of
  1380. this routine.
  1381. Arguments:
  1382. Handle - Supplies the device handle on which the interface is to be
  1383. removed.
  1384. Protocol - Supplies a pointer to the numeric ID of the interface.
  1385. Interface - Supplies a pointer to the interface.
  1386. Return Value:
  1387. EFI_SUCCESS on success.
  1388. EFI_NOT_FOUND if the old interface was not found.
  1389. EFI_ACCESS_DENIED if the protocl interface could not be reinstalled because
  1390. the old interface is still being used by a driver that will not release it.
  1391. EFI_INVALID_PARAMETER if the handle or protocol is NULL.
  1392. --*/
  1393. typedef
  1394. EFI_STATUS
  1395. (EFIAPI *EFI_UNINSTALL_MULTIPLE_PROTOCOL_INTERFACES) (
  1396. EFI_HANDLE Handle,
  1397. ...
  1398. );
  1399. /*++
  1400. Routine Description:
  1401. This routine removes one or more protocol interfaces into the boot services
  1402. environment.
  1403. Arguments:
  1404. Handle - Supplies the device handle on which the interface is to be
  1405. removed.
  1406. ... - Supplies a variable argument list containing pairs of protocol GUIDs
  1407. and protocol interfaces.
  1408. Return Value:
  1409. EFI_SUCCESS if all of the requested protocol interfaces were removed.
  1410. EFI_INVALID_PARAMETER if one of the protocol interfaces was not previously
  1411. installed on the given.
  1412. --*/
  1413. typedef
  1414. EFI_STATUS
  1415. (EFIAPI *EFI_HANDLE_PROTOCOL) (
  1416. EFI_HANDLE Handle,
  1417. EFI_GUID *Protocol,
  1418. VOID **Interface
  1419. );
  1420. /*++
  1421. Routine Description:
  1422. This routine queries a handle to determine if it supports a specified
  1423. protocol.
  1424. Arguments:
  1425. Handle - Supplies the handle being queried.
  1426. Protocol - Supplies the published unique identifier of the protocol.
  1427. Interface - Supplies the address where a pointer to the corresponding
  1428. protocol interface is returned.
  1429. Return Value:
  1430. EFI_SUCCESS if the interface information was returned.
  1431. EFI_UNSUPPORTED if the device not support the specified protocol.
  1432. EFI_INVALID_PARAMETER if the handle, protocol, or interface is NULL.
  1433. --*/
  1434. typedef
  1435. EFI_STATUS
  1436. (EFIAPI *EFI_OPEN_PROTOCOL) (
  1437. EFI_HANDLE Handle,
  1438. EFI_GUID *Protocol,
  1439. VOID **Interface,
  1440. EFI_HANDLE AgentHandle,
  1441. EFI_HANDLE ControllerHandle,
  1442. UINT32 Attributes
  1443. );
  1444. /*++
  1445. Routine Description:
  1446. This routine queries a handle to determine if it supports a specified
  1447. protocol. If the protocol is supported by the handle, it opens the protocol
  1448. on behalf of the calling agent.
  1449. Arguments:
  1450. Handle - Supplies the handle for the protocol interface that is being
  1451. opened.
  1452. Protocol - Supplies the published unique identifier of the protocol.
  1453. Interface - Supplies the address where a pointer to the corresponding
  1454. protocol interface is returned.
  1455. AgentHandle - Supplies the handle of the agent that is opening the protocol
  1456. interface specified by the protocol and interface.
  1457. ControllerHandle - Supplies the controller handle that requires the
  1458. protocl interface if the caller is a driver that follows the UEFI
  1459. driver model. If the caller does not follow the UEFI Driver Model, then
  1460. this parameter is optional.
  1461. Attributes - Supplies the open mode of the protocol interface specified by
  1462. the given handle and protocol.
  1463. Return Value:
  1464. EFI_SUCCESS if the interface information was returned.
  1465. EFI_UNSUPPORTED if the handle not support the specified protocol.
  1466. EFI_INVALID_PARAMETER if a parameter is invalid.
  1467. EFI_ACCESS_DENIED if the required attributes can't be supported in the
  1468. current environment.
  1469. EFI_ALREADY_STARTED if the item on the open list already has required
  1470. attributes whose agent handle is the same as the given one.
  1471. --*/
  1472. typedef
  1473. EFI_STATUS
  1474. (EFIAPI *EFI_CLOSE_PROTOCOL) (
  1475. EFI_HANDLE Handle,
  1476. EFI_GUID *Protocol,
  1477. EFI_HANDLE AgentHandle,
  1478. EFI_HANDLE ControllerHandle
  1479. );
  1480. /*++
  1481. Routine Description:
  1482. This routine closes a protocol on a handle that was previously opened.
  1483. Arguments:
  1484. Handle - Supplies the handle for the protocol interface was previously
  1485. opened.
  1486. Protocol - Supplies the published unique identifier of the protocol.
  1487. AgentHandle - Supplies the handle of the agent that is closing the
  1488. protocol interface.
  1489. ControllerHandle - Supplies the controller handle that required the
  1490. protocl interface if the caller is a driver that follows the UEFI
  1491. driver model. If the caller does not follow the UEFI Driver Model, then
  1492. this parameter is optional.
  1493. Return Value:
  1494. EFI_SUCCESS if the interface information was returned.
  1495. EFI_INVALID_PARAMETER if the handle, agent, or protocol is NULL, or if the
  1496. controller handle is not NULL and the controller handle is not valid.
  1497. EFI_NOT_FOUND if the handle does not support the given protocol, or the
  1498. protocol interface is not currently open by the agent and controller
  1499. handles.
  1500. --*/
  1501. typedef
  1502. EFI_STATUS
  1503. (EFIAPI *EFI_OPEN_PROTOCOL_INFORMATION) (
  1504. EFI_HANDLE Handle,
  1505. EFI_GUID *Protocol,
  1506. EFI_OPEN_PROTOCOL_INFORMATION_ENTRY **EntryBuffer,
  1507. UINTN *EntryCount
  1508. );
  1509. /*++
  1510. Routine Description:
  1511. This routine retrieves a list of agents that currently have a protocol
  1512. interface opened.
  1513. Arguments:
  1514. Handle - Supplies the handle for the protocol interface being queried.
  1515. Protocol - Supplies the published unique identifier of the protocol.
  1516. EntryBuffer - Supplies a pointer where a pointer to a buffer of open
  1517. protocol information in the form of EFI_OPEN_PROTOCOL_INFORMATION_ENTRY
  1518. structures will be returned.
  1519. EntryCount - Supplies a pointer that receives the number of entries in the
  1520. buffer.
  1521. Return Value:
  1522. EFI_SUCCESS if the interface information was returned.
  1523. EFI_OUT_OF_RESOURCES if an allocation failed.
  1524. EFI_NOT_FOUND if the handle does not support the given protocol.
  1525. --*/
  1526. typedef
  1527. EFI_STATUS
  1528. (EFIAPI *EFI_PROTOCOLS_PER_HANDLE) (
  1529. EFI_HANDLE Handle,
  1530. EFI_GUID ***ProtocolBuffer,
  1531. UINTN *ProtocolBufferCount
  1532. );
  1533. /*++
  1534. Routine Description:
  1535. This routine retrieves the list of protocol interface GUIDs that are
  1536. installed on a handle in a buffer allocated from pool.
  1537. Arguments:
  1538. Handle - Supplies the handle from which to retrieve the list of protocol
  1539. interface GUIDs.
  1540. ProtocolBuffer - Supplies a pointer to the list of protocol interface GUID
  1541. pointers that are installed on the given handle.
  1542. ProtocolBufferCount - Supplies a pointer to the number of GUID pointers
  1543. present in the protocol buffer.
  1544. Return Value:
  1545. EFI_SUCCESS if the interface information was returned.
  1546. EFI_OUT_OF_RESOURCES if an allocation failed.
  1547. EFI_INVALID_PARAMETER if the handle is NULL or invalid, or the protocol
  1548. buffer or count is NULL.
  1549. --*/
  1550. typedef
  1551. EFI_STATUS
  1552. (EFIAPI *EFI_REGISTER_PROTOCOL_NOTIFY) (
  1553. EFI_GUID *Protocol,
  1554. EFI_EVENT Event,
  1555. VOID **Registration
  1556. );
  1557. /*++
  1558. Routine Description:
  1559. This routine creates an event that is to be signaled whenever an interface
  1560. is installed for a specified protocol.
  1561. Arguments:
  1562. Protocol - Supplies the numeric ID of the protocol for which the event is
  1563. to be registered.
  1564. Event - Supplies the event that is to be signaled whenever a protocol
  1565. interface is registered for the given protocol.
  1566. Registration - Supplies a pointer to a memory location to receive the
  1567. registration value.
  1568. Return Value:
  1569. EFI_SUCCESS on success.
  1570. EFI_OUT_OF_RESOURCES if an allocation failed.
  1571. EFI_INVALID_PARAMETER if the protocol, event, or registration is NULL.
  1572. --*/
  1573. typedef
  1574. EFI_STATUS
  1575. (EFIAPI *EFI_LOCATE_HANDLE) (
  1576. EFI_LOCATE_SEARCH_TYPE SearchType,
  1577. EFI_GUID *Protocol,
  1578. VOID *SearchKey,
  1579. UINTN *BufferSize,
  1580. EFI_HANDLE *Buffer
  1581. );
  1582. /*++
  1583. Routine Description:
  1584. This routine returns an array of handles that support a specified protocol.
  1585. Arguments:
  1586. SearchType - Supplies which handle(s) are to be returned.
  1587. Protocol - Supplies an optional pointer to the protocols to search by.
  1588. SearchKey - Supplies an optional pointer to the search key.
  1589. BufferSize - Supplies a pointer that on input contains the size of the
  1590. result buffer in bytes. On output, the size of the result array will be
  1591. returned (even if the buffer was too small).
  1592. Buffer - Supplies a pointer where the results will be returned.
  1593. Return Value:
  1594. EFI_SUCCESS on success.
  1595. EFI_NOT_FOUND if no handles match the search.
  1596. EFI_BUFFER_TOO_SMALL if the given buffer wasn't big enough to hold all the
  1597. results.
  1598. EFI_INVALID_PARAMETER if the serach type is invalid, one of the parameters
  1599. required by the given search type was NULL, one or more matches are found
  1600. and the buffer size is NULL, or the buffer size is large enough and the
  1601. buffer is NULL.
  1602. --*/
  1603. typedef
  1604. EFI_STATUS
  1605. (EFIAPI *EFI_LOCATE_DEVICE_PATH) (
  1606. EFI_GUID *Protocol,
  1607. EFI_DEVICE_PATH_PROTOCOL **DevicePath,
  1608. EFI_HANDLE *Device
  1609. );
  1610. /*++
  1611. Routine Description:
  1612. This routine attempts to locate the handle to a device on the device path
  1613. that supports the specified protocol.
  1614. Arguments:
  1615. Protocol - Supplies a pointer to the protocol to search for.
  1616. DevicePath - Supplies a pointer that on input contains a pointer to the
  1617. device path. On output, the path pointer is modified to point to the
  1618. remaining part of the device path.
  1619. Device - Supplies a pointer where the handle of the device will be
  1620. returned.
  1621. Return Value:
  1622. EFI_SUCCESS if a handle was returned.
  1623. EFI_NOT_FOUND if no handles match the search.
  1624. EFI_INVALID_PARAMETER if the protocol is NULL, device path is NULL, or a
  1625. handle matched and the device is NULL.
  1626. --*/
  1627. typedef
  1628. EFI_STATUS
  1629. (EFIAPI *EFI_INSTALL_CONFIGURATION_TABLE) (
  1630. EFI_GUID *Guid,
  1631. VOID *Table
  1632. );
  1633. /*++
  1634. Routine Description:
  1635. This routine adds, updates, or removes a configuration table entry from the
  1636. EFI System Table.
  1637. Arguments:
  1638. Guid - Supplies a pointer to the GUID for the entry to add, update, or
  1639. remove.
  1640. Table - Supplies a pointer to the configuration table for the entry to add,
  1641. update, or remove. This may be NULL.
  1642. Return Value:
  1643. EFI_SUCCESS on success.
  1644. EFI_NOT_FOUND if an attempt was made to delete a nonexistant entry.
  1645. EFI_INVALID_PARAMETER if the GUID is NULL.
  1646. EFI_OUT_OF_RESOURCES if an allocation failed.
  1647. --*/
  1648. typedef
  1649. EFI_STATUS
  1650. (EFIAPI *EFI_LOCATE_HANDLE_BUFFER) (
  1651. EFI_LOCATE_SEARCH_TYPE SearchType,
  1652. EFI_GUID *Protocol,
  1653. VOID *SearchKey,
  1654. UINTN *HandleCount,
  1655. EFI_HANDLE **Buffer
  1656. );
  1657. /*++
  1658. Routine Description:
  1659. This routine returns an array of handles that support the requested
  1660. protocol in a buffer allocated from pool.
  1661. Arguments:
  1662. SearchType - Supplies the search behavior.
  1663. Protocol - Supplies a pointer to the protocol to search by.
  1664. SearchKey - Supplies a pointer to the search key.
  1665. HandleCount - Supplies a pointer where the number of handles will be
  1666. returned.
  1667. Buffer - Supplies a pointer where an array will be returned containing the
  1668. requested handles.
  1669. Return Value:
  1670. EFI_SUCCESS on success.
  1671. EFI_NOT_FOUND if no handles match the search.
  1672. EFI_INVALID_PARAMETER if the handle count or buffer is NULL.
  1673. EFI_OUT_OF_RESOURCES if an allocation failed.
  1674. --*/
  1675. typedef
  1676. EFI_STATUS
  1677. (EFIAPI *EFI_LOCATE_PROTOCOL) (
  1678. EFI_GUID *Protocol,
  1679. VOID *Registration,
  1680. VOID **Interface
  1681. );
  1682. /*++
  1683. Routine Description:
  1684. This routine returns the first protocol instance that matches the given
  1685. protocol.
  1686. Arguments:
  1687. Protocol - Supplies a pointer to the protocol to search by.
  1688. Registration - Supplies a pointer to an optional registration key
  1689. returned from RegisterProtocolNotify.
  1690. Interface - Supplies a pointer where a pointer to the first interface that
  1691. matches will be returned on success.
  1692. Return Value:
  1693. EFI_SUCCESS on success.
  1694. EFI_NOT_FOUND if no protocol instances matched the search.
  1695. EFI_INVALID_PARAMETER if the interface is NULL.
  1696. --*/
  1697. typedef
  1698. EFI_STATUS
  1699. (EFIAPI *EFI_UPDATE_CAPSULE) (
  1700. EFI_CAPSULE_HEADER **CapsuleHeaderArray,
  1701. UINTN CapsuleCount,
  1702. EFI_PHYSICAL_ADDRESS ScatterGatherList
  1703. );
  1704. /*++
  1705. Routine Description:
  1706. This routine passes capsules to the firmware with both virtual and physical
  1707. mapping. Depending on the intended consumption, the firmware may process
  1708. the capsule immediately. If the payload should persist across a system
  1709. reset, the reset value returned from EFI_QueryCapsuleCapabilities must be
  1710. passed into ResetSystem and will cause the capsule to be processed by the
  1711. firmware as part of the reset process.
  1712. Arguments:
  1713. CapsuleHeaderArray - Supplies a virtual pointer to an array of virtual
  1714. pointers to the capsules being passed into update capsule.
  1715. CapsuleCount - Supplies the number of pointers to EFI_CAPSULE_HEADERs in
  1716. the capsule header array.
  1717. ScatterGatherList - Supplies an optional physical pointer to a set of
  1718. EFI_CAPSULE_BLOCK_DESCRIPTOR that describes the location in physical
  1719. memory of a set of capsules.
  1720. Return Value:
  1721. EFI_SUCCESS if a valid capsule was passed. If
  1722. CAPSULE_FLAGS_PERSIT_ACROSS_RESET is not set, the capsule has been
  1723. successfully processed by the firmware.
  1724. EFI_INVALID_PARAMETER if the capsule size is NULL, the capsule count is
  1725. zero, or an incompatible set of flags were set in the capsule header.
  1726. EFI_DEVICE_ERROR if the capsule update was started, but failed due to a
  1727. device error.
  1728. EFI_UNSUPPORTED if the capsule type is not supported on this platform.
  1729. EFI_OUT_OF_RESOURCES if resources could not be allocated. If this call
  1730. originated during runtime, this error is returned if the caller must retry
  1731. the call during boot services.
  1732. --*/
  1733. typedef
  1734. EFI_STATUS
  1735. (EFIAPI *EFI_QUERY_CAPSULE_CAPABILITIES) (
  1736. EFI_CAPSULE_HEADER **CapsuleHeaderArray,
  1737. UINTN CapsuleCount,
  1738. UINT64 *MaximumCapsuleSize,
  1739. EFI_RESET_TYPE *ResetType
  1740. );
  1741. /*++
  1742. Routine Description:
  1743. This routine returns whether or not the capsule is supported via the
  1744. UpdateCapsule routine.
  1745. Arguments:
  1746. CapsuleHeaderArray - Supplies a virtual pointer to an array of virtual
  1747. pointers to the capsules being passed into update capsule.
  1748. CapsuleCount - Supplies the number of pointers to EFI_CAPSULE_HEADERs in
  1749. the capsule header array.
  1750. MaximumCapsuleSize - Supplies a pointer that on output contains the maximum
  1751. size that the update capsule routine can support as an argument to
  1752. the update capsule routine.
  1753. ResetType - Supplies a pointer where the reset type required to perform the
  1754. capsule update is returned.
  1755. Return Value:
  1756. EFI_SUCCESS if a valid answer was returned.
  1757. EFI_UNSUPPORTED if the capsule type is not supported on this platform.
  1758. EFI_DEVICE_ERROR if the capsule update was started, but failed due to a
  1759. device error.
  1760. EFI_INVALID_PARAMETER if the maximum capsule size is NULL.
  1761. EFI_OUT_OF_RESOURCES if resources could not be allocated. If this call
  1762. originated during runtime, this error is returned if the caller must retry
  1763. the call during boot services.
  1764. --*/
  1765. typedef
  1766. EFI_STATUS
  1767. (EFIAPI *EFI_QUERY_VARIABLE_INFO) (
  1768. UINT32 Attributes,
  1769. UINT64 *MaximumVariableStorageSize,
  1770. UINT64 *RemainingVariableStorageSize,
  1771. UINT64 *MaximumVariableSize
  1772. );
  1773. /*++
  1774. Routine Description:
  1775. This routine returns information about EFI variables.
  1776. Arguments:
  1777. Attributes - Supplies a bitmask of attributes specifying the type of
  1778. variables on which to return information.
  1779. MaximumVariableStorageSize - Supplies a pointer where the maximum size of
  1780. storage space for EFI variables with the given attributes will be
  1781. returned.
  1782. RemainingVariableStorageSize - Supplies a pointer where the remaining size
  1783. of the storage space available for EFI variables associated with the
  1784. attributes specified will be returned.
  1785. MaximumVariableSize - Supplies a pointer where the maximum size of an
  1786. individual variable will be returned on success.
  1787. Return Value:
  1788. EFI_SUCCESS if a valid answer was returned.
  1789. EFI_UNSUPPORTED if the attribute is not supported on this platform.
  1790. EFI_INVALID_PARAMETER if an invalid combination of attributes was supplied.
  1791. --*/
  1792. /*++
  1793. Structure Description:
  1794. This structure defines the EFI Runtime Services Table.
  1795. Members:
  1796. Hdr - Stores the standard header for an EFI table.
  1797. GetTime - Stores a pointer to a function for getting the current time.
  1798. SetTime - Stores a pointer to a function for setting the current time.
  1799. GetWakeupTime - Stores a pointer to a function for getting the current
  1800. wake alarm time.
  1801. SetWakeupTime - Stores a pointer to a function for setting (or disabling)
  1802. the wake alarm.
  1803. SetVirtualAddressMap - Stores a pointer to a function used to enable
  1804. running EFI runtime services with virtual-to-physical translation (the
  1805. MMU) enabled.
  1806. ConvertPointer - Stores a pointer to a function used to convert a pointer
  1807. into a virtual runtime pointer.
  1808. GetVariable - Stores a pointer to a function used to get the value of an
  1809. EFI variable.
  1810. GetNextVariableName - Stores a pointer to a function used to iterate
  1811. through a set of variables.
  1812. SetVariable - Stores a pointer to a function used to set or delete an
  1813. EFI variable.
  1814. GetNextHighMonotonicCount - Stores a pointer to a function used to get
  1815. the high 32-bits of a monotonically increasing number.
  1816. ResetSystem - Stores a pointer to a function used to shut down or reset
  1817. the platform.
  1818. UpdateCapsule - Stores a pointer to a function used to send an update
  1819. capsule to firmware.
  1820. QueryCapsuleCapabilities - Stores a pointer to a function used to
  1821. interrogate the firmware about update capsule capabilities.
  1822. QueryVariableInfo - Stores a pointer to a function used to get
  1823. information about EFI variable storage.
  1824. --*/
  1825. typedef struct {
  1826. EFI_TABLE_HEADER Hdr;
  1827. EFI_GET_TIME GetTime;
  1828. EFI_SET_TIME SetTime;
  1829. EFI_GET_WAKEUP_TIME GetWakeupTime;
  1830. EFI_SET_WAKEUP_TIME SetWakeupTime;
  1831. EFI_SET_VIRTUAL_ADDRESS_MAP SetVirtualAddressMap;
  1832. EFI_CONVERT_POINTER ConvertPointer;
  1833. EFI_GET_VARIABLE GetVariable;
  1834. EFI_GET_NEXT_VARIABLE_NAME GetNextVariableName;
  1835. EFI_SET_VARIABLE SetVariable;
  1836. EFI_GET_NEXT_HIGH_MONO_COUNT GetNextHighMonotonicCount;
  1837. EFI_RESET_SYSTEM ResetSystem;
  1838. EFI_UPDATE_CAPSULE UpdateCapsule;
  1839. EFI_QUERY_CAPSULE_CAPABILITIES QueryCapsuleCapabilities;
  1840. EFI_QUERY_VARIABLE_INFO QueryVariableInfo;
  1841. } EFI_RUNTIME_SERVICES;
  1842. /*++
  1843. Structure Description:
  1844. This structure defines the EFI Boot Services Table.
  1845. Members:
  1846. Hdr - Stores the standard header for an EFI table.
  1847. RaiseTPL - Stores a pointer to a function for raising the current Task
  1848. Priority Level.
  1849. RestoreTPL - Stores a pointer to a function for restoring a previous Task
  1850. Priority Level.
  1851. AllocatePages - Stores a pointer to a function for allocating pages from
  1852. EFI firmware.
  1853. FreePages - Stores a pointer to a function for freeing pages previously
  1854. allocated.
  1855. GetMemoryMap - Stores a pointer to a function for returning the current
  1856. memory map.
  1857. AllocatePool - Stores a pointer to a function for allocating heap memory.
  1858. FreePool - Stores a pointer to a function for freeing heap allocated
  1859. memory.
  1860. CreateEvent - Stores a pointer to a function for creating an event or
  1861. timer.
  1862. SetTimer - Stores a pointer to a function for setting the trigger on a
  1863. timer.
  1864. WaitForEvent - Stores a pointer to a function for waiting until an event
  1865. is triggered.
  1866. SignalEvent - Stores a pointer to a function for signaling an event.
  1867. CloseEvent - Stores a pointer to a function for closing an event.
  1868. CheckEvent - Stores a pointer to a function for determining if an event
  1869. is signaled.
  1870. InstallProtocolInterface - Stores a pointer to a function for adding
  1871. a protocol to a handle (or creating a new handle).
  1872. ReinstallProtocolInterface - Stores a pointer to a function for
  1873. reinstalling a protocol on a handle.
  1874. UninstallProtocolInterface - Stores a pointer to a function for removing
  1875. a protocol from a handle.
  1876. HandleProtocol - Stores a pointer to a function for determining if a
  1877. handle supports a given protocol.
  1878. Reserved - Stores a reserved pointer. Ignore this.
  1879. RegisterProtocolNotify - Stores a pointer to a function for registering
  1880. for notifications when a protocol is added to a handle.
  1881. LocateHandle - Stores a pointer to a function for locating a handle
  1882. associated with a protocol.
  1883. LocateDevicePath - Stores a pointer to a function for locating a handle on
  1884. a given device path that supports a given protocol.
  1885. InstallConfigurationTable - Stores a pointer to a function for adding a
  1886. configuration table to the firmware.
  1887. LoadImage - Stores a pointer to a function for loading a new EFI image.
  1888. StartImage - Stores a pointer to a function for starting a loaded EFI image.
  1889. Exit - Stores a pointer to a function for exiting an application.
  1890. UnloadImage - Stores a pointer to a function for unloading a loaded EFI
  1891. image.
  1892. ExitBootServices - Stores a pointer to a function for terminating boot
  1893. services.
  1894. GetNextMonotonicCount - Stores a pointer to a function for getting a
  1895. monotonically increasing value.
  1896. Stall - Stores a pointer to a function for performing fine-grained delays.
  1897. SetWatchdogTimer - Stores a pointer to a function for setting a platform
  1898. watchdog timer.
  1899. ConnectController - Stores a pointer to a function for connecting a driver
  1900. to a device controller handle.
  1901. DisconnectController - Stores a pointer to a function for disconnecting a
  1902. driver from a device controller handle.
  1903. OpenProtocol - Stores a pointer to a function for opening a protocol
  1904. interface on a handle.
  1905. CloseProtocol - Stores a pointer to a function for closing a previously
  1906. opened protocol interface on a handle.
  1907. OpenProtocolInformation - Stores a pointer to a function for getting a list
  1908. of agents that currently have a protocol interface opened.
  1909. ProtocolsPerHandle - Stores a pointer to a function for returning a list of
  1910. protocol interface GUIDs that are installed on a handle.
  1911. LocateHandleBuffer - Stores a pointer to a function for getting the list of
  1912. handles that support the requested protocol.
  1913. LocateProtocol - Stores a pointer to a function that returns the first
  1914. protocol instance that matches a given protocol.
  1915. InstallMultipleProtocolInterfaces - Stores a pointer to a function for
  1916. installing one or more protocol interfaces on a handle.
  1917. UninstallMultipleProtocolInterfaces - Stores a pointer to a function for
  1918. uninstalling one or more protocol interfaces from a handle.
  1919. CalculateCrc32 - Stores a pointer to a function for calculating the CRC32
  1920. of a given buffer.
  1921. CopyMem - Stores a pointer to a function for copying memory buffers.
  1922. SetMem - Stores a pointer to a function for initializing memory buffers.
  1923. CreateEventEx - Stores a pointer to a function for creating an event
  1924. optionally associated with a particular event group.
  1925. --*/
  1926. typedef struct {
  1927. EFI_TABLE_HEADER Hdr;
  1928. EFI_RAISE_TPL RaiseTPL;
  1929. EFI_RESTORE_TPL RestoreTPL;
  1930. EFI_ALLOCATE_PAGES AllocatePages;
  1931. EFI_FREE_PAGES FreePages;
  1932. EFI_GET_MEMORY_MAP GetMemoryMap;
  1933. EFI_ALLOCATE_POOL AllocatePool;
  1934. EFI_FREE_POOL FreePool;
  1935. EFI_CREATE_EVENT CreateEvent;
  1936. EFI_SET_TIMER SetTimer;
  1937. EFI_WAIT_FOR_EVENT WaitForEvent;
  1938. EFI_SIGNAL_EVENT SignalEvent;
  1939. EFI_CLOSE_EVENT CloseEvent;
  1940. EFI_CHECK_EVENT CheckEvent;
  1941. EFI_INSTALL_PROTOCOL_INTERFACE InstallProtocolInterface;
  1942. EFI_REINSTALL_PROTOCOL_INTERFACE ReinstallProtocolInterface;
  1943. EFI_UNINSTALL_PROTOCOL_INTERFACE UninstallProtocolInterface;
  1944. EFI_HANDLE_PROTOCOL HandleProtocol;
  1945. VOID *Reserved;
  1946. EFI_REGISTER_PROTOCOL_NOTIFY RegisterProtocolNotify;
  1947. EFI_LOCATE_HANDLE LocateHandle;
  1948. EFI_LOCATE_DEVICE_PATH LocateDevicePath;
  1949. EFI_INSTALL_CONFIGURATION_TABLE InstallConfigurationTable;
  1950. EFI_IMAGE_LOAD LoadImage;
  1951. EFI_IMAGE_START StartImage;
  1952. EFI_EXIT Exit;
  1953. EFI_IMAGE_UNLOAD UnloadImage;
  1954. EFI_EXIT_BOOT_SERVICES ExitBootServices;
  1955. EFI_GET_NEXT_MONOTONIC_COUNT GetNextMonotonicCount;
  1956. EFI_STALL Stall;
  1957. EFI_SET_WATCHDOG_TIMER SetWatchdogTimer;
  1958. EFI_CONNECT_CONTROLLER ConnectController;
  1959. EFI_DISCONNECT_CONTROLLER DisconnectController;
  1960. EFI_OPEN_PROTOCOL OpenProtocol;
  1961. EFI_CLOSE_PROTOCOL CloseProtocol;
  1962. EFI_OPEN_PROTOCOL_INFORMATION OpenProtocolInformation;
  1963. EFI_PROTOCOLS_PER_HANDLE ProtocolsPerHandle;
  1964. EFI_LOCATE_HANDLE_BUFFER LocateHandleBuffer;
  1965. EFI_LOCATE_PROTOCOL LocateProtocol;
  1966. EFI_INSTALL_MULTIPLE_PROTOCOL_INTERFACES InstallMultipleProtocolInterfaces;
  1967. EFI_UNINSTALL_MULTIPLE_PROTOCOL_INTERFACES
  1968. UninstallMultipleProtocolInterfaces;
  1969. EFI_CALCULATE_CRC32 CalculateCrc32;
  1970. EFI_COPY_MEM CopyMem;
  1971. EFI_SET_MEM SetMem;
  1972. EFI_CREATE_EVENT_EX CreateEventEx;
  1973. } EFI_BOOT_SERVICES;
  1974. /*++
  1975. Structure Description:
  1976. This structure defines a set consisting of a GUID and a pointer defining
  1977. a configuration table in the EFI System Table.
  1978. Members:
  1979. VendorGuid - Stores the GUID identifying the configuration table.
  1980. VendorTable - Stores a pointer to the configuration table.
  1981. --*/
  1982. typedef struct {
  1983. EFI_GUID VendorGuid;
  1984. VOID *VendorTable;
  1985. } EFI_CONFIGURATION_TABLE;
  1986. /*++
  1987. Structure Description:
  1988. This structure defines the EFI System Table.
  1989. Members:
  1990. Hdr - Stores the standard EFI table header.
  1991. FirmwareVendor - Stores a pointer to a null terminated string identifying
  1992. the vendor that produces the firmware for the platform.
  1993. FirmwareRevision - Stores a firmware vendor specific value identifying the
  1994. revision of the system firmware on this platform.
  1995. ConsoleInHandle - Stores the handle for the active console input device.
  1996. This handle must support EFI_SIMPLE_TEXT_INPUT_PROTOCOL and
  1997. EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL.
  1998. ConIn - Stores a pointer to the EFI_SIMPLE_TEXT_INPUT_PROTOCOL interface
  1999. associated with the console in handle.
  2000. ConsoleOutHandle - Stores the handle for the active console output device.
  2001. ConOut - Stores a pointer to the EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL interface
  2002. associated with the console out handle.
  2003. StandardErrorHandle - Stores the handle for the active standard error
  2004. console device. This device must support the
  2005. EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL.
  2006. StdErr - Stores a pointer to the EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL interface
  2007. that is associated with StandardErrorHandle.
  2008. RuntimeServices - Stores a pointer to the EFI Runtime Services Table.
  2009. BootServices - Stores a pointer to the EFI Boot Services Table.
  2010. NumberOfTableEntries - Stores the number of system configuration tables in
  2011. the configuration table buffer.
  2012. ConfigurationTable - Stores a pointer to the array of system configuration
  2013. tables.
  2014. --*/
  2015. typedef struct {
  2016. EFI_TABLE_HEADER Hdr;
  2017. CHAR16 *FirmwareVendor;
  2018. UINT32 FirmwareRevision;
  2019. EFI_HANDLE ConsoleInHandle;
  2020. EFI_SIMPLE_TEXT_INPUT_PROTOCOL *ConIn;
  2021. EFI_HANDLE ConsoleOutHandle;
  2022. EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *ConOut;
  2023. EFI_HANDLE StandardErrorHandle;
  2024. EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *StdErr;
  2025. EFI_RUNTIME_SERVICES *RuntimeServices;
  2026. EFI_BOOT_SERVICES *BootServices;
  2027. UINTN NumberOfTableEntries;
  2028. EFI_CONFIGURATION_TABLE *ConfigurationTable;
  2029. } EFI_SYSTEM_TABLE;
  2030. typedef
  2031. EFI_STATUS
  2032. (EFIAPI *EFI_IMAGE_ENTRY_POINT) (
  2033. EFI_HANDLE ImageHandle,
  2034. EFI_SYSTEM_TABLE *SystemTable
  2035. );
  2036. /*++
  2037. Routine Description:
  2038. This routine is an entry point into an EFI image. The entry point is the
  2039. same for UEFI Applications, UEFI OS Loaders, and UEFI Drivers (both
  2040. device and bus drivers).
  2041. Arguments:
  2042. ImageHandle - Supplies the firmware allocated handle associated with this
  2043. (just entered) UEFI image.
  2044. SystemTable - Supplies a pointer to the EFI System Table.
  2045. Return Value:
  2046. EFI_SUCCESS if the operation completed successfully.
  2047. Other error codes if an unexpected error occurred.
  2048. --*/
  2049. /*++
  2050. Union Description:
  2051. This union defines EFI Boot Key Data.
  2052. Members:
  2053. Options - Stores boot key options.
  2054. Revision - Stores the revision of the EFI_KEY_OPTION structure.
  2055. Currently 0.
  2056. ShiftPressed - Stores a bit indicating either the left or right shift
  2057. key is pressed.
  2058. ControlPressed - Stores a bit indicating either the left or right
  2059. control key is pressed.
  2060. AltPressed - Stores a bit indicating either the left or right alt key
  2061. is pressed.
  2062. LogoPressed - Stores a bit indicating either the left or right Logo key
  2063. is pressed.
  2064. MenuPressed - Stores a bit indicating that the menu key is pressed.
  2065. SysReqPressed - Stores a bit indicating the SysReq key is pressed.
  2066. Reserved - Stores bits reserved for future use.
  2067. InputKeyCount - Stores the number of entries in the Keys member of
  2068. the EFI_KEY_OPTION structure. Valid values are between 0 and 3,
  2069. inclusive. If zero, then only the shift state is considered. If
  2070. more than one, the boot option will only be launched if all the
  2071. specified keys are pressed with the same shift state.
  2072. PackedValue - Stores the packed representation of the options.
  2073. --*/
  2074. typedef union {
  2075. struct {
  2076. UINT32 Revision:8;
  2077. UINT32 ShiftPressed:1;
  2078. UINT32 ControlPressed:1;
  2079. UINT32 AltPressed:1;
  2080. UINT32 LogoPressed:1;
  2081. UINT32 MenuPressed:1;
  2082. UINT32 SysReqPressed:1;
  2083. UINT32 Reserved:16;
  2084. UINT32 InputKeyCount:2;
  2085. } Options;
  2086. UINT32 PackedValue;
  2087. } EFI_BOOT_KEY_DATA;
  2088. /*++
  2089. Structure Description:
  2090. This structure defines an EFI Boot Key Option.
  2091. Members:
  2092. KeyData - Stores options about how the key will be processed.
  2093. BootOptionCrc - Stores the CRC32 of the entire EFI_LOAD_OPTION to which
  2094. this boot option refers. If the CRCs do mot match this value, then this
  2095. key option is ignored.
  2096. BootOption - Stores the Boot#### option which will be invoked if this key
  2097. is pressed and the boot option is active (LOAD_OPTION_ACTIVE is set).
  2098. Keys - Stores the key codes to compare against those returned by the
  2099. EFI_SIMPLE_TEXT_INPUT and EFI_SIMPLE_TEXT_INPUT_EX protocols. The
  2100. number of key codes (0-3) is specified by the EFI_KEY_CODE_COUNT
  2101. field in the key options.
  2102. --*/
  2103. typedef struct {
  2104. EFI_BOOT_KEY_DATA KeyData;
  2105. UINT32 BootOptionCrc;
  2106. UINT16 BootOption;
  2107. //EFI_INPUT_KEY Keys[];
  2108. } PACKED EFI_KEY_OPTION;
  2109. //
  2110. // -------------------------------------------------------------------- Globals
  2111. //
  2112. //
  2113. // -------------------------------------------------------- Function Prototypes
  2114. //