2 Include file matches things in the Smm CIS spec.
4 Copyright (c) 2006, Intel Corporation
5 All rights reserved. This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
15 @par Revision Reference:
23 #define EFI_SMM_CPU_IO_GUID \
25 0x5f439a0b, 0x45d8, 0x4682, {0xa4, 0xf4, 0xf0, 0x57, 0x6b, 0x51, 0x34, 0x41 } \
28 typedef struct _EFI_SMM_SYSTEM_TABLE EFI_SMM_SYSTEM_TABLE
;
29 typedef struct _EFI_SMM_CPU_IO_INTERFACE EFI_SMM_CPU_IO_INTERFACE
;
33 // SMM Base specification constant and types
35 #define SMM_SMST_SIGNATURE EFI_SIGNATURE_32 ('S', 'M', 'S', 'T')
36 #define EFI_SMM_SYSTEM_TABLE_REVISION (0 << 16) | (0x09)
39 // *******************************************************
41 // *******************************************************
51 Provides the basic memory and I/O interfaces that are used to
52 abstract accesses to devices.
54 @param This The EFI_SMM_CPU_IO_INTERFACE instance.
56 @param Width Signifies the width of the I/O operations.
58 @param Address The base address of the I/O operations.
60 @param Count The number of I/O operations to perform.
62 @param Buffer For read operations, the destination buffer to store the results.
63 For write operations, the source buffer from which to write data.
65 @retval EFI_SUCCESS The data was read from or written to the device.
67 @retval EFI_UNSUPPORTED The Address is not valid for this system.
69 @retval EFI_INVALID_PARAMETER Width or Count, or both, were invalid.
71 @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.
76 (EFIAPI
*EFI_SMM_CPU_IO
) (
77 IN EFI_SMM_CPU_IO_INTERFACE
*This
,
78 IN EFI_SMM_IO_WIDTH Width
,
89 struct _EFI_SMM_CPU_IO_INTERFACE
{
90 EFI_SMM_IO_ACCESS Mem
;
95 Allocates pool memory from SMRAM for IA-32 or runtime memory for
96 the Itanium processor family.
98 @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.
102 @param Buffer A pointer to a pointer to the allocated buffer if the call
103 succeeds; undefined otherwise.
105 @retval EFI_SUCCESS The requested number of bytes was allocated.
107 @retval EFI_OUT_OF_RESOURCES The pool requested could not be allocated.
109 @retval EFI_UNSUPPORTED In runtime.
114 (EFIAPI
*EFI_SMMCORE_ALLOCATE_POOL
) (
115 IN EFI_MEMORY_TYPE PoolType
,
121 Returns pool memory to the system.
123 @param Buffer Pointer to the buffer to free.
125 @retval EFI_SUCCESS The memory was returned to the system.
127 @retval EFI_INVALID_PARAMETER Buffer was invalid.
129 @retval EFI_UNSUPPORTED In runtime.
134 (EFIAPI
*EFI_SMMCORE_FREE_POOL
) (
139 Allocates memory pages from the system.
141 @param Type The type of allocation to perform.
143 @param MemoryType The only supported type is EfiRuntimeServicesData
145 @param NumberofPages The number of contiguous 4 KB pages to allocate
147 @param Memory Pointer to a physical address. On input, the way in which
148 the address is used depends on the value of Type. On output, the address
149 is set to the base of the page range that was allocated.
151 @retval EFI_SUCCESS The requested pages were allocated.
153 @retval EFI_OUT_OF_RESOURCES The pages requested could not be allocated.
155 @retval EFI_NOT_FOUND The requested pages could not be found.
157 @retval EFI_INVALID_PARAMETER Type is not AllocateAnyPages or AllocateMaxAddress
158 or AllocateAddress. Or MemoryType is in the range EfiMaxMemoryType..0x7FFFFFFF.
163 (EFIAPI
*EFI_SMMCORE_ALLOCATE_PAGES
) (
164 IN EFI_ALLOCATE_TYPE Type
,
165 IN EFI_MEMORY_TYPE MemoryType
,
166 IN UINTN NumberOfPages
,
167 OUT EFI_PHYSICAL_ADDRESS
*Memory
171 Frees memory pages for the system.
173 @param Memory The base physical address of the pages to be freed
175 @param NumberOfPages The number of contiguous 4 KB pages to free.
177 @retval EFI_SUCCESS The requested memory pages were freed.
179 @retval EFI_INVALID_PARAMETER Memory is not a page-aligned address or NumberOfPages is invalid.
181 @retval EFI_NOT_FOUND The requested memory pages were not allocated with SmmAllocatePages().
186 (EFIAPI
*EFI_SMMCORE_FREE_PAGES
) (
187 IN EFI_PHYSICAL_ADDRESS Memory
,
188 IN UINTN NumberOfPages
193 (EFIAPI
*EFI_AP_PROCEDURE
) (
199 (EFIAPI
*EFI_SMM_STARTUP_THIS_AP
) (
200 IN EFI_AP_PROCEDURE Procedure
,
202 IN OUT VOID
*ProcArguments OPTIONAL
206 UINT8 Reserved1
[248];
210 UINT16 AutoHALTRestart
;
211 UINT8 Reserved2
[164];
234 } EFI_SMI_CPU_SAVE_STATE
;
281 // application registers
342 UINT64 int_nat
; // nat bits for R1-R31
344 } EFI_PMI_SYSTEM_CONTEXT
;
347 EFI_SMI_CPU_SAVE_STATE Ia32SaveState
;
348 EFI_PMI_SYSTEM_CONTEXT ItaniumSaveState
;
349 } EFI_SMM_CPU_SAVE_STATE
;
362 UINT8 St0Mm0
[10], Rsvd3
[6];
363 UINT8 St0Mm1
[10], Rsvd4
[6];
364 UINT8 St0Mm2
[10], Rsvd5
[6];
365 UINT8 St0Mm3
[10], Rsvd6
[6];
366 UINT8 St0Mm4
[10], Rsvd7
[6];
367 UINT8 St0Mm5
[10], Rsvd8
[6];
368 UINT8 St0Mm6
[10], Rsvd9
[6];
369 UINT8 St0Mm7
[10], Rsvd10
[6];
371 } EFI_SMI_OPTIONAL_FPSAVE_STATE
;
404 } EFI_PMI_OPTIONAL_FLOATING_POINT_CONTEXT
;
407 EFI_SMI_OPTIONAL_FPSAVE_STATE Ia32FpSave
;
408 EFI_PMI_OPTIONAL_FLOATING_POINT_CONTEXT ItaniumFpSave
;
409 } EFI_SMM_FLOATING_POINT_SAVE_STATE
;
412 This function is the main entry point for an SMM handler dispatch
413 or communicate-based callback.
415 @param SmmImageHandle A unique value returned by the SMM infrastructure
416 in response to registration for a communicate-based callback or dispatch.
418 @param CommunicationBuffer An optional buffer that will be populated
419 by the SMM infrastructure in response to a non-SMM agent (preboot or runtime)
420 invoking the EFI_SMM_BASE_PROTOCOL.Communicate() service.
422 @param SourceSize If CommunicationBuffer is non-NULL, this field
423 indicates the size of the data payload in this buffer.
430 (EFIAPI
*EFI_SMM_HANDLER_ENTRY_POINT
) (
431 IN EFI_HANDLE SmmImageHandle
,
432 IN OUT VOID
*CommunicationBuffer OPTIONAL
,
433 IN OUT UINTN
*SourceSize OPTIONAL
437 The SmmInstallConfigurationTable() function is used to maintain the list
438 of configuration tables that are stored in the System Management System
439 Table. The list is stored as an array of (GUID, Pointer) pairs. The list
440 must be allocated from pool memory with PoolType set to EfiRuntimeServicesData.
442 @param SystemTable A pointer to the SMM System Table.
443 @param Guid A pointer to the GUID for the entry to add, update, or remove.
444 @param Table A pointer to the buffer of the table to add.
445 @param TableSize The size of the table to install.
447 @retval EFI_SUCCESS The (Guid, Table) pair was added, updated, or removed.
448 @retval EFI_INVALID_PARAMETER Guid is not valid.
449 @retval EFI_NOT_FOUND An attempt was made to delete a non-existent entry.
450 @retval EFI_OUT_OF_RESOURCES There is not enough memory available to complete the operation.
455 (EFIAPI
*EFI_SMM_INSTALL_CONFIGURATION_TABLE
) (
456 IN EFI_SMM_SYSTEM_TABLE
*SystemTable
,
464 // System Management System Table (SMST)
466 struct _EFI_SMM_SYSTEM_TABLE
{
467 EFI_TABLE_HEADER Hdr
;
469 CHAR16
*SmmFirmwareVendor
;
470 UINT32 SmmFirmwareRevision
;
472 EFI_SMM_INSTALL_CONFIGURATION_TABLE SmmInstallConfigurationTable
;
477 EFI_GUID EfiSmmCpuIoGuid
;
478 EFI_SMM_CPU_IO_INTERFACE SmmIo
;
481 // Runtime memory service
483 EFI_SMMCORE_ALLOCATE_POOL SmmAllocatePool
;
484 EFI_SMMCORE_FREE_POOL SmmFreePool
;
485 EFI_SMMCORE_ALLOCATE_PAGES SmmAllocatePages
;
486 EFI_SMMCORE_FREE_PAGES SmmFreePages
;
491 EFI_SMM_STARTUP_THIS_AP SmmStartupThisAp
;
494 // CPU information records
496 UINTN CurrentlyExecutingCpu
;
498 EFI_SMM_CPU_SAVE_STATE
*CpuSaveState
;
499 EFI_SMM_FLOATING_POINT_SAVE_STATE
*CpuOptionalFloatingPointState
;
502 // Extensibility table
504 UINTN NumberOfTableEntries
;
505 EFI_CONFIGURATION_TABLE
*SmmConfigurationTable
;
509 #include <Guid/SmmCommunicate.h>
510 #include <Guid/SmramMemoryReserve.h>
511 #include <Protocol/SmmBase.h>
512 #include <Protocol/SmmAccess.h>
513 #include <Protocol/SmmControl.h>
514 #include <Protocol/SmmGpiDispatch.h>
515 #include <Protocol/SmmIchnDispatch.h>
516 #include <Protocol/SmmPeriodicTimerDispatch.h>
517 #include <Protocol/SmmPowerButtonDispatch.h>
518 #include <Protocol/SmmStandbyButtonDispatch.h>
519 #include <Protocol/SmmStatusCode.h>
520 #include <Protocol/SmmSwDispatch.h>
521 #include <Protocol/SmmSxDispatch.h>
522 #include <Protocol/SmmUsbDispatch.h>
524 extern EFI_GUID gEfiSmmCpuIoGuid
;