spec.h 81 KB

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