CpuIo2Mm.h 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168
  1. /** @file
  2. Internal include file for the SMM CPU I/O Protocol.
  3. Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.<BR>
  4. SPDX-License-Identifier: BSD-2-Clause-Patent
  5. **/
  6. #ifndef _CPU_IO2_SMM_H_
  7. #define _CPU_IO2_SMM_H_
  8. #include <PiSmm.h>
  9. #include <Protocol/SmmCpuIo2.h>
  10. #include <Library/BaseLib.h>
  11. #include <Library/DebugLib.h>
  12. #include <Library/IoLib.h>
  13. #include <Library/MmServicesTableLib.h>
  14. #include <Library/BaseMemoryLib.h>
  15. #define MAX_IO_PORT_ADDRESS 0xFFFF
  16. /**
  17. Reads memory-mapped registers.
  18. The I/O operations are carried out exactly as requested. The caller is
  19. responsible for any alignment and I/O width issues that the bus, device,
  20. platform, or type of I/O might require.
  21. @param[in] This The EFI_SMM_CPU_IO2_PROTOCOL instance.
  22. @param[in] Width Signifies the width of the I/O operations.
  23. @param[in] Address The base address of the I/O operations. The caller is
  24. responsible for aligning the Address if required.
  25. @param[in] Count The number of I/O operations to perform.
  26. @param[out] Buffer For read operations, the destination buffer to store
  27. the results. For write operations, the source buffer
  28. from which to write data.
  29. @retval EFI_SUCCESS The data was read from or written to the device.
  30. @retval EFI_UNSUPPORTED The Address is not valid for this system.
  31. @retval EFI_INVALID_PARAMETER Width or Count, or both, were invalid.
  32. @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a
  33. lack of resources
  34. **/
  35. EFI_STATUS
  36. EFIAPI
  37. CpuMemoryServiceRead (
  38. IN CONST EFI_SMM_CPU_IO2_PROTOCOL *This,
  39. IN EFI_SMM_IO_WIDTH Width,
  40. IN UINT64 Address,
  41. IN UINTN Count,
  42. OUT VOID *Buffer
  43. );
  44. /**
  45. Writes memory-mapped registers.
  46. The I/O operations are carried out exactly as requested. The caller is
  47. responsible for any alignment and I/O width issues that the bus, device,
  48. platform, or type of I/O might require.
  49. @param[in] This The EFI_SMM_CPU_IO2_PROTOCOL instance.
  50. @param[in] Width Signifies the width of the I/O operations.
  51. @param[in] Address The base address of the I/O operations. The caller is
  52. responsible for aligning the Address if required.
  53. @param[in] Count The number of I/O operations to perform.
  54. @param[in] Buffer For read operations, the destination buffer to store
  55. the results. For write operations, the source buffer
  56. from which to write data.
  57. @retval EFI_SUCCESS The data was read from or written to the device.
  58. @retval EFI_UNSUPPORTED The Address is not valid for this system.
  59. @retval EFI_INVALID_PARAMETER Width or Count, or both, were invalid.
  60. @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a
  61. lack of resources
  62. **/
  63. EFI_STATUS
  64. EFIAPI
  65. CpuMemoryServiceWrite (
  66. IN CONST EFI_SMM_CPU_IO2_PROTOCOL *This,
  67. IN EFI_SMM_IO_WIDTH Width,
  68. IN UINT64 Address,
  69. IN UINTN Count,
  70. IN VOID *Buffer
  71. );
  72. /**
  73. Reads I/O registers.
  74. The I/O operations are carried out exactly as requested. The caller is
  75. responsible for any alignment and I/O width issues that the bus, device,
  76. platform, or type of I/O might require.
  77. @param[in] This The EFI_SMM_CPU_IO2_PROTOCOL instance.
  78. @param[in] Width Signifies the width of the I/O operations.
  79. @param[in] Address The base address of the I/O operations. The caller is
  80. responsible for aligning the Address if required.
  81. @param[in] Count The number of I/O operations to perform.
  82. @param[out] Buffer For read operations, the destination buffer to store
  83. the results. For write operations, the source buffer
  84. from which to write data.
  85. @retval EFI_SUCCESS The data was read from or written to the device.
  86. @retval EFI_UNSUPPORTED The Address is not valid for this system.
  87. @retval EFI_INVALID_PARAMETER Width or Count, or both, were invalid.
  88. @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a
  89. lack of resources
  90. **/
  91. EFI_STATUS
  92. EFIAPI
  93. CpuIoServiceRead (
  94. IN CONST EFI_SMM_CPU_IO2_PROTOCOL *This,
  95. IN EFI_SMM_IO_WIDTH Width,
  96. IN UINT64 Address,
  97. IN UINTN Count,
  98. OUT VOID *Buffer
  99. );
  100. /**
  101. Write I/O registers.
  102. The I/O operations are carried out exactly as requested. The caller is
  103. responsible for any alignment and I/O width issues that the bus, device,
  104. platform, or type of I/O might require.
  105. @param[in] This The EFI_SMM_CPU_IO2_PROTOCOL instance.
  106. @param[in] Width Signifies the width of the I/O operations.
  107. @param[in] Address The base address of the I/O operations. The caller is
  108. responsible for aligning the Address if required.
  109. @param[in] Count The number of I/O operations to perform.
  110. @param[in] Buffer For read operations, the destination buffer to store
  111. the results. For write operations, the source buffer
  112. from which to write data.
  113. @retval EFI_SUCCESS The data was read from or written to the device.
  114. @retval EFI_UNSUPPORTED The Address is not valid for this system.
  115. @retval EFI_INVALID_PARAMETER Width or Count, or both, were invalid.
  116. @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a
  117. lack of resources
  118. **/
  119. EFI_STATUS
  120. EFIAPI
  121. CpuIoServiceWrite (
  122. IN CONST EFI_SMM_CPU_IO2_PROTOCOL *This,
  123. IN EFI_SMM_IO_WIDTH Width,
  124. IN UINT64 Address,
  125. IN UINTN Count,
  126. IN VOID *Buffer
  127. );
  128. /**
  129. The module Entry Point SmmCpuIoProtocol driver
  130. @retval EFI_SUCCESS The entry point is executed successfully.
  131. @retval Other Some error occurs when executing this entry point.
  132. **/
  133. EFI_STATUS
  134. CommonCpuIo2Initialize (
  135. VOID
  136. );
  137. #endif