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 - 2010, 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.
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 is EfiRuntimeServicesData
37 @param Size The number of bytes to allocate from the pool.
38 @param Buffer A pointer to a pointer to the allocated buffer if the call
39 succeeds; undefined otherwise.
41 @retval EFI_SUCCESS The requested number of bytes was allocated.
42 @retval EFI_OUT_OF_RESOURCES The pool requested could not be allocated.
43 @retval EFI_UNSUPPORTED In runtime.
44 @note Inconsistent with specification here:
45 In Framework Spec, this definition is named EFI_SMM_ALLOCATE_POOL.
46 To avoid a naming conflict, the definition is renamed.
50 (EFIAPI
*EFI_SMMCORE_ALLOCATE_POOL
)(
51 IN EFI_MEMORY_TYPE PoolType
,
57 Returns pool memory to the system.
59 @param Buffer Pointer to the buffer to free.
61 @retval EFI_SUCCESS The memory was returned to the system.
62 @retval EFI_INVALID_PARAMETER Buffer was invalid.
63 @retval EFI_UNSUPPORTED In runtime.
64 @note Inconsistent with specification here:
65 In Framework Spec, this definition is named EFI_SMM_FREE_POOL.
66 To avoid a naming conflict, the definition is renamed.
70 (EFIAPI
*EFI_SMMCORE_FREE_POOL
)(
75 Allocates memory pages from the system.
77 @param Type The type of allocation to perform.
78 @param MemoryType The only supported type is EfiRuntimeServicesData
79 @param NumberofPages The number of contiguous 4 KB pages to allocate
80 @param Memory Pointer to a physical address. On input, the way in which
81 the address is used depends on the value of Type. On output, the address
82 is set to the base of the page range that was allocated.
84 @retval EFI_SUCCESS The requested pages were allocated.
85 @retval EFI_OUT_OF_RESOURCES The pages requested could not be allocated.
86 @retval EFI_NOT_FOUND The requested pages could not be found.
87 @retval EFI_INVALID_PARAMETER Type is not AllocateAnyPages or AllocateMaxAddress
88 or AllocateAddress. Or MemoryType is in the range EfiMaxMemoryType..0x7FFFFFFF.
89 @note Inconsistent with specification here:
90 In the Framework Spec, this definition is named EFI_SMM_ALLOCATE_PAGES.
91 To avoid a naming conflict, the definition here is renamed.
95 (EFIAPI
*EFI_SMMCORE_ALLOCATE_PAGES
)(
96 IN EFI_ALLOCATE_TYPE Type
,
97 IN EFI_MEMORY_TYPE MemoryType
,
98 IN UINTN NumberOfPages
,
99 OUT EFI_PHYSICAL_ADDRESS
*Memory
103 Frees memory pages for the system.
105 @param Memory The base physical address of the pages to be freed
106 @param NumberOfPages The number of contiguous 4 KB pages to free.
108 @retval EFI_SUCCESS The requested memory pages were freed.
109 @retval EFI_INVALID_PARAMETER Memory is not a page-aligned address or NumberOfPages is invalid.
110 @retval EFI_NOT_FOUND The requested memory pages were not allocated with SmmAllocatePages().
112 @note Inconsistent with specification here:
113 In the Framework Spec, this definition is named EFI_SMM_FREE_PAGES.
114 To avoid a naming conflict, the definition here is renamed.
118 (EFIAPI
*EFI_SMMCORE_FREE_PAGES
)(
119 IN EFI_PHYSICAL_ADDRESS Memory
,
120 IN UINTN NumberOfPages
124 /// The processor save-state information for IA-32 processors. This information is important in that the
125 /// SMM drivers may need to ascertain the state of the processor before invoking the SMI.
129 /// Reserved for future processors. As such, software should not attempt to interpret or
130 /// write to this region.
132 UINT8 Reserved1
[248];
134 /// The location of the processor SMBASE, which is the location where the processor
135 /// will pass control upon receipt of an SMI.
139 /// The revision of the SMM save state. This value is set by the processor.
143 /// The value of the I/O restart field. Allows for restarting an in-process I/O instruction.
147 /// Describes behavior that should be commenced in response to a halt instruction.
149 UINT16 AutoHALTRestart
;
151 /// Reserved for future processors. As such, software should not attempt to interpret or
152 /// write to this region.
154 UINT8 Reserved2
[164];
157 // Registers in IA-32 processors.
181 } EFI_SMI_CPU_SAVE_STATE
;
184 /// The processor save-state information for the Itanium processor family. This information is
185 /// important in that the SMM drivers may need to ascertain the state of the processor before invoking
186 /// the PMI. This structure is mandatory and must be 512 byte aligned.
233 // application registers
294 UINT64 int_nat
; // nat bits for R1-R31
296 } EFI_PMI_SYSTEM_CONTEXT
;
299 /// The processor save-state information for IA-32 and Itanium processors. This information is
300 /// important in that the SMM drivers may need to ascertain the state of the processor before invoking
305 /// The processor save-state information for IA-32 processors.
307 EFI_SMI_CPU_SAVE_STATE Ia32SaveState
;
309 /// The processor save-state information for Itanium processors.
311 EFI_PMI_SYSTEM_CONTEXT ItaniumSaveState
;
312 } EFI_SMM_CPU_SAVE_STATE
;
315 /// The optional floating point save-state information for IA-32 processors. If the optional floating
316 /// point save is indicated for any handler, the following data structure must be preserved.
329 UINT8 St0Mm0
[10], Rsvd3
[6];
330 UINT8 St0Mm1
[10], Rsvd4
[6];
331 UINT8 St0Mm2
[10], Rsvd5
[6];
332 UINT8 St0Mm3
[10], Rsvd6
[6];
333 UINT8 St0Mm4
[10], Rsvd7
[6];
334 UINT8 St0Mm5
[10], Rsvd8
[6];
335 UINT8 St0Mm6
[10], Rsvd9
[6];
336 UINT8 St0Mm7
[10], Rsvd10
[6];
338 } EFI_SMI_OPTIONAL_FPSAVE_STATE
;
341 /// The optional floating point save-state information for the Itanium processor family. If the optional
342 /// floating point save is indicated for any handler, then this data structure must be preserved.
375 } EFI_PMI_OPTIONAL_FLOATING_POINT_CONTEXT
;
378 /// The processor save-state information for IA-32 and Itanium processors. If the optional floating
379 /// point save is indicated for any handler, then this data structure must be preserved.
383 /// The optional floating point save-state information for IA-32 processors.
385 EFI_SMI_OPTIONAL_FPSAVE_STATE Ia32FpSave
;
387 /// The optional floating point save-state information for Itanium processors.
389 EFI_PMI_OPTIONAL_FLOATING_POINT_CONTEXT ItaniumFpSave
;
390 } EFI_SMM_FLOATING_POINT_SAVE_STATE
;
393 This function is the main entry point for an SMM handler dispatch
394 or communicate-based callback.
396 @param SmmImageHandle A unique value returned by the SMM infrastructure
397 in response to registration for a communicate-based callback or dispatch.
398 @param CommunicationBuffer
399 An optional buffer that will be populated
400 by the SMM infrastructure in response to a non-SMM agent (preboot or runtime)
401 invoking the EFI_SMM_BASE_PROTOCOL.Communicate() service.
402 @param SourceSize If CommunicationBuffer is non-NULL, this field
403 indicates the size of the data payload in this buffer.
410 (EFIAPI
*EFI_SMM_HANDLER_ENTRY_POINT
)(
411 IN EFI_HANDLE SmmImageHandle
,
412 IN OUT VOID
*CommunicationBuffer OPTIONAL
,
413 IN OUT UINTN
*SourceSize OPTIONAL
417 The SmmInstallConfigurationTable() function is used to maintain the list
418 of configuration tables that are stored in the System Management System
419 Table. The list is stored as an array of (GUID, Pointer) pairs. The list
420 must be allocated from pool memory with PoolType set to EfiRuntimeServicesData.
422 @param SystemTable A pointer to the SMM System Table.
423 @param Guid A pointer to the GUID for the entry to add, update, or remove.
424 @param Table A pointer to the buffer of the table to add.
425 @param TableSize The size of the table to install.
427 @retval EFI_SUCCESS The (Guid, Table) pair was added, updated, or removed.
428 @retval EFI_INVALID_PARAMETER Guid is not valid.
429 @retval EFI_NOT_FOUND An attempt was made to delete a non-existent entry.
430 @retval EFI_OUT_OF_RESOURCES There is not enough memory available to complete the operation.
435 (EFIAPI
*EFI_SMM_INSTALL_CONFIGURATION_TABLE
)(
436 IN EFI_SMM_SYSTEM_TABLE
*SystemTable
,
443 // System Management System Table (SMST)
445 struct _EFI_SMM_SYSTEM_TABLE
{
447 /// The table header for the System Management System Table (SMST).
449 EFI_TABLE_HEADER Hdr
;
452 /// A pointer to a NULL-terminated Unicode string containing the vendor name. It is
453 /// permissible for this pointer to be NULL.
455 CHAR16
*SmmFirmwareVendor
;
457 /// The particular revision of the firmware.
459 UINT32 SmmFirmwareRevision
;
462 /// Adds, updates, or removes a configuration table entry from the SMST.
464 EFI_SMM_INSTALL_CONFIGURATION_TABLE SmmInstallConfigurationTable
;
470 /// A GUID that designates the particular CPU I/O services.
472 EFI_GUID EfiSmmCpuIoGuid
;
474 /// Provides the basic memory and I/O interfaces that are used to abstract accesses to
477 EFI_SMM_CPU_IO_INTERFACE SmmIo
;
480 // Runtime memory service
484 /// Allocates pool memory from SMRAM for IA-32 or runtime memory for the
485 /// Itanium processor family.
487 EFI_SMMCORE_ALLOCATE_POOL SmmAllocatePool
;
489 /// Returns pool memory to the system.
491 EFI_SMMCORE_FREE_POOL SmmFreePool
;
493 /// Allocates memory pages from the system.
495 EFI_SMMCORE_ALLOCATE_PAGES SmmAllocatePages
;
497 /// Frees memory pages for the system.
499 EFI_SMMCORE_FREE_PAGES SmmFreePages
;
505 ///Inconsistent with specification here:
506 /// In Framework Spec, this definition does not exist. This method is introduced in PI1.1 spec for
507 /// implementation needed.
508 EFI_SMM_STARTUP_THIS_AP SmmStartupThisAp
;
511 // CPU information records
514 /// A 1-relative number between 1 and the NumberOfCpus field. This field designates
515 /// which processor is executing the SMM infrastructure. This number also serves as an
516 /// index into the CpuSaveState and CpuOptionalFloatingPointState
519 UINTN CurrentlyExecutingCpu
;
521 /// The number of EFI Configuration Tables in the buffer
522 /// SmmConfigurationTable.
526 /// A pointer to the EFI Configuration Tables. The number of entries in the table is
527 /// NumberOfTableEntries.
529 EFI_SMM_CPU_SAVE_STATE
*CpuSaveState
;
531 /// A pointer to a catenation of the EFI_SMM_FLOATING_POINT_SAVE_STATE.
532 /// The size of this entire table is NumberOfCpus* size of the
533 /// EFI_SMM_FLOATING_POINT_SAVE_STATE. These fields are populated only if
534 /// there is at least one SMM driver that has registered for a callback with the
535 /// FloatingPointSave field in EFI_SMM_BASE_PROTOCOL.RegisterCallback() set to TRUE.
537 EFI_SMM_FLOATING_POINT_SAVE_STATE
*CpuOptionalFloatingPointState
;
540 // Extensibility table
543 /// The number of EFI Configuration Tables in the buffer
544 /// SmmConfigurationTable.
546 UINTN NumberOfTableEntries
;
548 /// A pointer to the EFI Configuration Tables. The number of entries in the table is
549 /// NumberOfTableEntries.
551 EFI_CONFIGURATION_TABLE
*SmmConfigurationTable
;