StandaloneMmPkg: Apply uncrustify changes
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3737 Apply uncrustify changes to .c/.h files in the StandaloneMmPkg package Cc: Andrew Fish <afish@apple.com> Cc: Leif Lindholm <leif@nuviainc.com> Cc: Michael D Kinney <michael.d.kinney@intel.com> Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com> Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
This commit is contained in:
committed by
mergify[bot]
parent
c1e126b119
commit
91415a36ae
@@ -47,8 +47,8 @@ GrowDepexStack (
|
||||
VOID
|
||||
)
|
||||
{
|
||||
BOOLEAN *NewStack;
|
||||
UINTN Size;
|
||||
BOOLEAN *NewStack;
|
||||
UINTN Size;
|
||||
|
||||
Size = DEPEX_STACK_SIZE_INCREMENT;
|
||||
if (mDepexEvaluationStack != NULL) {
|
||||
@@ -167,7 +167,7 @@ PopBool (
|
||||
**/
|
||||
BOOLEAN
|
||||
MmIsSchedulable (
|
||||
IN EFI_MM_DRIVER_ENTRY *DriverEntry
|
||||
IN EFI_MM_DRIVER_ENTRY *DriverEntry
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
@@ -177,7 +177,7 @@ MmIsSchedulable (
|
||||
EFI_GUID DriverGuid;
|
||||
VOID *Interface;
|
||||
|
||||
Operator = FALSE;
|
||||
Operator = FALSE;
|
||||
Operator2 = FALSE;
|
||||
|
||||
if (DriverEntry->After || DriverEntry->Before) {
|
||||
@@ -206,7 +206,6 @@ MmIsSchedulable (
|
||||
//
|
||||
mDepexEvaluationStackPointer = mDepexEvaluationStack;
|
||||
|
||||
|
||||
Iterator = DriverEntry->Depex;
|
||||
|
||||
while (TRUE) {
|
||||
@@ -223,148 +222,155 @@ MmIsSchedulable (
|
||||
// Look at the opcode of the dependency expression instruction.
|
||||
//
|
||||
switch (*Iterator) {
|
||||
case EFI_DEP_BEFORE:
|
||||
case EFI_DEP_AFTER:
|
||||
//
|
||||
// For a well-formed Dependency Expression, the code should never get here.
|
||||
// The BEFORE and AFTER are processed prior to this routine's invocation.
|
||||
// If the code flow arrives at this point, there was a BEFORE or AFTER
|
||||
// that were not the first opcodes.
|
||||
//
|
||||
DEBUG ((DEBUG_DISPATCH, " RESULT = FALSE (Unexpected BEFORE or AFTER opcode)\n"));
|
||||
ASSERT (FALSE);
|
||||
|
||||
case EFI_DEP_PUSH:
|
||||
//
|
||||
// Push operator is followed by a GUID. Test to see if the GUID protocol
|
||||
// is installed and push the boolean result on the stack.
|
||||
//
|
||||
CopyMem (&DriverGuid, Iterator + 1, sizeof (EFI_GUID));
|
||||
|
||||
Status = MmLocateProtocol (&DriverGuid, NULL, &Interface);
|
||||
if (EFI_ERROR (Status) && (mEfiSystemTable != NULL)) {
|
||||
case EFI_DEP_BEFORE:
|
||||
case EFI_DEP_AFTER:
|
||||
//
|
||||
// For MM Driver, it may depend on uefi protocols
|
||||
// For a well-formed Dependency Expression, the code should never get here.
|
||||
// The BEFORE and AFTER are processed prior to this routine's invocation.
|
||||
// If the code flow arrives at this point, there was a BEFORE or AFTER
|
||||
// that were not the first opcodes.
|
||||
//
|
||||
Status = mEfiSystemTable->BootServices->LocateProtocol (&DriverGuid, NULL, &Interface);
|
||||
}
|
||||
DEBUG ((DEBUG_DISPATCH, " RESULT = FALSE (Unexpected BEFORE or AFTER opcode)\n"));
|
||||
ASSERT (FALSE);
|
||||
|
||||
if (EFI_ERROR (Status)) {
|
||||
DEBUG ((DEBUG_DISPATCH, " PUSH GUID(%g) = FALSE\n", &DriverGuid));
|
||||
Status = PushBool (FALSE);
|
||||
} else {
|
||||
DEBUG ((DEBUG_DISPATCH, " PUSH GUID(%g) = TRUE\n", &DriverGuid));
|
||||
*Iterator = EFI_DEP_REPLACE_TRUE;
|
||||
case EFI_DEP_PUSH:
|
||||
//
|
||||
// Push operator is followed by a GUID. Test to see if the GUID protocol
|
||||
// is installed and push the boolean result on the stack.
|
||||
//
|
||||
CopyMem (&DriverGuid, Iterator + 1, sizeof (EFI_GUID));
|
||||
|
||||
Status = MmLocateProtocol (&DriverGuid, NULL, &Interface);
|
||||
if (EFI_ERROR (Status) && (mEfiSystemTable != NULL)) {
|
||||
//
|
||||
// For MM Driver, it may depend on uefi protocols
|
||||
//
|
||||
Status = mEfiSystemTable->BootServices->LocateProtocol (&DriverGuid, NULL, &Interface);
|
||||
}
|
||||
|
||||
if (EFI_ERROR (Status)) {
|
||||
DEBUG ((DEBUG_DISPATCH, " PUSH GUID(%g) = FALSE\n", &DriverGuid));
|
||||
Status = PushBool (FALSE);
|
||||
} else {
|
||||
DEBUG ((DEBUG_DISPATCH, " PUSH GUID(%g) = TRUE\n", &DriverGuid));
|
||||
*Iterator = EFI_DEP_REPLACE_TRUE;
|
||||
Status = PushBool (TRUE);
|
||||
}
|
||||
|
||||
if (EFI_ERROR (Status)) {
|
||||
DEBUG ((DEBUG_DISPATCH, " RESULT = FALSE (Unexpected error)\n"));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
Iterator += sizeof (EFI_GUID);
|
||||
break;
|
||||
|
||||
case EFI_DEP_AND:
|
||||
DEBUG ((DEBUG_DISPATCH, " AND\n"));
|
||||
Status = PopBool (&Operator);
|
||||
if (EFI_ERROR (Status)) {
|
||||
DEBUG ((DEBUG_DISPATCH, " RESULT = FALSE (Unexpected error)\n"));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
Status = PopBool (&Operator2);
|
||||
if (EFI_ERROR (Status)) {
|
||||
DEBUG ((DEBUG_DISPATCH, " RESULT = FALSE (Unexpected error)\n"));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
Status = PushBool ((BOOLEAN)(Operator && Operator2));
|
||||
if (EFI_ERROR (Status)) {
|
||||
DEBUG ((DEBUG_DISPATCH, " RESULT = FALSE (Unexpected error)\n"));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case EFI_DEP_OR:
|
||||
DEBUG ((DEBUG_DISPATCH, " OR\n"));
|
||||
Status = PopBool (&Operator);
|
||||
if (EFI_ERROR (Status)) {
|
||||
DEBUG ((DEBUG_DISPATCH, " RESULT = FALSE (Unexpected error)\n"));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
Status = PopBool (&Operator2);
|
||||
if (EFI_ERROR (Status)) {
|
||||
DEBUG ((DEBUG_DISPATCH, " RESULT = FALSE (Unexpected error)\n"));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
Status = PushBool ((BOOLEAN)(Operator || Operator2));
|
||||
if (EFI_ERROR (Status)) {
|
||||
DEBUG ((DEBUG_DISPATCH, " RESULT = FALSE (Unexpected error)\n"));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case EFI_DEP_NOT:
|
||||
DEBUG ((DEBUG_DISPATCH, " NOT\n"));
|
||||
Status = PopBool (&Operator);
|
||||
if (EFI_ERROR (Status)) {
|
||||
DEBUG ((DEBUG_DISPATCH, " RESULT = FALSE (Unexpected error)\n"));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
Status = PushBool ((BOOLEAN)(!Operator));
|
||||
if (EFI_ERROR (Status)) {
|
||||
DEBUG ((DEBUG_DISPATCH, " RESULT = FALSE (Unexpected error)\n"));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case EFI_DEP_TRUE:
|
||||
DEBUG ((DEBUG_DISPATCH, " TRUE\n"));
|
||||
Status = PushBool (TRUE);
|
||||
}
|
||||
if (EFI_ERROR (Status)) {
|
||||
DEBUG ((DEBUG_DISPATCH, " RESULT = FALSE (Unexpected error)\n"));
|
||||
return FALSE;
|
||||
}
|
||||
if (EFI_ERROR (Status)) {
|
||||
DEBUG ((DEBUG_DISPATCH, " RESULT = FALSE (Unexpected error)\n"));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
Iterator += sizeof (EFI_GUID);
|
||||
break;
|
||||
break;
|
||||
|
||||
case EFI_DEP_AND:
|
||||
DEBUG ((DEBUG_DISPATCH, " AND\n"));
|
||||
Status = PopBool (&Operator);
|
||||
if (EFI_ERROR (Status)) {
|
||||
DEBUG ((DEBUG_DISPATCH, " RESULT = FALSE (Unexpected error)\n"));
|
||||
return FALSE;
|
||||
}
|
||||
case EFI_DEP_FALSE:
|
||||
DEBUG ((DEBUG_DISPATCH, " FALSE\n"));
|
||||
Status = PushBool (FALSE);
|
||||
if (EFI_ERROR (Status)) {
|
||||
DEBUG ((DEBUG_DISPATCH, " RESULT = FALSE (Unexpected error)\n"));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
Status = PopBool (&Operator2);
|
||||
if (EFI_ERROR (Status)) {
|
||||
DEBUG ((DEBUG_DISPATCH, " RESULT = FALSE (Unexpected error)\n"));
|
||||
return FALSE;
|
||||
}
|
||||
break;
|
||||
|
||||
Status = PushBool ((BOOLEAN)(Operator && Operator2));
|
||||
if (EFI_ERROR (Status)) {
|
||||
DEBUG ((DEBUG_DISPATCH, " RESULT = FALSE (Unexpected error)\n"));
|
||||
return FALSE;
|
||||
}
|
||||
break;
|
||||
case EFI_DEP_END:
|
||||
DEBUG ((DEBUG_DISPATCH, " END\n"));
|
||||
Status = PopBool (&Operator);
|
||||
if (EFI_ERROR (Status)) {
|
||||
DEBUG ((DEBUG_DISPATCH, " RESULT = FALSE (Unexpected error)\n"));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
case EFI_DEP_OR:
|
||||
DEBUG ((DEBUG_DISPATCH, " OR\n"));
|
||||
Status = PopBool (&Operator);
|
||||
if (EFI_ERROR (Status)) {
|
||||
DEBUG ((DEBUG_DISPATCH, " RESULT = FALSE (Unexpected error)\n"));
|
||||
return FALSE;
|
||||
}
|
||||
DEBUG ((DEBUG_DISPATCH, " RESULT = %a\n", Operator ? "TRUE" : "FALSE"));
|
||||
return Operator;
|
||||
|
||||
Status = PopBool (&Operator2);
|
||||
if (EFI_ERROR (Status)) {
|
||||
DEBUG ((DEBUG_DISPATCH, " RESULT = FALSE (Unexpected error)\n"));
|
||||
return FALSE;
|
||||
}
|
||||
case EFI_DEP_REPLACE_TRUE:
|
||||
CopyMem (&DriverGuid, Iterator + 1, sizeof (EFI_GUID));
|
||||
DEBUG ((DEBUG_DISPATCH, " PUSH GUID(%g) = TRUE\n", &DriverGuid));
|
||||
Status = PushBool (TRUE);
|
||||
if (EFI_ERROR (Status)) {
|
||||
DEBUG ((DEBUG_DISPATCH, " RESULT = FALSE (Unexpected error)\n"));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
Status = PushBool ((BOOLEAN)(Operator || Operator2));
|
||||
if (EFI_ERROR (Status)) {
|
||||
DEBUG ((DEBUG_DISPATCH, " RESULT = FALSE (Unexpected error)\n"));
|
||||
return FALSE;
|
||||
}
|
||||
break;
|
||||
Iterator += sizeof (EFI_GUID);
|
||||
break;
|
||||
|
||||
case EFI_DEP_NOT:
|
||||
DEBUG ((DEBUG_DISPATCH, " NOT\n"));
|
||||
Status = PopBool (&Operator);
|
||||
if (EFI_ERROR (Status)) {
|
||||
DEBUG ((DEBUG_DISPATCH, " RESULT = FALSE (Unexpected error)\n"));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
Status = PushBool ((BOOLEAN)(!Operator));
|
||||
if (EFI_ERROR (Status)) {
|
||||
DEBUG ((DEBUG_DISPATCH, " RESULT = FALSE (Unexpected error)\n"));
|
||||
return FALSE;
|
||||
}
|
||||
break;
|
||||
|
||||
case EFI_DEP_TRUE:
|
||||
DEBUG ((DEBUG_DISPATCH, " TRUE\n"));
|
||||
Status = PushBool (TRUE);
|
||||
if (EFI_ERROR (Status)) {
|
||||
DEBUG ((DEBUG_DISPATCH, " RESULT = FALSE (Unexpected error)\n"));
|
||||
return FALSE;
|
||||
}
|
||||
break;
|
||||
|
||||
case EFI_DEP_FALSE:
|
||||
DEBUG ((DEBUG_DISPATCH, " FALSE\n"));
|
||||
Status = PushBool (FALSE);
|
||||
if (EFI_ERROR (Status)) {
|
||||
DEBUG ((DEBUG_DISPATCH, " RESULT = FALSE (Unexpected error)\n"));
|
||||
return FALSE;
|
||||
}
|
||||
break;
|
||||
|
||||
case EFI_DEP_END:
|
||||
DEBUG ((DEBUG_DISPATCH, " END\n"));
|
||||
Status = PopBool (&Operator);
|
||||
if (EFI_ERROR (Status)) {
|
||||
DEBUG ((DEBUG_DISPATCH, " RESULT = FALSE (Unexpected error)\n"));
|
||||
return FALSE;
|
||||
}
|
||||
DEBUG ((DEBUG_DISPATCH, " RESULT = %a\n", Operator ? "TRUE" : "FALSE"));
|
||||
return Operator;
|
||||
|
||||
case EFI_DEP_REPLACE_TRUE:
|
||||
CopyMem (&DriverGuid, Iterator + 1, sizeof (EFI_GUID));
|
||||
DEBUG ((DEBUG_DISPATCH, " PUSH GUID(%g) = TRUE\n", &DriverGuid));
|
||||
Status = PushBool (TRUE);
|
||||
if (EFI_ERROR (Status)) {
|
||||
DEBUG ((DEBUG_DISPATCH, " RESULT = FALSE (Unexpected error)\n"));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
Iterator += sizeof (EFI_GUID);
|
||||
break;
|
||||
|
||||
default:
|
||||
DEBUG ((DEBUG_DISPATCH, " RESULT = FALSE (Unknown opcode)\n"));
|
||||
goto Done;
|
||||
default:
|
||||
DEBUG ((DEBUG_DISPATCH, " RESULT = FALSE (Unknown opcode)\n"));
|
||||
goto Done;
|
||||
}
|
||||
|
||||
//
|
||||
|
@@ -44,9 +44,9 @@
|
||||
#define KNOWN_FWVOL_SIGNATURE SIGNATURE_32('k','n','o','w')
|
||||
|
||||
typedef struct {
|
||||
UINTN Signature;
|
||||
LIST_ENTRY Link; // mFwVolList
|
||||
EFI_FIRMWARE_VOLUME_HEADER *FwVolHeader;
|
||||
UINTN Signature;
|
||||
LIST_ENTRY Link; // mFwVolList
|
||||
EFI_FIRMWARE_VOLUME_HEADER *FwVolHeader;
|
||||
} KNOWN_FWVOL;
|
||||
|
||||
//
|
||||
@@ -71,7 +71,7 @@ MmCoreFfsFindMmDriver (
|
||||
**/
|
||||
VOID
|
||||
MmInsertOnScheduledQueueWhileProcessingBeforeAndAfter (
|
||||
IN EFI_MM_DRIVER_ENTRY *InsertedDriverEntry
|
||||
IN EFI_MM_DRIVER_ENTRY *InsertedDriverEntry
|
||||
);
|
||||
|
||||
//
|
||||
@@ -107,7 +107,7 @@ BOOLEAN gRequestDispatch = FALSE;
|
||||
// memory range usage. It is a bit mapped array in which every bit indicates the correspoding
|
||||
// memory page available or not.
|
||||
//
|
||||
GLOBAL_REMOVE_IF_UNREFERENCED UINT64 *mMmCodeMemoryRangeUsageBitMap=NULL;
|
||||
GLOBAL_REMOVE_IF_UNREFERENCED UINT64 *mMmCodeMemoryRangeUsageBitMap = NULL;
|
||||
|
||||
/**
|
||||
To check memory usage bit map array to figure out if the memory range in which the image will be loaded
|
||||
@@ -123,23 +123,23 @@ GLOBAL_REMOVE_IF_UNREFERENCED UINT64 *mMmCodeMemoryRangeUsageB
|
||||
**/
|
||||
EFI_STATUS
|
||||
CheckAndMarkFixLoadingMemoryUsageBitMap (
|
||||
IN EFI_PHYSICAL_ADDRESS ImageBase,
|
||||
IN UINTN ImageSize
|
||||
IN EFI_PHYSICAL_ADDRESS ImageBase,
|
||||
IN UINTN ImageSize
|
||||
)
|
||||
{
|
||||
UINT32 MmCodePageNumber;
|
||||
UINT64 MmCodeSize;
|
||||
EFI_PHYSICAL_ADDRESS MmCodeBase;
|
||||
UINTN BaseOffsetPageNumber;
|
||||
UINTN TopOffsetPageNumber;
|
||||
UINTN Index;
|
||||
UINT32 MmCodePageNumber;
|
||||
UINT64 MmCodeSize;
|
||||
EFI_PHYSICAL_ADDRESS MmCodeBase;
|
||||
UINTN BaseOffsetPageNumber;
|
||||
UINTN TopOffsetPageNumber;
|
||||
UINTN Index;
|
||||
|
||||
//
|
||||
// Build tool will calculate the smm code size and then patch the PcdLoadFixAddressMmCodePageNumber
|
||||
//
|
||||
MmCodePageNumber = 0;
|
||||
MmCodeSize = EFI_PAGES_TO_SIZE (MmCodePageNumber);
|
||||
MmCodeBase = gLoadModuleAtFixAddressMmramBase;
|
||||
MmCodeSize = EFI_PAGES_TO_SIZE (MmCodePageNumber);
|
||||
MmCodeBase = gLoadModuleAtFixAddressMmramBase;
|
||||
|
||||
//
|
||||
// If the memory usage bit map is not initialized, do it. Every bit in the array
|
||||
@@ -159,7 +159,7 @@ CheckAndMarkFixLoadingMemoryUsageBitMap (
|
||||
//
|
||||
// see if the memory range for loading the image is in the MM code range.
|
||||
//
|
||||
if (MmCodeBase + MmCodeSize < ImageBase + ImageSize || MmCodeBase > ImageBase) {
|
||||
if ((MmCodeBase + MmCodeSize < ImageBase + ImageSize) || (MmCodeBase > ImageBase)) {
|
||||
return EFI_NOT_FOUND;
|
||||
}
|
||||
|
||||
@@ -168,7 +168,7 @@ CheckAndMarkFixLoadingMemoryUsageBitMap (
|
||||
//
|
||||
BaseOffsetPageNumber = (UINTN)EFI_SIZE_TO_PAGES ((UINT32)(ImageBase - MmCodeBase));
|
||||
TopOffsetPageNumber = (UINTN)EFI_SIZE_TO_PAGES ((UINT32)(ImageBase + ImageSize - MmCodeBase));
|
||||
for (Index = BaseOffsetPageNumber; Index < TopOffsetPageNumber; Index ++) {
|
||||
for (Index = BaseOffsetPageNumber; Index < TopOffsetPageNumber; Index++) {
|
||||
if ((mMmCodeMemoryRangeUsageBitMap[Index / 64] & LShiftU64 (1, (Index % 64))) != 0) {
|
||||
//
|
||||
// This page is already used.
|
||||
@@ -180,10 +180,11 @@ CheckAndMarkFixLoadingMemoryUsageBitMap (
|
||||
//
|
||||
// Being here means the memory range is available. So mark the bits for the memory range
|
||||
//
|
||||
for (Index = BaseOffsetPageNumber; Index < TopOffsetPageNumber; Index ++) {
|
||||
for (Index = BaseOffsetPageNumber; Index < TopOffsetPageNumber; Index++) {
|
||||
mMmCodeMemoryRangeUsageBitMap[Index / 64] |= LShiftU64 (1, (Index % 64));
|
||||
}
|
||||
return EFI_SUCCESS;
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -197,29 +198,29 @@ CheckAndMarkFixLoadingMemoryUsageBitMap (
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
GetPeCoffImageFixLoadingAssignedAddress(
|
||||
GetPeCoffImageFixLoadingAssignedAddress (
|
||||
IN OUT PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext
|
||||
)
|
||||
{
|
||||
UINTN SectionHeaderOffset;
|
||||
EFI_STATUS Status;
|
||||
EFI_IMAGE_SECTION_HEADER SectionHeader;
|
||||
EFI_IMAGE_OPTIONAL_HEADER_UNION *ImgHdr;
|
||||
EFI_PHYSICAL_ADDRESS FixLoadingAddress;
|
||||
UINT16 Index;
|
||||
UINTN Size;
|
||||
UINT16 NumberOfSections;
|
||||
UINT64 ValueInSectionHeader;
|
||||
UINTN SectionHeaderOffset;
|
||||
EFI_STATUS Status;
|
||||
EFI_IMAGE_SECTION_HEADER SectionHeader;
|
||||
EFI_IMAGE_OPTIONAL_HEADER_UNION *ImgHdr;
|
||||
EFI_PHYSICAL_ADDRESS FixLoadingAddress;
|
||||
UINT16 Index;
|
||||
UINTN Size;
|
||||
UINT16 NumberOfSections;
|
||||
UINT64 ValueInSectionHeader;
|
||||
|
||||
FixLoadingAddress = 0;
|
||||
Status = EFI_NOT_FOUND;
|
||||
Status = EFI_NOT_FOUND;
|
||||
|
||||
//
|
||||
// Get PeHeader pointer
|
||||
//
|
||||
ImgHdr = (EFI_IMAGE_OPTIONAL_HEADER_UNION *)((CHAR8* )ImageContext->Handle + ImageContext->PeCoffHeaderOffset);
|
||||
ImgHdr = (EFI_IMAGE_OPTIONAL_HEADER_UNION *)((CHAR8 *)ImageContext->Handle + ImageContext->PeCoffHeaderOffset);
|
||||
SectionHeaderOffset = ImageContext->PeCoffHeaderOffset + sizeof (UINT32) + sizeof (EFI_IMAGE_FILE_HEADER) +
|
||||
ImgHdr->Pe32.FileHeader.SizeOfOptionalHeader;
|
||||
ImgHdr->Pe32.FileHeader.SizeOfOptionalHeader;
|
||||
NumberOfSections = ImgHdr->Pe32.FileHeader.NumberOfSections;
|
||||
|
||||
//
|
||||
@@ -229,7 +230,7 @@ GetPeCoffImageFixLoadingAssignedAddress(
|
||||
//
|
||||
// Read section header from file
|
||||
//
|
||||
Size = sizeof (EFI_IMAGE_SECTION_HEADER);
|
||||
Size = sizeof (EFI_IMAGE_SECTION_HEADER);
|
||||
Status = ImageContext->ImageRead (
|
||||
ImageContext->Handle,
|
||||
SectionHeaderOffset,
|
||||
@@ -250,7 +251,7 @@ GetPeCoffImageFixLoadingAssignedAddress(
|
||||
// assigned by tools, the PointerToRelocations & PointerToLineNumbers fields should not be
|
||||
// Zero, or else, these 2 fields should be set to Zero
|
||||
//
|
||||
ValueInSectionHeader = ReadUnaligned64 ((UINT64*)&SectionHeader.PointerToRelocations);
|
||||
ValueInSectionHeader = ReadUnaligned64 ((UINT64 *)&SectionHeader.PointerToRelocations);
|
||||
if (ValueInSectionHeader != 0) {
|
||||
//
|
||||
// Found first section header that doesn't point to code section in which build tool saves the
|
||||
@@ -261,21 +262,29 @@ GetPeCoffImageFixLoadingAssignedAddress(
|
||||
// Check if the memory range is available.
|
||||
//
|
||||
Status = CheckAndMarkFixLoadingMemoryUsageBitMap (FixLoadingAddress, (UINTN)(ImageContext->ImageSize + ImageContext->SectionAlignment));
|
||||
if (!EFI_ERROR(Status)) {
|
||||
if (!EFI_ERROR (Status)) {
|
||||
//
|
||||
// The assigned address is valid. Return the specified loading address
|
||||
//
|
||||
ImageContext->ImageAddress = FixLoadingAddress;
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
SectionHeaderOffset += sizeof (EFI_IMAGE_SECTION_HEADER);
|
||||
}
|
||||
DEBUG ((DEBUG_INFO|DEBUG_LOAD, "LOADING MODULE FIXED INFO: Loading module at fixed address %x, Status = %r\n",
|
||||
FixLoadingAddress, Status));
|
||||
|
||||
DEBUG ((
|
||||
DEBUG_INFO|DEBUG_LOAD,
|
||||
"LOADING MODULE FIXED INFO: Loading module at fixed address %x, Status = %r\n",
|
||||
FixLoadingAddress,
|
||||
Status
|
||||
));
|
||||
return Status;
|
||||
}
|
||||
|
||||
/**
|
||||
Loads an EFI image into SMRAM.
|
||||
|
||||
@@ -290,19 +299,19 @@ MmLoadImage (
|
||||
IN OUT EFI_MM_DRIVER_ENTRY *DriverEntry
|
||||
)
|
||||
{
|
||||
UINTN PageCount;
|
||||
EFI_STATUS Status;
|
||||
EFI_PHYSICAL_ADDRESS DstBuffer;
|
||||
PE_COFF_LOADER_IMAGE_CONTEXT ImageContext;
|
||||
UINTN PageCount;
|
||||
EFI_STATUS Status;
|
||||
EFI_PHYSICAL_ADDRESS DstBuffer;
|
||||
PE_COFF_LOADER_IMAGE_CONTEXT ImageContext;
|
||||
|
||||
DEBUG ((DEBUG_INFO, "MmLoadImage - %g\n", &DriverEntry->FileName));
|
||||
|
||||
Status = EFI_SUCCESS;
|
||||
Status = EFI_SUCCESS;
|
||||
|
||||
//
|
||||
// Initialize ImageContext
|
||||
//
|
||||
ImageContext.Handle = DriverEntry->Pe32Data;
|
||||
ImageContext.Handle = DriverEntry->Pe32Data;
|
||||
ImageContext.ImageRead = PeCoffLoaderImageReadFromMemory;
|
||||
|
||||
//
|
||||
@@ -355,14 +364,14 @@ MmLoadImage (
|
||||
//
|
||||
// Flush the instruction cache so the image data are written before we execute it
|
||||
//
|
||||
InvalidateInstructionCacheRange ((VOID *)(UINTN) ImageContext.ImageAddress, (UINTN) ImageContext.ImageSize);
|
||||
InvalidateInstructionCacheRange ((VOID *)(UINTN)ImageContext.ImageAddress, (UINTN)ImageContext.ImageSize);
|
||||
|
||||
//
|
||||
// Save Image EntryPoint in DriverEntry
|
||||
//
|
||||
DriverEntry->ImageEntryPoint = ImageContext.EntryPoint;
|
||||
DriverEntry->ImageBuffer = DstBuffer;
|
||||
DriverEntry->NumberOfPage = PageCount;
|
||||
DriverEntry->ImageEntryPoint = ImageContext.EntryPoint;
|
||||
DriverEntry->ImageBuffer = DstBuffer;
|
||||
DriverEntry->NumberOfPage = PageCount;
|
||||
|
||||
if (mEfiSystemTable != NULL) {
|
||||
Status = mEfiSystemTable->BootServices->AllocatePool (
|
||||
@@ -380,11 +389,11 @@ MmLoadImage (
|
||||
// Fill in the remaining fields of the Loaded Image Protocol instance.
|
||||
// Note: ImageBase is an SMRAM address that can not be accessed outside of SMRAM if SMRAM window is closed.
|
||||
//
|
||||
DriverEntry->LoadedImage->Revision = EFI_LOADED_IMAGE_PROTOCOL_REVISION;
|
||||
DriverEntry->LoadedImage->ParentHandle = NULL;
|
||||
DriverEntry->LoadedImage->SystemTable = mEfiSystemTable;
|
||||
DriverEntry->LoadedImage->DeviceHandle = NULL;
|
||||
DriverEntry->LoadedImage->FilePath = NULL;
|
||||
DriverEntry->LoadedImage->Revision = EFI_LOADED_IMAGE_PROTOCOL_REVISION;
|
||||
DriverEntry->LoadedImage->ParentHandle = NULL;
|
||||
DriverEntry->LoadedImage->SystemTable = mEfiSystemTable;
|
||||
DriverEntry->LoadedImage->DeviceHandle = NULL;
|
||||
DriverEntry->LoadedImage->FilePath = NULL;
|
||||
|
||||
DriverEntry->LoadedImage->ImageBase = (VOID *)(UINTN)DriverEntry->ImageBuffer;
|
||||
DriverEntry->LoadedImage->ImageSize = ImageContext.ImageSize;
|
||||
@@ -395,12 +404,12 @@ MmLoadImage (
|
||||
// Create a new image handle in the UEFI handle database for the MM Driver
|
||||
//
|
||||
DriverEntry->ImageHandle = NULL;
|
||||
Status = mEfiSystemTable->BootServices->InstallMultipleProtocolInterfaces (
|
||||
&DriverEntry->ImageHandle,
|
||||
&gEfiLoadedImageProtocolGuid,
|
||||
DriverEntry->LoadedImage,
|
||||
NULL
|
||||
);
|
||||
Status = mEfiSystemTable->BootServices->InstallMultipleProtocolInterfaces (
|
||||
&DriverEntry->ImageHandle,
|
||||
&gEfiLoadedImageProtocolGuid,
|
||||
DriverEntry->LoadedImage,
|
||||
NULL
|
||||
);
|
||||
}
|
||||
|
||||
//
|
||||
@@ -408,14 +417,16 @@ MmLoadImage (
|
||||
//
|
||||
DEBUG_CODE_BEGIN ();
|
||||
|
||||
UINTN Index;
|
||||
UINTN StartIndex;
|
||||
CHAR8 EfiFileName[256];
|
||||
UINTN Index;
|
||||
UINTN StartIndex;
|
||||
CHAR8 EfiFileName[256];
|
||||
|
||||
DEBUG ((DEBUG_INFO | DEBUG_LOAD,
|
||||
"Loading MM driver at 0x%11p EntryPoint=0x%11p ",
|
||||
(VOID *)(UINTN) ImageContext.ImageAddress,
|
||||
FUNCTION_ENTRY_POINT (ImageContext.EntryPoint)));
|
||||
DEBUG ((
|
||||
DEBUG_INFO | DEBUG_LOAD,
|
||||
"Loading MM driver at 0x%11p EntryPoint=0x%11p ",
|
||||
(VOID *)(UINTN)ImageContext.ImageAddress,
|
||||
FUNCTION_ENTRY_POINT (ImageContext.EntryPoint)
|
||||
));
|
||||
|
||||
//
|
||||
// Print Module Name by Pdb file path.
|
||||
@@ -439,6 +450,7 @@ MmLoadImage (
|
||||
if (EfiFileName[Index] == 0) {
|
||||
EfiFileName[Index] = '.';
|
||||
}
|
||||
|
||||
if (EfiFileName[Index] == '.') {
|
||||
EfiFileName[Index + 1] = 'e';
|
||||
EfiFileName[Index + 2] = 'f';
|
||||
@@ -451,8 +463,10 @@ MmLoadImage (
|
||||
if (Index == sizeof (EfiFileName) - 4) {
|
||||
EfiFileName[Index] = 0;
|
||||
}
|
||||
|
||||
DEBUG ((DEBUG_INFO | DEBUG_LOAD, "%a", EfiFileName));
|
||||
}
|
||||
|
||||
DEBUG ((DEBUG_INFO | DEBUG_LOAD, "\n"));
|
||||
|
||||
DEBUG_CODE_END ();
|
||||
@@ -477,7 +491,7 @@ MmPreProcessDepex (
|
||||
{
|
||||
UINT8 *Iterator;
|
||||
|
||||
Iterator = DriverEntry->Depex;
|
||||
Iterator = DriverEntry->Depex;
|
||||
DriverEntry->Dependent = TRUE;
|
||||
|
||||
if (*Iterator == EFI_DEP_BEFORE) {
|
||||
@@ -510,7 +524,7 @@ MmGetDepexSectionAndPreProccess (
|
||||
IN EFI_MM_DRIVER_ENTRY *DriverEntry
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
EFI_STATUS Status;
|
||||
|
||||
//
|
||||
// Data already read
|
||||
@@ -520,6 +534,7 @@ MmGetDepexSectionAndPreProccess (
|
||||
} else {
|
||||
Status = EFI_SUCCESS;
|
||||
}
|
||||
|
||||
if (EFI_ERROR (Status)) {
|
||||
if (Status == EFI_PROTOCOL_ERROR) {
|
||||
//
|
||||
@@ -530,8 +545,8 @@ MmGetDepexSectionAndPreProccess (
|
||||
//
|
||||
// If no Depex assume depend on all architectural protocols
|
||||
//
|
||||
DriverEntry->Depex = NULL;
|
||||
DriverEntry->Dependent = TRUE;
|
||||
DriverEntry->Depex = NULL;
|
||||
DriverEntry->Dependent = TRUE;
|
||||
DriverEntry->DepexProtocolError = FALSE;
|
||||
}
|
||||
} else {
|
||||
@@ -567,10 +582,10 @@ MmDispatcher (
|
||||
VOID
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
LIST_ENTRY *Link;
|
||||
EFI_STATUS Status;
|
||||
LIST_ENTRY *Link;
|
||||
EFI_MM_DRIVER_ENTRY *DriverEntry;
|
||||
BOOLEAN ReadyToRun;
|
||||
BOOLEAN ReadyToRun;
|
||||
|
||||
DEBUG ((DEBUG_INFO, "MmDispatcher\n"));
|
||||
|
||||
@@ -619,8 +634,8 @@ MmDispatcher (
|
||||
// The MM Driver could not be loaded, and do not attempt to load or start it again.
|
||||
// Take driver from Scheduled to Initialized.
|
||||
//
|
||||
DriverEntry->Initialized = TRUE;
|
||||
DriverEntry->Scheduled = FALSE;
|
||||
DriverEntry->Initialized = TRUE;
|
||||
DriverEntry->Scheduled = FALSE;
|
||||
RemoveEntryList (&DriverEntry->ScheduledLink);
|
||||
|
||||
//
|
||||
@@ -630,8 +645,8 @@ MmDispatcher (
|
||||
}
|
||||
}
|
||||
|
||||
DriverEntry->Scheduled = FALSE;
|
||||
DriverEntry->Initialized = TRUE;
|
||||
DriverEntry->Scheduled = FALSE;
|
||||
DriverEntry->Initialized = TRUE;
|
||||
RemoveEntryList (&DriverEntry->ScheduledLink);
|
||||
|
||||
//
|
||||
@@ -639,17 +654,18 @@ MmDispatcher (
|
||||
//
|
||||
if (mEfiSystemTable == NULL) {
|
||||
DEBUG ((DEBUG_INFO, "StartImage - 0x%x (Standalone Mode)\n", DriverEntry->ImageEntryPoint));
|
||||
Status = ((MM_IMAGE_ENTRY_POINT)(UINTN)DriverEntry->ImageEntryPoint) (DriverEntry->ImageHandle, &gMmCoreMmst);
|
||||
Status = ((MM_IMAGE_ENTRY_POINT)(UINTN)DriverEntry->ImageEntryPoint)(DriverEntry->ImageHandle, &gMmCoreMmst);
|
||||
} else {
|
||||
DEBUG ((DEBUG_INFO, "StartImage - 0x%x (Tradition Mode)\n", DriverEntry->ImageEntryPoint));
|
||||
Status = ((EFI_IMAGE_ENTRY_POINT)(UINTN)DriverEntry->ImageEntryPoint) (
|
||||
DriverEntry->ImageHandle,
|
||||
mEfiSystemTable
|
||||
);
|
||||
Status = ((EFI_IMAGE_ENTRY_POINT)(UINTN)DriverEntry->ImageEntryPoint)(
|
||||
DriverEntry->ImageHandle,
|
||||
mEfiSystemTable
|
||||
);
|
||||
}
|
||||
if (EFI_ERROR(Status)) {
|
||||
|
||||
if (EFI_ERROR (Status)) {
|
||||
DEBUG ((DEBUG_INFO, "StartImage Status - %r\n", Status));
|
||||
MmFreePages(DriverEntry->ImageBuffer, DriverEntry->NumberOfPage);
|
||||
MmFreePages (DriverEntry->ImageBuffer, DriverEntry->NumberOfPage);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -714,18 +730,18 @@ MmDispatcher (
|
||||
**/
|
||||
VOID
|
||||
MmInsertOnScheduledQueueWhileProcessingBeforeAndAfter (
|
||||
IN EFI_MM_DRIVER_ENTRY *InsertedDriverEntry
|
||||
IN EFI_MM_DRIVER_ENTRY *InsertedDriverEntry
|
||||
)
|
||||
{
|
||||
LIST_ENTRY *Link;
|
||||
EFI_MM_DRIVER_ENTRY *DriverEntry;
|
||||
LIST_ENTRY *Link;
|
||||
EFI_MM_DRIVER_ENTRY *DriverEntry;
|
||||
|
||||
//
|
||||
// Process Before Dependency
|
||||
//
|
||||
for (Link = mDiscoveredList.ForwardLink; Link != &mDiscoveredList; Link = Link->ForwardLink) {
|
||||
DriverEntry = CR(Link, EFI_MM_DRIVER_ENTRY, Link, EFI_MM_DRIVER_ENTRY_SIGNATURE);
|
||||
if (DriverEntry->Before && DriverEntry->Dependent && DriverEntry != InsertedDriverEntry) {
|
||||
DriverEntry = CR (Link, EFI_MM_DRIVER_ENTRY, Link, EFI_MM_DRIVER_ENTRY_SIGNATURE);
|
||||
if (DriverEntry->Before && DriverEntry->Dependent && (DriverEntry != InsertedDriverEntry)) {
|
||||
DEBUG ((DEBUG_DISPATCH, "Evaluate MM DEPEX for FFS(%g)\n", &DriverEntry->FileName));
|
||||
DEBUG ((DEBUG_DISPATCH, " BEFORE FFS(%g) = ", &DriverEntry->BeforeAfterGuid));
|
||||
if (CompareGuid (&InsertedDriverEntry->FileName, &DriverEntry->BeforeAfterGuid)) {
|
||||
@@ -748,13 +764,12 @@ MmInsertOnScheduledQueueWhileProcessingBeforeAndAfter (
|
||||
InsertedDriverEntry->Scheduled = TRUE;
|
||||
InsertTailList (&mScheduledQueue, &InsertedDriverEntry->ScheduledLink);
|
||||
|
||||
|
||||
//
|
||||
// Process After Dependency
|
||||
//
|
||||
for (Link = mDiscoveredList.ForwardLink; Link != &mDiscoveredList; Link = Link->ForwardLink) {
|
||||
DriverEntry = CR(Link, EFI_MM_DRIVER_ENTRY, Link, EFI_MM_DRIVER_ENTRY_SIGNATURE);
|
||||
if (DriverEntry->After && DriverEntry->Dependent && DriverEntry != InsertedDriverEntry) {
|
||||
DriverEntry = CR (Link, EFI_MM_DRIVER_ENTRY, Link, EFI_MM_DRIVER_ENTRY_SIGNATURE);
|
||||
if (DriverEntry->After && DriverEntry->Dependent && (DriverEntry != InsertedDriverEntry)) {
|
||||
DEBUG ((DEBUG_DISPATCH, "Evaluate MM DEPEX for FFS(%g)\n", &DriverEntry->FileName));
|
||||
DEBUG ((DEBUG_DISPATCH, " AFTER FFS(%g) = ", &DriverEntry->BeforeAfterGuid));
|
||||
if (CompareGuid (&InsertedDriverEntry->FileName, &DriverEntry->BeforeAfterGuid)) {
|
||||
@@ -784,20 +799,22 @@ MmInsertOnScheduledQueueWhileProcessingBeforeAndAfter (
|
||||
**/
|
||||
BOOLEAN
|
||||
FvHasBeenProcessed (
|
||||
IN EFI_FIRMWARE_VOLUME_HEADER *FwVolHeader
|
||||
IN EFI_FIRMWARE_VOLUME_HEADER *FwVolHeader
|
||||
)
|
||||
{
|
||||
LIST_ENTRY *Link;
|
||||
KNOWN_FWVOL *KnownFwVol;
|
||||
LIST_ENTRY *Link;
|
||||
KNOWN_FWVOL *KnownFwVol;
|
||||
|
||||
for (Link = mFwVolList.ForwardLink;
|
||||
Link != &mFwVolList;
|
||||
Link = Link->ForwardLink) {
|
||||
Link = Link->ForwardLink)
|
||||
{
|
||||
KnownFwVol = CR (Link, KNOWN_FWVOL, Link, KNOWN_FWVOL_SIGNATURE);
|
||||
if (KnownFwVol->FwVolHeader == FwVolHeader) {
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@@ -812,17 +829,17 @@ FvHasBeenProcessed (
|
||||
**/
|
||||
VOID
|
||||
FvIsBeingProcessed (
|
||||
IN EFI_FIRMWARE_VOLUME_HEADER *FwVolHeader
|
||||
IN EFI_FIRMWARE_VOLUME_HEADER *FwVolHeader
|
||||
)
|
||||
{
|
||||
KNOWN_FWVOL *KnownFwVol;
|
||||
KNOWN_FWVOL *KnownFwVol;
|
||||
|
||||
DEBUG ((DEBUG_INFO, "FvIsBeingProcessed - 0x%08x\n", FwVolHeader));
|
||||
|
||||
KnownFwVol = AllocatePool (sizeof (KNOWN_FWVOL));
|
||||
ASSERT (KnownFwVol != NULL);
|
||||
|
||||
KnownFwVol->Signature = KNOWN_FWVOL_SIGNATURE;
|
||||
KnownFwVol->Signature = KNOWN_FWVOL_SIGNATURE;
|
||||
KnownFwVol->FwVolHeader = FwVolHeader;
|
||||
InsertTailList (&mFwVolList, &KnownFwVol->Link);
|
||||
}
|
||||
@@ -845,12 +862,12 @@ FvIsBeingProcessed (
|
||||
**/
|
||||
EFI_STATUS
|
||||
MmAddToDriverList (
|
||||
IN EFI_FIRMWARE_VOLUME_HEADER *FwVolHeader,
|
||||
IN VOID *Pe32Data,
|
||||
IN UINTN Pe32DataSize,
|
||||
IN VOID *Depex,
|
||||
IN UINTN DepexSize,
|
||||
IN EFI_GUID *DriverName
|
||||
IN EFI_FIRMWARE_VOLUME_HEADER *FwVolHeader,
|
||||
IN VOID *Pe32Data,
|
||||
IN UINTN Pe32DataSize,
|
||||
IN VOID *Depex,
|
||||
IN UINTN DepexSize,
|
||||
IN EFI_GUID *DriverName
|
||||
)
|
||||
{
|
||||
EFI_MM_DRIVER_ENTRY *DriverEntry;
|
||||
@@ -864,13 +881,13 @@ MmAddToDriverList (
|
||||
DriverEntry = AllocateZeroPool (sizeof (EFI_MM_DRIVER_ENTRY));
|
||||
ASSERT (DriverEntry != NULL);
|
||||
|
||||
DriverEntry->Signature = EFI_MM_DRIVER_ENTRY_SIGNATURE;
|
||||
DriverEntry->Signature = EFI_MM_DRIVER_ENTRY_SIGNATURE;
|
||||
CopyGuid (&DriverEntry->FileName, DriverName);
|
||||
DriverEntry->FwVolHeader = FwVolHeader;
|
||||
DriverEntry->Pe32Data = Pe32Data;
|
||||
DriverEntry->Pe32DataSize = Pe32DataSize;
|
||||
DriverEntry->Depex = Depex;
|
||||
DriverEntry->DepexSize = DepexSize;
|
||||
DriverEntry->FwVolHeader = FwVolHeader;
|
||||
DriverEntry->Pe32Data = Pe32Data;
|
||||
DriverEntry->Pe32DataSize = Pe32DataSize;
|
||||
DriverEntry->Depex = Depex;
|
||||
DriverEntry->DepexSize = DepexSize;
|
||||
|
||||
MmGetDepexSectionAndPreProccess (DriverEntry);
|
||||
|
||||
@@ -890,10 +907,10 @@ MmDisplayDiscoveredNotDispatched (
|
||||
VOID
|
||||
)
|
||||
{
|
||||
LIST_ENTRY *Link;
|
||||
EFI_MM_DRIVER_ENTRY *DriverEntry;
|
||||
LIST_ENTRY *Link;
|
||||
EFI_MM_DRIVER_ENTRY *DriverEntry;
|
||||
|
||||
for (Link = mDiscoveredList.ForwardLink;Link !=&mDiscoveredList; Link = Link->ForwardLink) {
|
||||
for (Link = mDiscoveredList.ForwardLink; Link != &mDiscoveredList; Link = Link->ForwardLink) {
|
||||
DriverEntry = CR (Link, EFI_MM_DRIVER_ENTRY, Link, EFI_MM_DRIVER_ENTRY_SIGNATURE);
|
||||
if (DriverEntry->Dependent) {
|
||||
DEBUG ((DEBUG_LOAD, "MM Driver %g was discovered but not loaded!!\n", &DriverEntry->FileName));
|
||||
|
@@ -14,9 +14,9 @@
|
||||
//
|
||||
// List of file types supported by dispatcher
|
||||
//
|
||||
EFI_FV_FILETYPE mMmFileTypes[] = {
|
||||
EFI_FV_FILETYPE mMmFileTypes[] = {
|
||||
EFI_FV_FILETYPE_MM,
|
||||
0xE, //EFI_FV_FILETYPE_MM_STANDALONE,
|
||||
0xE, // EFI_FV_FILETYPE_MM_STANDALONE,
|
||||
//
|
||||
// Note: DXE core will process the FV image file, so skip it in MM core
|
||||
// EFI_FV_FILETYPE_FIRMWARE_VOLUME_IMAGE
|
||||
@@ -25,22 +25,22 @@ EFI_FV_FILETYPE mMmFileTypes[] = {
|
||||
|
||||
EFI_STATUS
|
||||
MmAddToDriverList (
|
||||
IN EFI_FIRMWARE_VOLUME_HEADER *FwVolHeader,
|
||||
IN VOID *Pe32Data,
|
||||
IN UINTN Pe32DataSize,
|
||||
IN VOID *Depex,
|
||||
IN UINTN DepexSize,
|
||||
IN EFI_GUID *DriverName
|
||||
IN EFI_FIRMWARE_VOLUME_HEADER *FwVolHeader,
|
||||
IN VOID *Pe32Data,
|
||||
IN UINTN Pe32DataSize,
|
||||
IN VOID *Depex,
|
||||
IN UINTN DepexSize,
|
||||
IN EFI_GUID *DriverName
|
||||
);
|
||||
|
||||
BOOLEAN
|
||||
FvHasBeenProcessed (
|
||||
IN EFI_FIRMWARE_VOLUME_HEADER *FwVolHeader
|
||||
IN EFI_FIRMWARE_VOLUME_HEADER *FwVolHeader
|
||||
);
|
||||
|
||||
VOID
|
||||
FvIsBeingProcessed (
|
||||
IN EFI_FIRMWARE_VOLUME_HEADER *FwVolHeader
|
||||
IN EFI_FIRMWARE_VOLUME_HEADER *FwVolHeader
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -62,25 +62,25 @@ MmCoreFfsFindMmDriver (
|
||||
IN EFI_FIRMWARE_VOLUME_HEADER *FwVolHeader
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
EFI_STATUS DepexStatus;
|
||||
EFI_FFS_FILE_HEADER *FileHeader;
|
||||
EFI_FV_FILETYPE FileType;
|
||||
VOID *Pe32Data;
|
||||
UINTN Pe32DataSize;
|
||||
VOID *Depex;
|
||||
UINTN DepexSize;
|
||||
UINTN Index;
|
||||
EFI_COMMON_SECTION_HEADER *Section;
|
||||
VOID *SectionData;
|
||||
UINTN SectionDataSize;
|
||||
UINT32 DstBufferSize;
|
||||
VOID *ScratchBuffer;
|
||||
UINT32 ScratchBufferSize;
|
||||
VOID *DstBuffer;
|
||||
UINT16 SectionAttribute;
|
||||
UINT32 AuthenticationStatus;
|
||||
EFI_FIRMWARE_VOLUME_HEADER *InnerFvHeader;
|
||||
EFI_STATUS Status;
|
||||
EFI_STATUS DepexStatus;
|
||||
EFI_FFS_FILE_HEADER *FileHeader;
|
||||
EFI_FV_FILETYPE FileType;
|
||||
VOID *Pe32Data;
|
||||
UINTN Pe32DataSize;
|
||||
VOID *Depex;
|
||||
UINTN DepexSize;
|
||||
UINTN Index;
|
||||
EFI_COMMON_SECTION_HEADER *Section;
|
||||
VOID *SectionData;
|
||||
UINTN SectionDataSize;
|
||||
UINT32 DstBufferSize;
|
||||
VOID *ScratchBuffer;
|
||||
UINT32 ScratchBufferSize;
|
||||
VOID *DstBuffer;
|
||||
UINT16 SectionAttribute;
|
||||
UINT32 AuthenticationStatus;
|
||||
EFI_FIRMWARE_VOLUME_HEADER *InnerFvHeader;
|
||||
|
||||
DEBUG ((DEBUG_INFO, "MmCoreFfsFindMmDriver - 0x%x\n", FwVolHeader));
|
||||
|
||||
@@ -95,19 +95,32 @@ MmCoreFfsFindMmDriver (
|
||||
//
|
||||
FileHeader = NULL;
|
||||
do {
|
||||
Status = FfsFindNextFile (EFI_FV_FILETYPE_FIRMWARE_VOLUME_IMAGE,
|
||||
FwVolHeader, &FileHeader);
|
||||
Status = FfsFindNextFile (
|
||||
EFI_FV_FILETYPE_FIRMWARE_VOLUME_IMAGE,
|
||||
FwVolHeader,
|
||||
&FileHeader
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
break;
|
||||
}
|
||||
Status = FfsFindSectionData (EFI_SECTION_GUID_DEFINED, FileHeader,
|
||||
&SectionData, &SectionDataSize);
|
||||
|
||||
Status = FfsFindSectionData (
|
||||
EFI_SECTION_GUID_DEFINED,
|
||||
FileHeader,
|
||||
&SectionData,
|
||||
&SectionDataSize
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
break;
|
||||
}
|
||||
|
||||
Section = (EFI_COMMON_SECTION_HEADER *)(FileHeader + 1);
|
||||
Status = ExtractGuidedSectionGetInfo (Section, &DstBufferSize,
|
||||
&ScratchBufferSize, &SectionAttribute);
|
||||
Status = ExtractGuidedSectionGetInfo (
|
||||
Section,
|
||||
&DstBufferSize,
|
||||
&ScratchBufferSize,
|
||||
&SectionAttribute
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
break;
|
||||
}
|
||||
@@ -131,25 +144,35 @@ MmCoreFfsFindMmDriver (
|
||||
//
|
||||
// Call decompress function
|
||||
//
|
||||
Status = ExtractGuidedSectionDecode (Section, &DstBuffer, ScratchBuffer,
|
||||
&AuthenticationStatus);
|
||||
Status = ExtractGuidedSectionDecode (
|
||||
Section,
|
||||
&DstBuffer,
|
||||
ScratchBuffer,
|
||||
&AuthenticationStatus
|
||||
);
|
||||
FreePages (ScratchBuffer, EFI_SIZE_TO_PAGES (ScratchBufferSize));
|
||||
if (EFI_ERROR (Status)) {
|
||||
goto FreeDstBuffer;
|
||||
}
|
||||
|
||||
DEBUG ((DEBUG_INFO,
|
||||
DEBUG ((
|
||||
DEBUG_INFO,
|
||||
"Processing compressed firmware volume (AuthenticationStatus == %x)\n",
|
||||
AuthenticationStatus));
|
||||
AuthenticationStatus
|
||||
));
|
||||
|
||||
Status = FindFfsSectionInSections (DstBuffer, DstBufferSize,
|
||||
EFI_SECTION_FIRMWARE_VOLUME_IMAGE, &Section);
|
||||
Status = FindFfsSectionInSections (
|
||||
DstBuffer,
|
||||
DstBufferSize,
|
||||
EFI_SECTION_FIRMWARE_VOLUME_IMAGE,
|
||||
&Section
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
goto FreeDstBuffer;
|
||||
}
|
||||
|
||||
InnerFvHeader = (VOID *)(Section + 1);
|
||||
Status = MmCoreFfsFindMmDriver (InnerFvHeader);
|
||||
Status = MmCoreFfsFindMmDriver (InnerFvHeader);
|
||||
if (EFI_ERROR (Status)) {
|
||||
goto FreeDstBuffer;
|
||||
}
|
||||
@@ -157,7 +180,7 @@ MmCoreFfsFindMmDriver (
|
||||
|
||||
for (Index = 0; Index < sizeof (mMmFileTypes) / sizeof (mMmFileTypes[0]); Index++) {
|
||||
DEBUG ((DEBUG_INFO, "Check MmFileTypes - 0x%x\n", mMmFileTypes[Index]));
|
||||
FileType = mMmFileTypes[Index];
|
||||
FileType = mMmFileTypes[Index];
|
||||
FileHeader = NULL;
|
||||
do {
|
||||
Status = FfsFindNextFile (FileType, FwVolHeader, &FileHeader);
|
||||
|
@@ -13,8 +13,8 @@
|
||||
// mProtocolDatabase - A list of all protocols in the system. (simple list for now)
|
||||
// gHandleList - A list of all the handles in the system
|
||||
//
|
||||
LIST_ENTRY mProtocolDatabase = INITIALIZE_LIST_HEAD_VARIABLE (mProtocolDatabase);
|
||||
LIST_ENTRY gHandleList = INITIALIZE_LIST_HEAD_VARIABLE (gHandleList);
|
||||
LIST_ENTRY mProtocolDatabase = INITIALIZE_LIST_HEAD_VARIABLE (mProtocolDatabase);
|
||||
LIST_ENTRY gHandleList = INITIALIZE_LIST_HEAD_VARIABLE (gHandleList);
|
||||
|
||||
/**
|
||||
Check whether a handle is a valid EFI_HANDLE
|
||||
@@ -36,9 +36,11 @@ MmValidateHandle (
|
||||
if (Handle == NULL) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
if (Handle->Signature != EFI_HANDLE_SIGNATURE) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -53,13 +55,13 @@ MmValidateHandle (
|
||||
**/
|
||||
PROTOCOL_ENTRY *
|
||||
MmFindProtocolEntry (
|
||||
IN EFI_GUID *Protocol,
|
||||
IN BOOLEAN Create
|
||||
IN EFI_GUID *Protocol,
|
||||
IN BOOLEAN Create
|
||||
)
|
||||
{
|
||||
LIST_ENTRY *Link;
|
||||
PROTOCOL_ENTRY *Item;
|
||||
PROTOCOL_ENTRY *ProtEntry;
|
||||
LIST_ENTRY *Link;
|
||||
PROTOCOL_ENTRY *Item;
|
||||
PROTOCOL_ENTRY *ProtEntry;
|
||||
|
||||
//
|
||||
// Search the database for the matching GUID
|
||||
@@ -68,8 +70,8 @@ MmFindProtocolEntry (
|
||||
ProtEntry = NULL;
|
||||
for (Link = mProtocolDatabase.ForwardLink;
|
||||
Link != &mProtocolDatabase;
|
||||
Link = Link->ForwardLink) {
|
||||
|
||||
Link = Link->ForwardLink)
|
||||
{
|
||||
Item = CR (Link, PROTOCOL_ENTRY, AllEntries, PROTOCOL_ENTRY_SIGNATURE);
|
||||
if (CompareGuid (&Item->ProtocolID, Protocol)) {
|
||||
//
|
||||
@@ -85,7 +87,7 @@ MmFindProtocolEntry (
|
||||
// allocate a new entry
|
||||
//
|
||||
if ((ProtEntry == NULL) && Create) {
|
||||
ProtEntry = AllocatePool (sizeof(PROTOCOL_ENTRY));
|
||||
ProtEntry = AllocatePool (sizeof (PROTOCOL_ENTRY));
|
||||
if (ProtEntry != NULL) {
|
||||
//
|
||||
// Initialize new protocol entry structure
|
||||
@@ -101,6 +103,7 @@ MmFindProtocolEntry (
|
||||
InsertTailList (&mProtocolDatabase, &ProtEntry->AllEntries);
|
||||
}
|
||||
}
|
||||
|
||||
return ProtEntry;
|
||||
}
|
||||
|
||||
@@ -137,17 +140,19 @@ MmFindProtocolInterface (
|
||||
//
|
||||
// Look at each protocol interface for any matches
|
||||
//
|
||||
for (Link = Handle->Protocols.ForwardLink; Link != &Handle->Protocols; Link=Link->ForwardLink) {
|
||||
for (Link = Handle->Protocols.ForwardLink; Link != &Handle->Protocols; Link = Link->ForwardLink) {
|
||||
//
|
||||
// If this protocol interface matches, remove it
|
||||
//
|
||||
Prot = CR (Link, PROTOCOL_INTERFACE, Link, PROTOCOL_INTERFACE_SIGNATURE);
|
||||
if (Prot->Interface == Interface && Prot->Protocol == ProtEntry) {
|
||||
if ((Prot->Interface == Interface) && (Prot->Protocol == ProtEntry)) {
|
||||
break;
|
||||
}
|
||||
|
||||
Prot = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
return Prot;
|
||||
}
|
||||
|
||||
@@ -219,7 +224,7 @@ MmInstallProtocolInterfaceNotify (
|
||||
// returns EFI_INVALID_PARAMETER if InterfaceType is invalid.
|
||||
// Also added check for invalid UserHandle and Protocol pointers.
|
||||
//
|
||||
if (UserHandle == NULL || Protocol == NULL) {
|
||||
if ((UserHandle == NULL) || (Protocol == NULL)) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
@@ -233,7 +238,7 @@ MmInstallProtocolInterfaceNotify (
|
||||
DEBUG ((DEBUG_LOAD | DEBUG_INFO, "MmInstallProtocolInterface: %g %p\n", Protocol, Interface));
|
||||
|
||||
Status = EFI_OUT_OF_RESOURCES;
|
||||
Prot = NULL;
|
||||
Prot = NULL;
|
||||
Handle = NULL;
|
||||
|
||||
if (*UserHandle != NULL) {
|
||||
@@ -298,8 +303,8 @@ MmInstallProtocolInterfaceNotify (
|
||||
// Initialize the protocol interface structure
|
||||
//
|
||||
Prot->Signature = PROTOCOL_INTERFACE_SIGNATURE;
|
||||
Prot->Handle = Handle;
|
||||
Prot->Protocol = ProtEntry;
|
||||
Prot->Handle = Handle;
|
||||
Prot->Protocol = ProtEntry;
|
||||
Prot->Interface = Interface;
|
||||
|
||||
//
|
||||
@@ -320,6 +325,7 @@ MmInstallProtocolInterfaceNotify (
|
||||
if (Notify) {
|
||||
MmNotifyProtocol (Prot);
|
||||
}
|
||||
|
||||
Status = EFI_SUCCESS;
|
||||
|
||||
Done:
|
||||
@@ -336,6 +342,7 @@ Done:
|
||||
FreePool (Prot);
|
||||
}
|
||||
}
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
@@ -416,6 +423,7 @@ MmUninstallProtocolInterface (
|
||||
RemoveEntryList (&Handle->AllHandles);
|
||||
FreePool (Handle);
|
||||
}
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
@@ -451,12 +459,13 @@ MmGetProtocolInterface (
|
||||
// Look at each protocol interface for a match
|
||||
//
|
||||
for (Link = Handle->Protocols.ForwardLink; Link != &Handle->Protocols; Link = Link->ForwardLink) {
|
||||
Prot = CR (Link, PROTOCOL_INTERFACE, Link, PROTOCOL_INTERFACE_SIGNATURE);
|
||||
Prot = CR (Link, PROTOCOL_INTERFACE, Link, PROTOCOL_INTERFACE_SIGNATURE);
|
||||
ProtEntry = Prot->Protocol;
|
||||
if (CompareGuid (&ProtEntry->ProtocolID, Protocol)) {
|
||||
return Prot;
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@@ -9,7 +9,7 @@
|
||||
|
||||
#include "StandaloneMmCore.h"
|
||||
|
||||
#define CONFIG_TABLE_SIZE_INCREASED 0x10
|
||||
#define CONFIG_TABLE_SIZE_INCREASED 0x10
|
||||
|
||||
UINTN mMmSystemTableAllocateSize = 0;
|
||||
|
||||
@@ -33,10 +33,10 @@ UINTN mMmSystemTableAllocateSize = 0;
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
MmInstallConfigurationTable (
|
||||
IN CONST EFI_MM_SYSTEM_TABLE *SystemTable,
|
||||
IN CONST EFI_GUID *Guid,
|
||||
IN VOID *Table,
|
||||
IN UINTN TableSize
|
||||
IN CONST EFI_MM_SYSTEM_TABLE *SystemTable,
|
||||
IN CONST EFI_GUID *Guid,
|
||||
IN VOID *Table,
|
||||
IN UINTN TableSize
|
||||
)
|
||||
{
|
||||
UINTN Index;
|
||||
@@ -87,7 +87,6 @@ MmInstallConfigurationTable (
|
||||
&(ConfigurationTable[Index + 1]),
|
||||
(gMmCoreMmst.NumberOfTableEntries - Index) * sizeof (EFI_CONFIGURATION_TABLE)
|
||||
);
|
||||
|
||||
} else {
|
||||
//
|
||||
// No matching GUIDs were found, so this is an add operation.
|
||||
@@ -107,7 +106,7 @@ MmInstallConfigurationTable (
|
||||
// Allocate a table with one additional entry.
|
||||
//
|
||||
mMmSystemTableAllocateSize += (CONFIG_TABLE_SIZE_INCREASED * sizeof (EFI_CONFIGURATION_TABLE));
|
||||
ConfigurationTable = AllocatePool (mMmSystemTableAllocateSize);
|
||||
ConfigurationTable = AllocatePool (mMmSystemTableAllocateSize);
|
||||
if (ConfigurationTable == NULL) {
|
||||
//
|
||||
// If a new table could not be allocated, then return an error.
|
||||
|
@@ -12,24 +12,24 @@
|
||||
//
|
||||
// ProtocolRequest - Last LocateHandle request ID
|
||||
//
|
||||
UINTN mEfiLocateHandleRequest = 0;
|
||||
UINTN mEfiLocateHandleRequest = 0;
|
||||
|
||||
//
|
||||
// Internal prototypes
|
||||
//
|
||||
|
||||
typedef struct {
|
||||
EFI_GUID *Protocol;
|
||||
VOID *SearchKey;
|
||||
LIST_ENTRY *Position;
|
||||
PROTOCOL_ENTRY *ProtEntry;
|
||||
EFI_GUID *Protocol;
|
||||
VOID *SearchKey;
|
||||
LIST_ENTRY *Position;
|
||||
PROTOCOL_ENTRY *ProtEntry;
|
||||
} LOCATE_POSITION;
|
||||
|
||||
typedef
|
||||
IHANDLE *
|
||||
(* CORE_GET_NEXT) (
|
||||
IN OUT LOCATE_POSITION *Position,
|
||||
OUT VOID **Interface
|
||||
(*CORE_GET_NEXT) (
|
||||
IN OUT LOCATE_POSITION *Position,
|
||||
OUT VOID **Interface
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -49,7 +49,7 @@ MmGetNextLocateAllHandles (
|
||||
OUT VOID **Interface
|
||||
)
|
||||
{
|
||||
IHANDLE *Handle;
|
||||
IHANDLE *Handle;
|
||||
|
||||
//
|
||||
// Next handle
|
||||
@@ -59,11 +59,12 @@ MmGetNextLocateAllHandles (
|
||||
//
|
||||
// If not at the end of the list, get the handle
|
||||
//
|
||||
Handle = NULL;
|
||||
*Interface = NULL;
|
||||
Handle = NULL;
|
||||
*Interface = NULL;
|
||||
if (Position->Position != &gHandleList) {
|
||||
Handle = CR (Position->Position, IHANDLE, AllHandles, EFI_HANDLE_SIGNATURE);
|
||||
}
|
||||
|
||||
return Handle;
|
||||
}
|
||||
|
||||
@@ -90,8 +91,8 @@ MmGetNextLocateByRegisterNotify (
|
||||
PROTOCOL_INTERFACE *Prot;
|
||||
LIST_ENTRY *Link;
|
||||
|
||||
Handle = NULL;
|
||||
*Interface = NULL;
|
||||
Handle = NULL;
|
||||
*Interface = NULL;
|
||||
ProtNotify = Position->SearchKey;
|
||||
|
||||
//
|
||||
@@ -106,11 +107,12 @@ MmGetNextLocateByRegisterNotify (
|
||||
//
|
||||
Link = ProtNotify->Position->ForwardLink;
|
||||
if (Link != &ProtNotify->Protocol->Protocols) {
|
||||
Prot = CR (Link, PROTOCOL_INTERFACE, ByProtocol, PROTOCOL_INTERFACE_SIGNATURE);
|
||||
Handle = Prot->Handle;
|
||||
Prot = CR (Link, PROTOCOL_INTERFACE, ByProtocol, PROTOCOL_INTERFACE_SIGNATURE);
|
||||
Handle = Prot->Handle;
|
||||
*Interface = Prot->Interface;
|
||||
}
|
||||
}
|
||||
|
||||
return Handle;
|
||||
}
|
||||
|
||||
@@ -135,13 +137,13 @@ MmGetNextLocateByProtocol (
|
||||
LIST_ENTRY *Link;
|
||||
PROTOCOL_INTERFACE *Prot;
|
||||
|
||||
Handle = NULL;
|
||||
*Interface = NULL;
|
||||
for (; ;) {
|
||||
Handle = NULL;
|
||||
*Interface = NULL;
|
||||
for ( ; ;) {
|
||||
//
|
||||
// Next entry
|
||||
//
|
||||
Link = Position->Position->ForwardLink;
|
||||
Link = Position->Position->ForwardLink;
|
||||
Position->Position = Link;
|
||||
|
||||
//
|
||||
@@ -155,8 +157,8 @@ MmGetNextLocateByProtocol (
|
||||
//
|
||||
// Get the handle
|
||||
//
|
||||
Prot = CR (Link, PROTOCOL_INTERFACE, ByProtocol, PROTOCOL_INTERFACE_SIGNATURE);
|
||||
Handle = Prot->Handle;
|
||||
Prot = CR (Link, PROTOCOL_INTERFACE, ByProtocol, PROTOCOL_INTERFACE_SIGNATURE);
|
||||
Handle = Prot->Handle;
|
||||
*Interface = Prot->Interface;
|
||||
|
||||
//
|
||||
@@ -168,6 +170,7 @@ MmGetNextLocateByProtocol (
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return Handle;
|
||||
}
|
||||
|
||||
@@ -195,17 +198,17 @@ MmLocateProtocol (
|
||||
OUT VOID **Interface
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
LOCATE_POSITION Position;
|
||||
PROTOCOL_NOTIFY *ProtNotify;
|
||||
IHANDLE *Handle;
|
||||
EFI_STATUS Status;
|
||||
LOCATE_POSITION Position;
|
||||
PROTOCOL_NOTIFY *ProtNotify;
|
||||
IHANDLE *Handle;
|
||||
|
||||
if ((Interface == NULL) || (Protocol == NULL)) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
*Interface = NULL;
|
||||
Status = EFI_SUCCESS;
|
||||
Status = EFI_SUCCESS;
|
||||
|
||||
//
|
||||
// Set initial position
|
||||
@@ -224,6 +227,7 @@ MmLocateProtocol (
|
||||
if (Position.ProtEntry == NULL) {
|
||||
return EFI_NOT_FOUND;
|
||||
}
|
||||
|
||||
Position.Position = &Position.ProtEntry->Protocols;
|
||||
|
||||
Handle = MmGetNextLocateByProtocol (&Position, Interface);
|
||||
@@ -238,7 +242,7 @@ MmLocateProtocol (
|
||||
// If this is a search by register notify and a handle was
|
||||
// returned, update the register notification position
|
||||
//
|
||||
ProtNotify = Registration;
|
||||
ProtNotify = Registration;
|
||||
ProtNotify->Position = ProtNotify->Position->ForwardLink;
|
||||
}
|
||||
|
||||
@@ -299,48 +303,51 @@ MmLocateHandle (
|
||||
Position.SearchKey = SearchKey;
|
||||
Position.Position = &gHandleList;
|
||||
|
||||
ResultSize = 0;
|
||||
ResultBuffer = (IHANDLE **) Buffer;
|
||||
Status = EFI_SUCCESS;
|
||||
ResultSize = 0;
|
||||
ResultBuffer = (IHANDLE **)Buffer;
|
||||
Status = EFI_SUCCESS;
|
||||
|
||||
//
|
||||
// Get the search function based on type
|
||||
//
|
||||
switch (SearchType) {
|
||||
case AllHandles:
|
||||
GetNext = MmGetNextLocateAllHandles;
|
||||
break;
|
||||
case AllHandles:
|
||||
GetNext = MmGetNextLocateAllHandles;
|
||||
break;
|
||||
|
||||
case ByRegisterNotify:
|
||||
GetNext = MmGetNextLocateByRegisterNotify;
|
||||
//
|
||||
// Must have SearchKey for locate ByRegisterNotify
|
||||
//
|
||||
if (SearchKey == NULL) {
|
||||
Status = EFI_INVALID_PARAMETER;
|
||||
}
|
||||
break;
|
||||
case ByRegisterNotify:
|
||||
GetNext = MmGetNextLocateByRegisterNotify;
|
||||
//
|
||||
// Must have SearchKey for locate ByRegisterNotify
|
||||
//
|
||||
if (SearchKey == NULL) {
|
||||
Status = EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
case ByProtocol:
|
||||
GetNext = MmGetNextLocateByProtocol;
|
||||
if (Protocol == NULL) {
|
||||
break;
|
||||
|
||||
case ByProtocol:
|
||||
GetNext = MmGetNextLocateByProtocol;
|
||||
if (Protocol == NULL) {
|
||||
Status = EFI_INVALID_PARAMETER;
|
||||
break;
|
||||
}
|
||||
|
||||
//
|
||||
// Look up the protocol entry and set the head pointer
|
||||
//
|
||||
Position.ProtEntry = MmFindProtocolEntry (Protocol, FALSE);
|
||||
if (Position.ProtEntry == NULL) {
|
||||
Status = EFI_NOT_FOUND;
|
||||
break;
|
||||
}
|
||||
|
||||
Position.Position = &Position.ProtEntry->Protocols;
|
||||
break;
|
||||
|
||||
default:
|
||||
Status = EFI_INVALID_PARAMETER;
|
||||
break;
|
||||
}
|
||||
//
|
||||
// Look up the protocol entry and set the head pointer
|
||||
//
|
||||
Position.ProtEntry = MmFindProtocolEntry (Protocol, FALSE);
|
||||
if (Position.ProtEntry == NULL) {
|
||||
Status = EFI_NOT_FOUND;
|
||||
break;
|
||||
}
|
||||
Position.Position = &Position.ProtEntry->Protocols;
|
||||
break;
|
||||
|
||||
default:
|
||||
Status = EFI_INVALID_PARAMETER;
|
||||
break;
|
||||
}
|
||||
|
||||
if (EFI_ERROR (Status)) {
|
||||
@@ -351,7 +358,7 @@ MmLocateHandle (
|
||||
// Enumerate out the matching handles
|
||||
//
|
||||
mEfiLocateHandleRequest += 1;
|
||||
for (; ;) {
|
||||
for ( ; ;) {
|
||||
//
|
||||
// Get the next handle. If no more handles, stop
|
||||
//
|
||||
@@ -366,8 +373,8 @@ MmLocateHandle (
|
||||
//
|
||||
ResultSize += sizeof (Handle);
|
||||
if (ResultSize <= *BufferSize) {
|
||||
*ResultBuffer = Handle;
|
||||
ResultBuffer += 1;
|
||||
*ResultBuffer = Handle;
|
||||
ResultBuffer += 1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -388,13 +395,13 @@ MmLocateHandle (
|
||||
|
||||
*BufferSize = ResultSize;
|
||||
|
||||
if (SearchType == ByRegisterNotify && !EFI_ERROR (Status)) {
|
||||
if ((SearchType == ByRegisterNotify) && !EFI_ERROR (Status)) {
|
||||
ASSERT (SearchKey != NULL);
|
||||
//
|
||||
// If this is a search by register notify and a handle was
|
||||
// returned, update the register notification position
|
||||
//
|
||||
ProtNotify = SearchKey;
|
||||
ProtNotify = SearchKey;
|
||||
ProtNotify->Position = ProtNotify->Position->ForwardLink;
|
||||
}
|
||||
}
|
||||
@@ -445,26 +452,27 @@ MmLocateHandleBuffer (
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
BufferSize = 0;
|
||||
BufferSize = 0;
|
||||
*NumberHandles = 0;
|
||||
*Buffer = NULL;
|
||||
Status = MmLocateHandle (
|
||||
SearchType,
|
||||
Protocol,
|
||||
SearchKey,
|
||||
&BufferSize,
|
||||
*Buffer
|
||||
);
|
||||
*Buffer = NULL;
|
||||
Status = MmLocateHandle (
|
||||
SearchType,
|
||||
Protocol,
|
||||
SearchKey,
|
||||
&BufferSize,
|
||||
*Buffer
|
||||
);
|
||||
//
|
||||
// LocateHandleBuffer() returns incorrect status code if SearchType is
|
||||
// invalid.
|
||||
//
|
||||
// Add code to correctly handle expected errors from MmLocateHandle().
|
||||
//
|
||||
if (EFI_ERROR (Status) && Status != EFI_BUFFER_TOO_SMALL) {
|
||||
if (EFI_ERROR (Status) && (Status != EFI_BUFFER_TOO_SMALL)) {
|
||||
if (Status != EFI_INVALID_PARAMETER) {
|
||||
Status = EFI_NOT_FOUND;
|
||||
}
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
@@ -481,7 +489,7 @@ MmLocateHandleBuffer (
|
||||
*Buffer
|
||||
);
|
||||
|
||||
*NumberHandles = BufferSize / sizeof(EFI_HANDLE);
|
||||
*NumberHandles = BufferSize / sizeof (EFI_HANDLE);
|
||||
if (EFI_ERROR (Status)) {
|
||||
*NumberHandles = 0;
|
||||
}
|
||||
|
@@ -20,11 +20,11 @@
|
||||
#define MMI_ENTRY_SIGNATURE SIGNATURE_32('m','m','i','e')
|
||||
|
||||
typedef struct {
|
||||
UINTN Signature;
|
||||
LIST_ENTRY AllEntries; // All entries
|
||||
UINTN Signature;
|
||||
LIST_ENTRY AllEntries; // All entries
|
||||
|
||||
EFI_GUID HandlerType; // Type of interrupt
|
||||
LIST_ENTRY MmiHandlers; // All handlers
|
||||
EFI_GUID HandlerType; // Type of interrupt
|
||||
LIST_ENTRY MmiHandlers; // All handlers
|
||||
} MMI_ENTRY;
|
||||
|
||||
#define MMI_HANDLER_SIGNATURE SIGNATURE_32('m','m','i','h')
|
||||
@@ -65,8 +65,8 @@ MmCoreFindMmiEntry (
|
||||
MmiEntry = NULL;
|
||||
for (Link = mMmiEntryList.ForwardLink;
|
||||
Link != &mMmiEntryList;
|
||||
Link = Link->ForwardLink) {
|
||||
|
||||
Link = Link->ForwardLink)
|
||||
{
|
||||
Item = CR (Link, MMI_ENTRY, AllEntries, MMI_ENTRY_SIGNATURE);
|
||||
if (CompareGuid (&Item->HandlerType, HandlerType)) {
|
||||
//
|
||||
@@ -97,6 +97,7 @@ MmCoreFindMmiEntry (
|
||||
InsertTailList (&mMmiEntryList, &MmiEntry->AllEntries);
|
||||
}
|
||||
}
|
||||
|
||||
return MmiEntry;
|
||||
}
|
||||
|
||||
@@ -130,7 +131,7 @@ MmiManage (
|
||||
BOOLEAN SuccessReturn;
|
||||
EFI_STATUS Status;
|
||||
|
||||
Status = EFI_NOT_FOUND;
|
||||
Status = EFI_NOT_FOUND;
|
||||
SuccessReturn = FALSE;
|
||||
if (HandlerType == NULL) {
|
||||
//
|
||||
@@ -142,7 +143,7 @@ MmiManage (
|
||||
//
|
||||
// Non-root MMI handler
|
||||
//
|
||||
MmiEntry = MmCoreFindMmiEntry ((EFI_GUID *) HandlerType, FALSE);
|
||||
MmiEntry = MmCoreFindMmiEntry ((EFI_GUID *)HandlerType, FALSE);
|
||||
if (MmiEntry == NULL) {
|
||||
//
|
||||
// There is no handler registered for this interrupt source
|
||||
@@ -157,56 +158,58 @@ MmiManage (
|
||||
MmiHandler = CR (Link, MMI_HANDLER, Link, MMI_HANDLER_SIGNATURE);
|
||||
|
||||
Status = MmiHandler->Handler (
|
||||
(EFI_HANDLE) MmiHandler,
|
||||
Context,
|
||||
CommBuffer,
|
||||
CommBufferSize
|
||||
);
|
||||
(EFI_HANDLE)MmiHandler,
|
||||
Context,
|
||||
CommBuffer,
|
||||
CommBufferSize
|
||||
);
|
||||
|
||||
switch (Status) {
|
||||
case EFI_INTERRUPT_PENDING:
|
||||
//
|
||||
// If a handler returns EFI_INTERRUPT_PENDING and HandlerType is not NULL then
|
||||
// no additional handlers will be processed and EFI_INTERRUPT_PENDING will be returned.
|
||||
//
|
||||
if (HandlerType != NULL) {
|
||||
return EFI_INTERRUPT_PENDING;
|
||||
}
|
||||
break;
|
||||
case EFI_INTERRUPT_PENDING:
|
||||
//
|
||||
// If a handler returns EFI_INTERRUPT_PENDING and HandlerType is not NULL then
|
||||
// no additional handlers will be processed and EFI_INTERRUPT_PENDING will be returned.
|
||||
//
|
||||
if (HandlerType != NULL) {
|
||||
return EFI_INTERRUPT_PENDING;
|
||||
}
|
||||
|
||||
case EFI_SUCCESS:
|
||||
//
|
||||
// If at least one of the handlers returns EFI_SUCCESS then the function will return
|
||||
// EFI_SUCCESS. If a handler returns EFI_SUCCESS and HandlerType is not NULL then no
|
||||
// additional handlers will be processed.
|
||||
//
|
||||
if (HandlerType != NULL) {
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
SuccessReturn = TRUE;
|
||||
break;
|
||||
break;
|
||||
|
||||
case EFI_WARN_INTERRUPT_SOURCE_QUIESCED:
|
||||
//
|
||||
// If at least one of the handlers returns EFI_WARN_INTERRUPT_SOURCE_QUIESCED
|
||||
// then the function will return EFI_SUCCESS.
|
||||
//
|
||||
SuccessReturn = TRUE;
|
||||
break;
|
||||
case EFI_SUCCESS:
|
||||
//
|
||||
// If at least one of the handlers returns EFI_SUCCESS then the function will return
|
||||
// EFI_SUCCESS. If a handler returns EFI_SUCCESS and HandlerType is not NULL then no
|
||||
// additional handlers will be processed.
|
||||
//
|
||||
if (HandlerType != NULL) {
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
case EFI_WARN_INTERRUPT_SOURCE_PENDING:
|
||||
//
|
||||
// If all the handlers returned EFI_WARN_INTERRUPT_SOURCE_PENDING
|
||||
// then EFI_WARN_INTERRUPT_SOURCE_PENDING will be returned.
|
||||
//
|
||||
break;
|
||||
SuccessReturn = TRUE;
|
||||
break;
|
||||
|
||||
default:
|
||||
//
|
||||
// Unexpected status code returned.
|
||||
//
|
||||
ASSERT (FALSE);
|
||||
break;
|
||||
case EFI_WARN_INTERRUPT_SOURCE_QUIESCED:
|
||||
//
|
||||
// If at least one of the handlers returns EFI_WARN_INTERRUPT_SOURCE_QUIESCED
|
||||
// then the function will return EFI_SUCCESS.
|
||||
//
|
||||
SuccessReturn = TRUE;
|
||||
break;
|
||||
|
||||
case EFI_WARN_INTERRUPT_SOURCE_PENDING:
|
||||
//
|
||||
// If all the handlers returned EFI_WARN_INTERRUPT_SOURCE_PENDING
|
||||
// then EFI_WARN_INTERRUPT_SOURCE_PENDING will be returned.
|
||||
//
|
||||
break;
|
||||
|
||||
default:
|
||||
//
|
||||
// Unexpected status code returned.
|
||||
//
|
||||
ASSERT (FALSE);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -231,16 +234,16 @@ MmiManage (
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
MmiHandlerRegister (
|
||||
IN EFI_MM_HANDLER_ENTRY_POINT Handler,
|
||||
IN CONST EFI_GUID *HandlerType OPTIONAL,
|
||||
OUT EFI_HANDLE *DispatchHandle
|
||||
IN EFI_MM_HANDLER_ENTRY_POINT Handler,
|
||||
IN CONST EFI_GUID *HandlerType OPTIONAL,
|
||||
OUT EFI_HANDLE *DispatchHandle
|
||||
)
|
||||
{
|
||||
MMI_HANDLER *MmiHandler;
|
||||
MMI_ENTRY *MmiEntry;
|
||||
LIST_ENTRY *List;
|
||||
|
||||
if (Handler == NULL || DispatchHandle == NULL) {
|
||||
if ((Handler == NULL) || (DispatchHandle == NULL)) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
@@ -250,19 +253,19 @@ MmiHandlerRegister (
|
||||
}
|
||||
|
||||
MmiHandler->Signature = MMI_HANDLER_SIGNATURE;
|
||||
MmiHandler->Handler = Handler;
|
||||
MmiHandler->Handler = Handler;
|
||||
|
||||
if (HandlerType == NULL) {
|
||||
//
|
||||
// This is root MMI handler
|
||||
//
|
||||
MmiEntry = NULL;
|
||||
List = &mRootMmiHandlerList;
|
||||
List = &mRootMmiHandlerList;
|
||||
} else {
|
||||
//
|
||||
// None root MMI handler
|
||||
//
|
||||
MmiEntry = MmCoreFindMmiEntry ((EFI_GUID *) HandlerType, TRUE);
|
||||
MmiEntry = MmCoreFindMmiEntry ((EFI_GUID *)HandlerType, TRUE);
|
||||
if (MmiEntry == NULL) {
|
||||
return EFI_OUT_OF_RESOURCES;
|
||||
}
|
||||
@@ -273,7 +276,7 @@ MmiHandlerRegister (
|
||||
MmiHandler->MmiEntry = MmiEntry;
|
||||
InsertTailList (List, &MmiHandler->Link);
|
||||
|
||||
*DispatchHandle = (EFI_HANDLE) MmiHandler;
|
||||
*DispatchHandle = (EFI_HANDLE)MmiHandler;
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
@@ -296,7 +299,7 @@ MmiHandlerUnRegister (
|
||||
MMI_HANDLER *MmiHandler;
|
||||
MMI_ENTRY *MmiEntry;
|
||||
|
||||
MmiHandler = (MMI_HANDLER *) DispatchHandle;
|
||||
MmiHandler = (MMI_HANDLER *)DispatchHandle;
|
||||
|
||||
if (MmiHandler == NULL) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
|
@@ -25,7 +25,7 @@ MmNotifyProtocol (
|
||||
LIST_ENTRY *Link;
|
||||
|
||||
ProtEntry = Prot->Protocol;
|
||||
for (Link=ProtEntry->Notify.ForwardLink; Link != &ProtEntry->Notify; Link=Link->ForwardLink) {
|
||||
for (Link = ProtEntry->Notify.ForwardLink; Link != &ProtEntry->Notify; Link = Link->ForwardLink) {
|
||||
ProtNotify = CR (Link, PROTOCOL_NOTIFY, Link, PROTOCOL_NOTIFY_SIGNATURE);
|
||||
ProtNotify->Function (&ProtEntry->ProtocolID, Prot->Interface, Prot->Handle);
|
||||
}
|
||||
@@ -55,7 +55,6 @@ MmRemoveInterfaceFromProtocol (
|
||||
|
||||
Prot = MmFindProtocolInterface (Handle, Protocol, Interface);
|
||||
if (Prot != NULL) {
|
||||
|
||||
ProtEntry = Prot->Protocol;
|
||||
|
||||
//
|
||||
@@ -96,9 +95,9 @@ MmRemoveInterfaceFromProtocol (
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
MmRegisterProtocolNotify (
|
||||
IN CONST EFI_GUID *Protocol,
|
||||
IN CONST EFI_GUID *Protocol,
|
||||
IN EFI_MM_NOTIFY_FN Function,
|
||||
OUT VOID **Registration
|
||||
OUT VOID **Registration
|
||||
)
|
||||
{
|
||||
PROTOCOL_ENTRY *ProtEntry;
|
||||
@@ -106,7 +105,7 @@ MmRegisterProtocolNotify (
|
||||
LIST_ENTRY *Link;
|
||||
EFI_STATUS Status;
|
||||
|
||||
if (Protocol == NULL || Registration == NULL) {
|
||||
if ((Protocol == NULL) || (Registration == NULL)) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
@@ -114,12 +113,13 @@ MmRegisterProtocolNotify (
|
||||
//
|
||||
// Get the protocol entry per Protocol
|
||||
//
|
||||
ProtEntry = MmFindProtocolEntry ((EFI_GUID *) Protocol, FALSE);
|
||||
ProtEntry = MmFindProtocolEntry ((EFI_GUID *)Protocol, FALSE);
|
||||
if (ProtEntry != NULL) {
|
||||
ProtNotify = (PROTOCOL_NOTIFY * )*Registration;
|
||||
ProtNotify = (PROTOCOL_NOTIFY *)*Registration;
|
||||
for (Link = ProtEntry->Notify.ForwardLink;
|
||||
Link != &ProtEntry->Notify;
|
||||
Link = Link->ForwardLink) {
|
||||
Link = Link->ForwardLink)
|
||||
{
|
||||
//
|
||||
// Compare the notification record
|
||||
//
|
||||
@@ -134,6 +134,7 @@ MmRegisterProtocolNotify (
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// If the registration is not found
|
||||
//
|
||||
@@ -145,19 +146,19 @@ MmRegisterProtocolNotify (
|
||||
//
|
||||
// Get the protocol entry to add the notification too
|
||||
//
|
||||
ProtEntry = MmFindProtocolEntry ((EFI_GUID *) Protocol, TRUE);
|
||||
ProtEntry = MmFindProtocolEntry ((EFI_GUID *)Protocol, TRUE);
|
||||
if (ProtEntry != NULL) {
|
||||
//
|
||||
// Find whether notification already exist
|
||||
//
|
||||
for (Link = ProtEntry->Notify.ForwardLink;
|
||||
Link != &ProtEntry->Notify;
|
||||
Link = Link->ForwardLink) {
|
||||
|
||||
Link = Link->ForwardLink)
|
||||
{
|
||||
ProtNotify = CR (Link, PROTOCOL_NOTIFY, Link, PROTOCOL_NOTIFY_SIGNATURE);
|
||||
if (CompareGuid (&ProtNotify->Protocol->ProtocolID, Protocol) &&
|
||||
(ProtNotify->Function == Function)) {
|
||||
|
||||
(ProtNotify->Function == Function))
|
||||
{
|
||||
//
|
||||
// Notification already exist
|
||||
//
|
||||
@@ -173,8 +174,8 @@ MmRegisterProtocolNotify (
|
||||
ProtNotify = AllocatePool (sizeof (PROTOCOL_NOTIFY));
|
||||
if (ProtNotify != NULL) {
|
||||
ProtNotify->Signature = PROTOCOL_NOTIFY_SIGNATURE;
|
||||
ProtNotify->Protocol = ProtEntry;
|
||||
ProtNotify->Function = Function;
|
||||
ProtNotify->Protocol = ProtEntry;
|
||||
ProtNotify->Function = Function;
|
||||
//
|
||||
// Start at the ending
|
||||
//
|
||||
@@ -191,7 +192,8 @@ MmRegisterProtocolNotify (
|
||||
Status = EFI_OUT_OF_RESOURCES;
|
||||
if (ProtNotify != NULL) {
|
||||
*Registration = ProtNotify;
|
||||
Status = EFI_SUCCESS;
|
||||
Status = EFI_SUCCESS;
|
||||
}
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
@@ -16,7 +16,7 @@
|
||||
|
||||
LIST_ENTRY mMmMemoryMap = INITIALIZE_LIST_HEAD_VARIABLE (mMmMemoryMap);
|
||||
|
||||
UINTN mMapKey;
|
||||
UINTN mMapKey;
|
||||
|
||||
/**
|
||||
Internal Function. Allocate n pages from given free page node.
|
||||
@@ -43,10 +43,11 @@ InternalAllocPagesOnOneNode (
|
||||
if (Top > Pages->NumberOfPages) {
|
||||
Top = Pages->NumberOfPages;
|
||||
}
|
||||
|
||||
Bottom = Top - NumberOfPages;
|
||||
|
||||
if (Top < Pages->NumberOfPages) {
|
||||
Node = (FREE_PAGE_LIST*)((UINTN)Pages + EFI_PAGES_TO_SIZE (Top));
|
||||
Node = (FREE_PAGE_LIST *)((UINTN)Pages + EFI_PAGES_TO_SIZE (Top));
|
||||
Node->NumberOfPages = Pages->NumberOfPages - Top;
|
||||
InsertHeadList (&Pages->Link, &Node->Link);
|
||||
}
|
||||
@@ -82,11 +83,13 @@ InternalAllocMaxAddress (
|
||||
|
||||
for (Node = FreePageList->BackLink; Node != FreePageList; Node = Node->BackLink) {
|
||||
Pages = BASE_CR (Node, FREE_PAGE_LIST, Link);
|
||||
if (Pages->NumberOfPages >= NumberOfPages &&
|
||||
(UINTN)Pages + EFI_PAGES_TO_SIZE (NumberOfPages) - 1 <= MaxAddress) {
|
||||
if ((Pages->NumberOfPages >= NumberOfPages) &&
|
||||
((UINTN)Pages + EFI_PAGES_TO_SIZE (NumberOfPages) - 1 <= MaxAddress))
|
||||
{
|
||||
return InternalAllocPagesOnOneNode (Pages, NumberOfPages, MaxAddress);
|
||||
}
|
||||
}
|
||||
|
||||
return (UINTN)(-1);
|
||||
}
|
||||
|
||||
@@ -116,15 +119,17 @@ InternalAllocAddress (
|
||||
}
|
||||
|
||||
EndAddress = Address + EFI_PAGES_TO_SIZE (NumberOfPages);
|
||||
for (Node = FreePageList->BackLink; Node!= FreePageList; Node = Node->BackLink) {
|
||||
for (Node = FreePageList->BackLink; Node != FreePageList; Node = Node->BackLink) {
|
||||
Pages = BASE_CR (Node, FREE_PAGE_LIST, Link);
|
||||
if ((UINTN)Pages <= Address) {
|
||||
if ((UINTN)Pages + EFI_PAGES_TO_SIZE (Pages->NumberOfPages) < EndAddress) {
|
||||
break;
|
||||
}
|
||||
|
||||
return InternalAllocPagesOnOneNode (Pages, NumberOfPages, EndAddress);
|
||||
}
|
||||
}
|
||||
|
||||
return ~Address;
|
||||
}
|
||||
|
||||
@@ -155,8 +160,9 @@ MmInternalAllocatePages (
|
||||
{
|
||||
UINTN RequestedAddress;
|
||||
|
||||
if (MemoryType != EfiRuntimeServicesCode &&
|
||||
MemoryType != EfiRuntimeServicesData) {
|
||||
if ((MemoryType != EfiRuntimeServicesCode) &&
|
||||
(MemoryType != EfiRuntimeServicesData))
|
||||
{
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
@@ -180,6 +186,7 @@ MmInternalAllocatePages (
|
||||
if (*Memory == (UINTN)-1) {
|
||||
return EFI_OUT_OF_RESOURCES;
|
||||
}
|
||||
|
||||
break;
|
||||
case AllocateAddress:
|
||||
*Memory = InternalAllocAddress (
|
||||
@@ -190,10 +197,12 @@ MmInternalAllocatePages (
|
||||
if (*Memory != RequestedAddress) {
|
||||
return EFI_NOT_FOUND;
|
||||
}
|
||||
|
||||
break;
|
||||
default:
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -245,13 +254,15 @@ InternalMergeNodes (
|
||||
|
||||
Next = BASE_CR (First->Link.ForwardLink, FREE_PAGE_LIST, Link);
|
||||
ASSERT (
|
||||
TRUNCATE_TO_PAGES ((UINTN)Next - (UINTN)First) >= First->NumberOfPages);
|
||||
TRUNCATE_TO_PAGES ((UINTN)Next - (UINTN)First) >= First->NumberOfPages
|
||||
);
|
||||
|
||||
if (TRUNCATE_TO_PAGES ((UINTN)Next - (UINTN)First) == First->NumberOfPages) {
|
||||
First->NumberOfPages += Next->NumberOfPages;
|
||||
RemoveEntryList (&Next->Link);
|
||||
Next = First;
|
||||
}
|
||||
|
||||
return Next;
|
||||
}
|
||||
|
||||
@@ -281,17 +292,19 @@ MmInternalFreePages (
|
||||
}
|
||||
|
||||
Pages = NULL;
|
||||
Node = mMmMemoryMap.ForwardLink;
|
||||
Node = mMmMemoryMap.ForwardLink;
|
||||
while (Node != &mMmMemoryMap) {
|
||||
Pages = BASE_CR (Node, FREE_PAGE_LIST, Link);
|
||||
if (Memory < (UINTN)Pages) {
|
||||
break;
|
||||
}
|
||||
|
||||
Node = Node->ForwardLink;
|
||||
}
|
||||
|
||||
if (Node != &mMmMemoryMap &&
|
||||
Memory + EFI_PAGES_TO_SIZE (NumberOfPages) > (UINTN)Pages) {
|
||||
if ((Node != &mMmMemoryMap) &&
|
||||
(Memory + EFI_PAGES_TO_SIZE (NumberOfPages) > (UINTN)Pages))
|
||||
{
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
@@ -302,7 +315,7 @@ MmInternalFreePages (
|
||||
}
|
||||
}
|
||||
|
||||
Pages = (FREE_PAGE_LIST*)(UINTN)Memory;
|
||||
Pages = (FREE_PAGE_LIST *)(UINTN)Memory;
|
||||
Pages->NumberOfPages = NumberOfPages;
|
||||
InsertTailList (Node, &Pages->Link);
|
||||
|
||||
@@ -373,6 +386,6 @@ MmAddMemoryRegion (
|
||||
// Align range on an EFI_PAGE_SIZE boundary
|
||||
//
|
||||
AlignedMemBase = (UINTN)(MemBase + EFI_PAGE_MASK) & ~EFI_PAGE_MASK;
|
||||
MemLength -= AlignedMemBase - MemBase;
|
||||
MemLength -= AlignedMemBase - MemBase;
|
||||
MmFreePages (AlignedMemBase, TRUNCATE_TO_PAGES ((UINTN)MemLength));
|
||||
}
|
||||
|
@@ -14,7 +14,7 @@ LIST_ENTRY mMmPoolLists[MAX_POOL_INDEX];
|
||||
// To cache the MMRAM base since when Loading modules At fixed address feature is enabled,
|
||||
// all module is assigned an offset relative the MMRAM base in build time.
|
||||
//
|
||||
GLOBAL_REMOVE_IF_UNREFERENCED EFI_PHYSICAL_ADDRESS gLoadModuleAtFixAddressMmramBase = 0;
|
||||
GLOBAL_REMOVE_IF_UNREFERENCED EFI_PHYSICAL_ADDRESS gLoadModuleAtFixAddressMmramBase = 0;
|
||||
|
||||
/**
|
||||
Called to initialize the memory service.
|
||||
@@ -29,7 +29,7 @@ MmInitializeMemoryServices (
|
||||
IN EFI_MMRAM_DESCRIPTOR *MmramRanges
|
||||
)
|
||||
{
|
||||
UINTN Index;
|
||||
UINTN Index;
|
||||
|
||||
//
|
||||
// Initialize Pool list
|
||||
@@ -38,7 +38,6 @@ MmInitializeMemoryServices (
|
||||
InitializeListHead (&mMmPoolLists[--Index]);
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Initialize free MMRAM regions
|
||||
//
|
||||
@@ -49,8 +48,14 @@ MmInitializeMemoryServices (
|
||||
if (MmramRanges[Index].CpuStart < BASE_1MB) {
|
||||
continue;
|
||||
}
|
||||
DEBUG ((DEBUG_INFO, "MmAddMemoryRegion %d : 0x%016lx - 0x%016lx\n",
|
||||
Index, MmramRanges[Index].CpuStart, MmramRanges[Index].PhysicalSize));
|
||||
|
||||
DEBUG ((
|
||||
DEBUG_INFO,
|
||||
"MmAddMemoryRegion %d : 0x%016lx - 0x%016lx\n",
|
||||
Index,
|
||||
MmramRanges[Index].CpuStart,
|
||||
MmramRanges[Index].PhysicalSize
|
||||
));
|
||||
MmAddMemoryRegion (
|
||||
MmramRanges[Index].CpuStart,
|
||||
MmramRanges[Index].PhysicalSize,
|
||||
@@ -58,7 +63,6 @@ MmInitializeMemoryServices (
|
||||
MmramRanges[Index].RegionState
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -83,7 +87,7 @@ InternalAllocPoolByIndex (
|
||||
|
||||
ASSERT (PoolIndex <= MAX_POOL_INDEX);
|
||||
Status = EFI_SUCCESS;
|
||||
Hdr = NULL;
|
||||
Hdr = NULL;
|
||||
if (PoolIndex == MAX_POOL_INDEX) {
|
||||
Status = MmInternalAllocatePages (
|
||||
AllocateAnyPages,
|
||||
@@ -94,22 +98,23 @@ InternalAllocPoolByIndex (
|
||||
if (EFI_ERROR (Status)) {
|
||||
return EFI_OUT_OF_RESOURCES;
|
||||
}
|
||||
Hdr = (FREE_POOL_HEADER *) (UINTN) Address;
|
||||
|
||||
Hdr = (FREE_POOL_HEADER *)(UINTN)Address;
|
||||
} else if (!IsListEmpty (&mMmPoolLists[PoolIndex])) {
|
||||
Hdr = BASE_CR (GetFirstNode (&mMmPoolLists[PoolIndex]), FREE_POOL_HEADER, Link);
|
||||
RemoveEntryList (&Hdr->Link);
|
||||
} else {
|
||||
Status = InternalAllocPoolByIndex (PoolIndex + 1, &Hdr);
|
||||
if (!EFI_ERROR (Status)) {
|
||||
Hdr->Header.Size >>= 1;
|
||||
Hdr->Header.Size >>= 1;
|
||||
Hdr->Header.Available = TRUE;
|
||||
InsertHeadList (&mMmPoolLists[PoolIndex], &Hdr->Link);
|
||||
Hdr = (FREE_POOL_HEADER*)((UINT8*)Hdr + Hdr->Header.Size);
|
||||
Hdr = (FREE_POOL_HEADER *)((UINT8 *)Hdr + Hdr->Header.Size);
|
||||
}
|
||||
}
|
||||
|
||||
if (!EFI_ERROR (Status)) {
|
||||
Hdr->Header.Size = MIN_POOL_SIZE << PoolIndex;
|
||||
Hdr->Header.Size = MIN_POOL_SIZE << PoolIndex;
|
||||
Hdr->Header.Available = FALSE;
|
||||
}
|
||||
|
||||
@@ -136,7 +141,7 @@ InternalFreePoolByIndex (
|
||||
ASSERT (((UINTN)FreePoolHdr & (FreePoolHdr->Header.Size - 1)) == 0);
|
||||
ASSERT (FreePoolHdr->Header.Size >= MIN_POOL_SIZE);
|
||||
|
||||
PoolIndex = (UINTN) (HighBitSet32 ((UINT32)FreePoolHdr->Header.Size) - MIN_POOL_SHIFT);
|
||||
PoolIndex = (UINTN)(HighBitSet32 ((UINT32)FreePoolHdr->Header.Size) - MIN_POOL_SHIFT);
|
||||
FreePoolHdr->Header.Available = TRUE;
|
||||
ASSERT (PoolIndex < MAX_POOL_INDEX);
|
||||
InsertHeadList (&mMmPoolLists[PoolIndex], &FreePoolHdr->Link);
|
||||
@@ -170,28 +175,29 @@ MmInternalAllocatePool (
|
||||
EFI_PHYSICAL_ADDRESS Address;
|
||||
UINTN PoolIndex;
|
||||
|
||||
if (PoolType != EfiRuntimeServicesCode &&
|
||||
PoolType != EfiRuntimeServicesData) {
|
||||
if ((PoolType != EfiRuntimeServicesCode) &&
|
||||
(PoolType != EfiRuntimeServicesData))
|
||||
{
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
Size += sizeof (*PoolHdr);
|
||||
if (Size > MAX_POOL_SIZE) {
|
||||
Size = EFI_SIZE_TO_PAGES (Size);
|
||||
Size = EFI_SIZE_TO_PAGES (Size);
|
||||
Status = MmInternalAllocatePages (AllocateAnyPages, PoolType, Size, &Address);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
}
|
||||
|
||||
PoolHdr = (POOL_HEADER*)(UINTN)Address;
|
||||
PoolHdr->Size = EFI_PAGES_TO_SIZE (Size);
|
||||
PoolHdr = (POOL_HEADER *)(UINTN)Address;
|
||||
PoolHdr->Size = EFI_PAGES_TO_SIZE (Size);
|
||||
PoolHdr->Available = FALSE;
|
||||
*Buffer = PoolHdr + 1;
|
||||
*Buffer = PoolHdr + 1;
|
||||
return Status;
|
||||
}
|
||||
|
||||
Size = (Size + MIN_POOL_SIZE - 1) >> MIN_POOL_SHIFT;
|
||||
PoolIndex = (UINTN) HighBitSet32 ((UINT32)Size);
|
||||
Size = (Size + MIN_POOL_SIZE - 1) >> MIN_POOL_SHIFT;
|
||||
PoolIndex = (UINTN)HighBitSet32 ((UINT32)Size);
|
||||
if ((Size & (Size - 1)) != 0) {
|
||||
PoolIndex++;
|
||||
}
|
||||
@@ -200,6 +206,7 @@ MmInternalAllocatePool (
|
||||
if (!EFI_ERROR (Status)) {
|
||||
*Buffer = &FreePoolHdr->Header + 1;
|
||||
}
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
@@ -251,7 +258,7 @@ MmInternalFreePool (
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
FreePoolHdr = (FREE_POOL_HEADER*)((POOL_HEADER*)Buffer - 1);
|
||||
FreePoolHdr = (FREE_POOL_HEADER *)((POOL_HEADER *)Buffer - 1);
|
||||
ASSERT (!FreePoolHdr->Header.Available);
|
||||
|
||||
if (FreePoolHdr->Header.Size > MAX_POOL_SIZE) {
|
||||
@@ -262,6 +269,7 @@ MmInternalFreePool (
|
||||
EFI_SIZE_TO_PAGES (FreePoolHdr->Header.Size)
|
||||
);
|
||||
}
|
||||
|
||||
return InternalFreePoolByIndex (FreePoolHdr);
|
||||
}
|
||||
|
||||
|
@@ -22,7 +22,7 @@ MmDispatcher (
|
||||
//
|
||||
// Globals used to initialize the protocol
|
||||
//
|
||||
EFI_HANDLE mMmCpuHandle = NULL;
|
||||
EFI_HANDLE mMmCpuHandle = NULL;
|
||||
|
||||
//
|
||||
// Physical pointer to private structure shared between MM IPL and the MM Core
|
||||
@@ -33,7 +33,6 @@ MM_CORE_PRIVATE_DATA *gMmCorePrivate;
|
||||
// MM Core global variable for MM System Table. Only accessed as a physical structure in MMRAM.
|
||||
//
|
||||
EFI_MM_SYSTEM_TABLE gMmCoreMmst = {
|
||||
|
||||
// The table header for the MMST.
|
||||
{
|
||||
MM_MMST_SIGNATURE,
|
||||
@@ -49,12 +48,12 @@ EFI_MM_SYSTEM_TABLE gMmCoreMmst = {
|
||||
// I/O Service
|
||||
{
|
||||
{
|
||||
(EFI_MM_CPU_IO) MmEfiNotAvailableYetArg5, // MmMemRead
|
||||
(EFI_MM_CPU_IO) MmEfiNotAvailableYetArg5 // MmMemWrite
|
||||
(EFI_MM_CPU_IO)MmEfiNotAvailableYetArg5, // MmMemRead
|
||||
(EFI_MM_CPU_IO)MmEfiNotAvailableYetArg5 // MmMemWrite
|
||||
},
|
||||
{
|
||||
(EFI_MM_CPU_IO) MmEfiNotAvailableYetArg5, // MmIoRead
|
||||
(EFI_MM_CPU_IO) MmEfiNotAvailableYetArg5 // MmIoWrite
|
||||
(EFI_MM_CPU_IO)MmEfiNotAvailableYetArg5, // MmIoRead
|
||||
(EFI_MM_CPU_IO)MmEfiNotAvailableYetArg5 // MmIoWrite
|
||||
}
|
||||
},
|
||||
// Runtime memory services
|
||||
@@ -85,16 +84,16 @@ EFI_MM_SYSTEM_TABLE gMmCoreMmst = {
|
||||
// Table of MMI Handlers that are registered by the MM Core when it is initialized
|
||||
//
|
||||
MM_CORE_MMI_HANDLERS mMmCoreMmiHandlers[] = {
|
||||
{ MmReadyToLockHandler, &gEfiDxeMmReadyToLockProtocolGuid, NULL, TRUE },
|
||||
{ MmEndOfDxeHandler, &gEfiEndOfDxeEventGroupGuid, NULL, FALSE },
|
||||
{ MmExitBootServiceHandler,&gEfiEventExitBootServicesGuid, NULL, FALSE },
|
||||
{ MmReadyToBootHandler, &gEfiEventReadyToBootGuid, NULL, FALSE },
|
||||
{ NULL, NULL, NULL, FALSE },
|
||||
{ MmReadyToLockHandler, &gEfiDxeMmReadyToLockProtocolGuid, NULL, TRUE },
|
||||
{ MmEndOfDxeHandler, &gEfiEndOfDxeEventGroupGuid, NULL, FALSE },
|
||||
{ MmExitBootServiceHandler, &gEfiEventExitBootServicesGuid, NULL, FALSE },
|
||||
{ MmReadyToBootHandler, &gEfiEventReadyToBootGuid, NULL, FALSE },
|
||||
{ NULL, NULL, NULL, FALSE },
|
||||
};
|
||||
|
||||
EFI_SYSTEM_TABLE *mEfiSystemTable;
|
||||
UINTN mMmramRangeCount;
|
||||
EFI_MMRAM_DESCRIPTOR *mMmramRanges;
|
||||
EFI_SYSTEM_TABLE *mEfiSystemTable;
|
||||
UINTN mMmramRangeCount;
|
||||
EFI_MMRAM_DESCRIPTOR *mMmramRanges;
|
||||
|
||||
/**
|
||||
Place holder function until all the MM System Table Service are available.
|
||||
@@ -113,11 +112,11 @@ EFI_MMRAM_DESCRIPTOR *mMmramRanges;
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
MmEfiNotAvailableYetArg5 (
|
||||
UINTN Arg1,
|
||||
UINTN Arg2,
|
||||
UINTN Arg3,
|
||||
UINTN Arg4,
|
||||
UINTN Arg5
|
||||
UINTN Arg1,
|
||||
UINTN Arg2,
|
||||
UINTN Arg3,
|
||||
UINTN Arg4,
|
||||
UINTN Arg5
|
||||
)
|
||||
{
|
||||
//
|
||||
@@ -148,20 +147,21 @@ MmExitBootServiceHandler (
|
||||
IN OUT UINTN *CommBufferSize OPTIONAL
|
||||
)
|
||||
{
|
||||
EFI_HANDLE MmHandle;
|
||||
EFI_STATUS Status;
|
||||
STATIC BOOLEAN mInExitBootServices = FALSE;
|
||||
EFI_HANDLE MmHandle;
|
||||
EFI_STATUS Status;
|
||||
STATIC BOOLEAN mInExitBootServices = FALSE;
|
||||
|
||||
Status = EFI_SUCCESS;
|
||||
if (!mInExitBootServices) {
|
||||
MmHandle = NULL;
|
||||
Status = MmInstallProtocolInterface (
|
||||
&MmHandle,
|
||||
&gEfiEventExitBootServicesGuid,
|
||||
EFI_NATIVE_INTERFACE,
|
||||
NULL
|
||||
);
|
||||
Status = MmInstallProtocolInterface (
|
||||
&MmHandle,
|
||||
&gEfiEventExitBootServicesGuid,
|
||||
EFI_NATIVE_INTERFACE,
|
||||
NULL
|
||||
);
|
||||
}
|
||||
|
||||
mInExitBootServices = TRUE;
|
||||
return Status;
|
||||
}
|
||||
@@ -187,20 +187,21 @@ MmReadyToBootHandler (
|
||||
IN OUT UINTN *CommBufferSize OPTIONAL
|
||||
)
|
||||
{
|
||||
EFI_HANDLE MmHandle;
|
||||
EFI_STATUS Status;
|
||||
STATIC BOOLEAN mInReadyToBoot = FALSE;
|
||||
EFI_HANDLE MmHandle;
|
||||
EFI_STATUS Status;
|
||||
STATIC BOOLEAN mInReadyToBoot = FALSE;
|
||||
|
||||
Status = EFI_SUCCESS;
|
||||
if (!mInReadyToBoot) {
|
||||
MmHandle = NULL;
|
||||
Status = MmInstallProtocolInterface (
|
||||
&MmHandle,
|
||||
&gEfiEventReadyToBootGuid,
|
||||
EFI_NATIVE_INTERFACE,
|
||||
NULL
|
||||
);
|
||||
Status = MmInstallProtocolInterface (
|
||||
&MmHandle,
|
||||
&gEfiEventReadyToBootGuid,
|
||||
EFI_NATIVE_INTERFACE,
|
||||
NULL
|
||||
);
|
||||
}
|
||||
|
||||
mInReadyToBoot = TRUE;
|
||||
return Status;
|
||||
}
|
||||
@@ -249,36 +250,35 @@ MmReadyToLockHandler (
|
||||
// Install MM Ready to lock protocol
|
||||
//
|
||||
MmHandle = NULL;
|
||||
Status = MmInstallProtocolInterface (
|
||||
&MmHandle,
|
||||
&gEfiMmReadyToLockProtocolGuid,
|
||||
EFI_NATIVE_INTERFACE,
|
||||
NULL
|
||||
);
|
||||
Status = MmInstallProtocolInterface (
|
||||
&MmHandle,
|
||||
&gEfiMmReadyToLockProtocolGuid,
|
||||
EFI_NATIVE_INTERFACE,
|
||||
NULL
|
||||
);
|
||||
|
||||
//
|
||||
// Make sure MM CPU I/O 2 Protocol has been installed into the handle database
|
||||
//
|
||||
//Status = MmLocateProtocol (&EFI_MM_CPU_IO_PROTOCOL_GUID, NULL, &Interface);
|
||||
// Status = MmLocateProtocol (&EFI_MM_CPU_IO_PROTOCOL_GUID, NULL, &Interface);
|
||||
|
||||
//
|
||||
// Print a message on a debug build if the MM CPU I/O 2 Protocol is not installed
|
||||
//
|
||||
//if (EFI_ERROR (Status)) {
|
||||
//DEBUG ((DEBUG_ERROR, "\nSMM: SmmCpuIo Arch Protocol not present!!\n"));
|
||||
//}
|
||||
|
||||
// if (EFI_ERROR (Status)) {
|
||||
// DEBUG ((DEBUG_ERROR, "\nSMM: SmmCpuIo Arch Protocol not present!!\n"));
|
||||
// }
|
||||
|
||||
//
|
||||
// Assert if the CPU I/O 2 Protocol is not installed
|
||||
//
|
||||
//ASSERT_EFI_ERROR (Status);
|
||||
// ASSERT_EFI_ERROR (Status);
|
||||
|
||||
//
|
||||
// Display any drivers that were not dispatched because dependency expression
|
||||
// evaluated to false if this is a debug build
|
||||
//
|
||||
//MmDisplayDiscoveredNotDispatched ();
|
||||
// MmDisplayDiscoveredNotDispatched ();
|
||||
|
||||
return Status;
|
||||
}
|
||||
@@ -314,17 +314,15 @@ MmEndOfDxeHandler (
|
||||
// Install MM EndOfDxe protocol
|
||||
//
|
||||
MmHandle = NULL;
|
||||
Status = MmInstallProtocolInterface (
|
||||
&MmHandle,
|
||||
&gEfiMmEndOfDxeProtocolGuid,
|
||||
EFI_NATIVE_INTERFACE,
|
||||
NULL
|
||||
);
|
||||
Status = MmInstallProtocolInterface (
|
||||
&MmHandle,
|
||||
&gEfiMmEndOfDxeProtocolGuid,
|
||||
EFI_NATIVE_INTERFACE,
|
||||
NULL
|
||||
);
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
The main entry point to MM Foundation.
|
||||
|
||||
@@ -338,9 +336,9 @@ VOID
|
||||
EFIAPI
|
||||
MmEntryPoint (
|
||||
IN CONST EFI_MM_ENTRY_CONTEXT *MmEntryContext
|
||||
)
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
EFI_STATUS Status;
|
||||
EFI_MM_COMMUNICATE_HEADER *CommunicateHeader;
|
||||
|
||||
DEBUG ((DEBUG_INFO, "MmEntryPoint ...\n"));
|
||||
@@ -353,7 +351,7 @@ MmEntryPoint (
|
||||
//
|
||||
// Call platform hook before Mm Dispatch
|
||||
//
|
||||
//PlatformHookBeforeMmDispatch ();
|
||||
// PlatformHookBeforeMmDispatch ();
|
||||
|
||||
//
|
||||
// If a legacy boot has occurred, then make sure gMmCorePrivate is not accessed
|
||||
@@ -377,23 +375,23 @@ MmEntryPoint (
|
||||
// If CommunicationBuffer is not in valid address scope, return EFI_INVALID_PARAMETER
|
||||
//
|
||||
gMmCorePrivate->CommunicationBuffer = 0;
|
||||
gMmCorePrivate->ReturnStatus = EFI_INVALID_PARAMETER;
|
||||
gMmCorePrivate->ReturnStatus = EFI_INVALID_PARAMETER;
|
||||
} else {
|
||||
CommunicateHeader = (EFI_MM_COMMUNICATE_HEADER *)(UINTN)gMmCorePrivate->CommunicationBuffer;
|
||||
CommunicateHeader = (EFI_MM_COMMUNICATE_HEADER *)(UINTN)gMmCorePrivate->CommunicationBuffer;
|
||||
gMmCorePrivate->BufferSize -= OFFSET_OF (EFI_MM_COMMUNICATE_HEADER, Data);
|
||||
Status = MmiManage (
|
||||
&CommunicateHeader->HeaderGuid,
|
||||
NULL,
|
||||
CommunicateHeader->Data,
|
||||
(UINTN *)&gMmCorePrivate->BufferSize
|
||||
);
|
||||
Status = MmiManage (
|
||||
&CommunicateHeader->HeaderGuid,
|
||||
NULL,
|
||||
CommunicateHeader->Data,
|
||||
(UINTN *)&gMmCorePrivate->BufferSize
|
||||
);
|
||||
//
|
||||
// Update CommunicationBuffer, BufferSize and ReturnStatus
|
||||
// Communicate service finished, reset the pointer to CommBuffer to NULL
|
||||
//
|
||||
gMmCorePrivate->BufferSize += OFFSET_OF (EFI_MM_COMMUNICATE_HEADER, Data);
|
||||
gMmCorePrivate->BufferSize += OFFSET_OF (EFI_MM_COMMUNICATE_HEADER, Data);
|
||||
gMmCorePrivate->CommunicationBuffer = 0;
|
||||
gMmCorePrivate->ReturnStatus = (Status == EFI_SUCCESS) ? EFI_SUCCESS : EFI_NOT_FOUND;
|
||||
gMmCorePrivate->ReturnStatus = (Status == EFI_SUCCESS) ? EFI_SUCCESS : EFI_NOT_FOUND;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -426,12 +424,12 @@ MmEntryPoint (
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
MmConfigurationMmNotify (
|
||||
IN CONST EFI_GUID *Protocol,
|
||||
IN VOID *Interface,
|
||||
IN CONST EFI_GUID *Protocol,
|
||||
IN VOID *Interface,
|
||||
IN EFI_HANDLE Handle
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
EFI_STATUS Status;
|
||||
EFI_MM_CONFIGURATION_PROTOCOL *MmConfiguration;
|
||||
|
||||
DEBUG ((DEBUG_INFO, "MmConfigurationMmNotify(%g) - %x\n", Protocol, Interface));
|
||||
@@ -465,17 +463,18 @@ MmConfigurationMmNotify (
|
||||
**/
|
||||
UINTN
|
||||
GetHobListSize (
|
||||
IN VOID *HobStart
|
||||
IN VOID *HobStart
|
||||
)
|
||||
{
|
||||
EFI_PEI_HOB_POINTERS Hob;
|
||||
|
||||
ASSERT (HobStart != NULL);
|
||||
|
||||
Hob.Raw = (UINT8 *) HobStart;
|
||||
Hob.Raw = (UINT8 *)HobStart;
|
||||
while (!END_OF_HOB_LIST (Hob)) {
|
||||
Hob.Raw = GET_NEXT_HOB (Hob);
|
||||
}
|
||||
|
||||
//
|
||||
// Need plus END_OF_HOB_LIST
|
||||
//
|
||||
@@ -529,23 +528,24 @@ StandaloneMmMain (
|
||||
// Allocate and zero memory for a MM_CORE_PRIVATE_DATA table and then
|
||||
// initialise it
|
||||
//
|
||||
gMmCorePrivate = (MM_CORE_PRIVATE_DATA *) AllocateRuntimePages(EFI_SIZE_TO_PAGES(sizeof (MM_CORE_PRIVATE_DATA)));
|
||||
gMmCorePrivate = (MM_CORE_PRIVATE_DATA *)AllocateRuntimePages (EFI_SIZE_TO_PAGES (sizeof (MM_CORE_PRIVATE_DATA)));
|
||||
SetMem ((VOID *)(UINTN)gMmCorePrivate, sizeof (MM_CORE_PRIVATE_DATA), 0);
|
||||
gMmCorePrivate->Signature = MM_CORE_PRIVATE_DATA_SIGNATURE;
|
||||
gMmCorePrivate->Signature = MM_CORE_PRIVATE_DATA_SIGNATURE;
|
||||
gMmCorePrivate->MmEntryPointRegistered = FALSE;
|
||||
gMmCorePrivate->InMm = FALSE;
|
||||
gMmCorePrivate->ReturnStatus = EFI_SUCCESS;
|
||||
gMmCorePrivate->InMm = FALSE;
|
||||
gMmCorePrivate->ReturnStatus = EFI_SUCCESS;
|
||||
|
||||
//
|
||||
// Extract the MMRAM ranges from the MMRAM descriptor HOB
|
||||
//
|
||||
MmramRangesHob = GetNextGuidHob (&gEfiMmPeiMmramMemoryReserveGuid, HobStart);
|
||||
if (MmramRangesHob == NULL)
|
||||
if (MmramRangesHob == NULL) {
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
|
||||
MmramRangesHobData = GET_GUID_HOB_DATA (MmramRangesHob);
|
||||
ASSERT (MmramRangesHobData != NULL);
|
||||
MmramRanges = MmramRangesHobData->Descriptor;
|
||||
MmramRanges = MmramRangesHobData->Descriptor;
|
||||
MmramRangeCount = (UINTN)MmramRangesHobData->NumberOfMmReservedRegions;
|
||||
ASSERT (MmramRanges);
|
||||
ASSERT (MmramRangeCount);
|
||||
@@ -555,7 +555,7 @@ StandaloneMmMain (
|
||||
// code relies on them being present there
|
||||
//
|
||||
gMmCorePrivate->MmramRangeCount = (UINT64)MmramRangeCount;
|
||||
gMmCorePrivate->MmramRanges =
|
||||
gMmCorePrivate->MmramRanges =
|
||||
(EFI_PHYSICAL_ADDRESS)(UINTN)AllocatePool (MmramRangeCount * sizeof (EFI_MMRAM_DESCRIPTOR));
|
||||
ASSERT (gMmCorePrivate->MmramRanges != 0);
|
||||
CopyMem (
|
||||
@@ -565,7 +565,7 @@ StandaloneMmMain (
|
||||
);
|
||||
} else {
|
||||
DataInHob = GET_GUID_HOB_DATA (GuidHob);
|
||||
gMmCorePrivate = (MM_CORE_PRIVATE_DATA *)(UINTN)DataInHob->Address;
|
||||
gMmCorePrivate = (MM_CORE_PRIVATE_DATA *)(UINTN)DataInHob->Address;
|
||||
MmramRanges = (EFI_MMRAM_DESCRIPTOR *)(UINTN)gMmCorePrivate->MmramRanges;
|
||||
MmramRangeCount = (UINTN)gMmCorePrivate->MmramRangeCount;
|
||||
}
|
||||
@@ -575,9 +575,13 @@ StandaloneMmMain (
|
||||
//
|
||||
DEBUG ((DEBUG_INFO, "MmramRangeCount - 0x%x\n", MmramRangeCount));
|
||||
for (Index = 0; Index < MmramRangeCount; Index++) {
|
||||
DEBUG ((DEBUG_INFO, "MmramRanges[%d]: 0x%016lx - 0x%lx\n", Index,
|
||||
MmramRanges[Index].CpuStart,
|
||||
MmramRanges[Index].PhysicalSize));
|
||||
DEBUG ((
|
||||
DEBUG_INFO,
|
||||
"MmramRanges[%d]: 0x%016lx - 0x%lx\n",
|
||||
Index,
|
||||
MmramRanges[Index].CpuStart,
|
||||
MmramRanges[Index].PhysicalSize
|
||||
));
|
||||
}
|
||||
|
||||
//
|
||||
@@ -600,7 +604,7 @@ StandaloneMmMain (
|
||||
gMmCorePrivate->StandaloneBfvAddress = BfvHob->BaseAddress;
|
||||
}
|
||||
|
||||
gMmCorePrivate->Mmst = (EFI_PHYSICAL_ADDRESS)(UINTN)&gMmCoreMmst;
|
||||
gMmCorePrivate->Mmst = (EFI_PHYSICAL_ADDRESS)(UINTN)&gMmCoreMmst;
|
||||
gMmCorePrivate->MmEntryPoint = (EFI_PHYSICAL_ADDRESS)(UINTN)MmEntryPoint;
|
||||
|
||||
//
|
||||
|
@@ -59,64 +59,64 @@ typedef struct {
|
||||
//
|
||||
// Structure for recording the state of an MM Driver
|
||||
//
|
||||
#define EFI_MM_DRIVER_ENTRY_SIGNATURE SIGNATURE_32('s', 'd','r','v')
|
||||
#define EFI_MM_DRIVER_ENTRY_SIGNATURE SIGNATURE_32('s', 'd','r','v')
|
||||
|
||||
typedef struct {
|
||||
UINTN Signature;
|
||||
LIST_ENTRY Link; // mDriverList
|
||||
UINTN Signature;
|
||||
LIST_ENTRY Link; // mDriverList
|
||||
|
||||
LIST_ENTRY ScheduledLink; // mScheduledQueue
|
||||
LIST_ENTRY ScheduledLink; // mScheduledQueue
|
||||
|
||||
EFI_FIRMWARE_VOLUME_HEADER *FwVolHeader;
|
||||
EFI_GUID FileName;
|
||||
VOID *Pe32Data;
|
||||
UINTN Pe32DataSize;
|
||||
EFI_FIRMWARE_VOLUME_HEADER *FwVolHeader;
|
||||
EFI_GUID FileName;
|
||||
VOID *Pe32Data;
|
||||
UINTN Pe32DataSize;
|
||||
|
||||
VOID *Depex;
|
||||
UINTN DepexSize;
|
||||
VOID *Depex;
|
||||
UINTN DepexSize;
|
||||
|
||||
BOOLEAN Before;
|
||||
BOOLEAN After;
|
||||
EFI_GUID BeforeAfterGuid;
|
||||
BOOLEAN Before;
|
||||
BOOLEAN After;
|
||||
EFI_GUID BeforeAfterGuid;
|
||||
|
||||
BOOLEAN Dependent;
|
||||
BOOLEAN Scheduled;
|
||||
BOOLEAN Initialized;
|
||||
BOOLEAN DepexProtocolError;
|
||||
BOOLEAN Dependent;
|
||||
BOOLEAN Scheduled;
|
||||
BOOLEAN Initialized;
|
||||
BOOLEAN DepexProtocolError;
|
||||
|
||||
EFI_HANDLE ImageHandle;
|
||||
EFI_LOADED_IMAGE_PROTOCOL *LoadedImage;
|
||||
EFI_HANDLE ImageHandle;
|
||||
EFI_LOADED_IMAGE_PROTOCOL *LoadedImage;
|
||||
//
|
||||
// Image EntryPoint in MMRAM
|
||||
//
|
||||
PHYSICAL_ADDRESS ImageEntryPoint;
|
||||
PHYSICAL_ADDRESS ImageEntryPoint;
|
||||
//
|
||||
// Image Buffer in MMRAM
|
||||
//
|
||||
PHYSICAL_ADDRESS ImageBuffer;
|
||||
PHYSICAL_ADDRESS ImageBuffer;
|
||||
//
|
||||
// Image Page Number
|
||||
//
|
||||
UINTN NumberOfPage;
|
||||
UINTN NumberOfPage;
|
||||
} EFI_MM_DRIVER_ENTRY;
|
||||
|
||||
#define EFI_HANDLE_SIGNATURE SIGNATURE_32('h','n','d','l')
|
||||
#define EFI_HANDLE_SIGNATURE SIGNATURE_32('h','n','d','l')
|
||||
|
||||
///
|
||||
/// IHANDLE - contains a list of protocol handles
|
||||
///
|
||||
typedef struct {
|
||||
UINTN Signature;
|
||||
UINTN Signature;
|
||||
/// All handles list of IHANDLE
|
||||
LIST_ENTRY AllHandles;
|
||||
LIST_ENTRY AllHandles;
|
||||
/// List of PROTOCOL_INTERFACE's for this handle
|
||||
LIST_ENTRY Protocols;
|
||||
UINTN LocateRequest;
|
||||
LIST_ENTRY Protocols;
|
||||
UINTN LocateRequest;
|
||||
} IHANDLE;
|
||||
|
||||
#define ASSERT_IS_HANDLE(a) ASSERT((a)->Signature == EFI_HANDLE_SIGNATURE)
|
||||
|
||||
#define PROTOCOL_ENTRY_SIGNATURE SIGNATURE_32('p','r','t','e')
|
||||
#define PROTOCOL_ENTRY_SIGNATURE SIGNATURE_32('p','r','t','e')
|
||||
|
||||
///
|
||||
/// PROTOCOL_ENTRY - each different protocol has 1 entry in the protocol
|
||||
@@ -124,15 +124,15 @@ typedef struct {
|
||||
/// with a list of registered notifies.
|
||||
///
|
||||
typedef struct {
|
||||
UINTN Signature;
|
||||
UINTN Signature;
|
||||
/// Link Entry inserted to mProtocolDatabase
|
||||
LIST_ENTRY AllEntries;
|
||||
LIST_ENTRY AllEntries;
|
||||
/// ID of the protocol
|
||||
EFI_GUID ProtocolID;
|
||||
EFI_GUID ProtocolID;
|
||||
/// All protocol interfaces
|
||||
LIST_ENTRY Protocols;
|
||||
LIST_ENTRY Protocols;
|
||||
/// Registered notification handlers
|
||||
LIST_ENTRY Notify;
|
||||
LIST_ENTRY Notify;
|
||||
} PROTOCOL_ENTRY;
|
||||
|
||||
#define PROTOCOL_INTERFACE_SIGNATURE SIGNATURE_32('p','i','f','c')
|
||||
@@ -142,20 +142,20 @@ typedef struct {
|
||||
/// with a protocol interface structure
|
||||
///
|
||||
typedef struct {
|
||||
UINTN Signature;
|
||||
UINTN Signature;
|
||||
/// Link on IHANDLE.Protocols
|
||||
LIST_ENTRY Link;
|
||||
LIST_ENTRY Link;
|
||||
/// Back pointer
|
||||
IHANDLE *Handle;
|
||||
IHANDLE *Handle;
|
||||
/// Link on PROTOCOL_ENTRY.Protocols
|
||||
LIST_ENTRY ByProtocol;
|
||||
LIST_ENTRY ByProtocol;
|
||||
/// The protocol ID
|
||||
PROTOCOL_ENTRY *Protocol;
|
||||
PROTOCOL_ENTRY *Protocol;
|
||||
/// The interface value
|
||||
VOID *Interface;
|
||||
VOID *Interface;
|
||||
} PROTOCOL_INTERFACE;
|
||||
|
||||
#define PROTOCOL_NOTIFY_SIGNATURE SIGNATURE_32('p','r','t','n')
|
||||
#define PROTOCOL_NOTIFY_SIGNATURE SIGNATURE_32('p','r','t','n')
|
||||
|
||||
///
|
||||
/// PROTOCOL_NOTIFY - used for each register notification for a protocol
|
||||
@@ -166,7 +166,7 @@ typedef struct {
|
||||
/// All notifications for this protocol
|
||||
LIST_ENTRY Link;
|
||||
/// Notification function
|
||||
EFI_MM_NOTIFY_FN Function;
|
||||
EFI_MM_NOTIFY_FN Function;
|
||||
/// Last position notified
|
||||
LIST_ENTRY *Position;
|
||||
} PROTOCOL_NOTIFY;
|
||||
@@ -213,9 +213,9 @@ EFI_STATUS
|
||||
EFIAPI
|
||||
MmInstallConfigurationTable (
|
||||
IN CONST EFI_MM_SYSTEM_TABLE *SystemTable,
|
||||
IN CONST EFI_GUID *Guid,
|
||||
IN VOID *Table,
|
||||
IN UINTN TableSize
|
||||
IN CONST EFI_GUID *Guid,
|
||||
IN VOID *Table,
|
||||
IN UINTN TableSize
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -235,10 +235,10 @@ MmInstallConfigurationTable (
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
MmInstallProtocolInterface (
|
||||
IN OUT EFI_HANDLE *UserHandle,
|
||||
IN EFI_GUID *Protocol,
|
||||
IN EFI_INTERFACE_TYPE InterfaceType,
|
||||
IN VOID *Interface
|
||||
IN OUT EFI_HANDLE *UserHandle,
|
||||
IN EFI_GUID *Protocol,
|
||||
IN EFI_INTERFACE_TYPE InterfaceType,
|
||||
IN VOID *Interface
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -260,10 +260,10 @@ MmInstallProtocolInterface (
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
MmAllocatePages (
|
||||
IN EFI_ALLOCATE_TYPE Type,
|
||||
IN EFI_MEMORY_TYPE MemoryType,
|
||||
IN UINTN NumberOfPages,
|
||||
OUT EFI_PHYSICAL_ADDRESS *Memory
|
||||
IN EFI_ALLOCATE_TYPE Type,
|
||||
IN EFI_MEMORY_TYPE MemoryType,
|
||||
IN UINTN NumberOfPages,
|
||||
OUT EFI_PHYSICAL_ADDRESS *Memory
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -285,10 +285,10 @@ MmAllocatePages (
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
MmInternalAllocatePages (
|
||||
IN EFI_ALLOCATE_TYPE Type,
|
||||
IN EFI_MEMORY_TYPE MemoryType,
|
||||
IN UINTN NumberOfPages,
|
||||
OUT EFI_PHYSICAL_ADDRESS *Memory
|
||||
IN EFI_ALLOCATE_TYPE Type,
|
||||
IN EFI_MEMORY_TYPE MemoryType,
|
||||
IN UINTN NumberOfPages,
|
||||
OUT EFI_PHYSICAL_ADDRESS *Memory
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -305,8 +305,8 @@ MmInternalAllocatePages (
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
MmFreePages (
|
||||
IN EFI_PHYSICAL_ADDRESS Memory,
|
||||
IN UINTN NumberOfPages
|
||||
IN EFI_PHYSICAL_ADDRESS Memory,
|
||||
IN UINTN NumberOfPages
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -323,8 +323,8 @@ MmFreePages (
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
MmInternalFreePages (
|
||||
IN EFI_PHYSICAL_ADDRESS Memory,
|
||||
IN UINTN NumberOfPages
|
||||
IN EFI_PHYSICAL_ADDRESS Memory,
|
||||
IN UINTN NumberOfPages
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -343,9 +343,9 @@ MmInternalFreePages (
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
MmAllocatePool (
|
||||
IN EFI_MEMORY_TYPE PoolType,
|
||||
IN UINTN Size,
|
||||
OUT VOID **Buffer
|
||||
IN EFI_MEMORY_TYPE PoolType,
|
||||
IN UINTN Size,
|
||||
OUT VOID **Buffer
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -364,9 +364,9 @@ MmAllocatePool (
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
MmInternalAllocatePool (
|
||||
IN EFI_MEMORY_TYPE PoolType,
|
||||
IN UINTN Size,
|
||||
OUT VOID **Buffer
|
||||
IN EFI_MEMORY_TYPE PoolType,
|
||||
IN UINTN Size,
|
||||
OUT VOID **Buffer
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -381,7 +381,7 @@ MmInternalAllocatePool (
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
MmFreePool (
|
||||
IN VOID *Buffer
|
||||
IN VOID *Buffer
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -396,7 +396,7 @@ MmFreePool (
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
MmInternalFreePool (
|
||||
IN VOID *Buffer
|
||||
IN VOID *Buffer
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -418,11 +418,11 @@ MmInternalFreePool (
|
||||
**/
|
||||
EFI_STATUS
|
||||
MmInstallProtocolInterfaceNotify (
|
||||
IN OUT EFI_HANDLE *UserHandle,
|
||||
IN EFI_GUID *Protocol,
|
||||
IN EFI_INTERFACE_TYPE InterfaceType,
|
||||
IN VOID *Interface,
|
||||
IN BOOLEAN Notify
|
||||
IN OUT EFI_HANDLE *UserHandle,
|
||||
IN EFI_GUID *Protocol,
|
||||
IN EFI_INTERFACE_TYPE InterfaceType,
|
||||
IN VOID *Interface,
|
||||
IN BOOLEAN Notify
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -441,9 +441,9 @@ MmInstallProtocolInterfaceNotify (
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
MmUninstallProtocolInterface (
|
||||
IN EFI_HANDLE UserHandle,
|
||||
IN EFI_GUID *Protocol,
|
||||
IN VOID *Interface
|
||||
IN EFI_HANDLE UserHandle,
|
||||
IN EFI_GUID *Protocol,
|
||||
IN VOID *Interface
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -460,9 +460,9 @@ MmUninstallProtocolInterface (
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
MmHandleProtocol (
|
||||
IN EFI_HANDLE UserHandle,
|
||||
IN EFI_GUID *Protocol,
|
||||
OUT VOID **Interface
|
||||
IN EFI_HANDLE UserHandle,
|
||||
IN EFI_GUID *Protocol,
|
||||
OUT VOID **Interface
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -481,9 +481,9 @@ MmHandleProtocol (
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
MmRegisterProtocolNotify (
|
||||
IN CONST EFI_GUID *Protocol,
|
||||
IN EFI_MM_NOTIFY_FN Function,
|
||||
OUT VOID **Registration
|
||||
IN CONST EFI_GUID *Protocol,
|
||||
IN EFI_MM_NOTIFY_FN Function,
|
||||
OUT VOID **Registration
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -507,11 +507,11 @@ MmRegisterProtocolNotify (
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
MmLocateHandle (
|
||||
IN EFI_LOCATE_SEARCH_TYPE SearchType,
|
||||
IN EFI_GUID *Protocol OPTIONAL,
|
||||
IN VOID *SearchKey OPTIONAL,
|
||||
IN OUT UINTN *BufferSize,
|
||||
OUT EFI_HANDLE *Buffer
|
||||
IN EFI_LOCATE_SEARCH_TYPE SearchType,
|
||||
IN EFI_GUID *Protocol OPTIONAL,
|
||||
IN VOID *SearchKey OPTIONAL,
|
||||
IN OUT UINTN *BufferSize,
|
||||
OUT EFI_HANDLE *Buffer
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -555,10 +555,10 @@ MmLocateProtocol (
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
MmiManage (
|
||||
IN CONST EFI_GUID *HandlerType,
|
||||
IN CONST VOID *Context OPTIONAL,
|
||||
IN OUT VOID *CommBuffer OPTIONAL,
|
||||
IN OUT UINTN *CommBufferSize OPTIONAL
|
||||
IN CONST EFI_GUID *HandlerType,
|
||||
IN CONST VOID *Context OPTIONAL,
|
||||
IN OUT VOID *CommBuffer OPTIONAL,
|
||||
IN OUT UINTN *CommBufferSize OPTIONAL
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -575,9 +575,9 @@ MmiManage (
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
MmiHandlerRegister (
|
||||
IN EFI_MM_HANDLER_ENTRY_POINT Handler,
|
||||
IN CONST EFI_GUID *HandlerType OPTIONAL,
|
||||
OUT EFI_HANDLE *DispatchHandle
|
||||
IN EFI_MM_HANDLER_ENTRY_POINT Handler,
|
||||
IN CONST EFI_GUID *HandlerType OPTIONAL,
|
||||
OUT EFI_HANDLE *DispatchHandle
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -592,7 +592,7 @@ MmiHandlerRegister (
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
MmiHandlerUnRegister (
|
||||
IN EFI_HANDLE DispatchHandle
|
||||
IN EFI_HANDLE DispatchHandle
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -611,10 +611,10 @@ MmiHandlerUnRegister (
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
MmDriverDispatchHandler (
|
||||
IN EFI_HANDLE DispatchHandle,
|
||||
IN CONST VOID *Context OPTIONAL,
|
||||
IN OUT VOID *CommBuffer OPTIONAL,
|
||||
IN OUT UINTN *CommBufferSize OPTIONAL
|
||||
IN EFI_HANDLE DispatchHandle,
|
||||
IN CONST VOID *Context OPTIONAL,
|
||||
IN OUT VOID *CommBuffer OPTIONAL,
|
||||
IN OUT UINTN *CommBufferSize OPTIONAL
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -633,10 +633,10 @@ MmDriverDispatchHandler (
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
MmExitBootServiceHandler (
|
||||
IN EFI_HANDLE DispatchHandle,
|
||||
IN CONST VOID *Context OPTIONAL,
|
||||
IN OUT VOID *CommBuffer OPTIONAL,
|
||||
IN OUT UINTN *CommBufferSize OPTIONAL
|
||||
IN EFI_HANDLE DispatchHandle,
|
||||
IN CONST VOID *Context OPTIONAL,
|
||||
IN OUT VOID *CommBuffer OPTIONAL,
|
||||
IN OUT UINTN *CommBufferSize OPTIONAL
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -655,10 +655,10 @@ MmExitBootServiceHandler (
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
MmReadyToBootHandler (
|
||||
IN EFI_HANDLE DispatchHandle,
|
||||
IN CONST VOID *Context OPTIONAL,
|
||||
IN OUT VOID *CommBuffer OPTIONAL,
|
||||
IN OUT UINTN *CommBufferSize OPTIONAL
|
||||
IN EFI_HANDLE DispatchHandle,
|
||||
IN CONST VOID *Context OPTIONAL,
|
||||
IN OUT VOID *CommBuffer OPTIONAL,
|
||||
IN OUT UINTN *CommBufferSize OPTIONAL
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -677,10 +677,10 @@ MmReadyToBootHandler (
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
MmReadyToLockHandler (
|
||||
IN EFI_HANDLE DispatchHandle,
|
||||
IN CONST VOID *Context OPTIONAL,
|
||||
IN OUT VOID *CommBuffer OPTIONAL,
|
||||
IN OUT UINTN *CommBufferSize OPTIONAL
|
||||
IN EFI_HANDLE DispatchHandle,
|
||||
IN CONST VOID *Context OPTIONAL,
|
||||
IN OUT VOID *CommBuffer OPTIONAL,
|
||||
IN OUT UINTN *CommBufferSize OPTIONAL
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -699,10 +699,10 @@ MmReadyToLockHandler (
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
MmEndOfDxeHandler (
|
||||
IN EFI_HANDLE DispatchHandle,
|
||||
IN CONST VOID *Context OPTIONAL,
|
||||
IN OUT VOID *CommBuffer OPTIONAL,
|
||||
IN OUT UINTN *CommBufferSize OPTIONAL
|
||||
IN EFI_HANDLE DispatchHandle,
|
||||
IN CONST VOID *Context OPTIONAL,
|
||||
IN OUT VOID *CommBuffer OPTIONAL,
|
||||
IN OUT UINTN *CommBufferSize OPTIONAL
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -720,15 +720,15 @@ MmEndOfDxeHandler (
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
MmEfiNotAvailableYetArg5 (
|
||||
UINTN Arg1,
|
||||
UINTN Arg2,
|
||||
UINTN Arg3,
|
||||
UINTN Arg4,
|
||||
UINTN Arg5
|
||||
UINTN Arg1,
|
||||
UINTN Arg2,
|
||||
UINTN Arg3,
|
||||
UINTN Arg4,
|
||||
UINTN Arg5
|
||||
);
|
||||
|
||||
//
|
||||
//Functions used during debug builds
|
||||
// Functions used during debug builds
|
||||
//
|
||||
|
||||
/**
|
||||
@@ -752,10 +752,10 @@ MmDisplayDiscoveredNotDispatched (
|
||||
**/
|
||||
VOID
|
||||
MmAddMemoryRegion (
|
||||
IN EFI_PHYSICAL_ADDRESS MemBase,
|
||||
IN UINT64 MemLength,
|
||||
IN EFI_MEMORY_TYPE Type,
|
||||
IN UINT64 Attributes
|
||||
IN EFI_PHYSICAL_ADDRESS MemBase,
|
||||
IN UINT64 MemLength,
|
||||
IN EFI_MEMORY_TYPE Type,
|
||||
IN UINT64 Attributes
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -769,8 +769,8 @@ MmAddMemoryRegion (
|
||||
**/
|
||||
PROTOCOL_ENTRY *
|
||||
MmFindProtocolEntry (
|
||||
IN EFI_GUID *Protocol,
|
||||
IN BOOLEAN Create
|
||||
IN EFI_GUID *Protocol,
|
||||
IN BOOLEAN Create
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -781,7 +781,7 @@ MmFindProtocolEntry (
|
||||
**/
|
||||
VOID
|
||||
MmNotifyProtocol (
|
||||
IN PROTOCOL_INTERFACE *Prot
|
||||
IN PROTOCOL_INTERFACE *Prot
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -798,9 +798,9 @@ MmNotifyProtocol (
|
||||
**/
|
||||
PROTOCOL_INTERFACE *
|
||||
MmFindProtocolInterface (
|
||||
IN IHANDLE *Handle,
|
||||
IN EFI_GUID *Protocol,
|
||||
IN VOID *Interface
|
||||
IN IHANDLE *Handle,
|
||||
IN EFI_GUID *Protocol,
|
||||
IN VOID *Interface
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -815,9 +815,9 @@ MmFindProtocolInterface (
|
||||
**/
|
||||
PROTOCOL_INTERFACE *
|
||||
MmRemoveInterfaceFromProtocol (
|
||||
IN IHANDLE *Handle,
|
||||
IN EFI_GUID *Protocol,
|
||||
IN VOID *Interface
|
||||
IN IHANDLE *Handle,
|
||||
IN EFI_GUID *Protocol,
|
||||
IN VOID *Interface
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -834,7 +834,7 @@ MmRemoveInterfaceFromProtocol (
|
||||
**/
|
||||
BOOLEAN
|
||||
MmIsSchedulable (
|
||||
IN EFI_MM_DRIVER_ENTRY *DriverEntry
|
||||
IN EFI_MM_DRIVER_ENTRY *DriverEntry
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -846,8 +846,8 @@ DumpMmramInfo (
|
||||
VOID
|
||||
);
|
||||
|
||||
extern UINTN mMmramRangeCount;
|
||||
extern EFI_MMRAM_DESCRIPTOR *mMmramRanges;
|
||||
extern EFI_SYSTEM_TABLE *mEfiSystemTable;
|
||||
extern UINTN mMmramRangeCount;
|
||||
extern EFI_MMRAM_DESCRIPTOR *mMmramRanges;
|
||||
extern EFI_SYSTEM_TABLE *mEfiSystemTable;
|
||||
|
||||
#endif
|
||||
|
@@ -18,8 +18,8 @@
|
||||
//
|
||||
|
||||
typedef struct {
|
||||
LIST_ENTRY Link;
|
||||
UINTN NumberOfPages;
|
||||
LIST_ENTRY Link;
|
||||
UINTN NumberOfPages;
|
||||
} FREE_PAGE_LIST;
|
||||
|
||||
extern LIST_ENTRY mMmMemoryMap;
|
||||
@@ -46,13 +46,13 @@ extern LIST_ENTRY mMmMemoryMap;
|
||||
#define MAX_POOL_INDEX (MAX_POOL_SHIFT - MIN_POOL_SHIFT + 1)
|
||||
|
||||
typedef struct {
|
||||
UINTN Size;
|
||||
BOOLEAN Available;
|
||||
UINTN Size;
|
||||
BOOLEAN Available;
|
||||
} POOL_HEADER;
|
||||
|
||||
typedef struct {
|
||||
POOL_HEADER Header;
|
||||
LIST_ENTRY Link;
|
||||
POOL_HEADER Header;
|
||||
LIST_ENTRY Link;
|
||||
} FREE_POOL_HEADER;
|
||||
|
||||
extern LIST_ENTRY mMmPoolLists[MAX_POOL_INDEX];
|
||||
|
Reference in New Issue
Block a user