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.
55 @param Width Signifies the width of the I/O operations.
56 @param Address The base address of the I/O operations.
57 @param Count The number of I/O operations to perform.
58 @param Buffer For read operations, the destination buffer to store the results.
59 For write operations, the source buffer from which to write data.
61 @retval EFI_SUCCESS The data was read from or written to the device.
62 @retval EFI_UNSUPPORTED The Address is not valid for this system.
63 @retval EFI_INVALID_PARAMETER Width or Count, or both, were invalid.
64 @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.
69 (EFIAPI
*EFI_SMM_CPU_IO
) (
70 IN EFI_SMM_CPU_IO_INTERFACE
*This
,
71 IN EFI_SMM_IO_WIDTH Width
,
82 struct _EFI_SMM_CPU_IO_INTERFACE
{
83 EFI_SMM_IO_ACCESS Mem
;
88 Allocates pool memory from SMRAM for IA-32 or runtime memory for
89 the Itanium processor family.
91 @param PoolType The type of pool to allocate.The only supported type is EfiRuntimeServicesData
92 @param Size The number of bytes to allocate from the pool.
93 @param Buffer A pointer to a pointer to the allocated buffer if the call
94 succeeds; undefined otherwise.
96 @retval EFI_SUCCESS The requested number of bytes was allocated.
97 @retval EFI_OUT_OF_RESOURCES The pool requested could not be allocated.
98 @retval EFI_UNSUPPORTED In runtime.
103 (EFIAPI
*EFI_SMMCORE_ALLOCATE_POOL
) (
104 IN EFI_MEMORY_TYPE PoolType
,
110 Returns pool memory to the system.
112 @param Buffer Pointer to the buffer to free.
114 @retval EFI_SUCCESS The memory was returned to the system.
115 @retval EFI_INVALID_PARAMETER Buffer was invalid.
116 @retval EFI_UNSUPPORTED In runtime.
121 (EFIAPI
*EFI_SMMCORE_FREE_POOL
) (
126 Allocates memory pages from the system.
128 @param Type The type of allocation to perform.
129 @param MemoryType The only supported type is EfiRuntimeServicesData
130 @param NumberofPages The number of contiguous 4 KB pages to allocate
131 @param Memory Pointer to a physical address. On input, the way in which
132 the address is used depends on the value of Type. On output, the address
133 is set to the base of the page range that was allocated.
135 @retval EFI_SUCCESS The requested pages were allocated.
136 @retval EFI_OUT_OF_RESOURCES The pages requested could not be allocated.
137 @retval EFI_NOT_FOUND The requested pages could not be found.
138 @retval EFI_INVALID_PARAMETER Type is not AllocateAnyPages or AllocateMaxAddress
139 or AllocateAddress. Or MemoryType is in the range EfiMaxMemoryType..0x7FFFFFFF.
144 (EFIAPI
*EFI_SMMCORE_ALLOCATE_PAGES
) (
145 IN EFI_ALLOCATE_TYPE Type
,
146 IN EFI_MEMORY_TYPE MemoryType
,
147 IN UINTN NumberOfPages
,
148 OUT EFI_PHYSICAL_ADDRESS
*Memory
152 Frees memory pages for the system.
154 @param Memory The base physical address of the pages to be freed
155 @param NumberOfPages The number of contiguous 4 KB pages to free.
157 @retval EFI_SUCCESS The requested memory pages were freed.
158 @retval EFI_INVALID_PARAMETER Memory is not a page-aligned address or NumberOfPages is invalid.
159 @retval EFI_NOT_FOUND The requested memory pages were not allocated with SmmAllocatePages().
164 (EFIAPI
*EFI_SMMCORE_FREE_PAGES
) (
165 IN EFI_PHYSICAL_ADDRESS Memory
,
166 IN UINTN NumberOfPages
171 (EFIAPI
*EFI_SMM_STARTUP_THIS_AP
) (
172 IN EFI_AP_PROCEDURE Procedure
,
174 IN OUT VOID
*ProcArguments OPTIONAL
178 UINT8 Reserved1
[248];
182 UINT16 AutoHALTRestart
;
183 UINT8 Reserved2
[164];
206 } EFI_SMI_CPU_SAVE_STATE
;
253 // application registers
314 UINT64 int_nat
; // nat bits for R1-R31
316 } EFI_PMI_SYSTEM_CONTEXT
;
319 EFI_SMI_CPU_SAVE_STATE Ia32SaveState
;
320 EFI_PMI_SYSTEM_CONTEXT ItaniumSaveState
;
321 } EFI_SMM_CPU_SAVE_STATE
;
334 UINT8 St0Mm0
[10], Rsvd3
[6];
335 UINT8 St0Mm1
[10], Rsvd4
[6];
336 UINT8 St0Mm2
[10], Rsvd5
[6];
337 UINT8 St0Mm3
[10], Rsvd6
[6];
338 UINT8 St0Mm4
[10], Rsvd7
[6];
339 UINT8 St0Mm5
[10], Rsvd8
[6];
340 UINT8 St0Mm6
[10], Rsvd9
[6];
341 UINT8 St0Mm7
[10], Rsvd10
[6];
343 } EFI_SMI_OPTIONAL_FPSAVE_STATE
;
376 } EFI_PMI_OPTIONAL_FLOATING_POINT_CONTEXT
;
379 EFI_SMI_OPTIONAL_FPSAVE_STATE Ia32FpSave
;
380 EFI_PMI_OPTIONAL_FLOATING_POINT_CONTEXT ItaniumFpSave
;
381 } EFI_SMM_FLOATING_POINT_SAVE_STATE
;
384 This function is the main entry point for an SMM handler dispatch
385 or communicate-based callback.
387 @param SmmImageHandle A unique value returned by the SMM infrastructure
388 in response to registration for a communicate-based callback or dispatch.
389 @param CommunicationBuffer
390 An optional buffer that will be populated
391 by the SMM infrastructure in response to a non-SMM agent (preboot or runtime)
392 invoking the EFI_SMM_BASE_PROTOCOL.Communicate() service.
393 @param SourceSize If CommunicationBuffer is non-NULL, this field
394 indicates the size of the data payload in this buffer.
401 (EFIAPI
*EFI_SMM_HANDLER_ENTRY_POINT
) (
402 IN EFI_HANDLE SmmImageHandle
,
403 IN OUT VOID
*CommunicationBuffer OPTIONAL
,
404 IN OUT UINTN
*SourceSize OPTIONAL
408 The SmmInstallConfigurationTable() function is used to maintain the list
409 of configuration tables that are stored in the System Management System
410 Table. The list is stored as an array of (GUID, Pointer) pairs. The list
411 must be allocated from pool memory with PoolType set to EfiRuntimeServicesData.
413 @param SystemTable A pointer to the SMM System Table.
414 @param Guid A pointer to the GUID for the entry to add, update, or remove.
415 @param Table A pointer to the buffer of the table to add.
416 @param TableSize The size of the table to install.
418 @retval EFI_SUCCESS The (Guid, Table) pair was added, updated, or removed.
419 @retval EFI_INVALID_PARAMETER Guid is not valid.
420 @retval EFI_NOT_FOUND An attempt was made to delete a non-existent entry.
421 @retval EFI_OUT_OF_RESOURCES There is not enough memory available to complete the operation.
426 (EFIAPI
*EFI_SMM_INSTALL_CONFIGURATION_TABLE
) (
427 IN EFI_SMM_SYSTEM_TABLE
*SystemTable
,
435 // System Management System Table (SMST)
437 struct _EFI_SMM_SYSTEM_TABLE
{
438 EFI_TABLE_HEADER Hdr
;
440 CHAR16
*SmmFirmwareVendor
;
441 UINT32 SmmFirmwareRevision
;
443 EFI_SMM_INSTALL_CONFIGURATION_TABLE SmmInstallConfigurationTable
;
448 EFI_GUID EfiSmmCpuIoGuid
;
449 EFI_SMM_CPU_IO_INTERFACE SmmIo
;
452 // Runtime memory service
454 EFI_SMMCORE_ALLOCATE_POOL SmmAllocatePool
;
455 EFI_SMMCORE_FREE_POOL SmmFreePool
;
456 EFI_SMMCORE_ALLOCATE_PAGES SmmAllocatePages
;
457 EFI_SMMCORE_FREE_PAGES SmmFreePages
;
462 EFI_SMM_STARTUP_THIS_AP SmmStartupThisAp
;
465 // CPU information records
467 UINTN CurrentlyExecutingCpu
;
469 EFI_SMM_CPU_SAVE_STATE
*CpuSaveState
;
470 EFI_SMM_FLOATING_POINT_SAVE_STATE
*CpuOptionalFloatingPointState
;
473 // Extensibility table
475 UINTN NumberOfTableEntries
;
476 EFI_CONFIGURATION_TABLE
*SmmConfigurationTable
;
480 #include <Guid/SmmCommunicate.h>
481 #include <Guid/SmramMemoryReserve.h>
482 #include <Protocol/SmmBase.h>
483 #include <Protocol/SmmAccess.h>
484 #include <Protocol/SmmControl.h>
485 #include <Protocol/SmmGpiDispatch.h>
486 #include <Protocol/SmmIchnDispatch.h>
487 #include <Protocol/SmmPeriodicTimerDispatch.h>
488 #include <Protocol/SmmPowerButtonDispatch.h>
489 #include <Protocol/SmmStandbyButtonDispatch.h>
490 #include <Protocol/SmmStatusCode.h>
491 #include <Protocol/SmmSwDispatch.h>
492 #include <Protocol/SmmSxDispatch.h>
493 #include <Protocol/SmmUsbDispatch.h>
495 extern EFI_GUID gEfiSmmCpuIoGuid
;