CpuIoPei.h 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442
  1. /** @file
  2. Internal include file for the CPU I/O PPI.
  3. Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.<BR>
  4. SPDX-License-Identifier: BSD-2-Clause-Patent
  5. **/
  6. #ifndef _CPU_IO2_PEI_H_
  7. #define _CPU_IO2_PEI_H_
  8. #include <PiDxe.h>
  9. #include <Ppi/CpuIo.h>
  10. #include <Library/BaseLib.h>
  11. #include <Library/DebugLib.h>
  12. #include <Library/IoLib.h>
  13. #include <Library/PeiServicesLib.h>
  14. #define MAX_IO_PORT_ADDRESS 0xFFFF
  15. /**
  16. Reads memory-mapped registers.
  17. @param[in] PeiServices An indirect pointer to the PEI Services Table
  18. published by the PEI Foundation.
  19. @param[in] This Pointer to local data for the interface.
  20. @param[in] Width The width of the access. Enumerated in bytes.
  21. @param[in] Address The physical address of the access.
  22. @param[in] Count The number of accesses to perform.
  23. @param[out] Buffer A pointer to the buffer of data.
  24. @retval EFI_SUCCESS The function completed successfully.
  25. @retval EFI_INVALID_PARAMETER Width is invalid for this EFI system.
  26. @retval EFI_INVALID_PARAMETER Buffer is NULL.
  27. @retval EFI_UNSUPPORTED The address range specified by Address, Width,
  28. and Count is not valid for this EFI system.
  29. **/
  30. EFI_STATUS
  31. EFIAPI
  32. CpuMemoryServiceRead (
  33. IN CONST EFI_PEI_SERVICES **PeiServices,
  34. IN CONST EFI_PEI_CPU_IO_PPI *This,
  35. IN EFI_PEI_CPU_IO_PPI_WIDTH Width,
  36. IN UINT64 Address,
  37. IN UINTN Count,
  38. OUT VOID *Buffer
  39. );
  40. /**
  41. Writes memory-mapped registers.
  42. @param[in] PeiServices An indirect pointer to the PEI Services Table
  43. published by the PEI Foundation.
  44. @param[in] This Pointer to local data for the interface.
  45. @param[in] Width The width of the access. Enumerated in bytes.
  46. @param[in] Address The physical address of the access.
  47. @param[in] Count The number of accesses to perform.
  48. @param[in] Buffer A pointer to the buffer of data.
  49. @retval EFI_SUCCESS The function completed successfully.
  50. @retval EFI_INVALID_PARAMETER Width is invalid for this EFI system.
  51. @retval EFI_INVALID_PARAMETER Buffer is NULL.
  52. @retval EFI_UNSUPPORTED The address range specified by Address, Width,
  53. and Count is not valid for this EFI system.
  54. **/
  55. EFI_STATUS
  56. EFIAPI
  57. CpuMemoryServiceWrite (
  58. IN CONST EFI_PEI_SERVICES **PeiServices,
  59. IN CONST EFI_PEI_CPU_IO_PPI *This,
  60. IN EFI_PEI_CPU_IO_PPI_WIDTH Width,
  61. IN UINT64 Address,
  62. IN UINTN Count,
  63. IN VOID *Buffer
  64. );
  65. /**
  66. Reads I/O registers.
  67. @param[in] PeiServices An indirect pointer to the PEI Services Table
  68. published by the PEI Foundation.
  69. @param[in] This Pointer to local data for the interface.
  70. @param[in] Width The width of the access. Enumerated in bytes.
  71. @param[in] Address The physical address of the access.
  72. @param[in] Count The number of accesses to perform.
  73. @param[out] Buffer A pointer to the buffer of data.
  74. @retval EFI_SUCCESS The function completed successfully.
  75. @retval EFI_INVALID_PARAMETER Width is invalid for this EFI system.
  76. @retval EFI_INVALID_PARAMETER Buffer is NULL.
  77. @retval EFI_UNSUPPORTED The address range specified by Address, Width,
  78. and Count is not valid for this EFI system.
  79. **/
  80. EFI_STATUS
  81. EFIAPI
  82. CpuIoServiceRead (
  83. IN CONST EFI_PEI_SERVICES **PeiServices,
  84. IN CONST EFI_PEI_CPU_IO_PPI *This,
  85. IN EFI_PEI_CPU_IO_PPI_WIDTH Width,
  86. IN UINT64 Address,
  87. IN UINTN Count,
  88. OUT VOID *Buffer
  89. );
  90. /**
  91. Write I/O registers.
  92. @param[in] PeiServices An indirect pointer to the PEI Services Table
  93. published by the PEI Foundation.
  94. @param[in] This Pointer to local data for the interface.
  95. @param[in] Width The width of the access. Enumerated in bytes.
  96. @param[in] Address The physical address of the access.
  97. @param[in] Count The number of accesses to perform.
  98. @param[in] Buffer A pointer to the buffer of data.
  99. @retval EFI_SUCCESS The function completed successfully.
  100. @retval EFI_INVALID_PARAMETER Width is invalid for this EFI system.
  101. @retval EFI_INVALID_PARAMETER Buffer is NULL.
  102. @retval EFI_UNSUPPORTED The address range specified by Address, Width,
  103. and Count is not valid for this EFI system.
  104. **/
  105. EFI_STATUS
  106. EFIAPI
  107. CpuIoServiceWrite (
  108. IN CONST EFI_PEI_SERVICES **PeiServices,
  109. IN CONST EFI_PEI_CPU_IO_PPI *This,
  110. IN EFI_PEI_CPU_IO_PPI_WIDTH Width,
  111. IN UINT64 Address,
  112. IN UINTN Count,
  113. IN VOID *Buffer
  114. );
  115. /**
  116. 8-bit I/O read operations.
  117. @param[in] PeiServices An indirect pointer to the PEI Services Table published
  118. by the PEI Foundation.
  119. @param[in] This Pointer to local data for the interface.
  120. @param[in] Address The physical address of the access.
  121. @return An 8-bit value returned from the I/O space.
  122. **/
  123. UINT8
  124. EFIAPI
  125. CpuIoRead8 (
  126. IN CONST EFI_PEI_SERVICES **PeiServices,
  127. IN CONST EFI_PEI_CPU_IO_PPI *This,
  128. IN UINT64 Address
  129. );
  130. /**
  131. 16-bit I/O read operations.
  132. @param[in] PeiServices An indirect pointer to the PEI Services Table published
  133. by the PEI Foundation.
  134. @param[in] This Pointer to local data for the interface.
  135. @param[in] Address The physical address of the access.
  136. @return A 16-bit value returned from the I/O space.
  137. **/
  138. UINT16
  139. EFIAPI
  140. CpuIoRead16 (
  141. IN CONST EFI_PEI_SERVICES **PeiServices,
  142. IN CONST EFI_PEI_CPU_IO_PPI *This,
  143. IN UINT64 Address
  144. );
  145. /**
  146. 32-bit I/O read operations.
  147. @param[in] PeiServices An indirect pointer to the PEI Services Table published
  148. by the PEI Foundation.
  149. @param[in] This Pointer to local data for the interface.
  150. @param[in] Address The physical address of the access.
  151. @return A 32-bit value returned from the I/O space.
  152. **/
  153. UINT32
  154. EFIAPI
  155. CpuIoRead32 (
  156. IN CONST EFI_PEI_SERVICES **PeiServices,
  157. IN CONST EFI_PEI_CPU_IO_PPI *This,
  158. IN UINT64 Address
  159. );
  160. /**
  161. 64-bit I/O read operations.
  162. @param[in] PeiServices An indirect pointer to the PEI Services Table published
  163. by the PEI Foundation.
  164. @param[in] This Pointer to local data for the interface.
  165. @param[in] Address The physical address of the access.
  166. @return A 64-bit value returned from the I/O space.
  167. **/
  168. UINT64
  169. EFIAPI
  170. CpuIoRead64 (
  171. IN CONST EFI_PEI_SERVICES **PeiServices,
  172. IN CONST EFI_PEI_CPU_IO_PPI *This,
  173. IN UINT64 Address
  174. );
  175. /**
  176. 8-bit I/O write operations.
  177. @param[in] PeiServices An indirect pointer to the PEI Services Table published
  178. by the PEI Foundation.
  179. @param[in] This Pointer to local data for the interface.
  180. @param[in] Address The physical address of the access.
  181. @param[in] Data The data to write.
  182. **/
  183. VOID
  184. EFIAPI
  185. CpuIoWrite8 (
  186. IN CONST EFI_PEI_SERVICES **PeiServices,
  187. IN CONST EFI_PEI_CPU_IO_PPI *This,
  188. IN UINT64 Address,
  189. IN UINT8 Data
  190. );
  191. /**
  192. 16-bit I/O write operations.
  193. @param[in] PeiServices An indirect pointer to the PEI Services Table published
  194. by the PEI Foundation.
  195. @param[in] This Pointer to local data for the interface.
  196. @param[in] Address The physical address of the access.
  197. @param[in] Data The data to write.
  198. **/
  199. VOID
  200. EFIAPI
  201. CpuIoWrite16 (
  202. IN CONST EFI_PEI_SERVICES **PeiServices,
  203. IN CONST EFI_PEI_CPU_IO_PPI *This,
  204. IN UINT64 Address,
  205. IN UINT16 Data
  206. );
  207. /**
  208. 32-bit I/O write operations.
  209. @param[in] PeiServices An indirect pointer to the PEI Services Table published
  210. by the PEI Foundation.
  211. @param[in] This Pointer to local data for the interface.
  212. @param[in] Address The physical address of the access.
  213. @param[in] Data The data to write.
  214. **/
  215. VOID
  216. EFIAPI
  217. CpuIoWrite32 (
  218. IN CONST EFI_PEI_SERVICES **PeiServices,
  219. IN CONST EFI_PEI_CPU_IO_PPI *This,
  220. IN UINT64 Address,
  221. IN UINT32 Data
  222. );
  223. /**
  224. 64-bit I/O write operations.
  225. @param[in] PeiServices An indirect pointer to the PEI Services Table published
  226. by the PEI Foundation.
  227. @param[in] This Pointer to local data for the interface.
  228. @param[in] Address The physical address of the access.
  229. @param[in] Data The data to write.
  230. **/
  231. VOID
  232. EFIAPI
  233. CpuIoWrite64 (
  234. IN CONST EFI_PEI_SERVICES **PeiServices,
  235. IN CONST EFI_PEI_CPU_IO_PPI *This,
  236. IN UINT64 Address,
  237. IN UINT64 Data
  238. );
  239. /**
  240. 8-bit memory read operations.
  241. @param[in] PeiServices An indirect pointer to the PEI Services Table published
  242. by the PEI Foundation.
  243. @param[in] This Pointer to local data for the interface.
  244. @param[in] Address The physical address of the access.
  245. @return An 8-bit value returned from the memory space.
  246. **/
  247. UINT8
  248. EFIAPI
  249. CpuMemRead8 (
  250. IN CONST EFI_PEI_SERVICES **PeiServices,
  251. IN CONST EFI_PEI_CPU_IO_PPI *This,
  252. IN UINT64 Address
  253. );
  254. /**
  255. 16-bit memory read operations.
  256. @param[in] PeiServices An indirect pointer to the PEI Services Table published
  257. by the PEI Foundation.
  258. @param[in] This Pointer to local data for the interface.
  259. @param[in] Address The physical address of the access.
  260. @return A 16-bit value returned from the memory space.
  261. **/
  262. UINT16
  263. EFIAPI
  264. CpuMemRead16 (
  265. IN CONST EFI_PEI_SERVICES **PeiServices,
  266. IN CONST EFI_PEI_CPU_IO_PPI *This,
  267. IN UINT64 Address
  268. );
  269. /**
  270. 32-bit memory read operations.
  271. @param[in] PeiServices An indirect pointer to the PEI Services Table published
  272. by the PEI Foundation.
  273. @param[in] This Pointer to local data for the interface.
  274. @param[in] Address The physical address of the access.
  275. @return A 32-bit value returned from the memory space.
  276. **/
  277. UINT32
  278. EFIAPI
  279. CpuMemRead32 (
  280. IN CONST EFI_PEI_SERVICES **PeiServices,
  281. IN CONST EFI_PEI_CPU_IO_PPI *This,
  282. IN UINT64 Address
  283. );
  284. /**
  285. 64-bit memory read operations.
  286. @param[in] PeiServices An indirect pointer to the PEI Services Table published
  287. by the PEI Foundation.
  288. @param[in] This Pointer to local data for the interface.
  289. @param[in] Address The physical address of the access.
  290. @return A 64-bit value returned from the memory space.
  291. **/
  292. UINT64
  293. EFIAPI
  294. CpuMemRead64 (
  295. IN CONST EFI_PEI_SERVICES **PeiServices,
  296. IN CONST EFI_PEI_CPU_IO_PPI *This,
  297. IN UINT64 Address
  298. );
  299. /**
  300. 8-bit memory write operations.
  301. @param[in] PeiServices An indirect pointer to the PEI Services Table published
  302. by the PEI Foundation.
  303. @param[in] This Pointer to local data for the interface.
  304. @param[in] Address The physical address of the access.
  305. @param[in] Data The data to write.
  306. **/
  307. VOID
  308. EFIAPI
  309. CpuMemWrite8 (
  310. IN CONST EFI_PEI_SERVICES **PeiServices,
  311. IN CONST EFI_PEI_CPU_IO_PPI *This,
  312. IN UINT64 Address,
  313. IN UINT8 Data
  314. );
  315. /**
  316. 16-bit memory write operations.
  317. @param[in] PeiServices An indirect pointer to the PEI Services Table published
  318. by the PEI Foundation.
  319. @param[in] This Pointer to local data for the interface.
  320. @param[in] Address The physical address of the access.
  321. @param[in] Data The data to write.
  322. **/
  323. VOID
  324. EFIAPI
  325. CpuMemWrite16 (
  326. IN CONST EFI_PEI_SERVICES **PeiServices,
  327. IN CONST EFI_PEI_CPU_IO_PPI *This,
  328. IN UINT64 Address,
  329. IN UINT16 Data
  330. );
  331. /**
  332. 32-bit memory write operations.
  333. @param[in] PeiServices An indirect pointer to the PEI Services Table published
  334. by the PEI Foundation.
  335. @param[in] This Pointer to local data for the interface.
  336. @param[in] Address The physical address of the access.
  337. @param[in] Data The data to write.
  338. **/
  339. VOID
  340. EFIAPI
  341. CpuMemWrite32 (
  342. IN CONST EFI_PEI_SERVICES **PeiServices,
  343. IN CONST EFI_PEI_CPU_IO_PPI *This,
  344. IN UINT64 Address,
  345. IN UINT32 Data
  346. );
  347. /**
  348. 64-bit memory write operations.
  349. @param[in] PeiServices An indirect pointer to the PEI Services Table published
  350. by the PEI Foundation.
  351. @param[in] This Pointer to local data for the interface.
  352. @param[in] Address The physical address of the access.
  353. @param[in] Data The data to write.
  354. **/
  355. VOID
  356. EFIAPI
  357. CpuMemWrite64 (
  358. IN CONST EFI_PEI_SERVICES **PeiServices,
  359. IN CONST EFI_PEI_CPU_IO_PPI *This,
  360. IN UINT64 Address,
  361. IN UINT64 Data
  362. );
  363. #endif