2 Include file for definitions in the Intel Platform Innovation Framework for EFI
3 System Management Mode Core Interface Specification (SMM CIS) version 0.90.
5 Copyright (c) 2007 - 2009, Intel Corporation
6 All rights reserved. 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
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.
16 #ifndef _FRAMEWORK_SMM_CIS_H_
17 #define _FRAMEWORK_SMM_CIS_H_
19 #include <Framework/DxeCis.h>
21 #define EFI_SMM_CPU_IO_GUID \
23 0x5f439a0b, 0x45d8, 0x4682, {0xa4, 0xf4, 0xf0, 0x57, 0x6b, 0x51, 0x34, 0x41 } \
26 typedef struct _EFI_SMM_SYSTEM_TABLE EFI_SMM_SYSTEM_TABLE
;
27 typedef struct _EFI_SMM_CPU_IO_INTERFACE EFI_SMM_CPU_IO_INTERFACE
;
31 // SMM Base specification constant and types
33 #define SMM_SMST_SIGNATURE SIGNATURE_32 ('S', 'M', 'S', 'T')
34 #define EFI_SMM_SYSTEM_TABLE_REVISION (0 << 16) | (0x09)
37 // *******************************************************
39 // *******************************************************
49 Provides the basic memory and I/O interfaces that are used to
50 abstract accesses to devices.
52 @param This The EFI_SMM_CPU_IO_INTERFACE instance.
53 @param Width Signifies the width of the I/O operations.
54 @param Address The base address of the I/O operations.
55 @param Count The number of I/O operations to perform.
56 @param Buffer For read operations, the destination buffer to store the results.
57 For write operations, the source buffer from which to write data.
59 @retval EFI_SUCCESS The data was read from or written to the device.
60 @retval EFI_UNSUPPORTED The Address is not valid for this system.
61 @retval EFI_INVALID_PARAMETER Width or Count, or both, were invalid.
62 @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.
67 (EFIAPI
*EFI_SMM_CPU_IO
)(
68 IN EFI_SMM_CPU_IO_INTERFACE
*This
,
69 IN EFI_SMM_IO_WIDTH Width
,
76 EFI_SMM_CPU_IO Read
; ///< This service provides the various modalities of memory and I/O read.
77 EFI_SMM_CPU_IO Write
; ///< This service provides the various modalities of memory and I/O write.
81 /// The EFI_SMM_CPU_IO_INTERFACE service provides the basic memory, I/O, and PCI
82 /// interfaces that are used to abstract accesses to devices.
84 struct _EFI_SMM_CPU_IO_INTERFACE
{
86 /// Allows reads and writes to memory-mapped I/O space.
88 EFI_SMM_IO_ACCESS Mem
;
90 /// Allows reads and writes to I/O space.
96 Allocates pool memory from SMRAM for IA-32 or runtime memory for
97 the Itanium processor family.
99 @param PoolType The type of pool to allocate.The only supported type is EfiRuntimeServicesData
100 @param Size The number of bytes to allocate from the pool.
101 @param Buffer A pointer to a pointer to the allocated buffer if the call
102 succeeds; undefined otherwise.
104 @retval EFI_SUCCESS The requested number of bytes was allocated.
105 @retval EFI_OUT_OF_RESOURCES The pool requested could not be allocated.
106 @retval EFI_UNSUPPORTED In runtime.
107 @note: Inconsistent with specification here:
108 In Framework Spec, This definition is naming EFI_SMM_ALLOCATE_POOL. However,
109 To avoid the naming conflict, the definition is renamed.
113 (EFIAPI
*EFI_SMMCORE_ALLOCATE_POOL
)(
114 IN EFI_MEMORY_TYPE PoolType
,
120 Returns pool memory to the system.
122 @param Buffer Pointer to the buffer to free.
124 @retval EFI_SUCCESS The memory was returned to the system.
125 @retval EFI_INVALID_PARAMETER Buffer was invalid.
126 @retval EFI_UNSUPPORTED In runtime.
127 @note: Inconsistent with specification here:
128 In Framework Spec, This definition is naming EFI_SMM_FREE_POOL However,
129 To avoid the naming conflict, the definition is renamed.
133 (EFIAPI
*EFI_SMMCORE_FREE_POOL
)(
138 Allocates memory pages from the system.
140 @param Type The type of allocation to perform.
141 @param MemoryType The only supported type is EfiRuntimeServicesData
142 @param NumberofPages The number of contiguous 4 KB pages to allocate
143 @param Memory Pointer to a physical address. On input, the way in which
144 the address is used depends on the value of Type. On output, the address
145 is set to the base of the page range that was allocated.
147 @retval EFI_SUCCESS The requested pages were allocated.
148 @retval EFI_OUT_OF_RESOURCES The pages requested could not be allocated.
149 @retval EFI_NOT_FOUND The requested pages could not be found.
150 @retval EFI_INVALID_PARAMETER Type is not AllocateAnyPages or AllocateMaxAddress
151 or AllocateAddress. Or MemoryType is in the range EfiMaxMemoryType..0x7FFFFFFF.
152 @note: Inconsistent with specification here:
153 In Framework Spec, This definition is naming EFI_SMM_ALLOCATE_PAGES However,
154 To avoid the naming conflict, the definition is renamed.
158 (EFIAPI
*EFI_SMMCORE_ALLOCATE_PAGES
)(
159 IN EFI_ALLOCATE_TYPE Type
,
160 IN EFI_MEMORY_TYPE MemoryType
,
161 IN UINTN NumberOfPages
,
162 OUT EFI_PHYSICAL_ADDRESS
*Memory
166 Frees memory pages for the system.
168 @param Memory The base physical address of the pages to be freed
169 @param NumberOfPages The number of contiguous 4 KB pages to free.
171 @retval EFI_SUCCESS The requested memory pages were freed.
172 @retval EFI_INVALID_PARAMETER Memory is not a page-aligned address or NumberOfPages is invalid.
173 @retval EFI_NOT_FOUND The requested memory pages were not allocated with SmmAllocatePages().
175 @note: Inconsistent with specification here:
176 In Framework Spec, This definition is naming EFI_SMM_FREE_PAGES However,
177 To avoid the naming conflict, the definition is renamed.
181 (EFIAPI
*EFI_SMMCORE_FREE_PAGES
)(
182 IN EFI_PHYSICAL_ADDRESS Memory
,
183 IN UINTN NumberOfPages
186 Frees memory pages for the system.
188 @param Procedure A pointer to the code stream to be run on the designated AP of the system.
189 @param CpuNumber The zero-based index of the processor number of the AP on which the code stream is
190 supposed to run. If the processor number points to the current processor or a disabled
191 processor, then it will not run the supplied code.
192 @param ProcArguments Allows the caller to pass a list of parameters to the code that is run by
193 the AP. It is an optional common mailbox between APs and the BSP to share information.
195 @retval EFI_SUCCESS The call was successful and the return parameters are valid.
196 @retval EFI_INVALID_PARAMETER The input arguments are out of range.
197 @retval EFI_INVALID_PARAMETER The CPU requested is not available on this SMI invocation.
198 @retval EFI_INVALID_PARAMETER The CPU cannot support an additional service invocation.
200 @note: Inconsistent with specification here:
201 In Framework Spec, No this definition. This method is introduced in PI1.0 spec for
202 implementation needed.
207 (EFIAPI
*EFI_SMM_STARTUP_THIS_AP
)(
208 IN EFI_AP_PROCEDURE Procedure
,
210 IN OUT VOID
*ProcArguments OPTIONAL
214 /// The processor save-state information for IA-32 processors. This information is important in that the
215 /// SMM drivers may need to ascertain the state of the processor before invoking the SMI.
219 /// Reserved for future processors. As such, software should not attempt to interpret or
220 /// write to this region.
222 UINT8 Reserved1
[248];
224 /// The location of the processor SMBASE, which is the location where the processor
225 /// will pass control upon receipt of an SMI.
229 /// The revision of the SMM save state. This value is set by the processor.
233 /// The value of the I/O restart field. Allows for restarting an in-process I/O instruction.
237 /// Describes behavior that should be commenced in response to a halt instruction.
239 UINT16 AutoHALTRestart
;
241 /// Reserved for future processors. As such, software should not attempt to interpret or
242 /// write to this region.
244 UINT8 Reserved2
[164];
247 // Registers in IA-32 processors.
271 } EFI_SMI_CPU_SAVE_STATE
;
274 /// The processor save-state information for the Itanium processor family. This information is
275 /// important in that the SMM drivers may need to ascertain the state of the processor before invoking
276 /// the PMI. This structure is mandatory and must be 512 byte aligned.
323 // application registers
384 UINT64 int_nat
; // nat bits for R1-R31
386 } EFI_PMI_SYSTEM_CONTEXT
;
389 /// The processor save-state information for IA-32 and Itanium processors. This information is
390 /// important in that the SMM drivers may need to ascertain the state of the processor before invoking
395 /// The processor save-state information for IA-32 processors.
397 EFI_SMI_CPU_SAVE_STATE Ia32SaveState
;
399 /// The processor save-state information for Itanium processors.
401 EFI_PMI_SYSTEM_CONTEXT ItaniumSaveState
;
402 } EFI_SMM_CPU_SAVE_STATE
;
405 /// The optional floating point save-state information for IA-32 processors. If the optional floating
406 /// point save is indicated for any handler, the following data structure must be preserved.
419 UINT8 St0Mm0
[10], Rsvd3
[6];
420 UINT8 St0Mm1
[10], Rsvd4
[6];
421 UINT8 St0Mm2
[10], Rsvd5
[6];
422 UINT8 St0Mm3
[10], Rsvd6
[6];
423 UINT8 St0Mm4
[10], Rsvd7
[6];
424 UINT8 St0Mm5
[10], Rsvd8
[6];
425 UINT8 St0Mm6
[10], Rsvd9
[6];
426 UINT8 St0Mm7
[10], Rsvd10
[6];
428 } EFI_SMI_OPTIONAL_FPSAVE_STATE
;
431 /// The optional floating point save-state information for the Itanium processor family. If the optional
432 /// floating point save is indicated for any handler, then this data structure must be preserved.
465 } EFI_PMI_OPTIONAL_FLOATING_POINT_CONTEXT
;
468 /// The processor save-state information for IA-32 and Itanium processors. If the optional floating
469 /// point save is indicated for any handler, then this data structure must be preserved.
473 /// The optional floating point save-state information for IA-32 processors.
475 EFI_SMI_OPTIONAL_FPSAVE_STATE Ia32FpSave
;
477 /// The optional floating point save-state information for Itanium processors.
479 EFI_PMI_OPTIONAL_FLOATING_POINT_CONTEXT ItaniumFpSave
;
480 } EFI_SMM_FLOATING_POINT_SAVE_STATE
;
483 This function is the main entry point for an SMM handler dispatch
484 or communicate-based callback.
486 @param SmmImageHandle A unique value returned by the SMM infrastructure
487 in response to registration for a communicate-based callback or dispatch.
488 @param CommunicationBuffer
489 An optional buffer that will be populated
490 by the SMM infrastructure in response to a non-SMM agent (preboot or runtime)
491 invoking the EFI_SMM_BASE_PROTOCOL.Communicate() service.
492 @param SourceSize If CommunicationBuffer is non-NULL, this field
493 indicates the size of the data payload in this buffer.
500 (EFIAPI
*EFI_SMM_HANDLER_ENTRY_POINT
)(
501 IN EFI_HANDLE SmmImageHandle
,
502 IN OUT VOID
*CommunicationBuffer OPTIONAL
,
503 IN OUT UINTN
*SourceSize OPTIONAL
507 The SmmInstallConfigurationTable() function is used to maintain the list
508 of configuration tables that are stored in the System Management System
509 Table. The list is stored as an array of (GUID, Pointer) pairs. The list
510 must be allocated from pool memory with PoolType set to EfiRuntimeServicesData.
512 @param SystemTable A pointer to the SMM System Table.
513 @param Guid A pointer to the GUID for the entry to add, update, or remove.
514 @param Table A pointer to the buffer of the table to add.
515 @param TableSize The size of the table to install.
517 @retval EFI_SUCCESS The (Guid, Table) pair was added, updated, or removed.
518 @retval EFI_INVALID_PARAMETER Guid is not valid.
519 @retval EFI_NOT_FOUND An attempt was made to delete a non-existent entry.
520 @retval EFI_OUT_OF_RESOURCES There is not enough memory available to complete the operation.
525 (EFIAPI
*EFI_SMM_INSTALL_CONFIGURATION_TABLE
)(
526 IN EFI_SMM_SYSTEM_TABLE
*SystemTable
,
533 // System Management System Table (SMST)
535 struct _EFI_SMM_SYSTEM_TABLE
{
537 /// The table header for the System Management System Table (SMST).
539 EFI_TABLE_HEADER Hdr
;
542 /// A pointer to a NULL-terminated Unicode string containing the vendor name. It is
543 /// permissible for this pointer to be NULL.
545 CHAR16
*SmmFirmwareVendor
;
547 /// The particular revision of the firmware.
549 UINT32 SmmFirmwareRevision
;
552 /// Adds, updates, or removes a configuration table entry from the SMST.
554 EFI_SMM_INSTALL_CONFIGURATION_TABLE SmmInstallConfigurationTable
;
560 /// A GUID that designates the particular CPU I/O services.
562 EFI_GUID EfiSmmCpuIoGuid
;
564 /// Provides the basic memory and I/O interfaces that are used to abstract accesses to
567 EFI_SMM_CPU_IO_INTERFACE SmmIo
;
570 // Runtime memory service
574 /// Allocates pool memory from SMRAM for IA-32 or runtime memory for the
575 /// Itanium processor family.
577 EFI_SMMCORE_ALLOCATE_POOL SmmAllocatePool
;
579 /// Returns pool memory to the system.
581 EFI_SMMCORE_FREE_POOL SmmFreePool
;
583 /// Allocates memory pages from the system.
585 EFI_SMMCORE_ALLOCATE_PAGES SmmAllocatePages
;
587 /// Frees memory pages for the system.
589 EFI_SMMCORE_FREE_PAGES SmmFreePages
;
595 ///Inconsistent with specification here:
596 /// In Framework Spec, No this definition. This method is introduced in PI1.0 spec for
597 /// implementation needed.
598 EFI_SMM_STARTUP_THIS_AP SmmStartupThisAp
;
601 // CPU information records
604 /// A 1-relative number between 1 and the NumberOfCpus field. This field designates
605 /// which processor is executing the SMM infrastructure. This number also serves as an
606 /// index into the CpuSaveState and CpuOptionalFloatingPointState
609 UINTN CurrentlyExecutingCpu
;
611 /// The number of EFI Configuration Tables in the buffer
612 /// SmmConfigurationTable.
616 /// A pointer to the EFI Configuration Tables. The number of entries in the table is
617 /// NumberOfTableEntries.
619 EFI_SMM_CPU_SAVE_STATE
*CpuSaveState
;
621 /// A pointer to a catenation of the EFI_SMM_FLOATING_POINT_SAVE_STATE.
622 /// The size of this entire table is NumberOfCpus* size of the
623 /// EFI_SMM_FLOATING_POINT_SAVE_STATE. These fields are populated only if
624 /// there is at least one SMM driver that has registered for a callback with the
625 /// FloatingPointSave field in EFI_SMM_BASE_PROTOCOL.RegisterCallback() set to TRUE.
627 EFI_SMM_FLOATING_POINT_SAVE_STATE
*CpuOptionalFloatingPointState
;
630 // Extensibility table
633 /// The number of EFI Configuration Tables in the buffer
634 /// SmmConfigurationTable.
636 UINTN NumberOfTableEntries
;
638 /// A pointer to the EFI Configuration Tables. The number of entries in the table is
639 /// NumberOfTableEntries.
641 EFI_CONFIGURATION_TABLE
*SmmConfigurationTable
;