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