Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

551 lines
14 KiB

  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. * Device Path protocol
  13. */
  14. #define DEVICE_PATH_PROTOCOL \
  15. { 0x9576e91, 0x6d3f, 0x11d2, 0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b }
  16. /*
  17. * Block IO protocol
  18. */
  19. #define BLOCK_IO_PROTOCOL \
  20. { 0x964e5b21, 0x6459, 0x11d2, 0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b }
  21. #define EFI_BLOCK_IO_INTERFACE_REVISION 0x00010000
  22. INTERFACE_DECL(_EFI_BLOCK_IO);
  23. typedef
  24. EFI_STATUS
  25. (EFIAPI *EFI_BLOCK_RESET) (
  26. IN struct _EFI_BLOCK_IO *This,
  27. IN BOOLEAN ExtendedVerification
  28. );
  29. typedef
  30. EFI_STATUS
  31. (EFIAPI *EFI_BLOCK_READ) (
  32. IN struct _EFI_BLOCK_IO *This,
  33. IN UINT32 MediaId,
  34. IN EFI_LBA LBA,
  35. IN UINTN BufferSize,
  36. OUT VOID *Buffer
  37. );
  38. typedef
  39. EFI_STATUS
  40. (EFIAPI *EFI_BLOCK_WRITE) (
  41. IN struct _EFI_BLOCK_IO *This,
  42. IN UINT32 MediaId,
  43. IN EFI_LBA LBA,
  44. IN UINTN BufferSize,
  45. IN VOID *Buffer
  46. );
  47. typedef
  48. EFI_STATUS
  49. (EFIAPI *EFI_BLOCK_FLUSH) (
  50. IN struct _EFI_BLOCK_IO *This
  51. );
  52. typedef struct {
  53. UINT32 MediaId;
  54. BOOLEAN RemovableMedia;
  55. BOOLEAN MediaPresent;
  56. BOOLEAN LogicalPartition;
  57. BOOLEAN ReadOnly;
  58. BOOLEAN WriteCaching;
  59. UINT32 BlockSize;
  60. UINT32 IoAlign;
  61. EFI_LBA LastBlock;
  62. } EFI_BLOCK_IO_MEDIA;
  63. typedef struct _EFI_BLOCK_IO {
  64. UINT64 Revision;
  65. EFI_BLOCK_IO_MEDIA *Media;
  66. EFI_BLOCK_RESET Reset;
  67. EFI_BLOCK_READ ReadBlocks;
  68. EFI_BLOCK_WRITE WriteBlocks;
  69. EFI_BLOCK_FLUSH FlushBlocks;
  70. } EFI_BLOCK_IO;
  71. /*
  72. * Disk Block IO protocol
  73. */
  74. #define DISK_IO_PROTOCOL \
  75. { 0xce345171, 0xba0b, 0x11d2, 0x8e, 0x4f, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b }
  76. #define EFI_DISK_IO_INTERFACE_REVISION 0x00010000
  77. INTERFACE_DECL(_EFI_DISK_IO);
  78. typedef
  79. EFI_STATUS
  80. (EFIAPI *EFI_DISK_READ) (
  81. IN struct _EFI_DISK_IO *This,
  82. IN UINT32 MediaId,
  83. IN UINT64 Offset,
  84. IN UINTN BufferSize,
  85. OUT VOID *Buffer
  86. );
  87. typedef
  88. EFI_STATUS
  89. (EFIAPI *EFI_DISK_WRITE) (
  90. IN struct _EFI_DISK_IO *This,
  91. IN UINT32 MediaId,
  92. IN UINT64 Offset,
  93. IN UINTN BufferSize,
  94. IN VOID *Buffer
  95. );
  96. typedef struct _EFI_DISK_IO {
  97. UINT64 Revision;
  98. EFI_DISK_READ ReadDisk;
  99. EFI_DISK_WRITE WriteDisk;
  100. } EFI_DISK_IO;
  101. /*
  102. * Simple file system protocol
  103. */
  104. #define SIMPLE_FILE_SYSTEM_PROTOCOL \
  105. { 0x964e5b22, 0x6459, 0x11d2, 0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b }
  106. INTERFACE_DECL(_EFI_FILE_IO_INTERFACE);
  107. INTERFACE_DECL(_EFI_FILE_HANDLE);
  108. typedef
  109. EFI_STATUS
  110. (EFIAPI *EFI_VOLUME_OPEN) (
  111. IN struct _EFI_FILE_IO_INTERFACE *This,
  112. OUT struct _EFI_FILE_HANDLE **Root
  113. );
  114. #define EFI_FILE_IO_INTERFACE_REVISION 0x00010000
  115. typedef struct _EFI_FILE_IO_INTERFACE {
  116. UINT64 Revision;
  117. EFI_VOLUME_OPEN OpenVolume;
  118. } EFI_FILE_IO_INTERFACE;
  119. /*
  120. *
  121. */
  122. typedef
  123. EFI_STATUS
  124. (EFIAPI *EFI_FILE_OPEN) (
  125. IN struct _EFI_FILE_HANDLE *File,
  126. OUT struct _EFI_FILE_HANDLE **NewHandle,
  127. IN CHAR16 *FileName,
  128. IN UINT64 OpenMode,
  129. IN UINT64 Attributes
  130. );
  131. /* Open modes */
  132. #define EFI_FILE_MODE_READ 0x0000000000000001
  133. #define EFI_FILE_MODE_WRITE 0x0000000000000002
  134. #define EFI_FILE_MODE_CREATE 0x8000000000000000
  135. /* File attributes */
  136. #define EFI_FILE_READ_ONLY 0x0000000000000001
  137. #define EFI_FILE_HIDDEN 0x0000000000000002
  138. #define EFI_FILE_SYSTEM 0x0000000000000004
  139. #define EFI_FILE_RESERVIED 0x0000000000000008
  140. #define EFI_FILE_DIRECTORY 0x0000000000000010
  141. #define EFI_FILE_ARCHIVE 0x0000000000000020
  142. #define EFI_FILE_VALID_ATTR 0x0000000000000037
  143. typedef
  144. EFI_STATUS
  145. (EFIAPI *EFI_FILE_CLOSE) (
  146. IN struct _EFI_FILE_HANDLE *File
  147. );
  148. typedef
  149. EFI_STATUS
  150. (EFIAPI *EFI_FILE_DELETE) (
  151. IN struct _EFI_FILE_HANDLE *File
  152. );
  153. typedef
  154. EFI_STATUS
  155. (EFIAPI *EFI_FILE_READ) (
  156. IN struct _EFI_FILE_HANDLE *File,
  157. IN OUT UINTN *BufferSize,
  158. OUT VOID *Buffer
  159. );
  160. typedef
  161. EFI_STATUS
  162. (EFIAPI *EFI_FILE_WRITE) (
  163. IN struct _EFI_FILE_HANDLE *File,
  164. IN OUT UINTN *BufferSize,
  165. IN VOID *Buffer
  166. );
  167. typedef
  168. EFI_STATUS
  169. (EFIAPI *EFI_FILE_SET_POSITION) (
  170. IN struct _EFI_FILE_HANDLE *File,
  171. IN UINT64 Position
  172. );
  173. typedef
  174. EFI_STATUS
  175. (EFIAPI *EFI_FILE_GET_POSITION) (
  176. IN struct _EFI_FILE_HANDLE *File,
  177. OUT UINT64 *Position
  178. );
  179. typedef
  180. EFI_STATUS
  181. (EFIAPI *EFI_FILE_GET_INFO) (
  182. IN struct _EFI_FILE_HANDLE *File,
  183. IN EFI_GUID *InformationType,
  184. IN OUT UINTN *BufferSize,
  185. OUT VOID *Buffer
  186. );
  187. typedef
  188. EFI_STATUS
  189. (EFIAPI *EFI_FILE_SET_INFO) (
  190. IN struct _EFI_FILE_HANDLE *File,
  191. IN EFI_GUID *InformationType,
  192. IN UINTN BufferSize,
  193. IN VOID *Buffer
  194. );
  195. typedef
  196. EFI_STATUS
  197. (EFIAPI *EFI_FILE_FLUSH) (
  198. IN struct _EFI_FILE_HANDLE *File
  199. );
  200. #define EFI_FILE_HANDLE_REVISION 0x00010000
  201. typedef struct _EFI_FILE_HANDLE {
  202. UINT64 Revision;
  203. EFI_FILE_OPEN Open;
  204. EFI_FILE_CLOSE Close;
  205. EFI_FILE_DELETE Delete;
  206. EFI_FILE_READ Read;
  207. EFI_FILE_WRITE Write;
  208. EFI_FILE_GET_POSITION GetPosition;
  209. EFI_FILE_SET_POSITION SetPosition;
  210. EFI_FILE_GET_INFO GetInfo;
  211. EFI_FILE_SET_INFO SetInfo;
  212. EFI_FILE_FLUSH Flush;
  213. } EFI_FILE, *EFI_FILE_HANDLE;
  214. /*
  215. * File information types
  216. */
  217. #define EFI_FILE_INFO_ID \
  218. { 0x9576e92, 0x6d3f, 0x11d2, 0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b }
  219. typedef struct {
  220. UINT64 Size;
  221. UINT64 FileSize;
  222. UINT64 PhysicalSize;
  223. EFI_TIME CreateTime;
  224. EFI_TIME LastAccessTime;
  225. EFI_TIME ModificationTime;
  226. UINT64 Attribute;
  227. CHAR16 FileName[1];
  228. } EFI_FILE_INFO;
  229. /*
  230. * The FileName field of the EFI_FILE_INFO data structure is variable length.
  231. * Whenever code needs to know the size of the EFI_FILE_INFO data structure, it needs to
  232. * be the size of the data structure without the FileName field. The following macro
  233. * computes this size correctly no matter how big the FileName array is declared.
  234. * This is required to make the EFI_FILE_INFO data structure ANSI compilant.
  235. */
  236. #define SIZE_OF_EFI_FILE_INFO EFI_FIELD_OFFSET(EFI_FILE_INFO,FileName)
  237. #define EFI_FILE_SYSTEM_INFO_ID \
  238. { 0x9576e93, 0x6d3f, 0x11d2, 0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b }
  239. typedef struct {
  240. UINT64 Size;
  241. BOOLEAN ReadOnly;
  242. UINT64 VolumeSize;
  243. UINT64 FreeSpace;
  244. UINT32 BlockSize;
  245. CHAR16 VolumeLabel[1];
  246. } EFI_FILE_SYSTEM_INFO;
  247. /*
  248. * The VolumeLabel field of the EFI_FILE_SYSTEM_INFO data structure is variable length.
  249. * Whenever code needs to know the size of the EFI_FILE_SYSTEM_INFO data structure, it needs
  250. * to be the size of the data structure without the VolumeLable field. The following macro
  251. * computes this size correctly no matter how big the VolumeLable array is declared.
  252. * This is required to make the EFI_FILE_SYSTEM_INFO data structure ANSI compilant.
  253. */
  254. #define SIZE_OF_EFI_FILE_SYSTEM_INFO EFI_FIELD_OFFSET(EFI_FILE_SYSTEM_INFO,VolumeLabel)
  255. #define EFI_FILE_SYSTEM_VOLUME_LABEL_INFO_ID \
  256. { 0xDB47D7D3,0xFE81, 0x11d3, 0x9A, 0x35, 0x00, 0x90, 0x27, 0x3F, 0xC1, 0x4D }
  257. typedef struct {
  258. CHAR16 VolumeLabel[1];
  259. } EFI_FILE_SYSTEM_VOLUME_LABEL_INFO;
  260. #define SIZE_OF_EFI_FILE_SYSTEM_VOLUME_LABEL_INFO EFI_FIELD_OFFSET(EFI_FILE_SYSTEM_VOLUME_LABEL_INFO,VolumeLabel)
  261. /*
  262. * Load file protocol
  263. */
  264. #define LOAD_FILE_PROTOCOL \
  265. { 0x56EC3091, 0x954C, 0x11d2, 0x8E, 0x3F, 0x00, 0xA0, 0xC9, 0x69, 0x72, 0x3B }
  266. INTERFACE_DECL(_EFI_LOAD_FILE_INTERFACE);
  267. typedef
  268. EFI_STATUS
  269. (EFIAPI *EFI_LOAD_FILE) (
  270. IN struct _EFI_LOAD_FILE_INTERFACE *This,
  271. IN EFI_DEVICE_PATH *FilePath,
  272. IN BOOLEAN BootPolicy,
  273. IN OUT UINTN *BufferSize,
  274. IN VOID *Buffer OPTIONAL
  275. );
  276. typedef struct _EFI_LOAD_FILE_INTERFACE {
  277. EFI_LOAD_FILE LoadFile;
  278. } EFI_LOAD_FILE_INTERFACE;
  279. /*
  280. * Device IO protocol
  281. */
  282. #define DEVICE_IO_PROTOCOL \
  283. { 0xaf6ac311, 0x84c3, 0x11d2, 0x8e, 0x3c, 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b }
  284. INTERFACE_DECL(_EFI_DEVICE_IO_INTERFACE);
  285. typedef enum {
  286. IO_UINT8,
  287. IO_UINT16,
  288. IO_UINT32,
  289. IO_UINT64,
  290. /*
  291. * Specification Change: Copy from MMIO to MMIO vs. MMIO to buffer, buffer to MMIO
  292. */
  293. MMIO_COPY_UINT8,
  294. MMIO_COPY_UINT16,
  295. MMIO_COPY_UINT32,
  296. MMIO_COPY_UINT64
  297. } EFI_IO_WIDTH;
  298. #define EFI_PCI_ADDRESS(_bus,_dev,_func) \
  299. ( (UINT64) ( (((UINTN)_bus) << 24) + (((UINTN)_dev) << 16) + (((UINTN)_func) << 8) ) )
  300. typedef
  301. EFI_STATUS
  302. (EFIAPI *EFI_DEVICE_IO) (
  303. IN struct _EFI_DEVICE_IO_INTERFACE *This,
  304. IN EFI_IO_WIDTH Width,
  305. IN UINT64 Address,
  306. IN UINTN Count,
  307. IN OUT VOID *Buffer
  308. );
  309. typedef struct {
  310. EFI_DEVICE_IO Read;
  311. EFI_DEVICE_IO Write;
  312. } EFI_IO_ACCESS;
  313. typedef
  314. EFI_STATUS
  315. (EFIAPI *EFI_PCI_DEVICE_PATH) (
  316. IN struct _EFI_DEVICE_IO_INTERFACE *This,
  317. IN UINT64 Address,
  318. IN OUT EFI_DEVICE_PATH **PciDevicePath
  319. );
  320. typedef enum {
  321. EfiBusMasterRead,
  322. EfiBusMasterWrite,
  323. EfiBusMasterCommonBuffer
  324. } EFI_IO_OPERATION_TYPE;
  325. typedef
  326. EFI_STATUS
  327. (EFIAPI *EFI_IO_MAP) (
  328. IN struct _EFI_DEVICE_IO_INTERFACE *This,
  329. IN EFI_IO_OPERATION_TYPE Operation,
  330. IN EFI_PHYSICAL_ADDRESS *HostAddress,
  331. IN OUT UINTN *NumberOfBytes,
  332. OUT EFI_PHYSICAL_ADDRESS *DeviceAddress,
  333. OUT VOID **Mapping
  334. );
  335. typedef
  336. EFI_STATUS
  337. (EFIAPI *EFI_IO_UNMAP) (
  338. IN struct _EFI_DEVICE_IO_INTERFACE *This,
  339. IN VOID *Mapping
  340. );
  341. typedef
  342. EFI_STATUS
  343. (EFIAPI *EFI_IO_ALLOCATE_BUFFER) (
  344. IN struct _EFI_DEVICE_IO_INTERFACE *This,
  345. IN EFI_ALLOCATE_TYPE Type,
  346. IN EFI_MEMORY_TYPE MemoryType,
  347. IN UINTN Pages,
  348. IN OUT EFI_PHYSICAL_ADDRESS *HostAddress
  349. );
  350. typedef
  351. EFI_STATUS
  352. (EFIAPI *EFI_IO_FLUSH) (
  353. IN struct _EFI_DEVICE_IO_INTERFACE *This
  354. );
  355. typedef
  356. EFI_STATUS
  357. (EFIAPI *EFI_IO_FREE_BUFFER) (
  358. IN struct _EFI_DEVICE_IO_INTERFACE *This,
  359. IN UINTN Pages,
  360. IN EFI_PHYSICAL_ADDRESS HostAddress
  361. );
  362. typedef struct _EFI_DEVICE_IO_INTERFACE {
  363. EFI_IO_ACCESS Mem;
  364. EFI_IO_ACCESS Io;
  365. EFI_IO_ACCESS Pci;
  366. EFI_IO_MAP Map;
  367. EFI_PCI_DEVICE_PATH PciDevicePath;
  368. EFI_IO_UNMAP Unmap;
  369. EFI_IO_ALLOCATE_BUFFER AllocateBuffer;
  370. EFI_IO_FLUSH Flush;
  371. EFI_IO_FREE_BUFFER FreeBuffer;
  372. } EFI_DEVICE_IO_INTERFACE;
  373. /*
  374. * Unicode Collation protocol
  375. */
  376. #define UNICODE_COLLATION_PROTOCOL \
  377. { 0x1d85cd7f, 0xf43d, 0x11d2, 0x9a, 0xc, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d }
  378. #define UNICODE_BYTE_ORDER_MARK (CHAR16)(0xfeff)
  379. INTERFACE_DECL(_EFI_UNICODE_COLLATION_INTERFACE);
  380. typedef
  381. INTN
  382. (EFIAPI *EFI_UNICODE_STRICOLL) (
  383. IN struct _EFI_UNICODE_COLLATION_INTERFACE *This,
  384. IN CHAR16 *s1,
  385. IN CHAR16 *s2
  386. );
  387. typedef
  388. BOOLEAN
  389. (EFIAPI *EFI_UNICODE_METAIMATCH) (
  390. IN struct _EFI_UNICODE_COLLATION_INTERFACE *This,
  391. IN CHAR16 *String,
  392. IN CHAR16 *Pattern
  393. );
  394. typedef
  395. VOID
  396. (EFIAPI *EFI_UNICODE_STRLWR) (
  397. IN struct _EFI_UNICODE_COLLATION_INTERFACE *This,
  398. IN OUT CHAR16 *Str
  399. );
  400. typedef
  401. VOID
  402. (EFIAPI *EFI_UNICODE_STRUPR) (
  403. IN struct _EFI_UNICODE_COLLATION_INTERFACE *This,
  404. IN OUT CHAR16 *Str
  405. );
  406. typedef
  407. VOID
  408. (EFIAPI *EFI_UNICODE_FATTOSTR) (
  409. IN struct _EFI_UNICODE_COLLATION_INTERFACE *This,
  410. IN UINTN FatSize,
  411. IN CHAR8 *Fat,
  412. OUT CHAR16 *String
  413. );
  414. typedef
  415. BOOLEAN
  416. (EFIAPI *EFI_UNICODE_STRTOFAT) (
  417. IN struct _EFI_UNICODE_COLLATION_INTERFACE *This,
  418. IN CHAR16 *String,
  419. IN UINTN FatSize,
  420. OUT CHAR8 *Fat
  421. );
  422. typedef struct _EFI_UNICODE_COLLATION_INTERFACE {
  423. /* general */
  424. EFI_UNICODE_STRICOLL StriColl;
  425. EFI_UNICODE_METAIMATCH MetaiMatch;
  426. EFI_UNICODE_STRLWR StrLwr;
  427. EFI_UNICODE_STRUPR StrUpr;
  428. /* for supporting fat volumes */
  429. EFI_UNICODE_FATTOSTR FatToStr;
  430. EFI_UNICODE_STRTOFAT StrToFat;
  431. CHAR8 *SupportedLanguages;
  432. } EFI_UNICODE_COLLATION_INTERFACE;
  433. #endif