2 Include file for definitions in the Intel Platform Innovation Framework for EFI
3 System Management Mode Core Interface Specification (SMM CIS) version 0.91.
5 Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved<BR>
6 This program and the accompanying materials are licensed and made available under
7 the terms and conditions of the BSD License that accompanies this distribution.
8 The full text of the license may be found at
9 http://opensource.org/licenses/bsd-license.php.
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.
20 // Share some common definitions with PI SMM
22 #include <Pi/PiSmmCis.h>
23 #include <Protocol/SmmCpuIo.h>
25 typedef struct _EFI_SMM_SYSTEM_TABLE EFI_SMM_SYSTEM_TABLE
;
28 // SMM Base specification constant and types
30 #define EFI_SMM_SYSTEM_TABLE_REVISION (0 << 16) | (0x09)
33 Allocates pool memory from SMRAM for IA-32, or runtime memory for
34 the Itanium processor family.
36 @param PoolType The type of pool to allocate. The only supported type
37 is EfiRuntimeServicesData.
38 @param Size The number of bytes to allocate from the pool.
39 @param Buffer A pointer to a pointer to the allocated buffer if the
40 call succeeds. Otherwise, undefined.
42 @retval EFI_SUCCESS The requested number of bytes was allocated.
43 @retval EFI_OUT_OF_RESOURCES The pool requested could not be allocated.
44 @retval EFI_UNSUPPORTED In runtime.
45 @note Inconsistent with specification here:
46 In Framework Spec, this definition is named EFI_SMM_ALLOCATE_POOL.
47 To avoid a naming conflict, the definition is renamed.
51 (EFIAPI
*EFI_SMMCORE_ALLOCATE_POOL
)(
52 IN EFI_MEMORY_TYPE PoolType
,
58 Returns pool memory to the system.
60 @param Buffer The pointer to the buffer to free.
62 @retval EFI_SUCCESS The memory was returned to the system.
63 @retval EFI_INVALID_PARAMETER Buffer was invalid.
64 @retval EFI_UNSUPPORTED In runtime.
65 @note Inconsistent with specification here:
66 In Framework Spec, this definition is named EFI_SMM_FREE_POOL.
67 To avoid a naming conflict, the definition is renamed.
71 (EFIAPI
*EFI_SMMCORE_FREE_POOL
)(
76 Allocates memory pages from the system.
78 @param Type The type of allocation to perform.
79 @param MemoryType The only supported type is EfiRuntimeServicesData.
80 @param NumberofPages The number of contiguous 4 KB pages to allocate.
81 @param Memory Pointer to a physical address. On input, the way in which
82 the address is used depends on the value of Type. On output, the address
83 is set to the base of the page range that was allocated.
85 @retval EFI_SUCCESS The requested pages were allocated.
86 @retval EFI_OUT_OF_RESOURCES The pages requested could not be allocated.
87 @retval EFI_NOT_FOUND The requested pages could not be found.
88 @retval EFI_INVALID_PARAMETER Type is not AllocateAnyPages or AllocateMaxAddress
89 or AllocateAddress. Or, MemoryType is in the range EfiMaxMemoryType..0x7FFFFFFF.
90 @note Inconsistent with specification here:
91 In the Framework Spec, this definition is named EFI_SMM_ALLOCATE_PAGES.
92 To avoid a naming conflict, the definition here is renamed.
96 (EFIAPI
*EFI_SMMCORE_ALLOCATE_PAGES
)(
97 IN EFI_ALLOCATE_TYPE Type
,
98 IN EFI_MEMORY_TYPE MemoryType
,
99 IN UINTN NumberOfPages
,
100 OUT EFI_PHYSICAL_ADDRESS
*Memory
104 Frees memory pages for the system.
106 @param Memory The base physical address of the pages to be freed.
107 @param NumberOfPages The number of contiguous 4 KB pages to free.
109 @retval EFI_SUCCESS The requested memory pages were freed.
110 @retval EFI_INVALID_PARAMETER Memory is not a page-aligned address or NumberOfPages is invalid.
111 @retval EFI_NOT_FOUND The requested memory pages were not allocated with SmmAllocatePages().
113 @note Inconsistent with specification here:
114 In the Framework Spec, this definition is named EFI_SMM_FREE_PAGES.
115 To avoid a naming conflict, the definition here is renamed.
119 (EFIAPI
*EFI_SMMCORE_FREE_PAGES
)(
120 IN EFI_PHYSICAL_ADDRESS Memory
,
121 IN UINTN NumberOfPages
125 /// The processor save-state information for IA-32 processors. This information is important in that the
126 /// SMM drivers may need to ascertain the state of the processor before invoking the SMI.
130 /// Reserved for future processors. As such, software should not attempt to interpret or
131 /// write to this region.
133 UINT8 Reserved1
[248];
135 /// The location of the processor SMBASE, which is the location where the processor
136 /// will pass control upon receipt of an SMI.
140 /// The revision of the SMM save state. This value is set by the processor.
144 /// The value of the I/O restart field. Allows for restarting an in-process I/O instruction.
148 /// Describes behavior that should be commenced in response to a halt instruction.
150 UINT16 AutoHALTRestart
;
152 /// Reserved for future processors. As such, software should not attempt to interpret or
153 /// write to this region.
155 UINT8 Reserved2
[164];
158 // Registers in IA-32 processors.
182 } EFI_SMI_CPU_SAVE_STATE
;
185 /// The processor save-state information for the Itanium processor family. This information is
186 /// important in that the SMM drivers may need to ascertain the state of the processor before invoking
187 /// the PMI. This structure is mandatory and must be 512 byte aligned.
234 // application registers
295 UINT64 int_nat
; // nat bits for R1-R31
297 } EFI_PMI_SYSTEM_CONTEXT
;
300 /// The processor save-state information for IA-32 and Itanium processors. This information is
301 /// important in that the SMM drivers may need to ascertain the state of the processor before invoking
306 /// The processor save-state information for IA-32 processors.
308 EFI_SMI_CPU_SAVE_STATE Ia32SaveState
;
310 /// The processor save-state information for Itanium processors.
312 EFI_PMI_SYSTEM_CONTEXT ItaniumSaveState
;
313 } EFI_SMM_CPU_SAVE_STATE
;
316 /// The optional floating point save-state information for IA-32 processors. If the optional floating
317 /// point save is indicated for any handler, the following data structure must be preserved.
330 UINT8 St0Mm0
[10], Rsvd3
[6];
331 UINT8 St0Mm1
[10], Rsvd4
[6];
332 UINT8 St0Mm2
[10], Rsvd5
[6];
333 UINT8 St0Mm3
[10], Rsvd6
[6];
334 UINT8 St0Mm4
[10], Rsvd7
[6];
335 UINT8 St0Mm5
[10], Rsvd8
[6];
336 UINT8 St0Mm6
[10], Rsvd9
[6];
337 UINT8 St0Mm7
[10], Rsvd10
[6];
339 } EFI_SMI_OPTIONAL_FPSAVE_STATE
;
342 /// The optional floating point save-state information for the Itanium processor family. If the optional
343 /// floating point save is indicated for any handler, then this data structure must be preserved.
376 } EFI_PMI_OPTIONAL_FLOATING_POINT_CONTEXT
;
379 /// The processor save-state information for IA-32 and Itanium processors. If the optional floating
380 /// point save is indicated for any handler, then this data structure must be preserved.
384 /// The optional floating point save-state information for IA-32 processors.
386 EFI_SMI_OPTIONAL_FPSAVE_STATE Ia32FpSave
;
388 /// The optional floating point save-state information for Itanium processors.
390 EFI_PMI_OPTIONAL_FLOATING_POINT_CONTEXT ItaniumFpSave
;
391 } EFI_SMM_FLOATING_POINT_SAVE_STATE
;
394 This function is the main entry point for an SMM handler dispatch
395 or communicate-based callback.
397 @param SmmImageHandle A unique value returned by the SMM infrastructure
398 in response to registration for a communicate-based callback or dispatch.
399 @param CommunicationBuffer
400 An optional buffer that will be populated
401 by the SMM infrastructure in response to a non-SMM agent (preboot or runtime)
402 invoking the EFI_SMM_BASE_PROTOCOL.Communicate() service.
403 @param SourceSize If CommunicationBuffer is non-NULL, this field
404 indicates the size of the data payload in this buffer.
411 (EFIAPI
*EFI_SMM_HANDLER_ENTRY_POINT
)(
412 IN EFI_HANDLE SmmImageHandle
,
413 IN OUT VOID
*CommunicationBuffer OPTIONAL
,
414 IN OUT UINTN
*SourceSize OPTIONAL
418 The SmmInstallConfigurationTable() function is used to maintain the list
419 of configuration tables that are stored in the System Management System
420 Table. The list is stored as an array of (GUID, Pointer) pairs. The list
421 must be allocated from pool memory with PoolType set to EfiRuntimeServicesData.
423 @param SystemTable A pointer to the SMM System Table.
424 @param Guid A pointer to the GUID for the entry to add, update, or remove.
425 @param Table A pointer to the buffer of the table to add.
426 @param TableSize The size of the table to install.
428 @retval EFI_SUCCESS The (Guid, Table) pair was added, updated, or removed.
429 @retval EFI_INVALID_PARAMETER Guid is not valid.
430 @retval EFI_NOT_FOUND An attempt was made to delete a non-existent entry.
431 @retval EFI_OUT_OF_RESOURCES There is not enough memory available to complete the operation.
436 (EFIAPI
*EFI_SMM_INSTALL_CONFIGURATION_TABLE
)(
437 IN EFI_SMM_SYSTEM_TABLE
*SystemTable
,
444 // System Management System Table (SMST)
446 struct _EFI_SMM_SYSTEM_TABLE
{
448 /// The table header for the System Management System Table (SMST).
450 EFI_TABLE_HEADER Hdr
;
453 /// A pointer to a NULL-terminated Unicode string containing the vendor name. It is
454 /// permissible for this pointer to be NULL.
456 CHAR16
*SmmFirmwareVendor
;
458 /// The particular revision of the firmware.
460 UINT32 SmmFirmwareRevision
;
463 /// Adds, updates, or removes a configuration table entry from the SMST.
465 EFI_SMM_INSTALL_CONFIGURATION_TABLE SmmInstallConfigurationTable
;
471 /// A GUID that designates the particular CPU I/O services.
473 EFI_GUID EfiSmmCpuIoGuid
;
475 /// Provides the basic memory and I/O interfaces that are used to abstract accesses to
478 EFI_SMM_CPU_IO_INTERFACE SmmIo
;
481 // Runtime memory service
485 /// Allocates pool memory from SMRAM for IA-32 or runtime memory for the
486 /// Itanium processor family.
488 EFI_SMMCORE_ALLOCATE_POOL SmmAllocatePool
;
490 /// Returns pool memory to the system.
492 EFI_SMMCORE_FREE_POOL SmmFreePool
;
494 /// Allocates memory pages from the system.
496 EFI_SMMCORE_ALLOCATE_PAGES SmmAllocatePages
;
498 /// Frees memory pages for the system.
500 EFI_SMMCORE_FREE_PAGES SmmFreePages
;
506 /// Inconsistent with specification here:
507 /// In Framework Spec, this definition does not exist. This method is introduced in PI1.1 specification for
508 /// the implementation needed.
509 EFI_SMM_STARTUP_THIS_AP SmmStartupThisAp
;
512 // CPU information records
515 /// A 1-relative number between 1 and the NumberOfCpus field. This field designates
516 /// which processor is executing the SMM infrastructure. This number also serves as an
517 /// index into the CpuSaveState and CpuOptionalFloatingPointState
520 UINTN CurrentlyExecutingCpu
;
522 /// The number of EFI Configuration Tables in the buffer
523 /// SmmConfigurationTable.
527 /// A pointer to the EFI Configuration Tables. The number of entries in the table is
528 /// NumberOfTableEntries.
530 EFI_SMM_CPU_SAVE_STATE
*CpuSaveState
;
532 /// A pointer to a catenation of the EFI_SMM_FLOATING_POINT_SAVE_STATE.
533 /// The size of this entire table is NumberOfCpus* size of the
534 /// EFI_SMM_FLOATING_POINT_SAVE_STATE. These fields are populated only if
535 /// there is at least one SMM driver that has registered for a callback with the
536 /// FloatingPointSave field in EFI_SMM_BASE_PROTOCOL.RegisterCallback() set to TRUE.
538 EFI_SMM_FLOATING_POINT_SAVE_STATE
*CpuOptionalFloatingPointState
;
541 // Extensibility table
544 /// The number of EFI Configuration Tables in the buffer
545 /// SmmConfigurationTable.
547 UINTN NumberOfTableEntries
;
549 /// A pointer to the EFI Configuration Tables. The number of entries in the table is
550 /// NumberOfTableEntries.
552 EFI_CONFIGURATION_TABLE
*SmmConfigurationTable
;