TianoCore EDK2 master
|
#include <PiSmm.h>
#include <Protocol/SmmConfiguration.h>
#include <Protocol/SmmCpu.h>
#include <Protocol/SmmReadyToLock.h>
#include <Protocol/SmmCpuService.h>
#include <Protocol/SmmMemoryAttribute.h>
#include <Protocol/MmMp.h>
#include <Protocol/SmmVariable.h>
#include <Guid/AcpiS3Context.h>
#include <Guid/MemoryAttributesTable.h>
#include <Guid/PiSmmMemoryAttributesTable.h>
#include <Guid/SmramMemoryReserve.h>
#include <Guid/SmmBaseHob.h>
#include <Guid/MpInformation2.h>
#include <Guid/MmProfileData.h>
#include <Guid/MmAcpiS3Enable.h>
#include <Guid/MmCpuSyncConfig.h>
#include <Library/BaseLib.h>
#include <Library/IoLib.h>
#include <Library/TimerLib.h>
#include <Library/SynchronizationLib.h>
#include <Library/DebugLib.h>
#include <Library/BaseMemoryLib.h>
#include <Library/PcdLib.h>
#include <Library/MtrrLib.h>
#include <Library/SmmCpuPlatformHookLib.h>
#include <Library/MmServicesTableLib.h>
#include <Library/MemoryAllocationLib.h>
#include <Library/DebugAgentLib.h>
#include <Library/UefiLib.h>
#include <Library/HobLib.h>
#include <Library/LocalApicLib.h>
#include <Library/CpuLib.h>
#include <Library/CpuExceptionHandlerLib.h>
#include <Library/ReportStatusCodeLib.h>
#include <Library/SmmCpuFeaturesLib.h>
#include <Library/PeCoffGetEntryPointLib.h>
#include <Library/RegisterCpuFeaturesLib.h>
#include <Library/PerformanceLib.h>
#include <Library/CpuPageTableLib.h>
#include <Library/MmSaveStateLib.h>
#include <Library/SmmCpuSyncLib.h>
#include <AcpiCpuData.h>
#include <CpuHotPlugData.h>
#include <Register/Intel/Cpuid.h>
#include <Register/Intel/Msr.h>
#include "CpuService.h"
#include "SmmProfile.h"
#include "SmmMpPerf.h"
Go to the source code of this file.
Data Structures | |
union | MSR_IA32_CET |
struct | PAGE_ATTRIBUTE_TABLE |
struct | PROCEDURE_WRAPPER |
struct | PROCEDURE_TOKEN |
struct | TOKEN_BUFFER |
struct | SMM_CPU_PRIVATE_DATA |
struct | PAGE_TABLE_POOL |
struct | SMM_CPU_DATA_BLOCK |
struct | SMM_DISPATCHER_MP_SYNC_DATA |
struct | SMM_CPU_SEMAPHORE_GLOBAL |
struct | SMM_CPU_SEMAPHORE_CPU |
struct | SMM_CPU_SEMAPHORES |
struct | MM_CPU_MEMORY_REGION |
Macros | |
#define | CPUID_CET_SS BIT7 |
#define | CPUID_CET_IBT BIT20 |
#define | CR4_CET_ENABLE BIT23 |
#define | MSR_IA32_S_CET 0x6A2 |
#define | MSR_IA32_PL0_SSP 0x6A4 |
#define | MSR_IA32_INTERRUPT_SSP_TABLE_ADDR 0x6A8 |
#define | EFI_MSR_SMM_MCA_CAP 0x17D |
#define | SMM_CODE_ACCESS_CHK_BIT BIT58 |
#define | SMM_FEATURE_CONTROL_LOCK_BIT BIT0 |
#define | SMM_CODE_CHK_EN_BIT BIT2 |
#define | IA32_PG_P BIT0 |
#define | IA32_PG_RW BIT1 |
#define | IA32_PG_U BIT2 |
#define | IA32_PG_WT BIT3 |
#define | IA32_PG_CD BIT4 |
#define | IA32_PG_A BIT5 |
#define | IA32_PG_D BIT6 |
#define | IA32_PG_PS BIT7 |
#define | IA32_PG_PAT_2M BIT12 |
#define | IA32_PG_PAT_4K IA32_PG_PS |
#define | IA32_PG_PMNT BIT62 |
#define | IA32_PG_NX BIT63 |
#define | PAGE_ATTRIBUTE_BITS (IA32_PG_D | IA32_PG_A | IA32_PG_U | IA32_PG_RW | IA32_PG_P) |
#define | IA32_PAE_PDPTE_ATTRIBUTE_BITS (IA32_PG_P) |
#define | PAGE_PROGATE_BITS (IA32_PG_NX | PAGE_ATTRIBUTE_BITS) |
#define | PAGING_4K_MASK 0xFFF |
#define | PAGING_2M_MASK 0x1FFFFF |
#define | PAGING_1G_MASK 0x3FFFFFFF |
#define | PAGING_PAE_INDEX_MASK 0x1FF |
#define | PAGING_4K_ADDRESS_MASK_64 0x000FFFFFFFFFF000ull |
#define | PAGING_2M_ADDRESS_MASK_64 0x000FFFFFFFE00000ull |
#define | PAGING_1G_ADDRESS_MASK_64 0x000FFFFFC0000000ull |
#define | SMRR_MAX_ADDRESS BASE_4GB |
#define | TSS_SIZE 104 |
#define | EXCEPTION_TSS_SIZE (TSS_SIZE + 4) |
#define | TSS_X64_IST1_OFFSET 36 |
#define | TSS_IA32_CR3_OFFSET 28 |
#define | TSS_IA32_ESP_OFFSET 56 |
#define | TSS_IA32_SSP_OFFSET 104 |
#define | CR0_WP BIT16 |
#define | PROTECT_MODE_CODE_SEGMENT 0x08 |
#define | LONG_MODE_CODE_SEGMENT 0x38 |
#define | EXCEPTION_VECTOR_NUMBER 0x20 |
#define | INVALID_APIC_ID 0xFFFFFFFFFFFFFFFFULL |
#define | PROCEDURE_TOKEN_SIGNATURE SIGNATURE_32 ('P', 'R', 'T', 'S') |
#define | PROCEDURE_TOKEN_FROM_LINK(a) CR (a, PROCEDURE_TOKEN, Link, PROCEDURE_TOKEN_SIGNATURE) |
#define | TOKEN_BUFFER_SIGNATURE SIGNATURE_32 ('T', 'K', 'B', 'S') |
#define | TOKEN_BUFFER_FROM_LINK(a) CR (a, TOKEN_BUFFER, Link, TOKEN_BUFFER_SIGNATURE) |
#define | SMM_CPU_PRIVATE_DATA_SIGNATURE SIGNATURE_32 ('s', 'c', 'p', 'u') |
#define | PAGE_TABLE_POOL_ALIGNMENT BASE_128KB |
#define | PAGE_TABLE_POOL_UNIT_SIZE BASE_128KB |
#define | PAGE_TABLE_POOL_UNIT_PAGES EFI_SIZE_TO_PAGES (PAGE_TABLE_POOL_UNIT_SIZE) |
#define | PAGE_TABLE_POOL_ALIGN_MASK (~(EFI_PHYSICAL_ADDRESS)(PAGE_TABLE_POOL_ALIGNMENT - 1)) |
#define | SMM_PSD_OFFSET 0xfb00 |
#define | WRITE_UNPROTECT_RO_PAGES(Wp, Cet) |
#define | WRITE_PROTECT_RO_PAGES(Wp, Cet) |
Enumerations | |
enum | PAGE_ATTRIBUTE { PageNone , Page4K , Page2M , Page1G , PageNone , Page4K , Page2M , Page1G } |
Agent Module to load other modules to deploy SMM Entry Vector for X86 CPU.
Copyright (c) 2009 - 2024, Intel Corporation. All rights reserved.
Copyright (c) 2017, AMD Incorporated. All rights reserved.
Copyright (C) 2023 Advanced Micro Devices, Inc. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent
Definition in file PiSmmCpuCommon.h.
#define CPUID_CET_IBT BIT20 |
Definition at line 75 of file PiSmmCpuCommon.h.
#define CPUID_CET_SS BIT7 |
Definition at line 74 of file PiSmmCpuCommon.h.
#define CR0_WP BIT16 |
Definition at line 185 of file PiSmmCpuCommon.h.
#define CR4_CET_ENABLE BIT23 |
Definition at line 77 of file PiSmmCpuCommon.h.
#define EFI_MSR_SMM_MCA_CAP 0x17D |
Definition at line 119 of file PiSmmCpuCommon.h.
#define EXCEPTION_TSS_SIZE (TSS_SIZE + 4) |
Definition at line 179 of file PiSmmCpuCommon.h.
#define EXCEPTION_VECTOR_NUMBER 0x20 |
Definition at line 193 of file PiSmmCpuCommon.h.
#define IA32_PAE_PDPTE_ATTRIBUTE_BITS (IA32_PG_P) |
Definition at line 146 of file PiSmmCpuCommon.h.
#define IA32_PG_A BIT5 |
Definition at line 133 of file PiSmmCpuCommon.h.
#define IA32_PG_CD BIT4 |
Definition at line 132 of file PiSmmCpuCommon.h.
#define IA32_PG_D BIT6 |
Definition at line 134 of file PiSmmCpuCommon.h.
#define IA32_PG_NX BIT63 |
Definition at line 139 of file PiSmmCpuCommon.h.
#define IA32_PG_P BIT0 |
Page Table Entry
Definition at line 128 of file PiSmmCpuCommon.h.
#define IA32_PG_PAT_2M BIT12 |
Definition at line 136 of file PiSmmCpuCommon.h.
#define IA32_PG_PAT_4K IA32_PG_PS |
Definition at line 137 of file PiSmmCpuCommon.h.
#define IA32_PG_PMNT BIT62 |
Definition at line 138 of file PiSmmCpuCommon.h.
#define IA32_PG_PS BIT7 |
Definition at line 135 of file PiSmmCpuCommon.h.
#define IA32_PG_RW BIT1 |
Definition at line 129 of file PiSmmCpuCommon.h.
#define IA32_PG_U BIT2 |
Definition at line 130 of file PiSmmCpuCommon.h.
#define IA32_PG_WT BIT3 |
Definition at line 131 of file PiSmmCpuCommon.h.
#define INVALID_APIC_ID 0xFFFFFFFFFFFFFFFFULL |
Definition at line 195 of file PiSmmCpuCommon.h.
#define LONG_MODE_CODE_SEGMENT 0x38 |
Definition at line 191 of file PiSmmCpuCommon.h.
#define MSR_IA32_INTERRUPT_SSP_TABLE_ADDR 0x6A8 |
Definition at line 81 of file PiSmmCpuCommon.h.
#define MSR_IA32_PL0_SSP 0x6A4 |
Definition at line 80 of file PiSmmCpuCommon.h.
#define MSR_IA32_S_CET 0x6A2 |
Definition at line 79 of file PiSmmCpuCommon.h.
#define PAGE_ATTRIBUTE_BITS (IA32_PG_D | IA32_PG_A | IA32_PG_U | IA32_PG_RW | IA32_PG_P) |
Definition at line 141 of file PiSmmCpuCommon.h.
#define PAGE_PROGATE_BITS (IA32_PG_NX | PAGE_ATTRIBUTE_BITS) |
Definition at line 148 of file PiSmmCpuCommon.h.
#define PAGE_TABLE_POOL_ALIGN_MASK (~(EFI_PHYSICAL_ADDRESS)(PAGE_TABLE_POOL_ALIGNMENT - 1)) |
Definition at line 278 of file PiSmmCpuCommon.h.
#define PAGE_TABLE_POOL_ALIGNMENT BASE_128KB |
Definition at line 275 of file PiSmmCpuCommon.h.
#define PAGE_TABLE_POOL_UNIT_PAGES EFI_SIZE_TO_PAGES (PAGE_TABLE_POOL_UNIT_SIZE) |
Definition at line 277 of file PiSmmCpuCommon.h.
#define PAGE_TABLE_POOL_UNIT_SIZE BASE_128KB |
Definition at line 276 of file PiSmmCpuCommon.h.
#define PAGING_1G_ADDRESS_MASK_64 0x000FFFFFC0000000ull |
Definition at line 158 of file PiSmmCpuCommon.h.
#define PAGING_1G_MASK 0x3FFFFFFF |
Definition at line 152 of file PiSmmCpuCommon.h.
#define PAGING_2M_ADDRESS_MASK_64 0x000FFFFFFFE00000ull |
Definition at line 157 of file PiSmmCpuCommon.h.
#define PAGING_2M_MASK 0x1FFFFF |
Definition at line 151 of file PiSmmCpuCommon.h.
#define PAGING_4K_ADDRESS_MASK_64 0x000FFFFFFFFFF000ull |
Definition at line 156 of file PiSmmCpuCommon.h.
#define PAGING_4K_MASK 0xFFF |
Definition at line 150 of file PiSmmCpuCommon.h.
#define PAGING_PAE_INDEX_MASK 0x1FF |
Definition at line 154 of file PiSmmCpuCommon.h.
#define PROCEDURE_TOKEN_FROM_LINK | ( | a | ) | CR (a, PROCEDURE_TOKEN, Link, PROCEDURE_TOKEN_SIGNATURE) |
Definition at line 215 of file PiSmmCpuCommon.h.
#define PROCEDURE_TOKEN_SIGNATURE SIGNATURE_32 ('P', 'R', 'T', 'S') |
Definition at line 205 of file PiSmmCpuCommon.h.
#define PROTECT_MODE_CODE_SEGMENT 0x08 |
Definition at line 190 of file PiSmmCpuCommon.h.
#define SMM_CODE_ACCESS_CHK_BIT BIT58 |
Definition at line 120 of file PiSmmCpuCommon.h.
#define SMM_CODE_CHK_EN_BIT BIT2 |
Definition at line 123 of file PiSmmCpuCommon.h.
#define SMM_CPU_PRIVATE_DATA_SIGNATURE SIGNATURE_32 ('s', 'c', 'p', 'u') |
Definition at line 233 of file PiSmmCpuCommon.h.
#define SMM_FEATURE_CONTROL_LOCK_BIT BIT0 |
Definition at line 122 of file PiSmmCpuCommon.h.
#define SMM_PSD_OFFSET 0xfb00 |
Definition at line 420 of file PiSmmCpuCommon.h.
#define SMRR_MAX_ADDRESS BASE_4GB |
Definition at line 160 of file PiSmmCpuCommon.h.
#define TOKEN_BUFFER_FROM_LINK | ( | a | ) | CR (a, TOKEN_BUFFER, Link, TOKEN_BUFFER_SIGNATURE) |
Definition at line 226 of file PiSmmCpuCommon.h.
#define TOKEN_BUFFER_SIGNATURE SIGNATURE_32 ('T', 'K', 'B', 'S') |
Definition at line 217 of file PiSmmCpuCommon.h.
#define TSS_IA32_CR3_OFFSET 28 |
Definition at line 181 of file PiSmmCpuCommon.h.
#define TSS_IA32_ESP_OFFSET 56 |
Definition at line 182 of file PiSmmCpuCommon.h.
#define TSS_IA32_SSP_OFFSET 104 |
Definition at line 183 of file PiSmmCpuCommon.h.
#define TSS_SIZE 104 |
Definition at line 178 of file PiSmmCpuCommon.h.
#define TSS_X64_IST1_OFFSET 36 |
Definition at line 180 of file PiSmmCpuCommon.h.
#define WRITE_PROTECT_RO_PAGES | ( | Wp, | |
Cet | |||
) |
Definition at line 1621 of file PiSmmCpuCommon.h.
#define WRITE_UNPROTECT_RO_PAGES | ( | Wp, | |
Cet | |||
) |
Define macros to encapsulate the write unprotect/protect read-only pages. Below pieces of logic are defined as macros and not functions because "CET" feature disable & enable must be in the same function to avoid shadow stack and normal SMI stack mismatch, thus WRITE_UNPROTECT_RO_PAGES () must be called pair with WRITE_PROTECT_RO_PAGES () in same function.
[in,out] | Wp | A BOOLEAN variable local to the containing function, carrying write protection status from WRITE_UNPROTECT_RO_PAGES() to WRITE_PROTECT_RO_PAGES(). |
[in,out] | Cet | A BOOLEAN variable local to the containing function, carrying control flow integrity enforcement status from WRITE_UNPROTECT_RO_PAGES() to WRITE_PROTECT_RO_PAGES(). |
Definition at line 1612 of file PiSmmCpuCommon.h.
enum PAGE_ATTRIBUTE |
Definition at line 162 of file PiSmmCpuCommon.h.
Allocate pages for code.
[in] | Pages | Number of pages to be allocated. |
Definition at line 28 of file PrePiLib.c.
This API provides a way to allocate memory for page table.
This API can be called more once to allocate memory for page tables.
Allocates the number of 4KB pages of type EfiRuntimeServicesData and returns a pointer to the allocated buffer. The buffer returned is aligned on a 4KB boundary. If Pages is 0, then NULL is returned. If there is not enough memory remaining to satisfy the request, then NULL is returned.
Pages | The number of 4 KB pages to allocate. |
This API provides a way to allocate memory for page table.
This API can be called more than once to allocate memory for page tables.
Allocates the number of 4KB pages and returns a pointer to the allocated buffer. The buffer returned is aligned on a 4KB boundary.
If Pages is 0, then NULL is returned. If there is not enough memory remaining to satisfy the request, then NULL is returned.
Pages | The number of 4 KB pages to allocate. |
This API provides a way to allocate memory for page table.
Pages | The number of 4 KB pages to allocate. |
Definition at line 314 of file VirtualMemory.c.
VOID ConfigSmmCodeAccessCheck | ( | VOID | ) |
Configure SMM Code Access Check feature for all processors. SMM Feature Control MSR will be locked after configuration.
Definition at line 1435 of file PiSmmCpuCommon.c.
Configure SMM Code Access Check feature on an AP. SMM Feature Control MSR will be locked after configuration.
[in,out] | Buffer | Pointer to private data buffer. |
Definition at line 1388 of file PiSmmCpuCommon.c.
RETURN_STATUS ConvertMemoryPageAttributes | ( | IN UINTN | PageTableBase, |
IN PAGING_MODE | PagingMode, | ||
IN PHYSICAL_ADDRESS | BaseAddress, | ||
IN UINT64 | Length, | ||
IN UINT64 | Attributes, | ||
IN BOOLEAN | IsSet, | ||
OUT BOOLEAN *IsModified | OPTIONAL | ||
) |
This function modifies the page attributes for the memory region specified by BaseAddress and Length from their current attributes to the attributes specified by Attributes.
Caller should make sure BaseAddress and Length is at page boundary.
[in] | PageTableBase | The page table base. |
[in] | BaseAddress | The physical address that is the start address of a memory region. |
[in] | Length | The size in bytes of the memory region. |
[in] | Attributes | The bit mask of attributes to modify for the memory region. |
[in] | IsSet | TRUE means to set attributes. FALSE means to clear attributes. |
[out] | IsModified | TRUE means page table modified. FALSE means page table not modified. |
RETURN_SUCCESS | The attributes were modified for the memory region. |
RETURN_ACCESS_DENIED | The attributes for the memory resource range specified by BaseAddress and Length cannot be modified. |
RETURN_INVALID_PARAMETER | Length is zero. Attributes specified an illegal combination of attributes that cannot be set together. |
RETURN_OUT_OF_RESOURCES | There are not enough system resources to modify the attributes of the memory resource range. |
RETURN_UNSUPPORTED | The processor does not support one or more bytes of the memory resource range specified by BaseAddress and Length. The bit mask of attributes is not support for the memory resource range specified by BaseAddress and Length. |
This function modifies the page attributes for the memory region specified by BaseAddress and Length from their current attributes to the attributes specified by Attributes.
Caller should make sure BaseAddress and Length is at page boundary.
[in] | PageTableBase | The page table base. |
[in] | PagingMode | The paging mode. |
[in] | BaseAddress | The physical address that is the start address of a memory region. |
[in] | Length | The size in bytes of the memory region. |
[in] | Attributes | The bit mask of attributes to modify for the memory region. |
[in] | IsSet | TRUE means to set attributes. FALSE means to clear attributes. |
[out] | IsModified | TRUE means page table modified. FALSE means page table not modified. |
RETURN_SUCCESS | The attributes were modified for the memory region. |
RETURN_ACCESS_DENIED | The attributes for the memory resource range specified by BaseAddress and Length cannot be modified. |
RETURN_INVALID_PARAMETER | Length is zero. Attributes specified an illegal combination of attributes that cannot be set together. |
RETURN_OUT_OF_RESOURCES | There are not enough system resources to modify the attributes of the memory resource range. |
RETURN_UNSUPPORTED | The processor does not support one or more bytes of the memory resource range specified by BaseAddress and Length. The bit mask of attributes is not support for the memory resource range specified by BaseAddress and Length. |
Definition at line 331 of file SmmCpuMemoryManagement.c.
VOID CreateExtendedProtectionRange | ( | OUT MM_CPU_MEMORY_REGION ** | MemoryRegion, |
OUT UINTN * | MemoryRegionCount | ||
) |
Build extended protection MemoryRegion.
The caller is responsible for freeing MemoryRegion via FreePool().
[out] | MemoryRegion | Returned Non-Mmram Memory regions. |
[out] | MemoryRegionCount | A pointer to the number of Memory regions. |
Create extended protection MemoryRegion. Return all MMIO ranges that are reported in GCD service at EndOfDxe.
The caller is responsible for freeing MemoryRegion via FreePool().
[out] | MemoryRegion | Returned Non-Mmram Memory regions. |
[out] | MemoryRegionCount | A pointer to the number of Memory regions. |
Definition at line 609 of file NonMmramMapDxeSmm.c.
VOID CreateNonMmramMemMap | ( | IN UINT8 | PhysicalAddressBits, |
OUT MM_CPU_MEMORY_REGION ** | MemoryRegion, | ||
OUT UINTN * | MemoryRegionCount | ||
) |
Create the Non-Mmram Memory Region.
The caller is responsible for freeing MemoryRegion via FreePool().
[in] | PhysicalAddressBits | The bits of physical address to map. |
[out] | MemoryRegion | Returned Non-Mmram Memory regions. |
[out] | MemoryRegionCount | A pointer to the number of Memory regions. |
Create the Non-Mmram Memory Region. Build MemoryRegion to cover [0, 2^PhysicalAddressBits) by excluding all Smram range. The memory attribute is all-allowed (read/write/executable).
The caller is responsible for freeing MemoryRegion via FreePool().
[in] | PhysicalAddressBits | The bits of physical address to map. |
[out] | MemoryRegion | Returned Non-Mmram Memory regions. |
[out] | MemoryRegionCount | A pointer to the number of Memory regions. |
Create the Non-Mmram Memory Region within the ResourceDescriptor HOBs without Logging attribute.
The caller is responsible for freeing MemoryRegion via FreePool().
[in] | PhysicalAddressBits | The bits of physical address to map. |
[out] | MemoryRegion | Returned Non-Mmram Memory regions. |
[out] | MemoryRegionCount | A pointer to the number of Memory regions. |
Definition at line 689 of file NonMmramMapDxeSmm.c.
VOID EFIAPI DisableCet | ( | VOID | ) |
Disable CET.
Search module name by input IP address and output it.
CallerIpAddress | Caller instruction pointer. |
Definition at line 181 of file PiSmmCpuCommon.c.
EFI_STATUS EFIAPI EdkiiSmmClearMemoryAttributes | ( | IN EDKII_SMM_MEMORY_ATTRIBUTE_PROTOCOL * | This, |
IN EFI_PHYSICAL_ADDRESS | BaseAddress, | ||
IN UINT64 | Length, | ||
IN UINT64 | Attributes | ||
) |
This function clears given attributes of the memory region specified by BaseAddress and Length.
This | The EDKII_SMM_MEMORY_ATTRIBUTE_PROTOCOL instance. |
BaseAddress | The physical address that is the start address of a memory region. |
Length | The size in bytes of the memory region. |
Attributes | The bit mask of attributes to clear for the memory region. |
EFI_SUCCESS | The attributes were cleared for the memory region. |
EFI_INVALID_PARAMETER | Length is zero. Attributes specified an illegal combination of attributes that cannot be cleared together. |
EFI_UNSUPPORTED | The processor does not support one or more bytes of the memory resource range specified by BaseAddress and Length. The bit mask of attributes is not supported for the memory resource range specified by BaseAddress and Length. |
Definition at line 1160 of file SmmCpuMemoryManagement.c.
EFI_STATUS EFIAPI EdkiiSmmGetMemoryAttributes | ( | IN EDKII_SMM_MEMORY_ATTRIBUTE_PROTOCOL * | This, |
IN EFI_PHYSICAL_ADDRESS | BaseAddress, | ||
IN UINT64 | Length, | ||
IN UINT64 * | Attributes | ||
) |
This function retrieves the attributes of the memory region specified by BaseAddress and Length. If different attributes are got from different part of the memory region, EFI_NO_MAPPING will be returned.
This | The EDKII_SMM_MEMORY_ATTRIBUTE_PROTOCOL instance. |
BaseAddress | The physical address that is the start address of a memory region. |
Length | The size in bytes of the memory region. |
Attributes | Pointer to attributes returned. |
EFI_SUCCESS | The attributes got for the memory region. |
EFI_INVALID_PARAMETER | Length is zero. Attributes is NULL. |
EFI_NO_MAPPING | Attributes are not consistent cross the memory region. |
EFI_UNSUPPORTED | The processor does not support one or more bytes of the memory resource range specified by BaseAddress and Length. |
EFI_STATUS EFIAPI EdkiiSmmSetMemoryAttributes | ( | IN EDKII_SMM_MEMORY_ATTRIBUTE_PROTOCOL * | This, |
IN EFI_PHYSICAL_ADDRESS | BaseAddress, | ||
IN UINT64 | Length, | ||
IN UINT64 | Attributes | ||
) |
This function set given attributes of the memory region specified by BaseAddress and Length.
This | The EDKII_SMM_MEMORY_ATTRIBUTE_PROTOCOL instance. |
BaseAddress | The physical address that is the start address of a memory region. |
Length | The size in bytes of the memory region. |
Attributes | The bit mask of attributes to set for the memory region. |
EFI_SUCCESS | The attributes were set for the memory region. |
EFI_INVALID_PARAMETER | Length is zero. Attributes specified an illegal combination of attributes that cannot be set together. |
EFI_UNSUPPORTED | The processor does not support one or more bytes of the memory resource range specified by BaseAddress and Length. The bit mask of attributes is not supported for the memory resource range specified by BaseAddress and Length. |
Definition at line 1125 of file SmmCpuMemoryManagement.c.
VOID EFIAPI EnableCet | ( | VOID | ) |
Enable CET.
VOID ExecuteFirstSmiInit | ( | VOID | ) |
Issue SMI IPI (All Excluding Self SMM IPI + BSP SMM IPI) to execute first SMI init.
Definition at line 398 of file PiSmmCpuCommon.c.
Find out SMRAM information including SMRR base and SMRR size.
SmrrBase | SMRR base |
SmrrSize | SMRR size |
Definition at line 1305 of file PiSmmCpuCommon.c.
UINT32 Gen4GPageTable | ( | IN BOOLEAN | Is32BitPageTable | ) |
Create 4G PageTable in SMRAM.
[in] | Is32BitPageTable | Whether the page table is 32-bit PAE |
Create page table based on input PagingMode and PhysicalAddressBits in smm.
[in] | PagingMode | The paging mode. |
[in] | PhysicalAddressBits | The bits of physical address to map. |
PageTable | Address |
Definition at line 1238 of file SmmCpuMemoryManagement.c.
VOID GetAcpiS3EnableFlag | ( | VOID | ) |
Get ACPI S3 enable flag.
Definition at line 230 of file PiSmmCpuDxeSmm.c.
EFI_PROCESSOR_INFORMATION * GetMpInformationFromMpServices | ( | OUT UINTN * | NumberOfCpus, |
OUT UINTN * | MaxNumberOfCpus | ||
) |
Extract NumberOfCpus, MaxNumberOfCpus and EFI_PROCESSOR_INFORMATION for all CPU from gEfiMpServiceProtocolGuid.
[out] | NumberOfCpus | Pointer to NumberOfCpus. |
[out] | MaxNumberOfCpus | Pointer to MaxNumberOfCpus. |
ProcessorInfo | Pointer to EFI_PROCESSOR_INFORMATION buffer. |
Extract NumberOfCpus, MaxNumberOfCpus and EFI_PROCESSOR_INFORMATION.
[out] | NumberOfCpus | Pointer to NumberOfCpus. |
[out] | MaxNumberOfCpus | Pointer to MaxNumberOfCpus. |
ProcessorInfo | Pointer to EFI_PROCESSOR_INFORMATION buffer. |
Get the MP Services Protocol
Get the number of processors
Allocate buffer for processor information
Get processor information
Definition at line 260 of file PiSmmCpuDxeSmm.c.
UINTN EFIAPI GetSmiHandlerSize | ( | VOID | ) |
Get the size of the SMI Handler in bytes.
The | size, in bytes, of the SMI Handler. |
Definition at line 80 of file SmramSaveState.c.
VOID GetSmmCpuSyncConfigData | ( | IN OUT BOOLEAN * | RelaxedMode, |
OPTIONAL IN OUT UINT64 * | SyncTimeout, | ||
OPTIONAL IN OUT UINT64 *SyncTimeout2 | OPTIONAL | ||
) |
Get SmmCpuSyncConfig data: RelaxedMode, SyncTimeout, SyncTimeout2.
[in,out] | RelaxedMode | It indicates if Relaxed CPU synchronization method or traditional CPU synchronization method is used when processing an SMI. |
[in,out] | SyncTimeout | It indicates the 1st BSP/AP synchronization timeout value in SMM. |
[in,out] | SyncTimeout2 | It indicates the 2nd BSP/AP synchronization timeout value in SMM. |
Definition at line 206 of file PiSmmCpuDxeSmm.c.
EFI_PHYSICAL_ADDRESS GetSmmProfileData | ( | IN OUT UINT64 * | Size | ) |
Get SmmProfileData.
[in,out] | Size | Return Size of SmmProfileData. |
Get SmmProfileData.
[in,out] | Size | Return Size of SmmProfileData. 0 means the gMmProfileDataHobGuid does not exist. |
Definition at line 489 of file NonMmramMapDxeSmm.c.
UINTN GetSupportedMaxLogicalProcessorNumber | ( | VOID | ) |
Get the maximum number of logical processors supported by the system.
The | maximum number of logical processors supported by the system is indicated by the return value. |
Definition at line 244 of file PiSmmCpuDxeSmm.c.
VOID GetUefiMemoryMap | ( | VOID | ) |
This function caches the UEFI memory map information.
Definition at line 246 of file NonMmramMapDxeSmm.c.
Initialize Gdt for all processors.
[in] | Cr3 | CR3 value. |
[out] | GdtStepSize | The step size for GDT table. |
Definition at line 55 of file SmmFuncsArch.c.
VOID InitializeDataForMmMp | ( | VOID | ) |
Allocate buffer for SpinLock and Wrapper function buffer.
Definition at line 1791 of file MpService.c.
VOID EFIAPI InitializeIdtIst | ( | IN EFI_EXCEPTION_TYPE | ExceptionType, |
IN UINT8 | Ist | ||
) |
Initialize IDT IST Field.
[in] | ExceptionType | Exception type. |
[in] | Ist | IST value. |
Definition at line 34 of file SmmFuncsArch.c.
VOID EFIAPI InitializeIDTSmmStackGuard | ( | VOID | ) |
Initialize IDT for SMM Stack Guard.
Definition at line 29 of file SmmFuncsArch.c.
Initialize global data for MP synchronization.
Stacks | Base address of SMI stack buffer for all processors. |
StackSize | Stack size for each processor in SMM. |
ShadowStackSize | Shadow Stack size for each processor in SMM. |
Definition at line 1940 of file MpService.c.
VOID EFIAPI InitializeMpSyncData | ( | VOID | ) |
Initialize MP synchronization data.
Initialize un-cacheable data.
Definition at line 1865 of file MpService.c.
VOID InitializeSmm | ( | VOID | ) |
Initialize SMM environment.
Definition at line 327 of file PiSmmCpuCommon.c.
VOID InitializeSmmTimer | ( | VOID | ) |
Initialize Timer for SMM AP Sync.
Definition at line 29 of file SyncTimer.c.
VOID InitMsrSpinLockByIndex | ( | IN UINT32 | MsrIndex | ) |
Initialize MSR spin lock by MSR index.
MsrIndex | MSR index value. |
VOID InitPackageFirstThreadIndexInfo | ( | VOID | ) |
Initialize PackageBsp Info. Processor specified by mPackageFirstThreadIndex[PackageIndex] will do the package-scope register programming. Set default CpuIndex to (UINT32)-1, which means not specified yet.
Definition at line 1752 of file MpService.c.
Initialize the shadow stack related data structure.
CpuIndex | The index of CPU. |
ShadowStack | The bottom of the shadow stack for this CPU. |
Definition at line 151 of file SmmFuncsArch.c.
VOID InitSmmS3ResumeState | ( | VOID | ) |
VOID EFIAPI InstallSmiHandler | ( | IN UINTN | CpuIndex, |
IN UINT32 | SmBase, | ||
IN VOID * | SmiStack, | ||
IN UINTN | StackSize, | ||
IN UINTN | GdtBase, | ||
IN UINTN | GdtSize, | ||
IN UINTN | IdtBase, | ||
IN UINTN | IdtSize, | ||
IN UINT32 | Cr3 | ||
) |
Install the SMI handler for the CPU specified by CpuIndex. This function is called by the CPU that was elected as monarch during System Management Mode initialization.
[in] | CpuIndex | The index of the CPU to install the custom SMI handler. The value must be between 0 and the NumberOfCpus field in the System Management System Table (SMST). |
[in] | SmBase | The SMBASE address for the CPU specified by CpuIndex. |
[in] | SmiStack | The stack to use when an SMI is processed by the the CPU specified by CpuIndex. |
[in] | StackSize | The size, in bytes, if the stack used when an SMI is processed by the CPU specified by CpuIndex. |
[in] | GdtBase | The base address of the GDT to use when an SMI is processed by the CPU specified by CpuIndex. |
[in] | GdtSize | The size, in bytes, of the GDT used when an SMI is processed by the CPU specified by CpuIndex. |
[in] | IdtBase | The base address of the IDT to use when an SMI is processed by the CPU specified by CpuIndex. |
[in] | IdtSize | The size, in bytes, of the IDT used when an SMI is processed by the CPU specified by CpuIndex. |
[in] | Cr3 | The base address of the page tables to use when an SMI is processed by the CPU specified by CpuIndex. |
Definition at line 120 of file SmramSaveState.c.
EFI_STATUS InternalSmmStartupAllAPs | ( | IN EFI_AP_PROCEDURE2 | Procedure, |
IN UINTN | TimeoutInMicroseconds, | ||
IN OUT VOID *ProcedureArguments | OPTIONAL, | ||
IN OUT MM_COMPLETION * | Token, | ||
IN OUT EFI_STATUS * | CPUStatus | ||
) |
Worker function to execute a caller provided function on all enabled APs.
[in] | Procedure | A pointer to the function to be run on enabled APs of the system. |
[in] | TimeoutInMicroseconds | Indicates the time limit in microseconds for APs to return from Procedure, either for blocking or non-blocking mode. |
[in,out] | ProcedureArguments | The parameter passed into Procedure for all APs. |
[in,out] | Token | This is an optional parameter that allows the caller to execute the procedure in a blocking or non-blocking fashion. If it is NULL the call is blocking, and the call will not return until the AP has completed the procedure. If the token is not NULL, the call will return immediately. The caller can check whether the procedure has completed with CheckOnProcedure or WaitForProcedure. |
[in,out] | CPUStatus | This optional pointer may be used to get the status code returned by Procedure when it completes execution on the target AP, or with EFI_TIMEOUT if the Procedure fails to complete within the optional timeout. The implementation will update this variable with EFI_NOT_READY prior to starting Procedure on the target AP. |
EFI_SUCCESS | In blocking mode, all APs have finished before the timeout expired. |
EFI_SUCCESS | In non-blocking mode, function has been dispatched to all enabled APs. |
others | Failed to Startup all APs. |
Definition at line 1252 of file MpService.c.
EFI_STATUS InternalSmmStartupThisAp | ( | IN EFI_AP_PROCEDURE2 | Procedure, |
IN UINTN | CpuIndex, | ||
IN OUT VOID *ProcArguments | OPTIONAL, | ||
IN OUT MM_COMPLETION * | Token, | ||
IN UINTN | TimeoutInMicroseconds, | ||
IN OUT EFI_STATUS * | CpuStatus | ||
) |
Schedule a procedure to run on the specified CPU.
[in] | Procedure | The address of the procedure to run |
[in] | CpuIndex | Target CPU Index |
[in,out] | ProcArguments | The parameter to pass to the procedure |
[in,out] | Token | This is an optional parameter that allows the caller to execute the procedure in a blocking or non-blocking fashion. If it is NULL the call is blocking, and the call will not return until the AP has completed the procedure. If the token is not NULL, the call will return immediately. The caller can check whether the procedure has completed with CheckOnProcedure or WaitForProcedure. |
[in] | TimeoutInMicroseconds | Indicates the time limit in microseconds for the APs to finish execution of Procedure, either for blocking or non-blocking mode. Zero means infinity. If the timeout expires before all APs return from Procedure, then Procedure on the failed APs is terminated. If the timeout expires in blocking mode, the call returns EFI_TIMEOUT. If the timeout expires in non-blocking mode, the timeout determined can be through CheckOnProcedure or WaitForProcedure. Note that timeout support is optional. Whether an implementation supports this feature can be determined via the Attributes data member. |
[in,out] | CpuStatus | This optional pointer may be used to get the status code returned by Procedure when it completes execution on the target AP, or with EFI_TIMEOUT if the Procedure fails to complete within the optional timeout. The implementation will update this variable with EFI_NOT_READY prior to starting Procedure on the target AP. |
EFI_INVALID_PARAMETER | CpuNumber not valid |
EFI_INVALID_PARAMETER | CpuNumber specifying BSP |
EFI_INVALID_PARAMETER | The AP specified by CpuNumber did not enter SMM |
EFI_INVALID_PARAMETER | The AP specified by CpuNumber is busy |
EFI_SUCCESS | The procedure has been successfully scheduled |
EFI_STATUS IsApReady | ( | IN SPIN_LOCK * | Token | ) |
Checks status of specified AP.
This function checks whether the specified AP has finished the task assigned by StartupThisAP(), and whether timeout expires.
[in] | Token | This parameter describes the token that was passed into DispatchProcedure or BroadcastProcedure. |
EFI_SUCCESS | Specified AP has finished task assigned by StartupThisAPs(). |
EFI_NOT_READY | Specified AP has not finished task and timeout has not expired. |
Definition at line 1082 of file MpService.c.
BOOLEAN IsNonMmramLoggingAddress | ( | IN UINT64 | Address | ) |
Return if the Address is the NonMmram logging Address.
[in] | Address | the address to be checked |
Definition at line 522 of file NonMmramMapDxeSmm.c.
Check whether it is an present AP.
CpuIndex | The AP index which calls this function. |
TRUE | It's a present AP. |
TRUE | This is not an AP or it is not present. |
Definition at line 403 of file MpService.c.
BOOLEAN IsRestrictedMemoryAccess | ( | VOID | ) |
Return whether access to non-SMRAM is restricted.
TRUE | Access to non-SMRAM is restricted. |
FALSE | Access to non-SMRAM is not restricted. |
Definition at line 17 of file SmmFuncsArchDxeSmm.c.
BOOLEAN IsSmmCommBufferForbiddenAddress | ( | IN UINT64 | Address | ) |
Return if the Address is forbidden as SMM communication buffer.
[in] | Address | the address to be checked |
Definition at line 540 of file NonMmramMapDxeSmm.c.
BOOLEAN IsSmmProfileEnabled | ( | VOID | ) |
Check SmmProfile is enabled or not.
Definition at line 34 of file PiSmmCpuDxeSmm.c.
Check if the SMM AP Sync Timer is timeout specified by Timeout.
Timer | The start timer from the begin. |
Timeout | The timeout ticker to wait. |
Definition at line 83 of file SyncTimer.c.
Checks whether the input token is the current used token.
[in] | Token | This parameter describes the token that was passed into DispatchProcedure or BroadcastProcedure. |
TRUE | The input token is the current used token. |
FALSE | The input token is not the current used token. |
Definition at line 949 of file MpService.c.
VOID PerformPreTasks | ( | VOID | ) |
Perform the pre tasks.
Definition at line 1533 of file PiSmmCpuCommon.c.
VOID PerformRemainingTasks | ( | VOID | ) |
Perform the remaining tasks.
Definition at line 46 of file PiSmmCpuDxeSmm.c.
EFI_STATUS PiSmmCpuEntryCommon | ( | VOID | ) |
The common Entry Point of the SMM CPU driver.
EFI_SUCCESS | The common entry point is executed successfully. |
Other | Some error occurs when executing this entry point. |
The module Entry Point of the CPU SMM driver.
EFI_SUCCESS | The common entry point is executed successfully. |
Other | Some error occurs when executing this entry point. |
Definition at line 740 of file PiSmmCpuCommon.c.
VOID EFIAPI PiSmmCpuSmiEntryFixupAddress | ( | ) |
This function fixes up the address of the global variable or function referred in SmiEntry assembly files to be the absolute address.
EFI_STATUS EFIAPI RegisterSmmEntry | ( | IN CONST EFI_SMM_CONFIGURATION_PROTOCOL * | This, |
IN EFI_SMM_ENTRY_POINT | SmmEntryPoint | ||
) |
Register the SMM Foundation entry point.
This | Pointer to EFI_SMM_CONFIGURATION_PROTOCOL instance |
SmmEntryPoint | SMM Foundation EntryPoint |
EFI_SUCCESS | Successfully to register SMM foundation entry point |
Definition at line 2041 of file MpService.c.
EFI_STATUS RegisterStartupProcedure | ( | IN EFI_AP_PROCEDURE | Procedure, |
IN OUT VOID *ProcedureArguments | OPTIONAL | ||
) |
Register the SMM Foundation entry point.
[in] | Procedure | A pointer to the code stream to be run on the designated target AP of the system. Type EFI_AP_PROCEDURE is defined below in Volume 2 with the related definitions of EFI_MP_SERVICES_PROTOCOL.StartupAllAPs. If caller may pass a value of NULL to deregister any existing startup procedure. |
[in,out] | ProcedureArguments | Allows the caller to pass a list of parameters to the code that is run by the AP. It is an optional common mailbox between APs and the caller to share information |
EFI_SUCCESS | The Procedure has been set successfully. |
EFI_INVALID_PARAMETER | The Procedure is NULL but ProcedureArguments not NULL. |
Definition at line 2072 of file MpService.c.
This function writes into CR2 register when on-demand paging is enabled for 64 bit and no action for 32 bit.
[in] | Cr2 | Value to write into CR2 register. |
This function returns with no action for 32 bit.
[in] | Cr2 | Value to write into CR2 register. |
This function restores CR2 register.
[in] | Cr2 | Value to write into CR2 register. |
VOID RestoreSmmConfigurationInS3 | ( | VOID | ) |
This function reads CR2 register when on-demand paging is enabled for 64 bit and no action for 32 bit.
[out] | *Cr2 | Pointer to variable to hold CR2 register value. |
This function returns with no action for 32 bit.
[out] | *Cr2 | Pointer to variable to hold CR2 register value. |
This function reads CR2 register.
[out] | *Cr2 | Pointer to variable to hold CR2 register value. |
VOID SetMemMapAttributes | ( | EDKII_PI_SMM_MEMORY_ATTRIBUTES_TABLE * | MemoryAttributesTable | ) |
This function sets memory attribute according to MemoryAttributesTable.
MemoryAttributesTable | A pointer to the buffer of SmmMemoryAttributesTable. |
Definition at line 1001 of file SmmCpuMemoryManagement.c.
VOID SetPageTableAttributes | ( | VOID | ) |
This function sets memory attribute for page table.
Definition at line 1507 of file SmmCpuMemoryManagement.c.
EFI_STATUS SetShadowStack | ( | IN UINTN | Cr3, |
IN EFI_PHYSICAL_ADDRESS | BaseAddress, | ||
IN UINT64 | Length | ||
) |
Set ShadowStack memory.
[in] | Cr3 | The page table base address. |
[in] | BaseAddress | The physical address that is the start address of a memory region. |
[in] | Length | The size in bytes of the memory region. |
EFI_SUCCESS | The shadow stack memory is set. |
Definition at line 719 of file SmmCpuMemoryManagement.c.
VOID EFIAPI SmiPFHandler | ( | IN EFI_EXCEPTION_TYPE | InterruptType, |
IN EFI_SYSTEM_CONTEXT | SystemContext | ||
) |
Page Fault handler for SMM use.
InterruptType | Defines the type of interrupt or exception that occurred on the processor.This parameter is processor architecture specific. |
SystemContext | A pointer to the processor context when the interrupt occurred on the processor. |
ThePage Fault handler wrapper for SMM use.
InterruptType | Defines the type of interrupt or exception that occurred on the processor.This parameter is processor architecture specific. |
SystemContext | A pointer to the processor context when the interrupt occurred on the processor. |
EFI_STATUS EFIAPI SmmBlockingStartupThisAp | ( | IN EFI_AP_PROCEDURE | Procedure, |
IN UINTN | CpuIndex, | ||
IN OUT VOID *ProcArguments | OPTIONAL | ||
) |
Schedule a procedure to run on the specified CPU in a blocking fashion.
Procedure | The address of the procedure to run |
CpuIndex | Target CPU Index |
ProcArguments | The parameter to pass to the procedure |
EFI_INVALID_PARAMETER | CpuNumber not valid |
EFI_INVALID_PARAMETER | CpuNumber specifying BSP |
EFI_INVALID_PARAMETER | The AP specified by CpuNumber did not enter SMM |
EFI_INVALID_PARAMETER | The AP specified by CpuNumber is busy |
EFI_SUCCESS | The procedure has been successfully scheduled |
Schedule a procedure to run on the specified CPU in blocking mode.
[in] | Procedure | The address of the procedure to run |
[in] | CpuIndex | Target CPU Index |
[in,out] | ProcArguments | The parameter to pass to the procedure |
EFI_INVALID_PARAMETER | CpuNumber not valid |
EFI_INVALID_PARAMETER | CpuNumber specifying BSP |
EFI_INVALID_PARAMETER | The AP specified by CpuNumber did not enter SMM |
EFI_INVALID_PARAMETER | The AP specified by CpuNumber is busy |
EFI_SUCCESS | The procedure has been successfully scheduled |
Definition at line 1401 of file MpService.c.
EFI_STATUS SmmClearMemoryAttributes | ( | IN EFI_PHYSICAL_ADDRESS | BaseAddress, |
IN UINT64 | Length, | ||
IN UINT64 | Attributes | ||
) |
This function clears the attributes for the memory region specified by BaseAddress and Length from their current attributes to the attributes specified by Attributes.
[in] | BaseAddress | The physical address that is the start address of a memory region. |
[in] | Length | The size in bytes of the memory region. |
[in] | Attributes | The bit mask of attributes to clear for the memory region. |
EFI_SUCCESS | The attributes were cleared for the memory region. |
EFI_ACCESS_DENIED | The attributes for the memory resource range specified by BaseAddress and Length cannot be modified. |
EFI_INVALID_PARAMETER | Length is zero. Attributes specified an illegal combination of attributes that cannot be set together. |
EFI_OUT_OF_RESOURCES | There are not enough system resources to modify the attributes of the memory resource range. |
EFI_UNSUPPORTED | The processor does not support one or more bytes of the memory resource range specified by BaseAddress and Length. The bit mask of attributes is not support for the memory resource range specified by BaseAddress and Length. |
This function clears the attributes for the memory region specified by BaseAddress and Length from their current attributes to the attributes specified by Attributes.
[in] | BaseAddress | The physical address that is the start address of a memory region. |
[in] | Length | The size in bytes of the memory region. |
[in] | Attributes | The bit mask of attributes to clear for the memory region. |
EFI_SUCCESS | The attributes were cleared for the memory region. |
EFI_ACCESS_DENIED | The attributes for the memory resource range specified by BaseAddress and Length cannot be modified. |
EFI_INVALID_PARAMETER | Length is zero. Attributes specified an illegal combination of attributes that cannot be cleared together. |
EFI_OUT_OF_RESOURCES | There are not enough system resources to modify the attributes of the memory resource range. |
EFI_UNSUPPORTED | The processor does not support one or more bytes of the memory resource range specified by BaseAddress and Length. The bit mask of attributes is not supported for the memory resource range specified by BaseAddress and Length. |
Definition at line 697 of file SmmCpuMemoryManagement.c.
EFI_STATUS SmmClearMemoryAttributesEx | ( | IN UINTN | PageTableBase, |
IN PAGING_MODE | PagingMode, | ||
IN EFI_PHYSICAL_ADDRESS | BaseAddress, | ||
IN UINT64 | Length, | ||
IN UINT64 | Attributes | ||
) |
This function clears the attributes for the memory region specified by BaseAddress and Length from their current attributes to the attributes specified by Attributes.
[in] | PageTableBase | The page table base. |
[in] | PagingMode | The paging mode. |
[in] | BaseAddress | The physical address that is the start address of a memory region. |
[in] | Length | The size in bytes of the memory region. |
[in] | Attributes | The bit mask of attributes to clear for the memory region. |
EFI_SUCCESS | The attributes were cleared for the memory region. |
EFI_ACCESS_DENIED | The attributes for the memory resource range specified by BaseAddress and Length cannot be modified. |
EFI_INVALID_PARAMETER | Length is zero. Attributes specified an illegal combination of attributes that cannot be cleared together. |
EFI_OUT_OF_RESOURCES | There are not enough system resources to modify the attributes of the memory resource range. |
EFI_UNSUPPORTED | The processor does not support one or more bytes of the memory resource range specified by BaseAddress and Length. The bit mask of attributes is not supported for the memory resource range specified by BaseAddress and Length. |
Definition at line 615 of file SmmCpuMemoryManagement.c.
EFI_STATUS EFIAPI SmmCpuRendezvous | ( | IN EDKII_SMM_CPU_RENDEZVOUS_PROTOCOL * | This, |
IN BOOLEAN | BlockingMode | ||
) |
Choose blocking or non-blocking mode to Wait for all APs.
[in] | This | A pointer to the EDKII_SMM_CPU_RENDEZVOUS_PROTOCOL instance. |
[in] | BlockingMode | Blocking or non-blocking mode. |
EFI_SUCCESS | All APs have arrived SMM mode except SMI disabled APs. |
EFI_TIMEOUT | There are APs not in SMM mode in given timeout constraint. |
Wait for all processors enterring SMM until all CPUs are already synchronized or not.
If BlockingMode is False, timeout value is zero.
This | A pointer to the EDKII_SMM_CPU_RENDEZVOUS_PROTOCOL instance. |
BlockingMode | Blocking mode or non-blocking mode. |
EFI_SUCCESS | All avaiable APs arrived. |
EFI_TIMEOUT | Wait for all APs until timeout. |
Definition at line 414 of file CpuService.c.
EFI_STATUS EFIAPI SmmGetSystemConfigurationTable | ( | IN EFI_GUID * | TableGuid, |
OUT VOID ** | Table | ||
) |
Retrieves a pointer to the system configuration table from the SMM System Table based on a specified GUID.
[in] | TableGuid | The pointer to table's GUID type. |
[out] | Table | The pointer to the table associated with TableGuid in the EFI System Table. |
EFI_SUCCESS | A configuration table matching TableGuid was found. |
EFI_NOT_FOUND | A configuration table matching TableGuid could not be found. |
Definition at line 747 of file SmmCpuMemoryManagement.c.
UINT32 SmmInitPageTable | ( | VOID | ) |
EFI_STATUS EFIAPI SmmReadSaveState | ( | IN CONST EFI_SMM_CPU_PROTOCOL * | This, |
IN UINTN | Width, | ||
IN EFI_SMM_SAVE_STATE_REGISTER | Register, | ||
IN UINTN | CpuIndex, | ||
OUT VOID * | Buffer | ||
) |
Read information from the CPU save state.
This | EFI_SMM_CPU_PROTOCOL instance |
Width | The number of bytes to read from the CPU save state. |
Register | Specifies the CPU register to read form the save state. |
CpuIndex | Specifies the zero-based index of the CPU save state |
Buffer | Upon return, this holds the CPU register value read from the save state. |
EFI_SUCCESS | The register was read from Save State |
EFI_NOT_FOUND | The register is not defined for the Save State of Processor |
EFI_INVALID_PARAMETER | This or Buffer is NULL. |
Read information from the CPU save state.
This | EFI_SMM_CPU_PROTOCOL instance |
Width | The number of bytes to read from the CPU save state. |
Register | Specifies the CPU register to read form the save state. |
CpuIndex | Specifies the zero-based index of the CPU save state. |
Buffer | Upon return, this holds the CPU register value read from the save state. |
EFI_SUCCESS | The register was read from Save State |
EFI_NOT_FOUND | The register is not defined for the Save State of Processor |
EFI_INVALID_PARAMETER | This or Buffer is NULL. |
Definition at line 217 of file PiSmmCpuCommon.c.
VOID EFIAPI SmmRelocationSemaphoreComplete | ( | VOID | ) |
Semaphore operation for all processor relocate SMMBase.
EFI_STATUS SmmSetMemoryAttributes | ( | IN EFI_PHYSICAL_ADDRESS | BaseAddress, |
IN UINT64 | Length, | ||
IN UINT64 | Attributes | ||
) |
This function sets the attributes for the memory region specified by BaseAddress and Length from their current attributes to the attributes specified by Attributes.
[in] | BaseAddress | The physical address that is the start address of a memory region. |
[in] | Length | The size in bytes of the memory region. |
[in] | Attributes | The bit mask of attributes to set for the memory region. |
EFI_SUCCESS | The attributes were set for the memory region. |
EFI_ACCESS_DENIED | The attributes for the memory resource range specified by BaseAddress and Length cannot be modified. |
EFI_INVALID_PARAMETER | Length is zero. Attributes specified an illegal combination of attributes that cannot be set together. |
EFI_OUT_OF_RESOURCES | There are not enough system resources to modify the attributes of the memory resource range. |
EFI_UNSUPPORTED | The processor does not support one or more bytes of the memory resource range specified by BaseAddress and Length. The bit mask of attributes is not support for the memory resource range specified by BaseAddress and Length. |
This function sets the attributes for the memory region specified by BaseAddress and Length from their current attributes to the attributes specified by Attributes.
[in] | BaseAddress | The physical address that is the start address of a memory region. |
[in] | Length | The size in bytes of the memory region. |
[in] | Attributes | The bit mask of attributes to set for the memory region. |
EFI_SUCCESS | The attributes were set for the memory region. |
EFI_ACCESS_DENIED | The attributes for the memory resource range specified by BaseAddress and Length cannot be modified. |
EFI_INVALID_PARAMETER | Length is zero. Attributes specified an illegal combination of attributes that cannot be set together. |
EFI_OUT_OF_RESOURCES | There are not enough system resources to modify the attributes of the memory resource range. |
EFI_UNSUPPORTED | The processor does not support one or more bytes of the memory resource range specified by BaseAddress and Length. The bit mask of attributes is not supported for the memory resource range specified by BaseAddress and Length. |
Definition at line 662 of file SmmCpuMemoryManagement.c.
EFI_STATUS SmmSetMemoryAttributesEx | ( | IN UINTN | PageTableBase, |
IN PAGING_MODE | PagingMode, | ||
IN EFI_PHYSICAL_ADDRESS | BaseAddress, | ||
IN UINT64 | Length, | ||
IN UINT64 | Attributes | ||
) |
This function sets the attributes for the memory region specified by BaseAddress and Length from their current attributes to the attributes specified by Attributes.
[in] | PageTableBase | The page table base. |
[in] | PagingMode | The paging mode. |
[in] | BaseAddress | The physical address that is the start address of a memory region. |
[in] | Length | The size in bytes of the memory region. |
[in] | Attributes | The bit mask of attributes to set for the memory region. |
EFI_SUCCESS | The attributes were set for the memory region. |
EFI_ACCESS_DENIED | The attributes for the memory resource range specified by BaseAddress and Length cannot be modified. |
EFI_INVALID_PARAMETER | Length is zero. Attributes specified an illegal combination of attributes that cannot be set together. |
EFI_OUT_OF_RESOURCES | There are not enough system resources to modify the attributes of the memory resource range. |
EFI_UNSUPPORTED | The processor does not support one or more bytes of the memory resource range specified by BaseAddress and Length. The bit mask of attributes is not support for the memory resource range specified by BaseAddress and Length. |
Definition at line 566 of file SmmCpuMemoryManagement.c.
EFI_STATUS EFIAPI SmmStartupThisAp | ( | IN EFI_AP_PROCEDURE | Procedure, |
IN UINTN | CpuIndex, | ||
IN OUT VOID *ProcArguments | OPTIONAL | ||
) |
Schedule a procedure to run on the specified CPU.
Procedure | The address of the procedure to run |
CpuIndex | Target CPU number |
ProcArguments | The parameter to pass to the procedure |
EFI_INVALID_PARAMETER | CpuNumber not valid |
EFI_INVALID_PARAMETER | CpuNumber specifying BSP |
EFI_INVALID_PARAMETER | The AP specified by CpuNumber did not enter SMM |
EFI_INVALID_PARAMETER | The AP specified by CpuNumber is busy |
EFI_SUCCESS | - The procedure has been successfully scheduled |
Schedule a procedure to run on the specified CPU.
Procedure | The address of the procedure to run |
CpuIndex | Target CPU Index |
ProcArguments | The parameter to pass to the procedure |
EFI_INVALID_PARAMETER | CpuNumber not valid |
EFI_INVALID_PARAMETER | CpuNumber specifying BSP |
EFI_INVALID_PARAMETER | The AP specified by CpuNumber did not enter SMM |
EFI_INVALID_PARAMETER | The AP specified by CpuNumber is busy |
EFI_SUCCESS | The procedure has been successfully scheduled |
Definition at line 1434 of file MpService.c.
VOID SmmWaitForApArrival | ( | VOID | ) |
Insure when this function returns, no AP will execute normal mode code before entering SMM, except SMI disabled APs.
Given timeout constraint, wait for all APs to arrive, and insure when this function returns, no AP will execute normal mode code before entering SMM, except SMI disabled APs.
Definition at line 231 of file MpService.c.
VOID SmmWriteProtectReadOnlyPage | ( | IN BOOLEAN | WriteProtect | ) |
Write protect read-only pages.
[in] | WriteProtect | If Cr0.Bits.WP should be enabled. |
Definition at line 52 of file SmmCpuMemoryManagement.c.
EFI_STATUS EFIAPI SmmWriteSaveState | ( | IN CONST EFI_SMM_CPU_PROTOCOL * | This, |
IN UINTN | Width, | ||
IN EFI_SMM_SAVE_STATE_REGISTER | Register, | ||
IN UINTN | CpuIndex, | ||
IN CONST VOID * | Buffer | ||
) |
Write data to the CPU save state.
This | EFI_SMM_CPU_PROTOCOL instance |
Width | The number of bytes to read from the CPU save state. |
Register | Specifies the CPU register to write to the save state. |
CpuIndex | Specifies the zero-based index of the CPU save state |
Buffer | Upon entry, this holds the new CPU register value. |
EFI_SUCCESS | The register was written from Save State |
EFI_NOT_FOUND | The register is not defined for the Save State of Processor |
EFI_INVALID_PARAMETER | ProcessorIndex or Width is not correct |
Definition at line 289 of file PiSmmCpuCommon.c.
VOID SmmWriteUnprotectReadOnlyPage | ( | OUT BOOLEAN * | WriteProtect | ) |
Write unprotect read-only pages if Cr0.Bits.WP is 1.
[out] | WriteProtect | If Cr0.Bits.WP is enabled. |
Definition at line 31 of file SmmCpuMemoryManagement.c.
UINT64 EFIAPI StartSyncTimer | ( | VOID | ) |
Start Timer for SMM AP Sync.
Definition at line 67 of file SyncTimer.c.
VOID UpdateUefiMemMapAttributes | ( | VOID | ) |
This function updates UEFI memory attribute according to UEFI memory map.
Definition at line 318 of file NonMmramMapDxeSmm.c.
|
extern |
Definition at line 17 of file MpService.c.
|
extern |
Definition at line 57 of file PiSmmCpuCommon.c.
|
extern |
Definition at line 11 of file SmmCpuMemoryManagement.c.
|
extern |
Definition at line 78 of file PiSmmCore.c.
|
extern |
Definition at line 21 of file ScriptExecute.c.
|
extern |
Definition at line 84 of file PiSmmCpuCommon.c.
|
extern |
Definition at line 94 of file PiSmmCpuCommon.c.
|
extern |
Definition at line 117 of file PiSmmCpuCommon.c.
|
extern |
Definition at line 42 of file CpuHotplug.c.
|
extern |
Definition at line 13 of file SmmFuncsArch.c.
|
extern |
Definition at line 14 of file SmmFuncsArch.c.
|
extern |
Definition at line 19 of file PiSmmCpuDxeSmm.c.
|
extern |
Definition at line 16 of file SmmRelocationLib.c.
|
extern |
Definition at line 17 of file SmmRelocationLib.c.
|
extern |
Definition at line 12 of file SmmCpuMemoryManagement.c.
X86_ASSEMBLY_PATCH_LABEL mPatchCetSupported |
Definition at line 378 of file PiSmmCpuCommon.h.
|
extern |
Definition at line 22 of file MpService.c.
|
extern |
Definition at line 125 of file PiSmmCpuCommon.c.
|
extern |
Definition at line 21 of file MpService.c.
|
extern |
Definition at line 102 of file PiSmmCpuCommon.c.
|
extern |
SMM CPU Protocol instance
Definition at line 67 of file PiSmmCpuCommon.c.
|
extern |
Definition at line 20 of file MpService.c.
|
extern |
Definition at line 14 of file CpuService.c.
|
extern |
Definition at line 123 of file PiSmmCpuCommon.c.
|
extern |
Definition at line 122 of file PiSmmCpuCommon.c.
|
extern |
Definition at line 107 of file PiSmmCpuCommon.c.
|
extern |
Definition at line 83 of file PiSmmCpuCommon.c.
|
extern |
|
extern |
Definition at line 18 of file MpService.c.
|
extern |
The mode of the CPU at the time an SMI occurs
Definition at line 26 of file AmdSmmCpuFeaturesLib.c.
|
extern |
Definition at line 93 of file PiSmmCpuCommon.c.
|
extern |
Definition at line 89 of file PiSmmCpuCommon.c.
|
extern |
Definition at line 90 of file PiSmmCpuCommon.c.
|
extern |
Definition at line 91 of file PiSmmCpuCommon.c.
|
extern |
Definition at line 11 of file SyncTimer.c.
|
extern |
Definition at line 13 of file SyncTimer.c.