SmmAccess.h 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  1. //
  2. //
  3. /*++
  4. Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved
  5. SPDX-License-Identifier: BSD-2-Clause-Patent
  6. Module Name:
  7. SmmAccess.h
  8. Abstract:
  9. SmmAccess PPI
  10. This code abstracts the PEI core to provide SmmAccess services.
  11. --*/
  12. #ifndef _PEI_SMM_ACCESS_PPI_H_
  13. #define _PEI_SMM_ACCESS_PPI_H_
  14. #ifdef ECP_FLAG
  15. #include "Guid/SmramMemoryReserve/SmramMemoryReserve.h"
  16. #else
  17. #include "Guid/SmramMemoryReserve.h"
  18. #endif
  19. #define PEI_SMM_ACCESS_PPI_GUID \
  20. { \
  21. 0x268f33a9, 0xcccd, 0x48be, 0x88, 0x17, 0x86, 0x5, 0x3a, 0xc3, 0x2e, 0xd6 \
  22. }
  23. typedef struct _PEI_SMM_ACCESS_PPI PEI_SMM_ACCESS_PPI;
  24. typedef
  25. EFI_STATUS
  26. (EFIAPI *PEI_SMM_OPEN) (
  27. IN EFI_PEI_SERVICES **PeiServices,
  28. IN PEI_SMM_ACCESS_PPI *This,
  29. IN UINTN DescriptorIndex
  30. )
  31. /*++
  32. Routine Description:
  33. This routine accepts a request to "open" a region of SMRAM. The
  34. region could be legacy ABSEG, HSEG, or TSEG near top of physical memory.
  35. The use of "open" means that the memory is visible from all PEIM
  36. and SMM agents.
  37. Arguments:
  38. PeiServices - General purpose services available to every PEIM.
  39. This - Pointer to the SMM Access Interface.
  40. DescriptorIndex - Region of SMRAM to Open.
  41. Returns:
  42. EFI_SUCCESS - The region was successfully opened.
  43. EFI_DEVICE_ERROR - The region could not be opened because locked by
  44. chipset.
  45. EFI_INVALID_PARAMETER - The descriptor index was out of bounds.
  46. --*/
  47. ;
  48. typedef
  49. EFI_STATUS
  50. (EFIAPI *PEI_SMM_CLOSE) (
  51. IN EFI_PEI_SERVICES **PeiServices,
  52. IN PEI_SMM_ACCESS_PPI *This,
  53. IN UINTN DescriptorIndex
  54. )
  55. /*++
  56. Routine Description:
  57. This routine accepts a request to "close" a region of SMRAM. The
  58. region could be legacy AB or TSEG near top of physical memory.
  59. The use of "close" means that the memory is only visible from SMM agents,
  60. not from PEIM.
  61. Arguments:
  62. PeiServices - General purpose services available to every PEIM.
  63. This - Pointer to the SMM Access Interface.
  64. DescriptorIndex - Region of SMRAM to Close.
  65. Returns:
  66. EFI_SUCCESS - The region was successfully closed.
  67. EFI_DEVICE_ERROR - The region could not be closed because locked by
  68. chipset.
  69. EFI_INVALID_PARAMETER - The descriptor index was out of bounds.
  70. --*/
  71. ;
  72. typedef
  73. EFI_STATUS
  74. (EFIAPI *PEI_SMM_LOCK) (
  75. IN EFI_PEI_SERVICES **PeiServices,
  76. IN PEI_SMM_ACCESS_PPI *This,
  77. IN UINTN DescriptorIndex
  78. )
  79. /*++
  80. Routine Description:
  81. This routine accepts a request to "lock" SMRAM. The
  82. region could be legacy AB or TSEG near top of physical memory.
  83. The use of "lock" means that the memory can no longer be opened
  84. to PEIM.
  85. Arguments:
  86. PeiServices - General purpose services available to every PEIM.
  87. This - Pointer to the SMM Access Interface.
  88. DescriptorIndex - Region of SMRAM to Lock.
  89. Returns:
  90. EFI_SUCCESS - The region was successfully locked.
  91. EFI_DEVICE_ERROR - The region could not be locked because at least
  92. one range is still open.
  93. EFI_INVALID_PARAMETER - The descriptor index was out of bounds.
  94. --*/
  95. ;
  96. typedef
  97. EFI_STATUS
  98. (EFIAPI *PEI_SMM_CAPABILITIES) (
  99. IN EFI_PEI_SERVICES **PeiServices,
  100. IN PEI_SMM_ACCESS_PPI *This,
  101. IN OUT UINTN *SmramMapSize,
  102. IN OUT EFI_SMRAM_DESCRIPTOR *SmramMap
  103. )
  104. /*++
  105. Routine Description:
  106. This routine services a user request to discover the SMRAM
  107. capabilities of this platform. This will report the possible
  108. ranges that are possible for SMRAM access, based upon the
  109. memory controller capabilities.
  110. Arguments:
  111. PeiServices - General purpose services available to every PEIM.
  112. This - Pointer to the SMRAM Access Interface.
  113. SmramMapSize - Pointer to the variable containing size of the
  114. buffer to contain the description information.
  115. SmramMap - Buffer containing the data describing the Smram
  116. region descriptors.
  117. Returns:
  118. EFI_BUFFER_TOO_SMALL - The user did not provide a sufficient buffer.
  119. EFI_SUCCESS - The user provided a sufficiently-sized buffer.
  120. --*/
  121. ;
  122. struct _PEI_SMM_ACCESS_PPI {
  123. PEI_SMM_OPEN Open;
  124. PEI_SMM_CLOSE Close;
  125. PEI_SMM_LOCK Lock;
  126. PEI_SMM_CAPABILITIES GetCapabilities;
  127. BOOLEAN LockState;
  128. BOOLEAN OpenState;
  129. };
  130. extern EFI_GUID gPeiSmmAccessPpiGuid;
  131. #endif