DxeCpuIoLibInternal.h 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172
  1. /** @file
  2. Internal include file of DXE CPU IO Library.
  3. It includes all necessary protocol/library class's header file
  4. for implementation of IoLib library instance. It is included
  5. all source code of this library instance.
  6. Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
  7. Copyright (c) 2017, AMD Incorporated. All rights reserved.<BR>
  8. SPDX-License-Identifier: BSD-2-Clause-Patent
  9. Module Name: DxeCpuIoLibInternal.h
  10. **/
  11. #ifndef _DXE_CPUIO_LIB_INTERNAL_H_
  12. #define _DXE_CPUIO_LIB_INTERNAL_H_
  13. #include <FrameworkDxe.h>
  14. #include <Protocol/CpuIo.h>
  15. #include <Library/IoLib.h>
  16. #include <Library/UefiBootServicesTableLib.h>
  17. #include <Library/DebugLib.h>
  18. #include <Library/BaseLib.h>
  19. /**
  20. Reads registers in the EFI CPU I/O space.
  21. Reads the I/O port specified by Port with registers width specified by Width.
  22. The read value is returned.
  23. This function must guarantee that all I/O read and write operations are serialized.
  24. If such operations are not supported, then ASSERT().
  25. @param Port The base address of the I/O operation.
  26. The caller is responsible for aligning the Address if required.
  27. @param Width The width of the I/O operation.
  28. @return Data read from registers in the EFI CPU I/O space.
  29. **/
  30. UINT64
  31. EFIAPI
  32. IoReadWorker (
  33. IN UINTN Port,
  34. IN EFI_CPU_IO_PROTOCOL_WIDTH Width
  35. );
  36. /**
  37. Writes registers in the EFI CPU I/O space.
  38. Writes the I/O port specified by Port with registers width and value specified by Width
  39. and Data respectively. Data is returned.
  40. This function must guarantee that all I/O read and write operations are serialized.
  41. If such operations are not supported, then ASSERT().
  42. @param Port The base address of the I/O operation.
  43. The caller is responsible for aligning the Address if required.
  44. @param Width The width of the I/O operation.
  45. @param Data The value to write to the I/O port.
  46. @return The parameter of Data.
  47. **/
  48. UINT64
  49. EFIAPI
  50. IoWriteWorker (
  51. IN UINTN Port,
  52. IN EFI_CPU_IO_PROTOCOL_WIDTH Width,
  53. IN UINT64 Data
  54. );
  55. /**
  56. Reads registers in the EFI CPU I/O space.
  57. Reads the I/O port specified by Port with registers width specified by Width.
  58. The port is read Count times, and the read data is stored in the provided Buffer.
  59. This function must guarantee that all I/O read and write operations are serialized.
  60. If such operations are not supported, then ASSERT().
  61. @param Port The base address of the I/O operation.
  62. The caller is responsible for aligning the Address if required.
  63. @param Width The width of the I/O operation.
  64. @param Count The number of times to read I/O port.
  65. @param Buffer The buffer to store the read data into.
  66. **/
  67. VOID
  68. EFIAPI
  69. IoReadFifoWorker (
  70. IN UINTN Port,
  71. IN EFI_CPU_IO_PROTOCOL_WIDTH Width,
  72. IN UINTN Count,
  73. IN VOID *Buffer
  74. );
  75. /**
  76. Writes registers in the EFI CPU I/O space.
  77. Writes the I/O port specified by Port with registers width specified by Width.
  78. The port is written Count times, and the write data is retrieved from the provided Buffer.
  79. This function must guarantee that all I/O read and write operations are serialized.
  80. If such operations are not supported, then ASSERT().
  81. @param Port The base address of the I/O operation.
  82. The caller is responsible for aligning the Address if required.
  83. @param Width The width of the I/O operation.
  84. @param Count The number of times to write I/O port.
  85. @param Buffer The buffer to store the read data into.
  86. **/
  87. VOID
  88. EFIAPI
  89. IoWriteFifoWorker (
  90. IN UINTN Port,
  91. IN EFI_CPU_IO_PROTOCOL_WIDTH Width,
  92. IN UINTN Count,
  93. IN VOID *Buffer
  94. );
  95. /**
  96. Reads memory-mapped registers in the EFI system memory space.
  97. Reads the MMIO registers specified by Address with registers width specified by Width.
  98. The read value is returned. If such operations are not supported, then ASSERT().
  99. This function must guarantee that all MMIO read and write operations are serialized.
  100. @param Address The MMIO register to read.
  101. The caller is responsible for aligning the Address if required.
  102. @param Width The width of the I/O operation.
  103. @return Data read from registers in the EFI system memory space.
  104. **/
  105. UINT64
  106. EFIAPI
  107. MmioReadWorker (
  108. IN UINTN Address,
  109. IN EFI_CPU_IO_PROTOCOL_WIDTH Width
  110. );
  111. /**
  112. Writes memory-mapped registers in the EFI system memory space.
  113. Writes the MMIO registers specified by Address with registers width and value specified by Width
  114. and Data respectively. Data is returned. If such operations are not supported, then ASSERT().
  115. This function must guarantee that all MMIO read and write operations are serialized.
  116. @param Address The MMIO register to read.
  117. The caller is responsible for aligning the Address if required.
  118. @param Width The width of the I/O operation.
  119. @param Data The value to write to the I/O port.
  120. @return Data read from registers in the EFI system memory space.
  121. **/
  122. UINT64
  123. EFIAPI
  124. MmioWriteWorker (
  125. IN UINTN Address,
  126. IN EFI_CPU_IO_PROTOCOL_WIDTH Width,
  127. IN UINT64 Data
  128. );
  129. #endif