]> git.proxmox.com Git - mirror_edk2.git/blame - IntelFrameworkPkg/Include/Common/FrameworkSmmCis.h
Rename Frame*Lib to *LibFramework to improve the speed that a module could be found...
[mirror_edk2.git] / IntelFrameworkPkg / Include / Common / FrameworkSmmCis.h
CommitLineData
79964ac8 1/** @file\r
2 Include file matches things in the Smm CIS spec.\r
3\r
4 Copyright (c) 2007, Intel Corporation\r
5 All rights reserved. This program and the accompanying materials\r
6 are licensed and made available under the terms and conditions of the BSD License\r
7 which accompanies this distribution. The full text of the license may be found at\r
8 http://opensource.org/licenses/bsd-license.php\r
9\r
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
12\r
13 Module Name: FrameworkSmmCis.h\r
14\r
15 @par Revision Reference:\r
16 Version 0.9.\r
17\r
18**/\r
19\r
20#ifndef _FRAMEWORK_SMM_CIS_H_\r
21#define _FRAMEWORK_SMM_CIS_H_\r
22\r
b80fbe85 23#include <Common/FrameworkDxeCis.h>\r
79964ac8 24\r
25#define EFI_SMM_CPU_IO_GUID \\r
26 { \\r
27 0x5f439a0b, 0x45d8, 0x4682, {0xa4, 0xf4, 0xf0, 0x57, 0x6b, 0x51, 0x34, 0x41 } \\r
28 }\r
29\r
30typedef struct _EFI_SMM_SYSTEM_TABLE EFI_SMM_SYSTEM_TABLE;\r
31typedef struct _EFI_SMM_CPU_IO_INTERFACE EFI_SMM_CPU_IO_INTERFACE;\r
32\r
33\r
34//\r
35// SMM Base specification constant and types\r
36//\r
37#define SMM_SMST_SIGNATURE EFI_SIGNATURE_32 ('S', 'M', 'S', 'T')\r
38#define EFI_SMM_SYSTEM_TABLE_REVISION (0 << 16) | (0x09)\r
39\r
40//\r
41// *******************************************************\r
42// EFI_SMM_IO_WIDTH\r
43// *******************************************************\r
44//\r
45typedef enum {\r
46 SMM_IO_UINT8 = 0,\r
47 SMM_IO_UINT16 = 1,\r
48 SMM_IO_UINT32 = 2,\r
49 SMM_IO_UINT64 = 3\r
50} EFI_SMM_IO_WIDTH;\r
51\r
52/**\r
53 Provides the basic memory and I/O interfaces that are used to\r
54 abstract accesses to devices.\r
55\r
56 @param This The EFI_SMM_CPU_IO_INTERFACE instance.\r
57 @param Width Signifies the width of the I/O operations.\r
58 @param Address The base address of the I/O operations.\r
59 @param Count The number of I/O operations to perform.\r
60 @param Buffer For read operations, the destination buffer to store the results.\r
61 For write operations, the source buffer from which to write data.\r
62\r
63 @retval EFI_SUCCESS The data was read from or written to the device.\r
64 @retval EFI_UNSUPPORTED The Address is not valid for this system.\r
65 @retval EFI_INVALID_PARAMETER Width or Count, or both, were invalid.\r
66 @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.\r
67\r
68**/\r
69typedef\r
70EFI_STATUS\r
71(EFIAPI *EFI_SMM_CPU_IO) (\r
72 IN EFI_SMM_CPU_IO_INTERFACE *This,\r
73 IN EFI_SMM_IO_WIDTH Width,\r
74 IN UINT64 Address,\r
75 IN UINTN Count,\r
76 IN OUT VOID *Buffer\r
77 );\r
78\r
79typedef struct {\r
80 EFI_SMM_CPU_IO Read;\r
81 EFI_SMM_CPU_IO Write;\r
82} EFI_SMM_IO_ACCESS;\r
83\r
84struct _EFI_SMM_CPU_IO_INTERFACE {\r
85 EFI_SMM_IO_ACCESS Mem;\r
86 EFI_SMM_IO_ACCESS Io;\r
87};\r
88\r
89/**\r
90 Allocates pool memory from SMRAM for IA-32 or runtime memory for\r
91 the Itanium processor family.\r
92\r
93 @param PoolType The type of pool to allocate.The only supported type is EfiRuntimeServicesData\r
94 @param Size The number of bytes to allocate from the pool.\r
95 @param Buffer A pointer to a pointer to the allocated buffer if the call\r
96 succeeds; undefined otherwise.\r
97\r
98 @retval EFI_SUCCESS The requested number of bytes was allocated.\r
99 @retval EFI_OUT_OF_RESOURCES The pool requested could not be allocated.\r
100 @retval EFI_UNSUPPORTED In runtime.\r
101\r
102**/\r
103typedef\r
104EFI_STATUS\r
105(EFIAPI *EFI_SMMCORE_ALLOCATE_POOL) (\r
106 IN EFI_MEMORY_TYPE PoolType,\r
107 IN UINTN Size,\r
108 OUT VOID **Buffer\r
109 );\r
110\r
111/**\r
112 Returns pool memory to the system.\r
113\r
114 @param Buffer Pointer to the buffer to free.\r
115\r
116 @retval EFI_SUCCESS The memory was returned to the system.\r
117 @retval EFI_INVALID_PARAMETER Buffer was invalid.\r
118 @retval EFI_UNSUPPORTED In runtime.\r
119\r
120**/\r
121typedef\r
122EFI_STATUS\r
123(EFIAPI *EFI_SMMCORE_FREE_POOL) (\r
124 IN VOID *Buffer\r
125 );\r
126\r
127/**\r
128 Allocates memory pages from the system.\r
129\r
130 @param Type The type of allocation to perform.\r
131 @param MemoryType The only supported type is EfiRuntimeServicesData\r
132 @param NumberofPages The number of contiguous 4 KB pages to allocate\r
133 @param Memory Pointer to a physical address. On input, the way in which\r
134 the address is used depends on the value of Type. On output, the address\r
135 is set to the base of the page range that was allocated.\r
136\r
137 @retval EFI_SUCCESS The requested pages were allocated.\r
138 @retval EFI_OUT_OF_RESOURCES The pages requested could not be allocated.\r
139 @retval EFI_NOT_FOUND The requested pages could not be found.\r
140 @retval EFI_INVALID_PARAMETER Type is not AllocateAnyPages or AllocateMaxAddress\r
141 or AllocateAddress. Or MemoryType is in the range EfiMaxMemoryType..0x7FFFFFFF.\r
142\r
143**/\r
144typedef\r
145EFI_STATUS\r
146(EFIAPI *EFI_SMMCORE_ALLOCATE_PAGES) (\r
147 IN EFI_ALLOCATE_TYPE Type,\r
148 IN EFI_MEMORY_TYPE MemoryType,\r
149 IN UINTN NumberOfPages,\r
150 OUT EFI_PHYSICAL_ADDRESS *Memory\r
151 );\r
152\r
153/**\r
154 Frees memory pages for the system.\r
155\r
156 @param Memory The base physical address of the pages to be freed\r
157 @param NumberOfPages The number of contiguous 4 KB pages to free.\r
158\r
159 @retval EFI_SUCCESS The requested memory pages were freed.\r
160 @retval EFI_INVALID_PARAMETER Memory is not a page-aligned address or NumberOfPages is invalid.\r
161 @retval EFI_NOT_FOUND The requested memory pages were not allocated with SmmAllocatePages().\r
162\r
163**/\r
164typedef\r
165EFI_STATUS\r
166(EFIAPI *EFI_SMMCORE_FREE_PAGES) (\r
167 IN EFI_PHYSICAL_ADDRESS Memory,\r
168 IN UINTN NumberOfPages\r
169 );\r
170\r
171typedef\r
172EFI_STATUS\r
173(EFIAPI *EFI_SMM_STARTUP_THIS_AP) (\r
174 IN EFI_AP_PROCEDURE Procedure,\r
175 IN UINTN CpuNumber,\r
176 IN OUT VOID *ProcArguments OPTIONAL\r
177 );\r
178\r
179typedef struct {\r
180 UINT8 Reserved1[248];\r
181 UINT32 SMBASE;\r
182 UINT32 SMMRevId;\r
183 UINT16 IORestart;\r
184 UINT16 AutoHALTRestart;\r
185 UINT8 Reserved2[164];\r
186 UINT32 ES;\r
187 UINT32 CS;\r
188 UINT32 SS;\r
189 UINT32 DS;\r
190 UINT32 FS;\r
191 UINT32 GS;\r
192 UINT32 LDTBase;\r
193 UINT32 TR;\r
194 UINT32 DR7;\r
195 UINT32 DR6;\r
196 UINT32 EAX;\r
197 UINT32 ECX;\r
198 UINT32 EDX;\r
199 UINT32 EBX;\r
200 UINT32 ESP;\r
201 UINT32 EBP;\r
202 UINT32 ESI;\r
203 UINT32 EDI;\r
204 UINT32 EIP;\r
205 UINT32 EFLAGS;\r
206 UINT32 CR3;\r
207 UINT32 CR0;\r
208} EFI_SMI_CPU_SAVE_STATE;\r
209\r
210typedef struct {\r
211 UINT64 reserved;\r
212 UINT64 r1;\r
213 UINT64 r2;\r
214 UINT64 r3;\r
215 UINT64 r4;\r
216 UINT64 r5;\r
217 UINT64 r6;\r
218 UINT64 r7;\r
219 UINT64 r8;\r
220 UINT64 r9;\r
221 UINT64 r10;\r
222 UINT64 r11;\r
223 UINT64 r12;\r
224 UINT64 r13;\r
225 UINT64 r14;\r
226 UINT64 r15;\r
227 UINT64 r16;\r
228 UINT64 r17;\r
229 UINT64 r18;\r
230 UINT64 r19;\r
231 UINT64 r20;\r
232 UINT64 r21;\r
233 UINT64 r22;\r
234 UINT64 r23;\r
235 UINT64 r24;\r
236 UINT64 r25;\r
237 UINT64 r26;\r
238 UINT64 r27;\r
239 UINT64 r28;\r
240 UINT64 r29;\r
241 UINT64 r30;\r
242 UINT64 r31;\r
243\r
244 UINT64 pr;\r
245\r
246 UINT64 b0;\r
247 UINT64 b1;\r
248 UINT64 b2;\r
249 UINT64 b3;\r
250 UINT64 b4;\r
251 UINT64 b5;\r
252 UINT64 b6;\r
253 UINT64 b7;\r
254\r
255 // application registers\r
256 UINT64 ar_rsc;\r
257 UINT64 ar_bsp;\r
258 UINT64 ar_bspstore;\r
259 UINT64 ar_rnat;\r
260\r
261 UINT64 ar_fcr;\r
262\r
263 UINT64 ar_eflag;\r
264 UINT64 ar_csd;\r
265 UINT64 ar_ssd;\r
266 UINT64 ar_cflg;\r
267 UINT64 ar_fsr;\r
268 UINT64 ar_fir;\r
269 UINT64 ar_fdr;\r
270\r
271 UINT64 ar_ccv;\r
272\r
273 UINT64 ar_unat;\r
274\r
275 UINT64 ar_fpsr;\r
276\r
277 UINT64 ar_pfs;\r
278 UINT64 ar_lc;\r
279 UINT64 ar_ec;\r
280\r
281 // control registers\r
282 UINT64 cr_dcr;\r
283 UINT64 cr_itm;\r
284 UINT64 cr_iva;\r
285 UINT64 cr_pta;\r
286 UINT64 cr_ipsr;\r
287 UINT64 cr_isr;\r
288 UINT64 cr_iip;\r
289 UINT64 cr_ifa;\r
290 UINT64 cr_itir;\r
291 UINT64 cr_iipa;\r
292 UINT64 cr_ifs;\r
293 UINT64 cr_iim;\r
294 UINT64 cr_iha;\r
295\r
296 // debug registers\r
297 UINT64 dbr0;\r
298 UINT64 dbr1;\r
299 UINT64 dbr2;\r
300 UINT64 dbr3;\r
301 UINT64 dbr4;\r
302 UINT64 dbr5;\r
303 UINT64 dbr6;\r
304 UINT64 dbr7;\r
305\r
306 UINT64 ibr0;\r
307 UINT64 ibr1;\r
308 UINT64 ibr2;\r
309 UINT64 ibr3;\r
310 UINT64 ibr4;\r
311 UINT64 ibr5;\r
312 UINT64 ibr6;\r
313 UINT64 ibr7;\r
314\r
315 // virtual registers\r
316 UINT64 int_nat; // nat bits for R1-R31\r
317\r
318} EFI_PMI_SYSTEM_CONTEXT;\r
319\r
320typedef union {\r
321 EFI_SMI_CPU_SAVE_STATE Ia32SaveState;\r
322 EFI_PMI_SYSTEM_CONTEXT ItaniumSaveState;\r
323} EFI_SMM_CPU_SAVE_STATE;\r
324\r
325typedef struct {\r
326 UINT16 Fcw;\r
327 UINT16 Fsw;\r
328 UINT16 Ftw;\r
329 UINT16 Opcode;\r
330 UINT32 Eip;\r
331 UINT16 Cs;\r
332 UINT16 Rsvd1;\r
333 UINT32 DataOffset;\r
334 UINT16 Ds;\r
335 UINT8 Rsvd2[10];\r
336 UINT8 St0Mm0[10], Rsvd3[6];\r
337 UINT8 St0Mm1[10], Rsvd4[6];\r
338 UINT8 St0Mm2[10], Rsvd5[6];\r
339 UINT8 St0Mm3[10], Rsvd6[6];\r
340 UINT8 St0Mm4[10], Rsvd7[6];\r
341 UINT8 St0Mm5[10], Rsvd8[6];\r
342 UINT8 St0Mm6[10], Rsvd9[6];\r
343 UINT8 St0Mm7[10], Rsvd10[6];\r
344 UINT8 Rsvd11[22*16];\r
345} EFI_SMI_OPTIONAL_FPSAVE_STATE;\r
346\r
347typedef struct {\r
348 UINT64 f2[2];\r
349 UINT64 f3[2];\r
350 UINT64 f4[2];\r
351 UINT64 f5[2];\r
352 UINT64 f6[2];\r
353 UINT64 f7[2];\r
354 UINT64 f8[2];\r
355 UINT64 f9[2];\r
356 UINT64 f10[2];\r
357 UINT64 f11[2];\r
358 UINT64 f12[2];\r
359 UINT64 f13[2];\r
360 UINT64 f14[2];\r
361 UINT64 f15[2];\r
362 UINT64 f16[2];\r
363 UINT64 f17[2];\r
364 UINT64 f18[2];\r
365 UINT64 f19[2];\r
366 UINT64 f20[2];\r
367 UINT64 f21[2];\r
368 UINT64 f22[2];\r
369 UINT64 f23[2];\r
370 UINT64 f24[2];\r
371 UINT64 f25[2];\r
372 UINT64 f26[2];\r
373 UINT64 f27[2];\r
374 UINT64 f28[2];\r
375 UINT64 f29[2];\r
376 UINT64 f30[2];\r
377 UINT64 f31[2];\r
378} EFI_PMI_OPTIONAL_FLOATING_POINT_CONTEXT;\r
379\r
380typedef union {\r
381 EFI_SMI_OPTIONAL_FPSAVE_STATE Ia32FpSave;\r
382 EFI_PMI_OPTIONAL_FLOATING_POINT_CONTEXT ItaniumFpSave;\r
383} EFI_SMM_FLOATING_POINT_SAVE_STATE;\r
384\r
385/**\r
386 This function is the main entry point for an SMM handler dispatch\r
387 or communicate-based callback.\r
388\r
389 @param SmmImageHandle A unique value returned by the SMM infrastructure\r
390 in response to registration for a communicate-based callback or dispatch.\r
391 @param CommunicationBuffer\r
392 An optional buffer that will be populated\r
393 by the SMM infrastructure in response to a non-SMM agent (preboot or runtime)\r
394 invoking the EFI_SMM_BASE_PROTOCOL.Communicate() service.\r
395 @param SourceSize If CommunicationBuffer is non-NULL, this field\r
396 indicates the size of the data payload in this buffer.\r
397\r
398 @return Status Code\r
399\r
400**/\r
401typedef\r
402EFI_STATUS\r
403(EFIAPI *EFI_SMM_HANDLER_ENTRY_POINT) (\r
404 IN EFI_HANDLE SmmImageHandle,\r
405 IN OUT VOID *CommunicationBuffer OPTIONAL,\r
406 IN OUT UINTN *SourceSize OPTIONAL\r
407 );\r
408\r
409/**\r
410 The SmmInstallConfigurationTable() function is used to maintain the list\r
411 of configuration tables that are stored in the System Management System\r
412 Table. The list is stored as an array of (GUID, Pointer) pairs. The list\r
413 must be allocated from pool memory with PoolType set to EfiRuntimeServicesData.\r
414\r
415 @param SystemTable A pointer to the SMM System Table.\r
416 @param Guid A pointer to the GUID for the entry to add, update, or remove.\r
417 @param Table A pointer to the buffer of the table to add.\r
418 @param TableSize The size of the table to install.\r
419\r
420 @retval EFI_SUCCESS The (Guid, Table) pair was added, updated, or removed.\r
421 @retval EFI_INVALID_PARAMETER Guid is not valid.\r
422 @retval EFI_NOT_FOUND An attempt was made to delete a non-existent entry.\r
423 @retval EFI_OUT_OF_RESOURCES There is not enough memory available to complete the operation.\r
424\r
425**/\r
426typedef\r
427EFI_STATUS\r
428(EFIAPI *EFI_SMM_INSTALL_CONFIGURATION_TABLE) (\r
429 IN EFI_SMM_SYSTEM_TABLE *SystemTable,\r
430 IN EFI_GUID *Guid,\r
431 IN VOID *Table,\r
432 IN UINTN TableSize\r
433 );\r
434\r
435//\r
436// System Management System Table (SMST)\r
437//\r
438struct _EFI_SMM_SYSTEM_TABLE {\r
439 EFI_TABLE_HEADER Hdr;\r
440\r
441 CHAR16 *SmmFirmwareVendor;\r
442 UINT32 SmmFirmwareRevision;\r
443\r
444 EFI_SMM_INSTALL_CONFIGURATION_TABLE SmmInstallConfigurationTable;\r
445\r
446 //\r
447 // I/O Services\r
448 //\r
449 EFI_GUID EfiSmmCpuIoGuid;\r
450 EFI_SMM_CPU_IO_INTERFACE SmmIo;\r
451\r
452 //\r
453 // Runtime memory service\r
454 //\r
455 EFI_SMMCORE_ALLOCATE_POOL SmmAllocatePool;\r
456 EFI_SMMCORE_FREE_POOL SmmFreePool;\r
457 EFI_SMMCORE_ALLOCATE_PAGES SmmAllocatePages;\r
458 EFI_SMMCORE_FREE_PAGES SmmFreePages;\r
459\r
460 //\r
461 // MP service\r
462 //\r
463 EFI_SMM_STARTUP_THIS_AP SmmStartupThisAp;\r
464\r
465 //\r
466 // CPU information records\r
467 //\r
468 UINTN CurrentlyExecutingCpu;\r
469 UINTN NumberOfCpus;\r
470 EFI_SMM_CPU_SAVE_STATE *CpuSaveState;\r
471 EFI_SMM_FLOATING_POINT_SAVE_STATE *CpuOptionalFloatingPointState;\r
472\r
473 //\r
474 // Extensibility table\r
475 //\r
476 UINTN NumberOfTableEntries;\r
477 EFI_CONFIGURATION_TABLE *SmmConfigurationTable;\r
478};\r
479\r
480#endif\r