]> git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Include/Pi/PiSmmCis.h
7692800e34e75ffdcf047143794467b2f9c13b73
[mirror_edk2.git] / MdePkg / Include / Pi / PiSmmCis.h
1 /** @file
2 Common definitions in the Platform Initialization Specification version 1.4a
3 VOLUME 4 System Management Mode Core Interface version.
4
5 Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.<BR>
6 This program and the accompanying materials
7 are licensed and made available under the terms and conditions of the BSD License
8 which accompanies this distribution. The full text of the license may be found at
9 http://opensource.org/licenses/bsd-license.php
10
11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
12 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
13
14 **/
15
16 #ifndef _PI_SMMCIS_H_
17 #define _PI_SMMCIS_H_
18
19 #include <Pi/PiMmCis.h>
20 #include <Protocol/SmmCpuIo2.h>
21
22 typedef struct _EFI_SMM_SYSTEM_TABLE2 EFI_SMM_SYSTEM_TABLE2;
23 //
24 // Define new MM related definition introduced by PI 1.5.
25 //
26 #define SMM_SMST_SIGNATURE MM_MMST_SIGNATURE
27 #define SMM_SPECIFICATION_MAJOR_REVISION MM_SPECIFICATION_MAJOR_REVISION
28 #define SMM_SPECIFICATION_MINOR_REVISION MM_SPECIFICATION_MINOR_REVISION
29 #define EFI_SMM_SYSTEM_TABLE2_REVISION EFI_MM_SYSTEM_TABLE_REVISION
30
31 /**
32 Adds, updates, or removes a configuration table entry from the System Management System Table.
33
34 The SmmInstallConfigurationTable() function is used to maintain the list
35 of configuration tables that are stored in the System Management System
36 Table. The list is stored as an array of (GUID, Pointer) pairs. The list
37 must be allocated from pool memory with PoolType set to EfiRuntimeServicesData.
38
39 @param[in] SystemTable A pointer to the SMM System Table (SMST).
40 @param[in] Guid A pointer to the GUID for the entry to add, update, or remove.
41 @param[in] Table A pointer to the buffer of the table to add.
42 @param[in] TableSize The size of the table to install.
43
44 @retval EFI_SUCCESS The (Guid, Table) pair was added, updated, or removed.
45 @retval EFI_INVALID_PARAMETER Guid is not valid.
46 @retval EFI_NOT_FOUND An attempt was made to delete a non-existent entry.
47 @retval EFI_OUT_OF_RESOURCES There is not enough memory available to complete the operation.
48 **/
49 typedef
50 EFI_STATUS
51 (EFIAPI *EFI_SMM_INSTALL_CONFIGURATION_TABLE2)(
52 IN CONST EFI_SMM_SYSTEM_TABLE2 *SystemTable,
53 IN CONST EFI_GUID *Guid,
54 IN VOID *Table,
55 IN UINTN TableSize
56 );
57
58 typedef EFI_MM_STARTUP_THIS_AP EFI_SMM_STARTUP_THIS_AP;
59 typedef EFI_MM_NOTIFY_FN EFI_SMM_NOTIFY_FN;
60 typedef EFI_MM_REGISTER_PROTOCOL_NOTIFY EFI_SMM_REGISTER_PROTOCOL_NOTIFY;
61 typedef EFI_MM_INTERRUPT_MANAGE EFI_SMM_INTERRUPT_MANAGE;
62 typedef EFI_MM_HANDLER_ENTRY_POINT EFI_SMM_HANDLER_ENTRY_POINT2;
63 typedef EFI_MM_INTERRUPT_REGISTER EFI_SMM_INTERRUPT_REGISTER;
64 typedef EFI_MM_INTERRUPT_UNREGISTER EFI_SMM_INTERRUPT_UNREGISTER;
65
66 ///
67 /// Processor information and functionality needed by SMM Foundation.
68 ///
69 typedef struct _EFI_SMM_ENTRY_CONTEXT {
70 EFI_SMM_STARTUP_THIS_AP SmmStartupThisAp;
71 ///
72 /// A number between zero and the NumberOfCpus field. This field designates which
73 /// processor is executing the SMM Foundation.
74 ///
75 UINTN CurrentlyExecutingCpu;
76 ///
77 /// The number of possible processors in the platform. This is a 1 based
78 /// counter. This does not indicate the number of processors that entered SMM.
79 ///
80 UINTN NumberOfCpus;
81 ///
82 /// Points to an array, where each element describes the number of bytes in the
83 /// corresponding save state specified by CpuSaveState. There are always
84 /// NumberOfCpus entries in the array.
85 ///
86 UINTN *CpuSaveStateSize;
87 ///
88 /// Points to an array, where each element is a pointer to a CPU save state. The
89 /// corresponding element in CpuSaveStateSize specifies the number of bytes in the
90 /// save state area. There are always NumberOfCpus entries in the array.
91 ///
92 VOID **CpuSaveState;
93 } EFI_SMM_ENTRY_CONTEXT;
94
95 /**
96 This function is the main entry point to the SMM Foundation.
97
98 @param[in] SmmEntryContext Processor information and functionality needed by SMM Foundation.
99 **/
100 typedef
101 VOID
102 (EFIAPI *EFI_SMM_ENTRY_POINT)(
103 IN CONST EFI_SMM_ENTRY_CONTEXT *SmmEntryContext
104 );
105
106 ///
107 /// System Management System Table (SMST)
108 ///
109 /// The System Management System Table (SMST) is a table that contains a collection of common
110 /// services for managing SMRAM allocation and providing basic I/O services. These services are
111 /// intended for both preboot and runtime usage.
112 ///
113 struct _EFI_SMM_SYSTEM_TABLE2 {
114 ///
115 /// The table header for the SMST.
116 ///
117 EFI_TABLE_HEADER Hdr;
118 ///
119 /// A pointer to a NULL-terminated Unicode string containing the vendor name.
120 /// It is permissible for this pointer to be NULL.
121 ///
122 CHAR16 *SmmFirmwareVendor;
123 ///
124 /// The particular revision of the firmware.
125 ///
126 UINT32 SmmFirmwareRevision;
127
128 EFI_SMM_INSTALL_CONFIGURATION_TABLE2 SmmInstallConfigurationTable;
129
130 ///
131 /// I/O Service
132 ///
133 EFI_SMM_CPU_IO2_PROTOCOL SmmIo;
134
135 ///
136 /// Runtime memory services
137 ///
138 EFI_ALLOCATE_POOL SmmAllocatePool;
139 EFI_FREE_POOL SmmFreePool;
140 EFI_ALLOCATE_PAGES SmmAllocatePages;
141 EFI_FREE_PAGES SmmFreePages;
142
143 ///
144 /// MP service
145 ///
146 EFI_SMM_STARTUP_THIS_AP SmmStartupThisAp;
147
148 ///
149 /// CPU information records
150 ///
151
152 ///
153 /// A number between zero and and the NumberOfCpus field. This field designates
154 /// which processor is executing the SMM infrastructure.
155 ///
156 UINTN CurrentlyExecutingCpu;
157 ///
158 /// The number of possible processors in the platform. This is a 1 based counter.
159 ///
160 UINTN NumberOfCpus;
161 ///
162 /// Points to an array, where each element describes the number of bytes in the
163 /// corresponding save state specified by CpuSaveState. There are always
164 /// NumberOfCpus entries in the array.
165 ///
166 UINTN *CpuSaveStateSize;
167 ///
168 /// Points to an array, where each element is a pointer to a CPU save state. The
169 /// corresponding element in CpuSaveStateSize specifies the number of bytes in the
170 /// save state area. There are always NumberOfCpus entries in the array.
171 ///
172 VOID **CpuSaveState;
173
174 ///
175 /// Extensibility table
176 ///
177
178 ///
179 /// The number of UEFI Configuration Tables in the buffer SmmConfigurationTable.
180 ///
181 UINTN NumberOfTableEntries;
182 ///
183 /// A pointer to the UEFI Configuration Tables. The number of entries in the table is
184 /// NumberOfTableEntries.
185 ///
186 EFI_CONFIGURATION_TABLE *SmmConfigurationTable;
187
188 ///
189 /// Protocol services
190 ///
191 EFI_INSTALL_PROTOCOL_INTERFACE SmmInstallProtocolInterface;
192 EFI_UNINSTALL_PROTOCOL_INTERFACE SmmUninstallProtocolInterface;
193 EFI_HANDLE_PROTOCOL SmmHandleProtocol;
194 EFI_SMM_REGISTER_PROTOCOL_NOTIFY SmmRegisterProtocolNotify;
195 EFI_LOCATE_HANDLE SmmLocateHandle;
196 EFI_LOCATE_PROTOCOL SmmLocateProtocol;
197
198 ///
199 /// SMI Management functions
200 ///
201 EFI_SMM_INTERRUPT_MANAGE SmiManage;
202 EFI_SMM_INTERRUPT_REGISTER SmiHandlerRegister;
203 EFI_SMM_INTERRUPT_UNREGISTER SmiHandlerUnRegister;
204 };
205
206 #endif