PrmPkg: Apply uncrustify changes
REF:https://bugzilla.tianocore.org/show_bug.cgi?id=3737 Apply uncrustify changes to .c/.h files in PrmPkg. Cc: Andrew Fish <afish@apple.com> Cc: Kang Gao <kang.gao@intel.com> Cc: Michael D Kinney <michael.d.kinney@intel.com> Cc: Michael Kubacki <michael.kubacki@microsoft.com> Cc: Leif Lindholm <leif@nuviainc.com> Cc: Benjamin You <benjamin.you@intel.com> Cc: Liu Yun <yun.y.liu@intel.com> Cc: Ankit Sinha <ankit.sinha@intel.com> Cc: Nate DeSimone <nathaniel.l.desimone@intel.com> Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com> Acked-by: Michael D Kinney <michael.d.kinney@intel.com> Acked-by: Liming Gao <gaoliming@byosoft.com.cn> Acked-by: Leif Lindholm <quic_llindhol@quicinc.com> Reviewed-by: Ankit Sinha <ankit.sinha@intel.com>
This commit is contained in:
committed by
mergify[bot]
parent
f3c11224b5
commit
a298a84478
@ -102,6 +102,7 @@ CreateNewPrmHandlerListEntry (
|
|||||||
if (PrmHandlerContextListEntry == NULL) {
|
if (PrmHandlerContextListEntry == NULL) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
PrmHandlerContextListEntry->Signature = PRM_HANDLER_CONTEXT_LIST_ENTRY_SIGNATURE;
|
PrmHandlerContextListEntry->Signature = PRM_HANDLER_CONTEXT_LIST_ENTRY_SIGNATURE;
|
||||||
|
|
||||||
return PrmHandlerContextListEntry;
|
return PrmHandlerContextListEntry;
|
||||||
@ -184,8 +185,8 @@ GatherPrmHandlerInfo (
|
|||||||
for (
|
for (
|
||||||
CurrentPrmModuleImageContext = NULL, Status = GetNextPrmModuleEntry (&CurrentPrmModuleImageContext);
|
CurrentPrmModuleImageContext = NULL, Status = GetNextPrmModuleEntry (&CurrentPrmModuleImageContext);
|
||||||
!EFI_ERROR (Status);
|
!EFI_ERROR (Status);
|
||||||
Status = GetNextPrmModuleEntry (&CurrentPrmModuleImageContext)) {
|
Status = GetNextPrmModuleEntry (&CurrentPrmModuleImageContext))
|
||||||
|
{
|
||||||
CurrentImageAddress = CurrentPrmModuleImageContext->PeCoffImageContext.ImageAddress;
|
CurrentImageAddress = CurrentPrmModuleImageContext->PeCoffImageContext.ImageAddress;
|
||||||
CurrentImageExportDirectory = CurrentPrmModuleImageContext->ExportDirectory;
|
CurrentImageExportDirectory = CurrentPrmModuleImageContext->ExportDirectory;
|
||||||
CurrentExportDescriptorStruct = CurrentPrmModuleImageContext->ExportDescriptor;
|
CurrentExportDescriptorStruct = CurrentPrmModuleImageContext->ExportDescriptor;
|
||||||
@ -224,7 +225,7 @@ GatherPrmHandlerInfo (
|
|||||||
(CONST PRM_MODULE_CONTEXT_BUFFERS **)&CurrentModuleContextBuffers
|
(CONST PRM_MODULE_CONTEXT_BUFFERS **)&CurrentModuleContextBuffers
|
||||||
);
|
);
|
||||||
ASSERT (!EFI_ERROR (Status) || Status == EFI_NOT_FOUND);
|
ASSERT (!EFI_ERROR (Status) || Status == EFI_NOT_FOUND);
|
||||||
if (!EFI_ERROR (Status) && CurrentModuleContextBuffers != NULL) {
|
if (!EFI_ERROR (Status) && (CurrentModuleContextBuffers != NULL)) {
|
||||||
CurrentPrmModuleRuntimeMmioRanges = CurrentModuleContextBuffers->RuntimeMmioRanges;
|
CurrentPrmModuleRuntimeMmioRanges = CurrentModuleContextBuffers->RuntimeMmioRanges;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -234,6 +235,7 @@ GatherPrmHandlerInfo (
|
|||||||
} else {
|
} else {
|
||||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_PRMINFO_NO_MMIO_RANGES), mPrmInfoHiiHandle);
|
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_PRMINFO_NO_MMIO_RANGES), mPrmInfoHiiHandle);
|
||||||
}
|
}
|
||||||
|
|
||||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_PRMINFO_LINE_BREAK), mPrmInfoHiiHandle);
|
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_PRMINFO_LINE_BREAK), mPrmInfoHiiHandle);
|
||||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_PRMINFO_HANDLER_COUNT), mPrmInfoHiiHandle, HandlerCount);
|
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_PRMINFO_HANDLER_COUNT), mPrmInfoHiiHandle, HandlerCount);
|
||||||
}
|
}
|
||||||
@ -329,7 +331,7 @@ PopulateContextBuffer (
|
|||||||
IN PRM_CONTEXT_BUFFER *ContextBuffer
|
IN PRM_CONTEXT_BUFFER *ContextBuffer
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
if (HandlerGuid == NULL || ContextBuffer == NULL) {
|
if ((HandlerGuid == NULL) || (ContextBuffer == NULL)) {
|
||||||
return EFI_INVALID_PARAMETER;
|
return EFI_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -465,6 +467,7 @@ ExecutePrmHandlerByGuid (
|
|||||||
if (PcdGetBool (PcdPrmInfoPrintHandlerExecutionTime)) {
|
if (PcdGetBool (PcdPrmInfoPrintHandlerExecutionTime)) {
|
||||||
StartTime = GetPerformanceCounter ();
|
StartTime = GetPerformanceCounter ();
|
||||||
}
|
}
|
||||||
|
|
||||||
Status = HandlerContext->Handler (NULL, &CurrentContextBuffer);
|
Status = HandlerContext->Handler (NULL, &CurrentContextBuffer);
|
||||||
if (PcdGetBool (PcdPrmInfoPrintHandlerExecutionTime)) {
|
if (PcdGetBool (PcdPrmInfoPrintHandlerExecutionTime)) {
|
||||||
EndTime = GetPerformanceCounter ();
|
EndTime = GetPerformanceCounter ();
|
||||||
@ -477,11 +480,12 @@ ExecutePrmHandlerByGuid (
|
|||||||
}
|
}
|
||||||
|
|
||||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_PRMINFO_HANDLER_EXEC_TIME), mPrmInfoHiiHandle);
|
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_PRMINFO_HANDLER_EXEC_TIME), mPrmInfoHiiHandle);
|
||||||
if (StartTime == 0 && EndTime == 0) {
|
if ((StartTime == 0) && (EndTime == 0)) {
|
||||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_PRMINFO_UNKNOWN), mPrmInfoHiiHandle);
|
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_PRMINFO_UNKNOWN), mPrmInfoHiiHandle);
|
||||||
} else {
|
} else {
|
||||||
PrintExecutionTime (GetTimeInNanoSecond (EndTime - StartTime));
|
PrintExecutionTime (GetTimeInNanoSecond (EndTime - StartTime));
|
||||||
}
|
}
|
||||||
|
|
||||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_PRMINFO_LINE_BREAK), mPrmInfoHiiHandle);
|
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_PRMINFO_LINE_BREAK), mPrmInfoHiiHandle);
|
||||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_PRMINFO_LINE_BREAK), mPrmInfoHiiHandle);
|
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_PRMINFO_LINE_BREAK), mPrmInfoHiiHandle);
|
||||||
} else {
|
} else {
|
||||||
@ -541,7 +545,7 @@ ParseParameterList (
|
|||||||
//
|
//
|
||||||
Status = ShellCommandLineParseEx (mParamList, &Package, &ProblemParam, FALSE, FALSE);
|
Status = ShellCommandLineParseEx (mParamList, &Package, &ProblemParam, FALSE, FALSE);
|
||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
if (Status == EFI_VOLUME_CORRUPTED && ProblemParam != NULL) {
|
if ((Status == EFI_VOLUME_CORRUPTED) && (ProblemParam != NULL)) {
|
||||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_PRMINFO_GEN_PROBLEM), mPrmInfoHiiHandle, APPLICATION_NAME, ProblemParam);
|
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_PRMINFO_GEN_PROBLEM), mPrmInfoHiiHandle, APPLICATION_NAME, ProblemParam);
|
||||||
ReturnStatus = EFI_INVALID_PARAMETER;
|
ReturnStatus = EFI_INVALID_PARAMETER;
|
||||||
FreePool (ProblemParam);
|
FreePool (ProblemParam);
|
||||||
@ -564,7 +568,9 @@ ParseParameterList (
|
|||||||
ArgumentCount = 0, TempNode = Package;
|
ArgumentCount = 0, TempNode = Package;
|
||||||
GetNextNode (Package, TempNode) != Package;
|
GetNextNode (Package, TempNode) != Package;
|
||||||
ArgumentCount++, TempNode = GetNextNode (Package, TempNode)
|
ArgumentCount++, TempNode = GetNextNode (Package, TempNode)
|
||||||
);
|
)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
if (ArgumentCount == 1) {
|
if (ArgumentCount == 1) {
|
||||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_PRMINFO_NO_ARG), mPrmInfoHiiHandle, APPLICATION_NAME);
|
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_PRMINFO_NO_ARG), mPrmInfoHiiHandle, APPLICATION_NAME);
|
||||||
@ -635,6 +641,7 @@ ParseParameterList (
|
|||||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_PRMINFO_HANDLERS_FOUND), mPrmInfoHiiHandle, mPrmHandlerCount);
|
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_PRMINFO_HANDLERS_FOUND), mPrmInfoHiiHandle, mPrmHandlerCount);
|
||||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_PRMINFO_LINE_BREAK), mPrmInfoHiiHandle);
|
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_PRMINFO_LINE_BREAK), mPrmInfoHiiHandle);
|
||||||
}
|
}
|
||||||
|
|
||||||
GatherPrmHandlerInfo (PrintHandlerInfo);
|
GatherPrmHandlerInfo (PrintHandlerInfo);
|
||||||
|
|
||||||
if (HandlerGuidStr != NULL) {
|
if (HandlerGuidStr != NULL) {
|
||||||
|
@ -98,8 +98,7 @@ typedef struct {
|
|||||||
// A firmware internal data structure used to track context buffer and
|
// A firmware internal data structure used to track context buffer and
|
||||||
// runtime MMIO range usage across a PRM module.
|
// runtime MMIO range usage across a PRM module.
|
||||||
//
|
//
|
||||||
typedef struct
|
typedef struct {
|
||||||
{
|
|
||||||
///
|
///
|
||||||
/// The GUID of the PRM module.
|
/// The GUID of the PRM module.
|
||||||
///
|
///
|
||||||
|
@ -67,6 +67,7 @@ typedef struct {
|
|||||||
PRM_STRING_(Name) \
|
PRM_STRING_(Name) \
|
||||||
} \
|
} \
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
A macro that returns the count of the number of variable-length arguments given.
|
A macro that returns the count of the number of variable-length arguments given.
|
||||||
|
|
||||||
|
@ -22,8 +22,7 @@ typedef struct _PRM_CONFIG_PROTOCOL PRM_CONFIG_PROTOCOL;
|
|||||||
#define PRM_CONFIG_PROTOCOL_SIGNATURE SIGNATURE_32('P','M','C','P')
|
#define PRM_CONFIG_PROTOCOL_SIGNATURE SIGNATURE_32('P','M','C','P')
|
||||||
#define PRM_CONFIG_PROTOCOL_VERSION 1
|
#define PRM_CONFIG_PROTOCOL_VERSION 1
|
||||||
|
|
||||||
struct _PRM_CONFIG_PROTOCOL
|
struct _PRM_CONFIG_PROTOCOL {
|
||||||
{
|
|
||||||
PRM_MODULE_CONTEXT_BUFFERS ModuleContextBuffers;
|
PRM_MODULE_CONTEXT_BUFFERS ModuleContextBuffers;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -42,7 +42,7 @@ FindContextBufferInModuleBuffers (
|
|||||||
|
|
||||||
DEBUG ((DEBUG_INFO, " %a %a - Entry.\n", _DBGMSGID_, __FUNCTION__));
|
DEBUG ((DEBUG_INFO, " %a %a - Entry.\n", _DBGMSGID_, __FUNCTION__));
|
||||||
|
|
||||||
if (HandlerGuid == NULL || ModuleContextBuffers == NULL || ContextBuffer == NULL) {
|
if ((HandlerGuid == NULL) || (ModuleContextBuffers == NULL) || (ContextBuffer == NULL)) {
|
||||||
return EFI_INVALID_PARAMETER;
|
return EFI_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -91,9 +91,10 @@ GetModuleContextBuffers (
|
|||||||
|
|
||||||
DEBUG ((DEBUG_INFO, " %a %a - Entry.\n", _DBGMSGID_, __FUNCTION__));
|
DEBUG ((DEBUG_INFO, " %a %a - Entry.\n", _DBGMSGID_, __FUNCTION__));
|
||||||
|
|
||||||
if (Guid == NULL || PrmModuleContextBuffers == NULL) {
|
if ((Guid == NULL) || (PrmModuleContextBuffers == NULL)) {
|
||||||
return EFI_INVALID_PARAMETER;
|
return EFI_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
*PrmModuleContextBuffers = NULL;
|
*PrmModuleContextBuffers = NULL;
|
||||||
|
|
||||||
Status = gBS->LocateHandleBuffer (
|
Status = gBS->LocateHandleBuffer (
|
||||||
@ -111,7 +112,7 @@ GetModuleContextBuffers (
|
|||||||
(VOID **)&PrmConfigProtocol
|
(VOID **)&PrmConfigProtocol
|
||||||
);
|
);
|
||||||
ASSERT_EFI_ERROR (Status);
|
ASSERT_EFI_ERROR (Status);
|
||||||
if (EFI_ERROR (Status) || PrmConfigProtocol == NULL) {
|
if (EFI_ERROR (Status) || (PrmConfigProtocol == NULL)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -177,9 +178,10 @@ GetContextBuffer (
|
|||||||
|
|
||||||
DEBUG ((DEBUG_INFO, " %a %a - Entry.\n", _DBGMSGID_, __FUNCTION__));
|
DEBUG ((DEBUG_INFO, " %a %a - Entry.\n", _DBGMSGID_, __FUNCTION__));
|
||||||
|
|
||||||
if (PrmHandlerGuid == NULL || PrmContextBuffer == NULL) {
|
if ((PrmHandlerGuid == NULL) || (PrmContextBuffer == NULL)) {
|
||||||
return EFI_INVALID_PARAMETER;
|
return EFI_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
*PrmContextBuffer = NULL;
|
*PrmContextBuffer = NULL;
|
||||||
|
|
||||||
if (PrmModuleContextBuffers == NULL) {
|
if (PrmModuleContextBuffers == NULL) {
|
||||||
@ -190,6 +192,7 @@ GetContextBuffer (
|
|||||||
} else {
|
} else {
|
||||||
ContextBuffers = PrmModuleContextBuffers;
|
ContextBuffers = PrmModuleContextBuffers;
|
||||||
}
|
}
|
||||||
|
|
||||||
Status = FindContextBufferInModuleBuffers (PrmHandlerGuid, ContextBuffers, PrmContextBuffer);
|
Status = FindContextBufferInModuleBuffers (PrmHandlerGuid, ContextBuffers, PrmContextBuffer);
|
||||||
|
|
||||||
return Status;
|
return Status;
|
||||||
|
@ -145,7 +145,6 @@ PRM_MODULE_CONTEXT_BUFFERS mTestPrmModuleContextBuffers3 = {
|
|||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
// *----------------------------------------------------------------------------------*
|
// *----------------------------------------------------------------------------------*
|
||||||
// * Test Contexts *
|
// * Test Contexts *
|
||||||
// *----------------------------------------------------------------------------------*
|
// *----------------------------------------------------------------------------------*
|
||||||
@ -496,7 +495,9 @@ VerifyGetContextBuffer (
|
|||||||
@retval other Some error occurred when executing this entry point.
|
@retval other Some error occurred when executing this entry point.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
int main ()
|
int
|
||||||
|
main (
|
||||||
|
)
|
||||||
{
|
{
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
UINTN Index;
|
UINTN Index;
|
||||||
@ -640,8 +641,7 @@ int main ()
|
|||||||
Status = RunAllTestSuites (Framework);
|
Status = RunAllTestSuites (Framework);
|
||||||
|
|
||||||
EXIT:
|
EXIT:
|
||||||
if (Framework)
|
if (Framework) {
|
||||||
{
|
|
||||||
FreeUnitTestFramework (Framework);
|
FreeUnitTestFramework (Framework);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -59,7 +59,7 @@ GetNextPrmModuleEntry (
|
|||||||
} else {
|
} else {
|
||||||
CurrentListEntry = NULL;
|
CurrentListEntry = NULL;
|
||||||
CurrentListEntry = CR (*ModuleImageContext, PRM_MODULE_IMAGE_CONTEXT_LIST_ENTRY, Context, PRM_MODULE_IMAGE_CONTEXT_LIST_ENTRY_SIGNATURE);
|
CurrentListEntry = CR (*ModuleImageContext, PRM_MODULE_IMAGE_CONTEXT_LIST_ENTRY, Context, PRM_MODULE_IMAGE_CONTEXT_LIST_ENTRY_SIGNATURE);
|
||||||
if (CurrentListEntry == NULL || CurrentListEntry->Signature != PRM_MODULE_IMAGE_CONTEXT_LIST_ENTRY_SIGNATURE) {
|
if ((CurrentListEntry == NULL) || (CurrentListEntry->Signature != PRM_MODULE_IMAGE_CONTEXT_LIST_ENTRY_SIGNATURE)) {
|
||||||
return EFI_INVALID_PARAMETER;
|
return EFI_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -100,6 +100,7 @@ CreateNewPrmModuleImageContextListEntry (
|
|||||||
if (PrmModuleImageContextListEntry == NULL) {
|
if (PrmModuleImageContextListEntry == NULL) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
DEBUG ((
|
DEBUG ((
|
||||||
DEBUG_INFO,
|
DEBUG_INFO,
|
||||||
" %a %a: Allocated PrmModuleImageContextListEntry at 0x%x of size 0x%x bytes.\n",
|
" %a %a: Allocated PrmModuleImageContextListEntry at 0x%x of size 0x%x bytes.\n",
|
||||||
@ -249,7 +250,7 @@ DiscoverPrmModules (
|
|||||||
TempPrmModuleImageContext.PeCoffImageContext.ImageRead = PeCoffLoaderImageReadFromMemory;
|
TempPrmModuleImageContext.PeCoffImageContext.ImageRead = PeCoffLoaderImageReadFromMemory;
|
||||||
|
|
||||||
Status = PeCoffLoaderGetImageInfo (&TempPrmModuleImageContext.PeCoffImageContext);
|
Status = PeCoffLoaderGetImageInfo (&TempPrmModuleImageContext.PeCoffImageContext);
|
||||||
if (EFI_ERROR (Status) || TempPrmModuleImageContext.PeCoffImageContext.ImageError != IMAGE_ERROR_SUCCESS) {
|
if (EFI_ERROR (Status) || (TempPrmModuleImageContext.PeCoffImageContext.ImageError != IMAGE_ERROR_SUCCESS)) {
|
||||||
DEBUG ((
|
DEBUG ((
|
||||||
DEBUG_WARN,
|
DEBUG_WARN,
|
||||||
"%a %a: ImageHandle 0x%016lx is not a valid PE/COFF image. It cannot be considered a PRM module.\n",
|
"%a %a: ImageHandle 0x%016lx is not a valid PE/COFF image. It cannot be considered a PRM module.\n",
|
||||||
@ -259,6 +260,7 @@ DiscoverPrmModules (
|
|||||||
));
|
));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (TempPrmModuleImageContext.PeCoffImageContext.IsTeImage) {
|
if (TempPrmModuleImageContext.PeCoffImageContext.IsTeImage) {
|
||||||
// A PRM Module is not allowed to be a TE image
|
// A PRM Module is not allowed to be a TE image
|
||||||
continue;
|
continue;
|
||||||
@ -280,9 +282,10 @@ DiscoverPrmModules (
|
|||||||
&TempPrmModuleImageContext.PeCoffImageContext,
|
&TempPrmModuleImageContext.PeCoffImageContext,
|
||||||
&TempPrmModuleImageContext.ExportDescriptor
|
&TempPrmModuleImageContext.ExportDescriptor
|
||||||
);
|
);
|
||||||
if (EFI_ERROR (Status) || TempPrmModuleImageContext.ExportDescriptor == NULL) {
|
if (EFI_ERROR (Status) || (TempPrmModuleImageContext.ExportDescriptor == NULL)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// A PRM Module Export Descriptor was successfully found, this is considered a PRM Module.
|
// A PRM Module Export Descriptor was successfully found, this is considered a PRM Module.
|
||||||
|
|
||||||
//
|
//
|
||||||
@ -292,6 +295,7 @@ DiscoverPrmModules (
|
|||||||
if (PrmModuleImageContextListEntry == NULL) {
|
if (PrmModuleImageContextListEntry == NULL) {
|
||||||
return EFI_OUT_OF_RESOURCES;
|
return EFI_OUT_OF_RESOURCES;
|
||||||
}
|
}
|
||||||
|
|
||||||
CopyMem (
|
CopyMem (
|
||||||
&PrmModuleImageContextListEntry->Context,
|
&PrmModuleImageContextListEntry->Context,
|
||||||
&TempPrmModuleImageContext,
|
&TempPrmModuleImageContext,
|
||||||
@ -306,6 +310,7 @@ DiscoverPrmModules (
|
|||||||
if (HandlerCount != NULL) {
|
if (HandlerCount != NULL) {
|
||||||
*HandlerCount = PrmHandlerCount;
|
*HandlerCount = PrmHandlerCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ModuleCount != NULL) {
|
if (ModuleCount != NULL) {
|
||||||
*ModuleCount = PrmModuleCount;
|
*ModuleCount = PrmModuleCount;
|
||||||
}
|
}
|
||||||
|
@ -131,7 +131,9 @@ PrmModuleImageContextListEntryImageContextShouldBeZeroed (
|
|||||||
@retval other Some error occurred when executing this entry point.
|
@retval other Some error occurred when executing this entry point.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
int main ()
|
int
|
||||||
|
main (
|
||||||
|
)
|
||||||
{
|
{
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
UNIT_TEST_FRAMEWORK_HANDLE Framework;
|
UNIT_TEST_FRAMEWORK_HANDLE Framework;
|
||||||
@ -200,8 +202,7 @@ int main ()
|
|||||||
Status = RunAllTestSuites (Framework);
|
Status = RunAllTestSuites (Framework);
|
||||||
|
|
||||||
EXIT:
|
EXIT:
|
||||||
if (Framework)
|
if (Framework) {
|
||||||
{
|
|
||||||
FreeUnitTestFramework (Framework);
|
FreeUnitTestFramework (Framework);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -53,10 +53,11 @@ GetPrmModuleExportDescriptorTable (
|
|||||||
|
|
||||||
DEBUG ((DEBUG_INFO, "%a %a - Entry.\n", _DBGMSGID_, __FUNCTION__));
|
DEBUG ((DEBUG_INFO, "%a %a - Entry.\n", _DBGMSGID_, __FUNCTION__));
|
||||||
|
|
||||||
if (ImageExportDirectory == NULL ||
|
if ((ImageExportDirectory == NULL) ||
|
||||||
PeCoffLoaderImageContext == NULL ||
|
(PeCoffLoaderImageContext == NULL) ||
|
||||||
PeCoffLoaderImageContext->ImageAddress == 0 ||
|
(PeCoffLoaderImageContext->ImageAddress == 0) ||
|
||||||
ExportDescriptor == NULL) {
|
(ExportDescriptor == NULL))
|
||||||
|
{
|
||||||
return EFI_INVALID_PARAMETER;
|
return EFI_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -93,7 +94,8 @@ GetPrmModuleExportDescriptorTable (
|
|||||||
PRM_STRING (PRM_MODULE_EXPORT_DESCRIPTOR_NAME),
|
PRM_STRING (PRM_MODULE_EXPORT_DESCRIPTOR_NAME),
|
||||||
CurrentExportName,
|
CurrentExportName,
|
||||||
AsciiStrLen (PRM_STRING (PRM_MODULE_EXPORT_DESCRIPTOR_NAME))
|
AsciiStrLen (PRM_STRING (PRM_MODULE_EXPORT_DESCRIPTOR_NAME))
|
||||||
) == 0) {
|
) == 0)
|
||||||
|
{
|
||||||
PrmModuleExportDescriptorOrdinal = OrdinalTable[Index];
|
PrmModuleExportDescriptorOrdinal = OrdinalTable[Index];
|
||||||
DEBUG ((
|
DEBUG ((
|
||||||
DEBUG_INFO,
|
DEBUG_INFO,
|
||||||
@ -106,6 +108,7 @@ GetPrmModuleExportDescriptorTable (
|
|||||||
DEBUG ((DEBUG_ERROR, "%a %a: The PRM Module Export Descriptor ordinal value is invalid.\n", _DBGMSGID_, __FUNCTION__));
|
DEBUG ((DEBUG_ERROR, "%a %a: The PRM Module Export Descriptor ordinal value is invalid.\n", _DBGMSGID_, __FUNCTION__));
|
||||||
return EFI_NOT_FOUND;
|
return EFI_NOT_FOUND;
|
||||||
}
|
}
|
||||||
|
|
||||||
TempExportDescriptor = (PRM_MODULE_EXPORT_DESCRIPTOR_STRUCT *)((UINTN)CurrentImageAddress + ExportAddressTable[PrmModuleExportDescriptorOrdinal]);
|
TempExportDescriptor = (PRM_MODULE_EXPORT_DESCRIPTOR_STRUCT *)((UINTN)CurrentImageAddress + ExportAddressTable[PrmModuleExportDescriptorOrdinal]);
|
||||||
if (TempExportDescriptor->Header.Signature == PRM_MODULE_EXPORT_DESCRIPTOR_SIGNATURE) {
|
if (TempExportDescriptor->Header.Signature == PRM_MODULE_EXPORT_DESCRIPTOR_SIGNATURE) {
|
||||||
*ExportDescriptor = TempExportDescriptor;
|
*ExportDescriptor = TempExportDescriptor;
|
||||||
@ -119,6 +122,7 @@ GetPrmModuleExportDescriptorTable (
|
|||||||
(UINTN)TempExportDescriptor
|
(UINTN)TempExportDescriptor
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
DEBUG ((DEBUG_INFO, " %a %a: Exiting export iteration since export descriptor found.\n", _DBGMSGID_, __FUNCTION__));
|
DEBUG ((DEBUG_INFO, " %a %a: Exiting export iteration since export descriptor found.\n", _DBGMSGID_, __FUNCTION__));
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
@ -156,7 +160,7 @@ GetExportDirectoryInPeCoffImage (
|
|||||||
EFI_IMAGE_DATA_DIRECTORY *DirectoryEntry;
|
EFI_IMAGE_DATA_DIRECTORY *DirectoryEntry;
|
||||||
EFI_IMAGE_EXPORT_DIRECTORY *ExportDirectory;
|
EFI_IMAGE_EXPORT_DIRECTORY *ExportDirectory;
|
||||||
|
|
||||||
if (Image == NULL || PeCoffLoaderImageContext == NULL || ImageExportDirectory == NULL) {
|
if ((Image == NULL) || (PeCoffLoaderImageContext == NULL) || (ImageExportDirectory == NULL)) {
|
||||||
return EFI_INVALID_PARAMETER;
|
return EFI_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -224,7 +228,7 @@ GetExportDirectoryInPeCoffImage (
|
|||||||
return EFI_UNSUPPORTED;
|
return EFI_UNSUPPORTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (NumberOfRvaAndSizes <= EFI_IMAGE_DIRECTORY_ENTRY_EXPORT || DirectoryEntry->VirtualAddress == 0) {
|
if ((NumberOfRvaAndSizes <= EFI_IMAGE_DIRECTORY_ENTRY_EXPORT) || (DirectoryEntry->VirtualAddress == 0)) {
|
||||||
//
|
//
|
||||||
// The export directory is not present
|
// The export directory is not present
|
||||||
//
|
//
|
||||||
@ -250,6 +254,7 @@ GetExportDirectoryInPeCoffImage (
|
|||||||
(CHAR8 *)((UINTN)Image + ExportDirectory->Name)
|
(CHAR8 *)((UINTN)Image + ExportDirectory->Name)
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
*ImageExportDirectory = ExportDirectory;
|
*ImageExportDirectory = ExportDirectory;
|
||||||
|
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
@ -284,7 +289,7 @@ GetImageVersionInPeCoffImage (
|
|||||||
|
|
||||||
DEBUG ((DEBUG_INFO, " %a %a - Entry.\n", _DBGMSGID_, __FUNCTION__));
|
DEBUG ((DEBUG_INFO, " %a %a - Entry.\n", _DBGMSGID_, __FUNCTION__));
|
||||||
|
|
||||||
if (Image == NULL || PeCoffLoaderImageContext == NULL || ImageMajorVersion == NULL || ImageMinorVersion == NULL) {
|
if ((Image == NULL) || (PeCoffLoaderImageContext == NULL) || (ImageMajorVersion == NULL) || (ImageMinorVersion == NULL)) {
|
||||||
return EFI_INVALID_PARAMETER;
|
return EFI_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -381,9 +386,10 @@ GetExportEntryAddress (
|
|||||||
UINT16 *OrdinalTable;
|
UINT16 *OrdinalTable;
|
||||||
CONST CHAR8 *ExportNameTablePointerName;
|
CONST CHAR8 *ExportNameTablePointerName;
|
||||||
|
|
||||||
if (ExportName == NULL || ImageBaseAddress == 0 || ImageExportDirectory == NULL || ExportPhysicalAddress == NULL) {
|
if ((ExportName == NULL) || (ImageBaseAddress == 0) || (ImageExportDirectory == NULL) || (ExportPhysicalAddress == NULL)) {
|
||||||
return EFI_INVALID_PARAMETER;
|
return EFI_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
*ExportPhysicalAddress = 0;
|
*ExportPhysicalAddress = 0;
|
||||||
|
|
||||||
ExportAddressTable = (UINT32 *)((UINTN)ImageBaseAddress + ImageExportDirectory->AddressOfFunctions);
|
ExportAddressTable = (UINT32 *)((UINTN)ImageBaseAddress + ImageExportDirectory->AddressOfFunctions);
|
||||||
|
@ -42,7 +42,7 @@ ConvertRuntimeMemoryRangeAddresses (
|
|||||||
{
|
{
|
||||||
UINTN Index;
|
UINTN Index;
|
||||||
|
|
||||||
if (RuntimeMmioRanges == NULL || RuntimeMmioRanges->Count == 0) {
|
if ((RuntimeMmioRanges == NULL) || (RuntimeMmioRanges->Count == 0)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -73,13 +73,18 @@ SetRuntimeMemoryRangeAttributes (
|
|||||||
|
|
||||||
DEBUG ((DEBUG_INFO, "%a %a - Entry.\n", _DBGMSGID_, __FUNCTION__));
|
DEBUG ((DEBUG_INFO, "%a %a - Entry.\n", _DBGMSGID_, __FUNCTION__));
|
||||||
|
|
||||||
if (RuntimeMmioRanges == NULL || RuntimeMmioRanges->Count == 0) {
|
if ((RuntimeMmioRanges == NULL) || (RuntimeMmioRanges->Count == 0)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (Index = 0; Index < (UINTN)RuntimeMmioRanges->Count; Index++) {
|
for (Index = 0; Index < (UINTN)RuntimeMmioRanges->Count; Index++) {
|
||||||
DEBUG ((
|
DEBUG ((
|
||||||
DEBUG_INFO, " %a %a: Runtime MMIO Range [%d].\n", _DBGMSGID_, __FUNCTION__, Index));
|
DEBUG_INFO,
|
||||||
|
" %a %a: Runtime MMIO Range [%d].\n",
|
||||||
|
_DBGMSGID_,
|
||||||
|
__FUNCTION__,
|
||||||
|
Index
|
||||||
|
));
|
||||||
DEBUG ((
|
DEBUG ((
|
||||||
DEBUG_INFO,
|
DEBUG_INFO,
|
||||||
" %a %a: Physical address = 0x%016x. Length = 0x%x.\n",
|
" %a %a: Physical address = 0x%016x. Length = 0x%x.\n",
|
||||||
@ -97,17 +102,18 @@ SetRuntimeMemoryRangeAttributes (
|
|||||||
Status = gDS->GetMemorySpaceDescriptor (RuntimeMmioRanges->Range[Index].PhysicalBaseAddress, &Descriptor);
|
Status = gDS->GetMemorySpaceDescriptor (RuntimeMmioRanges->Range[Index].PhysicalBaseAddress, &Descriptor);
|
||||||
if (!EFI_ERROR (Status) &&
|
if (!EFI_ERROR (Status) &&
|
||||||
(
|
(
|
||||||
(Descriptor.GcdMemoryType != EfiGcdMemoryTypeMemoryMappedIo && Descriptor.GcdMemoryType != EfiGcdMemoryTypeReserved) ||
|
((Descriptor.GcdMemoryType != EfiGcdMemoryTypeMemoryMappedIo) && (Descriptor.GcdMemoryType != EfiGcdMemoryTypeReserved)) ||
|
||||||
((Descriptor.Length & EFI_PAGE_MASK) != 0)
|
((Descriptor.Length & EFI_PAGE_MASK) != 0)
|
||||||
)
|
)
|
||||||
) {
|
)
|
||||||
|
{
|
||||||
Status2 = gDS->RemoveMemorySpace (
|
Status2 = gDS->RemoveMemorySpace (
|
||||||
RuntimeMmioRanges->Range[Index].PhysicalBaseAddress,
|
RuntimeMmioRanges->Range[Index].PhysicalBaseAddress,
|
||||||
Descriptor.Length
|
Descriptor.Length
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Status == EFI_NOT_FOUND || !EFI_ERROR (Status2)) {
|
if ((Status == EFI_NOT_FOUND) || !EFI_ERROR (Status2)) {
|
||||||
Status = gDS->AddMemorySpace (
|
Status = gDS->AddMemorySpace (
|
||||||
EfiGcdMemoryTypeMemoryMappedIo,
|
EfiGcdMemoryTypeMemoryMappedIo,
|
||||||
RuntimeMmioRanges->Range[Index].PhysicalBaseAddress,
|
RuntimeMmioRanges->Range[Index].PhysicalBaseAddress,
|
||||||
@ -141,6 +147,7 @@ SetRuntimeMemoryRangeAttributes (
|
|||||||
));
|
));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((Descriptor.Attributes & EFI_MEMORY_RUNTIME) != 0) {
|
if ((Descriptor.Attributes & EFI_MEMORY_RUNTIME) != 0) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -187,7 +194,7 @@ StoreVirtualMemoryAddressChangePointers (
|
|||||||
RangeIndex = 0;
|
RangeIndex = 0;
|
||||||
|
|
||||||
mRuntimeMmioRanges = AllocateRuntimeZeroPool (sizeof (*mRuntimeMmioRanges) * mMaxRuntimeMmioRangeCount);
|
mRuntimeMmioRanges = AllocateRuntimeZeroPool (sizeof (*mRuntimeMmioRanges) * mMaxRuntimeMmioRangeCount);
|
||||||
if (mRuntimeMmioRanges == NULL && mMaxRuntimeMmioRangeCount > 0) {
|
if ((mRuntimeMmioRanges == NULL) && (mMaxRuntimeMmioRangeCount > 0)) {
|
||||||
DEBUG ((
|
DEBUG ((
|
||||||
DEBUG_ERROR,
|
DEBUG_ERROR,
|
||||||
" %a %a: Memory allocation for runtime MMIO pointer array failed.\n",
|
" %a %a: Memory allocation for runtime MMIO pointer array failed.\n",
|
||||||
@ -214,7 +221,7 @@ StoreVirtualMemoryAddressChangePointers (
|
|||||||
(VOID **)&PrmConfigProtocol
|
(VOID **)&PrmConfigProtocol
|
||||||
);
|
);
|
||||||
ASSERT_EFI_ERROR (Status);
|
ASSERT_EFI_ERROR (Status);
|
||||||
if (EFI_ERROR (Status) || PrmConfigProtocol == NULL) {
|
if (EFI_ERROR (Status) || (PrmConfigProtocol == NULL)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -232,9 +239,11 @@ StoreVirtualMemoryAddressChangePointers (
|
|||||||
ASSERT_EFI_ERROR (Status);
|
ASSERT_EFI_ERROR (Status);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
mRuntimeMmioRanges[RangeIndex++] = PrmConfigProtocol->ModuleContextBuffers.RuntimeMmioRanges;
|
mRuntimeMmioRanges[RangeIndex++] = PrmConfigProtocol->ModuleContextBuffers.RuntimeMmioRanges;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
DEBUG ((
|
DEBUG ((
|
||||||
DEBUG_INFO,
|
DEBUG_INFO,
|
||||||
" %a %a: %d MMIO ranges buffers saved for future virtual memory conversion.\n",
|
" %a %a: %d MMIO ranges buffers saved for future virtual memory conversion.\n",
|
||||||
@ -271,6 +280,7 @@ ValidatePrmDataBuffer (
|
|||||||
DEBUG ((DEBUG_ERROR, " %a %a: The PRM data buffer signature is invalid. PRM module.\n", _DBGMSGID_, __FUNCTION__));
|
DEBUG ((DEBUG_ERROR, " %a %a: The PRM data buffer signature is invalid. PRM module.\n", _DBGMSGID_, __FUNCTION__));
|
||||||
return EFI_NOT_FOUND;
|
return EFI_NOT_FOUND;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (PrmDataBuffer->Header.Length < sizeof (PRM_DATA_BUFFER_HEADER)) {
|
if (PrmDataBuffer->Header.Length < sizeof (PRM_DATA_BUFFER_HEADER)) {
|
||||||
DEBUG ((DEBUG_ERROR, " %a %a: The PRM data buffer length is invalid.\n", _DBGMSGID_, __FUNCTION__));
|
DEBUG ((DEBUG_ERROR, " %a %a: The PRM data buffer length is invalid.\n", _DBGMSGID_, __FUNCTION__));
|
||||||
return EFI_BUFFER_TOO_SMALL;
|
return EFI_BUFFER_TOO_SMALL;
|
||||||
@ -310,7 +320,7 @@ ValidatePrmContextBuffer (
|
|||||||
return EFI_NOT_FOUND;
|
return EFI_NOT_FOUND;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (PrmContextBuffer->StaticDataBuffer != NULL && EFI_ERROR (ValidatePrmDataBuffer (PrmContextBuffer->StaticDataBuffer))) {
|
if ((PrmContextBuffer->StaticDataBuffer != NULL) && EFI_ERROR (ValidatePrmDataBuffer (PrmContextBuffer->StaticDataBuffer))) {
|
||||||
DEBUG ((
|
DEBUG ((
|
||||||
DEBUG_ERROR,
|
DEBUG_ERROR,
|
||||||
" %a %a: Error in static buffer for PRM handler %g.\n",
|
" %a %a: Error in static buffer for PRM handler %g.\n",
|
||||||
@ -395,7 +405,7 @@ PrmConfigEndOfDxeNotification (
|
|||||||
(VOID **)&PrmConfigProtocol
|
(VOID **)&PrmConfigProtocol
|
||||||
);
|
);
|
||||||
ASSERT_EFI_ERROR (Status);
|
ASSERT_EFI_ERROR (Status);
|
||||||
if (EFI_ERROR (Status) || PrmConfigProtocol == NULL) {
|
if (EFI_ERROR (Status) || (PrmConfigProtocol == NULL)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -422,6 +432,7 @@ PrmConfigEndOfDxeNotification (
|
|||||||
));
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
DEBUG ((DEBUG_INFO, " %a %a: Module context buffer validation complete.\n", _DBGMSGID_, __FUNCTION__));
|
DEBUG ((DEBUG_INFO, " %a %a: Module context buffer validation complete.\n", _DBGMSGID_, __FUNCTION__));
|
||||||
|
|
||||||
if (PrmConfigProtocol->ModuleContextBuffers.RuntimeMmioRanges != NULL) {
|
if (PrmConfigProtocol->ModuleContextBuffers.RuntimeMmioRanges != NULL) {
|
||||||
@ -443,6 +454,7 @@ PrmConfigEndOfDxeNotification (
|
|||||||
if (HandleBuffer != NULL) {
|
if (HandleBuffer != NULL) {
|
||||||
gBS->FreePool (HandleBuffer);
|
gBS->FreePool (HandleBuffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
gBS->CloseEvent (Event);
|
gBS->CloseEvent (Event);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -78,6 +78,7 @@ ProcessPrmModules (
|
|||||||
if (PrmAcpiDescriptionTable == NULL) {
|
if (PrmAcpiDescriptionTable == NULL) {
|
||||||
return EFI_INVALID_PARAMETER;
|
return EFI_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
*PrmAcpiDescriptionTable = NULL;
|
*PrmAcpiDescriptionTable = NULL;
|
||||||
|
|
||||||
//
|
//
|
||||||
@ -127,8 +128,8 @@ ProcessPrmModules (
|
|||||||
for (
|
for (
|
||||||
CurrentPrmModuleImageContext = NULL, Status = GetNextPrmModuleEntry (&CurrentPrmModuleImageContext);
|
CurrentPrmModuleImageContext = NULL, Status = GetNextPrmModuleEntry (&CurrentPrmModuleImageContext);
|
||||||
!EFI_ERROR (Status);
|
!EFI_ERROR (Status);
|
||||||
Status = GetNextPrmModuleEntry (&CurrentPrmModuleImageContext)) {
|
Status = GetNextPrmModuleEntry (&CurrentPrmModuleImageContext))
|
||||||
|
{
|
||||||
CurrentImageAddress = CurrentPrmModuleImageContext->PeCoffImageContext.ImageAddress;
|
CurrentImageAddress = CurrentPrmModuleImageContext->PeCoffImageContext.ImageAddress;
|
||||||
CurrentImageExportDirectory = CurrentPrmModuleImageContext->ExportDirectory;
|
CurrentImageExportDirectory = CurrentPrmModuleImageContext->ExportDirectory;
|
||||||
CurrentExportDescriptorStruct = CurrentPrmModuleImageContext->ExportDescriptor;
|
CurrentExportDescriptorStruct = CurrentPrmModuleImageContext->ExportDescriptor;
|
||||||
@ -169,7 +170,7 @@ ProcessPrmModules (
|
|||||||
(CONST PRM_MODULE_CONTEXT_BUFFERS **)&CurrentModuleContextBuffers
|
(CONST PRM_MODULE_CONTEXT_BUFFERS **)&CurrentModuleContextBuffers
|
||||||
);
|
);
|
||||||
ASSERT (!EFI_ERROR (Status) || Status == EFI_NOT_FOUND);
|
ASSERT (!EFI_ERROR (Status) || Status == EFI_NOT_FOUND);
|
||||||
if (!EFI_ERROR (Status) && CurrentModuleContextBuffers != NULL) {
|
if (!EFI_ERROR (Status) && (CurrentModuleContextBuffers != NULL)) {
|
||||||
CurrentModuleInfoStruct->RuntimeMmioRanges = (UINT64)(UINTN)CurrentModuleContextBuffers->RuntimeMmioRanges;
|
CurrentModuleInfoStruct->RuntimeMmioRanges = (UINT64)(UINTN)CurrentModuleContextBuffers->RuntimeMmioRanges;
|
||||||
CurrentModuleAcpiParamDescriptors = CurrentModuleContextBuffers->AcpiParameterBufferDescriptors;
|
CurrentModuleAcpiParamDescriptors = CurrentModuleContextBuffers->AcpiParameterBufferDescriptors;
|
||||||
}
|
}
|
||||||
@ -230,8 +231,10 @@ ProcessPrmModules (
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
CurrentModuleInfoStruct = (PRM_MODULE_INFORMATION_STRUCT *)((UINTN)CurrentModuleInfoStruct + CurrentModuleInfoStruct->StructureLength);
|
CurrentModuleInfoStruct = (PRM_MODULE_INFORMATION_STRUCT *)((UINTN)CurrentModuleInfoStruct + CurrentModuleInfoStruct->StructureLength);
|
||||||
}
|
}
|
||||||
|
|
||||||
*PrmAcpiDescriptionTable = PrmAcpiTable;
|
*PrmAcpiDescriptionTable = PrmAcpiTable;
|
||||||
|
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
@ -259,7 +262,7 @@ PublishPrmAcpiTable (
|
|||||||
EFI_ACPI_TABLE_PROTOCOL *AcpiTableProtocol;
|
EFI_ACPI_TABLE_PROTOCOL *AcpiTableProtocol;
|
||||||
UINTN TableKey;
|
UINTN TableKey;
|
||||||
|
|
||||||
if (PrmAcpiDescriptionTable == NULL || PrmAcpiDescriptionTable->Header.Signature != PRM_TABLE_SIGNATURE) {
|
if ((PrmAcpiDescriptionTable == NULL) || (PrmAcpiDescriptionTable->Header.Signature != PRM_TABLE_SIGNATURE)) {
|
||||||
return EFI_INVALID_PARAMETER;
|
return EFI_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -279,6 +282,7 @@ PublishPrmAcpiTable (
|
|||||||
DEBUG ((DEBUG_INFO, "%a %a: The PRMT ACPI table was installed successfully.\n", _DBGMSGID_, __FUNCTION__));
|
DEBUG ((DEBUG_INFO, "%a %a: The PRMT ACPI table was installed successfully.\n", _DBGMSGID_, __FUNCTION__));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ASSERT_EFI_ERROR (Status);
|
ASSERT_EFI_ERROR (Status);
|
||||||
|
|
||||||
return Status;
|
return Status;
|
||||||
@ -326,6 +330,7 @@ PrmLoaderEndOfDxeNotification (
|
|||||||
if (PrmAcpiDescriptionTable != NULL) {
|
if (PrmAcpiDescriptionTable != NULL) {
|
||||||
FreePool (PrmAcpiDescriptionTable);
|
FreePool (PrmAcpiDescriptionTable);
|
||||||
}
|
}
|
||||||
|
|
||||||
gBS->CloseEvent (Event);
|
gBS->CloseEvent (Event);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -17,10 +17,14 @@
|
|||||||
STATIC EFI_HANDLE mPrmConfigProtocolHandle;
|
STATIC EFI_HANDLE mPrmConfigProtocolHandle;
|
||||||
|
|
||||||
// {dc2a58a6-5927-4776-b995-d118a27335a2}
|
// {dc2a58a6-5927-4776-b995-d118a27335a2}
|
||||||
STATIC CONST EFI_GUID mPrmModuleGuid = {0xdc2a58a6, 0x5927, 0x4776, {0xb9, 0x95, 0xd1, 0x18, 0xa2, 0x73, 0x35, 0xa2}};
|
STATIC CONST EFI_GUID mPrmModuleGuid = {
|
||||||
|
0xdc2a58a6, 0x5927, 0x4776, { 0xb9, 0x95, 0xd1, 0x18, 0xa2, 0x73, 0x35, 0xa2 }
|
||||||
|
};
|
||||||
|
|
||||||
// {2e4f2d13-6240-4ed0-a401-c723fbdc34e8}
|
// {2e4f2d13-6240-4ed0-a401-c723fbdc34e8}
|
||||||
STATIC CONST EFI_GUID mCheckParamBufferPrmHandlerGuid = {0x2e4f2d13, 0x6240, 0x4ed0, {0xa4, 0x01, 0xc7, 0x23, 0xfb, 0xdc, 0x34, 0xe8}};
|
STATIC CONST EFI_GUID mCheckParamBufferPrmHandlerGuid = {
|
||||||
|
0x2e4f2d13, 0x6240, 0x4ed0, { 0xa4, 0x01, 0xc7, 0x23, 0xfb, 0xdc, 0x34, 0xe8 }
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Constructor of the PRM configuration library.
|
Constructor of the PRM configuration library.
|
||||||
@ -82,6 +86,7 @@ AcpiParameterBufferModuleConfigLibConstructor (
|
|||||||
Status = EFI_OUT_OF_RESOURCES;
|
Status = EFI_OUT_OF_RESOURCES;
|
||||||
goto Done;
|
goto Done;
|
||||||
}
|
}
|
||||||
|
|
||||||
CopyGuid (&PrmConfigProtocol->ModuleContextBuffers.ModuleGuid, &mPrmModuleGuid);
|
CopyGuid (&PrmConfigProtocol->ModuleContextBuffers.ModuleGuid, &mPrmModuleGuid);
|
||||||
|
|
||||||
// Populate the ACPI Parameter Buffer Descriptor structure
|
// Populate the ACPI Parameter Buffer Descriptor structure
|
||||||
@ -108,9 +113,11 @@ Done:
|
|||||||
if (AcpiParameterBuffer != NULL) {
|
if (AcpiParameterBuffer != NULL) {
|
||||||
FreePool (AcpiParameterBuffer);
|
FreePool (AcpiParameterBuffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (AcpiParamBufferDescriptor != NULL) {
|
if (AcpiParamBufferDescriptor != NULL) {
|
||||||
FreePool (AcpiParamBufferDescriptor);
|
FreePool (AcpiParamBufferDescriptor);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (PrmConfigProtocol != NULL) {
|
if (PrmConfigProtocol != NULL) {
|
||||||
FreePool (PrmConfigProtocol);
|
FreePool (PrmConfigProtocol);
|
||||||
}
|
}
|
||||||
|
@ -39,8 +39,7 @@
|
|||||||
@retval Others An error occurred in the PRM handler.
|
@retval Others An error occurred in the PRM handler.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
PRM_HANDLER_EXPORT (CheckParamBufferPrmHandler)
|
PRM_HANDLER_EXPORT (CheckParamBufferPrmHandler) {
|
||||||
{
|
|
||||||
if (ParameterBuffer == NULL) {
|
if (ParameterBuffer == NULL) {
|
||||||
return EFI_INVALID_PARAMETER;
|
return EFI_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
@ -21,10 +21,14 @@
|
|||||||
STATIC EFI_HANDLE mPrmConfigProtocolHandle;
|
STATIC EFI_HANDLE mPrmConfigProtocolHandle;
|
||||||
|
|
||||||
// {5a6cf42b-8bb4-472c-a233-5c4dc4033dc7}
|
// {5a6cf42b-8bb4-472c-a233-5c4dc4033dc7}
|
||||||
STATIC CONST EFI_GUID mPrmModuleGuid = {0x5a6cf42b, 0x8bb4, 0x472c, {0xa2, 0x33, 0x5c, 0x4d, 0xc4, 0x03, 0x3d, 0xc7}};
|
STATIC CONST EFI_GUID mPrmModuleGuid = {
|
||||||
|
0x5a6cf42b, 0x8bb4, 0x472c, { 0xa2, 0x33, 0x5c, 0x4d, 0xc4, 0x03, 0x3d, 0xc7 }
|
||||||
|
};
|
||||||
|
|
||||||
// {e1466081-7562-430f-896b-b0e523dc335a}
|
// {e1466081-7562-430f-896b-b0e523dc335a}
|
||||||
STATIC CONST EFI_GUID mCheckStaticDataBufferPrmHandlerGuid = {0xe1466081, 0x7562, 0x430f, {0x89, 0x6b, 0xb0, 0xe5, 0x23, 0xdc, 0x33, 0x5a}};
|
STATIC CONST EFI_GUID mCheckStaticDataBufferPrmHandlerGuid = {
|
||||||
|
0xe1466081, 0x7562, 0x430f, { 0x89, 0x6b, 0xb0, 0xe5, 0x23, 0xdc, 0x33, 0x5a }
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Populates the static data buffer for this PRM module.
|
Populates the static data buffer for this PRM module.
|
||||||
@ -80,6 +84,7 @@ GetStaticDataBuffer (
|
|||||||
if (StaticDataBuffer == NULL) {
|
if (StaticDataBuffer == NULL) {
|
||||||
return EFI_INVALID_PARAMETER;
|
return EFI_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
*StaticDataBuffer = NULL;
|
*StaticDataBuffer = NULL;
|
||||||
|
|
||||||
//
|
//
|
||||||
@ -144,7 +149,7 @@ ContextBufferModuleConfigLibConstructor (
|
|||||||
//
|
//
|
||||||
Status = GetStaticDataBuffer (&StaticDataBuffer);
|
Status = GetStaticDataBuffer (&StaticDataBuffer);
|
||||||
ASSERT_EFI_ERROR (Status);
|
ASSERT_EFI_ERROR (Status);
|
||||||
if (EFI_ERROR (Status) || StaticDataBuffer == NULL) {
|
if (EFI_ERROR (Status) || (StaticDataBuffer == NULL)) {
|
||||||
goto Done;
|
goto Done;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -166,6 +171,7 @@ ContextBufferModuleConfigLibConstructor (
|
|||||||
Status = EFI_OUT_OF_RESOURCES;
|
Status = EFI_OUT_OF_RESOURCES;
|
||||||
goto Done;
|
goto Done;
|
||||||
}
|
}
|
||||||
|
|
||||||
CopyGuid (&PrmContextBuffer->HandlerGuid, &mCheckStaticDataBufferPrmHandlerGuid);
|
CopyGuid (&PrmContextBuffer->HandlerGuid, &mCheckStaticDataBufferPrmHandlerGuid);
|
||||||
PrmContextBuffer->Signature = PRM_CONTEXT_BUFFER_SIGNATURE;
|
PrmContextBuffer->Signature = PRM_CONTEXT_BUFFER_SIGNATURE;
|
||||||
PrmContextBuffer->Version = PRM_CONTEXT_BUFFER_INTERFACE_VERSION;
|
PrmContextBuffer->Version = PRM_CONTEXT_BUFFER_INTERFACE_VERSION;
|
||||||
@ -177,6 +183,7 @@ ContextBufferModuleConfigLibConstructor (
|
|||||||
Status = EFI_OUT_OF_RESOURCES;
|
Status = EFI_OUT_OF_RESOURCES;
|
||||||
goto Done;
|
goto Done;
|
||||||
}
|
}
|
||||||
|
|
||||||
CopyGuid (&PrmConfigProtocol->ModuleContextBuffers.ModuleGuid, &mPrmModuleGuid);
|
CopyGuid (&PrmConfigProtocol->ModuleContextBuffers.ModuleGuid, &mPrmModuleGuid);
|
||||||
PrmConfigProtocol->ModuleContextBuffers.BufferCount = 1;
|
PrmConfigProtocol->ModuleContextBuffers.BufferCount = 1;
|
||||||
PrmConfigProtocol->ModuleContextBuffers.Buffer = PrmContextBuffer;
|
PrmConfigProtocol->ModuleContextBuffers.Buffer = PrmContextBuffer;
|
||||||
@ -197,9 +204,11 @@ Done:
|
|||||||
if (StaticDataBuffer != NULL) {
|
if (StaticDataBuffer != NULL) {
|
||||||
FreePool (StaticDataBuffer);
|
FreePool (StaticDataBuffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (PrmContextBuffer != NULL) {
|
if (PrmContextBuffer != NULL) {
|
||||||
FreePool (PrmContextBuffer);
|
FreePool (PrmContextBuffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (PrmConfigProtocol != NULL) {
|
if (PrmConfigProtocol != NULL) {
|
||||||
FreePool (PrmConfigProtocol);
|
FreePool (PrmConfigProtocol);
|
||||||
}
|
}
|
||||||
|
@ -35,8 +35,7 @@
|
|||||||
@retval Others An error occurred in the PRM handler.
|
@retval Others An error occurred in the PRM handler.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
PRM_HANDLER_EXPORT (CheckStaticDataBufferPrmHandler)
|
PRM_HANDLER_EXPORT (CheckStaticDataBufferPrmHandler) {
|
||||||
{
|
|
||||||
if (ContextBuffer == NULL) {
|
if (ContextBuffer == NULL) {
|
||||||
return EFI_INVALID_PARAMETER;
|
return EFI_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
@ -49,8 +48,9 @@ PRM_HANDLER_EXPORT (CheckStaticDataBufferPrmHandler)
|
|||||||
// Verify PRM data buffer signature is valid
|
// Verify PRM data buffer signature is valid
|
||||||
//
|
//
|
||||||
if (
|
if (
|
||||||
ContextBuffer->Signature != PRM_CONTEXT_BUFFER_SIGNATURE ||
|
(ContextBuffer->Signature != PRM_CONTEXT_BUFFER_SIGNATURE) ||
|
||||||
ContextBuffer->StaticDataBuffer->Header.Signature != PRM_DATA_BUFFER_HEADER_SIGNATURE) {
|
(ContextBuffer->StaticDataBuffer->Header.Signature != PRM_DATA_BUFFER_HEADER_SIGNATURE))
|
||||||
|
{
|
||||||
return EFI_NOT_FOUND;
|
return EFI_NOT_FOUND;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -18,7 +18,9 @@
|
|||||||
STATIC EFI_HANDLE mPrmConfigProtocolHandle;
|
STATIC EFI_HANDLE mPrmConfigProtocolHandle;
|
||||||
|
|
||||||
// {0ef93ed7-14ae-425b-928f-b85a6213b57e}
|
// {0ef93ed7-14ae-425b-928f-b85a6213b57e}
|
||||||
STATIC CONST EFI_GUID mPrmModuleGuid = {0x0ef93ed7, 0x14ae, 0x425b, {0x92, 0x8f, 0xb8, 0x5a, 0x62, 0x13, 0xb5, 0x7e}};
|
STATIC CONST EFI_GUID mPrmModuleGuid = {
|
||||||
|
0x0ef93ed7, 0x14ae, 0x425b, { 0x92, 0x8f, 0xb8, 0x5a, 0x62, 0x13, 0xb5, 0x7e }
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Constructor of the PRM configuration library.
|
Constructor of the PRM configuration library.
|
||||||
@ -70,6 +72,7 @@ HardwareAccessModuleConfigLibConstructor (
|
|||||||
Status = EFI_OUT_OF_RESOURCES;
|
Status = EFI_OUT_OF_RESOURCES;
|
||||||
goto Done;
|
goto Done;
|
||||||
}
|
}
|
||||||
|
|
||||||
CopyGuid (&PrmConfigProtocol->ModuleContextBuffers.ModuleGuid, &mPrmModuleGuid);
|
CopyGuid (&PrmConfigProtocol->ModuleContextBuffers.ModuleGuid, &mPrmModuleGuid);
|
||||||
|
|
||||||
// Populate the Runtime MMIO Ranges structure
|
// Populate the Runtime MMIO Ranges structure
|
||||||
@ -95,6 +98,7 @@ Done:
|
|||||||
if (RuntimeMmioRanges != NULL) {
|
if (RuntimeMmioRanges != NULL) {
|
||||||
FreePool (RuntimeMmioRanges);
|
FreePool (RuntimeMmioRanges);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (PrmConfigProtocol != NULL) {
|
if (PrmConfigProtocol != NULL) {
|
||||||
FreePool (PrmConfigProtocol);
|
FreePool (PrmConfigProtocol);
|
||||||
}
|
}
|
||||||
|
@ -158,12 +158,18 @@ AccessAllMtrrs (
|
|||||||
RangeCount = 1;
|
RangeCount = 1;
|
||||||
|
|
||||||
MtrrLibGetRawVariableRanges (
|
MtrrLibGetRawVariableRanges (
|
||||||
&Mtrrs->Variables, VariableMtrrCount,
|
&Mtrrs->Variables,
|
||||||
MtrrValidBitsMask, MtrrValidAddressMask, RawVariableRanges
|
VariableMtrrCount,
|
||||||
|
MtrrValidBitsMask,
|
||||||
|
MtrrValidAddressMask,
|
||||||
|
RawVariableRanges
|
||||||
);
|
);
|
||||||
MtrrLibApplyVariableMtrrs (
|
MtrrLibApplyVariableMtrrs (
|
||||||
RawVariableRanges, VariableMtrrCount,
|
RawVariableRanges,
|
||||||
Ranges, ARRAY_SIZE (Ranges), &RangeCount
|
VariableMtrrCount,
|
||||||
|
Ranges,
|
||||||
|
ARRAY_SIZE (Ranges),
|
||||||
|
&RangeCount
|
||||||
);
|
);
|
||||||
|
|
||||||
MtrrLibApplyFixedMtrrs (&Mtrrs->Fixed, Ranges, ARRAY_SIZE (Ranges), &RangeCount);
|
MtrrLibApplyFixedMtrrs (&Mtrrs->Fixed, Ranges, ARRAY_SIZE (Ranges), &RangeCount);
|
||||||
@ -251,8 +257,7 @@ GetMicrocodeSignature (
|
|||||||
@retval Others An error occurred in the PRM handler.
|
@retval Others An error occurred in the PRM handler.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
PRM_HANDLER_EXPORT (MsrAccessMicrocodeSignaturePrmHandler)
|
PRM_HANDLER_EXPORT (MsrAccessMicrocodeSignaturePrmHandler) {
|
||||||
{
|
|
||||||
UINT32 MicrocodeSignature;
|
UINT32 MicrocodeSignature;
|
||||||
|
|
||||||
MicrocodeSignature = 0;
|
MicrocodeSignature = 0;
|
||||||
@ -277,8 +282,7 @@ PRM_HANDLER_EXPORT (MsrAccessMicrocodeSignaturePrmHandler)
|
|||||||
@retval Others An error occurred in the PRM handler.
|
@retval Others An error occurred in the PRM handler.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
PRM_HANDLER_EXPORT (MsrAccessMtrrDumpPrmHandler)
|
PRM_HANDLER_EXPORT (MsrAccessMtrrDumpPrmHandler) {
|
||||||
{
|
|
||||||
AccessAllMtrrs ();
|
AccessAllMtrrs ();
|
||||||
|
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
@ -296,8 +300,7 @@ PRM_HANDLER_EXPORT (MsrAccessMtrrDumpPrmHandler)
|
|||||||
@retval Others An error occurred in the PRM handler.
|
@retval Others An error occurred in the PRM handler.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
PRM_HANDLER_EXPORT (MmioAccessHpetPrmHandler)
|
PRM_HANDLER_EXPORT (MmioAccessHpetPrmHandler) {
|
||||||
{
|
|
||||||
AccessHpetConfiguration ();
|
AccessHpetConfiguration ();
|
||||||
|
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
|
@ -37,8 +37,6 @@ UnitTestRaiseTpl (
|
|||||||
IN EFI_TPL NewTpl
|
IN EFI_TPL NewTpl
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Lowers the task priority to the previous value. If the new
|
Lowers the task priority to the previous value. If the new
|
||||||
priority unmasks events at a higher priority, they are dispatched.
|
priority unmasks events at a higher priority, they are dispatched.
|
||||||
@ -137,8 +135,6 @@ UnitTestGetMemoryMap (
|
|||||||
OUT UINT32 *DescriptorVersion
|
OUT UINT32 *DescriptorVersion
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Allocate pool of a particular type.
|
Allocate pool of a particular type.
|
||||||
|
|
||||||
|
@ -188,7 +188,7 @@ UnitTestCalculateCrc32 (
|
|||||||
OUT UINT32 *Crc32
|
OUT UINT32 *Crc32
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
if (Data == NULL || Crc32 == NULL || DataSize == 0) {
|
if ((Data == NULL) || (Crc32 == NULL) || (DataSize == 0)) {
|
||||||
return EFI_INVALID_PARAMETER;
|
return EFI_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -74,11 +74,10 @@ UnitTestFindProtocolEntry (
|
|||||||
ProtEntry = NULL;
|
ProtEntry = NULL;
|
||||||
for (Link = mProtocolDatabase.ForwardLink;
|
for (Link = mProtocolDatabase.ForwardLink;
|
||||||
Link != &mProtocolDatabase;
|
Link != &mProtocolDatabase;
|
||||||
Link = Link->ForwardLink) {
|
Link = Link->ForwardLink)
|
||||||
|
{
|
||||||
Item = CR (Link, PROTOCOL_ENTRY, AllEntries, PROTOCOL_ENTRY_SIGNATURE);
|
Item = CR (Link, PROTOCOL_ENTRY, AllEntries, PROTOCOL_ENTRY_SIGNATURE);
|
||||||
if (CompareGuid (&Item->ProtocolID, Protocol)) {
|
if (CompareGuid (&Item->ProtocolID, Protocol)) {
|
||||||
|
|
||||||
//
|
//
|
||||||
// This is the protocol entry
|
// This is the protocol entry
|
||||||
//
|
//
|
||||||
@ -145,17 +144,15 @@ UnitTestFindProtocolInterface (
|
|||||||
|
|
||||||
ProtEntry = UnitTestFindProtocolEntry (Protocol, FALSE);
|
ProtEntry = UnitTestFindProtocolEntry (Protocol, FALSE);
|
||||||
if (ProtEntry != NULL) {
|
if (ProtEntry != NULL) {
|
||||||
|
|
||||||
//
|
//
|
||||||
// Look at each protocol interface for any matches
|
// 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
|
// If this protocol interface matches, remove it
|
||||||
//
|
//
|
||||||
Prot = CR (Link, PROTOCOL_INTERFACE, Link, PROTOCOL_INTERFACE_SIGNATURE);
|
Prot = CR (Link, PROTOCOL_INTERFACE, Link, PROTOCOL_INTERFACE_SIGNATURE);
|
||||||
if (Prot->Interface == Interface && Prot->Protocol == ProtEntry) {
|
if ((Prot->Interface == Interface) && (Prot->Protocol == ProtEntry)) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -270,7 +267,6 @@ UnitTestGetNextLocateByRegisterNotify (
|
|||||||
return Handle;
|
return Handle;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Routine to get the next Handle, when you are searching for a given protocol.
|
Routine to get the next Handle, when you are searching for a given protocol.
|
||||||
|
|
||||||
@ -368,6 +364,7 @@ UnitTestDisconnectControllersUsingProtocolInterface (
|
|||||||
if (!EFI_ERROR (Status)) {
|
if (!EFI_ERROR (Status)) {
|
||||||
ItemFound = TRUE;
|
ItemFound = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -380,7 +377,8 @@ UnitTestDisconnectControllersUsingProtocolInterface (
|
|||||||
for (Link = Prot->OpenList.ForwardLink; Link != &Prot->OpenList;) {
|
for (Link = Prot->OpenList.ForwardLink; Link != &Prot->OpenList;) {
|
||||||
OpenData = CR (Link, OPEN_PROTOCOL_DATA, Link, OPEN_PROTOCOL_DATA_SIGNATURE);
|
OpenData = CR (Link, OPEN_PROTOCOL_DATA, Link, OPEN_PROTOCOL_DATA_SIGNATURE);
|
||||||
if ((OpenData->Attributes &
|
if ((OpenData->Attributes &
|
||||||
(EFI_OPEN_PROTOCOL_BY_HANDLE_PROTOCOL | EFI_OPEN_PROTOCOL_GET_PROTOCOL | EFI_OPEN_PROTOCOL_TEST_PROTOCOL)) != 0) {
|
(EFI_OPEN_PROTOCOL_BY_HANDLE_PROTOCOL | EFI_OPEN_PROTOCOL_GET_PROTOCOL | EFI_OPEN_PROTOCOL_TEST_PROTOCOL)) != 0)
|
||||||
|
{
|
||||||
Link = RemoveEntryList (&OpenData->Link);
|
Link = RemoveEntryList (&OpenData->Link);
|
||||||
Prot->OpenListCount--;
|
Prot->OpenListCount--;
|
||||||
FreePool (OpenData);
|
FreePool (OpenData);
|
||||||
@ -425,7 +423,6 @@ UnitTestRemoveInterfaceFromProtocol (
|
|||||||
|
|
||||||
Prot = UnitTestFindProtocolInterface (Handle, Protocol, Interface);
|
Prot = UnitTestFindProtocolInterface (Handle, Protocol, Interface);
|
||||||
if (Prot != NULL) {
|
if (Prot != NULL) {
|
||||||
|
|
||||||
ProtEntry = Prot->Protocol;
|
ProtEntry = Prot->Protocol;
|
||||||
|
|
||||||
//
|
//
|
||||||
@ -490,6 +487,7 @@ UnitTestGetProtocolInterface (
|
|||||||
return Prot;
|
return Prot;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -529,7 +527,7 @@ UnitTestInstallProtocolInterfaceNotify (
|
|||||||
// returns EFI_INVALID_PARAMETER if InterfaceType is invalid.
|
// returns EFI_INVALID_PARAMETER if InterfaceType is invalid.
|
||||||
// Also added check for invalid UserHandle and Protocol pointers.
|
// Also added check for invalid UserHandle and Protocol pointers.
|
||||||
//
|
//
|
||||||
if (UserHandle == NULL || Protocol == NULL) {
|
if ((UserHandle == NULL) || (Protocol == NULL)) {
|
||||||
return EFI_INVALID_PARAMETER;
|
return EFI_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -643,6 +641,7 @@ UnitTestInstallProtocolInterfaceNotify (
|
|||||||
if (Notify) {
|
if (Notify) {
|
||||||
UnitTestNotifyProtocolEntry (ProtEntry);
|
UnitTestNotifyProtocolEntry (ProtEntry);
|
||||||
}
|
}
|
||||||
|
|
||||||
Status = EFI_SUCCESS;
|
Status = EFI_SUCCESS;
|
||||||
|
|
||||||
Done:
|
Done:
|
||||||
@ -658,6 +657,7 @@ Done:
|
|||||||
if (Prot != NULL) {
|
if (Prot != NULL) {
|
||||||
UnitTestFreePool (Prot);
|
UnitTestFreePool (Prot);
|
||||||
}
|
}
|
||||||
|
|
||||||
DEBUG ((DEBUG_ERROR, "InstallProtocolInterface: %g %p failed with %r\n", Protocol, Interface, Status));
|
DEBUG ((DEBUG_ERROR, "InstallProtocolInterface: %g %p failed with %r\n", Protocol, Interface, Status));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -952,6 +952,7 @@ UnitTestLocateHandle (
|
|||||||
Status = EFI_INVALID_PARAMETER;
|
Status = EFI_INVALID_PARAMETER;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
GetNext = UnitTestGetNextLocateByRegisterNotify;
|
GetNext = UnitTestGetNextLocateByRegisterNotify;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -961,6 +962,7 @@ UnitTestLocateHandle (
|
|||||||
Status = EFI_INVALID_PARAMETER;
|
Status = EFI_INVALID_PARAMETER;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Look up the protocol entry and set the head pointer
|
// Look up the protocol entry and set the head pointer
|
||||||
//
|
//
|
||||||
@ -969,6 +971,7 @@ UnitTestLocateHandle (
|
|||||||
Status = EFI_NOT_FOUND;
|
Status = EFI_NOT_FOUND;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
Position.Position = &Position.ProtEntry->Protocols;
|
Position.Position = &Position.ProtEntry->Protocols;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -1023,7 +1026,7 @@ UnitTestLocateHandle (
|
|||||||
|
|
||||||
*BufferSize = ResultSize;
|
*BufferSize = ResultSize;
|
||||||
|
|
||||||
if (SearchType == ByRegisterNotify && !EFI_ERROR(Status)) {
|
if ((SearchType == ByRegisterNotify) && !EFI_ERROR (Status)) {
|
||||||
//
|
//
|
||||||
// If this is a search by register notify and a handle was
|
// If this is a search by register notify and a handle was
|
||||||
// returned, update the register notification position
|
// returned, update the register notification position
|
||||||
@ -1159,13 +1162,16 @@ UnitTestOpenProtocol (
|
|||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
Status = UnitTestValidateHandle (ControllerHandle);
|
Status = UnitTestValidateHandle (ControllerHandle);
|
||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (UserHandle == ControllerHandle) {
|
if (UserHandle == ControllerHandle) {
|
||||||
return EFI_INVALID_PARAMETER;
|
return EFI_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case EFI_OPEN_PROTOCOL_BY_DRIVER:
|
case EFI_OPEN_PROTOCOL_BY_DRIVER:
|
||||||
case EFI_OPEN_PROTOCOL_BY_DRIVER | EFI_OPEN_PROTOCOL_EXCLUSIVE:
|
case EFI_OPEN_PROTOCOL_BY_DRIVER | EFI_OPEN_PROTOCOL_EXCLUSIVE:
|
||||||
@ -1173,16 +1179,19 @@ UnitTestOpenProtocol (
|
|||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
Status = UnitTestValidateHandle (ControllerHandle);
|
Status = UnitTestValidateHandle (ControllerHandle);
|
||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case EFI_OPEN_PROTOCOL_EXCLUSIVE:
|
case EFI_OPEN_PROTOCOL_EXCLUSIVE:
|
||||||
Status = UnitTestValidateHandle (ImageHandle);
|
Status = UnitTestValidateHandle (ImageHandle);
|
||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case EFI_OPEN_PROTOCOL_BY_HANDLE_PROTOCOL:
|
case EFI_OPEN_PROTOCOL_BY_HANDLE_PROTOCOL:
|
||||||
case EFI_OPEN_PROTOCOL_GET_PROTOCOL:
|
case EFI_OPEN_PROTOCOL_GET_PROTOCOL:
|
||||||
@ -1217,6 +1226,7 @@ UnitTestOpenProtocol (
|
|||||||
goto Done;
|
goto Done;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((OpenData->Attributes & EFI_OPEN_PROTOCOL_EXCLUSIVE) != 0) {
|
if ((OpenData->Attributes & EFI_OPEN_PROTOCOL_EXCLUSIVE) != 0) {
|
||||||
Exclusive = TRUE;
|
Exclusive = TRUE;
|
||||||
} else if (ExactMatch) {
|
} else if (ExactMatch) {
|
||||||
@ -1239,6 +1249,7 @@ UnitTestOpenProtocol (
|
|||||||
Status = EFI_ACCESS_DENIED;
|
Status = EFI_ACCESS_DENIED;
|
||||||
goto Done;
|
goto Done;
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case EFI_OPEN_PROTOCOL_BY_DRIVER | EFI_OPEN_PROTOCOL_EXCLUSIVE:
|
case EFI_OPEN_PROTOCOL_BY_DRIVER | EFI_OPEN_PROTOCOL_EXCLUSIVE:
|
||||||
case EFI_OPEN_PROTOCOL_EXCLUSIVE:
|
case EFI_OPEN_PROTOCOL_EXCLUSIVE:
|
||||||
@ -1246,6 +1257,7 @@ UnitTestOpenProtocol (
|
|||||||
Status = EFI_ACCESS_DENIED;
|
Status = EFI_ACCESS_DENIED;
|
||||||
goto Done;
|
goto Done;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ByDriver) {
|
if (ByDriver) {
|
||||||
do {
|
do {
|
||||||
Disconnect = FALSE;
|
Disconnect = FALSE;
|
||||||
@ -1264,6 +1276,7 @@ UnitTestOpenProtocol (
|
|||||||
}
|
}
|
||||||
} while (Disconnect);
|
} while (Disconnect);
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER:
|
case EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER:
|
||||||
case EFI_OPEN_PROTOCOL_BY_HANDLE_PROTOCOL:
|
case EFI_OPEN_PROTOCOL_BY_HANDLE_PROTOCOL:
|
||||||
@ -1276,6 +1289,7 @@ UnitTestOpenProtocol (
|
|||||||
Status = EFI_SUCCESS;
|
Status = EFI_SUCCESS;
|
||||||
goto Done;
|
goto Done;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Create new entry
|
// Create new entry
|
||||||
//
|
//
|
||||||
@ -1300,7 +1314,7 @@ Done:
|
|||||||
// Keep Interface unmodified in case of any Error
|
// Keep Interface unmodified in case of any Error
|
||||||
// except EFI_ALREADY_STARTED and EFI_UNSUPPORTED.
|
// except EFI_ALREADY_STARTED and EFI_UNSUPPORTED.
|
||||||
//
|
//
|
||||||
if (!EFI_ERROR (Status) || Status == EFI_ALREADY_STARTED) {
|
if (!EFI_ERROR (Status) || (Status == EFI_ALREADY_STARTED)) {
|
||||||
//
|
//
|
||||||
// According to above logic, if 'Prot' is NULL, then the 'Status' must be
|
// According to above logic, if 'Prot' is NULL, then the 'Status' must be
|
||||||
// EFI_UNSUPPORTED. Here the 'Status' is not EFI_UNSUPPORTED, so 'Prot'
|
// EFI_UNSUPPORTED. Here the 'Status' is not EFI_UNSUPPORTED, so 'Prot'
|
||||||
@ -1479,10 +1493,11 @@ UnitTestLocateHandleBuffer (
|
|||||||
//
|
//
|
||||||
// Add code to correctly handle expected errors from UnitTestLocateHandle().
|
// Add code to correctly handle expected errors from UnitTestLocateHandle().
|
||||||
//
|
//
|
||||||
if (EFI_ERROR (Status) && Status != EFI_BUFFER_TOO_SMALL) {
|
if (EFI_ERROR (Status) && (Status != EFI_BUFFER_TOO_SMALL)) {
|
||||||
if (Status != EFI_INVALID_PARAMETER) {
|
if (Status != EFI_INVALID_PARAMETER) {
|
||||||
Status = EFI_NOT_FOUND;
|
Status = EFI_NOT_FOUND;
|
||||||
}
|
}
|
||||||
|
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1609,6 +1624,7 @@ UnitTestUninstallMultipleProtocolInterfaces (
|
|||||||
//
|
//
|
||||||
Status = UnitTestUninstallProtocolInterface (Handle, Protocol, Interface);
|
Status = UnitTestUninstallProtocolInterface (Handle, Protocol, Interface);
|
||||||
}
|
}
|
||||||
|
|
||||||
VA_END (Args);
|
VA_END (Args);
|
||||||
|
|
||||||
//
|
//
|
||||||
@ -1625,6 +1641,7 @@ UnitTestUninstallMultipleProtocolInterfaces (
|
|||||||
Interface = VA_ARG (Args, VOID *);
|
Interface = VA_ARG (Args, VOID *);
|
||||||
UnitTestInstallProtocolInterface (&Handle, Protocol, EFI_NATIVE_INTERFACE, Interface);
|
UnitTestInstallProtocolInterface (&Handle, Protocol, EFI_NATIVE_INTERFACE, Interface);
|
||||||
}
|
}
|
||||||
|
|
||||||
VA_END (Args);
|
VA_END (Args);
|
||||||
Status = EFI_INVALID_PARAMETER;
|
Status = EFI_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
@ -51,7 +51,6 @@ typedef struct {
|
|||||||
LIST_ENTRY Notify;
|
LIST_ENTRY Notify;
|
||||||
} PROTOCOL_ENTRY;
|
} PROTOCOL_ENTRY;
|
||||||
|
|
||||||
|
|
||||||
#define PROTOCOL_INTERFACE_SIGNATURE SIGNATURE_32('p','i','f','c')
|
#define PROTOCOL_INTERFACE_SIGNATURE SIGNATURE_32('p','i','f','c')
|
||||||
|
|
||||||
///
|
///
|
||||||
@ -73,7 +72,6 @@ typedef struct {
|
|||||||
/// OPEN_PROTOCOL_DATA list
|
/// OPEN_PROTOCOL_DATA list
|
||||||
LIST_ENTRY OpenList;
|
LIST_ENTRY OpenList;
|
||||||
UINTN OpenListCount;
|
UINTN OpenListCount;
|
||||||
|
|
||||||
} PROTOCOL_INTERFACE;
|
} PROTOCOL_INTERFACE;
|
||||||
|
|
||||||
#define OPEN_PROTOCOL_DATA_SIGNATURE SIGNATURE_32('p','o','d','l')
|
#define OPEN_PROTOCOL_DATA_SIGNATURE SIGNATURE_32('p','o','d','l')
|
||||||
@ -89,7 +87,6 @@ typedef struct {
|
|||||||
UINT32 OpenCount;
|
UINT32 OpenCount;
|
||||||
} OPEN_PROTOCOL_DATA;
|
} OPEN_PROTOCOL_DATA;
|
||||||
|
|
||||||
|
|
||||||
#define PROTOCOL_NOTIFY_SIGNATURE SIGNATURE_32('p','r','t','n')
|
#define PROTOCOL_NOTIFY_SIGNATURE SIGNATURE_32('p','r','t','n')
|
||||||
|
|
||||||
///
|
///
|
||||||
|
Reference in New Issue
Block a user