efiprot.h 44 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466
  1. #ifndef _EFI_PROT_H
  2. #define _EFI_PROT_H
  3. /*++
  4. Copyright (c) 1998 Intel Corporation
  5. Module Name:
  6. efiprot.h
  7. Abstract:
  8. EFI Protocols
  9. Revision History
  10. --*/
  11. //
  12. // FPSWA library protocol
  13. //
  14. #define EFI_FPSWA_PROTOCOL_GUID \
  15. { 0xc41b6531, 0x97b9, 0x11d3, {0x9a, 0x29, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d} }
  16. #define FPSWA_PROTOCOL EFI_FPSWA_PROTOCOL_GUID
  17. //
  18. // Device Path protocol
  19. //
  20. #define EFI_DEVICE_PATH_PROTOCOL_GUID \
  21. { 0x9576e91, 0x6d3f, 0x11d2, {0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b} }
  22. #define DEVICE_PATH_PROTOCOL EFI_DEVICE_PATH_PROTOCOL_GUID
  23. //
  24. // Block IO protocol
  25. //
  26. #define EFI_BLOCK_IO_PROTOCOL_GUID \
  27. { 0x964e5b21, 0x6459, 0x11d2, {0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b} }
  28. #define BLOCK_IO_PROTOCOL EFI_BLOCK_IO_PROTOCOL_GUID
  29. #define EFI_BLOCK_IO_PROTOCOL_REVISION 0x00010000
  30. #define EFI_BLOCK_IO_PROTOCOL_REVISION2 0x00020001
  31. #define EFI_BLOCK_IO_PROTOCOL_REVISION3 ((2<<16) | 31)
  32. #define EFI_BLOCK_IO_INTERFACE_REVISION EFI_BLOCK_IO_PROTOCOL_REVISION
  33. #define EFI_BLOCK_IO_INTERFACE_REVISION2 EFI_BLOCK_IO_PROTOCOL_REVISION2
  34. #define EFI_BLOCK_IO_INTERFACE_REVISION3 EFI_BLOCK_IO_PROTOCOL_REVISION3
  35. INTERFACE_DECL(_EFI_BLOCK_IO_PROTOCOL);
  36. typedef
  37. EFI_STATUS
  38. (EFIAPI *EFI_BLOCK_RESET) (
  39. IN struct _EFI_BLOCK_IO_PROTOCOL *This,
  40. IN BOOLEAN ExtendedVerification
  41. );
  42. typedef
  43. EFI_STATUS
  44. (EFIAPI *EFI_BLOCK_READ) (
  45. IN struct _EFI_BLOCK_IO_PROTOCOL *This,
  46. IN UINT32 MediaId,
  47. IN EFI_LBA LBA,
  48. IN UINTN BufferSize,
  49. OUT VOID *Buffer
  50. );
  51. typedef
  52. EFI_STATUS
  53. (EFIAPI *EFI_BLOCK_WRITE) (
  54. IN struct _EFI_BLOCK_IO_PROTOCOL *This,
  55. IN UINT32 MediaId,
  56. IN EFI_LBA LBA,
  57. IN UINTN BufferSize,
  58. IN VOID *Buffer
  59. );
  60. typedef
  61. EFI_STATUS
  62. (EFIAPI *EFI_BLOCK_FLUSH) (
  63. IN struct _EFI_BLOCK_IO_PROTOCOL *This
  64. );
  65. typedef struct {
  66. UINT32 MediaId;
  67. BOOLEAN RemovableMedia;
  68. BOOLEAN MediaPresent;
  69. BOOLEAN LogicalPartition;
  70. BOOLEAN ReadOnly;
  71. BOOLEAN WriteCaching;
  72. UINT32 BlockSize;
  73. UINT32 IoAlign;
  74. EFI_LBA LastBlock;
  75. /* revision 2 */
  76. EFI_LBA LowestAlignedLba;
  77. UINT32 LogicalBlocksPerPhysicalBlock;
  78. /* revision 3 */
  79. UINT32 OptimalTransferLengthGranularity;
  80. } EFI_BLOCK_IO_MEDIA;
  81. typedef struct _EFI_BLOCK_IO_PROTOCOL {
  82. UINT64 Revision;
  83. EFI_BLOCK_IO_MEDIA *Media;
  84. EFI_BLOCK_RESET Reset;
  85. EFI_BLOCK_READ ReadBlocks;
  86. EFI_BLOCK_WRITE WriteBlocks;
  87. EFI_BLOCK_FLUSH FlushBlocks;
  88. } EFI_BLOCK_IO_PROTOCOL;
  89. typedef struct _EFI_BLOCK_IO_PROTOCOL _EFI_BLOCK_IO;
  90. typedef EFI_BLOCK_IO_PROTOCOL EFI_BLOCK_IO;
  91. #define EFI_BLOCK_IO2_PROTOCOL_GUID \
  92. { 0xa77b2472, 0xe282, 0x4e9f, {0xa2, 0x45, 0xc2, 0xc0, 0xe2, 0x7b, 0xbc, 0xc1} }
  93. INTERFACE_DECL(_EFI_BLOCK_IO2_PROTOCOL);
  94. typedef struct {
  95. EFI_EVENT Event;
  96. EFI_STATUS TransactionStatus;
  97. } EFI_BLOCK_IO2_TOKEN;
  98. typedef
  99. EFI_STATUS
  100. (EFIAPI *EFI_BLOCK_RESET_EX) (
  101. IN struct _EFI_BLOCK_IO2_PROTOCOL *This,
  102. IN BOOLEAN ExtendedVerification
  103. );
  104. typedef
  105. EFI_STATUS
  106. (EFIAPI *EFI_BLOCK_READ_EX) (
  107. IN struct _EFI_BLOCK_IO2_PROTOCOL *This,
  108. IN UINT32 MediaId,
  109. IN EFI_LBA LBA,
  110. IN OUT EFI_BLOCK_IO2_TOKEN *Token,
  111. IN UINTN BufferSize,
  112. OUT VOID *Buffer
  113. );
  114. typedef
  115. EFI_STATUS
  116. (EFIAPI *EFI_BLOCK_WRITE_EX) (
  117. IN struct _EFI_BLOCK_IO2_PROTOCOL *This,
  118. IN UINT32 MediaId,
  119. IN EFI_LBA LBA,
  120. IN OUT EFI_BLOCK_IO2_TOKEN *Token,
  121. IN UINTN BufferSize,
  122. IN VOID *Buffer
  123. );
  124. typedef
  125. EFI_STATUS
  126. (EFIAPI *EFI_BLOCK_FLUSH_EX) (
  127. IN struct _EFI_BLOCK_IO2_PROTOCOL *This,
  128. IN OUT EFI_BLOCK_IO2_TOKEN *Token
  129. );
  130. typedef struct _EFI_BLOCK_IO2_PROTOCOL {
  131. EFI_BLOCK_IO_MEDIA *Media;
  132. EFI_BLOCK_RESET_EX Reset;
  133. EFI_BLOCK_READ_EX ReadBlocksEx;
  134. EFI_BLOCK_WRITE_EX WriteBlocksEx;
  135. EFI_BLOCK_FLUSH_EX FlushBlocksEx;
  136. } EFI_BLOCK_IO2_PROTOCOL;
  137. //
  138. // Disk Block IO protocol
  139. //
  140. #define EFI_DISK_IO_PROTOCOL_GUID \
  141. { 0xce345171, 0xba0b, 0x11d2, {0x8e, 0x4f, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b} }
  142. #define DISK_IO_PROTOCOL EFI_DISK_IO_PROTOCOL_GUID
  143. #define EFI_DISK_IO_PROTOCOL_REVISION 0x00010000
  144. #define EFI_DISK_IO_INTERFACE_REVISION EFI_DISK_IO_PROTOCOL_REVISION
  145. INTERFACE_DECL(_EFI_DISK_IO_PROTOCOL);
  146. typedef
  147. EFI_STATUS
  148. (EFIAPI *EFI_DISK_READ) (
  149. IN struct _EFI_DISK_IO_PROTOCOL *This,
  150. IN UINT32 MediaId,
  151. IN UINT64 Offset,
  152. IN UINTN BufferSize,
  153. OUT VOID *Buffer
  154. );
  155. typedef
  156. EFI_STATUS
  157. (EFIAPI *EFI_DISK_WRITE) (
  158. IN struct _EFI_DISK_IO_PROTOCOL *This,
  159. IN UINT32 MediaId,
  160. IN UINT64 Offset,
  161. IN UINTN BufferSize,
  162. IN VOID *Buffer
  163. );
  164. typedef struct _EFI_DISK_IO_PROTOCOL {
  165. UINT64 Revision;
  166. EFI_DISK_READ ReadDisk;
  167. EFI_DISK_WRITE WriteDisk;
  168. } EFI_DISK_IO_PROTOCOL;
  169. typedef struct _EFI_DISK_IO_PROTOCOL _EFI_DISK_IO;
  170. typedef EFI_DISK_IO_PROTOCOL EFI_DISK_IO;
  171. #define EFI_DISK_IO2_PROTOCOL_GUID \
  172. { 0x151c8eae, 0x7f2c, 0x472c, {0x9e, 0x54, 0x98, 0x28, 0x19, 0x4f, 0x6a, 0x88} }
  173. #define EFI_DISK_IO2_PROTOCOL_REVISION 0x00020000
  174. INTERFACE_DECL(_EFI_DISK_IO2_PROTOCOL);
  175. typedef struct {
  176. EFI_EVENT Event;
  177. EFI_STATUS TransactionStatus;
  178. } EFI_DISK_IO2_TOKEN;
  179. typedef
  180. EFI_STATUS
  181. (EFIAPI *EFI_DISK_CANCEL_EX) (
  182. IN struct _EFI_DISK_IO2_PROTOCOL *This
  183. );
  184. typedef
  185. EFI_STATUS
  186. (EFIAPI *EFI_DISK_READ_EX) (
  187. IN struct _EFI_DISK_IO2_PROTOCOL *This,
  188. IN UINT32 MediaId,
  189. IN UINT64 Offset,
  190. IN OUT EFI_DISK_IO2_TOKEN *Token,
  191. IN UINTN BufferSize,
  192. OUT VOID *Buffer
  193. );
  194. typedef
  195. EFI_STATUS
  196. (EFIAPI *EFI_DISK_WRITE_EX) (
  197. IN struct _EFI_DISK_IO2_PROTOCOL *This,
  198. IN UINT32 MediaId,
  199. IN UINT64 Offset,
  200. IN OUT EFI_DISK_IO2_TOKEN *Token,
  201. IN UINTN BufferSize,
  202. IN VOID *Buffer
  203. );
  204. typedef
  205. EFI_STATUS
  206. (EFIAPI *EFI_DISK_FLUSH_EX) (
  207. IN struct _EFI_DISK_IO2_PROTOCOL *This,
  208. IN OUT EFI_DISK_IO2_TOKEN *Token
  209. );
  210. typedef struct _EFI_DISK_IO2_PROTOCOL {
  211. UINT64 Revision;
  212. EFI_DISK_CANCEL_EX Cancel;
  213. EFI_DISK_READ_EX ReadDiskEx;
  214. EFI_DISK_WRITE_EX WriteDiskEx;
  215. EFI_DISK_FLUSH_EX FlushDiskEx;
  216. } EFI_DISK_IO2_PROTOCOL;
  217. //
  218. // Simple file system protocol
  219. //
  220. #define EFI_SIMPLE_FILE_SYSTEM_PROTOCOL_GUID \
  221. { 0x964e5b22, 0x6459, 0x11d2, {0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b} }
  222. #define SIMPLE_FILE_SYSTEM_PROTOCOL EFI_SIMPLE_FILE_SYSTEM_PROTOCOL_GUID
  223. INTERFACE_DECL(_EFI_SIMPLE_FILE_SYSTEM_PROTOCOL);
  224. INTERFACE_DECL(_EFI_FILE_HANDLE);
  225. typedef
  226. EFI_STATUS
  227. (EFIAPI *EFI_VOLUME_OPEN) (
  228. IN struct _EFI_SIMPLE_FILE_SYSTEM_PROTOCOL *This,
  229. OUT struct _EFI_FILE_HANDLE **Root
  230. );
  231. #define EFI_SIMPLE_FILE_SYSTEM_PROTOCOL_REVISION 0x00010000
  232. #define EFI_FILE_IO_INTERFACE_REVISION EFI_SIMPLE_FILE_SYSTEM_PROTOCOL_REVISION
  233. typedef struct _EFI_SIMPLE_FILE_SYSTEM_PROTOCOL {
  234. UINT64 Revision;
  235. EFI_VOLUME_OPEN OpenVolume;
  236. } EFI_SIMPLE_FILE_SYSTEM_PROTOCOL;
  237. typedef struct _EFI_SIMPLE_FILE_SYSTEM_PROTOCOL _EFI_FILE_IO_INTERFACE;
  238. typedef EFI_SIMPLE_FILE_SYSTEM_PROTOCOL EFI_FILE_IO_INTERFACE;
  239. //
  240. //
  241. //
  242. typedef
  243. EFI_STATUS
  244. (EFIAPI *EFI_FILE_OPEN) (
  245. IN struct _EFI_FILE_HANDLE *File,
  246. OUT struct _EFI_FILE_HANDLE **NewHandle,
  247. IN CHAR16 *FileName,
  248. IN UINT64 OpenMode,
  249. IN UINT64 Attributes
  250. );
  251. // Open modes
  252. #define EFI_FILE_MODE_READ 0x0000000000000001
  253. #define EFI_FILE_MODE_WRITE 0x0000000000000002
  254. #define EFI_FILE_MODE_CREATE 0x8000000000000000
  255. // File attributes
  256. #define EFI_FILE_READ_ONLY 0x0000000000000001
  257. #define EFI_FILE_HIDDEN 0x0000000000000002
  258. #define EFI_FILE_SYSTEM 0x0000000000000004
  259. #define EFI_FILE_RESERVIED 0x0000000000000008
  260. #define EFI_FILE_DIRECTORY 0x0000000000000010
  261. #define EFI_FILE_ARCHIVE 0x0000000000000020
  262. #define EFI_FILE_VALID_ATTR 0x0000000000000037
  263. typedef
  264. EFI_STATUS
  265. (EFIAPI *EFI_FILE_CLOSE) (
  266. IN struct _EFI_FILE_HANDLE *File
  267. );
  268. typedef
  269. EFI_STATUS
  270. (EFIAPI *EFI_FILE_DELETE) (
  271. IN struct _EFI_FILE_HANDLE *File
  272. );
  273. typedef
  274. EFI_STATUS
  275. (EFIAPI *EFI_FILE_READ) (
  276. IN struct _EFI_FILE_HANDLE *File,
  277. IN OUT UINTN *BufferSize,
  278. OUT VOID *Buffer
  279. );
  280. typedef
  281. EFI_STATUS
  282. (EFIAPI *EFI_FILE_WRITE) (
  283. IN struct _EFI_FILE_HANDLE *File,
  284. IN OUT UINTN *BufferSize,
  285. IN VOID *Buffer
  286. );
  287. typedef
  288. EFI_STATUS
  289. (EFIAPI *EFI_FILE_SET_POSITION) (
  290. IN struct _EFI_FILE_HANDLE *File,
  291. IN UINT64 Position
  292. );
  293. typedef
  294. EFI_STATUS
  295. (EFIAPI *EFI_FILE_GET_POSITION) (
  296. IN struct _EFI_FILE_HANDLE *File,
  297. OUT UINT64 *Position
  298. );
  299. typedef
  300. EFI_STATUS
  301. (EFIAPI *EFI_FILE_GET_INFO) (
  302. IN struct _EFI_FILE_HANDLE *File,
  303. IN EFI_GUID *InformationType,
  304. IN OUT UINTN *BufferSize,
  305. OUT VOID *Buffer
  306. );
  307. typedef
  308. EFI_STATUS
  309. (EFIAPI *EFI_FILE_SET_INFO) (
  310. IN struct _EFI_FILE_HANDLE *File,
  311. IN EFI_GUID *InformationType,
  312. IN UINTN BufferSize,
  313. IN VOID *Buffer
  314. );
  315. typedef
  316. EFI_STATUS
  317. (EFIAPI *EFI_FILE_FLUSH) (
  318. IN struct _EFI_FILE_HANDLE *File
  319. );
  320. typedef struct {
  321. EFI_EVENT Event;
  322. EFI_STATUS Status;
  323. UINTN BufferSize;
  324. VOID *Buffer;
  325. } EFI_FILE_IO_TOKEN;
  326. typedef
  327. EFI_STATUS
  328. (EFIAPI *EFI_FILE_OPEN_EX)(
  329. IN struct _EFI_FILE_HANDLE *File,
  330. OUT struct _EFI_FILE_HANDLE **NewHandle,
  331. IN CHAR16 *FileName,
  332. IN UINT64 OpenMode,
  333. IN UINT64 Attributes,
  334. IN OUT EFI_FILE_IO_TOKEN *Token
  335. );
  336. typedef
  337. EFI_STATUS
  338. (EFIAPI *EFI_FILE_READ_EX) (
  339. IN struct _EFI_FILE_HANDLE *File,
  340. IN OUT EFI_FILE_IO_TOKEN *Token
  341. );
  342. typedef
  343. EFI_STATUS
  344. (EFIAPI *EFI_FILE_WRITE_EX) (
  345. IN struct _EFI_FILE_HANDLE *File,
  346. IN OUT EFI_FILE_IO_TOKEN *Token
  347. );
  348. typedef
  349. EFI_STATUS
  350. (EFIAPI *EFI_FILE_FLUSH_EX) (
  351. IN struct _EFI_FILE_HANDLE *File,
  352. IN OUT EFI_FILE_IO_TOKEN *Token
  353. );
  354. #define EFI_FILE_PROTOCOL_REVISION 0x00010000
  355. #define EFI_FILE_PROTOCOL_REVISION2 0x00020000
  356. #define EFI_FILE_PROTOCOL_LATEST_REVISION EFI_FILE_PROTOCOL_REVISION2
  357. #define EFI_FILE_HANDLE_REVISION EFI_FILE_PROTOCOL_REVISION
  358. typedef struct _EFI_FILE_HANDLE {
  359. UINT64 Revision;
  360. EFI_FILE_OPEN Open;
  361. EFI_FILE_CLOSE Close;
  362. EFI_FILE_DELETE Delete;
  363. EFI_FILE_READ Read;
  364. EFI_FILE_WRITE Write;
  365. EFI_FILE_GET_POSITION GetPosition;
  366. EFI_FILE_SET_POSITION SetPosition;
  367. EFI_FILE_GET_INFO GetInfo;
  368. EFI_FILE_SET_INFO SetInfo;
  369. EFI_FILE_FLUSH Flush;
  370. EFI_FILE_OPEN_EX OpenEx;
  371. EFI_FILE_READ_EX ReadEx;
  372. EFI_FILE_WRITE_EX WriteEx;
  373. EFI_FILE_FLUSH_EX FlushEx;
  374. } EFI_FILE_PROTOCOL, *EFI_FILE_HANDLE;
  375. typedef EFI_FILE_PROTOCOL EFI_FILE;
  376. //
  377. // File information types
  378. //
  379. #define EFI_FILE_INFO_ID \
  380. { 0x9576e92, 0x6d3f, 0x11d2, {0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b} }
  381. typedef struct {
  382. UINT64 Size;
  383. UINT64 FileSize;
  384. UINT64 PhysicalSize;
  385. EFI_TIME CreateTime;
  386. EFI_TIME LastAccessTime;
  387. EFI_TIME ModificationTime;
  388. UINT64 Attribute;
  389. CHAR16 FileName[1];
  390. } EFI_FILE_INFO;
  391. //
  392. // The FileName field of the EFI_FILE_INFO data structure is variable length.
  393. // Whenever code needs to know the size of the EFI_FILE_INFO data structure, it needs to
  394. // be the size of the data structure without the FileName field. The following macro
  395. // computes this size correctly no matter how big the FileName array is declared.
  396. // This is required to make the EFI_FILE_INFO data structure ANSI compilant.
  397. //
  398. #define SIZE_OF_EFI_FILE_INFO EFI_FIELD_OFFSET(EFI_FILE_INFO,FileName)
  399. #define EFI_FILE_SYSTEM_INFO_ID \
  400. { 0x9576e93, 0x6d3f, 0x11d2, {0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b} }
  401. typedef struct {
  402. UINT64 Size;
  403. BOOLEAN ReadOnly;
  404. UINT64 VolumeSize;
  405. UINT64 FreeSpace;
  406. UINT32 BlockSize;
  407. CHAR16 VolumeLabel[1];
  408. } EFI_FILE_SYSTEM_INFO;
  409. //
  410. // The VolumeLabel field of the EFI_FILE_SYSTEM_INFO data structure is variable length.
  411. // Whenever code needs to know the size of the EFI_FILE_SYSTEM_INFO data structure, it needs
  412. // to be the size of the data structure without the VolumeLable field. The following macro
  413. // computes this size correctly no matter how big the VolumeLable array is declared.
  414. // This is required to make the EFI_FILE_SYSTEM_INFO data structure ANSI compilant.
  415. //
  416. #define SIZE_OF_EFI_FILE_SYSTEM_INFO EFI_FIELD_OFFSET(EFI_FILE_SYSTEM_INFO,VolumeLabel)
  417. #define EFI_FILE_SYSTEM_VOLUME_LABEL_ID \
  418. { 0xDB47D7D3,0xFE81, 0x11d3, {0x9A, 0x35, 0x00, 0x90, 0x27, 0x3F, 0xC1, 0x4D} }
  419. typedef struct {
  420. CHAR16 VolumeLabel[1];
  421. } EFI_FILE_SYSTEM_VOLUME_LABEL;
  422. #define SIZE_OF_EFI_FILE_SYSTEM_VOLUME_LABEL_INFO EFI_FIELD_OFFSET(EFI_FILE_SYSTEM_VOLUME_LABEL,VolumeLabel)
  423. //
  424. // For compatibility with older versions of gnu-efi
  425. //
  426. #define EFI_FILE_SYSTEM_VOLUME_LABEL_INFO_ID EFI_FILE_SYSTEM_VOLUME_LABEL_ID
  427. #define EFI_FILE_SYSTEM_VOLUME_LABEL_INFO EFI_FILE_SYSTEM_VOLUME_LABEL
  428. //
  429. // Load file protocol
  430. //
  431. #define EFI_LOAD_FILE_PROTOCOL_GUID \
  432. { 0x56EC3091, 0x954C, 0x11d2, {0x8E, 0x3F, 0x00, 0xA0, 0xC9, 0x69, 0x72, 0x3B} }
  433. #define LOAD_FILE_PROTOCOL EFI_LOAD_FILE_PROTOCOL_GUID
  434. INTERFACE_DECL(_EFI_LOAD_FILE_PROTOCOL);
  435. typedef
  436. EFI_STATUS
  437. (EFIAPI *EFI_LOAD_FILE) (
  438. IN struct _EFI_LOAD_FILE_PROTOCOL *This,
  439. IN EFI_DEVICE_PATH *FilePath,
  440. IN BOOLEAN BootPolicy,
  441. IN OUT UINTN *BufferSize,
  442. IN VOID *Buffer OPTIONAL
  443. );
  444. typedef struct _EFI_LOAD_FILE_PROTOCOL {
  445. EFI_LOAD_FILE LoadFile;
  446. } EFI_LOAD_FILE_PROTOCOL;
  447. typedef struct _EFI_LOAD_FILE_PROTOCOL _EFI_LOAD_FILE_INTERFACE;
  448. typedef EFI_LOAD_FILE_PROTOCOL EFI_LOAD_FILE_INTERFACE;
  449. //
  450. // Device IO protocol
  451. //
  452. #define EFI_DEVICE_IO_PROTOCOL_GUID \
  453. { 0xaf6ac311, 0x84c3, 0x11d2, {0x8e, 0x3c, 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b} }
  454. #define DEVICE_IO_PROTOCOL EFI_DEVICE_IO_PROTOCOL_GUID
  455. INTERFACE_DECL(_EFI_DEVICE_IO_PROTOCOL);
  456. typedef enum {
  457. IO_UINT8,
  458. IO_UINT16,
  459. IO_UINT32,
  460. IO_UINT64,
  461. //
  462. // Specification Change: Copy from MMIO to MMIO vs. MMIO to buffer, buffer to MMIO
  463. //
  464. MMIO_COPY_UINT8,
  465. MMIO_COPY_UINT16,
  466. MMIO_COPY_UINT32,
  467. MMIO_COPY_UINT64
  468. } EFI_IO_WIDTH;
  469. #define EFI_PCI_ADDRESS(_bus,_dev,_func) \
  470. ( (UINT64) ( (((UINTN)_bus) << 24) + (((UINTN)_dev) << 16) + (((UINTN)_func) << 8) ) )
  471. typedef
  472. EFI_STATUS
  473. (EFIAPI *EFI_DEVICE_IO) (
  474. IN struct _EFI_DEVICE_IO_PROTOCOL *This,
  475. IN EFI_IO_WIDTH Width,
  476. IN UINT64 Address,
  477. IN UINTN Count,
  478. IN OUT VOID *Buffer
  479. );
  480. typedef struct {
  481. EFI_DEVICE_IO Read;
  482. EFI_DEVICE_IO Write;
  483. } EFI_IO_ACCESS;
  484. typedef
  485. EFI_STATUS
  486. (EFIAPI *EFI_PCI_DEVICE_PATH) (
  487. IN struct _EFI_DEVICE_IO_PROTOCOL *This,
  488. IN UINT64 Address,
  489. IN OUT EFI_DEVICE_PATH **PciDevicePath
  490. );
  491. typedef enum {
  492. EfiBusMasterRead,
  493. EfiBusMasterWrite,
  494. EfiBusMasterCommonBuffer
  495. } EFI_IO_OPERATION_TYPE;
  496. typedef
  497. EFI_STATUS
  498. (EFIAPI *EFI_IO_MAP) (
  499. IN struct _EFI_DEVICE_IO_PROTOCOL *This,
  500. IN EFI_IO_OPERATION_TYPE Operation,
  501. IN EFI_PHYSICAL_ADDRESS *HostAddress,
  502. IN OUT UINTN *NumberOfBytes,
  503. OUT EFI_PHYSICAL_ADDRESS *DeviceAddress,
  504. OUT VOID **Mapping
  505. );
  506. typedef
  507. EFI_STATUS
  508. (EFIAPI *EFI_IO_UNMAP) (
  509. IN struct _EFI_DEVICE_IO_PROTOCOL *This,
  510. IN VOID *Mapping
  511. );
  512. typedef
  513. EFI_STATUS
  514. (EFIAPI *EFI_IO_ALLOCATE_BUFFER) (
  515. IN struct _EFI_DEVICE_IO_PROTOCOL *This,
  516. IN EFI_ALLOCATE_TYPE Type,
  517. IN EFI_MEMORY_TYPE MemoryType,
  518. IN UINTN Pages,
  519. IN OUT EFI_PHYSICAL_ADDRESS *HostAddress
  520. );
  521. typedef
  522. EFI_STATUS
  523. (EFIAPI *EFI_IO_FLUSH) (
  524. IN struct _EFI_DEVICE_IO_PROTOCOL *This
  525. );
  526. typedef
  527. EFI_STATUS
  528. (EFIAPI *EFI_IO_FREE_BUFFER) (
  529. IN struct _EFI_DEVICE_IO_PROTOCOL *This,
  530. IN UINTN Pages,
  531. IN EFI_PHYSICAL_ADDRESS HostAddress
  532. );
  533. typedef struct _EFI_DEVICE_IO_PROTOCOL {
  534. EFI_IO_ACCESS Mem;
  535. EFI_IO_ACCESS Io;
  536. EFI_IO_ACCESS Pci;
  537. EFI_IO_MAP Map;
  538. EFI_PCI_DEVICE_PATH PciDevicePath;
  539. EFI_IO_UNMAP Unmap;
  540. EFI_IO_ALLOCATE_BUFFER AllocateBuffer;
  541. EFI_IO_FLUSH Flush;
  542. EFI_IO_FREE_BUFFER FreeBuffer;
  543. } EFI_DEVICE_IO_PROTOCOL;
  544. typedef struct _EFI_DEVICE_IO_PROTOCOL _EFI_DEVICE_IO_INTERFACE;
  545. typedef EFI_DEVICE_IO_PROTOCOL EFI_DEVICE_IO_INTERFACE;
  546. //
  547. // Unicode Collation protocol
  548. //
  549. #define EFI_UNICODE_COLLATION_PROTOCOL_GUID \
  550. { 0x1d85cd7f, 0xf43d, 0x11d2, {0x9a, 0xc, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d} }
  551. #define UNICODE_COLLATION_PROTOCOL EFI_UNICODE_COLLATION_PROTOCOL_GUID
  552. #define EFI_UNICODE_BYTE_ORDER_MARK (CHAR16)(0xfeff)
  553. #define UNICODE_BYTE_ORDER_MARK EFI_UNICODE_BYTE_ORDER_MARK
  554. INTERFACE_DECL(_EFI_UNICODE_COLLATION_PROTOCOL);
  555. typedef
  556. INTN
  557. (EFIAPI *EFI_UNICODE_STRICOLL) (
  558. IN struct _EFI_UNICODE_COLLATION_PROTOCOL *This,
  559. IN CHAR16 *s1,
  560. IN CHAR16 *s2
  561. );
  562. typedef
  563. BOOLEAN
  564. (EFIAPI *EFI_UNICODE_METAIMATCH) (
  565. IN struct _EFI_UNICODE_COLLATION_PROTOCOL *This,
  566. IN CHAR16 *String,
  567. IN CHAR16 *Pattern
  568. );
  569. typedef
  570. VOID
  571. (EFIAPI *EFI_UNICODE_STRLWR) (
  572. IN struct _EFI_UNICODE_COLLATION_PROTOCOL *This,
  573. IN OUT CHAR16 *Str
  574. );
  575. typedef
  576. VOID
  577. (EFIAPI *EFI_UNICODE_STRUPR) (
  578. IN struct _EFI_UNICODE_COLLATION_PROTOCOL *This,
  579. IN OUT CHAR16 *Str
  580. );
  581. typedef
  582. VOID
  583. (EFIAPI *EFI_UNICODE_FATTOSTR) (
  584. IN struct _EFI_UNICODE_COLLATION_PROTOCOL *This,
  585. IN UINTN FatSize,
  586. IN CHAR8 *Fat,
  587. OUT CHAR16 *String
  588. );
  589. typedef
  590. BOOLEAN
  591. (EFIAPI *EFI_UNICODE_STRTOFAT) (
  592. IN struct _EFI_UNICODE_COLLATION_PROTOCOL *This,
  593. IN CHAR16 *String,
  594. IN UINTN FatSize,
  595. OUT CHAR8 *Fat
  596. );
  597. //
  598. // Hash Protocol
  599. //
  600. #define EFI_HASH_PROTOCOL_GUID \
  601. { 0xC5184932, 0xDBA5, 0x46DB, { 0xA5, 0xBA, 0xCC, 0x0B, 0xDA, 0x9C, 0x14, 0x35 } }
  602. #define HASH_PROTOCOL EFI_HASH_PROTOCOL_GUID
  603. #define EFI_HASH_ALGORITHM_SHA1_GUID \
  604. { 0x2AE9D80F, 0x3FB2, 0x4095, { 0xB7, 0xB1, 0xE9, 0x31, 0x57, 0xB9, 0x46, 0xB6 } } // Deprecated
  605. #define EFI_HASH_ALGORITHM_SHA1 EFI_HASH_ALGORITHM_SHA1_GUID
  606. #define EFI_HASH_ALGORITHM_SHA224_GUID \
  607. { 0x8DF01A06, 0x9BD5, 0x4BF7, { 0xB0, 0x21, 0xDB, 0x4F, 0xD9, 0xCC, 0xF4, 0x5B } } // Deprecated
  608. #define EFI_HASH_ALGORITHM_SHA224 EFI_HASH_ALGORITHM_SHA224_GUID
  609. #define EFI_HASH_ALGORITHM_SHA256_GUID \
  610. { 0x51AA59DE, 0xFDF2, 0x4EA3, { 0xBC, 0x63, 0x87, 0x5F, 0xB7, 0x84, 0x2E, 0xE9 } } // Deprecated
  611. #define EFI_HASH_ALGORITHM_SHA256 EFI_HASH_ALGORITHM_SHA256_GUID
  612. #define EFI_HASH_ALGORITHM_SHA384_GUID \
  613. { 0xEFA96432, 0xDE33, 0x4DD2, { 0xAE, 0xE6, 0x32, 0x8C, 0x33, 0xDF, 0x77, 0x7A } } // Deprecated
  614. #define EFI_HASH_ALGORITHM_SHA384 EFI_HASH_ALGORITHM_SHA384_GUID
  615. #define EFI_HASH_ALGORITHM_SHA512_GUID \
  616. { 0xCAA4381E, 0x750C, 0x4770, { 0xB8, 0x70, 0x7A, 0x23, 0xB4, 0xE4, 0x21, 0x30 } } // Deprecated
  617. #define EFI_HASH_ALGORITHM_SHA512 EFI_HASH_ALGORITHM_SHA512_GUID
  618. #define EFI_HASH_ALGORITHM_MD5_GUID \
  619. { 0x0AF7C79C, 0x65B5, 0x4319, { 0xB0, 0xAE, 0x44, 0xEC, 0x48, 0x4E, 0x4A, 0xD7 } } // Deprecated
  620. #define EFI_HASH_ALGORITHM_MD5 EFI_HASH_ALGORITHM_MD5_GUID
  621. #define EFI_HASH_ALGORITHM_SHA1_NOPAD_GUID \
  622. { 0x24C5DC2F, 0x53E2, 0x40CA, { 0x9E, 0xD6, 0xA5, 0xD9, 0xA4, 0x9F, 0x46, 0x3B } }
  623. #define EFI_HASH_ALGORITHM_SHA1_NOPAD EFI_HASH_ALGORITHM_SHA1_NOPAD_GUID
  624. #define EFI_HASH_ALGORITHM_SHA256_NOPAD_GUID \
  625. { 0x8628752A, 0x6CB7, 0x4814, { 0x96, 0xFC, 0x24, 0xA8, 0x15, 0xAC, 0x22, 0x26 } }
  626. #define EFI_HASH_ALGORITHM_SHA256_NOPAD EFI_HASH_ALGORITHM_SHA256_NOPAD_GUID
  627. INTERFACE_DECL(_EFI_HASH_PROTOCOL);
  628. typedef UINT8 EFI_MD5_HASH[16];
  629. typedef UINT8 EFI_SHA1_HASH[20];
  630. typedef UINT8 EFI_SHA224_HASH[28];
  631. typedef UINT8 EFI_SHA256_HASH[32];
  632. typedef UINT8 EFI_SHA384_HASH[48];
  633. typedef UINT8 EFI_SHA512_HASH[64];
  634. typedef union _EFI_HASH_OUTPUT {
  635. EFI_MD5_HASH *Md5Hash;
  636. EFI_SHA1_HASH *Sha1Hash;
  637. EFI_SHA224_HASH *Sha224Hash;
  638. EFI_SHA256_HASH *Sha256Hash;
  639. EFI_SHA384_HASH *Sha384Hash;
  640. EFI_SHA512_HASH *Sha512Hash;
  641. } EFI_HASH_OUTPUT;
  642. typedef
  643. EFI_STATUS
  644. (EFIAPI *EFI_HASH_GET_HASH_SIZE) (
  645. IN CONST struct _EFI_HASH_PROTOCOL *This,
  646. IN CONST EFI_GUID *HashAlgorithm,
  647. OUT UINTN *HashSize);
  648. typedef
  649. EFI_STATUS
  650. (EFIAPI *EFI_HASH_HASH) (
  651. IN CONST struct _EFI_HASH_PROTOCOL *This,
  652. IN CONST EFI_GUID *HashAlgorithm,
  653. IN BOOLEAN Extend,
  654. IN CONST UINT8 *Message,
  655. IN UINT64 MessageSize,
  656. IN OUT EFI_HASH_OUTPUT *Hash);
  657. typedef struct _EFI_HASH_PROTOCOL {
  658. EFI_HASH_GET_HASH_SIZE GetHashSize;
  659. EFI_HASH_HASH Hash;
  660. } EFI_HASH_PROTOCOL;
  661. typedef struct _EFI_HASH_PROTOCOL _EFI_HASH;
  662. typedef EFI_HASH_PROTOCOL EFI_HASH;
  663. typedef struct _EFI_UNICODE_COLLATION_PROTOCOL {
  664. // general
  665. EFI_UNICODE_STRICOLL StriColl;
  666. EFI_UNICODE_METAIMATCH MetaiMatch;
  667. EFI_UNICODE_STRLWR StrLwr;
  668. EFI_UNICODE_STRUPR StrUpr;
  669. // for supporting fat volumes
  670. EFI_UNICODE_FATTOSTR FatToStr;
  671. EFI_UNICODE_STRTOFAT StrToFat;
  672. CHAR8 *SupportedLanguages;
  673. } EFI_UNICODE_COLLATION_PROTOCOL;
  674. typedef EFI_UNICODE_COLLATION_PROTOCOL EFI_UNICODE_COLLATION_INTERFACE;
  675. /* Graphics output protocol */
  676. #define EFI_GRAPHICS_OUTPUT_PROTOCOL_GUID \
  677. { 0x9042a9de, 0x23dc, 0x4a38, {0x96, 0xfb, 0x7a, 0xde, 0xd0, 0x80, 0x51, 0x6a } }
  678. typedef struct _EFI_GRAPHICS_OUTPUT_PROTOCOL EFI_GRAPHICS_OUTPUT_PROTOCOL;
  679. typedef struct {
  680. UINT32 RedMask;
  681. UINT32 GreenMask;
  682. UINT32 BlueMask;
  683. UINT32 ReservedMask;
  684. } EFI_PIXEL_BITMASK;
  685. typedef enum {
  686. PixelRedGreenBlueReserved8BitPerColor,
  687. PixelBlueGreenRedReserved8BitPerColor,
  688. PixelBitMask,
  689. PixelBltOnly,
  690. PixelFormatMax
  691. } EFI_GRAPHICS_PIXEL_FORMAT;
  692. typedef struct {
  693. UINT32 Version;
  694. UINT32 HorizontalResolution;
  695. UINT32 VerticalResolution;
  696. EFI_GRAPHICS_PIXEL_FORMAT PixelFormat;
  697. EFI_PIXEL_BITMASK PixelInformation;
  698. UINT32 PixelsPerScanLine;
  699. } EFI_GRAPHICS_OUTPUT_MODE_INFORMATION;
  700. /**
  701. Return the current video mode information.
  702. @param This Protocol instance pointer.
  703. @param ModeNumber The mode number to return information on.
  704. @param SizeOfInfo A pointer to the size, in bytes, of the Info buffer.
  705. @param Info A pointer to callee allocated buffer that returns information about ModeNumber.
  706. @retval EFI_SUCCESS Mode information returned.
  707. @retval EFI_BUFFER_TOO_SMALL The Info buffer was too small.
  708. @retval EFI_DEVICE_ERROR A hardware error occurred trying to retrieve the video mode.
  709. @retval EFI_NOT_STARTED Video display is not initialized. Call SetMode ()
  710. @retval EFI_INVALID_PARAMETER One of the input args was NULL.
  711. **/
  712. typedef
  713. EFI_STATUS
  714. (EFIAPI *EFI_GRAPHICS_OUTPUT_PROTOCOL_QUERY_MODE) (
  715. IN EFI_GRAPHICS_OUTPUT_PROTOCOL *This,
  716. IN UINT32 ModeNumber,
  717. OUT UINTN *SizeOfInfo,
  718. OUT EFI_GRAPHICS_OUTPUT_MODE_INFORMATION **Info
  719. )
  720. ;
  721. /**
  722. Return the current video mode information.
  723. @param This Protocol instance pointer.
  724. @param ModeNumber The mode number to be set.
  725. @retval EFI_SUCCESS Graphics mode was changed.
  726. @retval EFI_DEVICE_ERROR The device had an error and could not complete the request.
  727. @retval EFI_UNSUPPORTED ModeNumber is not supported by this device.
  728. **/
  729. typedef
  730. EFI_STATUS
  731. (EFIAPI *EFI_GRAPHICS_OUTPUT_PROTOCOL_SET_MODE) (
  732. IN EFI_GRAPHICS_OUTPUT_PROTOCOL *This,
  733. IN UINT32 ModeNumber
  734. );
  735. typedef struct {
  736. UINT8 Blue;
  737. UINT8 Green;
  738. UINT8 Red;
  739. UINT8 Reserved;
  740. } EFI_GRAPHICS_OUTPUT_BLT_PIXEL;
  741. typedef union {
  742. EFI_GRAPHICS_OUTPUT_BLT_PIXEL Pixel;
  743. UINT32 Raw;
  744. } EFI_GRAPHICS_OUTPUT_BLT_PIXEL_UNION;
  745. typedef enum {
  746. EfiBltVideoFill,
  747. EfiBltVideoToBltBuffer,
  748. EfiBltBufferToVideo,
  749. EfiBltVideoToVideo,
  750. EfiGraphicsOutputBltOperationMax
  751. } EFI_GRAPHICS_OUTPUT_BLT_OPERATION;
  752. /**
  753. The following table defines actions for BltOperations:
  754. <B>EfiBltVideoFill</B> - Write data from the BltBuffer pixel (SourceX, SourceY)
  755. directly to every pixel of the video display rectangle
  756. (DestinationX, DestinationY) (DestinationX + Width, DestinationY + Height).
  757. Only one pixel will be used from the BltBuffer. Delta is NOT used.
  758. <B>EfiBltVideoToBltBuffer</B> - Read data from the video display rectangle
  759. (SourceX, SourceY) (SourceX + Width, SourceY + Height) and place it in
  760. the BltBuffer rectangle (DestinationX, DestinationY )
  761. (DestinationX + Width, DestinationY + Height). If DestinationX or
  762. DestinationY is not zero then Delta must be set to the length in bytes
  763. of a row in the BltBuffer.
  764. <B>EfiBltBufferToVideo</B> - Write data from the BltBuffer rectangle
  765. (SourceX, SourceY) (SourceX + Width, SourceY + Height) directly to the
  766. video display rectangle (DestinationX, DestinationY)
  767. (DestinationX + Width, DestinationY + Height). If SourceX or SourceY is
  768. not zero then Delta must be set to the length in bytes of a row in the
  769. BltBuffer.
  770. <B>EfiBltVideoToVideo</B> - Copy from the video display rectangle (SourceX, SourceY)
  771. (SourceX + Width, SourceY + Height) .to the video display rectangle
  772. (DestinationX, DestinationY) (DestinationX + Width, DestinationY + Height).
  773. The BltBuffer and Delta are not used in this mode.
  774. @param This Protocol instance pointer.
  775. @param BltBuffer Buffer containing data to blit into video buffer. This
  776. buffer has a size of Width*Height*sizeof(EFI_GRAPHICS_OUTPUT_BLT_PIXEL)
  777. @param BltOperation Operation to perform on BlitBuffer and video memory
  778. @param SourceX X coordinate of source for the BltBuffer.
  779. @param SourceY Y coordinate of source for the BltBuffer.
  780. @param DestinationX X coordinate of destination for the BltBuffer.
  781. @param DestinationY Y coordinate of destination for the BltBuffer.
  782. @param Width Width of rectangle in BltBuffer in pixels.
  783. @param Height Hight of rectangle in BltBuffer in pixels.
  784. @param Delta OPTIONAL
  785. @retval EFI_SUCCESS The Blt operation completed.
  786. @retval EFI_INVALID_PARAMETER BltOperation is not valid.
  787. @retval EFI_DEVICE_ERROR A hardware error occured writting to the video buffer.
  788. **/
  789. typedef
  790. EFI_STATUS
  791. (EFIAPI *EFI_GRAPHICS_OUTPUT_PROTOCOL_BLT) (
  792. IN EFI_GRAPHICS_OUTPUT_PROTOCOL *This,
  793. IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL *BltBuffer, OPTIONAL
  794. IN EFI_GRAPHICS_OUTPUT_BLT_OPERATION BltOperation,
  795. IN UINTN SourceX,
  796. IN UINTN SourceY,
  797. IN UINTN DestinationX,
  798. IN UINTN DestinationY,
  799. IN UINTN Width,
  800. IN UINTN Height,
  801. IN UINTN Delta OPTIONAL
  802. );
  803. typedef struct {
  804. UINT32 MaxMode;
  805. UINT32 Mode;
  806. EFI_GRAPHICS_OUTPUT_MODE_INFORMATION *Info;
  807. UINTN SizeOfInfo;
  808. EFI_PHYSICAL_ADDRESS FrameBufferBase;
  809. UINTN FrameBufferSize;
  810. } EFI_GRAPHICS_OUTPUT_PROTOCOL_MODE;
  811. struct _EFI_GRAPHICS_OUTPUT_PROTOCOL {
  812. EFI_GRAPHICS_OUTPUT_PROTOCOL_QUERY_MODE QueryMode;
  813. EFI_GRAPHICS_OUTPUT_PROTOCOL_SET_MODE SetMode;
  814. EFI_GRAPHICS_OUTPUT_PROTOCOL_BLT Blt;
  815. EFI_GRAPHICS_OUTPUT_PROTOCOL_MODE *Mode;
  816. };
  817. /*
  818. * EFI EDID Discovered Protocol
  819. * UEFI Specification Version 2.5 Section 11.9
  820. */
  821. #define EFI_EDID_DISCOVERED_PROTOCOL_GUID \
  822. { 0x1C0C34F6, 0xD380, 0x41FA, { 0xA0, 0x49, 0x8a, 0xD0, 0x6C, 0x1A, 0x66, 0xAA} }
  823. typedef struct _EFI_EDID_DISCOVERED_PROTOCOL {
  824. UINT32 SizeOfEdid;
  825. UINT8 *Edid;
  826. } EFI_EDID_DISCOVERED_PROTOCOL;
  827. /*
  828. * EFI EDID Active Protocol
  829. * UEFI Specification Version 2.5 Section 11.9
  830. */
  831. #define EFI_EDID_ACTIVE_PROTOCOL_GUID \
  832. { 0xBD8C1056, 0x9F36, 0x44EC, { 0x92, 0xA8, 0xA6, 0x33, 0x7F, 0x81, 0x79, 0x86} }
  833. typedef struct _EFI_EDID_ACTIVE_PROTOCOL {
  834. UINT32 SizeOfEdid;
  835. UINT8 *Edid;
  836. } EFI_EDID_ACTIVE_PROTOCOL;
  837. /*
  838. * EFI EDID Override Protocol
  839. * UEFI Specification Version 2.5 Section 11.9
  840. */
  841. #define EFI_EDID_OVERRIDE_PROTOCOL_GUID \
  842. { 0x48ECB431, 0xFB72, 0x45C0, { 0xA9, 0x22, 0xF4, 0x58, 0xFE, 0x04, 0x0B, 0xD5} }
  843. INTERFACE_DECL(_EFI_EDID_OVERRIDE_PROTOCOL);
  844. typedef
  845. EFI_STATUS
  846. (EFIAPI *EFI_EDID_OVERRIDE_PROTOCOL_GET_EDID) (
  847. IN struct _EFI_EDID_OVERRIDE_PROTOCOL *This,
  848. IN EFI_HANDLE *ChildHandle,
  849. OUT UINT32 *Attributes,
  850. IN OUT UINTN *EdidSize,
  851. IN OUT UINT8 **Edid);
  852. typedef struct _EFI_EDID_OVERRIDE_PROTOCOL {
  853. EFI_EDID_OVERRIDE_PROTOCOL_GET_EDID GetEdid;
  854. } EFI_EDID_OVERRIDE_PROTOCOL;
  855. INTERFACE_DECL(_EFI_SERVICE_BINDING);
  856. typedef
  857. EFI_STATUS
  858. (EFIAPI *EFI_SERVICE_BINDING_CREATE_CHILD) (
  859. IN struct _EFI_SERVICE_BINDING *This,
  860. IN EFI_HANDLE *ChildHandle
  861. );
  862. typedef
  863. EFI_STATUS
  864. (EFIAPI *EFI_SERVICE_BINDING_DESTROY_CHILD) (
  865. IN struct _EFI_SERVICE_BINDING *This,
  866. IN EFI_HANDLE ChildHandle
  867. );
  868. typedef struct _EFI_SERVICE_BINDING {
  869. EFI_SERVICE_BINDING_CREATE_CHILD CreateChild;
  870. EFI_SERVICE_BINDING_DESTROY_CHILD DestroyChild;
  871. } EFI_SERVICE_BINDING;
  872. /*
  873. * EFI Driver Binding Protocol
  874. * UEFI Specification Version 2.5 Section 10.1
  875. */
  876. #define EFI_DRIVER_BINDING_PROTOCOL_GUID \
  877. { 0x18A031AB, 0xB443, 0x4D1A, { 0xA5, 0xC0, 0x0C, 0x09, 0x26, 0x1E, 0x9F, 0x71} }
  878. #define DRIVER_BINDING_PROTOCOL EFI_DRIVER_BINDING_PROTOCOL_GUID
  879. INTERFACE_DECL(_EFI_DRIVER_BINDING_PROTOCOL);
  880. typedef
  881. EFI_STATUS
  882. (EFIAPI *EFI_DRIVER_BINDING_PROTOCOL_SUPPORTED) (
  883. IN struct _EFI_DRIVER_BINDING_PROTOCOL *This,
  884. IN EFI_HANDLE ControllerHandle,
  885. IN EFI_DEVICE_PATH *RemainingDevicePath OPTIONAL);
  886. typedef
  887. EFI_STATUS
  888. (EFIAPI *EFI_DRIVER_BINDING_PROTOCOL_START) (
  889. IN struct _EFI_DRIVER_BINDING_PROTOCOL *This,
  890. IN EFI_HANDLE ControllerHandle,
  891. IN EFI_DEVICE_PATH *RemainingDevicePath OPTIONAL);
  892. typedef
  893. EFI_STATUS
  894. (EFIAPI *EFI_DRIVER_BINDING_PROTOCOL_STOP) (
  895. IN struct _EFI_DRIVER_BINDING_PROTOCOL *This,
  896. IN EFI_HANDLE ControllerHandle,
  897. IN UINTN NumberOfChildren,
  898. IN EFI_HANDLE *ChildHandleBuffer OPTIONAL);
  899. typedef struct _EFI_DRIVER_BINDING_PROTOCOL {
  900. EFI_DRIVER_BINDING_PROTOCOL_SUPPORTED Supported;
  901. EFI_DRIVER_BINDING_PROTOCOL_START Start;
  902. EFI_DRIVER_BINDING_PROTOCOL_STOP Stop;
  903. UINT32 Version;
  904. EFI_HANDLE ImageHandle;
  905. EFI_HANDLE DriverBindingHandle;
  906. } EFI_DRIVER_BINDING_PROTOCOL;
  907. typedef struct _EFI_DRIVER_BINDING_PROTOCOL _EFI_DRIVER_BINDING;
  908. typedef EFI_DRIVER_BINDING_PROTOCOL EFI_DRIVER_BINDING;
  909. /*
  910. * Backwards compatibility with older GNU-EFI versions. Deprecated.
  911. */
  912. #define EFI_DRIVER_SUPPORTED EFI_DRIVER_BINDING_PROTOCOL_SUPPORTED
  913. #define EFI_DRIVER_START EFI_DRIVER_BINDING_PROTOCOL_START
  914. #define EFI_DRIVER_STOP EFI_DRIVER_BINDING_PROTOCOL_STOP
  915. /*
  916. * EFI Component Name Protocol
  917. * Deprecated - use EFI Component Name 2 Protocol instead
  918. */
  919. #define EFI_COMPONENT_NAME_PROTOCOL_GUID \
  920. {0x107A772C, 0xD5E1, 0x11D4, { 0x9A, 0x46, 0x00, 0x90, 0x27, 0x3F, 0xC1, 0x4D} }
  921. #define COMPONENT_NAME_PROTOCOL EFI_COMPONENT_NAME_PROTOCOL_GUID
  922. INTERFACE_DECL(_EFI_COMPONENT_NAME_PROTOCOL);
  923. typedef
  924. EFI_STATUS
  925. (EFIAPI *EFI_COMPONENT_NAME_GET_DRIVER_NAME) (
  926. IN struct _EFI_COMPONENT_NAME_PROTOCOL *This,
  927. IN CHAR8 *Language,
  928. OUT CHAR16 **DriverName);
  929. typedef
  930. EFI_STATUS
  931. (EFIAPI *EFI_COMPONENT_NAME_GET_CONTROLLER_NAME) (
  932. IN struct _EFI_COMPONENT_NAME_PROTOCOL *This,
  933. IN EFI_HANDLE ControllerHandle,
  934. IN EFI_HANDLE ChildHandle OPTIONAL,
  935. IN CHAR8 *Language,
  936. OUT CHAR16 **ControllerName);
  937. typedef struct _EFI_COMPONENT_NAME_PROTOCOL {
  938. EFI_COMPONENT_NAME_GET_DRIVER_NAME GetDriverName;
  939. EFI_COMPONENT_NAME_GET_CONTROLLER_NAME GetControllerName;
  940. CHAR8 *SupportedLanguages;
  941. } EFI_COMPONENT_NAME_PROTOCOL;
  942. typedef struct _EFI_COMPONENT_NAME_PROTOCOL _EFI_COMPONENT_NAME;
  943. typedef EFI_COMPONENT_NAME_PROTOCOL EFI_COMPONENT_NAME;
  944. /*
  945. * EFI Component Name 2 Protocol
  946. * UEFI Specification Version 2.5 Section 10.5
  947. */
  948. #define EFI_COMPONENT_NAME2_PROTOCOL_GUID \
  949. {0x6A7A5CFF, 0xE8D9, 0x4F70, { 0xBA, 0xDA, 0x75, 0xAB, 0x30, 0x25, 0xCE, 0x14} }
  950. #define COMPONENT_NAME2_PROTOCOL EFI_COMPONENT_NAME2_PROTOCOL_GUID
  951. INTERFACE_DECL(_EFI_COMPONENT_NAME2_PROTOCOL);
  952. typedef
  953. EFI_STATUS
  954. (EFIAPI *EFI_COMPONENT_NAME2_GET_DRIVER_NAME) (
  955. IN struct _EFI_COMPONENT_NAME2_PROTOCOL *This,
  956. IN CHAR8 *Language,
  957. OUT CHAR16 **DriverName);
  958. typedef
  959. EFI_STATUS
  960. (EFIAPI *EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME) (
  961. IN struct _EFI_COMPONENT_NAME2_PROTOCOL *This,
  962. IN EFI_HANDLE ControllerHandle,
  963. IN EFI_HANDLE ChildHandle OPTIONAL,
  964. IN CHAR8 *Language,
  965. OUT CHAR16 **ControllerName);
  966. typedef struct _EFI_COMPONENT_NAME2_PROTOCOL {
  967. EFI_COMPONENT_NAME2_GET_DRIVER_NAME GetDriverName;
  968. EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME GetControllerName;
  969. CHAR8 *SupportedLanguages;
  970. } EFI_COMPONENT_NAME2_PROTOCOL;
  971. typedef struct _EFI_COMPONENT_NAME2_PROTOCOL _EFI_COMPONENT_NAME2;
  972. typedef EFI_COMPONENT_NAME2_PROTOCOL EFI_COMPONENT_NAME2;
  973. /*
  974. * EFI Loaded Image Protocol
  975. * UEFI Specification Version 2.5 Section 8.1
  976. */
  977. #define EFI_LOADED_IMAGE_PROTOCOL_GUID \
  978. { 0x5B1B31A1, 0x9562, 0x11d2, {0x8E, 0x3F, 0x00, 0xA0, 0xC9, 0x69, 0x72, 0x3B} }
  979. #define LOADED_IMAGE_PROTOCOL EFI_LOADED_IMAGE_PROTOCOL_GUID
  980. #define EFI_LOADED_IMAGE_PROTOCOL_REVISION 0x1000
  981. #define EFI_IMAGE_INFORMATION_REVISION EFI_LOADED_IMAGE_PROTOCOL_REVISION
  982. typedef
  983. EFI_STATUS
  984. (EFIAPI *EFI_IMAGE_UNLOAD) (
  985. IN EFI_HANDLE ImageHandle
  986. );
  987. typedef struct {
  988. UINT32 Revision;
  989. EFI_HANDLE ParentHandle;
  990. struct _EFI_SYSTEM_TABLE *SystemTable;
  991. // Source location of image
  992. EFI_HANDLE DeviceHandle;
  993. EFI_DEVICE_PATH *FilePath;
  994. VOID *Reserved;
  995. // Images load options
  996. UINT32 LoadOptionsSize;
  997. VOID *LoadOptions;
  998. // Location of where image was loaded
  999. VOID *ImageBase;
  1000. UINT64 ImageSize;
  1001. EFI_MEMORY_TYPE ImageCodeType;
  1002. EFI_MEMORY_TYPE ImageDataType;
  1003. // If the driver image supports a dynamic unload request
  1004. EFI_IMAGE_UNLOAD Unload;
  1005. } EFI_LOADED_IMAGE_PROTOCOL;
  1006. typedef EFI_LOADED_IMAGE_PROTOCOL EFI_LOADED_IMAGE;
  1007. #define EFI_LOADED_IMAGE_DEVICE_PATH_PROTOCOL_GUID \
  1008. {0xbc62157e, 0x3e33, 0x4fec, {0x99, 0x20, 0x2d, 0x3b, 0x36, 0xd7, 0x50, 0xdf} }
  1009. /*
  1010. * Random Number Generator Protocol
  1011. * UEFI Specification Version 2.5 Section 35.5
  1012. */
  1013. #define EFI_RNG_PROTOCOL_GUID \
  1014. { 0x3152bca5, 0xeade, 0x433d, {0x86, 0x2e, 0xc0, 0x1c, 0xdc, 0x29, 0x1f, 0x44} }
  1015. typedef EFI_GUID EFI_RNG_ALGORITHM;
  1016. #define EFI_RNG_ALGORITHM_SP800_90_HASH_256_GUID \
  1017. {0xa7af67cb, 0x603b, 0x4d42, {0xba, 0x21, 0x70, 0xbf, 0xb6, 0x29, 0x3f, 0x96} }
  1018. #define EFI_RNG_ALGORITHM_SP800_90_HMAC_256_GUID \
  1019. {0xc5149b43, 0xae85, 0x4f53, {0x99, 0x82, 0xb9, 0x43, 0x35, 0xd3, 0xa9, 0xe7} }
  1020. #define EFI_RNG_ALGORITHM_SP800_90_CTR_256_GUID \
  1021. {0x44f0de6e, 0x4d8c, 0x4045, {0xa8, 0xc7, 0x4d, 0xd1, 0x68, 0x85, 0x6b, 0x9e} }
  1022. #define EFI_RNG_ALGORITHM_X9_31_3DES_GUID \
  1023. {0x63c4785a, 0xca34, 0x4012, {0xa3, 0xc8, 0x0b, 0x6a, 0x32, 0x4f, 0x55, 0x46} }
  1024. #define EFI_RNG_ALGORITHM_X9_31_AES_GUID \
  1025. {0xacd03321, 0x777e, 0x4d3d, {0xb1, 0xc8, 0x20, 0xcf, 0xd8, 0x88, 0x20, 0xc9} }
  1026. #define EFI_RNG_ALGORITHM_RAW \
  1027. {0xe43176d7, 0xb6e8, 0x4827, {0xb7, 0x84, 0x7f, 0xfd, 0xc4, 0xb6, 0x85, 0x61} }
  1028. INTERFACE_DECL(_EFI_RNG_PROTOCOL);
  1029. typedef
  1030. EFI_STATUS
  1031. (EFIAPI *EFI_RNG_GET_INFO) (
  1032. IN struct _EFI_RNG_PROTOCOL *This,
  1033. IN OUT UINTN *RNGAlgorithmListSize,
  1034. OUT EFI_RNG_ALGORITHM *RNGAlgorithmList
  1035. );
  1036. typedef
  1037. EFI_STATUS
  1038. (EFIAPI *EFI_RNG_GET_RNG) (
  1039. IN struct _EFI_RNG_PROTOCOL *This,
  1040. IN EFI_RNG_ALGORITHM *RNGAlgorithm, OPTIONAL
  1041. IN UINTN RNGValueLength,
  1042. OUT UINT8 *RNGValue
  1043. );
  1044. typedef struct _EFI_RNG_PROTOCOL {
  1045. EFI_RNG_GET_INFO GetInfo;
  1046. EFI_RNG_GET_RNG GetRNG;
  1047. } EFI_RNG_PROTOCOL;
  1048. //
  1049. // EFI_PLATFORM_DRIVER_OVERRIDE_PROTOCOL
  1050. //
  1051. #define EFI_PLATFORM_DRIVER_OVERRIDE_PROTOCOL_GUID \
  1052. { 0x6b30c738, 0xa391, 0x11d4, {0x9a, 0x3b, 0x00, 0x90, 0x27, 0x3f, 0xc1, 0x4d} }
  1053. INTERFACE_DECL(_EFI_PLATFORM_DRIVER_OVERRIDE_PROTOCOL);
  1054. typedef
  1055. EFI_STATUS
  1056. (EFIAPI *EFI_PLATFORM_DRIVER_OVERRIDE_GET_DRIVER) (
  1057. IN struct _EFI_PLATFORM_DRIVER_OVERRIDE_PROTOCOL *This,
  1058. IN EFI_HANDLE ControllerHandle,
  1059. IN OUT EFI_HANDLE *DriverImageHandle);
  1060. typedef
  1061. EFI_STATUS
  1062. (EFIAPI *EFI_PLATFORM_DRIVER_OVERRIDE_GET_DRIVER_PATH) (
  1063. IN struct _EFI_PLATFORM_DRIVER_OVERRIDE_PROTOCOL *This,
  1064. IN EFI_HANDLE ControllerHandle,
  1065. IN OUT EFI_DEVICE_PATH **DriverImagePath);
  1066. typedef
  1067. EFI_STATUS
  1068. (EFIAPI *EFI_PLATFORM_DRIVER_OVERRIDE_DRIVER_LOADED) (
  1069. IN struct _EFI_PLATFORM_DRIVER_OVERRIDE_PROTOCOL *This,
  1070. IN EFI_HANDLE ControllerHandle,
  1071. IN EFI_DEVICE_PATH *DriverImagePath,
  1072. IN EFI_HANDLE DriverImageHandle);
  1073. typedef struct _EFI_PLATFORM_DRIVER_OVERRIDE_PROTOCOL {
  1074. EFI_PLATFORM_DRIVER_OVERRIDE_GET_DRIVER GetDriver;
  1075. EFI_PLATFORM_DRIVER_OVERRIDE_GET_DRIVER_PATH GetDriverPath;
  1076. EFI_PLATFORM_DRIVER_OVERRIDE_DRIVER_LOADED DriverLoaded;
  1077. } EFI_PLATFORM_DRIVER_OVERRIDE_PROTOCOL;
  1078. //
  1079. // EFI_BUS_SPECIFIC_DRIVER_OVERRIDE_PROTOCOL
  1080. //
  1081. #define EFI_BUS_SPECIFIC_DRIVER_OVERRIDE_PROTOCOL_GUID \
  1082. { 0x3bc1b285, 0x8a15, 0x4a82, {0xaa, 0xbf, 0x4d, 0x7d, 0x13, 0xfb, 0x32, 0x65} }
  1083. INTERFACE_DECL(_EFI_BUS_SPECIFIC_DRIVER_OVERRIDE_PROTOCOL);
  1084. typedef
  1085. EFI_STATUS
  1086. (EFIAPI *EFI_BUS_SPECIFIC_DRIVER_OVERRIDE_GET_DRIVER) (
  1087. IN struct _EFI_BUS_SPECIFIC_DRIVER_OVERRIDE_PROTOCOL *This,
  1088. IN OUT EFI_HANDLE *DriverImageHandle);
  1089. typedef struct _EFI_BUS_SPECIFIC_DRIVER_OVERRIDE_PROTOCOL {
  1090. EFI_BUS_SPECIFIC_DRIVER_OVERRIDE_GET_DRIVER GetDriver;
  1091. } EFI_BUS_SPECIFIC_DRIVER_OVERRIDE_PROTOCOL;
  1092. //
  1093. // EFI_DRIVER_FAMILY_OVERRIDE_PROTOCOL
  1094. //
  1095. #define EFI_DRIVER_FAMILY_OVERRIDE_PROTOCOL_GUID \
  1096. { 0xb1ee129e, 0xda36, 0x4181, {0x91, 0xf8, 0x04, 0xa4, 0x92, 0x37, 0x66, 0xa7} }
  1097. INTERFACE_DECL(_EFI_DRIVER_FAMILY_OVERRIDE_PROTOCOL);
  1098. typedef
  1099. UINT32
  1100. (EFIAPI *EFI_DRIVER_FAMILY_OVERRIDE_GET_VERSION) (
  1101. IN struct _EFI_DRIVER_FAMILY_OVERRIDE_PROTOCOL *This);
  1102. typedef struct _EFI_DRIVER_FAMILY_OVERRIDE_PROTOCOL {
  1103. EFI_DRIVER_FAMILY_OVERRIDE_GET_VERSION GetVersion;
  1104. } EFI_DRIVER_FAMILY_OVERRIDE_PROTOCOL;
  1105. //
  1106. // EFI_EBC_PROTOCOL
  1107. //
  1108. #define EFI_EBC_INTERPRETER_PROTOCOL_GUID \
  1109. {0x13ac6dd1, 0x73d0, 0x11d4, {0xb0, 0x6b, 0x00, 0xaa, 0x00, 0xbd, 0x6d, 0xe7} }
  1110. #define EFI_EBC_PROTOCOL_GUID EFI_EBC_INTERPRETER_PROTOCOL_GUID
  1111. INTERFACE_DECL(_EFI_EBC_PROTOCOL);
  1112. typedef
  1113. EFI_STATUS
  1114. (EFIAPI *EFI_EBC_CREATE_THUNK)(
  1115. IN struct _EFI_EBC_PROTOCOL *This,
  1116. IN EFI_HANDLE ImageHandle,
  1117. IN VOID *EbcEntryPoint,
  1118. OUT VOID **Thunk);
  1119. typedef
  1120. EFI_STATUS
  1121. (EFIAPI *EFI_EBC_UNLOAD_IMAGE)(
  1122. IN struct _EFI_EBC_PROTOCOL *This,
  1123. IN EFI_HANDLE ImageHandle);
  1124. typedef
  1125. EFI_STATUS
  1126. (EFIAPI *EBC_ICACHE_FLUSH)(
  1127. IN EFI_PHYSICAL_ADDRESS Start,
  1128. IN UINT64 Length);
  1129. typedef
  1130. EFI_STATUS
  1131. (EFIAPI *EFI_EBC_REGISTER_ICACHE_FLUSH)(
  1132. IN struct _EFI_EBC_PROTOCOL *This,
  1133. IN EBC_ICACHE_FLUSH Flush);
  1134. typedef
  1135. EFI_STATUS
  1136. (EFIAPI *EFI_EBC_GET_VERSION)(
  1137. IN struct _EFI_EBC_PROTOCOL *This,
  1138. IN OUT UINT64 *Version);
  1139. typedef struct _EFI_EBC_PROTOCOL {
  1140. EFI_EBC_CREATE_THUNK CreateThunk;
  1141. EFI_EBC_UNLOAD_IMAGE UnloadImage;
  1142. EFI_EBC_REGISTER_ICACHE_FLUSH RegisterICacheFlush;
  1143. EFI_EBC_GET_VERSION GetVersion;
  1144. } EFI_EBC_PROTOCOL;
  1145. INTERFACE_DECL(_EFI_MEMORY_ATTRIBUTE_PROTOCOL);
  1146. typedef
  1147. EFI_STATUS
  1148. (EFIAPI *EFI_GET_MEMORY_ATTRIBUTES)(
  1149. IN struct _EFI_MEMORY_ATTRIBUTE_PROTOCOL *This,
  1150. IN EFI_PHYSICAL_ADDRESS BaseAddress,
  1151. IN UINT64 Length,
  1152. OUT UINT64 *Attributes
  1153. );
  1154. typedef
  1155. EFI_STATUS
  1156. (EFIAPI *EFI_SET_MEMORY_ATTRIBUTES)(
  1157. IN struct _EFI_MEMORY_ATTRIBUTE_PROTOCOL *This,
  1158. IN EFI_PHYSICAL_ADDRESS BaseAddress,
  1159. IN UINT64 Length,
  1160. IN UINT64 Attributes
  1161. );
  1162. typedef
  1163. EFI_STATUS
  1164. (EFIAPI *EFI_CLEAR_MEMORY_ATTRIBUTES)(
  1165. IN struct _EFI_MEMORY_ATTRIBUTE_PROTOCOL *This,
  1166. IN EFI_PHYSICAL_ADDRESS BaseAddress,
  1167. IN UINT64 Length,
  1168. IN UINT64 Attributes
  1169. );
  1170. typedef struct _EFI_MEMORY_ATTRIBUTE_PROTOCOL {
  1171. EFI_GET_MEMORY_ATTRIBUTES GetMemoryAttributes;
  1172. EFI_SET_MEMORY_ATTRIBUTES SetMemoryAttributes;
  1173. EFI_CLEAR_MEMORY_ATTRIBUTES ClearMemoryAttributes;
  1174. } EFI_MEMORY_ATTRIBUTE_PROTOCOL;
  1175. #endif