]> git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Include/Protocol/SmmAccess2.h
533c11d05ef191e6b507c81735d1cc0175ab691f
[mirror_edk2.git] / MdePkg / Include / Protocol / SmmAccess2.h
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, Intel Corporation
15 All rights reserved. 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 #include <PiDxe.h>
29
30 #define EFI_SMM_ACCESS2_PROTOCOL_GUID \
31 { \
32 0xc2702b74, 0x800c, 0x4131, {0x87, 0x46, 0x8f, 0xb5, 0xb8, 0x9c, 0xe4, 0xac } \
33 }
34
35 ///
36 /// SMRAM states and capabilities
37 ///
38 #define EFI_SMRAM_OPEN 0x00000001
39 #define EFI_SMRAM_CLOSED 0x00000002
40 #define EFI_SMRAM_LOCKED 0x00000004
41 #define EFI_CACHEABLE 0x00000008
42 #define EFI_ALLOCATED 0x00000010
43 #define EFI_NEEDS_TESTING 0x00000020
44 #define EFI_NEEDS_ECC_INITIALIZATION 0x00000040
45
46 ///
47 /// Structure describing a SMRAM region and its accessibility attributes
48 ///
49 typedef struct {
50 ///
51 /// Designates the physical address of the SMRAM in memory. This view of memory is
52 /// the same as seen by I/O-based agents, for example, but it may not be the address seen
53 /// by the processors.
54 ///
55 EFI_PHYSICAL_ADDRESS PhysicalStart;
56 ///
57 /// Designates the address of the SMRAM, as seen by software executing on the
58 /// processors. This address may or may not match PhysicalStart.
59 ///
60 EFI_PHYSICAL_ADDRESS CpuStart;
61 ///
62 /// Describes the number of bytes in the SMRAM region.
63 ///
64 UINT64 PhysicalSize;
65 ///
66 /// Describes the accessibility attributes of the SMRAM. These attributes include the
67 /// hardware state (e.g., Open/Closed/Locked), capability (e.g., cacheable), logical
68 /// allocation (e.g., allocated), and pre-use initialization (e.g., needs testing/ECC
69 /// initialization).
70 ///
71 UINT64 RegionState;
72 } EFI_SMRAM_DESCRIPTOR;
73
74 typedef struct _EFI_SMM_ACCESS2_PROTOCOL EFI_SMM_ACCESS2_PROTOCOL;
75
76 /**
77 Opens the SMRAM area to be accessible by a boot-service driver.
78
79 This function "opens" SMRAM so that it is visible while not inside of SMM. The function should
80 return EFI_UNSUPPORTED if the hardware does not support hiding of SMRAM. The function
81 should return EFI_DEVICE_ERROR if the SMRAM configuration is locked.
82
83 @param[in] This The EFI_SMM_ACCESS2_PROTOCOL instance.
84
85 @retval EFI_SUCCESS The operation was successful.
86 @retval EFI_UNSUPPORTED The system does not support opening and closing of SMRAM.
87 @retval EFI_DEVICE_ERROR SMRAM cannot be opened, perhaps because it is locked.
88 **/
89 typedef
90 EFI_STATUS
91 (EFIAPI *EFI_SMM_OPEN)(
92 IN EFI_SMM_ACCESS2_PROTOCOL *This
93 );
94
95 /**
96 Inhibits access to the SMRAM.
97
98 This function "closes" SMRAM so that it is not visible while outside of SMM. The function should
99 return EFI_UNSUPPORTED if the hardware does not support hiding of SMRAM.
100
101 @param[in] This The EFI_SMM_ACCESS2_PROTOCOL instance.
102
103 @retval EFI_SUCCESS The operation was successful.
104 @retval EFI_UNSUPPORTED The system does not support opening and closing of SMRAM.
105 @retval EFI_DEVICE_ERROR SMRAM cannot be closed.
106 **/
107 typedef
108 EFI_STATUS
109 (EFIAPI *EFI_SMM_CLOSE)(
110 IN EFI_SMM_ACCESS2_PROTOCOL *This
111 );
112
113 /**
114 Inhibits access to the SMRAM.
115
116 This function prohibits access to the SMRAM region. This function is usually implemented such
117 that it is a write-once operation.
118
119 @param[in] This The EFI_SMM_ACCESS2_PROTOCOL instance.
120
121 @retval EFI_SUCCESS The device was successfully locked.
122 @retval EFI_UNSUPPORTED The system does not support locking of SMRAM.
123 **/
124 typedef
125 EFI_STATUS
126 (EFIAPI *EFI_SMM_LOCK)(
127 IN EFI_SMM_ACCESS2_PROTOCOL *This
128 );
129
130 /**
131 Queries the memory controller for the possible regions that will support SMRAM.
132
133 @param[in] This The EFI_SMM_ACCESS2_PROTOCOL instance.
134 @param[in,out] SmramMapSize A pointer to the size, in bytes, of the SmramMemoryMap buffer.
135 @param[in,out] SmramMap A pointer to the buffer in which firmware places the current memory map.
136
137 @retval EFI_SUCCESS The chipset supported the given resource.
138 @retval EFI_BUFFER_TOO_SMALL The SmramMap parameter was too small. The current buffer size
139 needed to hold the memory map is returned in SmramMapSize.
140 **/
141 typedef
142 EFI_STATUS
143 (EFIAPI *EFI_SMM_CAPABILITIES)(
144 IN CONST EFI_SMM_ACCESS2_PROTOCOL *This,
145 IN OUT UINTN *SmramMapSize,
146 IN OUT EFI_SMRAM_DESCRIPTOR *SmramMap
147 );
148
149 ///
150 /// EFI SMM Access2 Protocol is used to control the visibility of the SMRAM on the platform.
151 /// It abstracts the location and characteristics of SMRAM. The expectation is
152 /// that the north bridge or memory controller would publish this protocol.
153 ///
154 struct _EFI_SMM_ACCESS2_PROTOCOL {
155 EFI_SMM_OPEN Open;
156 EFI_SMM_CLOSE Close;
157 EFI_SMM_LOCK Lock;
158 EFI_SMM_CAPABILITIES GetCapabilities;
159 ///
160 /// Indicates the current state of the SMRAM. Set to TRUE if SMRAM is locked.
161 ///
162 BOOLEAN LockState;
163 ///
164 /// Indicates the current state of the SMRAM. Set to TRUE if SMRAM is open.
165 ///
166 BOOLEAN OpenState;
167 };
168
169 extern EFI_GUID gEfiSmmAccess2ProtocolGuid;
170
171 #endif
172