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 SPDX-License-Identifier: BSD-2-Clause-Patent
14 // Share some common definitions with PI SMM
16 #include <Pi/PiSmmCis.h>
17 #include <Protocol/SmmCpuIo.h>
19 typedef struct _EFI_SMM_SYSTEM_TABLE EFI_SMM_SYSTEM_TABLE
;
22 // SMM Base specification constant and types
24 #define EFI_SMM_SYSTEM_TABLE_REVISION (0 << 16) | (0x09)
27 Allocates pool memory from SMRAM for IA-32, or runtime memory for
28 the Itanium processor family.
30 @param PoolType The type of pool to allocate. The only supported type
31 is EfiRuntimeServicesData.
32 @param Size The number of bytes to allocate from the pool.
33 @param Buffer A pointer to a pointer to the allocated buffer if the
34 call succeeds. Otherwise, undefined.
36 @retval EFI_SUCCESS The requested number of bytes was allocated.
37 @retval EFI_OUT_OF_RESOURCES The pool requested could not be allocated.
38 @retval EFI_UNSUPPORTED In runtime.
39 @note Inconsistent with specification here:
40 In Framework Spec, this definition is named EFI_SMM_ALLOCATE_POOL.
41 To avoid a naming conflict, the definition is renamed.
45 (EFIAPI
*EFI_SMMCORE_ALLOCATE_POOL
)(
46 IN EFI_MEMORY_TYPE PoolType
,
52 Returns pool memory to the system.
54 @param Buffer The pointer to the buffer to free.
56 @retval EFI_SUCCESS The memory was returned to the system.
57 @retval EFI_INVALID_PARAMETER Buffer was invalid.
58 @retval EFI_UNSUPPORTED In runtime.
59 @note Inconsistent with specification here:
60 In Framework Spec, this definition is named EFI_SMM_FREE_POOL.
61 To avoid a naming conflict, the definition is renamed.
65 (EFIAPI
*EFI_SMMCORE_FREE_POOL
)(
70 Allocates memory pages from the system.
72 @param Type The type of allocation to perform.
73 @param MemoryType The only supported type is EfiRuntimeServicesData.
74 @param NumberofPages The number of contiguous 4 KB pages to allocate.
75 @param Memory Pointer to a physical address. On input, the way in which
76 the address is used depends on the value of Type. On output, the address
77 is set to the base of the page range that was allocated.
79 @retval EFI_SUCCESS The requested pages were allocated.
80 @retval EFI_OUT_OF_RESOURCES The pages requested could not be allocated.
81 @retval EFI_NOT_FOUND The requested pages could not be found.
82 @retval EFI_INVALID_PARAMETER Type is not AllocateAnyPages or AllocateMaxAddress
83 or AllocateAddress. Or, MemoryType is in the range EfiMaxMemoryType..0x7FFFFFFF.
84 @note Inconsistent with specification here:
85 In the Framework Spec, this definition is named EFI_SMM_ALLOCATE_PAGES.
86 To avoid a naming conflict, the definition here is renamed.
90 (EFIAPI
*EFI_SMMCORE_ALLOCATE_PAGES
)(
91 IN EFI_ALLOCATE_TYPE Type
,
92 IN EFI_MEMORY_TYPE MemoryType
,
93 IN UINTN NumberOfPages
,
94 OUT EFI_PHYSICAL_ADDRESS
*Memory
98 Frees memory pages for the system.
100 @param Memory The base physical address of the pages to be freed.
101 @param NumberOfPages The number of contiguous 4 KB pages to free.
103 @retval EFI_SUCCESS The requested memory pages were freed.
104 @retval EFI_INVALID_PARAMETER Memory is not a page-aligned address or NumberOfPages is invalid.
105 @retval EFI_NOT_FOUND The requested memory pages were not allocated with SmmAllocatePages().
107 @note Inconsistent with specification here:
108 In the Framework Spec, this definition is named EFI_SMM_FREE_PAGES.
109 To avoid a naming conflict, the definition here is renamed.
113 (EFIAPI
*EFI_SMMCORE_FREE_PAGES
)(
114 IN EFI_PHYSICAL_ADDRESS Memory
,
115 IN UINTN NumberOfPages
119 /// The processor save-state information for IA-32 processors. This information is important in that the
120 /// SMM drivers may need to ascertain the state of the processor before invoking the SMI.
124 /// Reserved for future processors. As such, software should not attempt to interpret or
125 /// write to this region.
127 UINT8 Reserved1
[248];
129 /// The location of the processor SMBASE, which is the location where the processor
130 /// will pass control upon receipt of an SMI.
134 /// The revision of the SMM save state. This value is set by the processor.
138 /// The value of the I/O restart field. Allows for restarting an in-process I/O instruction.
142 /// Describes behavior that should be commenced in response to a halt instruction.
144 UINT16 AutoHALTRestart
;
146 /// Reserved for future processors. As such, software should not attempt to interpret or
147 /// write to this region.
149 UINT8 Reserved2
[164];
152 // Registers in IA-32 processors.
176 } EFI_SMI_CPU_SAVE_STATE
;
179 /// The processor save-state information for the Itanium processor family. This information is
180 /// important in that the SMM drivers may need to ascertain the state of the processor before invoking
181 /// the PMI. This structure is mandatory and must be 512 byte aligned.
228 // application registers
289 UINT64 int_nat
; // nat bits for R1-R31
291 } EFI_PMI_SYSTEM_CONTEXT
;
294 /// The processor save-state information for IA-32 and Itanium processors. This information is
295 /// important in that the SMM drivers may need to ascertain the state of the processor before invoking
300 /// The processor save-state information for IA-32 processors.
302 EFI_SMI_CPU_SAVE_STATE Ia32SaveState
;
304 /// Note: Inconsistency with the Framework SMM CIS spec - Itanium save state not included.
306 /// The processor save-state information for Itanium processors.
308 /// EFI_PMI_SYSTEM_CONTEXT ItaniumSaveState;
309 } EFI_SMM_CPU_SAVE_STATE
;
312 /// The optional floating point save-state information for IA-32 processors. If the optional floating
313 /// point save is indicated for any handler, the following data structure must be preserved.
326 UINT8 St0Mm0
[10], Rsvd3
[6];
327 UINT8 St0Mm1
[10], Rsvd4
[6];
328 UINT8 St0Mm2
[10], Rsvd5
[6];
329 UINT8 St0Mm3
[10], Rsvd6
[6];
330 UINT8 St0Mm4
[10], Rsvd7
[6];
331 UINT8 St0Mm5
[10], Rsvd8
[6];
332 UINT8 St0Mm6
[10], Rsvd9
[6];
333 UINT8 St0Mm7
[10], Rsvd10
[6];
335 } EFI_SMI_OPTIONAL_FPSAVE_STATE
;
338 /// The optional floating point save-state information for the Itanium processor family. If the optional
339 /// floating point save is indicated for any handler, then this data structure must be preserved.
372 } EFI_PMI_OPTIONAL_FLOATING_POINT_CONTEXT
;
375 /// The processor save-state information for IA-32 and Itanium processors. If the optional floating
376 /// point save is indicated for any handler, then this data structure must be preserved.
380 /// The optional floating point save-state information for IA-32 processors.
382 EFI_SMI_OPTIONAL_FPSAVE_STATE Ia32FpSave
;
384 /// The optional floating point save-state information for Itanium processors.
386 EFI_PMI_OPTIONAL_FLOATING_POINT_CONTEXT ItaniumFpSave
;
387 } EFI_SMM_FLOATING_POINT_SAVE_STATE
;
390 This function is the main entry point for an SMM handler dispatch
391 or communicate-based callback.
393 @param SmmImageHandle A unique value returned by the SMM infrastructure
394 in response to registration for a communicate-based callback or dispatch.
395 @param CommunicationBuffer
396 An optional buffer that will be populated
397 by the SMM infrastructure in response to a non-SMM agent (preboot or runtime)
398 invoking the EFI_SMM_BASE_PROTOCOL.Communicate() service.
399 @param SourceSize If CommunicationBuffer is non-NULL, this field
400 indicates the size of the data payload in this buffer.
407 (EFIAPI
*EFI_SMM_HANDLER_ENTRY_POINT
)(
408 IN EFI_HANDLE SmmImageHandle
,
409 IN OUT VOID
*CommunicationBuffer OPTIONAL
,
410 IN OUT UINTN
*SourceSize OPTIONAL
414 The SmmInstallConfigurationTable() function is used to maintain the list
415 of configuration tables that are stored in the System Management System
416 Table. The list is stored as an array of (GUID, Pointer) pairs. The list
417 must be allocated from pool memory with PoolType set to EfiRuntimeServicesData.
419 @param SystemTable A pointer to the SMM System Table.
420 @param Guid A pointer to the GUID for the entry to add, update, or remove.
421 @param Table A pointer to the buffer of the table to add.
422 @param TableSize The size of the table to install.
424 @retval EFI_SUCCESS The (Guid, Table) pair was added, updated, or removed.
425 @retval EFI_INVALID_PARAMETER Guid is not valid.
426 @retval EFI_NOT_FOUND An attempt was made to delete a non-existent entry.
427 @retval EFI_OUT_OF_RESOURCES There is not enough memory available to complete the operation.
432 (EFIAPI
*EFI_SMM_INSTALL_CONFIGURATION_TABLE
)(
433 IN EFI_SMM_SYSTEM_TABLE
*SystemTable
,
440 // System Management System Table (SMST)
442 struct _EFI_SMM_SYSTEM_TABLE
{
444 /// The table header for the System Management System Table (SMST).
446 EFI_TABLE_HEADER Hdr
;
449 /// A pointer to a NULL-terminated Unicode string containing the vendor name. It is
450 /// permissible for this pointer to be NULL.
452 CHAR16
*SmmFirmwareVendor
;
454 /// The particular revision of the firmware.
456 UINT32 SmmFirmwareRevision
;
459 /// Adds, updates, or removes a configuration table entry from the SMST.
461 EFI_SMM_INSTALL_CONFIGURATION_TABLE SmmInstallConfigurationTable
;
467 /// A GUID that designates the particular CPU I/O services.
469 EFI_GUID EfiSmmCpuIoGuid
;
471 /// Provides the basic memory and I/O interfaces that are used to abstract accesses to
474 EFI_SMM_CPU_IO_INTERFACE SmmIo
;
477 // Runtime memory service
481 /// Allocates pool memory from SMRAM for IA-32 or runtime memory for the
482 /// Itanium processor family.
484 EFI_SMMCORE_ALLOCATE_POOL SmmAllocatePool
;
486 /// Returns pool memory to the system.
488 EFI_SMMCORE_FREE_POOL SmmFreePool
;
490 /// Allocates memory pages from the system.
492 EFI_SMMCORE_ALLOCATE_PAGES SmmAllocatePages
;
494 /// Frees memory pages for the system.
496 EFI_SMMCORE_FREE_PAGES SmmFreePages
;
502 /// Inconsistent with specification here:
503 /// In Framework Spec, this definition does not exist. This method is introduced in PI1.1 specification for
504 /// the implementation needed.
505 EFI_SMM_STARTUP_THIS_AP SmmStartupThisAp
;
508 // CPU information records
511 /// A 1-relative number between 1 and the NumberOfCpus field. This field designates
512 /// which processor is executing the SMM infrastructure. This number also serves as an
513 /// index into the CpuSaveState and CpuOptionalFloatingPointState
516 UINTN CurrentlyExecutingCpu
;
518 /// The number of EFI Configuration Tables in the buffer
519 /// SmmConfigurationTable.
523 /// A pointer to the EFI Configuration Tables. The number of entries in the table is
524 /// NumberOfTableEntries.
526 EFI_SMM_CPU_SAVE_STATE
*CpuSaveState
;
528 /// A pointer to a catenation of the EFI_SMM_FLOATING_POINT_SAVE_STATE.
529 /// The size of this entire table is NumberOfCpus* size of the
530 /// EFI_SMM_FLOATING_POINT_SAVE_STATE. These fields are populated only if
531 /// there is at least one SMM driver that has registered for a callback with the
532 /// FloatingPointSave field in EFI_SMM_BASE_PROTOCOL.RegisterCallback() set to TRUE.
534 EFI_SMM_FLOATING_POINT_SAVE_STATE
*CpuOptionalFloatingPointState
;
537 // Extensibility table
540 /// The number of EFI Configuration Tables in the buffer
541 /// SmmConfigurationTable.
543 UINTN NumberOfTableEntries
;
545 /// A pointer to the EFI Configuration Tables. The number of entries in the table is
546 /// NumberOfTableEntries.
548 EFI_CONFIGURATION_TABLE
*SmmConfigurationTable
;