1 /** @file 2 EFI SMM Access2 Protocol as defined in the PI 1.2 specification. 3 4 This protocol is used to control the visibility of the SMRAM on the platform. 5 It abstracts the location and characteristics of SMRAM. The expectation is 6 that the north bridge or memory controller would publish this protocol. 7 8 The principal functionality found in the memory controller includes the following: 9 - Exposing the SMRAM to all non-SMM agents, or the "open" state 10 - Shrouding the SMRAM to all but the SMM agents, or the "closed" state 11 - Preserving the system integrity, or "locking" the SMRAM, such that the settings cannot be 12 perturbed by either boot service or runtime agents 13 14 Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR> 15 This program and the accompanying materials 16 are licensed and made available under the terms and conditions of the BSD License 17 which accompanies this distribution. The full text of the license may be found at 18 http://opensource.org/licenses/bsd-license.php 19 20 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 21 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 22 23 **/ 24 25 #ifndef _SMM_ACCESS2_H_ 26 #define _SMM_ACCESS2_H_ 27 28 #define EFI_SMM_ACCESS2_PROTOCOL_GUID \ 29 { \ 30 0xc2702b74, 0x800c, 0x4131, {0x87, 0x46, 0x8f, 0xb5, 0xb8, 0x9c, 0xe4, 0xac } \ 31 } 32 33 34 typedef struct _EFI_SMM_ACCESS2_PROTOCOL EFI_SMM_ACCESS2_PROTOCOL; 35 36 /** 37 Opens the SMRAM area to be accessible by a boot-service driver. 38 39 This function "opens" SMRAM so that it is visible while not inside of SMM. The function should 40 return EFI_UNSUPPORTED if the hardware does not support hiding of SMRAM. The function 41 should return EFI_DEVICE_ERROR if the SMRAM configuration is locked. 42 43 @param[in] This The EFI_SMM_ACCESS2_PROTOCOL instance. 44 45 @retval EFI_SUCCESS The operation was successful. 46 @retval EFI_UNSUPPORTED The system does not support opening and closing of SMRAM. 47 @retval EFI_DEVICE_ERROR SMRAM cannot be opened, perhaps because it is locked. 48 **/ 49 typedef 50 EFI_STATUS 51 (EFIAPI *EFI_SMM_OPEN2)( 52 IN EFI_SMM_ACCESS2_PROTOCOL *This 53 ); 54 55 /** 56 Inhibits access to the SMRAM. 57 58 This function "closes" SMRAM so that it is not visible while outside of SMM. The function should 59 return EFI_UNSUPPORTED if the hardware does not support hiding of SMRAM. 60 61 @param[in] This The EFI_SMM_ACCESS2_PROTOCOL instance. 62 63 @retval EFI_SUCCESS The operation was successful. 64 @retval EFI_UNSUPPORTED The system does not support opening and closing of SMRAM. 65 @retval EFI_DEVICE_ERROR SMRAM cannot be closed. 66 **/ 67 typedef 68 EFI_STATUS 69 (EFIAPI *EFI_SMM_CLOSE2)( 70 IN EFI_SMM_ACCESS2_PROTOCOL *This 71 ); 72 73 /** 74 Inhibits access to the SMRAM. 75 76 This function prohibits access to the SMRAM region. This function is usually implemented such 77 that it is a write-once operation. 78 79 @param[in] This The EFI_SMM_ACCESS2_PROTOCOL instance. 80 81 @retval EFI_SUCCESS The device was successfully locked. 82 @retval EFI_UNSUPPORTED The system does not support locking of SMRAM. 83 **/ 84 typedef 85 EFI_STATUS 86 (EFIAPI *EFI_SMM_LOCK2)( 87 IN EFI_SMM_ACCESS2_PROTOCOL *This 88 ); 89 90 /** 91 Queries the memory controller for the possible regions that will support SMRAM. 92 93 @param[in] This The EFI_SMM_ACCESS2_PROTOCOL instance. 94 @param[in,out] SmramMapSize A pointer to the size, in bytes, of the SmramMemoryMap buffer. 95 @param[in,out] SmramMap A pointer to the buffer in which firmware places the current memory map. 96 97 @retval EFI_SUCCESS The chipset supported the given resource. 98 @retval EFI_BUFFER_TOO_SMALL The SmramMap parameter was too small. The current buffer size 99 needed to hold the memory map is returned in SmramMapSize. 100 **/ 101 typedef 102 EFI_STATUS 103 (EFIAPI *EFI_SMM_CAPABILITIES2)( 104 IN CONST EFI_SMM_ACCESS2_PROTOCOL *This, 105 IN OUT UINTN *SmramMapSize, 106 IN OUT EFI_SMRAM_DESCRIPTOR *SmramMap 107 ); 108 109 /// 110 /// EFI SMM Access2 Protocol is used to control the visibility of the SMRAM on the platform. 111 /// It abstracts the location and characteristics of SMRAM. The expectation is 112 /// that the north bridge or memory controller would publish this protocol. 113 /// 114 struct _EFI_SMM_ACCESS2_PROTOCOL { 115 EFI_SMM_OPEN2 Open; 116 EFI_SMM_CLOSE2 Close; 117 EFI_SMM_LOCK2 Lock; 118 EFI_SMM_CAPABILITIES2 GetCapabilities; 119 /// 120 /// Indicates the current state of the SMRAM. Set to TRUE if SMRAM is locked. 121 /// 122 BOOLEAN LockState; 123 /// 124 /// Indicates the current state of the SMRAM. Set to TRUE if SMRAM is open. 125 /// 126 BOOLEAN OpenState; 127 }; 128 129 extern EFI_GUID gEfiSmmAccess2ProtocolGuid; 130 131 #endif 132 133