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 - 2018, 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 /// Note: Inconsistency with the Framework SMM CIS spec - Itanium save state not included.
312 /// The processor save-state information for Itanium processors.
314 /// EFI_PMI_SYSTEM_CONTEXT ItaniumSaveState;
315 } EFI_SMM_CPU_SAVE_STATE
;
318 /// The optional floating point save-state information for IA-32 processors. If the optional floating
319 /// point save is indicated for any handler, the following data structure must be preserved.
332 UINT8 St0Mm0
[10], Rsvd3
[6];
333 UINT8 St0Mm1
[10], Rsvd4
[6];
334 UINT8 St0Mm2
[10], Rsvd5
[6];
335 UINT8 St0Mm3
[10], Rsvd6
[6];
336 UINT8 St0Mm4
[10], Rsvd7
[6];
337 UINT8 St0Mm5
[10], Rsvd8
[6];
338 UINT8 St0Mm6
[10], Rsvd9
[6];
339 UINT8 St0Mm7
[10], Rsvd10
[6];
341 } EFI_SMI_OPTIONAL_FPSAVE_STATE
;
344 /// The optional floating point save-state information for the Itanium processor family. If the optional
345 /// floating point save is indicated for any handler, then this data structure must be preserved.
378 } EFI_PMI_OPTIONAL_FLOATING_POINT_CONTEXT
;
381 /// The processor save-state information for IA-32 and Itanium processors. If the optional floating
382 /// point save is indicated for any handler, then this data structure must be preserved.
386 /// The optional floating point save-state information for IA-32 processors.
388 EFI_SMI_OPTIONAL_FPSAVE_STATE Ia32FpSave
;
390 /// The optional floating point save-state information for Itanium processors.
392 EFI_PMI_OPTIONAL_FLOATING_POINT_CONTEXT ItaniumFpSave
;
393 } EFI_SMM_FLOATING_POINT_SAVE_STATE
;
396 This function is the main entry point for an SMM handler dispatch
397 or communicate-based callback.
399 @param SmmImageHandle A unique value returned by the SMM infrastructure
400 in response to registration for a communicate-based callback or dispatch.
401 @param CommunicationBuffer
402 An optional buffer that will be populated
403 by the SMM infrastructure in response to a non-SMM agent (preboot or runtime)
404 invoking the EFI_SMM_BASE_PROTOCOL.Communicate() service.
405 @param SourceSize If CommunicationBuffer is non-NULL, this field
406 indicates the size of the data payload in this buffer.
413 (EFIAPI
*EFI_SMM_HANDLER_ENTRY_POINT
)(
414 IN EFI_HANDLE SmmImageHandle
,
415 IN OUT VOID
*CommunicationBuffer OPTIONAL
,
416 IN OUT UINTN
*SourceSize OPTIONAL
420 The SmmInstallConfigurationTable() function is used to maintain the list
421 of configuration tables that are stored in the System Management System
422 Table. The list is stored as an array of (GUID, Pointer) pairs. The list
423 must be allocated from pool memory with PoolType set to EfiRuntimeServicesData.
425 @param SystemTable A pointer to the SMM System Table.
426 @param Guid A pointer to the GUID for the entry to add, update, or remove.
427 @param Table A pointer to the buffer of the table to add.
428 @param TableSize The size of the table to install.
430 @retval EFI_SUCCESS The (Guid, Table) pair was added, updated, or removed.
431 @retval EFI_INVALID_PARAMETER Guid is not valid.
432 @retval EFI_NOT_FOUND An attempt was made to delete a non-existent entry.
433 @retval EFI_OUT_OF_RESOURCES There is not enough memory available to complete the operation.
438 (EFIAPI
*EFI_SMM_INSTALL_CONFIGURATION_TABLE
)(
439 IN EFI_SMM_SYSTEM_TABLE
*SystemTable
,
446 // System Management System Table (SMST)
448 struct _EFI_SMM_SYSTEM_TABLE
{
450 /// The table header for the System Management System Table (SMST).
452 EFI_TABLE_HEADER Hdr
;
455 /// A pointer to a NULL-terminated Unicode string containing the vendor name. It is
456 /// permissible for this pointer to be NULL.
458 CHAR16
*SmmFirmwareVendor
;
460 /// The particular revision of the firmware.
462 UINT32 SmmFirmwareRevision
;
465 /// Adds, updates, or removes a configuration table entry from the SMST.
467 EFI_SMM_INSTALL_CONFIGURATION_TABLE SmmInstallConfigurationTable
;
473 /// A GUID that designates the particular CPU I/O services.
475 EFI_GUID EfiSmmCpuIoGuid
;
477 /// Provides the basic memory and I/O interfaces that are used to abstract accesses to
480 EFI_SMM_CPU_IO_INTERFACE SmmIo
;
483 // Runtime memory service
487 /// Allocates pool memory from SMRAM for IA-32 or runtime memory for the
488 /// Itanium processor family.
490 EFI_SMMCORE_ALLOCATE_POOL SmmAllocatePool
;
492 /// Returns pool memory to the system.
494 EFI_SMMCORE_FREE_POOL SmmFreePool
;
496 /// Allocates memory pages from the system.
498 EFI_SMMCORE_ALLOCATE_PAGES SmmAllocatePages
;
500 /// Frees memory pages for the system.
502 EFI_SMMCORE_FREE_PAGES SmmFreePages
;
508 /// Inconsistent with specification here:
509 /// In Framework Spec, this definition does not exist. This method is introduced in PI1.1 specification for
510 /// the implementation needed.
511 EFI_SMM_STARTUP_THIS_AP SmmStartupThisAp
;
514 // CPU information records
517 /// A 1-relative number between 1 and the NumberOfCpus field. This field designates
518 /// which processor is executing the SMM infrastructure. This number also serves as an
519 /// index into the CpuSaveState and CpuOptionalFloatingPointState
522 UINTN CurrentlyExecutingCpu
;
524 /// The number of EFI Configuration Tables in the buffer
525 /// SmmConfigurationTable.
529 /// A pointer to the EFI Configuration Tables. The number of entries in the table is
530 /// NumberOfTableEntries.
532 EFI_SMM_CPU_SAVE_STATE
*CpuSaveState
;
534 /// A pointer to a catenation of the EFI_SMM_FLOATING_POINT_SAVE_STATE.
535 /// The size of this entire table is NumberOfCpus* size of the
536 /// EFI_SMM_FLOATING_POINT_SAVE_STATE. These fields are populated only if
537 /// there is at least one SMM driver that has registered for a callback with the
538 /// FloatingPointSave field in EFI_SMM_BASE_PROTOCOL.RegisterCallback() set to TRUE.
540 EFI_SMM_FLOATING_POINT_SAVE_STATE
*CpuOptionalFloatingPointState
;
543 // Extensibility table
546 /// The number of EFI Configuration Tables in the buffer
547 /// SmmConfigurationTable.
549 UINTN NumberOfTableEntries
;
551 /// A pointer to the EFI Configuration Tables. The number of entries in the table is
552 /// NumberOfTableEntries.
554 EFI_CONFIGURATION_TABLE
*SmmConfigurationTable
;