]>
Commit | Line | Data |
---|---|---|
8442c53e | 1 | /** @file\r |
2 | EFI SMM Access2 Protocol as defined in the PI 1.2 specification.\r | |
3 | \r | |
4 | This protocol is used to control the visibility of the SMRAM on the platform.\r | |
5 | It abstracts the location and characteristics of SMRAM. The expectation is\r | |
6 | that the north bridge or memory controller would publish this protocol.\r | |
7 | \r | |
8 | The principal functionality found in the memory controller includes the following: \r | |
9 | - Exposing the SMRAM to all non-SMM agents, or the "open" state\r | |
10 | - Shrouding the SMRAM to all but the SMM agents, or the "closed" state\r | |
11 | - Preserving the system integrity, or "locking" the SMRAM, such that the settings cannot be \r | |
12 | perturbed by either boot service or runtime agents \r | |
13 | \r | |
14 | Copyright (c) 2009, Intel Corporation \r | |
15 | All rights reserved. This program and the accompanying materials \r | |
16 | are licensed and made available under the terms and conditions of the BSD License \r | |
17 | which accompanies this distribution. The full text of the license may be found at \r | |
18 | http://opensource.org/licenses/bsd-license.php \r | |
19 | \r | |
20 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r | |
21 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r | |
22 | \r | |
23 | **/\r | |
24 | \r | |
25 | #ifndef _SMM_ACCESS2_H_\r | |
26 | #define _SMM_ACCESS2_H_\r | |
27 | \r | |
28 | #include <PiDxe.h>\r | |
29 | \r | |
a2bb197e | 30 | ///\r |
31 | /// Note:\r | |
32 | /// To avoid name conflict between PI and Framework SMM spec, the following names defined\r | |
33 | /// in PI 1.2 SMM spec are renamed. These renamings are not yet in a public PI spec and errta.\r | |
34 | ///\r | |
35 | /// EFI_SMM_OPEN -> EFI_SMM_OPEN2\r | |
36 | /// EFI_SMM_CLOSE -> EFI_SMM_CLOSE2\r | |
37 | /// EFI_SMM_LOCK -> EFI_SMM_LOCK2\r | |
38 | /// EFI_SMM_CAPABILITIES -> EFI_SMM_CAPABILITIES2\r | |
39 | ///\r | |
40 | \r | |
8442c53e | 41 | #define EFI_SMM_ACCESS2_PROTOCOL_GUID \\r |
42 | { \\r | |
43 | 0xc2702b74, 0x800c, 0x4131, {0x87, 0x46, 0x8f, 0xb5, 0xb8, 0x9c, 0xe4, 0xac } \\r | |
44 | }\r | |
45 | \r | |
46 | ///\r | |
47 | /// SMRAM states and capabilities\r | |
48 | ///\r | |
49 | #define EFI_SMRAM_OPEN 0x00000001\r | |
50 | #define EFI_SMRAM_CLOSED 0x00000002\r | |
51 | #define EFI_SMRAM_LOCKED 0x00000004\r | |
52 | #define EFI_CACHEABLE 0x00000008\r | |
53 | #define EFI_ALLOCATED 0x00000010\r | |
54 | #define EFI_NEEDS_TESTING 0x00000020\r | |
55 | #define EFI_NEEDS_ECC_INITIALIZATION 0x00000040\r | |
56 | \r | |
57 | ///\r | |
58 | /// Structure describing a SMRAM region and its accessibility attributes\r | |
59 | ///\r | |
60 | typedef struct {\r | |
61 | ///\r | |
62 | /// Designates the physical address of the SMRAM in memory. This view of memory is \r | |
63 | /// the same as seen by I/O-based agents, for example, but it may not be the address seen \r | |
64 | /// by the processors.\r | |
65 | ///\r | |
66 | EFI_PHYSICAL_ADDRESS PhysicalStart;\r | |
67 | ///\r | |
68 | /// Designates the address of the SMRAM, as seen by software executing on the \r | |
69 | /// processors. This address may or may not match PhysicalStart.\r | |
70 | ///\r | |
71 | EFI_PHYSICAL_ADDRESS CpuStart; \r | |
72 | ///\r | |
73 | /// Describes the number of bytes in the SMRAM region.\r | |
74 | ///\r | |
75 | UINT64 PhysicalSize;\r | |
76 | ///\r | |
77 | /// Describes the accessibility attributes of the SMRAM. These attributes include the \r | |
78 | /// hardware state (e.g., Open/Closed/Locked), capability (e.g., cacheable), logical \r | |
79 | /// allocation (e.g., allocated), and pre-use initialization (e.g., needs testing/ECC \r | |
80 | /// initialization).\r | |
81 | ///\r | |
82 | UINT64 RegionState;\r | |
83 | } EFI_SMRAM_DESCRIPTOR;\r | |
84 | \r | |
85 | typedef struct _EFI_SMM_ACCESS2_PROTOCOL EFI_SMM_ACCESS2_PROTOCOL;\r | |
86 | \r | |
87 | /**\r | |
88 | Opens the SMRAM area to be accessible by a boot-service driver.\r | |
89 | \r | |
90 | This function "opens" SMRAM so that it is visible while not inside of SMM. The function should \r | |
91 | return EFI_UNSUPPORTED if the hardware does not support hiding of SMRAM. The function \r | |
92 | should return EFI_DEVICE_ERROR if the SMRAM configuration is locked.\r | |
93 | \r | |
94 | @param[in] This The EFI_SMM_ACCESS2_PROTOCOL instance.\r | |
95 | \r | |
96 | @retval EFI_SUCCESS The operation was successful.\r | |
97 | @retval EFI_UNSUPPORTED The system does not support opening and closing of SMRAM.\r | |
98 | @retval EFI_DEVICE_ERROR SMRAM cannot be opened, perhaps because it is locked.\r | |
99 | **/\r | |
100 | typedef\r | |
101 | EFI_STATUS\r | |
a2bb197e | 102 | (EFIAPI *EFI_SMM_OPEN2)(\r |
f57525fa | 103 | IN EFI_SMM_ACCESS2_PROTOCOL *This\r |
8442c53e | 104 | );\r |
105 | \r | |
106 | /**\r | |
107 | Inhibits access to the SMRAM.\r | |
108 | \r | |
109 | This function "closes" SMRAM so that it is not visible while outside of SMM. The function should \r | |
110 | return EFI_UNSUPPORTED if the hardware does not support hiding of SMRAM.\r | |
111 | \r | |
112 | @param[in] This The EFI_SMM_ACCESS2_PROTOCOL instance.\r | |
113 | \r | |
114 | @retval EFI_SUCCESS The operation was successful.\r | |
115 | @retval EFI_UNSUPPORTED The system does not support opening and closing of SMRAM.\r | |
116 | @retval EFI_DEVICE_ERROR SMRAM cannot be closed.\r | |
117 | **/\r | |
118 | typedef\r | |
119 | EFI_STATUS\r | |
a2bb197e | 120 | (EFIAPI *EFI_SMM_CLOSE2)(\r |
f57525fa | 121 | IN EFI_SMM_ACCESS2_PROTOCOL *This\r |
8442c53e | 122 | );\r |
123 | \r | |
124 | /**\r | |
125 | Inhibits access to the SMRAM.\r | |
126 | \r | |
127 | This function prohibits access to the SMRAM region. This function is usually implemented such \r | |
128 | that it is a write-once operation. \r | |
129 | \r | |
130 | @param[in] This The EFI_SMM_ACCESS2_PROTOCOL instance.\r | |
131 | \r | |
132 | @retval EFI_SUCCESS The device was successfully locked.\r | |
133 | @retval EFI_UNSUPPORTED The system does not support locking of SMRAM.\r | |
134 | **/\r | |
135 | typedef\r | |
136 | EFI_STATUS\r | |
a2bb197e | 137 | (EFIAPI *EFI_SMM_LOCK2)(\r |
f57525fa | 138 | IN EFI_SMM_ACCESS2_PROTOCOL *This\r |
8442c53e | 139 | );\r |
140 | \r | |
141 | /**\r | |
142 | Queries the memory controller for the possible regions that will support SMRAM.\r | |
143 | \r | |
144 | @param[in] This The EFI_SMM_ACCESS2_PROTOCOL instance.\r | |
145 | @param[in,out] SmramMapSize A pointer to the size, in bytes, of the SmramMemoryMap buffer.\r | |
146 | @param[in,out] SmramMap A pointer to the buffer in which firmware places the current memory map.\r | |
147 | \r | |
148 | @retval EFI_SUCCESS The chipset supported the given resource.\r | |
149 | @retval EFI_BUFFER_TOO_SMALL The SmramMap parameter was too small. The current buffer size \r | |
150 | needed to hold the memory map is returned in SmramMapSize.\r | |
151 | **/\r | |
152 | typedef\r | |
153 | EFI_STATUS\r | |
a2bb197e | 154 | (EFIAPI *EFI_SMM_CAPABILITIES2)(\r |
8442c53e | 155 | IN CONST EFI_SMM_ACCESS2_PROTOCOL *This,\r |
156 | IN OUT UINTN *SmramMapSize,\r | |
157 | IN OUT EFI_SMRAM_DESCRIPTOR *SmramMap\r | |
158 | );\r | |
159 | \r | |
160 | ///\r | |
161 | /// EFI SMM Access2 Protocol is used to control the visibility of the SMRAM on the platform.\r | |
162 | /// It abstracts the location and characteristics of SMRAM. The expectation is\r | |
163 | /// that the north bridge or memory controller would publish this protocol.\r | |
164 | /// \r | |
165 | struct _EFI_SMM_ACCESS2_PROTOCOL {\r | |
a2bb197e | 166 | EFI_SMM_OPEN2 Open;\r |
167 | EFI_SMM_CLOSE2 Close;\r | |
168 | EFI_SMM_LOCK2 Lock;\r | |
169 | EFI_SMM_CAPABILITIES2 GetCapabilities;\r | |
8442c53e | 170 | ///\r |
171 | /// Indicates the current state of the SMRAM. Set to TRUE if SMRAM is locked.\r | |
172 | ///\r | |
173 | BOOLEAN LockState;\r | |
174 | ///\r | |
175 | /// Indicates the current state of the SMRAM. Set to TRUE if SMRAM is open.\r | |
176 | ///\r | |
177 | BOOLEAN OpenState;\r | |
178 | };\r | |
179 | \r | |
180 | extern EFI_GUID gEfiSmmAccess2ProtocolGuid;\r | |
181 | \r | |
182 | #endif\r | |
183 | \r |