]> git.proxmox.com Git - mirror_edk2.git/blob - IntelFrameworkPkg/Include/Protocol/SmmAccess.h
Committing changes to the comments, after review with engineers.
[mirror_edk2.git] / IntelFrameworkPkg / Include / Protocol / SmmAccess.h
1 /** @file
2 This file declares the 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 - 2009, 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 <Guid/SmramMemoryReserve.h>
27
28 typedef struct _EFI_SMM_ACCESS_PROTOCOL EFI_SMM_ACCESS_PROTOCOL;
29
30 #define EFI_SMM_ACCESS_PROTOCOL_GUID \
31 { \
32 0x3792095a, 0xe309, 0x4c1e, {0xaa, 0x01, 0x85, 0xf5, 0x65, 0x5a, 0x17, 0xf1 } \
33 }
34
35 //
36 // SMM Access specification constant and types
37 //
38 // *******************************************************
39 // EFI_SMRAM_STATE
40 // *******************************************************
41 //
42 #define EFI_SMRAM_OPEN 0x00000001
43 #define EFI_SMRAM_CLOSED 0x00000002
44 #define EFI_SMRAM_LOCKED 0x00000004
45 #define EFI_CACHEABLE 0x00000008
46 #define EFI_ALLOCATED 0x00000010
47
48 //
49 // SMM Access specification Member Function
50 //
51 /**
52 Opens the SMRAM area to be accessible by a boot-service driver.
53
54 @param This The EFI_SMM_ACCESS_PROTOCOL instance.
55 @param DescriptorIndex Indicates that the driver wishes to open
56 the memory tagged by this index.
57
58 @retval EFI_SUCCESS The operation was successful.
59 @retval EFI_INVALID_PARAMETER The given DescriptorIndex is not supported.
60 @retval EFI_NOT_STARTED The SMM base service has not been initialized.
61
62 **/
63 typedef
64 EFI_STATUS
65 (EFIAPI *EFI_SMM_OPEN)(
66 IN EFI_SMM_ACCESS_PROTOCOL *This,
67 UINTN DescriptorIndex
68 );
69
70 /**
71 Inhibits access to the SMRAM.
72
73 @param This The EFI_SMM_ACCESS_PROTOCOL instance.
74 @param DescriptorIndex Indicates that the driver wishes to close
75 the memory tagged by this index.
76
77 @retval EFI_SUCCESS The operation was successful.
78 @retval EFI_DEVICE_ERROR The given DescriptorIndex is not open.
79 @retval EFI_INVALID_PARAMETER The given DescriptorIndex is not supported.
80 @retval EFI_NOT_STARTED The SMM base service has not been initialized.
81
82 **/
83 typedef
84 EFI_STATUS
85 (EFIAPI *EFI_SMM_CLOSE)(
86 IN EFI_SMM_ACCESS_PROTOCOL *This,
87 UINTN DescriptorIndex
88 );
89
90 /**
91 Inhibits access to the SMRAM.
92
93 @param This The EFI_SMM_ACCESS_PROTOCOL instance.
94 @param DescriptorIndex Indicates that the driver wishes to lock
95 the memory tagged by this index.
96
97 @retval EFI_SUCCESS The operation was successful.
98 @retval EFI_DEVICE_ERROR The given DescriptorIndex is not open.
99 @retval EFI_INVALID_PARAMETER The given DescriptorIndex is not supported.
100 @retval EFI_NOT_STARTED The SMM base service has not been initialized.
101
102 **/
103 typedef
104 EFI_STATUS
105 (EFIAPI *EFI_SMM_LOCK)(
106 IN EFI_SMM_ACCESS_PROTOCOL *This,
107 UINTN DescriptorIndex
108 );
109
110 /**
111 Queries the memory controller for the possible regions that will support SMRAM.
112
113 @param This The EFI_SMM_ACCESS_PROTOCOL instance.
114 @param SmramMapSize A pointer to the size, in bytes, of the SmramMemoryMap buffer.
115 @param SmramMap A pointer to the buffer in which firmware places the current memory map.
116
117 @retval EFI_SUCCESS The chipset supported the given resource.
118 @retval EFI_BUFFER_TOO_SMALL The SmramMap parameter was too small.
119
120 **/
121 typedef
122 EFI_STATUS
123 (EFIAPI *EFI_SMM_CAPABILITIES)(
124 IN EFI_SMM_ACCESS_PROTOCOL *This,
125 IN OUT UINTN *SmramMapSize,
126 IN OUT EFI_SMRAM_DESCRIPTOR *SmramMap
127 );
128
129 /**
130 This protocol is used to control the visibility of the SMRAM on the platform.
131 **/
132 struct _EFI_SMM_ACCESS_PROTOCOL {
133 EFI_SMM_OPEN Open; ///< Opens the SMRAM.
134 EFI_SMM_CLOSE Close; ///< Closes the SMRAM.
135 EFI_SMM_LOCK Lock; ///< Locks the SMRAM.
136 EFI_SMM_CAPABILITIES GetCapabilities; ///< Gets information on possible SMRAM regions.
137 BOOLEAN LockState; ///< Indicates the current state of the SMRAM. Set to TRUE if any region is locked.
138 BOOLEAN OpenState; ///< Indicates the current state of the SMRAM. Set to TRUE if any region is open.
139 };
140
141 extern EFI_GUID gEfiSmmAccessProtocolGuid;
142
143 #endif