SmmAccess.h 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. /** @file
  2. This file declares the SMM SMRAM Access abstraction protocol, which is used to control
  3. the visibility of the SMRAM on the platform. The expectation is
  4. that the north bridge or memory controller would publish this protocol.
  5. For example, the Memory Controller Hub (MCH) has the hardware provision for this
  6. type of control. Because of the protected, distinguished class of memory for IA-32
  7. systems, the expectation is that this protocol would be supported only on IA-32 systems.
  8. Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
  9. SPDX-License-Identifier: BSD-2-Clause-Patent
  10. @par Revision Reference:
  11. This Protocol is defined in Framework of EFI SMM Core Interface Spec
  12. Version 0.9.
  13. **/
  14. #ifndef _SMM_ACCESS_H_
  15. #define _SMM_ACCESS_H_
  16. #include <Guid/SmramMemoryReserve.h>
  17. typedef struct _EFI_SMM_ACCESS_PROTOCOL EFI_SMM_ACCESS_PROTOCOL;
  18. #define EFI_SMM_ACCESS_PROTOCOL_GUID \
  19. { \
  20. 0x3792095a, 0xe309, 0x4c1e, {0xaa, 0x01, 0x85, 0xf5, 0x65, 0x5a, 0x17, 0xf1 } \
  21. }
  22. //
  23. // SMM Access specification Member Function
  24. //
  25. /**
  26. Opens the SMRAM area to be accessible by a boot-service driver.
  27. @param This The EFI_SMM_ACCESS_PROTOCOL instance.
  28. @param DescriptorIndex Indicates that the driver wishes to open
  29. the memory tagged by this index.
  30. @retval EFI_SUCCESS The operation was successful.
  31. @retval EFI_INVALID_PARAMETER The given DescriptorIndex is not supported.
  32. @retval EFI_NOT_STARTED The SMM base service has not been initialized.
  33. **/
  34. typedef
  35. EFI_STATUS
  36. (EFIAPI *EFI_SMM_OPEN)(
  37. IN EFI_SMM_ACCESS_PROTOCOL *This,
  38. UINTN DescriptorIndex
  39. );
  40. /**
  41. Inhibits access to the SMRAM.
  42. @param This The EFI_SMM_ACCESS_PROTOCOL instance.
  43. @param DescriptorIndex Indicates that the driver wishes to close
  44. the memory tagged by this index.
  45. @retval EFI_SUCCESS The operation was successful.
  46. @retval EFI_DEVICE_ERROR The given DescriptorIndex is not open.
  47. @retval EFI_INVALID_PARAMETER The given DescriptorIndex is not supported.
  48. @retval EFI_NOT_STARTED The SMM base service has not been initialized.
  49. **/
  50. typedef
  51. EFI_STATUS
  52. (EFIAPI *EFI_SMM_CLOSE)(
  53. IN EFI_SMM_ACCESS_PROTOCOL *This,
  54. UINTN DescriptorIndex
  55. );
  56. /**
  57. Inhibits access to the SMRAM.
  58. @param This The EFI_SMM_ACCESS_PROTOCOL instance.
  59. @param DescriptorIndex Indicates that the driver wishes to lock
  60. the memory tagged by this index.
  61. @retval EFI_SUCCESS The operation was successful.
  62. @retval EFI_DEVICE_ERROR The given DescriptorIndex is not open.
  63. @retval EFI_INVALID_PARAMETER The given DescriptorIndex is not supported.
  64. @retval EFI_NOT_STARTED The SMM base service has not been initialized.
  65. **/
  66. typedef
  67. EFI_STATUS
  68. (EFIAPI *EFI_SMM_LOCK)(
  69. IN EFI_SMM_ACCESS_PROTOCOL *This,
  70. UINTN DescriptorIndex
  71. );
  72. /**
  73. Queries the memory controller for the possible regions that will support SMRAM.
  74. @param This The EFI_SMM_ACCESS_PROTOCOL instance.
  75. @param SmramMapSize A pointer to the size, in bytes, of the SmramMemoryMap buffer.
  76. @param SmramMap A pointer to the buffer in which firmware places the current memory map.
  77. @retval EFI_SUCCESS The chipset supported the given resource.
  78. @retval EFI_BUFFER_TOO_SMALL The SmramMap parameter was too small.
  79. **/
  80. typedef
  81. EFI_STATUS
  82. (EFIAPI *EFI_SMM_CAPABILITIES)(
  83. IN EFI_SMM_ACCESS_PROTOCOL *This,
  84. IN OUT UINTN *SmramMapSize,
  85. IN OUT EFI_SMRAM_DESCRIPTOR *SmramMap
  86. );
  87. /**
  88. This protocol is used to control the visibility of the SMRAM on the platform.
  89. **/
  90. struct _EFI_SMM_ACCESS_PROTOCOL {
  91. EFI_SMM_OPEN Open; ///< Opens the SMRAM.
  92. EFI_SMM_CLOSE Close; ///< Closes the SMRAM.
  93. EFI_SMM_LOCK Lock; ///< Locks the SMRAM.
  94. EFI_SMM_CAPABILITIES GetCapabilities; ///< Gets information on possible SMRAM regions.
  95. BOOLEAN LockState; ///< Indicates the current state of the SMRAM. Set to TRUE if any region is locked.
  96. BOOLEAN OpenState; ///< Indicates the current state of the SMRAM. Set to TRUE if any region is open.
  97. };
  98. extern EFI_GUID gEfiSmmAccessProtocolGuid;
  99. #endif