40#define SMRAM_CAPABILITIES (EFI_MEMORY_WB | EFI_MEMORY_UC)
112 IN OUT VOID *CommBuffer,
144 IN OUT VOID *CommBufferPhysical,
145 IN OUT VOID *CommBufferVirtual,
307BOOLEAN mSmmLocked =
FALSE;
310UINT64 mSmramCacheSize;
394 OUT UINT64 *SmramCacheSize
399 UINT64 RangePhysicalSize;
400 BOOLEAN FoundAjacentRange;
402 *SmramCacheBase = SmramRange->CpuStart;
403 *SmramCacheSize = SmramRange->PhysicalSize;
406 FoundAjacentRange =
FALSE;
410 if ((RangeCpuStart < *SmramCacheBase) && (*SmramCacheBase == (RangeCpuStart + RangePhysicalSize))) {
411 *SmramCacheBase = RangeCpuStart;
412 *SmramCacheSize += RangePhysicalSize;
413 FoundAjacentRange =
TRUE;
414 }
else if (((*SmramCacheBase + *SmramCacheSize) == RangeCpuStart) && (RangePhysicalSize > 0)) {
415 *SmramCacheSize += RangePhysicalSize;
416 FoundAjacentRange =
TRUE;
419 }
while (FoundAjacentRange);
440 if (InSmram ==
NULL) {
441 return EFI_INVALID_PARAMETER;
444 *InSmram = gSmmCorePrivate->
InSmm;
467 if ((This ==
NULL) || (Smst ==
NULL)) {
468 return EFI_INVALID_PARAMETER;
471 if (!gSmmCorePrivate->
InSmm) {
472 return EFI_UNSUPPORTED;
475 *Smst = gSmmCorePrivate->
Smst;
510 IN OUT VOID *CommBuffer,
522 if (CommBuffer ==
NULL) {
523 return EFI_INVALID_PARAMETER;
528 if (CommSize ==
NULL) {
531 TempCommSize = *CommSize;
536 return EFI_INVALID_PARAMETER;
553 Status = mSmmControl2->Trigger (mSmmControl2,
NULL,
NULL,
FALSE, 0);
554 if (EFI_ERROR (Status)) {
555 return EFI_UNSUPPORTED;
561 if (CommSize !=
NULL) {
575 return EFI_INVALID_PARAMETER;
582 return EFI_INVALID_PARAMETER;
588 OldInSmm = gSmmCorePrivate->
InSmm;
598 CommunicateHeader->
Data,
602 if (CommSize !=
NULL) {
603 *CommSize = TempCommSize;
609 gSmmCorePrivate->
InSmm = OldInSmm;
642 IN OUT VOID *CommBufferPhysical,
643 IN OUT VOID *CommBufferVirtual,
675 mCommunicateHeader.
Data[0] = 0;
680 Size =
sizeof (mCommunicateHeader);
729 mCommunicateHeader.
Data[0] = 0;
734 Size =
sizeof (mCommunicateHeader);
740 if (mCommunicateHeader.
Data[0] != COMM_BUFFER_SMM_DISPATCH_RESTART) {
749 Status = mSmmAccess->Close (mSmmAccess);
755 DEBUG ((DEBUG_INFO,
"SMM IPL closed SMRAM window\n"));
779 Status =
gBS->LocateProtocol (Context,
NULL, (VOID **)&SmmConfiguration);
780 if (EFI_ERROR (Status)) {
787 Status = SmmConfiguration->RegisterSmmEntry (SmmConfiguration, gSmmCorePrivate->
SmmEntryPoint);
799 DEBUG ((DEBUG_INFO,
"SMM IPL registered SMM Entry Point address %p\n", (VOID *)(
UINTN)gSmmCorePrivate->
SmmEntryPoint));
832 Status =
gBS->LocateProtocol (&gEfiDxeSmmReadyToLockProtocolGuid,
NULL, &Interface);
833 if (EFI_ERROR (Status)) {
842 DEBUG ((DEBUG_WARN,
"SMM IPL! DXE SMM Ready To Lock Protocol not installed before Ready To Boot signal\n"));
846 DEBUG ((DEBUG_ERROR,
"EndOfDxe Event must be signaled before DxeSmmReadyToLock Protocol installation!\n"));
848 EFI_ERROR_CODE | EFI_ERROR_UNRECOVERED,
849 (EFI_SOFTWARE_SMM_DRIVER | EFI_SW_EC_ILLEGAL_SOFTWARE_STATE)
857 mSmmAccess->Lock (mSmmAccess);
864 for (Index = 0; mSmmIplEvents[Index].NotifyFunction !=
NULL; Index++) {
865 if (mSmmIplEvents[Index].CloseOnLock) {
866 gBS->CloseEvent (mSmmIplEvents[Index].Event);
878 DEBUG ((DEBUG_INFO,
"SMM IPL locked SMRAM window\n"));
920 UINTN SectionHeaderOffset;
927 UINT16 NumberOfSections;
930 UINT64 ValueInSectionHeader;
937 FixLoadingAddress = 0;
938 Status = EFI_NOT_FOUND;
939 SmramBase = mLMFAConfigurationTable->
SmramBase;
944 SectionHeaderOffset = ImageContext->PeCoffHeaderOffset +
947 ImgHdr->Pe32.FileHeader.SizeOfOptionalHeader;
948 NumberOfSections = ImgHdr->Pe32.FileHeader.NumberOfSections;
953 for (Index = 0; Index < NumberOfSections; Index++) {
958 Status = ImageContext->ImageRead (
959 ImageContext->Handle,
964 if (EFI_ERROR (Status)) {
968 Status = EFI_NOT_FOUND;
977 ValueInSectionHeader =
ReadUnaligned64 ((UINT64 *)&SectionHeader.PointerToRelocations);
978 if (ValueInSectionHeader != 0) {
985 if ((SmramBase + SmmCodeSize > FixLoadingAddress) && (SmramBase <= FixLoadingAddress)) {
989 ImageContext->ImageAddress = FixLoadingAddress;
1000 DEBUG ((DEBUG_INFO|DEBUG_LOAD,
"LOADING MODULE FIXED INFO: Loading module at fixed address %x, Status = %r \n", FixLoadingAddress, Status));
1035 EFI_FV_FILETYPE_SMM_CORE,
1042 if (EFI_ERROR (Status)) {
1049 ImageContext.
Handle = SourceBuffer;
1056 if (EFI_ERROR (Status)) {
1064 if (
PcdGet64 (PcdLoadModuleAtFixAddressEnable) != 0) {
1069 if (!EFI_ERROR (Status)) {
1079 DEBUG ((DEBUG_INFO,
"LOADING MODULE FIXED ERROR: Loading module at fixed address at address failed\n"));
1086 ASSERT ((SmramRange->PhysicalSize & EFI_PAGE_MASK) == 0);
1090 SmramRangeSmmCore->CpuStart = SmramRange->CpuStart + SmramRange->PhysicalSize;
1091 SmramRangeSmmCore->PhysicalStart = SmramRange->PhysicalStart + SmramRange->PhysicalSize;
1092 SmramRangeSmmCore->RegionState = SmramRange->RegionState | EFI_ALLOCATED;
1098 ImageContext.
ImageAddress = SmramRangeSmmCore->CpuStart;
1107 ASSERT ((SmramRange->PhysicalSize & EFI_PAGE_MASK) == 0);
1111 SmramRangeSmmCore->CpuStart = SmramRange->CpuStart + SmramRange->PhysicalSize;
1112 SmramRangeSmmCore->PhysicalStart = SmramRange->PhysicalStart + SmramRange->PhysicalSize;
1113 SmramRangeSmmCore->RegionState = SmramRange->RegionState | EFI_ALLOCATED;
1119 ImageContext.
ImageAddress = SmramRangeSmmCore->CpuStart;
1128 DEBUG ((DEBUG_INFO,
"SMM IPL loading SMM Core at SMRAM address %p\n", (VOID *)(
UINTN)ImageContext.
ImageAddress));
1134 if (!EFI_ERROR (Status)) {
1139 if (!EFI_ERROR (Status)) {
1148 DEBUG ((DEBUG_INFO,
"SMM IPL calling SMM Core at SMRAM address %p\n", (VOID *)(
UINTN)ImageContext.
EntryPoint));
1150 gSmmCorePrivate->PiSmmCoreImageBase = ImageContext.
ImageAddress;
1151 gSmmCorePrivate->PiSmmCoreImageSize = ImageContext.
ImageSize;
1152 DEBUG ((DEBUG_INFO,
"PiSmmCoreImageBase - 0x%016lx\n", gSmmCorePrivate->PiSmmCoreImageBase));
1153 DEBUG ((DEBUG_INFO,
"PiSmmCoreImageSize - 0x%016lx\n", gSmmCorePrivate->PiSmmCoreImageSize));
1155 gSmmCorePrivate->PiSmmCoreEntryPoint = ImageContext.
EntryPoint;
1199 UINT64 RangeToCompareEnd;
1200 UINT64 ReservedRangeToCompareEnd;
1202 RangeToCompareEnd = RangeToCompare->CpuStart + RangeToCompare->PhysicalSize;
1203 ReservedRangeToCompareEnd = ReservedRangeToCompare->SmramReservedStart + ReservedRangeToCompare->SmramReservedSize;
1205 if ((RangeToCompare->CpuStart >= ReservedRangeToCompare->SmramReservedStart) &&
1206 (RangeToCompare->CpuStart < ReservedRangeToCompareEnd))
1208 if (RangeToCompareEnd < ReservedRangeToCompareEnd) {
1225 ReservedRangeToCompare->SmramReservedSize = RangeToCompare->CpuStart - ReservedRangeToCompare->SmramReservedStart;
1230 FinalRanges[*FinalRangeCount].CpuStart = RangeToCompare->CpuStart;
1231 FinalRanges[*FinalRangeCount].PhysicalStart = RangeToCompare->PhysicalStart;
1232 FinalRanges[*FinalRangeCount].RegionState = RangeToCompare->RegionState | EFI_ALLOCATED;
1233 FinalRanges[*FinalRangeCount].PhysicalSize = RangeToCompare->PhysicalSize;
1234 *FinalRangeCount += 1;
1235 RangeToCompare->PhysicalSize = 0;
1239 ReservedRanges[*ReservedRangeCount].SmramReservedStart = FinalRanges[*FinalRangeCount - 1].CpuStart + FinalRanges[*FinalRangeCount - 1].PhysicalSize;
1240 ReservedRanges[*ReservedRangeCount].SmramReservedSize = ReservedRangeToCompareEnd - RangeToCompareEnd;
1241 *ReservedRangeCount += 1;
1259 ReservedRangeToCompare->SmramReservedSize = RangeToCompare->CpuStart - ReservedRangeToCompare->SmramReservedStart;
1263 FinalRanges[*FinalRangeCount].CpuStart = RangeToCompare->CpuStart;
1264 FinalRanges[*FinalRangeCount].PhysicalStart = RangeToCompare->PhysicalStart;
1265 FinalRanges[*FinalRangeCount].RegionState = RangeToCompare->RegionState | EFI_ALLOCATED;
1266 FinalRanges[*FinalRangeCount].PhysicalSize = ReservedRangeToCompareEnd - RangeToCompare->CpuStart;
1267 *FinalRangeCount += 1;
1271 RangeToCompare->CpuStart += FinalRanges[*FinalRangeCount - 1].PhysicalSize;
1272 RangeToCompare->PhysicalStart += FinalRanges[*FinalRangeCount - 1].PhysicalSize;
1273 RangeToCompare->PhysicalSize -= FinalRanges[*FinalRangeCount - 1].PhysicalSize;
1275 }
else if ((ReservedRangeToCompare->SmramReservedStart >= RangeToCompare->CpuStart) &&
1276 (ReservedRangeToCompare->SmramReservedStart < RangeToCompareEnd))
1278 if (ReservedRangeToCompareEnd < RangeToCompareEnd) {
1295 RangeToCompare->PhysicalSize = ReservedRangeToCompare->SmramReservedStart - RangeToCompare->CpuStart;
1300 FinalRanges[*FinalRangeCount].CpuStart = ReservedRangeToCompare->SmramReservedStart;
1301 FinalRanges[*FinalRangeCount].PhysicalStart = RangeToCompare->PhysicalStart + RangeToCompare->PhysicalSize;
1302 FinalRanges[*FinalRangeCount].RegionState = RangeToCompare->RegionState | EFI_ALLOCATED;
1303 FinalRanges[*FinalRangeCount].PhysicalSize = ReservedRangeToCompare->SmramReservedSize;
1304 *FinalRangeCount += 1;
1305 ReservedRangeToCompare->SmramReservedSize = 0;
1309 Ranges[*RangeCount].CpuStart = FinalRanges[*FinalRangeCount - 1].CpuStart + FinalRanges[*FinalRangeCount - 1].PhysicalSize;
1310 Ranges[*RangeCount].PhysicalStart = FinalRanges[*FinalRangeCount - 1].PhysicalStart + FinalRanges[*FinalRangeCount - 1].PhysicalSize;
1311 Ranges[*RangeCount].RegionState = RangeToCompare->RegionState;
1312 Ranges[*RangeCount].PhysicalSize = RangeToCompareEnd - ReservedRangeToCompareEnd;
1331 RangeToCompare->PhysicalSize = ReservedRangeToCompare->SmramReservedStart - RangeToCompare->CpuStart;
1336 FinalRanges[*FinalRangeCount].CpuStart = ReservedRangeToCompare->SmramReservedStart;
1337 FinalRanges[*FinalRangeCount].PhysicalStart = RangeToCompare->PhysicalStart + RangeToCompare->PhysicalSize;
1338 FinalRanges[*FinalRangeCount].RegionState = RangeToCompare->RegionState | EFI_ALLOCATED;
1339 FinalRanges[*FinalRangeCount].PhysicalSize = RangeToCompareEnd - ReservedRangeToCompare->SmramReservedStart;
1340 *FinalRangeCount += 1;
1344 ReservedRangeToCompare->SmramReservedStart += FinalRanges[*FinalRangeCount - 1].PhysicalSize;
1345 ReservedRangeToCompare->SmramReservedSize -= FinalRanges[*FinalRangeCount - 1].PhysicalSize;
1367 UINT64 RangeToCompareEnd;
1368 UINT64 ReservedRangeToCompareEnd;
1369 BOOLEAN IsOverUnderflow1;
1370 BOOLEAN IsOverUnderflow2;
1373 IsOverUnderflow1 = EFI_ERROR (
1375 (UINT64)RangeToCompare->CpuStart,
1376 RangeToCompare->PhysicalSize,
1380 IsOverUnderflow2 = EFI_ERROR (
1382 (UINT64)ReservedRangeToCompare->SmramReservedStart,
1383 ReservedRangeToCompare->SmramReservedSize,
1384 &ReservedRangeToCompareEnd
1387 if (IsOverUnderflow1 || IsOverUnderflow2) {
1391 if ((RangeToCompare->CpuStart >= ReservedRangeToCompare->SmramReservedStart) &&
1392 (RangeToCompare->CpuStart < ReservedRangeToCompareEnd))
1395 }
else if ((ReservedRangeToCompare->SmramReservedStart >= RangeToCompare->CpuStart) &&
1396 (ReservedRangeToCompare->SmramReservedStart < RangeToCompareEnd))
1427 UINTN TempSmramRangeCount;
1428 UINTN AdditionSmramRangeCount;
1430 UINTN SmramRangeCount;
1432 UINTN SmramReservedCount;
1440 SmmConfiguration =
NULL;
1441 Status =
gBS->LocateProtocol (&gEfiSmmConfigurationProtocolGuid,
NULL, (VOID **)&SmmConfiguration);
1447 Status = mSmmAccess->GetCapabilities (mSmmAccess, &Size,
NULL);
1448 ASSERT (Status == EFI_BUFFER_TOO_SMALL);
1455 SmramReservedCount = 0;
1456 if (SmmConfiguration !=
NULL) {
1458 SmramReservedCount++;
1465 AdditionSmramRangeCount = 1;
1466 if (
PcdGet64 (PcdLoadModuleAtFixAddressEnable) != 0) {
1470 AdditionSmramRangeCount = 2;
1473 if (SmramReservedCount == 0) {
1477 *FullSmramRangeCount = SmramRangeCount + AdditionSmramRangeCount;
1480 ASSERT (FullSmramRanges !=
NULL);
1482 Status = mSmmAccess->GetCapabilities (mSmmAccess, &Size, FullSmramRanges);
1485 return FullSmramRanges;
1523 MaxCount = SmramRangeCount + 2 * SmramReservedCount;
1527 ASSERT (SmramReservedRanges !=
NULL);
1528 for (Index = 0; Index < SmramReservedCount; Index++) {
1534 ASSERT (TempSmramRanges !=
NULL);
1535 TempSmramRangeCount = 0;
1538 ASSERT (SmramRanges !=
NULL);
1539 Status = mSmmAccess->GetCapabilities (mSmmAccess, &Size, SmramRanges);
1544 for (Index = 0; (Index < SmramRangeCount) && !Rescan; Index++) {
1548 if (SmramRanges[Index].PhysicalSize != 0) {
1549 for (Index2 = 0; (Index2 < SmramReservedCount) && !Rescan; Index2++) {
1553 if (SmramReservedRanges[Index2].SmramReservedSize != 0) {
1555 &SmramRanges[Index],
1556 &SmramReservedRanges[Index2]
1563 &SmramRanges[Index],
1564 &SmramReservedRanges[Index2],
1567 SmramReservedRanges,
1568 &SmramReservedCount,
1570 &TempSmramRangeCount
1589 ASSERT (TempSmramRangeCount <= MaxCount);
1595 ASSERT (FullSmramRanges !=
NULL);
1596 *FullSmramRangeCount = 0;
1598 for (Index = 0; Index < TempSmramRangeCount; Index++) {
1599 if (TempSmramRanges[Index].PhysicalSize != 0) {
1604 ASSERT (Index < TempSmramRangeCount);
1605 for (Index2 = 0; Index2 < TempSmramRangeCount; Index2++) {
1606 if ((Index2 != Index) && (TempSmramRanges[Index2].PhysicalSize != 0) && (TempSmramRanges[Index2].CpuStart < TempSmramRanges[Index].CpuStart)) {
1612 *FullSmramRangeCount += 1;
1614 }
while (*FullSmramRangeCount < TempSmramRangeCount);
1616 ASSERT (*FullSmramRangeCount == TempSmramRangeCount);
1617 *FullSmramRangeCount += AdditionSmramRangeCount;
1623 return FullSmramRanges;
1667 Status =
gBS->LocateProtocol (&gEfiSmmAccess2ProtocolGuid,
NULL, (VOID **)&mSmmAccess);
1673 Status =
gBS->LocateProtocol (&gEfiSmmControl2ProtocolGuid,
NULL, (VOID **)&mSmmControl2);
1681 Status = mSmmAccess->Open (mSmmAccess);
1687 DEBUG ((DEBUG_INFO,
"SMM IPL opened SMRAM window\n"));
1692 mCurrentSmramRange =
NULL;
1693 for (Index = 0, MaxSize = SIZE_256KB - EFI_PAGE_SIZE; Index < gSmmCorePrivate->
SmramRangeCount; Index++) {
1697 if ((gSmmCorePrivate->
SmramRanges[Index].
RegionState & (EFI_ALLOCATED | EFI_NEEDS_TESTING | EFI_NEEDS_ECC_INITIALIZATION)) != 0) {
1705 mCurrentSmramRange = &gSmmCorePrivate->
SmramRanges[Index];
1711 if (mCurrentSmramRange !=
NULL) {
1717 "SMM IPL found SMRAM window %p - %p\n",
1726 Status =
gDS->GetMemorySpaceDescriptor (
1731 if ((MemDesc.
Capabilities & SMRAM_CAPABILITIES) != SMRAM_CAPABILITIES) {
1732 gDS->SetMemorySpaceCapabilities (
1746 Status =
gBS->LocateProtocol (&gEfiCpuArchProtocolGuid,
NULL, (VOID **)&CpuArch);
1747 if (!EFI_ERROR (Status)) {
1748 MemDesc.
Attributes &= ~(EFI_CACHE_ATTRIBUTE_MASK | EFI_MEMORY_ATTRIBUTE_MASK);
1750 Status =
gDS->SetMemorySpaceAttributes (
1755 if (EFI_ERROR (Status)) {
1756 DEBUG ((DEBUG_WARN,
"SMM IPL failed to set SMRAM window to EFI_MEMORY_WB\n"));
1760 gDS->GetMemorySpaceDescriptor (
1764 DEBUG ((DEBUG_INFO,
"SMRAM attributes: %016lx\n", MemDesc.
Attributes));
1765 ASSERT ((MemDesc.
Attributes & EFI_MEMORY_ATTRIBUTE_MASK) == 0);
1773 if (
PcdGet64 (PcdLoadModuleAtFixAddressEnable) != 0) {
1777 SmmCodeSize =
LShiftU64 (
PcdGet32 (PcdLoadFixAddressSmmCodePageNumber), EFI_PAGE_SHIFT);
1781 ASSERT (mCurrentSmramRange->
PhysicalSize > SmmCodeSize);
1786 &gLoadFixedAddressConfigurationTableGuid,
1787 (VOID **)&mLMFAConfigurationTable
1789 if (!EFI_ERROR (Status) && (mLMFAConfigurationTable !=
NULL)) {
1794 DEBUG ((DEBUG_INFO,
"LOADING MODULE FIXED INFO: TSEG BASE is %x. \n", mLMFAConfigurationTable->
SmramBase));
1819 if (EFI_ERROR (Status)) {
1823 DEBUG ((DEBUG_ERROR,
"SMM IPL could not load and execute SMM Core from SMRAM\n"));
1828 if (CpuArch !=
NULL) {
1829 SetAttrStatus =
gDS->SetMemorySpaceAttributes (
1834 if (EFI_ERROR (SetAttrStatus)) {
1835 DEBUG ((DEBUG_WARN,
"SMM IPL failed to reset SMRAM window to EFI_MEMORY_UC\n"));
1843 DEBUG ((DEBUG_ERROR,
"SMM IPL could not find a large enough SMRAM region to load SMM Core\n"));
1850 if ((mCurrentSmramRange ==
NULL) || EFI_ERROR (Status)) {
1854 Status = mSmmAccess->Close (mSmmAccess);
1860 DEBUG ((DEBUG_INFO,
"SMM IPL closed SMRAM window\n"));
1867 return EFI_UNSUPPORTED;
1873 Status =
gBS->InstallMultipleProtocolInterfaces (
1875 &gEfiSmmBase2ProtocolGuid,
1877 &gEfiSmmCommunicationProtocolGuid,
1879 &gEfiMmCommunication2ProtocolGuid,
1888 for (Index = 0; mSmmIplEvents[Index].NotifyFunction !=
NULL; Index++) {
1889 if (mSmmIplEvents[Index].Protocol) {
1891 mSmmIplEvents[Index].Guid,
1892 mSmmIplEvents[Index].NotifyTpl,
1894 mSmmIplEvents[Index].NotifyContext,
1898 Status =
gBS->CreateEventEx (
1900 mSmmIplEvents[Index].NotifyTpl,
1902 mSmmIplEvents[Index].NotifyContext,
1903 mSmmIplEvents[Index].Guid,
1904 &mSmmIplEvents[Index].Event
VOID *EFIAPI InvalidateInstructionCacheRange(IN VOID *Address, IN UINTN Length)
UINT64 EFIAPI ReadUnaligned64(IN CONST UINT64 *Buffer)
UINT64 EFIAPI LShiftU64(IN UINT64 Operand, IN UINTN Count)
VOID *EFIAPI CopyMem(OUT VOID *DestinationBuffer, IN CONST VOID *SourceBuffer, IN UINTN Length)
BOOLEAN EFIAPI CompareGuid(IN CONST GUID *Guid1, IN CONST GUID *Guid2)
GUID *EFIAPI CopyGuid(OUT GUID *DestinationGuid, IN CONST GUID *SourceGuid)
EFI_STATUS EFIAPI GetSectionFromAnyFvByFileType(IN EFI_FV_FILETYPE FileType, IN UINTN FileInstance, IN EFI_SECTION_TYPE SectionType, IN UINTN SectionInstance, OUT VOID **Buffer, OUT UINTN *Size)
VOID *EFIAPI AllocateZeroPool(IN UINTN AllocationSize)
VOID EFIAPI FreePool(IN VOID *Buffer)
#define OFFSET_OF(TYPE, Field)
#define ASSERT_EFI_ERROR(StatusParameter)
#define DEBUG(Expression)
#define DEBUG_CODE(Expression)
#define REPORT_STATUS_CODE(Type, Value)
#define PcdGet64(TokenName)
#define PcdGet32(TokenName)
RETURN_STATUS EFIAPI PeCoffLoaderLoadImage(IN OUT PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext)
RETURN_STATUS EFIAPI PeCoffLoaderRelocateImage(IN OUT PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext)
RETURN_STATUS EFIAPI PeCoffLoaderGetImageInfo(IN OUT PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext)
RETURN_STATUS EFIAPI PeCoffLoaderImageReadFromMemory(IN VOID *FileHandle, IN UINTN FileOffset, IN OUT UINTN *ReadSize, OUT VOID *Buffer)
#define EFI_IMAGE_SCN_CNT_CODE
0x00000020
#define SMM_CORE_PRIVATE_DATA_SIGNATURE
VOID EFIAPI SmmIplSmmConfigurationEventNotify(IN EFI_EVENT Event, IN VOID *Context)
EFI_STATUS ExecuteSmmCoreFromSmram(IN OUT EFI_SMRAM_DESCRIPTOR *SmramRange, IN OUT EFI_SMRAM_DESCRIPTOR *SmramRangeSmmCore, IN VOID *Context)
EFI_STATUS EFIAPI SmmBase2GetSmstLocation(IN CONST EFI_SMM_BASE2_PROTOCOL *This, OUT EFI_SMM_SYSTEM_TABLE2 **Smst)
VOID EFIAPI SmmIplEndOfDxeEventNotify(IN EFI_EVENT Event, IN VOID *Context)
EFI_STATUS EFIAPI SmmBase2InSmram(IN CONST EFI_SMM_BASE2_PROTOCOL *This, OUT BOOLEAN *InSmram)
EFI_STATUS EFIAPI SmmCommunicationCommunicate(IN CONST EFI_SMM_COMMUNICATION_PROTOCOL *This, IN OUT VOID *CommBuffer, IN OUT UINTN *CommSize OPTIONAL)
VOID EFIAPI SmmIplDxeDispatchEventNotify(IN EFI_EVENT Event, IN VOID *Context)
VOID EFIAPI SmmIplReadyToLockEventNotify(IN EFI_EVENT Event, IN VOID *Context)
EFI_STATUS GetPeCoffImageFixLoadingAssignedAddress(IN OUT PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext)
EFI_STATUS EFIAPI SmmIplEntry(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
VOID GetSmramCacheRange(IN EFI_SMRAM_DESCRIPTOR *SmramRange, OUT EFI_PHYSICAL_ADDRESS *SmramCacheBase, OUT UINT64 *SmramCacheSize)
BOOLEAN SmmIsSmramOverlap(IN EFI_SMRAM_DESCRIPTOR *RangeToCompare, IN EFI_SMM_RESERVED_SMRAM_REGION *ReservedRangeToCompare)
EFI_STATUS EFIAPI SmmCommunicationMmCommunicate2(IN CONST EFI_MM_COMMUNICATION2_PROTOCOL *This, IN OUT VOID *CommBufferPhysical, IN OUT VOID *CommBufferVirtual, IN OUT UINTN *CommSize OPTIONAL)
VOID SmmSplitSmramEntry(IN OUT EFI_SMRAM_DESCRIPTOR *RangeToCompare, IN OUT EFI_SMM_RESERVED_SMRAM_REGION *ReservedRangeToCompare, OUT EFI_SMRAM_DESCRIPTOR *Ranges, IN OUT UINTN *RangeCount, OUT EFI_SMM_RESERVED_SMRAM_REGION *ReservedRanges, IN OUT UINTN *ReservedRangeCount, OUT EFI_SMRAM_DESCRIPTOR *FinalRanges, IN OUT UINTN *FinalRangeCount)
VOID EFIAPI SmmIplGuidedEventNotify(IN EFI_EVENT Event, IN VOID *Context)
VOID EFIAPI SmmIplSetVirtualAddressNotify(IN EFI_EVENT Event, IN VOID *Context)
EFI_SMRAM_DESCRIPTOR * GetFullSmramRanges(OUT UINTN *FullSmramRangeCount)
VOID *EFIAPI AllocatePool(IN UINTN AllocationSize)
RETURN_STATUS EFIAPI SafeUint64Add(IN UINT64 Augend, IN UINT64 Addend, OUT UINT64 *Result)
VOID EFIAPI NotifyFunction(IN EFI_EVENT Event, IN VOID *Context)
struct _EFI_SMM_RESERVED_SMRAM_REGION EFI_SMM_RESERVED_SMRAM_REGION
UINT64 EFI_PHYSICAL_ADDRESS
#define EFI_PAGES_TO_SIZE(Pages)
#define EFI_SIZE_TO_PAGES(Size)
EFI_STATUS EFIAPI EfiGetSystemConfigurationTable(IN EFI_GUID *TableGuid, OUT VOID **Table)
EFI_EVENT EFIAPI EfiCreateProtocolNotifyEvent(IN EFI_GUID *ProtocolGuid, IN EFI_TPL NotifyTpl, IN EFI_EVENT_NOTIFY NotifyFunction, IN VOID *NotifyContext OPTIONAL, OUT VOID **Registration)
EFI_STATUS EFIAPI EfiConvertPointer(IN UINTN DebugDisposition, IN OUT VOID **Address)
BOOLEAN EFIAPI EfiGoneVirtual(VOID)
VOID(EFIAPI * EFI_EVENT_NOTIFY)(IN EFI_EVENT Event, IN VOID *Context)
EFI_STATUS(EFIAPI * EFI_IMAGE_ENTRY_POINT)(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
EFI_SMM_RESERVED_SMRAM_REGION * SmramReservedRegions
EFI_SMM_INTERRUPT_MANAGE SmiManage
EFI_PHYSICAL_ADDRESS SmramBase
SMRAM base address. The build tool assigns an offset relative to the SMRAM base for a SMM driver.
EFI_PHYSICAL_ADDRESS CpuStart
EFI_PHYSICAL_ADDRESS PhysicalStart
PE_COFF_LOADER_READ_FILE ImageRead
PHYSICAL_ADDRESS EntryPoint
PHYSICAL_ADDRESS ImageAddress
EFI_SMM_SYSTEM_TABLE2 * Smst
EFI_HANDLE SmmIplImageHandle
BOOLEAN SmmEntryPointRegistered
VOID * CommunicationBuffer
EFI_SMM_ENTRY_POINT SmmEntryPoint
EFI_SMRAM_DESCRIPTOR * SmramRanges