]> git.proxmox.com Git - mirror_edk2.git/blob - IntelFrameworkPkg/Include/Protocol/SmmAccess.h
d7719e44c1c66a526b32a12551c042af829588f7
[mirror_edk2.git] / IntelFrameworkPkg / Include / Protocol / SmmAccess.h
1 /** @file
2 This file declares 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
9 Copyright (c) 2007, Intel Corporation
10 All rights reserved. This program and the accompanying materials
11 are licensed and made available under the terms and conditions of the BSD License
12 which accompanies this distribution. The full text of the license may be found at
13 http://opensource.org/licenses/bsd-license.php
14
15 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
16 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
17
18 @par Revision Reference:
19 This Protocol is defined in Framework of EFI SMM Core Interface Spec
20 Version 0.9.
21 **/
22
23 #ifndef _SMM_ACCESS_H_
24 #define _SMM_ACCESS_H_
25
26 #include <PiDxe.h>
27 #include <Guid/SmramMemoryReserve.h>
28
29 typedef struct _EFI_SMM_ACCESS_PROTOCOL EFI_SMM_ACCESS_PROTOCOL;
30
31 #define EFI_SMM_ACCESS_PROTOCOL_GUID \
32 { \
33 0x3792095a, 0xe309, 0x4c1e, {0xaa, 0x01, 0x85, 0xf5, 0x65, 0x5a, 0x17, 0xf1 } \
34 }
35
36 //
37 // SMM Access specification constant and types
38 //
39 // *******************************************************
40 // EFI_SMRAM_STATE
41 // *******************************************************
42 //
43 #define EFI_SMRAM_OPEN 0x00000001
44 #define EFI_SMRAM_CLOSED 0x00000002
45 #define EFI_SMRAM_LOCKED 0x00000004
46 #define EFI_CACHEABLE 0x00000008
47 #define EFI_ALLOCATED 0x00000010
48
49 //
50 // SMM Access specification Member Function
51 //
52 /**
53 Opens the SMRAM area to be accessible by a boot-service driver.
54
55 @param This The EFI_SMM_ACCESS_PROTOCOL instance.
56 @param DescriptorIndex Indicates that the driver wishes to open
57 the memory tagged by this index.
58
59 @retval EFI_SUCCESS The operation was successful.
60 @retval EFI_INVALID_PARAMETER The given DescriptorIndex is not supported.
61 @retval EFI_NOT_STARTED The SMM base service has not been initialized.
62
63 **/
64 typedef
65 EFI_STATUS
66 (EFIAPI *EFI_SMM_OPEN)(
67 IN EFI_SMM_ACCESS_PROTOCOL *This,
68 UINTN DescriptorIndex
69 );
70
71 /**
72 Inhibits access to the SMRAM.
73
74 @param This The EFI_SMM_ACCESS_PROTOCOL instance.
75 @param DescriptorIndex Indicates that the driver wishes to close
76 the memory tagged by this index.
77
78 @retval EFI_SUCCESS The operation was successful.
79 @retval EFI_DEVICE_ERROR The given DescriptorIndex is not open.
80 @retval EFI_INVALID_PARAMETER The given DescriptorIndex is not supported.
81 @retval EFI_NOT_STARTED The SMM base service has not been initialized.
82
83 **/
84 typedef
85 EFI_STATUS
86 (EFIAPI *EFI_SMM_CLOSE)(
87 IN EFI_SMM_ACCESS_PROTOCOL *This,
88 UINTN DescriptorIndex
89 );
90
91 /**
92 Inhibits access to the SMRAM.
93
94 @param This The EFI_SMM_ACCESS_PROTOCOL instance.
95 @param DescriptorIndex Indicates that the driver wishes to lock
96 the memory tagged by this index.
97
98 @retval EFI_SUCCESS The operation was successful.
99 @retval EFI_DEVICE_ERROR The given DescriptorIndex is not open.
100 @retval EFI_INVALID_PARAMETER The given DescriptorIndex is not supported.
101 @retval EFI_NOT_STARTED The SMM base service has not been initialized.
102
103 **/
104 typedef
105 EFI_STATUS
106 (EFIAPI *EFI_SMM_LOCK)(
107 IN EFI_SMM_ACCESS_PROTOCOL *This,
108 UINTN DescriptorIndex
109 );
110
111 /**
112 Queries the memory controller for the possible regions that will support SMRAM.
113
114 @param This The EFI_SMM_ACCESS_PROTOCOL instance.
115 @param SmramMapSize A pointer to the size, in bytes, of the SmramMemoryMap buffer.
116 @param SmramMap A pointer to the buffer in which firmware places the current memory map.
117
118 @retval EFI_SUCCESS The chipset supported the given resource.
119 @retval EFI_BUFFER_TOO_SMALL The SmramMap parameter was too small.
120
121 **/
122 typedef
123 EFI_STATUS
124 (EFIAPI *EFI_SMM_CAPABILITIES)(
125 IN EFI_SMM_ACCESS_PROTOCOL *This,
126 IN OUT UINTN *SmramMapSize,
127 IN OUT EFI_SMRAM_DESCRIPTOR *SmramMap
128 );
129
130 /**
131 @par Protocol Description:
132 This protocol is used to control the visibility of the SMRAM on the platform.
133
134 @param Open
135 Opens the SMRAM.
136
137 @param Close
138 Closes the SMRAM.
139
140 @param Lock
141 Locks the SMRAM.
142
143 @param GetCapabilities
144 Gets information on possible SMRAM regions.
145
146 @param LockState
147 Indicates the current state of the SMRAM. Set to TRUE if any region is locked.
148
149 @param OpenState
150 Indicates the current state of the SMRAM. Set to TRUE if any region is open.
151
152 **/
153 struct _EFI_SMM_ACCESS_PROTOCOL {
154 EFI_SMM_OPEN Open;
155 EFI_SMM_CLOSE Close;
156 EFI_SMM_LOCK Lock;
157 EFI_SMM_CAPABILITIES GetCapabilities;
158 BOOLEAN LockState;
159 BOOLEAN OpenState;
160 };
161
162 extern EFI_GUID gEfiSmmAccessProtocolGuid;
163
164 #endif