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