efiprot.h 29 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021
  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 FPSWA_PROTOCOL \
  15. { 0xc41b6531, 0x97b9, 0x11d3, {0x9a, 0x29, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d} }
  16. //
  17. // Device Path protocol
  18. //
  19. #define DEVICE_PATH_PROTOCOL \
  20. { 0x9576e91, 0x6d3f, 0x11d2, {0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b} }
  21. //
  22. // Block IO protocol
  23. //
  24. #define BLOCK_IO_PROTOCOL \
  25. { 0x964e5b21, 0x6459, 0x11d2, {0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b} }
  26. #define EFI_BLOCK_IO_INTERFACE_REVISION 0x00010000
  27. #define EFI_BLOCK_IO_INTERFACE_REVISION2 0x00020001
  28. #define EFI_BLOCK_IO_INTERFACE_REVISION3 ((2<<16) | 31)
  29. INTERFACE_DECL(_EFI_BLOCK_IO);
  30. typedef
  31. EFI_STATUS
  32. (EFIAPI *EFI_BLOCK_RESET) (
  33. IN struct _EFI_BLOCK_IO *This,
  34. IN BOOLEAN ExtendedVerification
  35. );
  36. typedef
  37. EFI_STATUS
  38. (EFIAPI *EFI_BLOCK_READ) (
  39. IN struct _EFI_BLOCK_IO *This,
  40. IN UINT32 MediaId,
  41. IN EFI_LBA LBA,
  42. IN UINTN BufferSize,
  43. OUT VOID *Buffer
  44. );
  45. typedef
  46. EFI_STATUS
  47. (EFIAPI *EFI_BLOCK_WRITE) (
  48. IN struct _EFI_BLOCK_IO *This,
  49. IN UINT32 MediaId,
  50. IN EFI_LBA LBA,
  51. IN UINTN BufferSize,
  52. IN VOID *Buffer
  53. );
  54. typedef
  55. EFI_STATUS
  56. (EFIAPI *EFI_BLOCK_FLUSH) (
  57. IN struct _EFI_BLOCK_IO *This
  58. );
  59. typedef struct {
  60. UINT32 MediaId;
  61. BOOLEAN RemovableMedia;
  62. BOOLEAN MediaPresent;
  63. BOOLEAN LogicalPartition;
  64. BOOLEAN ReadOnly;
  65. BOOLEAN WriteCaching;
  66. UINT32 BlockSize;
  67. UINT32 IoAlign;
  68. EFI_LBA LastBlock;
  69. /* revision 2 */
  70. EFI_LBA LowestAlignedLba;
  71. UINT32 LogicalBlocksPerPhysicalBlock;
  72. /* revision 3 */
  73. UINT32 OptimalTransferLengthGranularity;
  74. } EFI_BLOCK_IO_MEDIA;
  75. typedef struct _EFI_BLOCK_IO {
  76. UINT64 Revision;
  77. EFI_BLOCK_IO_MEDIA *Media;
  78. EFI_BLOCK_RESET Reset;
  79. EFI_BLOCK_READ ReadBlocks;
  80. EFI_BLOCK_WRITE WriteBlocks;
  81. EFI_BLOCK_FLUSH FlushBlocks;
  82. } EFI_BLOCK_IO;
  83. //
  84. // Disk Block IO protocol
  85. //
  86. #define DISK_IO_PROTOCOL \
  87. { 0xce345171, 0xba0b, 0x11d2, {0x8e, 0x4f, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b} }
  88. #define EFI_DISK_IO_INTERFACE_REVISION 0x00010000
  89. INTERFACE_DECL(_EFI_DISK_IO);
  90. typedef
  91. EFI_STATUS
  92. (EFIAPI *EFI_DISK_READ) (
  93. IN struct _EFI_DISK_IO *This,
  94. IN UINT32 MediaId,
  95. IN UINT64 Offset,
  96. IN UINTN BufferSize,
  97. OUT VOID *Buffer
  98. );
  99. typedef
  100. EFI_STATUS
  101. (EFIAPI *EFI_DISK_WRITE) (
  102. IN struct _EFI_DISK_IO *This,
  103. IN UINT32 MediaId,
  104. IN UINT64 Offset,
  105. IN UINTN BufferSize,
  106. IN VOID *Buffer
  107. );
  108. typedef struct _EFI_DISK_IO {
  109. UINT64 Revision;
  110. EFI_DISK_READ ReadDisk;
  111. EFI_DISK_WRITE WriteDisk;
  112. } EFI_DISK_IO;
  113. //
  114. // Simple file system protocol
  115. //
  116. #define SIMPLE_FILE_SYSTEM_PROTOCOL \
  117. { 0x964e5b22, 0x6459, 0x11d2, {0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b} }
  118. INTERFACE_DECL(_EFI_FILE_IO_INTERFACE);
  119. INTERFACE_DECL(_EFI_FILE_HANDLE);
  120. typedef
  121. EFI_STATUS
  122. (EFIAPI *EFI_VOLUME_OPEN) (
  123. IN struct _EFI_FILE_IO_INTERFACE *This,
  124. OUT struct _EFI_FILE_HANDLE **Root
  125. );
  126. #define EFI_FILE_IO_INTERFACE_REVISION 0x00010000
  127. typedef struct _EFI_FILE_IO_INTERFACE {
  128. UINT64 Revision;
  129. EFI_VOLUME_OPEN OpenVolume;
  130. } EFI_FILE_IO_INTERFACE;
  131. //
  132. //
  133. //
  134. typedef
  135. EFI_STATUS
  136. (EFIAPI *EFI_FILE_OPEN) (
  137. IN struct _EFI_FILE_HANDLE *File,
  138. OUT struct _EFI_FILE_HANDLE **NewHandle,
  139. IN CHAR16 *FileName,
  140. IN UINT64 OpenMode,
  141. IN UINT64 Attributes
  142. );
  143. // Open modes
  144. #define EFI_FILE_MODE_READ 0x0000000000000001
  145. #define EFI_FILE_MODE_WRITE 0x0000000000000002
  146. #define EFI_FILE_MODE_CREATE 0x8000000000000000
  147. // File attributes
  148. #define EFI_FILE_READ_ONLY 0x0000000000000001
  149. #define EFI_FILE_HIDDEN 0x0000000000000002
  150. #define EFI_FILE_SYSTEM 0x0000000000000004
  151. #define EFI_FILE_RESERVIED 0x0000000000000008
  152. #define EFI_FILE_DIRECTORY 0x0000000000000010
  153. #define EFI_FILE_ARCHIVE 0x0000000000000020
  154. #define EFI_FILE_VALID_ATTR 0x0000000000000037
  155. typedef
  156. EFI_STATUS
  157. (EFIAPI *EFI_FILE_CLOSE) (
  158. IN struct _EFI_FILE_HANDLE *File
  159. );
  160. typedef
  161. EFI_STATUS
  162. (EFIAPI *EFI_FILE_DELETE) (
  163. IN struct _EFI_FILE_HANDLE *File
  164. );
  165. typedef
  166. EFI_STATUS
  167. (EFIAPI *EFI_FILE_READ) (
  168. IN struct _EFI_FILE_HANDLE *File,
  169. IN OUT UINTN *BufferSize,
  170. OUT VOID *Buffer
  171. );
  172. typedef
  173. EFI_STATUS
  174. (EFIAPI *EFI_FILE_WRITE) (
  175. IN struct _EFI_FILE_HANDLE *File,
  176. IN OUT UINTN *BufferSize,
  177. IN VOID *Buffer
  178. );
  179. typedef
  180. EFI_STATUS
  181. (EFIAPI *EFI_FILE_SET_POSITION) (
  182. IN struct _EFI_FILE_HANDLE *File,
  183. IN UINT64 Position
  184. );
  185. typedef
  186. EFI_STATUS
  187. (EFIAPI *EFI_FILE_GET_POSITION) (
  188. IN struct _EFI_FILE_HANDLE *File,
  189. OUT UINT64 *Position
  190. );
  191. typedef
  192. EFI_STATUS
  193. (EFIAPI *EFI_FILE_GET_INFO) (
  194. IN struct _EFI_FILE_HANDLE *File,
  195. IN EFI_GUID *InformationType,
  196. IN OUT UINTN *BufferSize,
  197. OUT VOID *Buffer
  198. );
  199. typedef
  200. EFI_STATUS
  201. (EFIAPI *EFI_FILE_SET_INFO) (
  202. IN struct _EFI_FILE_HANDLE *File,
  203. IN EFI_GUID *InformationType,
  204. IN UINTN BufferSize,
  205. IN VOID *Buffer
  206. );
  207. typedef
  208. EFI_STATUS
  209. (EFIAPI *EFI_FILE_FLUSH) (
  210. IN struct _EFI_FILE_HANDLE *File
  211. );
  212. #define EFI_FILE_HANDLE_REVISION 0x00010000
  213. typedef struct _EFI_FILE_HANDLE {
  214. UINT64 Revision;
  215. EFI_FILE_OPEN Open;
  216. EFI_FILE_CLOSE Close;
  217. EFI_FILE_DELETE Delete;
  218. EFI_FILE_READ Read;
  219. EFI_FILE_WRITE Write;
  220. EFI_FILE_GET_POSITION GetPosition;
  221. EFI_FILE_SET_POSITION SetPosition;
  222. EFI_FILE_GET_INFO GetInfo;
  223. EFI_FILE_SET_INFO SetInfo;
  224. EFI_FILE_FLUSH Flush;
  225. } EFI_FILE, *EFI_FILE_HANDLE;
  226. //
  227. // File information types
  228. //
  229. #define EFI_FILE_INFO_ID \
  230. { 0x9576e92, 0x6d3f, 0x11d2, {0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b} }
  231. typedef struct {
  232. UINT64 Size;
  233. UINT64 FileSize;
  234. UINT64 PhysicalSize;
  235. EFI_TIME CreateTime;
  236. EFI_TIME LastAccessTime;
  237. EFI_TIME ModificationTime;
  238. UINT64 Attribute;
  239. CHAR16 FileName[1];
  240. } EFI_FILE_INFO;
  241. //
  242. // The FileName field of the EFI_FILE_INFO data structure is variable length.
  243. // Whenever code needs to know the size of the EFI_FILE_INFO data structure, it needs to
  244. // be the size of the data structure without the FileName field. The following macro
  245. // computes this size correctly no matter how big the FileName array is declared.
  246. // This is required to make the EFI_FILE_INFO data structure ANSI compilant.
  247. //
  248. #define SIZE_OF_EFI_FILE_INFO EFI_FIELD_OFFSET(EFI_FILE_INFO,FileName)
  249. #define EFI_FILE_SYSTEM_INFO_ID \
  250. { 0x9576e93, 0x6d3f, 0x11d2, {0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b} }
  251. typedef struct {
  252. UINT64 Size;
  253. BOOLEAN ReadOnly;
  254. UINT64 VolumeSize;
  255. UINT64 FreeSpace;
  256. UINT32 BlockSize;
  257. CHAR16 VolumeLabel[1];
  258. } EFI_FILE_SYSTEM_INFO;
  259. //
  260. // The VolumeLabel field of the EFI_FILE_SYSTEM_INFO data structure is variable length.
  261. // Whenever code needs to know the size of the EFI_FILE_SYSTEM_INFO data structure, it needs
  262. // to be the size of the data structure without the VolumeLable field. The following macro
  263. // computes this size correctly no matter how big the VolumeLable array is declared.
  264. // This is required to make the EFI_FILE_SYSTEM_INFO data structure ANSI compilant.
  265. //
  266. #define SIZE_OF_EFI_FILE_SYSTEM_INFO EFI_FIELD_OFFSET(EFI_FILE_SYSTEM_INFO,VolumeLabel)
  267. #define EFI_FILE_SYSTEM_VOLUME_LABEL_INFO_ID \
  268. { 0xDB47D7D3,0xFE81, 0x11d3, {0x9A, 0x35, 0x00, 0x90, 0x27, 0x3F, 0xC1, 0x4D} }
  269. typedef struct {
  270. CHAR16 VolumeLabel[1];
  271. } EFI_FILE_SYSTEM_VOLUME_LABEL_INFO;
  272. #define SIZE_OF_EFI_FILE_SYSTEM_VOLUME_LABEL_INFO EFI_FIELD_OFFSET(EFI_FILE_SYSTEM_VOLUME_LABEL_INFO,VolumeLabel)
  273. //
  274. // Load file protocol
  275. //
  276. #define LOAD_FILE_PROTOCOL \
  277. { 0x56EC3091, 0x954C, 0x11d2, {0x8E, 0x3F, 0x00, 0xA0, 0xC9, 0x69, 0x72, 0x3B} }
  278. INTERFACE_DECL(_EFI_LOAD_FILE_INTERFACE);
  279. typedef
  280. EFI_STATUS
  281. (EFIAPI *EFI_LOAD_FILE) (
  282. IN struct _EFI_LOAD_FILE_INTERFACE *This,
  283. IN EFI_DEVICE_PATH *FilePath,
  284. IN BOOLEAN BootPolicy,
  285. IN OUT UINTN *BufferSize,
  286. IN VOID *Buffer OPTIONAL
  287. );
  288. typedef struct _EFI_LOAD_FILE_INTERFACE {
  289. EFI_LOAD_FILE LoadFile;
  290. } EFI_LOAD_FILE_INTERFACE;
  291. //
  292. // Device IO protocol
  293. //
  294. #define DEVICE_IO_PROTOCOL \
  295. { 0xaf6ac311, 0x84c3, 0x11d2, {0x8e, 0x3c, 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b} }
  296. INTERFACE_DECL(_EFI_DEVICE_IO_INTERFACE);
  297. typedef enum {
  298. IO_UINT8,
  299. IO_UINT16,
  300. IO_UINT32,
  301. IO_UINT64,
  302. //
  303. // Specification Change: Copy from MMIO to MMIO vs. MMIO to buffer, buffer to MMIO
  304. //
  305. MMIO_COPY_UINT8,
  306. MMIO_COPY_UINT16,
  307. MMIO_COPY_UINT32,
  308. MMIO_COPY_UINT64
  309. } EFI_IO_WIDTH;
  310. #define EFI_PCI_ADDRESS(_bus,_dev,_func) \
  311. ( (UINT64) ( (((UINTN)_bus) << 24) + (((UINTN)_dev) << 16) + (((UINTN)_func) << 8) ) )
  312. typedef
  313. EFI_STATUS
  314. (EFIAPI *EFI_DEVICE_IO) (
  315. IN struct _EFI_DEVICE_IO_INTERFACE *This,
  316. IN EFI_IO_WIDTH Width,
  317. IN UINT64 Address,
  318. IN UINTN Count,
  319. IN OUT VOID *Buffer
  320. );
  321. typedef struct {
  322. EFI_DEVICE_IO Read;
  323. EFI_DEVICE_IO Write;
  324. } EFI_IO_ACCESS;
  325. typedef
  326. EFI_STATUS
  327. (EFIAPI *EFI_PCI_DEVICE_PATH) (
  328. IN struct _EFI_DEVICE_IO_INTERFACE *This,
  329. IN UINT64 Address,
  330. IN OUT EFI_DEVICE_PATH **PciDevicePath
  331. );
  332. typedef enum {
  333. EfiBusMasterRead,
  334. EfiBusMasterWrite,
  335. EfiBusMasterCommonBuffer
  336. } EFI_IO_OPERATION_TYPE;
  337. typedef
  338. EFI_STATUS
  339. (EFIAPI *EFI_IO_MAP) (
  340. IN struct _EFI_DEVICE_IO_INTERFACE *This,
  341. IN EFI_IO_OPERATION_TYPE Operation,
  342. IN EFI_PHYSICAL_ADDRESS *HostAddress,
  343. IN OUT UINTN *NumberOfBytes,
  344. OUT EFI_PHYSICAL_ADDRESS *DeviceAddress,
  345. OUT VOID **Mapping
  346. );
  347. typedef
  348. EFI_STATUS
  349. (EFIAPI *EFI_IO_UNMAP) (
  350. IN struct _EFI_DEVICE_IO_INTERFACE *This,
  351. IN VOID *Mapping
  352. );
  353. typedef
  354. EFI_STATUS
  355. (EFIAPI *EFI_IO_ALLOCATE_BUFFER) (
  356. IN struct _EFI_DEVICE_IO_INTERFACE *This,
  357. IN EFI_ALLOCATE_TYPE Type,
  358. IN EFI_MEMORY_TYPE MemoryType,
  359. IN UINTN Pages,
  360. IN OUT EFI_PHYSICAL_ADDRESS *HostAddress
  361. );
  362. typedef
  363. EFI_STATUS
  364. (EFIAPI *EFI_IO_FLUSH) (
  365. IN struct _EFI_DEVICE_IO_INTERFACE *This
  366. );
  367. typedef
  368. EFI_STATUS
  369. (EFIAPI *EFI_IO_FREE_BUFFER) (
  370. IN struct _EFI_DEVICE_IO_INTERFACE *This,
  371. IN UINTN Pages,
  372. IN EFI_PHYSICAL_ADDRESS HostAddress
  373. );
  374. typedef struct _EFI_DEVICE_IO_INTERFACE {
  375. EFI_IO_ACCESS Mem;
  376. EFI_IO_ACCESS Io;
  377. EFI_IO_ACCESS Pci;
  378. EFI_IO_MAP Map;
  379. EFI_PCI_DEVICE_PATH PciDevicePath;
  380. EFI_IO_UNMAP Unmap;
  381. EFI_IO_ALLOCATE_BUFFER AllocateBuffer;
  382. EFI_IO_FLUSH Flush;
  383. EFI_IO_FREE_BUFFER FreeBuffer;
  384. } EFI_DEVICE_IO_INTERFACE;
  385. //
  386. // Unicode Collation protocol
  387. //
  388. #define UNICODE_COLLATION_PROTOCOL \
  389. { 0x1d85cd7f, 0xf43d, 0x11d2, {0x9a, 0xc, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d} }
  390. #define UNICODE_BYTE_ORDER_MARK (CHAR16)(0xfeff)
  391. INTERFACE_DECL(_EFI_UNICODE_COLLATION_INTERFACE);
  392. typedef
  393. INTN
  394. (EFIAPI *EFI_UNICODE_STRICOLL) (
  395. IN struct _EFI_UNICODE_COLLATION_INTERFACE *This,
  396. IN CHAR16 *s1,
  397. IN CHAR16 *s2
  398. );
  399. typedef
  400. BOOLEAN
  401. (EFIAPI *EFI_UNICODE_METAIMATCH) (
  402. IN struct _EFI_UNICODE_COLLATION_INTERFACE *This,
  403. IN CHAR16 *String,
  404. IN CHAR16 *Pattern
  405. );
  406. typedef
  407. VOID
  408. (EFIAPI *EFI_UNICODE_STRLWR) (
  409. IN struct _EFI_UNICODE_COLLATION_INTERFACE *This,
  410. IN OUT CHAR16 *Str
  411. );
  412. typedef
  413. VOID
  414. (EFIAPI *EFI_UNICODE_STRUPR) (
  415. IN struct _EFI_UNICODE_COLLATION_INTERFACE *This,
  416. IN OUT CHAR16 *Str
  417. );
  418. typedef
  419. VOID
  420. (EFIAPI *EFI_UNICODE_FATTOSTR) (
  421. IN struct _EFI_UNICODE_COLLATION_INTERFACE *This,
  422. IN UINTN FatSize,
  423. IN CHAR8 *Fat,
  424. OUT CHAR16 *String
  425. );
  426. typedef
  427. BOOLEAN
  428. (EFIAPI *EFI_UNICODE_STRTOFAT) (
  429. IN struct _EFI_UNICODE_COLLATION_INTERFACE *This,
  430. IN CHAR16 *String,
  431. IN UINTN FatSize,
  432. OUT CHAR8 *Fat
  433. );
  434. //
  435. // Hash Protocol
  436. //
  437. #define HASH_PROTOCOL \
  438. { 0xC5184932, 0xDBA5, 0x46DB, { 0xA5, 0xBA, 0xCC, 0x0B, 0xDA, 0x9C, 0x14, 0x35 } }
  439. #define EFI_HASH_ALGORITHM_SHA1 \
  440. { 0x2AE9D80F, 0x3FB2, 0x4095, { 0xB7, 0xB1, 0xE9, 0x31, 0x57, 0xB9, 0x46, 0xB6 } } // Deprecated
  441. #define EFI_HASH_ALGORITHM_SHA224 \
  442. { 0x8DF01A06, 0x9BD5, 0x4BF7, { 0xB0, 0x21, 0xDB, 0x4F, 0xD9, 0xCC, 0xF4, 0x5B } } // Deprecated
  443. #define EFI_HASH_ALGORITHM_SHA256 \
  444. { 0x51AA59DE, 0xFDF2, 0x4EA3, { 0xBC, 0x63, 0x87, 0x5F, 0xB7, 0x84, 0x2E, 0xE9 } } // Deprecated
  445. #define EFI_HASH_ALGORITHM_SHA384 \
  446. { 0xEFA96432, 0xDE33, 0x4DD2, { 0xAE, 0xE6, 0x32, 0x8C, 0x33, 0xDF, 0x77, 0x7A } } // Deprecated
  447. #define EFI_HASH_ALGORITHM_SHA512 \
  448. { 0xCAA4381E, 0x750C, 0x4770, { 0xB8, 0x70, 0x7A, 0x23, 0xB4, 0xE4, 0x21, 0x30 } } // Deprecated
  449. #define EFI_HASH_ALGORITHM_MD5 \
  450. { 0x0AF7C79C, 0x65B5, 0x4319, { 0xB0, 0xAE, 0x44, 0xEC, 0x48, 0x4E, 0x4A, 0xD7 } } // Deprecated
  451. #define EFI_HASH_ALGORITHM_SHA1_NOPAD \
  452. { 0x24C5DC2F, 0x53E2, 0x40CA, { 0x9E, 0xD6, 0xA5, 0xD9, 0xA4, 0x9F, 0x46, 0x3B } }
  453. #define EFI_HASH_ALGORITHM_SHA256_NOPAD \
  454. { 0x8628752A, 0x6CB7, 0x4814, { 0x96, 0xFC, 0x24, 0xA8, 0x15, 0xAC, 0x22, 0x26 } }
  455. INTERFACE_DECL(_EFI_HASH);
  456. typedef UINT8 EFI_MD5_HASH[16];
  457. typedef UINT8 EFI_SHA1_HASH[20];
  458. typedef UINT8 EFI_SHA224_HASH[28];
  459. typedef UINT8 EFI_SHA256_HASH[32];
  460. typedef UINT8 EFI_SHA384_HASH[48];
  461. typedef UINT8 EFI_SHA512_HASH[64];
  462. typedef union _EFI_HASH_OUTPUT {
  463. EFI_MD5_HASH *Md5Hash;
  464. EFI_SHA1_HASH *Sha1Hash;
  465. EFI_SHA224_HASH *Sha224Hash;
  466. EFI_SHA256_HASH *Sha256Hash;
  467. EFI_SHA384_HASH *Sha384Hash;
  468. EFI_SHA512_HASH *Sha512Hash;
  469. } EFI_HASH_OUTPUT;
  470. typedef
  471. EFI_STATUS
  472. (EFIAPI *EFI_HASH_GET_HASH_SIZE) (
  473. IN CONST struct _EFI_HASH *This,
  474. IN CONST EFI_GUID *HashAlgorithm,
  475. OUT UINTN *HashSize);
  476. typedef
  477. EFI_STATUS
  478. (EFIAPI *EFI_HASH_HASH) (
  479. IN CONST struct _EFI_HASH *This,
  480. IN CONST EFI_GUID *HashAlgorithm,
  481. IN BOOLEAN Extend,
  482. IN CONST UINT8 *Message,
  483. IN UINT64 MessageSize,
  484. IN OUT EFI_HASH_OUTPUT *Hash);
  485. typedef struct _EFI_HASH {
  486. EFI_HASH_GET_HASH_SIZE GetHashSize;
  487. EFI_HASH_HASH Hash;
  488. } EFI_HASH;
  489. typedef struct _EFI_UNICODE_COLLATION_INTERFACE {
  490. // general
  491. EFI_UNICODE_STRICOLL StriColl;
  492. EFI_UNICODE_METAIMATCH MetaiMatch;
  493. EFI_UNICODE_STRLWR StrLwr;
  494. EFI_UNICODE_STRUPR StrUpr;
  495. // for supporting fat volumes
  496. EFI_UNICODE_FATTOSTR FatToStr;
  497. EFI_UNICODE_STRTOFAT StrToFat;
  498. CHAR8 *SupportedLanguages;
  499. } EFI_UNICODE_COLLATION_INTERFACE;
  500. /* Graphics output protocol */
  501. #define EFI_GRAPHICS_OUTPUT_PROTOCOL_GUID \
  502. { \
  503. 0x9042a9de, 0x23dc, 0x4a38, {0x96, 0xfb, 0x7a, 0xde, 0xd0, 0x80, 0x51, 0x6a } \
  504. }
  505. typedef struct _EFI_GRAPHICS_OUTPUT_PROTOCOL EFI_GRAPHICS_OUTPUT_PROTOCOL;
  506. typedef struct {
  507. UINT32 RedMask;
  508. UINT32 GreenMask;
  509. UINT32 BlueMask;
  510. UINT32 ReservedMask;
  511. } EFI_PIXEL_BITMASK;
  512. typedef enum {
  513. PixelRedGreenBlueReserved8BitPerColor,
  514. PixelBlueGreenRedReserved8BitPerColor,
  515. PixelBitMask,
  516. PixelBltOnly,
  517. PixelFormatMax
  518. } EFI_GRAPHICS_PIXEL_FORMAT;
  519. typedef struct {
  520. UINT32 Version;
  521. UINT32 HorizontalResolution;
  522. UINT32 VerticalResolution;
  523. EFI_GRAPHICS_PIXEL_FORMAT PixelFormat;
  524. EFI_PIXEL_BITMASK PixelInformation;
  525. UINT32 PixelsPerScanLine;
  526. } EFI_GRAPHICS_OUTPUT_MODE_INFORMATION;
  527. /**
  528. Return the current video mode information.
  529. @param This Protocol instance pointer.
  530. @param ModeNumber The mode number to return information on.
  531. @param SizeOfInfo A pointer to the size, in bytes, of the Info buffer.
  532. @param Info A pointer to callee allocated buffer that returns information about ModeNumber.
  533. @retval EFI_SUCCESS Mode information returned.
  534. @retval EFI_BUFFER_TOO_SMALL The Info buffer was too small.
  535. @retval EFI_DEVICE_ERROR A hardware error occurred trying to retrieve the video mode.
  536. @retval EFI_NOT_STARTED Video display is not initialized. Call SetMode ()
  537. @retval EFI_INVALID_PARAMETER One of the input args was NULL.
  538. **/
  539. typedef
  540. EFI_STATUS
  541. (EFIAPI *EFI_GRAPHICS_OUTPUT_PROTOCOL_QUERY_MODE) (
  542. IN EFI_GRAPHICS_OUTPUT_PROTOCOL *This,
  543. IN UINT32 ModeNumber,
  544. OUT UINTN *SizeOfInfo,
  545. OUT EFI_GRAPHICS_OUTPUT_MODE_INFORMATION **Info
  546. )
  547. ;
  548. /**
  549. Return the current video mode information.
  550. @param This Protocol instance pointer.
  551. @param ModeNumber The mode number to be set.
  552. @retval EFI_SUCCESS Graphics mode was changed.
  553. @retval EFI_DEVICE_ERROR The device had an error and could not complete the request.
  554. @retval EFI_UNSUPPORTED ModeNumber is not supported by this device.
  555. **/
  556. typedef
  557. EFI_STATUS
  558. (EFIAPI *EFI_GRAPHICS_OUTPUT_PROTOCOL_SET_MODE) (
  559. IN EFI_GRAPHICS_OUTPUT_PROTOCOL *This,
  560. IN UINT32 ModeNumber
  561. );
  562. typedef struct {
  563. UINT8 Blue;
  564. UINT8 Green;
  565. UINT8 Red;
  566. UINT8 Reserved;
  567. } EFI_GRAPHICS_OUTPUT_BLT_PIXEL;
  568. typedef union {
  569. EFI_GRAPHICS_OUTPUT_BLT_PIXEL Pixel;
  570. UINT32 Raw;
  571. } EFI_GRAPHICS_OUTPUT_BLT_PIXEL_UNION;
  572. typedef enum {
  573. EfiBltVideoFill,
  574. EfiBltVideoToBltBuffer,
  575. EfiBltBufferToVideo,
  576. EfiBltVideoToVideo,
  577. EfiGraphicsOutputBltOperationMax
  578. } EFI_GRAPHICS_OUTPUT_BLT_OPERATION;
  579. /**
  580. The following table defines actions for BltOperations:
  581. <B>EfiBltVideoFill</B> - Write data from the BltBuffer pixel (SourceX, SourceY)
  582. directly to every pixel of the video display rectangle
  583. (DestinationX, DestinationY) (DestinationX + Width, DestinationY + Height).
  584. Only one pixel will be used from the BltBuffer. Delta is NOT used.
  585. <B>EfiBltVideoToBltBuffer</B> - Read data from the video display rectangle
  586. (SourceX, SourceY) (SourceX + Width, SourceY + Height) and place it in
  587. the BltBuffer rectangle (DestinationX, DestinationY )
  588. (DestinationX + Width, DestinationY + Height). If DestinationX or
  589. DestinationY is not zero then Delta must be set to the length in bytes
  590. of a row in the BltBuffer.
  591. <B>EfiBltBufferToVideo</B> - Write data from the BltBuffer rectangle
  592. (SourceX, SourceY) (SourceX + Width, SourceY + Height) directly to the
  593. video display rectangle (DestinationX, DestinationY)
  594. (DestinationX + Width, DestinationY + Height). If SourceX or SourceY is
  595. not zero then Delta must be set to the length in bytes of a row in the
  596. BltBuffer.
  597. <B>EfiBltVideoToVideo</B> - Copy from the video display rectangle (SourceX, SourceY)
  598. (SourceX + Width, SourceY + Height) .to the video display rectangle
  599. (DestinationX, DestinationY) (DestinationX + Width, DestinationY + Height).
  600. The BltBuffer and Delta are not used in this mode.
  601. @param This Protocol instance pointer.
  602. @param BltBuffer Buffer containing data to blit into video buffer. This
  603. buffer has a size of Width*Height*sizeof(EFI_GRAPHICS_OUTPUT_BLT_PIXEL)
  604. @param BltOperation Operation to perform on BlitBuffer and video memory
  605. @param SourceX X coordinate of source for the BltBuffer.
  606. @param SourceY Y coordinate of source for the BltBuffer.
  607. @param DestinationX X coordinate of destination for the BltBuffer.
  608. @param DestinationY Y coordinate of destination for the BltBuffer.
  609. @param Width Width of rectangle in BltBuffer in pixels.
  610. @param Height Hight of rectangle in BltBuffer in pixels.
  611. @param Delta OPTIONAL
  612. @retval EFI_SUCCESS The Blt operation completed.
  613. @retval EFI_INVALID_PARAMETER BltOperation is not valid.
  614. @retval EFI_DEVICE_ERROR A hardware error occured writting to the video buffer.
  615. **/
  616. typedef
  617. EFI_STATUS
  618. (EFIAPI *EFI_GRAPHICS_OUTPUT_PROTOCOL_BLT) (
  619. IN EFI_GRAPHICS_OUTPUT_PROTOCOL *This,
  620. IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL *BltBuffer, OPTIONAL
  621. IN EFI_GRAPHICS_OUTPUT_BLT_OPERATION BltOperation,
  622. IN UINTN SourceX,
  623. IN UINTN SourceY,
  624. IN UINTN DestinationX,
  625. IN UINTN DestinationY,
  626. IN UINTN Width,
  627. IN UINTN Height,
  628. IN UINTN Delta OPTIONAL
  629. );
  630. typedef struct {
  631. UINT32 MaxMode;
  632. UINT32 Mode;
  633. EFI_GRAPHICS_OUTPUT_MODE_INFORMATION *Info;
  634. UINTN SizeOfInfo;
  635. EFI_PHYSICAL_ADDRESS FrameBufferBase;
  636. UINTN FrameBufferSize;
  637. } EFI_GRAPHICS_OUTPUT_PROTOCOL_MODE;
  638. struct _EFI_GRAPHICS_OUTPUT_PROTOCOL {
  639. EFI_GRAPHICS_OUTPUT_PROTOCOL_QUERY_MODE QueryMode;
  640. EFI_GRAPHICS_OUTPUT_PROTOCOL_SET_MODE SetMode;
  641. EFI_GRAPHICS_OUTPUT_PROTOCOL_BLT Blt;
  642. EFI_GRAPHICS_OUTPUT_PROTOCOL_MODE *Mode;
  643. };
  644. INTERFACE_DECL(_EFI_SERVICE_BINDING);
  645. typedef
  646. EFI_STATUS
  647. (EFIAPI *EFI_SERVICE_BINDING_CREATE_CHILD) (
  648. IN struct _EFI_SERVICE_BINDING *This,
  649. IN EFI_HANDLE *ChildHandle
  650. );
  651. typedef
  652. EFI_STATUS
  653. (EFIAPI *EFI_SERVICE_BINDING_DESTROY_CHILD) (
  654. IN struct _EFI_SERVICE_BINDING *This,
  655. IN EFI_HANDLE ChildHandle
  656. );
  657. typedef struct _EFI_SERVICE_BINDING {
  658. EFI_SERVICE_BINDING_CREATE_CHILD CreateChild;
  659. EFI_SERVICE_BINDING_DESTROY_CHILD DestroyChild;
  660. } EFI_SERVICE_BINDING;
  661. //
  662. // Driver Binding Protocol
  663. //
  664. #define DRIVER_BINDING_PROTOCOL \
  665. { 0x18A031AB, 0xB443, 0x4D1A, { 0xA5, 0xC0, 0x0C, 0x09, 0x26, 0x1E, 0x9F, 0x71} }
  666. INTERFACE_DECL(_EFI_DRIVER_BINDING);
  667. typedef
  668. EFI_STATUS
  669. (EFIAPI *EFI_DRIVER_SUPPORTED) (
  670. IN struct _EFI_DRIVER_BINDING *This,
  671. IN EFI_HANDLE ControllerHandle,
  672. IN EFI_DEVICE_PATH *RemainingDevicePath OPTIONAL);
  673. typedef
  674. EFI_STATUS
  675. (EFIAPI *EFI_DRIVER_START) (
  676. IN struct _EFI_DRIVER_BINDING *This,
  677. IN EFI_HANDLE ControllerHandle,
  678. IN EFI_DEVICE_PATH *RemainingDevicePath OPTIONAL);
  679. typedef
  680. EFI_STATUS
  681. (EFIAPI *EFI_DRIVER_STOP) (
  682. IN struct _EFI_DRIVER_BINDING *This,
  683. IN EFI_HANDLE ControllerHandle,
  684. IN UINTN NumberOfChildren,
  685. IN EFI_HANDLE *ChildHandleBuffer OPTIONAL);
  686. typedef struct _EFI_DRIVER_BINDING {
  687. EFI_DRIVER_SUPPORTED Supported;
  688. EFI_DRIVER_START Start;
  689. EFI_DRIVER_STOP Stop;
  690. UINT32 Version;
  691. EFI_HANDLE ImageHandle;
  692. EFI_HANDLE DriverBindingHandle;
  693. } EFI_DRIVER_BINDING;
  694. //
  695. // Component Name Protocol
  696. // Deprecated - use Component Name 2 Protocol instead
  697. //
  698. #define COMPONENT_NAME_PROTOCOL \
  699. {0x107A772C, 0xD5E1, 0x11D4, { 0x9A, 0x46, 0x00, 0x90, 0x27, 0x3F, 0xC1, 0x4D} }
  700. INTERFACE_DECL(_EFI_COMPONENT_NAME);
  701. typedef
  702. EFI_STATUS
  703. (EFIAPI *EFI_COMPONENT_NAME_GET_DRIVER_NAME) (
  704. IN struct _EFI_COMPONENT_NAME *This,
  705. IN CHAR8 *Language,
  706. OUT CHAR16 **DriverName);
  707. typedef
  708. EFI_STATUS
  709. (EFIAPI *EFI_COMPONENT_NAME_GET_CONTROLLER_NAME) (
  710. IN struct _EFI_COMPONENT_NAME *This,
  711. IN EFI_HANDLE ControllerHandle,
  712. IN EFI_HANDLE ChildHandle OPTIONAL,
  713. IN CHAR8 *Language,
  714. OUT CHAR16 **ControllerName);
  715. typedef struct _EFI_COMPONENT_NAME {
  716. EFI_COMPONENT_NAME_GET_DRIVER_NAME GetDriverName;
  717. EFI_COMPONENT_NAME_GET_CONTROLLER_NAME GetControllerName;
  718. CHAR8 *SupportedLanguages;
  719. } EFI_COMPONENT_NAME;
  720. //
  721. // Component Name 2 Protocol
  722. //
  723. #define COMPONENT_NAME2_PROTOCOL \
  724. {0x6A7A5CFF, 0xE8D9, 0x4F70, { 0xBA, 0xDA, 0x75, 0xAB, 0x30, 0x25, 0xCE, 0x14} }
  725. INTERFACE_DECL(_EFI_COMPONENT_NAME2);
  726. typedef
  727. EFI_STATUS
  728. (EFIAPI *EFI_COMPONENT_NAME2_GET_DRIVER_NAME) (
  729. IN struct _EFI_COMPONENT_NAME2 *This,
  730. IN CHAR8 *Language,
  731. OUT CHAR16 **DriverName);
  732. typedef
  733. EFI_STATUS
  734. (EFIAPI *EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME) (
  735. IN struct _EFI_COMPONENT_NAME2 *This,
  736. IN EFI_HANDLE ControllerHandle,
  737. IN EFI_HANDLE ChildHandle OPTIONAL,
  738. IN CHAR8 *Language,
  739. OUT CHAR16 **ControllerName);
  740. typedef struct _EFI_COMPONENT_NAME2 {
  741. EFI_COMPONENT_NAME2_GET_DRIVER_NAME GetDriverName;
  742. EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME GetControllerName;
  743. CHAR8 *SupportedLanguages;
  744. } EFI_COMPONENT_NAME2;
  745. //
  746. // Loaded Image Protocol
  747. //
  748. #define LOADED_IMAGE_PROTOCOL \
  749. { 0x5B1B31A1, 0x9562, 0x11d2, {0x8E, 0x3F, 0x00, 0xA0, 0xC9, 0x69, 0x72, 0x3B} }
  750. typedef
  751. EFI_STATUS
  752. (EFIAPI *EFI_IMAGE_UNLOAD) (
  753. IN EFI_HANDLE ImageHandle
  754. );
  755. #define EFI_IMAGE_INFORMATION_REVISION 0x1000
  756. typedef struct {
  757. UINT32 Revision;
  758. EFI_HANDLE ParentHandle;
  759. struct _EFI_SYSTEM_TABLE *SystemTable;
  760. // Source location of image
  761. EFI_HANDLE DeviceHandle;
  762. EFI_DEVICE_PATH *FilePath;
  763. VOID *Reserved;
  764. // Images load options
  765. UINT32 LoadOptionsSize;
  766. VOID *LoadOptions;
  767. // Location of where image was loaded
  768. VOID *ImageBase;
  769. UINT64 ImageSize;
  770. EFI_MEMORY_TYPE ImageCodeType;
  771. EFI_MEMORY_TYPE ImageDataType;
  772. // If the driver image supports a dynamic unload request
  773. EFI_IMAGE_UNLOAD Unload;
  774. } EFI_LOADED_IMAGE;
  775. //
  776. // EFI_RNG_PROTOCOL
  777. //
  778. #define EFI_RNG_PROTOCOL_GUID \
  779. { 0x3152bca5, 0xeade, 0x433d, {0x86, 0x2e, 0xc0, 0x1c, 0xdc, 0x29, 0x1f, 0x44} }
  780. typedef EFI_GUID EFI_RNG_ALGORITHM;
  781. #define EFI_RNG_ALGORITHM_SP800_90_HASH_256_GUID \
  782. {0xa7af67cb, 0x603b, 0x4d42, {0xba, 0x21, 0x70, 0xbf, 0xb6, 0x29, 0x3f, 0x96} }
  783. #define EFI_RNG_ALGORITHM_SP800_90_HMAC_256_GUID \
  784. {0xc5149b43, 0xae85, 0x4f53, {0x99, 0x82, 0xb9, 0x43, 0x35, 0xd3, 0xa9, 0xe7} }
  785. #define EFI_RNG_ALGORITHM_SP800_90_CTR_256_GUID \
  786. {0x44f0de6e, 0x4d8c, 0x4045, {0xa8, 0xc7, 0x4d, 0xd1, 0x68, 0x85, 0x6b, 0x9e} }
  787. #define EFI_RNG_ALGORITHM_X9_31_3DES_GUID \
  788. {0x63c4785a, 0xca34, 0x4012, {0xa3, 0xc8, 0x0b, 0x6a, 0x32, 0x4f, 0x55, 0x46} }
  789. #define EFI_RNG_ALGORITHM_X9_31_AES_GUID \
  790. {0xacd03321, 0x777e, 0x4d3d, {0xb1, 0xc8, 0x20, 0xcf, 0xd8, 0x88, 0x20, 0xc9} }
  791. #define EFI_RNG_ALGORITHM_RAW \
  792. {0xe43176d7, 0xb6e8, 0x4827, {0xb7, 0x84, 0x7f, 0xfd, 0xc4, 0xb6, 0x85, 0x61} }
  793. INTERFACE_DECL(_EFI_RNG_PROTOCOL);
  794. typedef
  795. EFI_STATUS
  796. (EFIAPI *EFI_RNG_GET_INFO) (
  797. IN struct _EFI_RNG_PROTOCOL *This,
  798. IN OUT UINTN *RNGAlgorithmListSize,
  799. OUT EFI_RNG_ALGORITHM *RNGAlgorithmList
  800. );
  801. typedef
  802. EFI_STATUS
  803. (EFIAPI *EFI_RNG_GET_RNG) (
  804. IN struct _EFI_RNG_PROTOCOL *This,
  805. IN EFI_RNG_ALGORITHM *RNGAlgorithm, OPTIONAL
  806. IN UINTN RNGValueLength,
  807. OUT UINT8 *RNGValue
  808. );
  809. typedef struct _EFI_RNG_PROTOCOL {
  810. EFI_RNG_GET_INFO GetInfo;
  811. EFI_RNG_GET_RNG GetRNG;
  812. } EFI_RNG_PROTOCOL;
  813. #endif