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
@ -32,25 +32,25 @@
|
|||||||
|
|
||||||
#include "PrmInfo.h"
|
#include "PrmInfo.h"
|
||||||
|
|
||||||
GLOBAL_REMOVE_IF_UNREFERENCED EFI_STRING_ID mStringPrmInfoHelpTokenId = STRING_TOKEN (STR_PRMINFO_HELP);
|
GLOBAL_REMOVE_IF_UNREFERENCED EFI_STRING_ID mStringPrmInfoHelpTokenId = STRING_TOKEN (STR_PRMINFO_HELP);
|
||||||
//
|
//
|
||||||
// This is the generated String package data for all .UNI files.
|
// This is the generated String package data for all .UNI files.
|
||||||
// This data array is ready to be used as input of HiiAddPackages() to
|
// This data array is ready to be used as input of HiiAddPackages() to
|
||||||
// create a packagelist (which contains Form packages, String packages, etc).
|
// create a packagelist (which contains Form packages, String packages, etc).
|
||||||
//
|
//
|
||||||
extern UINT8 PrmInfoStrings[];
|
extern UINT8 PrmInfoStrings[];
|
||||||
|
|
||||||
STATIC UINTN mPrmHandlerCount;
|
STATIC UINTN mPrmHandlerCount;
|
||||||
STATIC UINTN mPrmModuleCount;
|
STATIC UINTN mPrmModuleCount;
|
||||||
|
|
||||||
STATIC EFI_HII_HANDLE mPrmInfoHiiHandle;
|
STATIC EFI_HII_HANDLE mPrmInfoHiiHandle;
|
||||||
STATIC LIST_ENTRY mPrmHandlerList;
|
STATIC LIST_ENTRY mPrmHandlerList;
|
||||||
|
|
||||||
STATIC CONST SHELL_PARAM_ITEM mParamList[] = {
|
STATIC CONST SHELL_PARAM_ITEM mParamList[] = {
|
||||||
{L"-l", TypeFlag},
|
{ L"-l", TypeFlag },
|
||||||
{L"-t", TypeValue},
|
{ L"-t", TypeValue },
|
||||||
{NULL, TypeMax}
|
{ NULL, TypeMax }
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Frees all of the nodes in a linked list.
|
Frees all of the nodes in a linked list.
|
||||||
@ -61,12 +61,12 @@ STATIC CONST SHELL_PARAM_ITEM mParamList[] = {
|
|||||||
VOID
|
VOID
|
||||||
EFIAPI
|
EFIAPI
|
||||||
FreeList (
|
FreeList (
|
||||||
IN LIST_ENTRY *ListHead
|
IN LIST_ENTRY *ListHead
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
LIST_ENTRY *Link;
|
LIST_ENTRY *Link;
|
||||||
LIST_ENTRY *NextLink;
|
LIST_ENTRY *NextLink;
|
||||||
PRM_HANDLER_CONTEXT_LIST_ENTRY *ListEntry;
|
PRM_HANDLER_CONTEXT_LIST_ENTRY *ListEntry;
|
||||||
|
|
||||||
if (ListHead == NULL) {
|
if (ListHead == NULL) {
|
||||||
return;
|
return;
|
||||||
@ -75,7 +75,7 @@ FreeList (
|
|||||||
Link = GetFirstNode (&mPrmHandlerList);
|
Link = GetFirstNode (&mPrmHandlerList);
|
||||||
while (!IsNull (&mPrmHandlerList, Link)) {
|
while (!IsNull (&mPrmHandlerList, Link)) {
|
||||||
ListEntry = CR (Link, PRM_HANDLER_CONTEXT_LIST_ENTRY, Link, PRM_HANDLER_CONTEXT_LIST_ENTRY_SIGNATURE);
|
ListEntry = CR (Link, PRM_HANDLER_CONTEXT_LIST_ENTRY, Link, PRM_HANDLER_CONTEXT_LIST_ENTRY_SIGNATURE);
|
||||||
NextLink = GetNextNode (&mPrmHandlerList, Link);
|
NextLink = GetNextNode (&mPrmHandlerList, Link);
|
||||||
|
|
||||||
RemoveEntryList (Link);
|
RemoveEntryList (Link);
|
||||||
FreePool (ListEntry);
|
FreePool (ListEntry);
|
||||||
@ -96,12 +96,13 @@ CreateNewPrmHandlerListEntry (
|
|||||||
VOID
|
VOID
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
PRM_HANDLER_CONTEXT_LIST_ENTRY *PrmHandlerContextListEntry;
|
PRM_HANDLER_CONTEXT_LIST_ENTRY *PrmHandlerContextListEntry;
|
||||||
|
|
||||||
PrmHandlerContextListEntry = AllocateZeroPool (sizeof (*PrmHandlerContextListEntry));
|
PrmHandlerContextListEntry = AllocateZeroPool (sizeof (*PrmHandlerContextListEntry));
|
||||||
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;
|
||||||
@ -118,14 +119,14 @@ PrintMmioRuntimeRangeInfo (
|
|||||||
IN PRM_RUNTIME_MMIO_RANGES *RuntimeMmioRanges
|
IN PRM_RUNTIME_MMIO_RANGES *RuntimeMmioRanges
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
UINTN RuntimeMmioRangeCount;
|
UINTN RuntimeMmioRangeCount;
|
||||||
UINTN RuntimeMmioRangeIndex;
|
UINTN RuntimeMmioRangeIndex;
|
||||||
|
|
||||||
if (RuntimeMmioRanges == NULL) {
|
if (RuntimeMmioRanges == NULL) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
RuntimeMmioRangeCount = (UINTN) RuntimeMmioRanges->Count;
|
RuntimeMmioRangeCount = (UINTN)RuntimeMmioRanges->Count;
|
||||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_PRMINFO_RUNTIME_MMIO_COUNT), mPrmInfoHiiHandle, RuntimeMmioRangeCount);
|
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_PRMINFO_RUNTIME_MMIO_COUNT), mPrmInfoHiiHandle, RuntimeMmioRangeCount);
|
||||||
|
|
||||||
for (RuntimeMmioRangeIndex = 0; RuntimeMmioRangeIndex < RuntimeMmioRangeCount; RuntimeMmioRangeIndex++) {
|
for (RuntimeMmioRangeIndex = 0; RuntimeMmioRangeIndex < RuntimeMmioRangeCount; RuntimeMmioRangeIndex++) {
|
||||||
@ -154,25 +155,25 @@ PrintMmioRuntimeRangeInfo (
|
|||||||
**/
|
**/
|
||||||
VOID
|
VOID
|
||||||
GatherPrmHandlerInfo (
|
GatherPrmHandlerInfo (
|
||||||
IN BOOLEAN PrintInformation
|
IN BOOLEAN PrintInformation
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
UINT16 MajorVersion;
|
UINT16 MajorVersion;
|
||||||
UINT16 MinorVersion;
|
UINT16 MinorVersion;
|
||||||
UINT16 HandlerCount;
|
UINT16 HandlerCount;
|
||||||
UINTN HandlerIndex;
|
UINTN HandlerIndex;
|
||||||
EFI_PHYSICAL_ADDRESS CurrentHandlerPhysicalAddress;
|
EFI_PHYSICAL_ADDRESS CurrentHandlerPhysicalAddress;
|
||||||
EFI_PHYSICAL_ADDRESS CurrentImageAddress;
|
EFI_PHYSICAL_ADDRESS CurrentImageAddress;
|
||||||
PRM_HANDLER_CONTEXT CurrentHandlerContext;
|
PRM_HANDLER_CONTEXT CurrentHandlerContext;
|
||||||
EFI_GUID *CurrentModuleGuid;
|
EFI_GUID *CurrentModuleGuid;
|
||||||
EFI_IMAGE_EXPORT_DIRECTORY *CurrentImageExportDirectory;
|
EFI_IMAGE_EXPORT_DIRECTORY *CurrentImageExportDirectory;
|
||||||
PRM_CONTEXT_BUFFER *CurrentContextBuffer;
|
PRM_CONTEXT_BUFFER *CurrentContextBuffer;
|
||||||
PRM_MODULE_EXPORT_DESCRIPTOR_STRUCT *CurrentExportDescriptorStruct;
|
PRM_MODULE_EXPORT_DESCRIPTOR_STRUCT *CurrentExportDescriptorStruct;
|
||||||
PRM_MODULE_CONTEXT_BUFFERS *CurrentModuleContextBuffers;
|
PRM_MODULE_CONTEXT_BUFFERS *CurrentModuleContextBuffers;
|
||||||
PRM_HANDLER_CONTEXT_LIST_ENTRY *CurrentHandlerContextListEntry;
|
PRM_HANDLER_CONTEXT_LIST_ENTRY *CurrentHandlerContextListEntry;
|
||||||
PRM_MODULE_IMAGE_CONTEXT *CurrentPrmModuleImageContext;
|
PRM_MODULE_IMAGE_CONTEXT *CurrentPrmModuleImageContext;
|
||||||
PRM_RUNTIME_MMIO_RANGES *CurrentPrmModuleRuntimeMmioRanges;
|
PRM_RUNTIME_MMIO_RANGES *CurrentPrmModuleRuntimeMmioRanges;
|
||||||
|
|
||||||
ASSERT (mPrmModuleCount <= mPrmHandlerCount);
|
ASSERT (mPrmModuleCount <= mPrmHandlerCount);
|
||||||
|
|
||||||
@ -182,25 +183,25 @@ GatherPrmHandlerInfo (
|
|||||||
|
|
||||||
// Iterate across all PRM modules discovered
|
// Iterate across all PRM modules discovered
|
||||||
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;
|
||||||
|
|
||||||
CurrentModuleGuid = &CurrentExportDescriptorStruct->Header.ModuleGuid;
|
CurrentModuleGuid = &CurrentExportDescriptorStruct->Header.ModuleGuid;
|
||||||
HandlerCount = CurrentExportDescriptorStruct->Header.NumberPrmHandlers;
|
HandlerCount = CurrentExportDescriptorStruct->Header.NumberPrmHandlers;
|
||||||
|
|
||||||
MajorVersion = 0;
|
MajorVersion = 0;
|
||||||
MinorVersion = 0;
|
MinorVersion = 0;
|
||||||
Status = GetImageVersionInPeCoffImage (
|
Status = GetImageVersionInPeCoffImage (
|
||||||
(VOID *) (UINTN) CurrentImageAddress,
|
(VOID *)(UINTN)CurrentImageAddress,
|
||||||
&CurrentPrmModuleImageContext->PeCoffImageContext,
|
&CurrentPrmModuleImageContext->PeCoffImageContext,
|
||||||
&MajorVersion,
|
&MajorVersion,
|
||||||
&MinorVersion
|
&MinorVersion
|
||||||
);
|
);
|
||||||
ASSERT_EFI_ERROR (Status);
|
ASSERT_EFI_ERROR (Status);
|
||||||
|
|
||||||
if (PrintInformation) {
|
if (PrintInformation) {
|
||||||
@ -210,7 +211,7 @@ GatherPrmHandlerInfo (
|
|||||||
NULL,
|
NULL,
|
||||||
STRING_TOKEN (STR_PRMINFO_MODULE_NAME),
|
STRING_TOKEN (STR_PRMINFO_MODULE_NAME),
|
||||||
mPrmInfoHiiHandle,
|
mPrmInfoHiiHandle,
|
||||||
(CHAR8 *) ((UINTN) CurrentImageAddress + CurrentImageExportDirectory->Name)
|
(CHAR8 *)((UINTN)CurrentImageAddress + CurrentImageExportDirectory->Name)
|
||||||
);
|
);
|
||||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_PRMINFO_MODULE_GUID), mPrmInfoHiiHandle, CurrentModuleGuid);
|
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_PRMINFO_MODULE_GUID), mPrmInfoHiiHandle, CurrentModuleGuid);
|
||||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_PRMINFO_MODULE_VERSION), mPrmInfoHiiHandle, MajorVersion, MinorVersion);
|
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_PRMINFO_MODULE_VERSION), mPrmInfoHiiHandle, MajorVersion, MinorVersion);
|
||||||
@ -218,13 +219,13 @@ GatherPrmHandlerInfo (
|
|||||||
|
|
||||||
// It is currently valid for a PRM module not to use a context buffer
|
// It is currently valid for a PRM module not to use a context buffer
|
||||||
CurrentPrmModuleRuntimeMmioRanges = NULL;
|
CurrentPrmModuleRuntimeMmioRanges = NULL;
|
||||||
Status = GetModuleContextBuffers (
|
Status = GetModuleContextBuffers (
|
||||||
ByModuleGuid,
|
ByModuleGuid,
|
||||||
CurrentModuleGuid,
|
CurrentModuleGuid,
|
||||||
(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);
|
||||||
}
|
}
|
||||||
@ -241,9 +243,9 @@ GatherPrmHandlerInfo (
|
|||||||
for (HandlerIndex = 0; HandlerIndex < HandlerCount; HandlerIndex++) {
|
for (HandlerIndex = 0; HandlerIndex < HandlerCount; HandlerIndex++) {
|
||||||
ZeroMem (&CurrentHandlerContext, sizeof (CurrentHandlerContext));
|
ZeroMem (&CurrentHandlerContext, sizeof (CurrentHandlerContext));
|
||||||
|
|
||||||
CurrentHandlerContext.ModuleName = (CHAR8 *) ((UINTN) CurrentImageAddress + CurrentImageExportDirectory->Name);
|
CurrentHandlerContext.ModuleName = (CHAR8 *)((UINTN)CurrentImageAddress + CurrentImageExportDirectory->Name);
|
||||||
CurrentHandlerContext.Guid = &CurrentExportDescriptorStruct->PrmHandlerExportDescriptors[HandlerIndex].PrmHandlerGuid;
|
CurrentHandlerContext.Guid = &CurrentExportDescriptorStruct->PrmHandlerExportDescriptors[HandlerIndex].PrmHandlerGuid;
|
||||||
CurrentHandlerContext.Name = (CHAR8 *) CurrentExportDescriptorStruct->PrmHandlerExportDescriptors[HandlerIndex].PrmHandlerName;
|
CurrentHandlerContext.Name = (CHAR8 *)CurrentExportDescriptorStruct->PrmHandlerExportDescriptors[HandlerIndex].PrmHandlerName;
|
||||||
|
|
||||||
if (PrintInformation) {
|
if (PrintInformation) {
|
||||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_PRMINFO_HANDLER_NAME), mPrmInfoHiiHandle, CurrentHandlerContext.Name);
|
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_PRMINFO_HANDLER_NAME), mPrmInfoHiiHandle, CurrentHandlerContext.Name);
|
||||||
@ -258,7 +260,7 @@ GatherPrmHandlerInfo (
|
|||||||
);
|
);
|
||||||
ASSERT_EFI_ERROR (Status);
|
ASSERT_EFI_ERROR (Status);
|
||||||
if (!EFI_ERROR (Status)) {
|
if (!EFI_ERROR (Status)) {
|
||||||
CurrentHandlerContext.Handler = (PRM_HANDLER *) (UINTN) CurrentHandlerPhysicalAddress;
|
CurrentHandlerContext.Handler = (PRM_HANDLER *)(UINTN)CurrentHandlerPhysicalAddress;
|
||||||
|
|
||||||
if (PrintInformation) {
|
if (PrintInformation) {
|
||||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_PRMINFO_HANDLER_PA), mPrmInfoHiiHandle, CurrentHandlerPhysicalAddress);
|
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_PRMINFO_HANDLER_PA), mPrmInfoHiiHandle, CurrentHandlerPhysicalAddress);
|
||||||
@ -272,7 +274,7 @@ GatherPrmHandlerInfo (
|
|||||||
Status = GetContextBuffer (
|
Status = GetContextBuffer (
|
||||||
CurrentHandlerContext.Guid,
|
CurrentHandlerContext.Guid,
|
||||||
CurrentModuleContextBuffers,
|
CurrentModuleContextBuffers,
|
||||||
(CONST PRM_CONTEXT_BUFFER **) &CurrentContextBuffer
|
(CONST PRM_CONTEXT_BUFFER **)&CurrentContextBuffer
|
||||||
);
|
);
|
||||||
if (!EFI_ERROR (Status)) {
|
if (!EFI_ERROR (Status)) {
|
||||||
CurrentHandlerContext.StaticDataBuffer = CurrentContextBuffer->StaticDataBuffer;
|
CurrentHandlerContext.StaticDataBuffer = CurrentContextBuffer->StaticDataBuffer;
|
||||||
@ -286,7 +288,7 @@ GatherPrmHandlerInfo (
|
|||||||
NULL,
|
NULL,
|
||||||
STRING_TOKEN (STR_PRMINFO_STATIC_DATA_BUFFER),
|
STRING_TOKEN (STR_PRMINFO_STATIC_DATA_BUFFER),
|
||||||
mPrmInfoHiiHandle,
|
mPrmInfoHiiHandle,
|
||||||
(UINTN) CurrentHandlerContext.StaticDataBuffer
|
(UINTN)CurrentHandlerContext.StaticDataBuffer
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_PRMINFO_LINE_BREAK), mPrmInfoHiiHandle);
|
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_PRMINFO_LINE_BREAK), mPrmInfoHiiHandle);
|
||||||
@ -324,19 +326,19 @@ GatherPrmHandlerInfo (
|
|||||||
**/
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
PopulateContextBuffer (
|
PopulateContextBuffer (
|
||||||
IN PRM_DATA_BUFFER *StaticDataBuffer OPTIONAL,
|
IN PRM_DATA_BUFFER *StaticDataBuffer OPTIONAL,
|
||||||
IN EFI_GUID *HandlerGuid,
|
IN EFI_GUID *HandlerGuid,
|
||||||
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
ZeroMem (ContextBuffer, sizeof (*ContextBuffer));
|
ZeroMem (ContextBuffer, sizeof (*ContextBuffer));
|
||||||
|
|
||||||
ContextBuffer->Signature = PRM_CONTEXT_BUFFER_SIGNATURE;
|
ContextBuffer->Signature = PRM_CONTEXT_BUFFER_SIGNATURE;
|
||||||
ContextBuffer->Version = PRM_CONTEXT_BUFFER_INTERFACE_VERSION;
|
ContextBuffer->Version = PRM_CONTEXT_BUFFER_INTERFACE_VERSION;
|
||||||
CopyGuid (&ContextBuffer->HandlerGuid, HandlerGuid);
|
CopyGuid (&ContextBuffer->HandlerGuid, HandlerGuid);
|
||||||
|
|
||||||
if (StaticDataBuffer != NULL) {
|
if (StaticDataBuffer != NULL) {
|
||||||
@ -354,7 +356,7 @@ PopulateContextBuffer (
|
|||||||
**/
|
**/
|
||||||
VOID
|
VOID
|
||||||
PrintExecutionTime (
|
PrintExecutionTime (
|
||||||
IN UINT64 TimeInNanoSec
|
IN UINT64 TimeInNanoSec
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
UINT64 Sec;
|
UINT64 Sec;
|
||||||
@ -363,24 +365,24 @@ PrintExecutionTime (
|
|||||||
UINT64 NanoSec;
|
UINT64 NanoSec;
|
||||||
UINT64 RemainingTime;
|
UINT64 RemainingTime;
|
||||||
|
|
||||||
Sec = 0;
|
Sec = 0;
|
||||||
MilliSec = 0;
|
MilliSec = 0;
|
||||||
MicroSec = 0;
|
MicroSec = 0;
|
||||||
NanoSec = 0;
|
NanoSec = 0;
|
||||||
RemainingTime = TimeInNanoSec;
|
RemainingTime = TimeInNanoSec;
|
||||||
|
|
||||||
if (RemainingTime > ONE_SECOND) {
|
if (RemainingTime > ONE_SECOND) {
|
||||||
Sec = DivU64x32 (RemainingTime, ONE_SECOND);
|
Sec = DivU64x32 (RemainingTime, ONE_SECOND);
|
||||||
RemainingTime -= MultU64x32 (Sec, ONE_SECOND);
|
RemainingTime -= MultU64x32 (Sec, ONE_SECOND);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (RemainingTime > ONE_MILLISECOND) {
|
if (RemainingTime > ONE_MILLISECOND) {
|
||||||
MilliSec = DivU64x32 (RemainingTime, ONE_MILLISECOND);
|
MilliSec = DivU64x32 (RemainingTime, ONE_MILLISECOND);
|
||||||
RemainingTime -= MultU64x32 (MilliSec, ONE_MILLISECOND);
|
RemainingTime -= MultU64x32 (MilliSec, ONE_MILLISECOND);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (RemainingTime > ONE_MICROSECOND) {
|
if (RemainingTime > ONE_MICROSECOND) {
|
||||||
MicroSec = DivU64x32 (RemainingTime, ONE_MICROSECOND);
|
MicroSec = DivU64x32 (RemainingTime, ONE_MICROSECOND);
|
||||||
RemainingTime -= MultU64x32 (MicroSec, ONE_MICROSECOND);
|
RemainingTime -= MultU64x32 (MicroSec, ONE_MICROSECOND);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -412,20 +414,20 @@ PrintExecutionTime (
|
|||||||
**/
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
ExecutePrmHandlerByGuid (
|
ExecutePrmHandlerByGuid (
|
||||||
IN EFI_GUID *HandlerGuid
|
IN EFI_GUID *HandlerGuid
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
BOOLEAN ExecuteAllHandlers;
|
BOOLEAN ExecuteAllHandlers;
|
||||||
BOOLEAN HandlerFound;
|
BOOLEAN HandlerFound;
|
||||||
UINT64 StartTime;
|
UINT64 StartTime;
|
||||||
UINT64 EndTime;
|
UINT64 EndTime;
|
||||||
PRM_CONTEXT_BUFFER CurrentContextBuffer;
|
PRM_CONTEXT_BUFFER CurrentContextBuffer;
|
||||||
PRM_HANDLER_CONTEXT *HandlerContext;
|
PRM_HANDLER_CONTEXT *HandlerContext;
|
||||||
PRM_HANDLER_CONTEXT_LIST_ENTRY *HandlerContextListEntry;
|
PRM_HANDLER_CONTEXT_LIST_ENTRY *HandlerContextListEntry;
|
||||||
LIST_ENTRY *Link;
|
LIST_ENTRY *Link;
|
||||||
|
|
||||||
Link = NULL;
|
Link = NULL;
|
||||||
HandlerFound = FALSE;
|
HandlerFound = FALSE;
|
||||||
|
|
||||||
if (HandlerGuid == NULL) {
|
if (HandlerGuid == NULL) {
|
||||||
@ -439,14 +441,14 @@ ExecutePrmHandlerByGuid (
|
|||||||
|
|
||||||
EFI_LIST_FOR_EACH (Link, &mPrmHandlerList) {
|
EFI_LIST_FOR_EACH (Link, &mPrmHandlerList) {
|
||||||
HandlerContextListEntry = CR (Link, PRM_HANDLER_CONTEXT_LIST_ENTRY, Link, PRM_HANDLER_CONTEXT_LIST_ENTRY_SIGNATURE);
|
HandlerContextListEntry = CR (Link, PRM_HANDLER_CONTEXT_LIST_ENTRY, Link, PRM_HANDLER_CONTEXT_LIST_ENTRY_SIGNATURE);
|
||||||
HandlerContext = &HandlerContextListEntry->Context;
|
HandlerContext = &HandlerContextListEntry->Context;
|
||||||
|
|
||||||
if (!ExecuteAllHandlers && !CompareGuid (HandlerGuid, HandlerContext->Guid)) {
|
if (!ExecuteAllHandlers && !CompareGuid (HandlerGuid, HandlerContext->Guid)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
HandlerFound = TRUE;
|
HandlerFound = TRUE;
|
||||||
Status = PopulateContextBuffer (HandlerContext->StaticDataBuffer, HandlerContext->Guid, &CurrentContextBuffer);
|
Status = PopulateContextBuffer (HandlerContext->StaticDataBuffer, HandlerContext->Guid, &CurrentContextBuffer);
|
||||||
if (!EFI_ERROR (Status)) {
|
if (!EFI_ERROR (Status)) {
|
||||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_PRMINFO_LINE_BREAK), mPrmInfoHiiHandle);
|
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_PRMINFO_LINE_BREAK), mPrmInfoHiiHandle);
|
||||||
ShellPrintHiiEx (
|
ShellPrintHiiEx (
|
||||||
@ -461,10 +463,11 @@ ExecutePrmHandlerByGuid (
|
|||||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_PRMINFO_HANDLER_GUID), mPrmInfoHiiHandle, HandlerContext->Guid);
|
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_PRMINFO_HANDLER_GUID), mPrmInfoHiiHandle, HandlerContext->Guid);
|
||||||
|
|
||||||
StartTime = 0;
|
StartTime = 0;
|
||||||
EndTime = 0;
|
EndTime = 0;
|
||||||
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 {
|
||||||
@ -519,20 +523,20 @@ ParseParameterList (
|
|||||||
VOID
|
VOID
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
EFI_STATUS ReturnStatus;
|
EFI_STATUS ReturnStatus;
|
||||||
UINTN ArgumentCount;
|
UINTN ArgumentCount;
|
||||||
EFI_GUID HandlerGuid;
|
EFI_GUID HandlerGuid;
|
||||||
BOOLEAN PrintHandlerInfo;
|
BOOLEAN PrintHandlerInfo;
|
||||||
LIST_ENTRY *Package;
|
LIST_ENTRY *Package;
|
||||||
LIST_ENTRY *TempNode;
|
LIST_ENTRY *TempNode;
|
||||||
CHAR16 *ProblemParam;
|
CHAR16 *ProblemParam;
|
||||||
CONST CHAR16 *HandlerGuidStr;
|
CONST CHAR16 *HandlerGuidStr;
|
||||||
|
|
||||||
HandlerGuidStr = NULL;
|
HandlerGuidStr = NULL;
|
||||||
Package = NULL;
|
Package = NULL;
|
||||||
PrintHandlerInfo = FALSE;
|
PrintHandlerInfo = FALSE;
|
||||||
ReturnStatus = EFI_SUCCESS;
|
ReturnStatus = EFI_SUCCESS;
|
||||||
|
|
||||||
InitializeListHead (&mPrmHandlerList);
|
InitializeListHead (&mPrmHandlerList);
|
||||||
|
|
||||||
@ -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);
|
||||||
@ -561,10 +565,12 @@ ParseParameterList (
|
|||||||
// Get argument count including flags
|
// Get argument count including flags
|
||||||
//
|
//
|
||||||
for (
|
for (
|
||||||
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,13 +641,14 @@ 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) {
|
||||||
Status = ExecutePrmHandlerByGuid (&HandlerGuid);
|
Status = ExecutePrmHandlerByGuid (&HandlerGuid);
|
||||||
if (Status == EFI_NOT_FOUND) {
|
if (Status == EFI_NOT_FOUND) {
|
||||||
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_PRMINFO_HANDLER_NOT_FOUND), mPrmInfoHiiHandle, APPLICATION_NAME, HandlerGuid);
|
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_PRMINFO_HANDLER_NOT_FOUND), mPrmInfoHiiHandle, APPLICATION_NAME, HandlerGuid);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Done:
|
Done:
|
||||||
@ -667,12 +674,12 @@ Done:
|
|||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
UefiMain (
|
UefiMain (
|
||||||
IN EFI_HANDLE ImageHandle,
|
IN EFI_HANDLE ImageHandle,
|
||||||
IN EFI_SYSTEM_TABLE *SystemTable
|
IN EFI_SYSTEM_TABLE *SystemTable
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
EFI_HII_PACKAGE_LIST_HEADER *PackageList;
|
EFI_HII_PACKAGE_LIST_HEADER *PackageList;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Retrieve the HII package list from ImageHandle
|
// Retrieve the HII package list from ImageHandle
|
||||||
@ -680,7 +687,7 @@ UefiMain (
|
|||||||
Status = gBS->OpenProtocol (
|
Status = gBS->OpenProtocol (
|
||||||
ImageHandle,
|
ImageHandle,
|
||||||
&gEfiHiiPackageListProtocolGuid,
|
&gEfiHiiPackageListProtocolGuid,
|
||||||
(VOID **) &PackageList,
|
(VOID **)&PackageList,
|
||||||
ImageHandle,
|
ImageHandle,
|
||||||
NULL,
|
NULL,
|
||||||
EFI_OPEN_PROTOCOL_GET_PROTOCOL
|
EFI_OPEN_PROTOCOL_GET_PROTOCOL
|
||||||
|
@ -14,24 +14,24 @@
|
|||||||
#include <PrmDataBuffer.h>
|
#include <PrmDataBuffer.h>
|
||||||
#include <Uefi.h>
|
#include <Uefi.h>
|
||||||
|
|
||||||
#define APPLICATION_NAME L"PrmInfo"
|
#define APPLICATION_NAME L"PrmInfo"
|
||||||
|
|
||||||
#define PRM_HANDLER_CONTEXT_LIST_ENTRY_SIGNATURE SIGNATURE_32('P','R','H','E')
|
#define PRM_HANDLER_CONTEXT_LIST_ENTRY_SIGNATURE SIGNATURE_32('P','R','H','E')
|
||||||
|
|
||||||
#pragma pack(push, 1)
|
#pragma pack(push, 1)
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
CHAR8 *Name;
|
CHAR8 *Name;
|
||||||
EFI_GUID *Guid;
|
EFI_GUID *Guid;
|
||||||
PRM_DATA_BUFFER *StaticDataBuffer;
|
PRM_DATA_BUFFER *StaticDataBuffer;
|
||||||
CHAR8 *ModuleName;
|
CHAR8 *ModuleName;
|
||||||
PRM_HANDLER *Handler;
|
PRM_HANDLER *Handler;
|
||||||
} PRM_HANDLER_CONTEXT;
|
} PRM_HANDLER_CONTEXT;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
UINTN Signature;
|
UINTN Signature;
|
||||||
LIST_ENTRY Link;
|
LIST_ENTRY Link;
|
||||||
PRM_HANDLER_CONTEXT Context;
|
PRM_HANDLER_CONTEXT Context;
|
||||||
} PRM_HANDLER_CONTEXT_LIST_ENTRY;
|
} PRM_HANDLER_CONTEXT_LIST_ENTRY;
|
||||||
|
|
||||||
#pragma pack(pop)
|
#pragma pack(pop)
|
||||||
@ -42,8 +42,8 @@ typedef struct {
|
|||||||
#define EFI_LIST_FOR_EACH(Entry, ListHead) \
|
#define EFI_LIST_FOR_EACH(Entry, ListHead) \
|
||||||
for(Entry = (ListHead)->ForwardLink; Entry != (ListHead); Entry = Entry->ForwardLink)
|
for(Entry = (ListHead)->ForwardLink; Entry != (ListHead); Entry = Entry->ForwardLink)
|
||||||
|
|
||||||
#define ONE_MICROSECOND (1000)
|
#define ONE_MICROSECOND (1000)
|
||||||
#define ONE_MILLISECOND (1000 * ONE_MICROSECOND)
|
#define ONE_MILLISECOND (1000 * ONE_MICROSECOND)
|
||||||
#define ONE_SECOND (1000 * ONE_MILLISECOND)
|
#define ONE_SECOND (1000 * ONE_MILLISECOND)
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -42,9 +42,9 @@ typedef enum {
|
|||||||
**/
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
FindContextBufferInModuleBuffers (
|
FindContextBufferInModuleBuffers (
|
||||||
IN CONST EFI_GUID *HandlerGuid,
|
IN CONST EFI_GUID *HandlerGuid,
|
||||||
IN CONST PRM_MODULE_CONTEXT_BUFFERS *ModuleContextBuffers,
|
IN CONST PRM_MODULE_CONTEXT_BUFFERS *ModuleContextBuffers,
|
||||||
OUT CONST PRM_CONTEXT_BUFFER **ContextBuffer
|
OUT CONST PRM_CONTEXT_BUFFER **ContextBuffer
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -68,9 +68,9 @@ FindContextBufferInModuleBuffers (
|
|||||||
**/
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
GetModuleContextBuffers (
|
GetModuleContextBuffers (
|
||||||
IN PRM_GUID_SEARCH_TYPE GuidSearchType,
|
IN PRM_GUID_SEARCH_TYPE GuidSearchType,
|
||||||
IN CONST EFI_GUID *Guid,
|
IN CONST EFI_GUID *Guid,
|
||||||
OUT CONST PRM_MODULE_CONTEXT_BUFFERS **PrmModuleContextBuffers
|
OUT CONST PRM_MODULE_CONTEXT_BUFFERS **PrmModuleContextBuffers
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -91,9 +91,9 @@ GetModuleContextBuffers (
|
|||||||
**/
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
GetContextBuffer (
|
GetContextBuffer (
|
||||||
IN CONST EFI_GUID *PrmHandlerGuid,
|
IN CONST EFI_GUID *PrmHandlerGuid,
|
||||||
IN CONST PRM_MODULE_CONTEXT_BUFFERS *PrmModuleContextBuffers OPTIONAL,
|
IN CONST PRM_MODULE_CONTEXT_BUFFERS *PrmModuleContextBuffers OPTIONAL,
|
||||||
OUT CONST PRM_CONTEXT_BUFFER **PrmContextBuffer
|
OUT CONST PRM_CONTEXT_BUFFER **PrmContextBuffer
|
||||||
);
|
);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -28,7 +28,7 @@
|
|||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
GetNextPrmModuleEntry (
|
GetNextPrmModuleEntry (
|
||||||
IN OUT PRM_MODULE_IMAGE_CONTEXT **ModuleImageContext
|
IN OUT PRM_MODULE_IMAGE_CONTEXT **ModuleImageContext
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -53,8 +53,8 @@ GetNextPrmModuleEntry (
|
|||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
DiscoverPrmModules (
|
DiscoverPrmModules (
|
||||||
OUT UINTN *ModuleCount OPTIONAL,
|
OUT UINTN *ModuleCount OPTIONAL,
|
||||||
OUT UINTN *HandlerCount OPTIONAL
|
OUT UINTN *HandlerCount OPTIONAL
|
||||||
);
|
);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -34,9 +34,9 @@
|
|||||||
**/
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
GetPrmModuleExportDescriptorTable (
|
GetPrmModuleExportDescriptorTable (
|
||||||
IN EFI_IMAGE_EXPORT_DIRECTORY *ImageExportDirectory,
|
IN EFI_IMAGE_EXPORT_DIRECTORY *ImageExportDirectory,
|
||||||
IN PE_COFF_LOADER_IMAGE_CONTEXT *PeCoffLoaderImageContext,
|
IN PE_COFF_LOADER_IMAGE_CONTEXT *PeCoffLoaderImageContext,
|
||||||
OUT PRM_MODULE_EXPORT_DESCRIPTOR_STRUCT **ExportDescriptor
|
OUT PRM_MODULE_EXPORT_DESCRIPTOR_STRUCT **ExportDescriptor
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -57,9 +57,9 @@ GetPrmModuleExportDescriptorTable (
|
|||||||
**/
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
GetExportDirectoryInPeCoffImage (
|
GetExportDirectoryInPeCoffImage (
|
||||||
IN VOID *Image,
|
IN VOID *Image,
|
||||||
IN PE_COFF_LOADER_IMAGE_CONTEXT *PeCoffLoaderImageContext,
|
IN PE_COFF_LOADER_IMAGE_CONTEXT *PeCoffLoaderImageContext,
|
||||||
OUT EFI_IMAGE_EXPORT_DIRECTORY **ImageExportDirectory
|
OUT EFI_IMAGE_EXPORT_DIRECTORY **ImageExportDirectory
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -80,10 +80,10 @@ GetExportDirectoryInPeCoffImage (
|
|||||||
**/
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
GetImageVersionInPeCoffImage (
|
GetImageVersionInPeCoffImage (
|
||||||
IN VOID *Image,
|
IN VOID *Image,
|
||||||
IN PE_COFF_LOADER_IMAGE_CONTEXT *PeCoffLoaderImageContext,
|
IN PE_COFF_LOADER_IMAGE_CONTEXT *PeCoffLoaderImageContext,
|
||||||
OUT UINT16 *ImageMajorVersion,
|
OUT UINT16 *ImageMajorVersion,
|
||||||
OUT UINT16 *ImageMinorVersion
|
OUT UINT16 *ImageMinorVersion
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -102,10 +102,10 @@ GetImageVersionInPeCoffImage (
|
|||||||
**/
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
GetExportEntryAddress (
|
GetExportEntryAddress (
|
||||||
IN CONST CHAR8 *ExportName,
|
IN CONST CHAR8 *ExportName,
|
||||||
IN EFI_PHYSICAL_ADDRESS ImageBaseAddress,
|
IN EFI_PHYSICAL_ADDRESS ImageBaseAddress,
|
||||||
IN EFI_IMAGE_EXPORT_DIRECTORY *ImageExportDirectory,
|
IN EFI_IMAGE_EXPORT_DIRECTORY *ImageExportDirectory,
|
||||||
OUT EFI_PHYSICAL_ADDRESS *ExportPhysicalAddress
|
OUT EFI_PHYSICAL_ADDRESS *ExportPhysicalAddress
|
||||||
);
|
);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -13,16 +13,16 @@
|
|||||||
#include <Uefi.h>
|
#include <Uefi.h>
|
||||||
#include <PrmContextBuffer.h>
|
#include <PrmContextBuffer.h>
|
||||||
|
|
||||||
#if defined(_MSC_VER)
|
#if defined (_MSC_VER)
|
||||||
#define PRM_EXPORT_API __declspec(dllexport)
|
#define PRM_EXPORT_API __declspec(dllexport)
|
||||||
#else
|
#else
|
||||||
#define PRM_EXPORT_API
|
#define PRM_EXPORT_API
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define PRM_HANDLER_NAME_MAXIMUM_LENGTH 128
|
#define PRM_HANDLER_NAME_MAXIMUM_LENGTH 128
|
||||||
|
|
||||||
#define PRM_STRING_(x) #x
|
#define PRM_STRING_(x) #x
|
||||||
#define PRM_STRING(x) PRM_STRING_(x)
|
#define PRM_STRING(x) PRM_STRING_(x)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
A Platform Runtime Mechanism (PRM) handler function.
|
A Platform Runtime Mechanism (PRM) handler function.
|
||||||
@ -38,7 +38,7 @@
|
|||||||
**/
|
**/
|
||||||
typedef
|
typedef
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
(EFIAPI PRM_HANDLER) (
|
(EFIAPI PRM_HANDLER)(
|
||||||
IN VOID *ParameterBuffer OPTIONAL,
|
IN VOID *ParameterBuffer OPTIONAL,
|
||||||
IN PRM_CONTEXT_BUFFER *ContextBuffer OPTIONAL
|
IN PRM_CONTEXT_BUFFER *ContextBuffer OPTIONAL
|
||||||
);
|
);
|
||||||
|
@ -27,8 +27,8 @@
|
|||||||
// copy the ACPI parameter buffer address to the PRMT ACPI table.
|
// copy the ACPI parameter buffer address to the PRMT ACPI table.
|
||||||
//
|
//
|
||||||
typedef struct {
|
typedef struct {
|
||||||
EFI_GUID HandlerGuid;
|
EFI_GUID HandlerGuid;
|
||||||
UINT64 AcpiParameterBufferAddress;
|
UINT64 AcpiParameterBufferAddress;
|
||||||
} ACPI_PARAMETER_BUFFER_DESCRIPTOR;
|
} ACPI_PARAMETER_BUFFER_DESCRIPTOR;
|
||||||
|
|
||||||
//
|
//
|
||||||
@ -45,22 +45,22 @@ typedef struct {
|
|||||||
///
|
///
|
||||||
/// Signature of this interface.
|
/// Signature of this interface.
|
||||||
///
|
///
|
||||||
UINT32 Signature;
|
UINT32 Signature;
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Version of this interface.
|
/// Version of this interface.
|
||||||
///
|
///
|
||||||
UINT16 Version;
|
UINT16 Version;
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Reserved field.
|
/// Reserved field.
|
||||||
///
|
///
|
||||||
UINT16 Reserved;
|
UINT16 Reserved;
|
||||||
|
|
||||||
///
|
///
|
||||||
/// The GUID of the PRM handler represented by this context instance.
|
/// The GUID of the PRM handler represented by this context instance.
|
||||||
///
|
///
|
||||||
EFI_GUID HandlerGuid;
|
EFI_GUID HandlerGuid;
|
||||||
|
|
||||||
///
|
///
|
||||||
/// A virtual address pointer to the static data buffer allocated for
|
/// A virtual address pointer to the static data buffer allocated for
|
||||||
@ -71,7 +71,7 @@ typedef struct {
|
|||||||
///
|
///
|
||||||
/// This pointer may be NULL if a static data buffer is not needed.
|
/// This pointer may be NULL if a static data buffer is not needed.
|
||||||
///
|
///
|
||||||
PRM_DATA_BUFFER *StaticDataBuffer;
|
PRM_DATA_BUFFER *StaticDataBuffer;
|
||||||
|
|
||||||
///
|
///
|
||||||
/// A virtual address pointer to an array of PRM_RUNTIME_MMIO_RANGE
|
/// A virtual address pointer to an array of PRM_RUNTIME_MMIO_RANGE
|
||||||
@ -91,30 +91,29 @@ typedef struct {
|
|||||||
///
|
///
|
||||||
/// This pointer may be NULL if runtime memory ranges are not needed.
|
/// This pointer may be NULL if runtime memory ranges are not needed.
|
||||||
///
|
///
|
||||||
PRM_RUNTIME_MMIO_RANGES *RuntimeMmioRanges;
|
PRM_RUNTIME_MMIO_RANGES *RuntimeMmioRanges;
|
||||||
} PRM_CONTEXT_BUFFER;
|
} PRM_CONTEXT_BUFFER;
|
||||||
|
|
||||||
//
|
//
|
||||||
// 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.
|
||||||
///
|
///
|
||||||
EFI_GUID ModuleGuid;
|
EFI_GUID ModuleGuid;
|
||||||
|
|
||||||
///
|
///
|
||||||
/// The number of PRM context buffers in ContextBuffers[].
|
/// The number of PRM context buffers in ContextBuffers[].
|
||||||
/// This count should equal the number of PRM handlers in the module being configured.
|
/// This count should equal the number of PRM handlers in the module being configured.
|
||||||
///
|
///
|
||||||
UINTN BufferCount;
|
UINTN BufferCount;
|
||||||
|
|
||||||
///
|
///
|
||||||
/// A pointer to an array of PRM context buffers
|
/// A pointer to an array of PRM context buffers
|
||||||
///
|
///
|
||||||
PRM_CONTEXT_BUFFER *Buffer;
|
PRM_CONTEXT_BUFFER *Buffer;
|
||||||
|
|
||||||
/// The MMIO ranges are defined in the firmware boot environment.
|
/// The MMIO ranges are defined in the firmware boot environment.
|
||||||
/// The addresses within the PRM_RUNTIME_MMIO_RANGES structure will
|
/// The addresses within the PRM_RUNTIME_MMIO_RANGES structure will
|
||||||
@ -135,13 +134,13 @@ typedef struct
|
|||||||
///
|
///
|
||||||
/// This pointer may be NULL if runtime memory ranges are not needed.
|
/// This pointer may be NULL if runtime memory ranges are not needed.
|
||||||
///
|
///
|
||||||
PRM_RUNTIME_MMIO_RANGES *RuntimeMmioRanges;
|
PRM_RUNTIME_MMIO_RANGES *RuntimeMmioRanges;
|
||||||
|
|
||||||
///
|
///
|
||||||
/// The number of ACPI parameter buffer descriptors in the array
|
/// The number of ACPI parameter buffer descriptors in the array
|
||||||
/// AcpiParameterBufferDescriptors
|
/// AcpiParameterBufferDescriptors
|
||||||
///
|
///
|
||||||
UINTN AcpiParameterBufferDescriptorCount;
|
UINTN AcpiParameterBufferDescriptorCount;
|
||||||
|
|
||||||
///
|
///
|
||||||
/// A pointer to an array of ACPI parameter buffer descriptors. PRM module
|
/// A pointer to an array of ACPI parameter buffer descriptors. PRM module
|
||||||
@ -164,7 +163,7 @@ typedef struct
|
|||||||
/// for each PRM handler that actually uses an ACPI parameter buffer. If
|
/// for each PRM handler that actually uses an ACPI parameter buffer. If
|
||||||
/// no handlers use an ACPI parameter buffer this pointer should be NULL.
|
/// no handlers use an ACPI parameter buffer this pointer should be NULL.
|
||||||
///
|
///
|
||||||
ACPI_PARAMETER_BUFFER_DESCRIPTOR *AcpiParameterBufferDescriptors;
|
ACPI_PARAMETER_BUFFER_DESCRIPTOR *AcpiParameterBufferDescriptors;
|
||||||
} PRM_MODULE_CONTEXT_BUFFERS;
|
} PRM_MODULE_CONTEXT_BUFFERS;
|
||||||
|
|
||||||
#pragma pack(pop)
|
#pragma pack(pop)
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
|
|
||||||
#include <Uefi.h>
|
#include <Uefi.h>
|
||||||
|
|
||||||
#define PRM_DATA_BUFFER_HEADER_SIGNATURE SIGNATURE_32('P','R','M','D')
|
#define PRM_DATA_BUFFER_HEADER_SIGNATURE SIGNATURE_32('P','R','M','D')
|
||||||
|
|
||||||
#pragma pack(push, 1)
|
#pragma pack(push, 1)
|
||||||
|
|
||||||
@ -23,11 +23,11 @@ typedef struct {
|
|||||||
///
|
///
|
||||||
/// PRM Data Buffer signature.
|
/// PRM Data Buffer signature.
|
||||||
///
|
///
|
||||||
UINT32 Signature;
|
UINT32 Signature;
|
||||||
///
|
///
|
||||||
/// Length of the entire data buffer, including the size of the header.
|
/// Length of the entire data buffer, including the size of the header.
|
||||||
///
|
///
|
||||||
UINT32 Length;
|
UINT32 Length;
|
||||||
} PRM_DATA_BUFFER_HEADER;
|
} PRM_DATA_BUFFER_HEADER;
|
||||||
|
|
||||||
///
|
///
|
||||||
@ -37,12 +37,12 @@ typedef struct {
|
|||||||
///
|
///
|
||||||
/// The header is required at the beginning of every PRM data buffer.
|
/// The header is required at the beginning of every PRM data buffer.
|
||||||
///
|
///
|
||||||
PRM_DATA_BUFFER_HEADER Header;
|
PRM_DATA_BUFFER_HEADER Header;
|
||||||
|
|
||||||
///
|
///
|
||||||
/// The beginning of data immediately follows the header.
|
/// The beginning of data immediately follows the header.
|
||||||
///
|
///
|
||||||
UINT8 Data[1];
|
UINT8 Data[1];
|
||||||
} PRM_DATA_BUFFER;
|
} PRM_DATA_BUFFER;
|
||||||
|
|
||||||
#pragma pack(pop)
|
#pragma pack(pop)
|
||||||
|
@ -12,9 +12,9 @@
|
|||||||
|
|
||||||
#include <Prm.h>
|
#include <Prm.h>
|
||||||
|
|
||||||
#define PRM_MODULE_EXPORT_DESCRIPTOR_NAME PrmModuleExportDescriptor
|
#define PRM_MODULE_EXPORT_DESCRIPTOR_NAME PrmModuleExportDescriptor
|
||||||
#define PRM_MODULE_EXPORT_DESCRIPTOR_SIGNATURE SIGNATURE_64 ('P', 'R', 'M', '_', 'M', 'E', 'D', 'T')
|
#define PRM_MODULE_EXPORT_DESCRIPTOR_SIGNATURE SIGNATURE_64 ('P', 'R', 'M', '_', 'M', 'E', 'D', 'T')
|
||||||
#define PRM_MODULE_EXPORT_REVISION 0x0
|
#define PRM_MODULE_EXPORT_REVISION 0x0
|
||||||
|
|
||||||
//
|
//
|
||||||
// Platform Runtime Mechanism (PRM) Export Descriptor Structures
|
// Platform Runtime Mechanism (PRM) Export Descriptor Structures
|
||||||
@ -22,30 +22,30 @@
|
|||||||
#pragma pack(push, 1)
|
#pragma pack(push, 1)
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
GUID PrmHandlerGuid;
|
GUID PrmHandlerGuid;
|
||||||
CHAR8 PrmHandlerName[PRM_HANDLER_NAME_MAXIMUM_LENGTH];
|
CHAR8 PrmHandlerName[PRM_HANDLER_NAME_MAXIMUM_LENGTH];
|
||||||
} PRM_HANDLER_EXPORT_DESCRIPTOR_STRUCT;
|
} PRM_HANDLER_EXPORT_DESCRIPTOR_STRUCT;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
UINT64 Signature;
|
UINT64 Signature;
|
||||||
UINT16 Revision;
|
UINT16 Revision;
|
||||||
UINT16 NumberPrmHandlers;
|
UINT16 NumberPrmHandlers;
|
||||||
GUID PlatformGuid;
|
GUID PlatformGuid;
|
||||||
GUID ModuleGuid;
|
GUID ModuleGuid;
|
||||||
} PRM_MODULE_EXPORT_DESCRIPTOR_STRUCT_HEADER;
|
} PRM_MODULE_EXPORT_DESCRIPTOR_STRUCT_HEADER;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
PRM_MODULE_EXPORT_DESCRIPTOR_STRUCT_HEADER Header;
|
PRM_MODULE_EXPORT_DESCRIPTOR_STRUCT_HEADER Header;
|
||||||
PRM_HANDLER_EXPORT_DESCRIPTOR_STRUCT PrmHandlerExportDescriptors[1];
|
PRM_HANDLER_EXPORT_DESCRIPTOR_STRUCT PrmHandlerExportDescriptors[1];
|
||||||
} PRM_MODULE_EXPORT_DESCRIPTOR_STRUCT;
|
} PRM_MODULE_EXPORT_DESCRIPTOR_STRUCT;
|
||||||
|
|
||||||
#pragma pack(pop)
|
#pragma pack(pop)
|
||||||
|
|
||||||
#if defined(_MSC_VER)
|
#if defined (_MSC_VER)
|
||||||
#define PRM_PACKED_STRUCT(definition) \
|
#define PRM_PACKED_STRUCT(definition) \
|
||||||
__pragma(pack(push, 1)) typedef struct definition __pragma(pack(pop))
|
__pragma(pack(push, 1)) typedef struct definition __pragma(pack(pop))
|
||||||
#elif defined (__GNUC__) || defined (__clang__)
|
#elif defined (__GNUC__) || defined (__clang__)
|
||||||
#define PRM_PACKED_STRUCT(definition) \
|
#define PRM_PACKED_STRUCT(definition) \
|
||||||
typedef struct __attribute__((packed)) definition
|
typedef struct __attribute__((packed)) definition
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -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.
|
||||||
|
|
||||||
|
@ -20,9 +20,9 @@
|
|||||||
/// The memory range with the given base address and length will be marked as EFI_MEMORY_RUNTIME.
|
/// The memory range with the given base address and length will be marked as EFI_MEMORY_RUNTIME.
|
||||||
///
|
///
|
||||||
typedef struct {
|
typedef struct {
|
||||||
EFI_PHYSICAL_ADDRESS PhysicalBaseAddress;
|
EFI_PHYSICAL_ADDRESS PhysicalBaseAddress;
|
||||||
EFI_PHYSICAL_ADDRESS VirtualBaseAddress;
|
EFI_PHYSICAL_ADDRESS VirtualBaseAddress;
|
||||||
UINT32 Length;
|
UINT32 Length;
|
||||||
} PRM_RUNTIME_MMIO_RANGE;
|
} PRM_RUNTIME_MMIO_RANGE;
|
||||||
|
|
||||||
///
|
///
|
||||||
@ -33,11 +33,11 @@ typedef struct {
|
|||||||
///
|
///
|
||||||
/// The number of runtime memory range elements in this buffer.
|
/// The number of runtime memory range elements in this buffer.
|
||||||
///
|
///
|
||||||
UINT64 Count;
|
UINT64 Count;
|
||||||
///
|
///
|
||||||
/// The beginning of the runtime memory range data.
|
/// The beginning of the runtime memory range data.
|
||||||
///
|
///
|
||||||
PRM_RUNTIME_MMIO_RANGE Range[1];
|
PRM_RUNTIME_MMIO_RANGE Range[1];
|
||||||
} PRM_RUNTIME_MMIO_RANGES;
|
} PRM_RUNTIME_MMIO_RANGES;
|
||||||
|
|
||||||
#pragma pack(pop)
|
#pragma pack(pop)
|
||||||
|
@ -26,16 +26,16 @@
|
|||||||
#define PRM_HANDLER_EXPORT(Name) \
|
#define PRM_HANDLER_EXPORT(Name) \
|
||||||
STATIC_ASSERT (sizeof (PRM_STRING_(Name)) <= PRM_HANDLER_NAME_MAXIMUM_LENGTH, "The PRM handler exceeds the maximum allowed size of 128."); \
|
STATIC_ASSERT (sizeof (PRM_STRING_(Name)) <= PRM_HANDLER_NAME_MAXIMUM_LENGTH, "The PRM handler exceeds the maximum allowed size of 128."); \
|
||||||
\
|
\
|
||||||
/** \
|
/** \
|
||||||
A Platform Runtime Mechanism (PRM) handler. \
|
A Platform Runtime Mechanism (PRM) handler. \
|
||||||
\
|
\
|
||||||
@param[in] ParameterBuffer A pointer to the PRM handler parameter buffer \
|
@param[in] ParameterBuffer A pointer to the PRM handler parameter buffer \
|
||||||
@param[in] ContextBUffer A pointer to the PRM handler context buffer \
|
@param[in] ContextBUffer A pointer to the PRM handler context buffer \
|
||||||
\
|
\
|
||||||
@retval EFI_STATUS The PRM handler executed successfully. \
|
@retval EFI_STATUS The PRM handler executed successfully. \
|
||||||
@retval Others An error occurred in the PRM handler. \
|
@retval Others An error occurred in the PRM handler. \
|
||||||
\
|
\
|
||||||
**/ \
|
**/ \
|
||||||
EFI_STATUS \
|
EFI_STATUS \
|
||||||
PRM_EXPORT_API \
|
PRM_EXPORT_API \
|
||||||
EFIAPI \
|
EFIAPI \
|
||||||
|
@ -18,9 +18,9 @@
|
|||||||
#pragma pack(push, 1)
|
#pragma pack(push, 1)
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
PE_COFF_LOADER_IMAGE_CONTEXT PeCoffImageContext;
|
PE_COFF_LOADER_IMAGE_CONTEXT PeCoffImageContext;
|
||||||
EFI_IMAGE_EXPORT_DIRECTORY *ExportDirectory;
|
EFI_IMAGE_EXPORT_DIRECTORY *ExportDirectory;
|
||||||
PRM_MODULE_EXPORT_DESCRIPTOR_STRUCT *ExportDescriptor;
|
PRM_MODULE_EXPORT_DESCRIPTOR_STRUCT *ExportDescriptor;
|
||||||
} PRM_MODULE_IMAGE_CONTEXT;
|
} PRM_MODULE_IMAGE_CONTEXT;
|
||||||
|
|
||||||
#pragma pack(pop)
|
#pragma pack(pop)
|
||||||
|
@ -19,14 +19,13 @@
|
|||||||
|
|
||||||
typedef struct _PRM_CONFIG_PROTOCOL PRM_CONFIG_PROTOCOL;
|
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;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
extern EFI_GUID gPrmConfigProtocolGuid;
|
extern EFI_GUID gPrmConfigProtocolGuid;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
#include <Library/UefiBootServicesTableLib.h>
|
#include <Library/UefiBootServicesTableLib.h>
|
||||||
#include <Protocol/PrmConfig.h>
|
#include <Protocol/PrmConfig.h>
|
||||||
|
|
||||||
#define _DBGMSGID_ "[PRMCONTEXTBUFFERLIB]"
|
#define _DBGMSGID_ "[PRMCONTEXTBUFFERLIB]"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Finds a PRM context buffer for the given PRM handler GUID.
|
Finds a PRM context buffer for the given PRM handler GUID.
|
||||||
@ -33,16 +33,16 @@
|
|||||||
**/
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
FindContextBufferInModuleBuffers (
|
FindContextBufferInModuleBuffers (
|
||||||
IN CONST EFI_GUID *HandlerGuid,
|
IN CONST EFI_GUID *HandlerGuid,
|
||||||
IN CONST PRM_MODULE_CONTEXT_BUFFERS *ModuleContextBuffers,
|
IN CONST PRM_MODULE_CONTEXT_BUFFERS *ModuleContextBuffers,
|
||||||
OUT CONST PRM_CONTEXT_BUFFER **ContextBuffer
|
OUT CONST PRM_CONTEXT_BUFFER **ContextBuffer
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
UINTN Index;
|
UINTN Index;
|
||||||
|
|
||||||
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -77,23 +77,24 @@ FindContextBufferInModuleBuffers (
|
|||||||
**/
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
GetModuleContextBuffers (
|
GetModuleContextBuffers (
|
||||||
IN PRM_GUID_SEARCH_TYPE GuidSearchType,
|
IN PRM_GUID_SEARCH_TYPE GuidSearchType,
|
||||||
IN CONST EFI_GUID *Guid,
|
IN CONST EFI_GUID *Guid,
|
||||||
OUT CONST PRM_MODULE_CONTEXT_BUFFERS **PrmModuleContextBuffers
|
OUT CONST PRM_MODULE_CONTEXT_BUFFERS **PrmModuleContextBuffers
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
UINTN HandleCount;
|
UINTN HandleCount;
|
||||||
UINTN Index;
|
UINTN Index;
|
||||||
EFI_HANDLE *HandleBuffer;
|
EFI_HANDLE *HandleBuffer;
|
||||||
PRM_CONFIG_PROTOCOL *PrmConfigProtocol;
|
PRM_CONFIG_PROTOCOL *PrmConfigProtocol;
|
||||||
CONST PRM_CONTEXT_BUFFER *PrmContextBuffer;
|
CONST PRM_CONTEXT_BUFFER *PrmContextBuffer;
|
||||||
|
|
||||||
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 (
|
||||||
@ -108,10 +109,10 @@ GetModuleContextBuffers (
|
|||||||
Status = gBS->HandleProtocol (
|
Status = gBS->HandleProtocol (
|
||||||
HandleBuffer[Index],
|
HandleBuffer[Index],
|
||||||
&gPrmConfigProtocolGuid,
|
&gPrmConfigProtocolGuid,
|
||||||
(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;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -167,19 +168,20 @@ GetModuleContextBuffers (
|
|||||||
**/
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
GetContextBuffer (
|
GetContextBuffer (
|
||||||
IN CONST EFI_GUID *PrmHandlerGuid,
|
IN CONST EFI_GUID *PrmHandlerGuid,
|
||||||
IN CONST PRM_MODULE_CONTEXT_BUFFERS *PrmModuleContextBuffers OPTIONAL,
|
IN CONST PRM_MODULE_CONTEXT_BUFFERS *PrmModuleContextBuffers OPTIONAL,
|
||||||
OUT CONST PRM_CONTEXT_BUFFER **PrmContextBuffer
|
OUT CONST PRM_CONTEXT_BUFFER **PrmContextBuffer
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
CONST PRM_MODULE_CONTEXT_BUFFERS *ContextBuffers;
|
CONST PRM_MODULE_CONTEXT_BUFFERS *ContextBuffers;
|
||||||
|
|
||||||
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;
|
||||||
|
@ -27,69 +27,69 @@
|
|||||||
#include <Library/UnitTestLib.h>
|
#include <Library/UnitTestLib.h>
|
||||||
#include <Protocol/PrmConfig.h>
|
#include <Protocol/PrmConfig.h>
|
||||||
|
|
||||||
#define UNIT_TEST_NAME "PRM Context Buffer Library Unit Test"
|
#define UNIT_TEST_NAME "PRM Context Buffer Library Unit Test"
|
||||||
#define UNIT_TEST_VERSION "0.1"
|
#define UNIT_TEST_VERSION "0.1"
|
||||||
|
|
||||||
///=== TEST DATA ==================================================================================
|
/// === TEST DATA ==================================================================================
|
||||||
|
|
||||||
EFI_HANDLE mTestProtocolHandle;
|
EFI_HANDLE mTestProtocolHandle;
|
||||||
|
|
||||||
//*----------------------------------------------------------------------------------*
|
// *----------------------------------------------------------------------------------*
|
||||||
//* Context Structures *
|
// * Context Structures *
|
||||||
//*----------------------------------------------------------------------------------*
|
// *----------------------------------------------------------------------------------*
|
||||||
typedef struct {
|
typedef struct {
|
||||||
PRM_MODULE_CONTEXT_BUFFERS *InstallationStructure;
|
PRM_MODULE_CONTEXT_BUFFERS *InstallationStructure;
|
||||||
EFI_HANDLE Handle;
|
EFI_HANDLE Handle;
|
||||||
PRM_GUID_SEARCH_TYPE GuidSearchType;
|
PRM_GUID_SEARCH_TYPE GuidSearchType;
|
||||||
EFI_GUID *Guid;
|
EFI_GUID *Guid;
|
||||||
EFI_GUID *ExpectedModuleGuid;
|
EFI_GUID *ExpectedModuleGuid;
|
||||||
EFI_STATUS ExpectedStatus;
|
EFI_STATUS ExpectedStatus;
|
||||||
} PRM_CONTEXT_BUFFERS_TEST_CONTEXT;
|
} PRM_CONTEXT_BUFFERS_TEST_CONTEXT;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
EFI_GUID *HandlerGuid;
|
EFI_GUID *HandlerGuid;
|
||||||
PRM_MODULE_CONTEXT_BUFFERS *ContextBuffers;
|
PRM_MODULE_CONTEXT_BUFFERS *ContextBuffers;
|
||||||
PRM_CONTEXT_BUFFER *ExpectedContextBuffer;
|
PRM_CONTEXT_BUFFER *ExpectedContextBuffer;
|
||||||
EFI_STATUS ExpectedStatus;
|
EFI_STATUS ExpectedStatus;
|
||||||
} PRM_CONTEXT_BUFFER_TEST_CONTEXT;
|
} PRM_CONTEXT_BUFFER_TEST_CONTEXT;
|
||||||
|
|
||||||
//*----------------------------------------------------------------------------------*
|
// *----------------------------------------------------------------------------------*
|
||||||
//* Test GUIDs *
|
// * Test GUIDs *
|
||||||
//*----------------------------------------------------------------------------------*
|
// *----------------------------------------------------------------------------------*
|
||||||
|
|
||||||
// {52960b90-2f3a-4917-b91a-ed5f599a8809}
|
// {52960b90-2f3a-4917-b91a-ed5f599a8809}
|
||||||
#define HANDLER_TEST_GUID_1 {0x52960b90, 0x2f3a, 0x4917, { 0xb9, 0x1a, 0xed, 0x5f, 0x59, 0x9a, 0x88, 0x09 }}
|
#define HANDLER_TEST_GUID_1 {0x52960b90, 0x2f3a, 0x4917, { 0xb9, 0x1a, 0xed, 0x5f, 0x59, 0x9a, 0x88, 0x09 }}
|
||||||
EFI_GUID mHandlerTestGuid1 = HANDLER_TEST_GUID_1;
|
EFI_GUID mHandlerTestGuid1 = HANDLER_TEST_GUID_1;
|
||||||
|
|
||||||
// {9316a80d-06dc-417b-b21d-6b3c2ae4ed6f}
|
// {9316a80d-06dc-417b-b21d-6b3c2ae4ed6f}
|
||||||
#define HANDLER_TEST_GUID_2 {0x9316a80d, 0x06dc, 0x417b, { 0xb2, 0x1d, 0x6b, 0x3c, 0x2a, 0xe4, 0xed, 0x6f }}
|
#define HANDLER_TEST_GUID_2 {0x9316a80d, 0x06dc, 0x417b, { 0xb2, 0x1d, 0x6b, 0x3c, 0x2a, 0xe4, 0xed, 0x6f }}
|
||||||
EFI_GUID mHandlerTestGuid2 = HANDLER_TEST_GUID_2;
|
EFI_GUID mHandlerTestGuid2 = HANDLER_TEST_GUID_2;
|
||||||
|
|
||||||
// {d32ac8ba-6cc6-456f-9ed9-9233fa310434}
|
// {d32ac8ba-6cc6-456f-9ed9-9233fa310434}
|
||||||
#define HANDLER_TEST_GUID_3 {0xd32ac8ba, 0x6cc6, 0x456f, { 0x9e, 0xd9, 0x92, 0x33, 0xfa, 0x31, 0x04, 0x34 }}
|
#define HANDLER_TEST_GUID_3 {0xd32ac8ba, 0x6cc6, 0x456f, { 0x9e, 0xd9, 0x92, 0x33, 0xfa, 0x31, 0x04, 0x34 }}
|
||||||
EFI_GUID mHandlerTestGuid3 = HANDLER_TEST_GUID_3;
|
EFI_GUID mHandlerTestGuid3 = HANDLER_TEST_GUID_3;
|
||||||
|
|
||||||
// {faadaa95-070b-4a34-a919-18305dc07370}
|
// {faadaa95-070b-4a34-a919-18305dc07370}
|
||||||
#define MODULE_TEST_GUID_1 {0xfaadaa95, 0x070b, 0x4a34, { 0xa9, 0x19, 0x18, 0x30, 0x5d, 0xc0, 0x73, 0x70 }}
|
#define MODULE_TEST_GUID_1 {0xfaadaa95, 0x070b, 0x4a34, { 0xa9, 0x19, 0x18, 0x30, 0x5d, 0xc0, 0x73, 0x70 }}
|
||||||
EFI_GUID mModuleTestGuid1 = MODULE_TEST_GUID_1;
|
EFI_GUID mModuleTestGuid1 = MODULE_TEST_GUID_1;
|
||||||
|
|
||||||
// {0ea24584-731c-4863-9100-75780af509a7}
|
// {0ea24584-731c-4863-9100-75780af509a7}
|
||||||
#define MODULE_TEST_GUID_2 {0x0ea24584, 0x731c, 0x4863, { 0x91, 0x00, 0x75, 0x78, 0x0a, 0xf5, 0x09, 0xa7 }}
|
#define MODULE_TEST_GUID_2 {0x0ea24584, 0x731c, 0x4863, { 0x91, 0x00, 0x75, 0x78, 0x0a, 0xf5, 0x09, 0xa7 }}
|
||||||
EFI_GUID mModuleTestGuid2 = MODULE_TEST_GUID_2;
|
EFI_GUID mModuleTestGuid2 = MODULE_TEST_GUID_2;
|
||||||
|
|
||||||
// {f456b7a1-82a6-4427-8486-87e3a602df43}
|
// {f456b7a1-82a6-4427-8486-87e3a602df43}
|
||||||
#define MODULE_TEST_GUID_3 {0xf456b7a1, 0x82a6, 0x4427, { 0x84, 0x86, 0x87, 0xe3, 0xa6, 0x02, 0xdf, 0x43 }}
|
#define MODULE_TEST_GUID_3 {0xf456b7a1, 0x82a6, 0x4427, { 0x84, 0x86, 0x87, 0xe3, 0xa6, 0x02, 0xdf, 0x43 }}
|
||||||
EFI_GUID mModuleTestGuid3 = MODULE_TEST_GUID_3;
|
EFI_GUID mModuleTestGuid3 = MODULE_TEST_GUID_3;
|
||||||
|
|
||||||
// {4a941a9c-9dcf-471b-94b5-d9e2d8c64a1b}
|
// {4a941a9c-9dcf-471b-94b5-d9e2d8c64a1b}
|
||||||
#define NEGATIVE_TEST_GUID {0x4a941a9c, 0x9dcf, 0x471b, {0x94, 0xb5, 0xd9, 0xe2, 0xd8, 0xc6, 0x4a, 0x1b }}
|
#define NEGATIVE_TEST_GUID {0x4a941a9c, 0x9dcf, 0x471b, {0x94, 0xb5, 0xd9, 0xe2, 0xd8, 0xc6, 0x4a, 0x1b }}
|
||||||
EFI_GUID mNegativeTestGuid = NEGATIVE_TEST_GUID;
|
EFI_GUID mNegativeTestGuid = NEGATIVE_TEST_GUID;
|
||||||
|
|
||||||
//*----------------------------------------------------------------------------------*
|
// *----------------------------------------------------------------------------------*
|
||||||
//* PRM Static Test Structures *
|
// * PRM Static Test Structures *
|
||||||
//*----------------------------------------------------------------------------------*
|
// *----------------------------------------------------------------------------------*
|
||||||
|
|
||||||
PRM_DATA_BUFFER mTestStaticDataBuffer1 = {
|
PRM_DATA_BUFFER mTestStaticDataBuffer1 = {
|
||||||
{
|
{
|
||||||
PRM_DATA_BUFFER_HEADER_SIGNATURE,
|
PRM_DATA_BUFFER_HEADER_SIGNATURE,
|
||||||
sizeof (PRM_DATA_BUFFER)
|
sizeof (PRM_DATA_BUFFER)
|
||||||
@ -97,7 +97,7 @@ PRM_DATA_BUFFER mTestStaticDataBuffer1 = {
|
|||||||
// No data in the buffer (only a header)
|
// No data in the buffer (only a header)
|
||||||
};
|
};
|
||||||
|
|
||||||
PRM_CONTEXT_BUFFER mTestPrmContextBuffer1 = {
|
PRM_CONTEXT_BUFFER mTestPrmContextBuffer1 = {
|
||||||
PRM_CONTEXT_BUFFER_SIGNATURE, // Signature
|
PRM_CONTEXT_BUFFER_SIGNATURE, // Signature
|
||||||
PRM_CONTEXT_BUFFER_INTERFACE_VERSION, // Version
|
PRM_CONTEXT_BUFFER_INTERFACE_VERSION, // Version
|
||||||
0, // Reserved
|
0, // Reserved
|
||||||
@ -105,7 +105,7 @@ PRM_CONTEXT_BUFFER mTestPrmContextBuffer1 = {
|
|||||||
&mTestStaticDataBuffer1 // StaticDataBuffer
|
&mTestStaticDataBuffer1 // StaticDataBuffer
|
||||||
};
|
};
|
||||||
|
|
||||||
PRM_CONTEXT_BUFFER mTestPrmContextBuffer2[2] = {
|
PRM_CONTEXT_BUFFER mTestPrmContextBuffer2[2] = {
|
||||||
// Context buffer #1
|
// Context buffer #1
|
||||||
{
|
{
|
||||||
PRM_CONTEXT_BUFFER_SIGNATURE, // Signature
|
PRM_CONTEXT_BUFFER_SIGNATURE, // Signature
|
||||||
@ -124,56 +124,55 @@ PRM_CONTEXT_BUFFER mTestPrmContextBuffer2[2] = {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
PRM_MODULE_CONTEXT_BUFFERS mTestPrmModuleContextBuffers1 = {
|
PRM_MODULE_CONTEXT_BUFFERS mTestPrmModuleContextBuffers1 = {
|
||||||
MODULE_TEST_GUID_1,
|
MODULE_TEST_GUID_1,
|
||||||
1,
|
1,
|
||||||
&mTestPrmContextBuffer1,
|
&mTestPrmContextBuffer1,
|
||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
PRM_MODULE_CONTEXT_BUFFERS mTestPrmModuleContextBuffers2 = {
|
PRM_MODULE_CONTEXT_BUFFERS mTestPrmModuleContextBuffers2 = {
|
||||||
MODULE_TEST_GUID_2,
|
MODULE_TEST_GUID_2,
|
||||||
1,
|
1,
|
||||||
&mTestPrmContextBuffer1,
|
&mTestPrmContextBuffer1,
|
||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
PRM_MODULE_CONTEXT_BUFFERS mTestPrmModuleContextBuffers3 = {
|
PRM_MODULE_CONTEXT_BUFFERS mTestPrmModuleContextBuffers3 = {
|
||||||
MODULE_TEST_GUID_3,
|
MODULE_TEST_GUID_3,
|
||||||
2,
|
2,
|
||||||
&mTestPrmContextBuffer2[0],
|
&mTestPrmContextBuffer2[0],
|
||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// *----------------------------------------------------------------------------------*
|
||||||
|
// * Test Contexts *
|
||||||
|
// *----------------------------------------------------------------------------------*
|
||||||
|
|
||||||
//*----------------------------------------------------------------------------------*
|
// * Searches by module GUID *
|
||||||
//* Test Contexts *
|
|
||||||
//*----------------------------------------------------------------------------------*
|
|
||||||
|
|
||||||
//* Searches by module GUID *
|
|
||||||
// +--------------------------------+--------+----------------+--------------------+--------------------+--------------------+
|
// +--------------------------------+--------+----------------+--------------------+--------------------+--------------------+
|
||||||
// + InstallationStructure | Handle | GuidSearchType | Guid | ExpectedModuleGuid | ExpectedStatus |
|
// + InstallationStructure | Handle | GuidSearchType | Guid | ExpectedModuleGuid | ExpectedStatus |
|
||||||
// +--------------------------------+--------+----------------+--------------------+--------------------+--------------------+
|
// +--------------------------------+--------+----------------+--------------------+--------------------+--------------------+
|
||||||
PRM_CONTEXT_BUFFERS_TEST_CONTEXT mContextBuffers00 = { &mTestPrmModuleContextBuffers1, NULL, ByModuleGuid, &mModuleTestGuid1, &mModuleTestGuid1, EFI_SUCCESS };
|
PRM_CONTEXT_BUFFERS_TEST_CONTEXT mContextBuffers00 = { &mTestPrmModuleContextBuffers1, NULL, ByModuleGuid, &mModuleTestGuid1, &mModuleTestGuid1, EFI_SUCCESS };
|
||||||
PRM_CONTEXT_BUFFERS_TEST_CONTEXT mContextBuffers01 = { &mTestPrmModuleContextBuffers2, NULL, ByModuleGuid, &mModuleTestGuid2, &mModuleTestGuid2, EFI_SUCCESS };
|
PRM_CONTEXT_BUFFERS_TEST_CONTEXT mContextBuffers01 = { &mTestPrmModuleContextBuffers2, NULL, ByModuleGuid, &mModuleTestGuid2, &mModuleTestGuid2, EFI_SUCCESS };
|
||||||
PRM_CONTEXT_BUFFERS_TEST_CONTEXT mContextBuffers02 = { &mTestPrmModuleContextBuffers3, NULL, ByModuleGuid, &mModuleTestGuid3, &mModuleTestGuid3, EFI_SUCCESS };
|
PRM_CONTEXT_BUFFERS_TEST_CONTEXT mContextBuffers02 = { &mTestPrmModuleContextBuffers3, NULL, ByModuleGuid, &mModuleTestGuid3, &mModuleTestGuid3, EFI_SUCCESS };
|
||||||
PRM_CONTEXT_BUFFERS_TEST_CONTEXT mContextBuffers03 = { &mTestPrmModuleContextBuffers3, NULL, ByModuleGuid, &mNegativeTestGuid, &gZeroGuid, EFI_NOT_FOUND };
|
PRM_CONTEXT_BUFFERS_TEST_CONTEXT mContextBuffers03 = { &mTestPrmModuleContextBuffers3, NULL, ByModuleGuid, &mNegativeTestGuid, &gZeroGuid, EFI_NOT_FOUND };
|
||||||
PRM_CONTEXT_BUFFERS_TEST_CONTEXT mContextBuffers04 = { &mTestPrmModuleContextBuffers1, NULL, ByModuleGuid, &gZeroGuid, &gZeroGuid, EFI_NOT_FOUND };
|
PRM_CONTEXT_BUFFERS_TEST_CONTEXT mContextBuffers04 = { &mTestPrmModuleContextBuffers1, NULL, ByModuleGuid, &gZeroGuid, &gZeroGuid, EFI_NOT_FOUND };
|
||||||
|
|
||||||
//* Searches by handler GUID *
|
// * Searches by handler GUID *
|
||||||
// +--------------------------------+--------+----------------+--------------------+--------------------+--------------------+
|
// +--------------------------------+--------+----------------+--------------------+--------------------+--------------------+
|
||||||
// + InstallationStructure | Handle | GuidSearchType | Guid | ExpectedModuleGuid | ExpectedStatus |
|
// + InstallationStructure | Handle | GuidSearchType | Guid | ExpectedModuleGuid | ExpectedStatus |
|
||||||
// +--------------------------------+--------+----------------+--------------------+--------------------+--------------------+
|
// +--------------------------------+--------+----------------+--------------------+--------------------+--------------------+
|
||||||
PRM_CONTEXT_BUFFERS_TEST_CONTEXT mContextBuffers05 = { &mTestPrmModuleContextBuffers1, NULL, ByHandlerGuid, &mHandlerTestGuid1, &mModuleTestGuid1, EFI_SUCCESS };
|
PRM_CONTEXT_BUFFERS_TEST_CONTEXT mContextBuffers05 = { &mTestPrmModuleContextBuffers1, NULL, ByHandlerGuid, &mHandlerTestGuid1, &mModuleTestGuid1, EFI_SUCCESS };
|
||||||
PRM_CONTEXT_BUFFERS_TEST_CONTEXT mContextBuffers06 = { &mTestPrmModuleContextBuffers1, NULL, ByHandlerGuid, &gZeroGuid, &gZeroGuid, EFI_NOT_FOUND };
|
PRM_CONTEXT_BUFFERS_TEST_CONTEXT mContextBuffers06 = { &mTestPrmModuleContextBuffers1, NULL, ByHandlerGuid, &gZeroGuid, &gZeroGuid, EFI_NOT_FOUND };
|
||||||
PRM_CONTEXT_BUFFERS_TEST_CONTEXT mContextBuffers07 = { &mTestPrmModuleContextBuffers2, NULL, ByHandlerGuid, &mHandlerTestGuid1, &mModuleTestGuid2, EFI_SUCCESS };
|
PRM_CONTEXT_BUFFERS_TEST_CONTEXT mContextBuffers07 = { &mTestPrmModuleContextBuffers2, NULL, ByHandlerGuid, &mHandlerTestGuid1, &mModuleTestGuid2, EFI_SUCCESS };
|
||||||
PRM_CONTEXT_BUFFERS_TEST_CONTEXT mContextBuffers08 = { &mTestPrmModuleContextBuffers2, NULL, ByHandlerGuid, &mNegativeTestGuid, &gZeroGuid, EFI_NOT_FOUND };
|
PRM_CONTEXT_BUFFERS_TEST_CONTEXT mContextBuffers08 = { &mTestPrmModuleContextBuffers2, NULL, ByHandlerGuid, &mNegativeTestGuid, &gZeroGuid, EFI_NOT_FOUND };
|
||||||
PRM_CONTEXT_BUFFERS_TEST_CONTEXT mContextBuffers09 = { &mTestPrmModuleContextBuffers3, NULL, ByHandlerGuid, &mHandlerTestGuid1, &gZeroGuid, EFI_NOT_FOUND };
|
PRM_CONTEXT_BUFFERS_TEST_CONTEXT mContextBuffers09 = { &mTestPrmModuleContextBuffers3, NULL, ByHandlerGuid, &mHandlerTestGuid1, &gZeroGuid, EFI_NOT_FOUND };
|
||||||
PRM_CONTEXT_BUFFERS_TEST_CONTEXT mContextBuffers10 = { &mTestPrmModuleContextBuffers3, NULL, ByHandlerGuid, &mHandlerTestGuid2, &mModuleTestGuid3, EFI_SUCCESS };
|
PRM_CONTEXT_BUFFERS_TEST_CONTEXT mContextBuffers10 = { &mTestPrmModuleContextBuffers3, NULL, ByHandlerGuid, &mHandlerTestGuid2, &mModuleTestGuid3, EFI_SUCCESS };
|
||||||
PRM_CONTEXT_BUFFERS_TEST_CONTEXT mContextBuffers11 = { &mTestPrmModuleContextBuffers3, NULL, ByHandlerGuid, &mHandlerTestGuid3, &mModuleTestGuid3, EFI_SUCCESS };
|
PRM_CONTEXT_BUFFERS_TEST_CONTEXT mContextBuffers11 = { &mTestPrmModuleContextBuffers3, NULL, ByHandlerGuid, &mHandlerTestGuid3, &mModuleTestGuid3, EFI_SUCCESS };
|
||||||
PRM_CONTEXT_BUFFERS_TEST_CONTEXT mContextBuffers12 = { &mTestPrmModuleContextBuffers3, NULL, ByHandlerGuid, &gZeroGuid, &gZeroGuid, EFI_NOT_FOUND };
|
PRM_CONTEXT_BUFFERS_TEST_CONTEXT mContextBuffers12 = { &mTestPrmModuleContextBuffers3, NULL, ByHandlerGuid, &gZeroGuid, &gZeroGuid, EFI_NOT_FOUND };
|
||||||
|
|
||||||
PRM_CONTEXT_BUFFERS_TEST_CONTEXT *mContextBuffersArray[] = {
|
PRM_CONTEXT_BUFFERS_TEST_CONTEXT *mContextBuffersArray[] = {
|
||||||
&mContextBuffers00,
|
&mContextBuffers00,
|
||||||
&mContextBuffers01,
|
&mContextBuffers01,
|
||||||
&mContextBuffers02,
|
&mContextBuffers02,
|
||||||
@ -192,14 +191,14 @@ PRM_CONTEXT_BUFFERS_TEST_CONTEXT *mContextBuffersArray[] = {
|
|||||||
// +----------------------+----------------------------------+------------------------------------------+--------------------+
|
// +----------------------+----------------------------------+------------------------------------------+--------------------+
|
||||||
// + HandlerGuid | ContextBuffers | ExpectedContextBuffer | ExpectedStatus |
|
// + HandlerGuid | ContextBuffers | ExpectedContextBuffer | ExpectedStatus |
|
||||||
// +----------------------+----------------------------------+------------------------------------------+--------------------+
|
// +----------------------+----------------------------------+------------------------------------------+--------------------+
|
||||||
PRM_CONTEXT_BUFFER_TEST_CONTEXT mContextBuffer00 = { &mHandlerTestGuid1, &mTestPrmModuleContextBuffers1, &mTestPrmContextBuffer1, EFI_SUCCESS };
|
PRM_CONTEXT_BUFFER_TEST_CONTEXT mContextBuffer00 = { &mHandlerTestGuid1, &mTestPrmModuleContextBuffers1, &mTestPrmContextBuffer1, EFI_SUCCESS };
|
||||||
PRM_CONTEXT_BUFFER_TEST_CONTEXT mContextBuffer01 = { &mHandlerTestGuid1, &mTestPrmModuleContextBuffers2, &mTestPrmContextBuffer1, EFI_SUCCESS };
|
PRM_CONTEXT_BUFFER_TEST_CONTEXT mContextBuffer01 = { &mHandlerTestGuid1, &mTestPrmModuleContextBuffers2, &mTestPrmContextBuffer1, EFI_SUCCESS };
|
||||||
PRM_CONTEXT_BUFFER_TEST_CONTEXT mContextBuffer02 = { &mHandlerTestGuid2, &mTestPrmModuleContextBuffers3, &mTestPrmContextBuffer2[0], EFI_SUCCESS };
|
PRM_CONTEXT_BUFFER_TEST_CONTEXT mContextBuffer02 = { &mHandlerTestGuid2, &mTestPrmModuleContextBuffers3, &mTestPrmContextBuffer2[0], EFI_SUCCESS };
|
||||||
PRM_CONTEXT_BUFFER_TEST_CONTEXT mContextBuffer03 = { &mHandlerTestGuid3, &mTestPrmModuleContextBuffers3, &mTestPrmContextBuffer2[1], EFI_SUCCESS };
|
PRM_CONTEXT_BUFFER_TEST_CONTEXT mContextBuffer03 = { &mHandlerTestGuid3, &mTestPrmModuleContextBuffers3, &mTestPrmContextBuffer2[1], EFI_SUCCESS };
|
||||||
PRM_CONTEXT_BUFFER_TEST_CONTEXT mContextBuffer04 = { &mNegativeTestGuid, &mTestPrmModuleContextBuffers1, NULL, EFI_NOT_FOUND };
|
PRM_CONTEXT_BUFFER_TEST_CONTEXT mContextBuffer04 = { &mNegativeTestGuid, &mTestPrmModuleContextBuffers1, NULL, EFI_NOT_FOUND };
|
||||||
PRM_CONTEXT_BUFFER_TEST_CONTEXT mContextBuffer05 = { &gZeroGuid, &mTestPrmModuleContextBuffers3, NULL, EFI_NOT_FOUND };
|
PRM_CONTEXT_BUFFER_TEST_CONTEXT mContextBuffer05 = { &gZeroGuid, &mTestPrmModuleContextBuffers3, NULL, EFI_NOT_FOUND };
|
||||||
|
|
||||||
PRM_CONTEXT_BUFFER_TEST_CONTEXT *mContextBufferArray[] = {
|
PRM_CONTEXT_BUFFER_TEST_CONTEXT *mContextBufferArray[] = {
|
||||||
&mContextBuffer00,
|
&mContextBuffer00,
|
||||||
&mContextBuffer01,
|
&mContextBuffer01,
|
||||||
&mContextBuffer02,
|
&mContextBuffer02,
|
||||||
@ -208,13 +207,13 @@ PRM_CONTEXT_BUFFER_TEST_CONTEXT *mContextBufferArray[] = {
|
|||||||
&mContextBuffer05
|
&mContextBuffer05
|
||||||
};
|
};
|
||||||
|
|
||||||
///=== HELPER FUNCTIONS ===========================================================================
|
/// === HELPER FUNCTIONS ===========================================================================
|
||||||
|
|
||||||
// None
|
// None
|
||||||
|
|
||||||
///=== TEST CASES =================================================================================
|
/// === TEST CASES =================================================================================
|
||||||
|
|
||||||
///===== BASIC SUITE ==================================================
|
/// ===== BASIC SUITE ==================================================
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Verifies that passing NULL arguments to all library functions fails with EFI_INVALID_PARAMETER.
|
Verifies that passing NULL arguments to all library functions fails with EFI_INVALID_PARAMETER.
|
||||||
@ -229,13 +228,13 @@ PRM_CONTEXT_BUFFER_TEST_CONTEXT *mContextBufferArray[] = {
|
|||||||
UNIT_TEST_STATUS
|
UNIT_TEST_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
NullPointerArgumentsShouldFailGracefully (
|
NullPointerArgumentsShouldFailGracefully (
|
||||||
IN UNIT_TEST_CONTEXT Context
|
IN UNIT_TEST_CONTEXT Context
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
EFI_GUID Guid;
|
EFI_GUID Guid;
|
||||||
PRM_CONTEXT_BUFFER *ContextBufferPtr;
|
PRM_CONTEXT_BUFFER *ContextBufferPtr;
|
||||||
PRM_MODULE_CONTEXT_BUFFERS ModuleContextBuffers;
|
PRM_MODULE_CONTEXT_BUFFERS ModuleContextBuffers;
|
||||||
PRM_MODULE_CONTEXT_BUFFERS *ModuleContextBuffersPtr;
|
PRM_MODULE_CONTEXT_BUFFERS *ModuleContextBuffersPtr;
|
||||||
|
|
||||||
UT_ASSERT_EQUAL (FindContextBufferInModuleBuffers (NULL, NULL, NULL), EFI_INVALID_PARAMETER);
|
UT_ASSERT_EQUAL (FindContextBufferInModuleBuffers (NULL, NULL, NULL), EFI_INVALID_PARAMETER);
|
||||||
UT_ASSERT_EQUAL (FindContextBufferInModuleBuffers (NULL, &ModuleContextBuffers, &ContextBufferPtr), EFI_INVALID_PARAMETER);
|
UT_ASSERT_EQUAL (FindContextBufferInModuleBuffers (NULL, &ModuleContextBuffers, &ContextBufferPtr), EFI_INVALID_PARAMETER);
|
||||||
@ -254,7 +253,7 @@ NullPointerArgumentsShouldFailGracefully (
|
|||||||
return UNIT_TEST_PASSED;
|
return UNIT_TEST_PASSED;
|
||||||
}
|
}
|
||||||
|
|
||||||
///===== FUNCTIONAL CORRECTNESS SUITE ==================================================
|
/// ===== FUNCTIONAL CORRECTNESS SUITE ==================================================
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Functional Correctness pre-requisite function.
|
Functional Correctness pre-requisite function.
|
||||||
@ -275,16 +274,16 @@ STATIC
|
|||||||
UNIT_TEST_STATUS
|
UNIT_TEST_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
InitializeFunctionalCorrectness (
|
InitializeFunctionalCorrectness (
|
||||||
IN UNIT_TEST_CONTEXT Context
|
IN UNIT_TEST_CONTEXT Context
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
PRM_CONFIG_PROTOCOL *PrmConfigProtocol;
|
PRM_CONFIG_PROTOCOL *PrmConfigProtocol;
|
||||||
PRM_MODULE_CONTEXT_BUFFERS *ModuleContextBuffers;
|
PRM_MODULE_CONTEXT_BUFFERS *ModuleContextBuffers;
|
||||||
PRM_CONTEXT_BUFFERS_TEST_CONTEXT *TestContext;
|
PRM_CONTEXT_BUFFERS_TEST_CONTEXT *TestContext;
|
||||||
|
|
||||||
UT_ASSERT_NOT_NULL (Context);
|
UT_ASSERT_NOT_NULL (Context);
|
||||||
TestContext = (PRM_CONTEXT_BUFFERS_TEST_CONTEXT *) Context;
|
TestContext = (PRM_CONTEXT_BUFFERS_TEST_CONTEXT *)Context;
|
||||||
ModuleContextBuffers = TestContext->InstallationStructure;
|
ModuleContextBuffers = TestContext->InstallationStructure;
|
||||||
|
|
||||||
PrmConfigProtocol = AllocateZeroPool (sizeof (*PrmConfigProtocol));
|
PrmConfigProtocol = AllocateZeroPool (sizeof (*PrmConfigProtocol));
|
||||||
@ -294,14 +293,14 @@ InitializeFunctionalCorrectness (
|
|||||||
|
|
||||||
CopyGuid (&PrmConfigProtocol->ModuleContextBuffers.ModuleGuid, &ModuleContextBuffers->ModuleGuid);
|
CopyGuid (&PrmConfigProtocol->ModuleContextBuffers.ModuleGuid, &ModuleContextBuffers->ModuleGuid);
|
||||||
PrmConfigProtocol->ModuleContextBuffers.BufferCount = ModuleContextBuffers->BufferCount;
|
PrmConfigProtocol->ModuleContextBuffers.BufferCount = ModuleContextBuffers->BufferCount;
|
||||||
PrmConfigProtocol->ModuleContextBuffers.Buffer = ModuleContextBuffers->Buffer;
|
PrmConfigProtocol->ModuleContextBuffers.Buffer = ModuleContextBuffers->Buffer;
|
||||||
|
|
||||||
Status = gBS->InstallProtocolInterface (
|
Status = gBS->InstallProtocolInterface (
|
||||||
&TestContext->Handle,
|
&TestContext->Handle,
|
||||||
&gPrmConfigProtocolGuid,
|
&gPrmConfigProtocolGuid,
|
||||||
EFI_NATIVE_INTERFACE,
|
EFI_NATIVE_INTERFACE,
|
||||||
(VOID *) PrmConfigProtocol
|
(VOID *)PrmConfigProtocol
|
||||||
);
|
);
|
||||||
UT_ASSERT_NOT_EFI_ERROR (Status);
|
UT_ASSERT_NOT_EFI_ERROR (Status);
|
||||||
|
|
||||||
return UNIT_TEST_PASSED;
|
return UNIT_TEST_PASSED;
|
||||||
@ -326,20 +325,20 @@ STATIC
|
|||||||
UNIT_TEST_STATUS
|
UNIT_TEST_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
DeInitializeFunctionalCorrectness (
|
DeInitializeFunctionalCorrectness (
|
||||||
IN UNIT_TEST_CONTEXT Context
|
IN UNIT_TEST_CONTEXT Context
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
PRM_CONFIG_PROTOCOL *PrmConfigProtocol;
|
PRM_CONFIG_PROTOCOL *PrmConfigProtocol;
|
||||||
PRM_CONTEXT_BUFFERS_TEST_CONTEXT *TestContext;
|
PRM_CONTEXT_BUFFERS_TEST_CONTEXT *TestContext;
|
||||||
|
|
||||||
UT_ASSERT_NOT_NULL (Context);
|
UT_ASSERT_NOT_NULL (Context);
|
||||||
TestContext = (PRM_CONTEXT_BUFFERS_TEST_CONTEXT *) Context;
|
TestContext = (PRM_CONTEXT_BUFFERS_TEST_CONTEXT *)Context;
|
||||||
|
|
||||||
Status = gBS->HandleProtocol (
|
Status = gBS->HandleProtocol (
|
||||||
TestContext->Handle,
|
TestContext->Handle,
|
||||||
&gPrmConfigProtocolGuid,
|
&gPrmConfigProtocolGuid,
|
||||||
(VOID **) &PrmConfigProtocol
|
(VOID **)&PrmConfigProtocol
|
||||||
);
|
);
|
||||||
UT_ASSERT_NOT_EFI_ERROR (Status);
|
UT_ASSERT_NOT_EFI_ERROR (Status);
|
||||||
|
|
||||||
@ -348,7 +347,7 @@ DeInitializeFunctionalCorrectness (
|
|||||||
TestContext->Handle,
|
TestContext->Handle,
|
||||||
&gPrmConfigProtocolGuid,
|
&gPrmConfigProtocolGuid,
|
||||||
PrmConfigProtocol
|
PrmConfigProtocol
|
||||||
);
|
);
|
||||||
UT_ASSERT_NOT_EFI_ERROR (Status);
|
UT_ASSERT_NOT_EFI_ERROR (Status);
|
||||||
if (!EFI_ERROR (Status)) {
|
if (!EFI_ERROR (Status)) {
|
||||||
FreePool (PrmConfigProtocol);
|
FreePool (PrmConfigProtocol);
|
||||||
@ -373,15 +372,15 @@ DeInitializeFunctionalCorrectness (
|
|||||||
UNIT_TEST_STATUS
|
UNIT_TEST_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
VerifyGetModuleContextBuffers (
|
VerifyGetModuleContextBuffers (
|
||||||
IN UNIT_TEST_CONTEXT Context
|
IN UNIT_TEST_CONTEXT Context
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
PRM_MODULE_CONTEXT_BUFFERS *ContextBuffers;
|
PRM_MODULE_CONTEXT_BUFFERS *ContextBuffers;
|
||||||
PRM_CONTEXT_BUFFERS_TEST_CONTEXT *TestContext;
|
PRM_CONTEXT_BUFFERS_TEST_CONTEXT *TestContext;
|
||||||
|
|
||||||
ContextBuffers = NULL;
|
ContextBuffers = NULL;
|
||||||
TestContext = (PRM_CONTEXT_BUFFERS_TEST_CONTEXT *) Context;
|
TestContext = (PRM_CONTEXT_BUFFERS_TEST_CONTEXT *)Context;
|
||||||
|
|
||||||
Status = GetModuleContextBuffers (TestContext->GuidSearchType, TestContext->Guid, &ContextBuffers);
|
Status = GetModuleContextBuffers (TestContext->GuidSearchType, TestContext->Guid, &ContextBuffers);
|
||||||
UT_ASSERT_STATUS_EQUAL (Status, TestContext->ExpectedStatus);
|
UT_ASSERT_STATUS_EQUAL (Status, TestContext->ExpectedStatus);
|
||||||
@ -393,7 +392,7 @@ VerifyGetModuleContextBuffers (
|
|||||||
__FUNCTION__,
|
__FUNCTION__,
|
||||||
((TestContext->GuidSearchType == ByModuleGuid) ? "module" : "handler"),
|
((TestContext->GuidSearchType == ByModuleGuid) ? "module" : "handler"),
|
||||||
TestContext->Guid,
|
TestContext->Guid,
|
||||||
(UINTN) ContextBuffers
|
(UINTN)ContextBuffers
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -415,17 +414,17 @@ VerifyGetModuleContextBuffers (
|
|||||||
UNIT_TEST_STATUS
|
UNIT_TEST_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
VerifyFindContextBufferInModuleBuffers (
|
VerifyFindContextBufferInModuleBuffers (
|
||||||
IN UNIT_TEST_CONTEXT Context
|
IN UNIT_TEST_CONTEXT Context
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
PRM_CONTEXT_BUFFER *FoundContextBuffer;
|
PRM_CONTEXT_BUFFER *FoundContextBuffer;
|
||||||
PRM_MODULE_CONTEXT_BUFFERS *ContextBuffers;
|
PRM_MODULE_CONTEXT_BUFFERS *ContextBuffers;
|
||||||
PRM_CONTEXT_BUFFER_TEST_CONTEXT *TestContext;
|
PRM_CONTEXT_BUFFER_TEST_CONTEXT *TestContext;
|
||||||
|
|
||||||
ContextBuffers = NULL;
|
ContextBuffers = NULL;
|
||||||
FoundContextBuffer = NULL;
|
FoundContextBuffer = NULL;
|
||||||
TestContext = (PRM_CONTEXT_BUFFER_TEST_CONTEXT *) Context;
|
TestContext = (PRM_CONTEXT_BUFFER_TEST_CONTEXT *)Context;
|
||||||
|
|
||||||
Status = FindContextBufferInModuleBuffers (TestContext->HandlerGuid, TestContext->ContextBuffers, &FoundContextBuffer);
|
Status = FindContextBufferInModuleBuffers (TestContext->HandlerGuid, TestContext->ContextBuffers, &FoundContextBuffer);
|
||||||
UT_ASSERT_STATUS_EQUAL (Status, TestContext->ExpectedStatus);
|
UT_ASSERT_STATUS_EQUAL (Status, TestContext->ExpectedStatus);
|
||||||
@ -461,17 +460,17 @@ VerifyFindContextBufferInModuleBuffers (
|
|||||||
UNIT_TEST_STATUS
|
UNIT_TEST_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
VerifyGetContextBuffer (
|
VerifyGetContextBuffer (
|
||||||
IN UNIT_TEST_CONTEXT Context
|
IN UNIT_TEST_CONTEXT Context
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
PRM_CONTEXT_BUFFER *FoundContextBuffer;
|
PRM_CONTEXT_BUFFER *FoundContextBuffer;
|
||||||
PRM_MODULE_CONTEXT_BUFFERS *ContextBuffers;
|
PRM_MODULE_CONTEXT_BUFFERS *ContextBuffers;
|
||||||
PRM_CONTEXT_BUFFER_TEST_CONTEXT *TestContext;
|
PRM_CONTEXT_BUFFER_TEST_CONTEXT *TestContext;
|
||||||
|
|
||||||
ContextBuffers = NULL;
|
ContextBuffers = NULL;
|
||||||
FoundContextBuffer = NULL;
|
FoundContextBuffer = NULL;
|
||||||
TestContext = (PRM_CONTEXT_BUFFER_TEST_CONTEXT *) Context;
|
TestContext = (PRM_CONTEXT_BUFFER_TEST_CONTEXT *)Context;
|
||||||
|
|
||||||
Status = GetContextBuffer (TestContext->HandlerGuid, TestContext->ContextBuffers, &FoundContextBuffer);
|
Status = GetContextBuffer (TestContext->HandlerGuid, TestContext->ContextBuffers, &FoundContextBuffer);
|
||||||
UT_ASSERT_STATUS_EQUAL (Status, TestContext->ExpectedStatus);
|
UT_ASSERT_STATUS_EQUAL (Status, TestContext->ExpectedStatus);
|
||||||
@ -484,7 +483,7 @@ VerifyGetContextBuffer (
|
|||||||
return UNIT_TEST_PASSED;
|
return UNIT_TEST_PASSED;
|
||||||
}
|
}
|
||||||
|
|
||||||
///=== TEST ENGINE ================================================================================
|
/// === TEST ENGINE ================================================================================
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Entry point for the PRM Context Buffer Library unit tests.
|
Entry point for the PRM Context Buffer Library unit tests.
|
||||||
@ -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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
|
|
||||||
#define _DBGMSGID_ "[PRMMODULEDISCOVERYLIB]"
|
#define _DBGMSGID_ "[PRMMODULEDISCOVERYLIB]"
|
||||||
|
|
||||||
LIST_ENTRY mPrmModuleList;
|
LIST_ENTRY mPrmModuleList;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Gets the next PRM module discovered after the given PRM module.
|
Gets the next PRM module discovered after the given PRM module.
|
||||||
@ -40,13 +40,13 @@ LIST_ENTRY mPrmModuleList;
|
|||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
GetNextPrmModuleEntry (
|
GetNextPrmModuleEntry (
|
||||||
IN OUT PRM_MODULE_IMAGE_CONTEXT **ModuleImageContext
|
IN OUT PRM_MODULE_IMAGE_CONTEXT **ModuleImageContext
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
LIST_ENTRY *CurrentLink;
|
LIST_ENTRY *CurrentLink;
|
||||||
LIST_ENTRY *ForwardLink;
|
LIST_ENTRY *ForwardLink;
|
||||||
PRM_MODULE_IMAGE_CONTEXT_LIST_ENTRY *CurrentListEntry;
|
PRM_MODULE_IMAGE_CONTEXT_LIST_ENTRY *CurrentListEntry;
|
||||||
PRM_MODULE_IMAGE_CONTEXT_LIST_ENTRY *ForwardListEntry;
|
PRM_MODULE_IMAGE_CONTEXT_LIST_ENTRY *ForwardListEntry;
|
||||||
|
|
||||||
DEBUG ((DEBUG_INFO, "%a %a - Entry.\n", _DBGMSGID_, __FUNCTION__));
|
DEBUG ((DEBUG_INFO, "%a %a - Entry.\n", _DBGMSGID_, __FUNCTION__));
|
||||||
|
|
||||||
@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -92,7 +92,7 @@ CreateNewPrmModuleImageContextListEntry (
|
|||||||
VOID
|
VOID
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
PRM_MODULE_IMAGE_CONTEXT_LIST_ENTRY *PrmModuleImageContextListEntry;
|
PRM_MODULE_IMAGE_CONTEXT_LIST_ENTRY *PrmModuleImageContextListEntry;
|
||||||
|
|
||||||
DEBUG ((DEBUG_INFO, "%a %a - Entry.\n", _DBGMSGID_, __FUNCTION__));
|
DEBUG ((DEBUG_INFO, "%a %a - Entry.\n", _DBGMSGID_, __FUNCTION__));
|
||||||
|
|
||||||
@ -100,12 +100,13 @@ 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",
|
||||||
_DBGMSGID_,
|
_DBGMSGID_,
|
||||||
__FUNCTION__,
|
__FUNCTION__,
|
||||||
(UINTN) PrmModuleImageContextListEntry,
|
(UINTN)PrmModuleImageContextListEntry,
|
||||||
sizeof (*PrmModuleImageContextListEntry)
|
sizeof (*PrmModuleImageContextListEntry)
|
||||||
));
|
));
|
||||||
|
|
||||||
@ -127,12 +128,12 @@ CreateNewPrmModuleImageContextListEntry (
|
|||||||
BOOLEAN
|
BOOLEAN
|
||||||
EFIAPI
|
EFIAPI
|
||||||
IsAddressInMmram (
|
IsAddressInMmram (
|
||||||
IN EFI_PHYSICAL_ADDRESS Address,
|
IN EFI_PHYSICAL_ADDRESS Address,
|
||||||
IN EFI_MMRAM_DESCRIPTOR *MmramRanges,
|
IN EFI_MMRAM_DESCRIPTOR *MmramRanges,
|
||||||
IN UINTN MmramRangeCount
|
IN UINTN MmramRangeCount
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
UINTN Index;
|
UINTN Index;
|
||||||
|
|
||||||
for (Index = 0; Index < MmramRangeCount; Index++) {
|
for (Index = 0; Index < MmramRangeCount; Index++) {
|
||||||
if ((Address >= MmramRanges[Index].CpuStart) &&
|
if ((Address >= MmramRanges[Index].CpuStart) &&
|
||||||
@ -167,28 +168,28 @@ IsAddressInMmram (
|
|||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
DiscoverPrmModules (
|
DiscoverPrmModules (
|
||||||
OUT UINTN *ModuleCount OPTIONAL,
|
OUT UINTN *ModuleCount OPTIONAL,
|
||||||
OUT UINTN *HandlerCount OPTIONAL
|
OUT UINTN *HandlerCount OPTIONAL
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
PRM_MODULE_IMAGE_CONTEXT TempPrmModuleImageContext;
|
PRM_MODULE_IMAGE_CONTEXT TempPrmModuleImageContext;
|
||||||
PRM_MODULE_IMAGE_CONTEXT_LIST_ENTRY *PrmModuleImageContextListEntry;
|
PRM_MODULE_IMAGE_CONTEXT_LIST_ENTRY *PrmModuleImageContextListEntry;
|
||||||
EFI_LOADED_IMAGE_PROTOCOL *LoadedImageProtocol;
|
EFI_LOADED_IMAGE_PROTOCOL *LoadedImageProtocol;
|
||||||
EFI_HANDLE *HandleBuffer;
|
EFI_HANDLE *HandleBuffer;
|
||||||
UINTN HandleCount;
|
UINTN HandleCount;
|
||||||
UINTN Index;
|
UINTN Index;
|
||||||
UINTN PrmHandlerCount;
|
UINTN PrmHandlerCount;
|
||||||
UINTN PrmModuleCount;
|
UINTN PrmModuleCount;
|
||||||
EFI_MM_ACCESS_PROTOCOL *MmAccess;
|
EFI_MM_ACCESS_PROTOCOL *MmAccess;
|
||||||
UINTN Size;
|
UINTN Size;
|
||||||
EFI_MMRAM_DESCRIPTOR *MmramRanges;
|
EFI_MMRAM_DESCRIPTOR *MmramRanges;
|
||||||
UINTN MmramRangeCount;
|
UINTN MmramRangeCount;
|
||||||
|
|
||||||
DEBUG ((DEBUG_INFO, "%a %a - Entry.\n", _DBGMSGID_, __FUNCTION__));
|
DEBUG ((DEBUG_INFO, "%a %a - Entry.\n", _DBGMSGID_, __FUNCTION__));
|
||||||
|
|
||||||
PrmHandlerCount = 0;
|
PrmHandlerCount = 0;
|
||||||
PrmModuleCount = 0;
|
PrmModuleCount = 0;
|
||||||
|
|
||||||
if (!IsListEmpty (&mPrmModuleList)) {
|
if (!IsListEmpty (&mPrmModuleList)) {
|
||||||
return EFI_ALREADY_STARTED;
|
return EFI_ALREADY_STARTED;
|
||||||
@ -206,18 +207,18 @@ DiscoverPrmModules (
|
|||||||
return EFI_NOT_FOUND;
|
return EFI_NOT_FOUND;
|
||||||
}
|
}
|
||||||
|
|
||||||
MmramRanges = NULL;
|
MmramRanges = NULL;
|
||||||
MmramRangeCount = 0;
|
MmramRangeCount = 0;
|
||||||
Status = gBS->LocateProtocol (
|
Status = gBS->LocateProtocol (
|
||||||
&gEfiMmAccessProtocolGuid,
|
&gEfiMmAccessProtocolGuid,
|
||||||
NULL,
|
NULL,
|
||||||
(VOID **)&MmAccess
|
(VOID **)&MmAccess
|
||||||
);
|
);
|
||||||
if (Status == EFI_SUCCESS) {
|
if (Status == EFI_SUCCESS) {
|
||||||
//
|
//
|
||||||
// Get MMRAM range information
|
// Get MMRAM range information
|
||||||
//
|
//
|
||||||
Size = 0;
|
Size = 0;
|
||||||
Status = MmAccess->GetCapabilities (MmAccess, &Size, NULL);
|
Status = MmAccess->GetCapabilities (MmAccess, &Size, NULL);
|
||||||
if ((Status == EFI_BUFFER_TOO_SMALL) && (Size != 0)) {
|
if ((Status == EFI_BUFFER_TOO_SMALL) && (Size != 0)) {
|
||||||
MmramRanges = (EFI_MMRAM_DESCRIPTOR *)AllocatePool (Size);
|
MmramRanges = (EFI_MMRAM_DESCRIPTOR *)AllocatePool (Size);
|
||||||
@ -234,7 +235,7 @@ DiscoverPrmModules (
|
|||||||
Status = gBS->HandleProtocol (
|
Status = gBS->HandleProtocol (
|
||||||
HandleBuffer[Index],
|
HandleBuffer[Index],
|
||||||
&gEfiLoadedImageProtocolGuid,
|
&gEfiLoadedImageProtocolGuid,
|
||||||
(VOID **) &LoadedImageProtocol
|
(VOID **)&LoadedImageProtocol
|
||||||
);
|
);
|
||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
continue;
|
continue;
|
||||||
@ -249,16 +250,17 @@ 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",
|
||||||
_DBGMSGID_,
|
_DBGMSGID_,
|
||||||
__FUNCTION__,
|
__FUNCTION__,
|
||||||
(EFI_PHYSICAL_ADDRESS) (UINTN) LoadedImageProtocol->ImageBase
|
(EFI_PHYSICAL_ADDRESS)(UINTN)LoadedImageProtocol->ImageBase
|
||||||
));
|
));
|
||||||
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;
|
||||||
@ -276,13 +278,14 @@ DiscoverPrmModules (
|
|||||||
|
|
||||||
// Attempt to find the PRM Module Export Descriptor in the export table
|
// Attempt to find the PRM Module Export Descriptor in the export table
|
||||||
Status = GetPrmModuleExportDescriptorTable (
|
Status = GetPrmModuleExportDescriptorTable (
|
||||||
TempPrmModuleImageContext.ExportDirectory,
|
TempPrmModuleImageContext.ExportDirectory,
|
||||||
&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;
|
||||||
}
|
}
|
||||||
@ -331,13 +336,13 @@ DiscoverPrmModules (
|
|||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
PrmModuleDiscoveryLibDestructor (
|
PrmModuleDiscoveryLibDestructor (
|
||||||
IN EFI_HANDLE ImageHandle,
|
IN EFI_HANDLE ImageHandle,
|
||||||
IN EFI_SYSTEM_TABLE *SystemTable
|
IN EFI_SYSTEM_TABLE *SystemTable
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
LIST_ENTRY *Link;
|
LIST_ENTRY *Link;
|
||||||
LIST_ENTRY *NextLink;
|
LIST_ENTRY *NextLink;
|
||||||
PRM_MODULE_IMAGE_CONTEXT_LIST_ENTRY *ListEntry;
|
PRM_MODULE_IMAGE_CONTEXT_LIST_ENTRY *ListEntry;
|
||||||
|
|
||||||
if (IsListEmpty (&mPrmModuleList)) {
|
if (IsListEmpty (&mPrmModuleList)) {
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
@ -346,7 +351,7 @@ PrmModuleDiscoveryLibDestructor (
|
|||||||
Link = GetFirstNode (&mPrmModuleList);
|
Link = GetFirstNode (&mPrmModuleList);
|
||||||
while (!IsNull (&mPrmModuleList, Link)) {
|
while (!IsNull (&mPrmModuleList, Link)) {
|
||||||
ListEntry = CR (Link, PRM_MODULE_IMAGE_CONTEXT_LIST_ENTRY, Link, PRM_MODULE_IMAGE_CONTEXT_LIST_ENTRY_SIGNATURE);
|
ListEntry = CR (Link, PRM_MODULE_IMAGE_CONTEXT_LIST_ENTRY, Link, PRM_MODULE_IMAGE_CONTEXT_LIST_ENTRY_SIGNATURE);
|
||||||
NextLink = GetNextNode (&mPrmModuleList, Link);
|
NextLink = GetNextNode (&mPrmModuleList, Link);
|
||||||
|
|
||||||
RemoveEntryList (Link);
|
RemoveEntryList (Link);
|
||||||
FreePool (ListEntry);
|
FreePool (ListEntry);
|
||||||
@ -371,8 +376,8 @@ PrmModuleDiscoveryLibDestructor (
|
|||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
PrmModuleDiscoveryLibConstructor (
|
PrmModuleDiscoveryLibConstructor (
|
||||||
IN EFI_HANDLE ImageHandle,
|
IN EFI_HANDLE ImageHandle,
|
||||||
IN EFI_SYSTEM_TABLE *SystemTable
|
IN EFI_SYSTEM_TABLE *SystemTable
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
InitializeListHead (&mPrmModuleList);
|
InitializeListHead (&mPrmModuleList);
|
||||||
|
@ -12,14 +12,14 @@
|
|||||||
|
|
||||||
#include <PrmModuleImageContext.h>
|
#include <PrmModuleImageContext.h>
|
||||||
|
|
||||||
#define PRM_MODULE_IMAGE_CONTEXT_LIST_ENTRY_SIGNATURE SIGNATURE_32('P','R','M','E')
|
#define PRM_MODULE_IMAGE_CONTEXT_LIST_ENTRY_SIGNATURE SIGNATURE_32('P','R','M','E')
|
||||||
|
|
||||||
#pragma pack(push, 1)
|
#pragma pack(push, 1)
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
UINTN Signature;
|
UINTN Signature;
|
||||||
LIST_ENTRY Link;
|
LIST_ENTRY Link;
|
||||||
PRM_MODULE_IMAGE_CONTEXT Context;
|
PRM_MODULE_IMAGE_CONTEXT Context;
|
||||||
} PRM_MODULE_IMAGE_CONTEXT_LIST_ENTRY;
|
} PRM_MODULE_IMAGE_CONTEXT_LIST_ENTRY;
|
||||||
|
|
||||||
#pragma pack(pop)
|
#pragma pack(pop)
|
||||||
|
@ -24,12 +24,12 @@
|
|||||||
|
|
||||||
#include "../PrmModuleDiscovery.h"
|
#include "../PrmModuleDiscovery.h"
|
||||||
|
|
||||||
#define UNIT_TEST_NAME "PRM Module Discovery Library Unit Test"
|
#define UNIT_TEST_NAME "PRM Module Discovery Library Unit Test"
|
||||||
#define UNIT_TEST_VERSION "0.1"
|
#define UNIT_TEST_VERSION "0.1"
|
||||||
|
|
||||||
///=== TEST CASES =================================================================================
|
/// === TEST CASES =================================================================================
|
||||||
|
|
||||||
///===== CREATE NEW PRM MODULE IMAGE CONTEXT LIST ENTRY TESTS SUITE ==================================================
|
/// ===== CREATE NEW PRM MODULE IMAGE CONTEXT LIST ENTRY TESTS SUITE ==================================================
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Verifies that the buffer returned can be deallocated.
|
Verifies that the buffer returned can be deallocated.
|
||||||
@ -44,10 +44,10 @@
|
|||||||
UNIT_TEST_STATUS
|
UNIT_TEST_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
PrmModuleImageContextListEntryShouldDeallocate (
|
PrmModuleImageContextListEntryShouldDeallocate (
|
||||||
IN UNIT_TEST_CONTEXT Context
|
IN UNIT_TEST_CONTEXT Context
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
PRM_MODULE_IMAGE_CONTEXT_LIST_ENTRY *ListEntry;
|
PRM_MODULE_IMAGE_CONTEXT_LIST_ENTRY *ListEntry;
|
||||||
|
|
||||||
ListEntry = CreateNewPrmModuleImageContextListEntry ();
|
ListEntry = CreateNewPrmModuleImageContextListEntry ();
|
||||||
|
|
||||||
@ -72,10 +72,10 @@ PrmModuleImageContextListEntryShouldDeallocate (
|
|||||||
UNIT_TEST_STATUS
|
UNIT_TEST_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
PrmModuleImageContextListEntrySignatureShouldBeValid (
|
PrmModuleImageContextListEntrySignatureShouldBeValid (
|
||||||
IN UNIT_TEST_CONTEXT Context
|
IN UNIT_TEST_CONTEXT Context
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
PRM_MODULE_IMAGE_CONTEXT_LIST_ENTRY *ListEntry;
|
PRM_MODULE_IMAGE_CONTEXT_LIST_ENTRY *ListEntry;
|
||||||
|
|
||||||
ListEntry = CreateNewPrmModuleImageContextListEntry ();
|
ListEntry = CreateNewPrmModuleImageContextListEntry ();
|
||||||
|
|
||||||
@ -101,11 +101,11 @@ PrmModuleImageContextListEntrySignatureShouldBeValid (
|
|||||||
UNIT_TEST_STATUS
|
UNIT_TEST_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
PrmModuleImageContextListEntryImageContextShouldBeZeroed (
|
PrmModuleImageContextListEntryImageContextShouldBeZeroed (
|
||||||
IN UNIT_TEST_CONTEXT Context
|
IN UNIT_TEST_CONTEXT Context
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
PRM_MODULE_IMAGE_CONTEXT_LIST_ENTRY *ListEntry;
|
PRM_MODULE_IMAGE_CONTEXT_LIST_ENTRY *ListEntry;
|
||||||
PRM_MODULE_IMAGE_CONTEXT ImageContext;
|
PRM_MODULE_IMAGE_CONTEXT ImageContext;
|
||||||
|
|
||||||
ListEntry = CreateNewPrmModuleImageContextListEntry ();
|
ListEntry = CreateNewPrmModuleImageContextListEntry ();
|
||||||
|
|
||||||
@ -119,7 +119,7 @@ PrmModuleImageContextListEntryImageContextShouldBeZeroed (
|
|||||||
return UNIT_TEST_PASSED;
|
return UNIT_TEST_PASSED;
|
||||||
}
|
}
|
||||||
|
|
||||||
///=== TEST ENGINE ================================================================================
|
/// === TEST ENGINE ================================================================================
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Entry point for the PRM Context Buffer Library unit tests.
|
Entry point for the PRM Context Buffer Library unit tests.
|
||||||
@ -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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -37,26 +37,27 @@
|
|||||||
**/
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
GetPrmModuleExportDescriptorTable (
|
GetPrmModuleExportDescriptorTable (
|
||||||
IN EFI_IMAGE_EXPORT_DIRECTORY *ImageExportDirectory,
|
IN EFI_IMAGE_EXPORT_DIRECTORY *ImageExportDirectory,
|
||||||
IN PE_COFF_LOADER_IMAGE_CONTEXT *PeCoffLoaderImageContext,
|
IN PE_COFF_LOADER_IMAGE_CONTEXT *PeCoffLoaderImageContext,
|
||||||
OUT PRM_MODULE_EXPORT_DESCRIPTOR_STRUCT **ExportDescriptor
|
OUT PRM_MODULE_EXPORT_DESCRIPTOR_STRUCT **ExportDescriptor
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
UINTN Index;
|
UINTN Index;
|
||||||
EFI_PHYSICAL_ADDRESS CurrentImageAddress;
|
EFI_PHYSICAL_ADDRESS CurrentImageAddress;
|
||||||
UINT16 PrmModuleExportDescriptorOrdinal;
|
UINT16 PrmModuleExportDescriptorOrdinal;
|
||||||
CONST CHAR8 *CurrentExportName;
|
CONST CHAR8 *CurrentExportName;
|
||||||
UINT16 *OrdinalTable;
|
UINT16 *OrdinalTable;
|
||||||
UINT32 *ExportNamePointerTable;
|
UINT32 *ExportNamePointerTable;
|
||||||
UINT32 *ExportAddressTable;
|
UINT32 *ExportAddressTable;
|
||||||
PRM_MODULE_EXPORT_DESCRIPTOR_STRUCT *TempExportDescriptor;
|
PRM_MODULE_EXPORT_DESCRIPTOR_STRUCT *TempExportDescriptor;
|
||||||
|
|
||||||
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -73,13 +74,13 @@ GetPrmModuleExportDescriptorTable (
|
|||||||
//
|
//
|
||||||
// The export name pointer table and export ordinal table form two parallel arrays associated by index.
|
// The export name pointer table and export ordinal table form two parallel arrays associated by index.
|
||||||
//
|
//
|
||||||
CurrentImageAddress = PeCoffLoaderImageContext->ImageAddress;
|
CurrentImageAddress = PeCoffLoaderImageContext->ImageAddress;
|
||||||
ExportAddressTable = (UINT32 *) ((UINTN) CurrentImageAddress + ImageExportDirectory->AddressOfFunctions);
|
ExportAddressTable = (UINT32 *)((UINTN)CurrentImageAddress + ImageExportDirectory->AddressOfFunctions);
|
||||||
ExportNamePointerTable = (UINT32 *) ((UINTN) CurrentImageAddress + ImageExportDirectory->AddressOfNames);
|
ExportNamePointerTable = (UINT32 *)((UINTN)CurrentImageAddress + ImageExportDirectory->AddressOfNames);
|
||||||
OrdinalTable = (UINT16 *) ((UINTN) CurrentImageAddress + ImageExportDirectory->AddressOfNameOrdinals);
|
OrdinalTable = (UINT16 *)((UINTN)CurrentImageAddress + ImageExportDirectory->AddressOfNameOrdinals);
|
||||||
|
|
||||||
for (Index = 0; Index < ImageExportDirectory->NumberOfNames; Index++) {
|
for (Index = 0; Index < ImageExportDirectory->NumberOfNames; Index++) {
|
||||||
CurrentExportName = (CONST CHAR8 *) ((UINTN) CurrentImageAddress + ExportNamePointerTable[Index]);
|
CurrentExportName = (CONST CHAR8 *)((UINTN)CurrentImageAddress + ExportNamePointerTable[Index]);
|
||||||
DEBUG ((
|
DEBUG ((
|
||||||
DEBUG_INFO,
|
DEBUG_INFO,
|
||||||
" %a %a: Export Name[0x%x] - %a.\n",
|
" %a %a: Export Name[0x%x] - %a.\n",
|
||||||
@ -89,11 +90,12 @@ GetPrmModuleExportDescriptorTable (
|
|||||||
CurrentExportName
|
CurrentExportName
|
||||||
));
|
));
|
||||||
if (
|
if (
|
||||||
AsciiStrnCmp (
|
AsciiStrnCmp (
|
||||||
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,19 +108,21 @@ 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;
|
||||||
DEBUG ((DEBUG_INFO, " %a %a: PRM Module Export Descriptor found at 0x%x.\n", _DBGMSGID_, __FUNCTION__, (UINTN) ExportDescriptor));
|
DEBUG ((DEBUG_INFO, " %a %a: PRM Module Export Descriptor found at 0x%x.\n", _DBGMSGID_, __FUNCTION__, (UINTN)ExportDescriptor));
|
||||||
} else {
|
} else {
|
||||||
DEBUG ((
|
DEBUG ((
|
||||||
DEBUG_INFO,
|
DEBUG_INFO,
|
||||||
" %a %a: PRM Module Export Descriptor found at 0x%x but signature check failed.\n",
|
" %a %a: PRM Module Export Descriptor found at 0x%x but signature check failed.\n",
|
||||||
_DBGMSGID_,
|
_DBGMSGID_,
|
||||||
__FUNCTION__,
|
__FUNCTION__,
|
||||||
(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;
|
||||||
}
|
}
|
||||||
@ -145,18 +149,18 @@ GetPrmModuleExportDescriptorTable (
|
|||||||
**/
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
GetExportDirectoryInPeCoffImage (
|
GetExportDirectoryInPeCoffImage (
|
||||||
IN VOID *Image,
|
IN VOID *Image,
|
||||||
IN PE_COFF_LOADER_IMAGE_CONTEXT *PeCoffLoaderImageContext,
|
IN PE_COFF_LOADER_IMAGE_CONTEXT *PeCoffLoaderImageContext,
|
||||||
OUT EFI_IMAGE_EXPORT_DIRECTORY **ImageExportDirectory
|
OUT EFI_IMAGE_EXPORT_DIRECTORY **ImageExportDirectory
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
UINT16 Magic;
|
UINT16 Magic;
|
||||||
UINT32 NumberOfRvaAndSizes;
|
UINT32 NumberOfRvaAndSizes;
|
||||||
EFI_IMAGE_OPTIONAL_HEADER_PTR_UNION OptionalHeaderPtrUnion;
|
EFI_IMAGE_OPTIONAL_HEADER_PTR_UNION OptionalHeaderPtrUnion;
|
||||||
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -169,36 +173,36 @@ GetExportDirectoryInPeCoffImage (
|
|||||||
// image with PE32 magic.
|
// image with PE32 magic.
|
||||||
//
|
//
|
||||||
switch (PeCoffLoaderImageContext->Machine) {
|
switch (PeCoffLoaderImageContext->Machine) {
|
||||||
case EFI_IMAGE_MACHINE_IA32:
|
case EFI_IMAGE_MACHINE_IA32:
|
||||||
//
|
//
|
||||||
// Assume PE32 image with IA32 Machine field.
|
// Assume PE32 image with IA32 Machine field.
|
||||||
//
|
//
|
||||||
Magic = EFI_IMAGE_NT_OPTIONAL_HDR32_MAGIC;
|
Magic = EFI_IMAGE_NT_OPTIONAL_HDR32_MAGIC;
|
||||||
break;
|
break;
|
||||||
case EFI_IMAGE_MACHINE_X64:
|
case EFI_IMAGE_MACHINE_X64:
|
||||||
case EFI_IMAGE_MACHINE_AARCH64:
|
case EFI_IMAGE_MACHINE_AARCH64:
|
||||||
//
|
//
|
||||||
// Assume PE32+ image with X64 Machine field
|
// Assume PE32+ image with X64 Machine field
|
||||||
//
|
//
|
||||||
Magic = EFI_IMAGE_NT_OPTIONAL_HDR64_MAGIC;
|
Magic = EFI_IMAGE_NT_OPTIONAL_HDR64_MAGIC;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
//
|
//
|
||||||
// For unknown Machine field, use Magic in optional header
|
// For unknown Machine field, use Magic in optional header
|
||||||
//
|
//
|
||||||
DEBUG ((
|
DEBUG ((
|
||||||
DEBUG_WARN,
|
DEBUG_WARN,
|
||||||
"%a %a: The machine type for this image is not valid for a PRM module.\n",
|
"%a %a: The machine type for this image is not valid for a PRM module.\n",
|
||||||
_DBGMSGID_,
|
_DBGMSGID_,
|
||||||
__FUNCTION__
|
__FUNCTION__
|
||||||
));
|
));
|
||||||
return EFI_UNSUPPORTED;
|
return EFI_UNSUPPORTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
OptionalHeaderPtrUnion.Pe32 = (EFI_IMAGE_NT_HEADERS32 *) (
|
OptionalHeaderPtrUnion.Pe32 = (EFI_IMAGE_NT_HEADERS32 *)(
|
||||||
(UINTN) Image +
|
(UINTN)Image +
|
||||||
PeCoffLoaderImageContext->PeCoffHeaderOffset
|
PeCoffLoaderImageContext->PeCoffHeaderOffset
|
||||||
);
|
);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Check the PE/COFF Header Signature. Determine if the image is valid and/or a TE image.
|
// Check the PE/COFF Header Signature. Determine if the image is valid and/or a TE image.
|
||||||
@ -213,43 +217,44 @@ GetExportDirectoryInPeCoffImage (
|
|||||||
// Use the PE32 offset to get the Export Directory Entry
|
// Use the PE32 offset to get the Export Directory Entry
|
||||||
//
|
//
|
||||||
NumberOfRvaAndSizes = OptionalHeaderPtrUnion.Pe32->OptionalHeader.NumberOfRvaAndSizes;
|
NumberOfRvaAndSizes = OptionalHeaderPtrUnion.Pe32->OptionalHeader.NumberOfRvaAndSizes;
|
||||||
DirectoryEntry = (EFI_IMAGE_DATA_DIRECTORY *) &(OptionalHeaderPtrUnion.Pe32->OptionalHeader.DataDirectory[EFI_IMAGE_DIRECTORY_ENTRY_EXPORT]);
|
DirectoryEntry = (EFI_IMAGE_DATA_DIRECTORY *)&(OptionalHeaderPtrUnion.Pe32->OptionalHeader.DataDirectory[EFI_IMAGE_DIRECTORY_ENTRY_EXPORT]);
|
||||||
} else if (OptionalHeaderPtrUnion.Pe32->OptionalHeader.Magic == EFI_IMAGE_NT_OPTIONAL_HDR64_MAGIC) {
|
} else if (OptionalHeaderPtrUnion.Pe32->OptionalHeader.Magic == EFI_IMAGE_NT_OPTIONAL_HDR64_MAGIC) {
|
||||||
//
|
//
|
||||||
// Use the PE32+ offset get the Export Directory Entry
|
// Use the PE32+ offset get the Export Directory Entry
|
||||||
//
|
//
|
||||||
NumberOfRvaAndSizes = OptionalHeaderPtrUnion.Pe32Plus->OptionalHeader.NumberOfRvaAndSizes;
|
NumberOfRvaAndSizes = OptionalHeaderPtrUnion.Pe32Plus->OptionalHeader.NumberOfRvaAndSizes;
|
||||||
DirectoryEntry = (EFI_IMAGE_DATA_DIRECTORY *) &(OptionalHeaderPtrUnion.Pe32Plus->OptionalHeader.DataDirectory[EFI_IMAGE_DIRECTORY_ENTRY_EXPORT]);
|
DirectoryEntry = (EFI_IMAGE_DATA_DIRECTORY *)&(OptionalHeaderPtrUnion.Pe32Plus->OptionalHeader.DataDirectory[EFI_IMAGE_DIRECTORY_ENTRY_EXPORT]);
|
||||||
} else {
|
} else {
|
||||||
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
|
||||||
//
|
//
|
||||||
return EFI_NOT_FOUND;
|
return EFI_NOT_FOUND;
|
||||||
} else if (((UINT32) (~0) - DirectoryEntry->VirtualAddress) < DirectoryEntry->Size) {
|
} else if (((UINT32)(~0) - DirectoryEntry->VirtualAddress) < DirectoryEntry->Size) {
|
||||||
//
|
//
|
||||||
// The directory address overflows
|
// The directory address overflows
|
||||||
//
|
//
|
||||||
DEBUG ((DEBUG_ERROR, "%a %a: The export directory entry in this image results in overflow.\n", _DBGMSGID_, __FUNCTION__));
|
DEBUG ((DEBUG_ERROR, "%a %a: The export directory entry in this image results in overflow.\n", _DBGMSGID_, __FUNCTION__));
|
||||||
return EFI_UNSUPPORTED;
|
return EFI_UNSUPPORTED;
|
||||||
} else {
|
} else {
|
||||||
DEBUG ((DEBUG_INFO, "%a %a: Export Directory Entry found in the image at 0x%x.\n", _DBGMSGID_, __FUNCTION__, (UINTN) OptionalHeaderPtrUnion.Pe32));
|
DEBUG ((DEBUG_INFO, "%a %a: Export Directory Entry found in the image at 0x%x.\n", _DBGMSGID_, __FUNCTION__, (UINTN)OptionalHeaderPtrUnion.Pe32));
|
||||||
DEBUG ((DEBUG_INFO, " %a %a: Directory Entry Virtual Address = 0x%x.\n", _DBGMSGID_, __FUNCTION__, DirectoryEntry->VirtualAddress));
|
DEBUG ((DEBUG_INFO, " %a %a: Directory Entry Virtual Address = 0x%x.\n", _DBGMSGID_, __FUNCTION__, DirectoryEntry->VirtualAddress));
|
||||||
|
|
||||||
ExportDirectory = (EFI_IMAGE_EXPORT_DIRECTORY *) ((UINTN) Image + DirectoryEntry->VirtualAddress);
|
ExportDirectory = (EFI_IMAGE_EXPORT_DIRECTORY *)((UINTN)Image + DirectoryEntry->VirtualAddress);
|
||||||
DEBUG ((
|
DEBUG ((
|
||||||
DEBUG_INFO,
|
DEBUG_INFO,
|
||||||
" %a %a: Export Directory Table found successfully at 0x%x. Name address = 0x%x. Name = %a.\n",
|
" %a %a: Export Directory Table found successfully at 0x%x. Name address = 0x%x. Name = %a.\n",
|
||||||
_DBGMSGID_,
|
_DBGMSGID_,
|
||||||
__FUNCTION__,
|
__FUNCTION__,
|
||||||
(UINTN) ExportDirectory,
|
(UINTN)ExportDirectory,
|
||||||
((UINTN) Image + ExportDirectory->Name),
|
((UINTN)Image + ExportDirectory->Name),
|
||||||
(CHAR8 *) ((UINTN) Image + ExportDirectory->Name)
|
(CHAR8 *)((UINTN)Image + ExportDirectory->Name)
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
*ImageExportDirectory = ExportDirectory;
|
*ImageExportDirectory = ExportDirectory;
|
||||||
|
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
@ -273,18 +278,18 @@ GetExportDirectoryInPeCoffImage (
|
|||||||
**/
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
GetImageVersionInPeCoffImage (
|
GetImageVersionInPeCoffImage (
|
||||||
IN VOID *Image,
|
IN VOID *Image,
|
||||||
IN PE_COFF_LOADER_IMAGE_CONTEXT *PeCoffLoaderImageContext,
|
IN PE_COFF_LOADER_IMAGE_CONTEXT *PeCoffLoaderImageContext,
|
||||||
OUT UINT16 *ImageMajorVersion,
|
OUT UINT16 *ImageMajorVersion,
|
||||||
OUT UINT16 *ImageMinorVersion
|
OUT UINT16 *ImageMinorVersion
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
EFI_IMAGE_OPTIONAL_HEADER_PTR_UNION OptionalHeaderPtrUnion;
|
EFI_IMAGE_OPTIONAL_HEADER_PTR_UNION OptionalHeaderPtrUnion;
|
||||||
UINT16 Magic;
|
UINT16 Magic;
|
||||||
|
|
||||||
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -294,36 +299,36 @@ GetImageVersionInPeCoffImage (
|
|||||||
// image with PE32 magic.
|
// image with PE32 magic.
|
||||||
//
|
//
|
||||||
switch (PeCoffLoaderImageContext->Machine) {
|
switch (PeCoffLoaderImageContext->Machine) {
|
||||||
case EFI_IMAGE_MACHINE_IA32:
|
case EFI_IMAGE_MACHINE_IA32:
|
||||||
//
|
//
|
||||||
// Assume PE32 image
|
// Assume PE32 image
|
||||||
//
|
//
|
||||||
Magic = EFI_IMAGE_NT_OPTIONAL_HDR32_MAGIC;
|
Magic = EFI_IMAGE_NT_OPTIONAL_HDR32_MAGIC;
|
||||||
break;
|
break;
|
||||||
case EFI_IMAGE_MACHINE_X64:
|
case EFI_IMAGE_MACHINE_X64:
|
||||||
case EFI_IMAGE_MACHINE_AARCH64:
|
case EFI_IMAGE_MACHINE_AARCH64:
|
||||||
//
|
//
|
||||||
// Assume PE32+ image
|
// Assume PE32+ image
|
||||||
//
|
//
|
||||||
Magic = EFI_IMAGE_NT_OPTIONAL_HDR64_MAGIC;
|
Magic = EFI_IMAGE_NT_OPTIONAL_HDR64_MAGIC;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
//
|
//
|
||||||
// For unknown Machine field, use Magic in optional header
|
// For unknown Machine field, use Magic in optional header
|
||||||
//
|
//
|
||||||
DEBUG ((
|
DEBUG ((
|
||||||
DEBUG_WARN,
|
DEBUG_WARN,
|
||||||
"%a %a: The machine type for this image is not valid for a PRM module.\n",
|
"%a %a: The machine type for this image is not valid for a PRM module.\n",
|
||||||
_DBGMSGID_,
|
_DBGMSGID_,
|
||||||
__FUNCTION__
|
__FUNCTION__
|
||||||
));
|
));
|
||||||
return EFI_UNSUPPORTED;
|
return EFI_UNSUPPORTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
OptionalHeaderPtrUnion.Pe32 = (EFI_IMAGE_NT_HEADERS32 *) (
|
OptionalHeaderPtrUnion.Pe32 = (EFI_IMAGE_NT_HEADERS32 *)(
|
||||||
(UINTN) Image +
|
(UINTN)Image +
|
||||||
PeCoffLoaderImageContext->PeCoffHeaderOffset
|
PeCoffLoaderImageContext->PeCoffHeaderOffset
|
||||||
);
|
);
|
||||||
//
|
//
|
||||||
// Check the PE/COFF Header Signature. Determine if the image is valid and/or a TE image.
|
// Check the PE/COFF Header Signature. Determine if the image is valid and/or a TE image.
|
||||||
//
|
//
|
||||||
@ -368,30 +373,31 @@ GetImageVersionInPeCoffImage (
|
|||||||
**/
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
GetExportEntryAddress (
|
GetExportEntryAddress (
|
||||||
IN CONST CHAR8 *ExportName,
|
IN CONST CHAR8 *ExportName,
|
||||||
IN EFI_PHYSICAL_ADDRESS ImageBaseAddress,
|
IN EFI_PHYSICAL_ADDRESS ImageBaseAddress,
|
||||||
IN EFI_IMAGE_EXPORT_DIRECTORY *ImageExportDirectory,
|
IN EFI_IMAGE_EXPORT_DIRECTORY *ImageExportDirectory,
|
||||||
OUT EFI_PHYSICAL_ADDRESS *ExportPhysicalAddress
|
OUT EFI_PHYSICAL_ADDRESS *ExportPhysicalAddress
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
UINTN ExportNameIndex;
|
UINTN ExportNameIndex;
|
||||||
UINT16 CurrentExportOrdinal;
|
UINT16 CurrentExportOrdinal;
|
||||||
UINT32 *ExportAddressTable;
|
UINT32 *ExportAddressTable;
|
||||||
UINT32 *ExportNamePointerTable;
|
UINT32 *ExportNamePointerTable;
|
||||||
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);
|
||||||
ExportNamePointerTable = (UINT32 *) ((UINTN) ImageBaseAddress + ImageExportDirectory->AddressOfNames);
|
ExportNamePointerTable = (UINT32 *)((UINTN)ImageBaseAddress + ImageExportDirectory->AddressOfNames);
|
||||||
OrdinalTable = (UINT16 *) ((UINTN) ImageBaseAddress + ImageExportDirectory->AddressOfNameOrdinals);
|
OrdinalTable = (UINT16 *)((UINTN)ImageBaseAddress + ImageExportDirectory->AddressOfNameOrdinals);
|
||||||
|
|
||||||
for (ExportNameIndex = 0; ExportNameIndex < ImageExportDirectory->NumberOfNames; ExportNameIndex++) {
|
for (ExportNameIndex = 0; ExportNameIndex < ImageExportDirectory->NumberOfNames; ExportNameIndex++) {
|
||||||
ExportNameTablePointerName = (CONST CHAR8 *) ((UINTN) ImageBaseAddress + ExportNamePointerTable[ExportNameIndex]);
|
ExportNameTablePointerName = (CONST CHAR8 *)((UINTN)ImageBaseAddress + ExportNamePointerTable[ExportNameIndex]);
|
||||||
|
|
||||||
if (AsciiStrnCmp (ExportName, ExportNameTablePointerName, PRM_HANDLER_NAME_MAXIMUM_LENGTH) == 0) {
|
if (AsciiStrnCmp (ExportName, ExportNameTablePointerName, PRM_HANDLER_NAME_MAXIMUM_LENGTH) == 0) {
|
||||||
CurrentExportOrdinal = OrdinalTable[ExportNameIndex];
|
CurrentExportOrdinal = OrdinalTable[ExportNameIndex];
|
||||||
@ -402,7 +408,7 @@ GetExportEntryAddress (
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
*ExportPhysicalAddress = (EFI_PHYSICAL_ADDRESS) ((UINTN) ImageBaseAddress + ExportAddressTable[CurrentExportOrdinal]);
|
*ExportPhysicalAddress = (EFI_PHYSICAL_ADDRESS)((UINTN)ImageBaseAddress + ExportAddressTable[CurrentExportOrdinal]);
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -23,11 +23,11 @@
|
|||||||
#include <PrmMmio.h>
|
#include <PrmMmio.h>
|
||||||
#include <Protocol/PrmConfig.h>
|
#include <Protocol/PrmConfig.h>
|
||||||
|
|
||||||
#define _DBGMSGID_ "[PRMCONFIG]"
|
#define _DBGMSGID_ "[PRMCONFIG]"
|
||||||
|
|
||||||
STATIC UINTN mMaxRuntimeMmioRangeCount;
|
STATIC UINTN mMaxRuntimeMmioRangeCount;
|
||||||
|
|
||||||
GLOBAL_REMOVE_IF_UNREFERENCED STATIC PRM_RUNTIME_MMIO_RANGES **mRuntimeMmioRanges;
|
GLOBAL_REMOVE_IF_UNREFERENCED STATIC PRM_RUNTIME_MMIO_RANGES **mRuntimeMmioRanges;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Converts the runtime memory range physical addresses to virtual addresses.
|
Converts the runtime memory range physical addresses to virtual addresses.
|
||||||
@ -37,18 +37,18 @@ GLOBAL_REMOVE_IF_UNREFERENCED STATIC PRM_RUNTIME_MMIO_RANGES **mRuntimeMmioRa
|
|||||||
**/
|
**/
|
||||||
VOID
|
VOID
|
||||||
ConvertRuntimeMemoryRangeAddresses (
|
ConvertRuntimeMemoryRangeAddresses (
|
||||||
IN PRM_RUNTIME_MMIO_RANGES *RuntimeMmioRanges
|
IN PRM_RUNTIME_MMIO_RANGES *RuntimeMmioRanges
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
UINTN Index;
|
UINTN Index;
|
||||||
|
|
||||||
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++) {
|
||||||
RuntimeMmioRanges->Range[Index].VirtualBaseAddress = RuntimeMmioRanges->Range[Index].PhysicalBaseAddress;
|
RuntimeMmioRanges->Range[Index].VirtualBaseAddress = RuntimeMmioRanges->Range[Index].PhysicalBaseAddress;
|
||||||
gRT->ConvertPointer (0x0, (VOID **) &(RuntimeMmioRanges->Range[Index].VirtualBaseAddress));
|
gRT->ConvertPointer (0x0, (VOID **)&(RuntimeMmioRanges->Range[Index].VirtualBaseAddress));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -63,23 +63,28 @@ ConvertRuntimeMemoryRangeAddresses (
|
|||||||
**/
|
**/
|
||||||
VOID
|
VOID
|
||||||
SetRuntimeMemoryRangeAttributes (
|
SetRuntimeMemoryRangeAttributes (
|
||||||
IN PRM_RUNTIME_MMIO_RANGES *RuntimeMmioRanges
|
IN PRM_RUNTIME_MMIO_RANGES *RuntimeMmioRanges
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
EFI_STATUS Status2;
|
EFI_STATUS Status2;
|
||||||
UINTN Index;
|
UINTN Index;
|
||||||
EFI_GCD_MEMORY_SPACE_DESCRIPTOR Descriptor;
|
EFI_GCD_MEMORY_SPACE_DESCRIPTOR Descriptor;
|
||||||
|
|
||||||
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",
|
||||||
@ -94,24 +99,25 @@ SetRuntimeMemoryRangeAttributes (
|
|||||||
ASSERT ((RuntimeMmioRanges->Range[Index].Length & EFI_PAGE_MASK) == 0);
|
ASSERT ((RuntimeMmioRanges->Range[Index].Length & EFI_PAGE_MASK) == 0);
|
||||||
|
|
||||||
Status2 = EFI_NOT_FOUND;
|
Status2 = EFI_NOT_FOUND;
|
||||||
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,
|
||||||
(UINT64) RuntimeMmioRanges->Range[Index].Length,
|
(UINT64)RuntimeMmioRanges->Range[Index].Length,
|
||||||
EFI_MEMORY_UC | EFI_MEMORY_RUNTIME
|
EFI_MEMORY_UC | EFI_MEMORY_RUNTIME
|
||||||
);
|
);
|
||||||
ASSERT_EFI_ERROR (Status);
|
ASSERT_EFI_ERROR (Status);
|
||||||
@ -120,7 +126,7 @@ SetRuntimeMemoryRangeAttributes (
|
|||||||
EfiGcdAllocateAddress,
|
EfiGcdAllocateAddress,
|
||||||
EfiGcdMemoryTypeMemoryMappedIo,
|
EfiGcdMemoryTypeMemoryMappedIo,
|
||||||
0,
|
0,
|
||||||
(UINT64) RuntimeMmioRanges->Range[Index].Length,
|
(UINT64)RuntimeMmioRanges->Range[Index].Length,
|
||||||
&RuntimeMmioRanges->Range[Index].PhysicalBaseAddress,
|
&RuntimeMmioRanges->Range[Index].PhysicalBaseAddress,
|
||||||
gImageHandle,
|
gImageHandle,
|
||||||
NULL
|
NULL
|
||||||
@ -141,13 +147,14 @@ SetRuntimeMemoryRangeAttributes (
|
|||||||
));
|
));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((Descriptor.Attributes & EFI_MEMORY_RUNTIME) != 0) {
|
if ((Descriptor.Attributes & EFI_MEMORY_RUNTIME) != 0) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
Status = gDS->SetMemorySpaceAttributes (
|
Status = gDS->SetMemorySpaceAttributes (
|
||||||
RuntimeMmioRanges->Range[Index].PhysicalBaseAddress,
|
RuntimeMmioRanges->Range[Index].PhysicalBaseAddress,
|
||||||
(UINT64) RuntimeMmioRanges->Range[Index].Length,
|
(UINT64)RuntimeMmioRanges->Range[Index].Length,
|
||||||
Descriptor.Attributes | EFI_MEMORY_RUNTIME
|
Descriptor.Attributes | EFI_MEMORY_RUNTIME
|
||||||
);
|
);
|
||||||
ASSERT_EFI_ERROR (Status);
|
ASSERT_EFI_ERROR (Status);
|
||||||
@ -175,19 +182,19 @@ StoreVirtualMemoryAddressChangePointers (
|
|||||||
VOID
|
VOID
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
UINTN HandleCount;
|
UINTN HandleCount;
|
||||||
UINTN HandleIndex;
|
UINTN HandleIndex;
|
||||||
UINTN RangeIndex;
|
UINTN RangeIndex;
|
||||||
EFI_HANDLE *HandleBuffer;
|
EFI_HANDLE *HandleBuffer;
|
||||||
PRM_CONFIG_PROTOCOL *PrmConfigProtocol;
|
PRM_CONFIG_PROTOCOL *PrmConfigProtocol;
|
||||||
|
|
||||||
DEBUG ((DEBUG_INFO, "%a %a - Entry.\n", _DBGMSGID_, __FUNCTION__));
|
DEBUG ((DEBUG_INFO, "%a %a - Entry.\n", _DBGMSGID_, __FUNCTION__));
|
||||||
|
|
||||||
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",
|
||||||
@ -199,22 +206,22 @@ StoreVirtualMemoryAddressChangePointers (
|
|||||||
}
|
}
|
||||||
|
|
||||||
HandleBuffer = NULL;
|
HandleBuffer = NULL;
|
||||||
Status = gBS->LocateHandleBuffer (
|
Status = gBS->LocateHandleBuffer (
|
||||||
ByProtocol,
|
ByProtocol,
|
||||||
&gPrmConfigProtocolGuid,
|
&gPrmConfigProtocolGuid,
|
||||||
NULL,
|
NULL,
|
||||||
&HandleCount,
|
&HandleCount,
|
||||||
&HandleBuffer
|
&HandleBuffer
|
||||||
);
|
);
|
||||||
if (!EFI_ERROR (Status)) {
|
if (!EFI_ERROR (Status)) {
|
||||||
for (HandleIndex = 0; HandleIndex < HandleCount; HandleIndex++) {
|
for (HandleIndex = 0; HandleIndex < HandleCount; HandleIndex++) {
|
||||||
Status = gBS->HandleProtocol (
|
Status = gBS->HandleProtocol (
|
||||||
HandleBuffer[HandleIndex],
|
HandleBuffer[HandleIndex],
|
||||||
&gPrmConfigProtocolGuid,
|
&gPrmConfigProtocolGuid,
|
||||||
(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",
|
||||||
@ -260,7 +269,7 @@ StoreVirtualMemoryAddressChangePointers (
|
|||||||
**/
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
ValidatePrmDataBuffer (
|
ValidatePrmDataBuffer (
|
||||||
IN CONST PRM_DATA_BUFFER *PrmDataBuffer
|
IN CONST PRM_DATA_BUFFER *PrmDataBuffer
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
if (PrmDataBuffer == NULL) {
|
if (PrmDataBuffer == NULL) {
|
||||||
@ -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;
|
||||||
@ -293,7 +303,7 @@ ValidatePrmDataBuffer (
|
|||||||
**/
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
ValidatePrmContextBuffer (
|
ValidatePrmContextBuffer (
|
||||||
IN CONST PRM_CONTEXT_BUFFER *PrmContextBuffer
|
IN CONST PRM_CONTEXT_BUFFER *PrmContextBuffer
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
if (PrmContextBuffer == NULL) {
|
if (PrmContextBuffer == NULL) {
|
||||||
@ -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",
|
||||||
@ -337,11 +347,11 @@ ValidatePrmContextBuffer (
|
|||||||
VOID
|
VOID
|
||||||
EFIAPI
|
EFIAPI
|
||||||
PrmConfigVirtualAddressChangeEvent (
|
PrmConfigVirtualAddressChangeEvent (
|
||||||
IN EFI_EVENT Event,
|
IN EFI_EVENT Event,
|
||||||
IN VOID *Context
|
IN VOID *Context
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
UINTN Index;
|
UINTN Index;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Convert runtime MMIO ranges
|
// Convert runtime MMIO ranges
|
||||||
@ -365,47 +375,47 @@ PrmConfigVirtualAddressChangeEvent (
|
|||||||
VOID
|
VOID
|
||||||
EFIAPI
|
EFIAPI
|
||||||
PrmConfigEndOfDxeNotification (
|
PrmConfigEndOfDxeNotification (
|
||||||
IN EFI_EVENT Event,
|
IN EFI_EVENT Event,
|
||||||
IN VOID *Context
|
IN VOID *Context
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
UINTN HandleCount;
|
UINTN HandleCount;
|
||||||
UINTN BufferIndex;
|
UINTN BufferIndex;
|
||||||
UINTN HandleIndex;
|
UINTN HandleIndex;
|
||||||
EFI_HANDLE *HandleBuffer;
|
EFI_HANDLE *HandleBuffer;
|
||||||
PRM_CONTEXT_BUFFER *CurrentContextBuffer;
|
PRM_CONTEXT_BUFFER *CurrentContextBuffer;
|
||||||
PRM_CONFIG_PROTOCOL *PrmConfigProtocol;
|
PRM_CONFIG_PROTOCOL *PrmConfigProtocol;
|
||||||
|
|
||||||
DEBUG ((DEBUG_INFO, "%a %a - Entry.\n", _DBGMSGID_, __FUNCTION__));
|
DEBUG ((DEBUG_INFO, "%a %a - Entry.\n", _DBGMSGID_, __FUNCTION__));
|
||||||
|
|
||||||
HandleBuffer = NULL;
|
HandleBuffer = NULL;
|
||||||
Status = gBS->LocateHandleBuffer (
|
Status = gBS->LocateHandleBuffer (
|
||||||
ByProtocol,
|
ByProtocol,
|
||||||
&gPrmConfigProtocolGuid,
|
&gPrmConfigProtocolGuid,
|
||||||
NULL,
|
NULL,
|
||||||
&HandleCount,
|
&HandleCount,
|
||||||
&HandleBuffer
|
&HandleBuffer
|
||||||
);
|
);
|
||||||
if (!EFI_ERROR (Status)) {
|
if (!EFI_ERROR (Status)) {
|
||||||
for (HandleIndex = 0; HandleIndex < HandleCount; HandleIndex++) {
|
for (HandleIndex = 0; HandleIndex < HandleCount; HandleIndex++) {
|
||||||
Status = gBS->HandleProtocol (
|
Status = gBS->HandleProtocol (
|
||||||
HandleBuffer[HandleIndex],
|
HandleBuffer[HandleIndex],
|
||||||
&gPrmConfigProtocolGuid,
|
&gPrmConfigProtocolGuid,
|
||||||
(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;
|
||||||
}
|
}
|
||||||
|
|
||||||
DEBUG ((
|
DEBUG ((
|
||||||
DEBUG_INFO,
|
DEBUG_INFO,
|
||||||
" %a %a: Found PRM configuration protocol for PRM module %g.\n",
|
" %a %a: Found PRM configuration protocol for PRM module %g.\n",
|
||||||
_DBGMSGID_,
|
_DBGMSGID_,
|
||||||
__FUNCTION__,
|
__FUNCTION__,
|
||||||
&PrmConfigProtocol->ModuleContextBuffers.ModuleGuid
|
&PrmConfigProtocol->ModuleContextBuffers.ModuleGuid
|
||||||
));
|
));
|
||||||
|
|
||||||
DEBUG ((DEBUG_INFO, " %a %a: Validating module context buffers...\n", _DBGMSGID_, __FUNCTION__));
|
DEBUG ((DEBUG_INFO, " %a %a: Validating module context buffers...\n", _DBGMSGID_, __FUNCTION__));
|
||||||
for (BufferIndex = 0; BufferIndex < PrmConfigProtocol->ModuleContextBuffers.BufferCount; BufferIndex++) {
|
for (BufferIndex = 0; BufferIndex < PrmConfigProtocol->ModuleContextBuffers.BufferCount; BufferIndex++) {
|
||||||
@ -422,16 +432,17 @@ 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) {
|
||||||
DEBUG ((
|
DEBUG ((
|
||||||
DEBUG_INFO,
|
DEBUG_INFO,
|
||||||
" %a %a: Found %d PRM runtime MMIO ranges.\n",
|
" %a %a: Found %d PRM runtime MMIO ranges.\n",
|
||||||
_DBGMSGID_,
|
_DBGMSGID_,
|
||||||
__FUNCTION__,
|
__FUNCTION__,
|
||||||
PrmConfigProtocol->ModuleContextBuffers.RuntimeMmioRanges->Count
|
PrmConfigProtocol->ModuleContextBuffers.RuntimeMmioRanges->Count
|
||||||
));
|
));
|
||||||
SetRuntimeMemoryRangeAttributes (PrmConfigProtocol->ModuleContextBuffers.RuntimeMmioRanges);
|
SetRuntimeMemoryRangeAttributes (PrmConfigProtocol->ModuleContextBuffers.RuntimeMmioRanges);
|
||||||
mMaxRuntimeMmioRangeCount++;
|
mMaxRuntimeMmioRangeCount++;
|
||||||
}
|
}
|
||||||
@ -443,7 +454,8 @@ PrmConfigEndOfDxeNotification (
|
|||||||
if (HandleBuffer != NULL) {
|
if (HandleBuffer != NULL) {
|
||||||
gBS->FreePool (HandleBuffer);
|
gBS->FreePool (HandleBuffer);
|
||||||
}
|
}
|
||||||
gBS->CloseEvent(Event);
|
|
||||||
|
gBS->CloseEvent (Event);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -459,19 +471,19 @@ PrmConfigEndOfDxeNotification (
|
|||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
PrmConfigEntryPoint (
|
PrmConfigEntryPoint (
|
||||||
IN EFI_HANDLE ImageHandle,
|
IN EFI_HANDLE ImageHandle,
|
||||||
IN EFI_SYSTEM_TABLE *SystemTable
|
IN EFI_SYSTEM_TABLE *SystemTable
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
EFI_EVENT Event;
|
EFI_EVENT Event;
|
||||||
|
|
||||||
DEBUG ((DEBUG_INFO, "%a %a - Entry.\n", _DBGMSGID_, __FUNCTION__));
|
DEBUG ((DEBUG_INFO, "%a %a - Entry.\n", _DBGMSGID_, __FUNCTION__));
|
||||||
|
|
||||||
//
|
//
|
||||||
// Register a notification function to change memory attributes at end of DXE
|
// Register a notification function to change memory attributes at end of DXE
|
||||||
//
|
//
|
||||||
Event = NULL;
|
Event = NULL;
|
||||||
Status = gBS->CreateEventEx (
|
Status = gBS->CreateEventEx (
|
||||||
EVT_NOTIFY_SIGNAL,
|
EVT_NOTIFY_SIGNAL,
|
||||||
TPL_CALLBACK,
|
TPL_CALLBACK,
|
||||||
@ -485,7 +497,7 @@ PrmConfigEntryPoint (
|
|||||||
//
|
//
|
||||||
// Register a notification function for virtual address change
|
// Register a notification function for virtual address change
|
||||||
//
|
//
|
||||||
Event = NULL;
|
Event = NULL;
|
||||||
Status = gBS->CreateEventEx (
|
Status = gBS->CreateEventEx (
|
||||||
EVT_NOTIFY_SIGNAL,
|
EVT_NOTIFY_SIGNAL,
|
||||||
TPL_NOTIFY,
|
TPL_NOTIFY,
|
||||||
|
@ -14,11 +14,11 @@
|
|||||||
#include <Base.h>
|
#include <Base.h>
|
||||||
#include <IndustryStandard/Acpi10.h>
|
#include <IndustryStandard/Acpi10.h>
|
||||||
|
|
||||||
#define PRM_TABLE_SIGNATURE SIGNATURE_32 ('P', 'R', 'M', 'T')
|
#define PRM_TABLE_SIGNATURE SIGNATURE_32 ('P', 'R', 'M', 'T')
|
||||||
|
|
||||||
#define PRM_TABLE_REVISION 0x0
|
#define PRM_TABLE_REVISION 0x0
|
||||||
#define PRM_MODULE_INFORMATION_STRUCT_REVISION 0x00
|
#define PRM_MODULE_INFORMATION_STRUCT_REVISION 0x00
|
||||||
#define PRM_HANDLER_INFORMATION_STRUCT_REVISION 0x00
|
#define PRM_HANDLER_INFORMATION_STRUCT_REVISION 0x00
|
||||||
|
|
||||||
#pragma pack(push, 1)
|
#pragma pack(push, 1)
|
||||||
|
|
||||||
@ -26,13 +26,13 @@
|
|||||||
// Platform Runtime Mechanism (PRM) ACPI Table (PRMT) structures
|
// Platform Runtime Mechanism (PRM) ACPI Table (PRMT) structures
|
||||||
//
|
//
|
||||||
typedef struct {
|
typedef struct {
|
||||||
UINT16 StructureRevision; ///< Revision of this structure
|
UINT16 StructureRevision; ///< Revision of this structure
|
||||||
UINT16 StructureLength; ///< Length in bytes of this structure
|
UINT16 StructureLength; ///< Length in bytes of this structure
|
||||||
GUID Identifier; ///< GUID of the PRM handler for this structure
|
GUID Identifier; ///< GUID of the PRM handler for this structure
|
||||||
UINT64 PhysicalAddress; ///< Physical address of this PRM handler
|
UINT64 PhysicalAddress; ///< Physical address of this PRM handler
|
||||||
UINT64 StaticDataBuffer; ///< Physical address of the static data buffer for
|
UINT64 StaticDataBuffer; ///< Physical address of the static data buffer for
|
||||||
///< this PRM handler (PRM_DATA_BUFFER *)
|
///< this PRM handler (PRM_DATA_BUFFER *)
|
||||||
UINT64 AcpiParameterBuffer; ///< Physical address of the parameter buffer
|
UINT64 AcpiParameterBuffer; ///< Physical address of the parameter buffer
|
||||||
///< for this PRM handler (PRM_DATA_BUFFER *)
|
///< for this PRM handler (PRM_DATA_BUFFER *)
|
||||||
///< that is only used in the case of _DSM invocation.
|
///< that is only used in the case of _DSM invocation.
|
||||||
///< If _DSM invocation is not used, this value is
|
///< If _DSM invocation is not used, this value is
|
||||||
@ -40,29 +40,29 @@ typedef struct {
|
|||||||
} PRM_HANDLER_INFORMATION_STRUCT;
|
} PRM_HANDLER_INFORMATION_STRUCT;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
UINT16 StructureRevision; ///< Revision of this structure
|
UINT16 StructureRevision; ///< Revision of this structure
|
||||||
UINT16 StructureLength; ///< Length in bytes of this structure including the
|
UINT16 StructureLength; ///< Length in bytes of this structure including the
|
||||||
///< variable length PRM Handler Info array
|
///< variable length PRM Handler Info array
|
||||||
GUID Identifier; ///< GUID of the PRM module for this structure
|
GUID Identifier; ///< GUID of the PRM module for this structure
|
||||||
UINT16 MajorRevision; ///< PRM module major revision
|
UINT16 MajorRevision; ///< PRM module major revision
|
||||||
UINT16 MinorRevision; ///< PRM module minor revision
|
UINT16 MinorRevision; ///< PRM module minor revision
|
||||||
UINT16 HandlerCount; ///< Number of entries in the Handler Info array
|
UINT16 HandlerCount; ///< Number of entries in the Handler Info array
|
||||||
UINT32 HandlerInfoOffset; ///< Offset in bytes from the beginning of this
|
UINT32 HandlerInfoOffset; ///< Offset in bytes from the beginning of this
|
||||||
///< structure to the Handler Info array
|
///< structure to the Handler Info array
|
||||||
UINT64 RuntimeMmioRanges; ///< Physical address of the PRM MMIO Ranges
|
UINT64 RuntimeMmioRanges; ///< Physical address of the PRM MMIO Ranges
|
||||||
///< structure (PRM_MODULE_RUNTIME_MMIO_RANGES *)
|
///< structure (PRM_MODULE_RUNTIME_MMIO_RANGES *)
|
||||||
PRM_HANDLER_INFORMATION_STRUCT HandlerInfoStructure[1];
|
PRM_HANDLER_INFORMATION_STRUCT HandlerInfoStructure[1];
|
||||||
} PRM_MODULE_INFORMATION_STRUCT;
|
} PRM_MODULE_INFORMATION_STRUCT;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
EFI_ACPI_DESCRIPTION_HEADER Header; ///< Standard ACPI description header
|
EFI_ACPI_DESCRIPTION_HEADER Header; ///< Standard ACPI description header
|
||||||
GUID PrmPlatformGuid; ///< A GUID that uniquely identifies this platform.
|
GUID PrmPlatformGuid; ///< A GUID that uniquely identifies this platform.
|
||||||
///< Used to check for compatibility in PRM module
|
///< Used to check for compatibility in PRM module
|
||||||
///< runtime updates.
|
///< runtime updates.
|
||||||
UINT32 PrmModuleInfoOffset; ///< Offset in bytes from the beginning of this
|
UINT32 PrmModuleInfoOffset; ///< Offset in bytes from the beginning of this
|
||||||
///< structure to the PRM Module Info array
|
///< structure to the PRM Module Info array
|
||||||
UINT32 PrmModuleInfoCount; ///< Number of entries in the PRM Module Info array
|
UINT32 PrmModuleInfoCount; ///< Number of entries in the PRM Module Info array
|
||||||
PRM_MODULE_INFORMATION_STRUCT PrmModuleInfoStructure[1];
|
PRM_MODULE_INFORMATION_STRUCT PrmModuleInfoStructure[1];
|
||||||
} PRM_ACPI_DESCRIPTION_TABLE;
|
} PRM_ACPI_DESCRIPTION_TABLE;
|
||||||
|
|
||||||
#pragma pack(pop)
|
#pragma pack(pop)
|
||||||
@ -72,19 +72,19 @@ typedef struct {
|
|||||||
//
|
//
|
||||||
// Todo: Revisit whether to use; currently both macros are not used
|
// Todo: Revisit whether to use; currently both macros are not used
|
||||||
//
|
//
|
||||||
#define PRM_MODULE_INFORMATION_STRUCTURE(ModuleGuid, ModuleRevision, HandlerCount, PrmHanderInfoStructureArray) { \
|
#define PRM_MODULE_INFORMATION_STRUCTURE(ModuleGuid, ModuleRevision, HandlerCount, PrmHanderInfoStructureArray) { \
|
||||||
{ \
|
{ \
|
||||||
PRM_MODULE_INFORMATION_STRUCT_REVISION, /* UINT16 StructureRevision; */ \
|
PRM_MODULE_INFORMATION_STRUCT_REVISION, /* UINT16 StructureRevision; */ \
|
||||||
(OFFSET_OF (PRM_MODULE_INFORMATION_STRUCT, HandlerInfoStructure) + (HandlerCount * sizeof (PRM_HANDLER_INFORMATION_STRUCT))) /* UINT16 StructureLength; */ \
|
(OFFSET_OF (PRM_MODULE_INFORMATION_STRUCT, HandlerInfoStructure) + (HandlerCount * sizeof (PRM_HANDLER_INFORMATION_STRUCT))) /* UINT16 StructureLength; */ \
|
||||||
ModuleGuid, /* GUID ModuleGuid; */ \
|
ModuleGuid, /* GUID ModuleGuid; */ \
|
||||||
ModuleRevision, /* UINT16 ModuleRevision */ \
|
ModuleRevision, /* UINT16 ModuleRevision */ \
|
||||||
HandlerCount, /* UINT16 HandlerCount */ \
|
HandlerCount, /* UINT16 HandlerCount */ \
|
||||||
OFFSET_OF (PRM_MODULE_INFORMATION_STRUCT, HandlerInfoOffset), /* UINT32 HandlerInfoOffset */ \
|
OFFSET_OF (PRM_MODULE_INFORMATION_STRUCT, HandlerInfoOffset), /* UINT32 HandlerInfoOffset */ \
|
||||||
PrmHanderInfoStructureArray /* PRM_HANDLER_INFORMATION_STRUCT HandlerInfoStructure */ \
|
PrmHanderInfoStructureArray /* PRM_HANDLER_INFORMATION_STRUCT HandlerInfoStructure */ \
|
||||||
} \
|
} \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define PRM_HANDLER_INFORMATION_STRUCTURE(HandlerGuid, PhysicalAddress) { \
|
#define PRM_HANDLER_INFORMATION_STRUCTURE(HandlerGuid, PhysicalAddress) { \
|
||||||
{ \
|
{ \
|
||||||
PRM_HANDLER_INFORMATION_STRUCT_REVISION, /* UINT16 StructureRevision; */ \
|
PRM_HANDLER_INFORMATION_STRUCT_REVISION, /* UINT16 StructureRevision; */ \
|
||||||
sizeof (PRM_HANDLER_INFORMATION_STRUCT), /* UINT16 StructureLength; */ \
|
sizeof (PRM_HANDLER_INFORMATION_STRUCT), /* UINT16 StructureLength; */ \
|
||||||
|
@ -30,8 +30,8 @@
|
|||||||
|
|
||||||
#define _DBGMSGID_ "[PRMLOADER]"
|
#define _DBGMSGID_ "[PRMLOADER]"
|
||||||
|
|
||||||
UINTN mPrmHandlerCount;
|
UINTN mPrmHandlerCount;
|
||||||
UINTN mPrmModuleCount;
|
UINTN mPrmModuleCount;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Processes a list of PRM context entries to build a PRM ACPI table.
|
Processes a list of PRM context entries to build a PRM ACPI table.
|
||||||
@ -50,34 +50,35 @@ UINTN mPrmModuleCount;
|
|||||||
**/
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
ProcessPrmModules (
|
ProcessPrmModules (
|
||||||
OUT PRM_ACPI_DESCRIPTION_TABLE **PrmAcpiDescriptionTable
|
OUT PRM_ACPI_DESCRIPTION_TABLE **PrmAcpiDescriptionTable
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
EFI_IMAGE_EXPORT_DIRECTORY *CurrentImageExportDirectory;
|
EFI_IMAGE_EXPORT_DIRECTORY *CurrentImageExportDirectory;
|
||||||
PRM_MODULE_EXPORT_DESCRIPTOR_STRUCT *CurrentExportDescriptorStruct;
|
PRM_MODULE_EXPORT_DESCRIPTOR_STRUCT *CurrentExportDescriptorStruct;
|
||||||
PRM_ACPI_DESCRIPTION_TABLE *PrmAcpiTable;
|
PRM_ACPI_DESCRIPTION_TABLE *PrmAcpiTable;
|
||||||
PRM_MODULE_IMAGE_CONTEXT *CurrentPrmModuleImageContext;
|
PRM_MODULE_IMAGE_CONTEXT *CurrentPrmModuleImageContext;
|
||||||
CONST CHAR8 *CurrentExportDescriptorHandlerName;
|
CONST CHAR8 *CurrentExportDescriptorHandlerName;
|
||||||
|
|
||||||
ACPI_PARAMETER_BUFFER_DESCRIPTOR *CurrentModuleAcpiParamDescriptors;
|
ACPI_PARAMETER_BUFFER_DESCRIPTOR *CurrentModuleAcpiParamDescriptors;
|
||||||
PRM_CONTEXT_BUFFER *CurrentContextBuffer;
|
PRM_CONTEXT_BUFFER *CurrentContextBuffer;
|
||||||
PRM_MODULE_CONTEXT_BUFFERS *CurrentModuleContextBuffers;
|
PRM_MODULE_CONTEXT_BUFFERS *CurrentModuleContextBuffers;
|
||||||
PRM_MODULE_INFORMATION_STRUCT *CurrentModuleInfoStruct;
|
PRM_MODULE_INFORMATION_STRUCT *CurrentModuleInfoStruct;
|
||||||
PRM_HANDLER_INFORMATION_STRUCT *CurrentHandlerInfoStruct;
|
PRM_HANDLER_INFORMATION_STRUCT *CurrentHandlerInfoStruct;
|
||||||
|
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
EFI_PHYSICAL_ADDRESS CurrentImageAddress;
|
EFI_PHYSICAL_ADDRESS CurrentImageAddress;
|
||||||
UINTN AcpiParamIndex;
|
UINTN AcpiParamIndex;
|
||||||
UINTN HandlerIndex;
|
UINTN HandlerIndex;
|
||||||
UINT32 PrmAcpiDescriptionTableBufferSize;
|
UINT32 PrmAcpiDescriptionTableBufferSize;
|
||||||
|
|
||||||
UINT64 HandlerPhysicalAddress;
|
UINT64 HandlerPhysicalAddress;
|
||||||
|
|
||||||
DEBUG ((DEBUG_INFO, "%a %a - Entry.\n", _DBGMSGID_, __FUNCTION__));
|
DEBUG ((DEBUG_INFO, "%a %a - Entry.\n", _DBGMSGID_, __FUNCTION__));
|
||||||
|
|
||||||
if (PrmAcpiDescriptionTable == NULL) {
|
if (PrmAcpiDescriptionTable == NULL) {
|
||||||
return EFI_INVALID_PARAMETER;
|
return EFI_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
*PrmAcpiDescriptionTable = NULL;
|
*PrmAcpiDescriptionTable = NULL;
|
||||||
|
|
||||||
//
|
//
|
||||||
@ -96,42 +97,42 @@ ProcessPrmModules (
|
|||||||
DEBUG ((DEBUG_INFO, " %a %a: %d total PRM modules to process.\n", _DBGMSGID_, __FUNCTION__, mPrmModuleCount));
|
DEBUG ((DEBUG_INFO, " %a %a: %d total PRM modules to process.\n", _DBGMSGID_, __FUNCTION__, mPrmModuleCount));
|
||||||
DEBUG ((DEBUG_INFO, " %a %a: %d total PRM handlers to process.\n", _DBGMSGID_, __FUNCTION__, mPrmHandlerCount));
|
DEBUG ((DEBUG_INFO, " %a %a: %d total PRM handlers to process.\n", _DBGMSGID_, __FUNCTION__, mPrmHandlerCount));
|
||||||
|
|
||||||
PrmAcpiDescriptionTableBufferSize = (UINT32) (OFFSET_OF (PRM_ACPI_DESCRIPTION_TABLE, PrmModuleInfoStructure) +
|
PrmAcpiDescriptionTableBufferSize = (UINT32)(OFFSET_OF (PRM_ACPI_DESCRIPTION_TABLE, PrmModuleInfoStructure) +
|
||||||
(OFFSET_OF (PRM_MODULE_INFORMATION_STRUCT, HandlerInfoStructure) * mPrmModuleCount) +
|
(OFFSET_OF (PRM_MODULE_INFORMATION_STRUCT, HandlerInfoStructure) * mPrmModuleCount) +
|
||||||
(sizeof (PRM_HANDLER_INFORMATION_STRUCT) * mPrmHandlerCount)
|
(sizeof (PRM_HANDLER_INFORMATION_STRUCT) * mPrmHandlerCount)
|
||||||
);
|
);
|
||||||
DEBUG ((DEBUG_INFO, " %a %a: Total PRM ACPI table size: 0x%x.\n", _DBGMSGID_, __FUNCTION__, PrmAcpiDescriptionTableBufferSize));
|
DEBUG ((DEBUG_INFO, " %a %a: Total PRM ACPI table size: 0x%x.\n", _DBGMSGID_, __FUNCTION__, PrmAcpiDescriptionTableBufferSize));
|
||||||
|
|
||||||
PrmAcpiTable = AllocateZeroPool ((UINTN) PrmAcpiDescriptionTableBufferSize);
|
PrmAcpiTable = AllocateZeroPool ((UINTN)PrmAcpiDescriptionTableBufferSize);
|
||||||
if (PrmAcpiTable == NULL) {
|
if (PrmAcpiTable == NULL) {
|
||||||
return EFI_OUT_OF_RESOURCES;
|
return EFI_OUT_OF_RESOURCES;
|
||||||
}
|
}
|
||||||
|
|
||||||
PrmAcpiTable->Header.Signature = PRM_TABLE_SIGNATURE;
|
PrmAcpiTable->Header.Signature = PRM_TABLE_SIGNATURE;
|
||||||
PrmAcpiTable->Header.Length = PrmAcpiDescriptionTableBufferSize;
|
PrmAcpiTable->Header.Length = PrmAcpiDescriptionTableBufferSize;
|
||||||
PrmAcpiTable->Header.Revision = PRM_TABLE_REVISION;
|
PrmAcpiTable->Header.Revision = PRM_TABLE_REVISION;
|
||||||
PrmAcpiTable->Header.Checksum = 0x0;
|
PrmAcpiTable->Header.Checksum = 0x0;
|
||||||
CopyMem (&PrmAcpiTable->Header.OemId, PcdGetPtr (PcdAcpiDefaultOemId), sizeof (PrmAcpiTable->Header.OemId));
|
CopyMem (&PrmAcpiTable->Header.OemId, PcdGetPtr (PcdAcpiDefaultOemId), sizeof (PrmAcpiTable->Header.OemId));
|
||||||
PrmAcpiTable->Header.OemTableId = PcdGet64 (PcdAcpiDefaultOemTableId);
|
PrmAcpiTable->Header.OemTableId = PcdGet64 (PcdAcpiDefaultOemTableId);
|
||||||
PrmAcpiTable->Header.OemRevision = PcdGet32 (PcdAcpiDefaultOemRevision);
|
PrmAcpiTable->Header.OemRevision = PcdGet32 (PcdAcpiDefaultOemRevision);
|
||||||
PrmAcpiTable->Header.CreatorId = PcdGet32 (PcdAcpiDefaultCreatorId);
|
PrmAcpiTable->Header.CreatorId = PcdGet32 (PcdAcpiDefaultCreatorId);
|
||||||
PrmAcpiTable->Header.CreatorRevision = PcdGet32 (PcdAcpiDefaultCreatorRevision);
|
PrmAcpiTable->Header.CreatorRevision = PcdGet32 (PcdAcpiDefaultCreatorRevision);
|
||||||
CopyGuid (&PrmAcpiTable->PrmPlatformGuid, &gEdkiiDscPlatformGuid);
|
CopyGuid (&PrmAcpiTable->PrmPlatformGuid, &gEdkiiDscPlatformGuid);
|
||||||
PrmAcpiTable->PrmModuleInfoOffset = OFFSET_OF (PRM_ACPI_DESCRIPTION_TABLE, PrmModuleInfoStructure);
|
PrmAcpiTable->PrmModuleInfoOffset = OFFSET_OF (PRM_ACPI_DESCRIPTION_TABLE, PrmModuleInfoStructure);
|
||||||
PrmAcpiTable->PrmModuleInfoCount = (UINT32) mPrmModuleCount;
|
PrmAcpiTable->PrmModuleInfoCount = (UINT32)mPrmModuleCount;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Iterate across all PRM Modules on the list
|
// Iterate across all PRM Modules on the list
|
||||||
//
|
//
|
||||||
CurrentModuleInfoStruct = &PrmAcpiTable->PrmModuleInfoStructure[0];
|
CurrentModuleInfoStruct = &PrmAcpiTable->PrmModuleInfoStructure[0];
|
||||||
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;
|
||||||
CurrentModuleAcpiParamDescriptors = NULL;
|
CurrentModuleAcpiParamDescriptors = NULL;
|
||||||
|
|
||||||
DEBUG ((
|
DEBUG ((
|
||||||
@ -139,39 +140,39 @@ ProcessPrmModules (
|
|||||||
" %a %a: PRM Module - %a with %d handlers.\n",
|
" %a %a: PRM Module - %a with %d handlers.\n",
|
||||||
_DBGMSGID_,
|
_DBGMSGID_,
|
||||||
__FUNCTION__,
|
__FUNCTION__,
|
||||||
(CHAR8 *) ((UINTN) CurrentImageAddress + CurrentImageExportDirectory->Name),
|
(CHAR8 *)((UINTN)CurrentImageAddress + CurrentImageExportDirectory->Name),
|
||||||
CurrentExportDescriptorStruct->Header.NumberPrmHandlers
|
CurrentExportDescriptorStruct->Header.NumberPrmHandlers
|
||||||
));
|
));
|
||||||
|
|
||||||
CurrentModuleInfoStruct->StructureRevision = PRM_MODULE_INFORMATION_STRUCT_REVISION;
|
CurrentModuleInfoStruct->StructureRevision = PRM_MODULE_INFORMATION_STRUCT_REVISION;
|
||||||
CurrentModuleInfoStruct->StructureLength = (
|
CurrentModuleInfoStruct->StructureLength = (
|
||||||
OFFSET_OF (PRM_MODULE_INFORMATION_STRUCT, HandlerInfoStructure) +
|
OFFSET_OF (PRM_MODULE_INFORMATION_STRUCT, HandlerInfoStructure) +
|
||||||
(CurrentExportDescriptorStruct->Header.NumberPrmHandlers * sizeof (PRM_HANDLER_INFORMATION_STRUCT))
|
(CurrentExportDescriptorStruct->Header.NumberPrmHandlers * sizeof (PRM_HANDLER_INFORMATION_STRUCT))
|
||||||
);
|
);
|
||||||
CopyGuid (&CurrentModuleInfoStruct->Identifier, &CurrentExportDescriptorStruct->Header.ModuleGuid);
|
CopyGuid (&CurrentModuleInfoStruct->Identifier, &CurrentExportDescriptorStruct->Header.ModuleGuid);
|
||||||
CurrentModuleInfoStruct->HandlerCount = (UINT32) CurrentExportDescriptorStruct->Header.NumberPrmHandlers;
|
CurrentModuleInfoStruct->HandlerCount = (UINT32)CurrentExportDescriptorStruct->Header.NumberPrmHandlers;
|
||||||
CurrentModuleInfoStruct->HandlerInfoOffset = OFFSET_OF (PRM_MODULE_INFORMATION_STRUCT, HandlerInfoStructure);
|
CurrentModuleInfoStruct->HandlerInfoOffset = OFFSET_OF (PRM_MODULE_INFORMATION_STRUCT, HandlerInfoStructure);
|
||||||
|
|
||||||
CurrentModuleInfoStruct->MajorRevision = 0;
|
CurrentModuleInfoStruct->MajorRevision = 0;
|
||||||
CurrentModuleInfoStruct->MinorRevision = 0;
|
CurrentModuleInfoStruct->MinorRevision = 0;
|
||||||
Status = GetImageVersionInPeCoffImage (
|
Status = GetImageVersionInPeCoffImage (
|
||||||
(VOID *) (UINTN) CurrentImageAddress,
|
(VOID *)(UINTN)CurrentImageAddress,
|
||||||
&CurrentPrmModuleImageContext->PeCoffImageContext,
|
&CurrentPrmModuleImageContext->PeCoffImageContext,
|
||||||
&CurrentModuleInfoStruct->MajorRevision,
|
&CurrentModuleInfoStruct->MajorRevision,
|
||||||
&CurrentModuleInfoStruct->MinorRevision
|
&CurrentModuleInfoStruct->MinorRevision
|
||||||
);
|
);
|
||||||
ASSERT_EFI_ERROR (Status);
|
ASSERT_EFI_ERROR (Status);
|
||||||
|
|
||||||
// It is currently valid for a PRM module not to use a context buffer
|
// It is currently valid for a PRM module not to use a context buffer
|
||||||
Status = GetModuleContextBuffers (
|
Status = GetModuleContextBuffers (
|
||||||
ByModuleGuid,
|
ByModuleGuid,
|
||||||
&CurrentModuleInfoStruct->Identifier,
|
&CurrentModuleInfoStruct->Identifier,
|
||||||
(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;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@ -181,21 +182,21 @@ ProcessPrmModules (
|
|||||||
CurrentHandlerInfoStruct = &(CurrentModuleInfoStruct->HandlerInfoStructure[HandlerIndex]);
|
CurrentHandlerInfoStruct = &(CurrentModuleInfoStruct->HandlerInfoStructure[HandlerIndex]);
|
||||||
|
|
||||||
CurrentHandlerInfoStruct->StructureRevision = PRM_HANDLER_INFORMATION_STRUCT_REVISION;
|
CurrentHandlerInfoStruct->StructureRevision = PRM_HANDLER_INFORMATION_STRUCT_REVISION;
|
||||||
CurrentHandlerInfoStruct->StructureLength = sizeof (PRM_HANDLER_INFORMATION_STRUCT);
|
CurrentHandlerInfoStruct->StructureLength = sizeof (PRM_HANDLER_INFORMATION_STRUCT);
|
||||||
CopyGuid (
|
CopyGuid (
|
||||||
&CurrentHandlerInfoStruct->Identifier,
|
&CurrentHandlerInfoStruct->Identifier,
|
||||||
&CurrentExportDescriptorStruct->PrmHandlerExportDescriptors[HandlerIndex].PrmHandlerGuid
|
&CurrentExportDescriptorStruct->PrmHandlerExportDescriptors[HandlerIndex].PrmHandlerGuid
|
||||||
);
|
);
|
||||||
|
|
||||||
CurrentExportDescriptorHandlerName = (CONST CHAR8 *) CurrentExportDescriptorStruct->PrmHandlerExportDescriptors[HandlerIndex].PrmHandlerName;
|
CurrentExportDescriptorHandlerName = (CONST CHAR8 *)CurrentExportDescriptorStruct->PrmHandlerExportDescriptors[HandlerIndex].PrmHandlerName;
|
||||||
|
|
||||||
Status = GetContextBuffer (
|
Status = GetContextBuffer (
|
||||||
&CurrentHandlerInfoStruct->Identifier,
|
&CurrentHandlerInfoStruct->Identifier,
|
||||||
CurrentModuleContextBuffers,
|
CurrentModuleContextBuffers,
|
||||||
(CONST PRM_CONTEXT_BUFFER **) &CurrentContextBuffer
|
(CONST PRM_CONTEXT_BUFFER **)&CurrentContextBuffer
|
||||||
);
|
);
|
||||||
if (!EFI_ERROR (Status)) {
|
if (!EFI_ERROR (Status)) {
|
||||||
CurrentHandlerInfoStruct->StaticDataBuffer = (UINT64) (UINTN) CurrentContextBuffer->StaticDataBuffer;
|
CurrentHandlerInfoStruct->StaticDataBuffer = (UINT64)(UINTN)CurrentContextBuffer->StaticDataBuffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
Status = GetExportEntryAddress (
|
Status = GetExportEntryAddress (
|
||||||
@ -223,15 +224,17 @@ ProcessPrmModules (
|
|||||||
if (CurrentModuleAcpiParamDescriptors != NULL) {
|
if (CurrentModuleAcpiParamDescriptors != NULL) {
|
||||||
for (AcpiParamIndex = 0; AcpiParamIndex < CurrentModuleContextBuffers->AcpiParameterBufferDescriptorCount; AcpiParamIndex++) {
|
for (AcpiParamIndex = 0; AcpiParamIndex < CurrentModuleContextBuffers->AcpiParameterBufferDescriptorCount; AcpiParamIndex++) {
|
||||||
if (CompareGuid (&CurrentModuleAcpiParamDescriptors[AcpiParamIndex].HandlerGuid, &CurrentHandlerInfoStruct->Identifier)) {
|
if (CompareGuid (&CurrentModuleAcpiParamDescriptors[AcpiParamIndex].HandlerGuid, &CurrentHandlerInfoStruct->Identifier)) {
|
||||||
CurrentHandlerInfoStruct->AcpiParameterBuffer = (UINT64) (UINTN) (
|
CurrentHandlerInfoStruct->AcpiParameterBuffer = (UINT64)(UINTN)(
|
||||||
CurrentModuleAcpiParamDescriptors[AcpiParamIndex].AcpiParameterBufferAddress
|
CurrentModuleAcpiParamDescriptors[AcpiParamIndex].AcpiParameterBufferAddress
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
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;
|
||||||
@ -252,18 +255,18 @@ ProcessPrmModules (
|
|||||||
**/
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
PublishPrmAcpiTable (
|
PublishPrmAcpiTable (
|
||||||
IN PRM_ACPI_DESCRIPTION_TABLE *PrmAcpiDescriptionTable
|
IN PRM_ACPI_DESCRIPTION_TABLE *PrmAcpiDescriptionTable
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
Status = gBS->LocateProtocol (&gEfiAcpiTableProtocolGuid, NULL, (VOID **) &AcpiTableProtocol);
|
Status = gBS->LocateProtocol (&gEfiAcpiTableProtocolGuid, NULL, (VOID **)&AcpiTableProtocol);
|
||||||
if (!EFI_ERROR (Status)) {
|
if (!EFI_ERROR (Status)) {
|
||||||
TableKey = 0;
|
TableKey = 0;
|
||||||
//
|
//
|
||||||
@ -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;
|
||||||
@ -305,12 +309,12 @@ PublishPrmAcpiTable (
|
|||||||
VOID
|
VOID
|
||||||
EFIAPI
|
EFIAPI
|
||||||
PrmLoaderEndOfDxeNotification (
|
PrmLoaderEndOfDxeNotification (
|
||||||
IN EFI_EVENT Event,
|
IN EFI_EVENT Event,
|
||||||
IN VOID *Context
|
IN VOID *Context
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
PRM_ACPI_DESCRIPTION_TABLE *PrmAcpiDescriptionTable;
|
PRM_ACPI_DESCRIPTION_TABLE *PrmAcpiDescriptionTable;
|
||||||
|
|
||||||
DEBUG ((DEBUG_INFO, "%a %a - Entry.\n", _DBGMSGID_, __FUNCTION__));
|
DEBUG ((DEBUG_INFO, "%a %a - Entry.\n", _DBGMSGID_, __FUNCTION__));
|
||||||
|
|
||||||
@ -326,6 +330,7 @@ PrmLoaderEndOfDxeNotification (
|
|||||||
if (PrmAcpiDescriptionTable != NULL) {
|
if (PrmAcpiDescriptionTable != NULL) {
|
||||||
FreePool (PrmAcpiDescriptionTable);
|
FreePool (PrmAcpiDescriptionTable);
|
||||||
}
|
}
|
||||||
|
|
||||||
gBS->CloseEvent (Event);
|
gBS->CloseEvent (Event);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -342,12 +347,12 @@ PrmLoaderEndOfDxeNotification (
|
|||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
PrmLoaderEntryPoint (
|
PrmLoaderEntryPoint (
|
||||||
IN EFI_HANDLE ImageHandle,
|
IN EFI_HANDLE ImageHandle,
|
||||||
IN EFI_SYSTEM_TABLE *SystemTable
|
IN EFI_SYSTEM_TABLE *SystemTable
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
EFI_EVENT EndOfDxeEvent;
|
EFI_EVENT EndOfDxeEvent;
|
||||||
|
|
||||||
DEBUG ((DEBUG_INFO, "%a %a - Entry.\n", _DBGMSGID_, __FUNCTION__));
|
DEBUG ((DEBUG_INFO, "%a %a - Entry.\n", _DBGMSGID_, __FUNCTION__));
|
||||||
|
|
||||||
@ -355,7 +360,7 @@ PrmLoaderEntryPoint (
|
|||||||
// Discover and process installed PRM modules at the End of DXE
|
// Discover and process installed PRM modules at the End of DXE
|
||||||
// The PRM ACPI table is published if one or PRM modules are discovered
|
// The PRM ACPI table is published if one or PRM modules are discovered
|
||||||
//
|
//
|
||||||
Status = gBS->CreateEventEx(
|
Status = gBS->CreateEventEx (
|
||||||
EVT_NOTIFY_SIGNAL,
|
EVT_NOTIFY_SIGNAL,
|
||||||
TPL_CALLBACK,
|
TPL_CALLBACK,
|
||||||
PrmLoaderEndOfDxeNotification,
|
PrmLoaderEndOfDxeNotification,
|
||||||
|
@ -33,14 +33,14 @@
|
|||||||
**/
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
InstallPrmSsdt (
|
InstallPrmSsdt (
|
||||||
IN CONST UINT8 *OemId
|
IN CONST UINT8 *OemId
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
UINTN SsdtSize;
|
UINTN SsdtSize;
|
||||||
UINTN TableKey;
|
UINTN TableKey;
|
||||||
EFI_ACPI_TABLE_PROTOCOL *AcpiTableProtocol;
|
EFI_ACPI_TABLE_PROTOCOL *AcpiTableProtocol;
|
||||||
EFI_ACPI_DESCRIPTION_HEADER *Ssdt;
|
EFI_ACPI_DESCRIPTION_HEADER *Ssdt;
|
||||||
|
|
||||||
DEBUG ((DEBUG_INFO, "%a %a - Entry.\n", _DBGMSGID_, __FUNCTION__));
|
DEBUG ((DEBUG_INFO, "%a %a - Entry.\n", _DBGMSGID_, __FUNCTION__));
|
||||||
|
|
||||||
@ -48,7 +48,7 @@ InstallPrmSsdt (
|
|||||||
return EFI_INVALID_PARAMETER;
|
return EFI_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
Status = gBS->LocateProtocol (&gEfiAcpiTableProtocolGuid, NULL, (VOID **) &AcpiTableProtocol);
|
Status = gBS->LocateProtocol (&gEfiAcpiTableProtocolGuid, NULL, (VOID **)&AcpiTableProtocol);
|
||||||
if (!EFI_ERROR (Status)) {
|
if (!EFI_ERROR (Status)) {
|
||||||
//
|
//
|
||||||
// Discover the SSDT
|
// Discover the SSDT
|
||||||
@ -57,7 +57,7 @@ InstallPrmSsdt (
|
|||||||
&gEfiCallerIdGuid,
|
&gEfiCallerIdGuid,
|
||||||
EFI_SECTION_RAW,
|
EFI_SECTION_RAW,
|
||||||
0,
|
0,
|
||||||
(VOID **) &Ssdt,
|
(VOID **)&Ssdt,
|
||||||
&SsdtSize
|
&SsdtSize
|
||||||
);
|
);
|
||||||
ASSERT_EFI_ERROR (Status);
|
ASSERT_EFI_ERROR (Status);
|
||||||
@ -72,12 +72,12 @@ InstallPrmSsdt (
|
|||||||
// Publish the SSDT. Table is re-checksummed.
|
// Publish the SSDT. Table is re-checksummed.
|
||||||
//
|
//
|
||||||
TableKey = 0;
|
TableKey = 0;
|
||||||
Status = AcpiTableProtocol->InstallAcpiTable (
|
Status = AcpiTableProtocol->InstallAcpiTable (
|
||||||
AcpiTableProtocol,
|
AcpiTableProtocol,
|
||||||
Ssdt,
|
Ssdt,
|
||||||
SsdtSize,
|
SsdtSize,
|
||||||
&TableKey
|
&TableKey
|
||||||
);
|
);
|
||||||
ASSERT_EFI_ERROR (Status);
|
ASSERT_EFI_ERROR (Status);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -97,13 +97,13 @@ InstallPrmSsdt (
|
|||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
PrmSsdtInstallEntryPoint (
|
PrmSsdtInstallEntryPoint (
|
||||||
IN EFI_HANDLE ImageHandle,
|
IN EFI_HANDLE ImageHandle,
|
||||||
IN EFI_SYSTEM_TABLE *SystemTable
|
IN EFI_SYSTEM_TABLE *SystemTable
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
|
|
||||||
Status = InstallPrmSsdt ((UINT8 *) PcdGetPtr (PcdAcpiDefaultOemId));
|
Status = InstallPrmSsdt ((UINT8 *)PcdGetPtr (PcdAcpiDefaultOemId));
|
||||||
ASSERT_EFI_ERROR (Status);
|
ASSERT_EFI_ERROR (Status);
|
||||||
|
|
||||||
return Status;
|
return Status;
|
||||||
|
@ -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.
|
||||||
@ -34,8 +38,8 @@ STATIC CONST EFI_GUID mCheckParamBufferPrmHandlerGuid = {0x2e4f2d13, 0x6240, 0x4
|
|||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
AcpiParameterBufferModuleConfigLibConstructor (
|
AcpiParameterBufferModuleConfigLibConstructor (
|
||||||
IN EFI_HANDLE ImageHandle,
|
IN EFI_HANDLE ImageHandle,
|
||||||
IN EFI_SYSTEM_TABLE *SystemTable
|
IN EFI_SYSTEM_TABLE *SystemTable
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
@ -43,9 +47,9 @@ AcpiParameterBufferModuleConfigLibConstructor (
|
|||||||
ACPI_PARAMETER_BUFFER_DESCRIPTOR *AcpiParamBufferDescriptor;
|
ACPI_PARAMETER_BUFFER_DESCRIPTOR *AcpiParamBufferDescriptor;
|
||||||
PRM_CONFIG_PROTOCOL *PrmConfigProtocol;
|
PRM_CONFIG_PROTOCOL *PrmConfigProtocol;
|
||||||
|
|
||||||
AcpiParameterBuffer = NULL;
|
AcpiParameterBuffer = NULL;
|
||||||
AcpiParamBufferDescriptor = NULL;
|
AcpiParamBufferDescriptor = NULL;
|
||||||
PrmConfigProtocol = NULL;
|
PrmConfigProtocol = NULL;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
In this sample PRM module, the protocol describing this sample module's resources is simply
|
In this sample PRM module, the protocol describing this sample module's resources is simply
|
||||||
@ -82,15 +86,16 @@ 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
|
||||||
CopyGuid (&AcpiParamBufferDescriptor->HandlerGuid, &mCheckParamBufferPrmHandlerGuid);
|
CopyGuid (&AcpiParamBufferDescriptor->HandlerGuid, &mCheckParamBufferPrmHandlerGuid);
|
||||||
AcpiParamBufferDescriptor->AcpiParameterBufferAddress = (UINT64) (UINTN) AcpiParameterBuffer;
|
AcpiParamBufferDescriptor->AcpiParameterBufferAddress = (UINT64)(UINTN)AcpiParameterBuffer;
|
||||||
|
|
||||||
// Populate the PRM Module Context Buffers structure
|
// Populate the PRM Module Context Buffers structure
|
||||||
PrmConfigProtocol->ModuleContextBuffers.AcpiParameterBufferDescriptorCount = 1;
|
PrmConfigProtocol->ModuleContextBuffers.AcpiParameterBufferDescriptorCount = 1;
|
||||||
PrmConfigProtocol->ModuleContextBuffers.AcpiParameterBufferDescriptors = AcpiParamBufferDescriptor;
|
PrmConfigProtocol->ModuleContextBuffers.AcpiParameterBufferDescriptors = AcpiParamBufferDescriptor;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Install the PRM Configuration Protocol for this module. This indicates the configuration
|
// Install the PRM Configuration Protocol for this module. This indicates the configuration
|
||||||
@ -100,7 +105,7 @@ AcpiParameterBufferModuleConfigLibConstructor (
|
|||||||
&mPrmConfigProtocolHandle,
|
&mPrmConfigProtocolHandle,
|
||||||
&gPrmConfigProtocolGuid,
|
&gPrmConfigProtocolGuid,
|
||||||
EFI_NATIVE_INTERFACE,
|
EFI_NATIVE_INTERFACE,
|
||||||
(VOID *) PrmConfigProtocol
|
(VOID *)PrmConfigProtocol
|
||||||
);
|
);
|
||||||
|
|
||||||
Done:
|
Done:
|
||||||
@ -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);
|
||||||
}
|
}
|
||||||
|
@ -15,14 +15,14 @@
|
|||||||
// TEMP
|
// TEMP
|
||||||
#include <Library/DebugLib.h>
|
#include <Library/DebugLib.h>
|
||||||
|
|
||||||
#define PARAM_BUFFER_TEST_SIGNATURE SIGNATURE_32('T','E','S','T')
|
#define PARAM_BUFFER_TEST_SIGNATURE SIGNATURE_32('T','E','S','T')
|
||||||
|
|
||||||
//
|
//
|
||||||
// PRM Handler GUIDs
|
// PRM Handler GUIDs
|
||||||
//
|
//
|
||||||
|
|
||||||
// {2e4f2d13-6240-4ed0-a401-c723fbdc34e8}
|
// {2e4f2d13-6240-4ed0-a401-c723fbdc34e8}
|
||||||
#define CHECK_PARAM_BUFFER_PRM_HANDLER_GUID {0x2e4f2d13, 0x6240, 0x4ed0, {0xa4, 0x01, 0xc7, 0x23, 0xfb, 0xdc, 0x34, 0xe8}}
|
#define CHECK_PARAM_BUFFER_PRM_HANDLER_GUID {0x2e4f2d13, 0x6240, 0x4ed0, {0xa4, 0x01, 0xc7, 0x23, 0xfb, 0xdc, 0x34, 0xe8}}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
A sample Platform Runtime Mechanism (PRM) handler.
|
A sample Platform Runtime Mechanism (PRM) handler.
|
||||||
@ -39,13 +39,12 @@
|
|||||||
@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;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (*((UINT32 *) ParameterBuffer) == PARAM_BUFFER_TEST_SIGNATURE) {
|
if (*((UINT32 *)ParameterBuffer) == PARAM_BUFFER_TEST_SIGNATURE) {
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -71,8 +70,8 @@ PRM_MODULE_EXPORT (
|
|||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
PrmSampleAcpiParameterBufferModuleInit (
|
PrmSampleAcpiParameterBufferModuleInit (
|
||||||
IN EFI_HANDLE ImageHandle,
|
IN EFI_HANDLE ImageHandle,
|
||||||
IN EFI_SYSTEM_TABLE *SystemTable
|
IN EFI_SYSTEM_TABLE *SystemTable
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
|
@ -13,12 +13,12 @@
|
|||||||
|
|
||||||
#include <Base.h>
|
#include <Base.h>
|
||||||
|
|
||||||
#define SOME_VALUE_ARRAY_MAX_VALUES 16
|
#define SOME_VALUE_ARRAY_MAX_VALUES 16
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
BOOLEAN Policy1Enabled;
|
BOOLEAN Policy1Enabled;
|
||||||
BOOLEAN Policy2Enabled;
|
BOOLEAN Policy2Enabled;
|
||||||
UINT8 SomeValueArray[SOME_VALUE_ARRAY_MAX_VALUES];
|
UINT8 SomeValueArray[SOME_VALUE_ARRAY_MAX_VALUES];
|
||||||
} STATIC_DATA_SAMPLE_CONTEXT_BUFFER_MODULE;
|
} STATIC_DATA_SAMPLE_CONTEXT_BUFFER_MODULE;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -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.
|
||||||
@ -70,16 +74,17 @@ PopulateStaticDataBuffer (
|
|||||||
**/
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
GetStaticDataBuffer (
|
GetStaticDataBuffer (
|
||||||
OUT PRM_DATA_BUFFER **StaticDataBuffer
|
OUT PRM_DATA_BUFFER **StaticDataBuffer
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
PRM_DATA_BUFFER *DataBuffer;
|
PRM_DATA_BUFFER *DataBuffer;
|
||||||
UINTN DataBufferLength;
|
UINTN DataBufferLength;
|
||||||
|
|
||||||
if (StaticDataBuffer == NULL) {
|
if (StaticDataBuffer == NULL) {
|
||||||
return EFI_INVALID_PARAMETER;
|
return EFI_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
*StaticDataBuffer = NULL;
|
*StaticDataBuffer = NULL;
|
||||||
|
|
||||||
//
|
//
|
||||||
@ -96,9 +101,9 @@ GetStaticDataBuffer (
|
|||||||
// Initialize the data buffer header
|
// Initialize the data buffer header
|
||||||
//
|
//
|
||||||
DataBuffer->Header.Signature = PRM_DATA_BUFFER_HEADER_SIGNATURE;
|
DataBuffer->Header.Signature = PRM_DATA_BUFFER_HEADER_SIGNATURE;
|
||||||
DataBuffer->Header.Length = (UINT32) DataBufferLength;
|
DataBuffer->Header.Length = (UINT32)DataBufferLength;
|
||||||
|
|
||||||
Status = PopulateStaticDataBuffer ((STATIC_DATA_SAMPLE_CONTEXT_BUFFER_MODULE *) &DataBuffer->Data[0]);
|
Status = PopulateStaticDataBuffer ((STATIC_DATA_SAMPLE_CONTEXT_BUFFER_MODULE *)&DataBuffer->Data[0]);
|
||||||
ASSERT_EFI_ERROR (Status);
|
ASSERT_EFI_ERROR (Status);
|
||||||
|
|
||||||
*StaticDataBuffer = DataBuffer;
|
*StaticDataBuffer = DataBuffer;
|
||||||
@ -117,17 +122,17 @@ GetStaticDataBuffer (
|
|||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
ContextBufferModuleConfigLibConstructor (
|
ContextBufferModuleConfigLibConstructor (
|
||||||
IN EFI_HANDLE ImageHandle,
|
IN EFI_HANDLE ImageHandle,
|
||||||
IN EFI_SYSTEM_TABLE *SystemTable
|
IN EFI_SYSTEM_TABLE *SystemTable
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
PRM_CONTEXT_BUFFER *PrmContextBuffer;
|
PRM_CONTEXT_BUFFER *PrmContextBuffer;
|
||||||
PRM_DATA_BUFFER *StaticDataBuffer;
|
PRM_DATA_BUFFER *StaticDataBuffer;
|
||||||
PRM_CONFIG_PROTOCOL *PrmConfigProtocol;
|
PRM_CONFIG_PROTOCOL *PrmConfigProtocol;
|
||||||
|
|
||||||
PrmContextBuffer = NULL;
|
PrmContextBuffer = NULL;
|
||||||
StaticDataBuffer = NULL;
|
StaticDataBuffer = NULL;
|
||||||
PrmConfigProtocol = NULL;
|
PrmConfigProtocol = 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,9 +171,10 @@ 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;
|
||||||
PrmContextBuffer->StaticDataBuffer = StaticDataBuffer;
|
PrmContextBuffer->StaticDataBuffer = StaticDataBuffer;
|
||||||
|
|
||||||
PrmConfigProtocol = AllocateZeroPool (sizeof (*PrmConfigProtocol));
|
PrmConfigProtocol = AllocateZeroPool (sizeof (*PrmConfigProtocol));
|
||||||
@ -177,9 +183,10 @@ 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;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Install the PRM Configuration Protocol for this module. This indicates the configuration
|
// Install the PRM Configuration Protocol for this module. This indicates the configuration
|
||||||
@ -189,7 +196,7 @@ ContextBufferModuleConfigLibConstructor (
|
|||||||
&mPrmConfigProtocolHandle,
|
&mPrmConfigProtocolHandle,
|
||||||
&gPrmConfigProtocolGuid,
|
&gPrmConfigProtocolGuid,
|
||||||
EFI_NATIVE_INTERFACE,
|
EFI_NATIVE_INTERFACE,
|
||||||
(VOID *) PrmConfigProtocol
|
(VOID *)PrmConfigProtocol
|
||||||
);
|
);
|
||||||
|
|
||||||
Done:
|
Done:
|
||||||
@ -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);
|
||||||
}
|
}
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
//
|
//
|
||||||
|
|
||||||
// {e1466081-7562-430f-896b-b0e523dc335a}
|
// {e1466081-7562-430f-896b-b0e523dc335a}
|
||||||
#define CHECK_STATIC_DATA_BUFFER_PRM_HANDLER_GUID {0xe1466081, 0x7562, 0x430f, {0x89, 0x6b, 0xb0, 0xe5, 0x23, 0xdc, 0x33, 0x5a}}
|
#define CHECK_STATIC_DATA_BUFFER_PRM_HANDLER_GUID {0xe1466081, 0x7562, 0x430f, {0x89, 0x6b, 0xb0, 0xe5, 0x23, 0xdc, 0x33, 0x5a}}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
A sample Platform Runtime Mechanism (PRM) handler.
|
A sample Platform Runtime Mechanism (PRM) handler.
|
||||||
@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -76,8 +76,8 @@ PRM_MODULE_EXPORT (
|
|||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
PrmSampleContextBufferModuleInit (
|
PrmSampleContextBufferModuleInit (
|
||||||
IN EFI_HANDLE ImageHandle,
|
IN EFI_HANDLE ImageHandle,
|
||||||
IN EFI_SYSTEM_TABLE *SystemTable
|
IN EFI_SYSTEM_TABLE *SystemTable
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
|
@ -15,8 +15,8 @@
|
|||||||
#ifndef HPET_REGISTER_H_
|
#ifndef HPET_REGISTER_H_
|
||||||
#define HPET_REGISTER_H_
|
#define HPET_REGISTER_H_
|
||||||
|
|
||||||
#define HPET_BASE_ADDRESS 0xFED00000
|
#define HPET_BASE_ADDRESS 0xFED00000
|
||||||
#define HPET_RANGE_LENGTH 0x1000
|
#define HPET_RANGE_LENGTH 0x1000
|
||||||
|
|
||||||
///
|
///
|
||||||
/// HPET General Register Offsets
|
/// HPET General Register Offsets
|
||||||
@ -28,15 +28,15 @@
|
|||||||
///
|
///
|
||||||
/// HPET Timer Register Offsets
|
/// HPET Timer Register Offsets
|
||||||
///
|
///
|
||||||
#define HPET_MAIN_COUNTER_OFFSET 0x0F0
|
#define HPET_MAIN_COUNTER_OFFSET 0x0F0
|
||||||
#define HPET_TIMER_CONFIGURATION_OFFSET 0x100
|
#define HPET_TIMER_CONFIGURATION_OFFSET 0x100
|
||||||
#define HPET_TIMER_COMPARATOR_OFFSET 0x108
|
#define HPET_TIMER_COMPARATOR_OFFSET 0x108
|
||||||
#define HPET_TIMER_MSI_ROUTE_OFFSET 0x110
|
#define HPET_TIMER_MSI_ROUTE_OFFSET 0x110
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Stride between sets of HPET Timer Registers
|
/// Stride between sets of HPET Timer Registers
|
||||||
///
|
///
|
||||||
#define HPET_TIMER_STRIDE 0x20
|
#define HPET_TIMER_STRIDE 0x20
|
||||||
|
|
||||||
#pragma pack(1)
|
#pragma pack(1)
|
||||||
|
|
||||||
@ -45,15 +45,15 @@
|
|||||||
///
|
///
|
||||||
typedef union {
|
typedef union {
|
||||||
struct {
|
struct {
|
||||||
UINT32 Revision:8;
|
UINT32 Revision : 8;
|
||||||
UINT32 NumberOfTimers:5;
|
UINT32 NumberOfTimers : 5;
|
||||||
UINT32 CounterSize:1;
|
UINT32 CounterSize : 1;
|
||||||
UINT32 Reserved0:1;
|
UINT32 Reserved0 : 1;
|
||||||
UINT32 LegacyRoute:1;
|
UINT32 LegacyRoute : 1;
|
||||||
UINT32 VendorId:16;
|
UINT32 VendorId : 16;
|
||||||
UINT32 CounterClockPeriod:32;
|
UINT32 CounterClockPeriod : 32;
|
||||||
} Bits;
|
} Bits;
|
||||||
UINT64 Uint64;
|
UINT64 Uint64;
|
||||||
} HPET_GENERAL_CAPABILITIES_ID_REGISTER;
|
} HPET_GENERAL_CAPABILITIES_ID_REGISTER;
|
||||||
|
|
||||||
///
|
///
|
||||||
@ -61,12 +61,12 @@ typedef union {
|
|||||||
///
|
///
|
||||||
typedef union {
|
typedef union {
|
||||||
struct {
|
struct {
|
||||||
UINT32 MainCounterEnable:1;
|
UINT32 MainCounterEnable : 1;
|
||||||
UINT32 LegacyRouteEnable:1;
|
UINT32 LegacyRouteEnable : 1;
|
||||||
UINT32 Reserved0:30;
|
UINT32 Reserved0 : 30;
|
||||||
UINT32 Reserved1:32;
|
UINT32 Reserved1 : 32;
|
||||||
} Bits;
|
} Bits;
|
||||||
UINT64 Uint64;
|
UINT64 Uint64;
|
||||||
} HPET_GENERAL_CONFIGURATION_REGISTER;
|
} HPET_GENERAL_CONFIGURATION_REGISTER;
|
||||||
|
|
||||||
///
|
///
|
||||||
@ -74,22 +74,22 @@ typedef union {
|
|||||||
///
|
///
|
||||||
typedef union {
|
typedef union {
|
||||||
struct {
|
struct {
|
||||||
UINT32 Reserved0:1;
|
UINT32 Reserved0 : 1;
|
||||||
UINT32 LevelTriggeredInterrupt:1;
|
UINT32 LevelTriggeredInterrupt : 1;
|
||||||
UINT32 InterruptEnable:1;
|
UINT32 InterruptEnable : 1;
|
||||||
UINT32 PeriodicInterruptEnable:1;
|
UINT32 PeriodicInterruptEnable : 1;
|
||||||
UINT32 PeriodicInterruptCapability:1;
|
UINT32 PeriodicInterruptCapability : 1;
|
||||||
UINT32 CounterSizeCapability:1;
|
UINT32 CounterSizeCapability : 1;
|
||||||
UINT32 ValueSetEnable:1;
|
UINT32 ValueSetEnable : 1;
|
||||||
UINT32 Reserved1:1;
|
UINT32 Reserved1 : 1;
|
||||||
UINT32 CounterSizeEnable:1;
|
UINT32 CounterSizeEnable : 1;
|
||||||
UINT32 InterruptRoute:5;
|
UINT32 InterruptRoute : 5;
|
||||||
UINT32 MsiInterruptEnable:1;
|
UINT32 MsiInterruptEnable : 1;
|
||||||
UINT32 MsiInterruptCapability:1;
|
UINT32 MsiInterruptCapability : 1;
|
||||||
UINT32 Reserved2:16;
|
UINT32 Reserved2 : 16;
|
||||||
UINT32 InterruptRouteCapability;
|
UINT32 InterruptRouteCapability;
|
||||||
} Bits;
|
} Bits;
|
||||||
UINT64 Uint64;
|
UINT64 Uint64;
|
||||||
} HPET_TIMER_CONFIGURATION_REGISTER;
|
} HPET_TIMER_CONFIGURATION_REGISTER;
|
||||||
|
|
||||||
///
|
///
|
||||||
@ -97,10 +97,10 @@ typedef union {
|
|||||||
///
|
///
|
||||||
typedef union {
|
typedef union {
|
||||||
struct {
|
struct {
|
||||||
UINT32 Value:32;
|
UINT32 Value : 32;
|
||||||
UINT32 Address:32;
|
UINT32 Address : 32;
|
||||||
} Bits;
|
} Bits;
|
||||||
UINT64 Uint64;
|
UINT64 Uint64;
|
||||||
} HPET_TIMER_MSI_ROUTE_REGISTER;
|
} HPET_TIMER_MSI_ROUTE_REGISTER;
|
||||||
|
|
||||||
#pragma pack()
|
#pragma pack()
|
||||||
|
@ -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.
|
||||||
@ -32,13 +34,13 @@ STATIC CONST EFI_GUID mPrmModuleGuid = {0x0ef93ed7, 0x14ae, 0x425b, {0x92, 0x8f,
|
|||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
HardwareAccessModuleConfigLibConstructor (
|
HardwareAccessModuleConfigLibConstructor (
|
||||||
IN EFI_HANDLE ImageHandle,
|
IN EFI_HANDLE ImageHandle,
|
||||||
IN EFI_SYSTEM_TABLE *SystemTable
|
IN EFI_SYSTEM_TABLE *SystemTable
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
PRM_RUNTIME_MMIO_RANGES *RuntimeMmioRanges;
|
PRM_RUNTIME_MMIO_RANGES *RuntimeMmioRanges;
|
||||||
PRM_CONFIG_PROTOCOL *PrmConfigProtocol;
|
PRM_CONFIG_PROTOCOL *PrmConfigProtocol;
|
||||||
|
|
||||||
RuntimeMmioRanges = NULL;
|
RuntimeMmioRanges = NULL;
|
||||||
PrmConfigProtocol = NULL;
|
PrmConfigProtocol = NULL;
|
||||||
@ -70,12 +72,13 @@ 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
|
||||||
RuntimeMmioRanges->Count = 1;
|
RuntimeMmioRanges->Count = 1;
|
||||||
RuntimeMmioRanges->Range[0].PhysicalBaseAddress = HPET_BASE_ADDRESS;
|
RuntimeMmioRanges->Range[0].PhysicalBaseAddress = HPET_BASE_ADDRESS;
|
||||||
RuntimeMmioRanges->Range[0].Length = HPET_RANGE_LENGTH;
|
RuntimeMmioRanges->Range[0].Length = HPET_RANGE_LENGTH;
|
||||||
|
|
||||||
PrmConfigProtocol->ModuleContextBuffers.RuntimeMmioRanges = RuntimeMmioRanges;
|
PrmConfigProtocol->ModuleContextBuffers.RuntimeMmioRanges = RuntimeMmioRanges;
|
||||||
|
|
||||||
@ -87,7 +90,7 @@ HardwareAccessModuleConfigLibConstructor (
|
|||||||
&mPrmConfigProtocolHandle,
|
&mPrmConfigProtocolHandle,
|
||||||
&gPrmConfigProtocolGuid,
|
&gPrmConfigProtocolGuid,
|
||||||
EFI_NATIVE_INTERFACE,
|
EFI_NATIVE_INTERFACE,
|
||||||
(VOID *) PrmConfigProtocol
|
(VOID *)PrmConfigProtocol
|
||||||
);
|
);
|
||||||
|
|
||||||
Done:
|
Done:
|
||||||
@ -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);
|
||||||
}
|
}
|
||||||
|
@ -24,18 +24,18 @@
|
|||||||
//
|
//
|
||||||
|
|
||||||
// {2120cd3c-848b-4d8f-abbb-4b74ce64ac89}
|
// {2120cd3c-848b-4d8f-abbb-4b74ce64ac89}
|
||||||
#define MSR_ACCESS_MICROCODE_SIGNATURE_PRM_HANDLER_GUID {0x2120cd3c, 0x848b, 0x4d8f, {0xab, 0xbb, 0x4b, 0x74, 0xce, 0x64, 0xac, 0x89}}
|
#define MSR_ACCESS_MICROCODE_SIGNATURE_PRM_HANDLER_GUID {0x2120cd3c, 0x848b, 0x4d8f, {0xab, 0xbb, 0x4b, 0x74, 0xce, 0x64, 0xac, 0x89}}
|
||||||
|
|
||||||
// {ea0935a7-506b-4159-bbbb-48deeecb6f58}
|
// {ea0935a7-506b-4159-bbbb-48deeecb6f58}
|
||||||
#define MSR_ACCESS_MTRR_DUMP_PRM_HANDLER_GUID {0xea0935a7, 0x506b, 0x4159, {0xbb, 0xbb, 0x48, 0xde, 0xee, 0xcb, 0x6f, 0x58}}
|
#define MSR_ACCESS_MTRR_DUMP_PRM_HANDLER_GUID {0xea0935a7, 0x506b, 0x4159, {0xbb, 0xbb, 0x48, 0xde, 0xee, 0xcb, 0x6f, 0x58}}
|
||||||
|
|
||||||
// {1bd1bda9-909a-4614-9699-25ec0c2783f7}
|
// {1bd1bda9-909a-4614-9699-25ec0c2783f7}
|
||||||
#define MMIO_ACCESS_HPET_PRM_HANDLER_GUID {0x1bd1bda9, 0x909a, 0x4614, {0x96, 0x99, 0x25, 0xec, 0x0c, 0x27, 0x83, 0xf7}}
|
#define MMIO_ACCESS_HPET_PRM_HANDLER_GUID {0x1bd1bda9, 0x909a, 0x4614, {0x96, 0x99, 0x25, 0xec, 0x0c, 0x27, 0x83, 0xf7}}
|
||||||
|
|
||||||
//
|
//
|
||||||
// BEGIN: MtrrLib internal library globals and function prototypes here for testing
|
// BEGIN: MtrrLib internal library globals and function prototypes here for testing
|
||||||
//
|
//
|
||||||
extern CONST CHAR8 *mMtrrMemoryCacheTypeShortName[];
|
extern CONST CHAR8 *mMtrrMemoryCacheTypeShortName[];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Initializes the valid bits mask and valid address mask for MTRRs.
|
Initializes the valid bits mask and valid address mask for MTRRs.
|
||||||
@ -48,8 +48,8 @@ extern CONST CHAR8 *mMtrrMemoryCacheTypeShortName[];
|
|||||||
**/
|
**/
|
||||||
VOID
|
VOID
|
||||||
MtrrLibInitializeMtrrMask (
|
MtrrLibInitializeMtrrMask (
|
||||||
OUT UINT64 *MtrrValidBitsMask,
|
OUT UINT64 *MtrrValidBitsMask,
|
||||||
OUT UINT64 *MtrrValidAddressMask
|
OUT UINT64 *MtrrValidAddressMask
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -109,11 +109,11 @@ MtrrLibApplyFixedMtrrs (
|
|||||||
**/
|
**/
|
||||||
RETURN_STATUS
|
RETURN_STATUS
|
||||||
MtrrLibApplyVariableMtrrs (
|
MtrrLibApplyVariableMtrrs (
|
||||||
IN CONST MTRR_MEMORY_RANGE *VariableMtrr,
|
IN CONST MTRR_MEMORY_RANGE *VariableMtrr,
|
||||||
IN UINT32 VariableMtrrCount,
|
IN UINT32 VariableMtrrCount,
|
||||||
IN OUT MTRR_MEMORY_RANGE *Ranges,
|
IN OUT MTRR_MEMORY_RANGE *Ranges,
|
||||||
IN UINTN RangeCapacity,
|
IN UINTN RangeCapacity,
|
||||||
IN OUT UINTN *RangeCount
|
IN OUT UINTN *RangeCount
|
||||||
);
|
);
|
||||||
|
|
||||||
//
|
//
|
||||||
@ -130,17 +130,17 @@ AccessAllMtrrs (
|
|||||||
VOID
|
VOID
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
MTRR_SETTINGS LocalMtrrs;
|
MTRR_SETTINGS LocalMtrrs;
|
||||||
MTRR_SETTINGS *Mtrrs;
|
MTRR_SETTINGS *Mtrrs;
|
||||||
UINTN RangeCount;
|
UINTN RangeCount;
|
||||||
UINT64 MtrrValidBitsMask;
|
UINT64 MtrrValidBitsMask;
|
||||||
UINT64 MtrrValidAddressMask;
|
UINT64 MtrrValidAddressMask;
|
||||||
UINT32 VariableMtrrCount;
|
UINT32 VariableMtrrCount;
|
||||||
|
|
||||||
MTRR_MEMORY_RANGE Ranges[
|
MTRR_MEMORY_RANGE Ranges[
|
||||||
MTRR_NUMBER_OF_FIXED_MTRR * sizeof (UINT64) + 2 * ARRAY_SIZE (Mtrrs->Variables.Mtrr) + 1
|
MTRR_NUMBER_OF_FIXED_MTRR * sizeof (UINT64) + 2 * ARRAY_SIZE (Mtrrs->Variables.Mtrr) + 1
|
||||||
];
|
];
|
||||||
MTRR_MEMORY_RANGE RawVariableRanges[ARRAY_SIZE (Mtrrs->Variables.Mtrr)];
|
MTRR_MEMORY_RANGE RawVariableRanges[ARRAY_SIZE (Mtrrs->Variables.Mtrr)];
|
||||||
|
|
||||||
if (!IsMtrrSupported ()) {
|
if (!IsMtrrSupported ()) {
|
||||||
return;
|
return;
|
||||||
@ -155,15 +155,21 @@ AccessAllMtrrs (
|
|||||||
Ranges[0].BaseAddress = 0;
|
Ranges[0].BaseAddress = 0;
|
||||||
Ranges[0].Length = MtrrValidBitsMask + 1;
|
Ranges[0].Length = MtrrValidBitsMask + 1;
|
||||||
Ranges[0].Type = MtrrGetDefaultMemoryType ();
|
Ranges[0].Type = MtrrGetDefaultMemoryType ();
|
||||||
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);
|
||||||
@ -187,11 +193,11 @@ AccessAllMtrrs (
|
|||||||
UINT64
|
UINT64
|
||||||
EFIAPI
|
EFIAPI
|
||||||
HpetRead (
|
HpetRead (
|
||||||
IN UINTN Offset
|
IN UINTN Offset
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
UINTN Address;
|
UINTN Address;
|
||||||
UINT64 Value;
|
UINT64 Value;
|
||||||
|
|
||||||
Address = HPET_BASE_ADDRESS + Offset;
|
Address = HPET_BASE_ADDRESS + Offset;
|
||||||
|
|
||||||
@ -200,7 +206,7 @@ HpetRead (
|
|||||||
}
|
}
|
||||||
|
|
||||||
MemoryFence ();
|
MemoryFence ();
|
||||||
Value = *(volatile UINT64*)Address;
|
Value = *(volatile UINT64 *)Address;
|
||||||
MemoryFence ();
|
MemoryFence ();
|
||||||
|
|
||||||
return Value;
|
return Value;
|
||||||
@ -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;
|
||||||
@ -324,8 +327,8 @@ PRM_MODULE_EXPORT (
|
|||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
PrmSampleHardwareAccessModuleInit (
|
PrmSampleHardwareAccessModuleInit (
|
||||||
IN EFI_HANDLE ImageHandle,
|
IN EFI_HANDLE ImageHandle,
|
||||||
IN EFI_SYSTEM_TABLE *SystemTable
|
IN EFI_SYSTEM_TABLE *SystemTable
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
|
@ -16,10 +16,10 @@
|
|||||||
|
|
||||||
#include "UefiBootServicesTableLibUnitTest.h"
|
#include "UefiBootServicesTableLibUnitTest.h"
|
||||||
|
|
||||||
EFI_HANDLE gImageHandle = NULL;
|
EFI_HANDLE gImageHandle = NULL;
|
||||||
EFI_SYSTEM_TABLE *gST = NULL;
|
EFI_SYSTEM_TABLE *gST = NULL;
|
||||||
|
|
||||||
STATIC EFI_BOOT_SERVICES mBootServices = {
|
STATIC EFI_BOOT_SERVICES mBootServices = {
|
||||||
{
|
{
|
||||||
EFI_BOOT_SERVICES_SIGNATURE, // Signature
|
EFI_BOOT_SERVICES_SIGNATURE, // Signature
|
||||||
EFI_BOOT_SERVICES_REVISION, // Revision
|
EFI_BOOT_SERVICES_REVISION, // Revision
|
||||||
@ -27,50 +27,50 @@ STATIC EFI_BOOT_SERVICES mBootServices = {
|
|||||||
0, // CRC32
|
0, // CRC32
|
||||||
0 // Reserved
|
0 // Reserved
|
||||||
},
|
},
|
||||||
(EFI_RAISE_TPL) UnitTestRaiseTpl, // RaiseTPL
|
(EFI_RAISE_TPL)UnitTestRaiseTpl, // RaiseTPL
|
||||||
(EFI_RESTORE_TPL) UnitTestRestoreTpl, // RestoreTPL
|
(EFI_RESTORE_TPL)UnitTestRestoreTpl, // RestoreTPL
|
||||||
(EFI_ALLOCATE_PAGES) UnitTestAllocatePages, // AllocatePages
|
(EFI_ALLOCATE_PAGES)UnitTestAllocatePages, // AllocatePages
|
||||||
(EFI_FREE_PAGES) UnitTestFreePages, // FreePages
|
(EFI_FREE_PAGES)UnitTestFreePages, // FreePages
|
||||||
(EFI_GET_MEMORY_MAP) UnitTestGetMemoryMap, // GetMemoryMap
|
(EFI_GET_MEMORY_MAP)UnitTestGetMemoryMap, // GetMemoryMap
|
||||||
(EFI_ALLOCATE_POOL) UnitTestAllocatePool, // AllocatePool
|
(EFI_ALLOCATE_POOL)UnitTestAllocatePool, // AllocatePool
|
||||||
(EFI_FREE_POOL) UnitTestFreePool, // FreePool
|
(EFI_FREE_POOL)UnitTestFreePool, // FreePool
|
||||||
(EFI_CREATE_EVENT) UnitTestCreateEvent, // CreateEvent
|
(EFI_CREATE_EVENT)UnitTestCreateEvent, // CreateEvent
|
||||||
(EFI_SET_TIMER) UnitTestSetTimer, // SetTimer
|
(EFI_SET_TIMER)UnitTestSetTimer, // SetTimer
|
||||||
(EFI_WAIT_FOR_EVENT) UnitTestWaitForEvent, // WaitForEvent
|
(EFI_WAIT_FOR_EVENT)UnitTestWaitForEvent, // WaitForEvent
|
||||||
(EFI_SIGNAL_EVENT) UnitTestSignalEvent, // SignalEvent
|
(EFI_SIGNAL_EVENT)UnitTestSignalEvent, // SignalEvent
|
||||||
(EFI_CLOSE_EVENT) UnitTestCloseEvent, // CloseEvent
|
(EFI_CLOSE_EVENT)UnitTestCloseEvent, // CloseEvent
|
||||||
(EFI_CHECK_EVENT) UnitTestCheckEvent, // CheckEvent
|
(EFI_CHECK_EVENT)UnitTestCheckEvent, // CheckEvent
|
||||||
(EFI_INSTALL_PROTOCOL_INTERFACE) UnitTestInstallProtocolInterface, // InstallProtocolInterface
|
(EFI_INSTALL_PROTOCOL_INTERFACE)UnitTestInstallProtocolInterface, // InstallProtocolInterface
|
||||||
(EFI_REINSTALL_PROTOCOL_INTERFACE) UnitTestReinstallProtocolInterface, // ReinstallProtocolInterface
|
(EFI_REINSTALL_PROTOCOL_INTERFACE)UnitTestReinstallProtocolInterface, // ReinstallProtocolInterface
|
||||||
(EFI_UNINSTALL_PROTOCOL_INTERFACE) UnitTestUninstallProtocolInterface, // UninstallProtocolInterface
|
(EFI_UNINSTALL_PROTOCOL_INTERFACE)UnitTestUninstallProtocolInterface, // UninstallProtocolInterface
|
||||||
(EFI_HANDLE_PROTOCOL) UnitTestHandleProtocol, // HandleProtocol
|
(EFI_HANDLE_PROTOCOL)UnitTestHandleProtocol, // HandleProtocol
|
||||||
(VOID *) NULL, // Reserved
|
(VOID *)NULL, // Reserved
|
||||||
(EFI_REGISTER_PROTOCOL_NOTIFY) UnitTestRegisterProtocolNotify, // RegisterProtocolNotify
|
(EFI_REGISTER_PROTOCOL_NOTIFY)UnitTestRegisterProtocolNotify, // RegisterProtocolNotify
|
||||||
(EFI_LOCATE_HANDLE) UnitTestLocateHandle, // LocateHandle
|
(EFI_LOCATE_HANDLE)UnitTestLocateHandle, // LocateHandle
|
||||||
(EFI_LOCATE_DEVICE_PATH) UnitTestLocateDevicePath, // LocateDevicePath
|
(EFI_LOCATE_DEVICE_PATH)UnitTestLocateDevicePath, // LocateDevicePath
|
||||||
(EFI_INSTALL_CONFIGURATION_TABLE) UnitTestInstallConfigurationTable, // InstallConfigurationTable
|
(EFI_INSTALL_CONFIGURATION_TABLE)UnitTestInstallConfigurationTable, // InstallConfigurationTable
|
||||||
(EFI_IMAGE_LOAD) UnitTestLoadImage, // LoadImage
|
(EFI_IMAGE_LOAD)UnitTestLoadImage, // LoadImage
|
||||||
(EFI_IMAGE_START) UnitTestStartImage, // StartImage
|
(EFI_IMAGE_START)UnitTestStartImage, // StartImage
|
||||||
(EFI_EXIT) UnitTestExit, // Exit
|
(EFI_EXIT)UnitTestExit, // Exit
|
||||||
(EFI_IMAGE_UNLOAD) UnitTestUnloadImage, // UnloadImage
|
(EFI_IMAGE_UNLOAD)UnitTestUnloadImage, // UnloadImage
|
||||||
(EFI_EXIT_BOOT_SERVICES) UnitTestExitBootServices, // ExitBootServices
|
(EFI_EXIT_BOOT_SERVICES)UnitTestExitBootServices, // ExitBootServices
|
||||||
(EFI_GET_NEXT_MONOTONIC_COUNT) UnitTestGetNextMonotonicCount, // GetNextMonotonicCount
|
(EFI_GET_NEXT_MONOTONIC_COUNT)UnitTestGetNextMonotonicCount, // GetNextMonotonicCount
|
||||||
(EFI_STALL) UnitTestStall, // Stall
|
(EFI_STALL)UnitTestStall, // Stall
|
||||||
(EFI_SET_WATCHDOG_TIMER) UnitTestSetWatchdogTimer, // SetWatchdogTimer
|
(EFI_SET_WATCHDOG_TIMER)UnitTestSetWatchdogTimer, // SetWatchdogTimer
|
||||||
(EFI_CONNECT_CONTROLLER) UnitTestConnectController, // ConnectController
|
(EFI_CONNECT_CONTROLLER)UnitTestConnectController, // ConnectController
|
||||||
(EFI_DISCONNECT_CONTROLLER) UnitTestDisconnectController, // DisconnectController
|
(EFI_DISCONNECT_CONTROLLER)UnitTestDisconnectController, // DisconnectController
|
||||||
(EFI_OPEN_PROTOCOL) UnitTestOpenProtocol, // OpenProtocol
|
(EFI_OPEN_PROTOCOL)UnitTestOpenProtocol, // OpenProtocol
|
||||||
(EFI_CLOSE_PROTOCOL) UnitTestCloseProtocol, // CloseProtocol
|
(EFI_CLOSE_PROTOCOL)UnitTestCloseProtocol, // CloseProtocol
|
||||||
(EFI_OPEN_PROTOCOL_INFORMATION) UnitTestOpenProtocolInformation, // OpenProtocolInformation
|
(EFI_OPEN_PROTOCOL_INFORMATION)UnitTestOpenProtocolInformation, // OpenProtocolInformation
|
||||||
(EFI_PROTOCOLS_PER_HANDLE) UnitTestProtocolsPerHandle, // ProtocolsPerHandle
|
(EFI_PROTOCOLS_PER_HANDLE)UnitTestProtocolsPerHandle, // ProtocolsPerHandle
|
||||||
(EFI_LOCATE_HANDLE_BUFFER) UnitTestLocateHandleBuffer, // LocateHandleBuffer
|
(EFI_LOCATE_HANDLE_BUFFER)UnitTestLocateHandleBuffer, // LocateHandleBuffer
|
||||||
(EFI_LOCATE_PROTOCOL) UnitTestLocateProtocol, // LocateProtocol
|
(EFI_LOCATE_PROTOCOL)UnitTestLocateProtocol, // LocateProtocol
|
||||||
(EFI_INSTALL_MULTIPLE_PROTOCOL_INTERFACES) UnitTestInstallMultipleProtocolInterfaces, // InstallMultipleProtocolInterfaces
|
(EFI_INSTALL_MULTIPLE_PROTOCOL_INTERFACES)UnitTestInstallMultipleProtocolInterfaces, // InstallMultipleProtocolInterfaces
|
||||||
(EFI_UNINSTALL_MULTIPLE_PROTOCOL_INTERFACES) UnitTestUninstallMultipleProtocolInterfaces, // UninstallMultipleProtocolInterfaces
|
(EFI_UNINSTALL_MULTIPLE_PROTOCOL_INTERFACES)UnitTestUninstallMultipleProtocolInterfaces, // UninstallMultipleProtocolInterfaces
|
||||||
(EFI_CALCULATE_CRC32) UnitTestCalculateCrc32, // CalculateCrc32
|
(EFI_CALCULATE_CRC32)UnitTestCalculateCrc32, // CalculateCrc32
|
||||||
(EFI_COPY_MEM) CopyMem, // CopyMem
|
(EFI_COPY_MEM)CopyMem, // CopyMem
|
||||||
(EFI_SET_MEM) SetMem, // SetMem
|
(EFI_SET_MEM)SetMem, // SetMem
|
||||||
(EFI_CREATE_EVENT_EX) UnitTestCreateEventEx // CreateEventEx
|
(EFI_CREATE_EVENT_EX)UnitTestCreateEventEx // CreateEventEx
|
||||||
};
|
};
|
||||||
|
|
||||||
EFI_BOOT_SERVICES *gBS = &mBootServices;
|
EFI_BOOT_SERVICES *gBS = &mBootServices;
|
||||||
|
@ -34,11 +34,9 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
|||||||
EFI_TPL
|
EFI_TPL
|
||||||
EFIAPI
|
EFIAPI
|
||||||
UnitTestRaiseTpl (
|
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.
|
||||||
@ -49,7 +47,7 @@ UnitTestRaiseTpl (
|
|||||||
VOID
|
VOID
|
||||||
EFIAPI
|
EFIAPI
|
||||||
UnitTestRestoreTpl (
|
UnitTestRestoreTpl (
|
||||||
IN EFI_TPL NewTpl
|
IN EFI_TPL NewTpl
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -73,9 +71,9 @@ UnitTestRestoreTpl (
|
|||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
UnitTestAllocatePages (
|
UnitTestAllocatePages (
|
||||||
IN EFI_ALLOCATE_TYPE Type,
|
IN EFI_ALLOCATE_TYPE Type,
|
||||||
IN EFI_MEMORY_TYPE MemoryType,
|
IN EFI_MEMORY_TYPE MemoryType,
|
||||||
IN UINTN NumberOfPages,
|
IN UINTN NumberOfPages,
|
||||||
IN OUT EFI_PHYSICAL_ADDRESS *Memory
|
IN OUT EFI_PHYSICAL_ADDRESS *Memory
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -93,8 +91,8 @@ UnitTestAllocatePages (
|
|||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
UnitTestFreePages (
|
UnitTestFreePages (
|
||||||
IN EFI_PHYSICAL_ADDRESS Memory,
|
IN EFI_PHYSICAL_ADDRESS Memory,
|
||||||
IN UINTN NumberOfPages
|
IN UINTN NumberOfPages
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -137,8 +135,6 @@ UnitTestGetMemoryMap (
|
|||||||
OUT UINT32 *DescriptorVersion
|
OUT UINT32 *DescriptorVersion
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Allocate pool of a particular type.
|
Allocate pool of a particular type.
|
||||||
|
|
||||||
@ -172,7 +168,7 @@ UnitTestAllocatePool (
|
|||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
UnitTestFreePool (
|
UnitTestFreePool (
|
||||||
IN VOID *Buffer
|
IN VOID *Buffer
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -188,8 +184,8 @@ UnitTestFreePool (
|
|||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
UnitTestInternalFreePool (
|
UnitTestInternalFreePool (
|
||||||
IN VOID *Buffer,
|
IN VOID *Buffer,
|
||||||
OUT EFI_MEMORY_TYPE *PoolType OPTIONAL
|
OUT EFI_MEMORY_TYPE *PoolType OPTIONAL
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -213,9 +209,9 @@ UnitTestInternalFreePool (
|
|||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
UnitTestCreateEvent (
|
UnitTestCreateEvent (
|
||||||
IN UINT32 Type,
|
IN UINT32 Type,
|
||||||
IN EFI_TPL NotifyTpl,
|
IN EFI_TPL NotifyTpl,
|
||||||
IN EFI_EVENT_NOTIFY NotifyFunction, OPTIONAL
|
IN EFI_EVENT_NOTIFY NotifyFunction, OPTIONAL
|
||||||
IN VOID *NotifyContext, OPTIONAL
|
IN VOID *NotifyContext, OPTIONAL
|
||||||
OUT EFI_EVENT *Event
|
OUT EFI_EVENT *Event
|
||||||
);
|
);
|
||||||
@ -238,9 +234,9 @@ UnitTestCreateEvent (
|
|||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
UnitTestSetTimer (
|
UnitTestSetTimer (
|
||||||
IN EFI_EVENT UserEvent,
|
IN EFI_EVENT UserEvent,
|
||||||
IN EFI_TIMER_DELAY Type,
|
IN EFI_TIMER_DELAY Type,
|
||||||
IN UINT64 TriggerTime
|
IN UINT64 TriggerTime
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -260,9 +256,9 @@ UnitTestSetTimer (
|
|||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
UnitTestWaitForEvent (
|
UnitTestWaitForEvent (
|
||||||
IN UINTN NumberOfEvents,
|
IN UINTN NumberOfEvents,
|
||||||
IN EFI_EVENT *UserEvents,
|
IN EFI_EVENT *UserEvents,
|
||||||
OUT UINTN *UserIndex
|
OUT UINTN *UserIndex
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -277,7 +273,7 @@ UnitTestWaitForEvent (
|
|||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
UnitTestSignalEvent (
|
UnitTestSignalEvent (
|
||||||
IN EFI_EVENT UserEvent
|
IN EFI_EVENT UserEvent
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -292,7 +288,7 @@ UnitTestSignalEvent (
|
|||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
UnitTestCloseEvent (
|
UnitTestCloseEvent (
|
||||||
IN EFI_EVENT UserEvent
|
IN EFI_EVENT UserEvent
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -308,7 +304,7 @@ UnitTestCloseEvent (
|
|||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
UnitTestCheckEvent (
|
UnitTestCheckEvent (
|
||||||
IN EFI_EVENT UserEvent
|
IN EFI_EVENT UserEvent
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -328,10 +324,10 @@ UnitTestCheckEvent (
|
|||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
UnitTestInstallProtocolInterface (
|
UnitTestInstallProtocolInterface (
|
||||||
IN OUT EFI_HANDLE *UserHandle,
|
IN OUT EFI_HANDLE *UserHandle,
|
||||||
IN EFI_GUID *Protocol,
|
IN EFI_GUID *Protocol,
|
||||||
IN EFI_INTERFACE_TYPE InterfaceType,
|
IN EFI_INTERFACE_TYPE InterfaceType,
|
||||||
IN VOID *Interface
|
IN VOID *Interface
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -351,10 +347,10 @@ UnitTestInstallProtocolInterface (
|
|||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
UnitTestReinstallProtocolInterface (
|
UnitTestReinstallProtocolInterface (
|
||||||
IN EFI_HANDLE UserHandle,
|
IN EFI_HANDLE UserHandle,
|
||||||
IN EFI_GUID *Protocol,
|
IN EFI_GUID *Protocol,
|
||||||
IN VOID *OldInterface,
|
IN VOID *OldInterface,
|
||||||
IN VOID *NewInterface
|
IN VOID *NewInterface
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -373,9 +369,9 @@ UnitTestReinstallProtocolInterface (
|
|||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
UnitTestUninstallProtocolInterface (
|
UnitTestUninstallProtocolInterface (
|
||||||
IN EFI_HANDLE UserHandle,
|
IN EFI_HANDLE UserHandle,
|
||||||
IN EFI_GUID *Protocol,
|
IN EFI_GUID *Protocol,
|
||||||
IN VOID *Interface
|
IN VOID *Interface
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -392,9 +388,9 @@ UnitTestUninstallProtocolInterface (
|
|||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
UnitTestHandleProtocol (
|
UnitTestHandleProtocol (
|
||||||
IN EFI_HANDLE UserHandle,
|
IN EFI_HANDLE UserHandle,
|
||||||
IN EFI_GUID *Protocol,
|
IN EFI_GUID *Protocol,
|
||||||
OUT VOID **Interface
|
OUT VOID **Interface
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -413,9 +409,9 @@ UnitTestHandleProtocol (
|
|||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
UnitTestRegisterProtocolNotify (
|
UnitTestRegisterProtocolNotify (
|
||||||
IN EFI_GUID *Protocol,
|
IN EFI_GUID *Protocol,
|
||||||
IN EFI_EVENT Event,
|
IN EFI_EVENT Event,
|
||||||
OUT VOID **Registration
|
OUT VOID **Registration
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -439,11 +435,11 @@ UnitTestRegisterProtocolNotify (
|
|||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
UnitTestLocateHandle (
|
UnitTestLocateHandle (
|
||||||
IN EFI_LOCATE_SEARCH_TYPE SearchType,
|
IN EFI_LOCATE_SEARCH_TYPE SearchType,
|
||||||
IN EFI_GUID *Protocol OPTIONAL,
|
IN EFI_GUID *Protocol OPTIONAL,
|
||||||
IN VOID *SearchKey OPTIONAL,
|
IN VOID *SearchKey OPTIONAL,
|
||||||
IN OUT UINTN *BufferSize,
|
IN OUT UINTN *BufferSize,
|
||||||
OUT EFI_HANDLE *Buffer
|
OUT EFI_HANDLE *Buffer
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -464,9 +460,9 @@ UnitTestLocateHandle (
|
|||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
UnitTestLocateDevicePath (
|
UnitTestLocateDevicePath (
|
||||||
IN EFI_GUID *Protocol,
|
IN EFI_GUID *Protocol,
|
||||||
IN OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath,
|
IN OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath,
|
||||||
OUT EFI_HANDLE *Device
|
OUT EFI_HANDLE *Device
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -487,8 +483,8 @@ UnitTestLocateDevicePath (
|
|||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
UnitTestInstallConfigurationTable (
|
UnitTestInstallConfigurationTable (
|
||||||
IN EFI_GUID *Guid,
|
IN EFI_GUID *Guid,
|
||||||
IN VOID *Table
|
IN VOID *Table
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -528,12 +524,12 @@ UnitTestInstallConfigurationTable (
|
|||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
UnitTestLoadImage (
|
UnitTestLoadImage (
|
||||||
IN BOOLEAN BootPolicy,
|
IN BOOLEAN BootPolicy,
|
||||||
IN EFI_HANDLE ParentImageHandle,
|
IN EFI_HANDLE ParentImageHandle,
|
||||||
IN EFI_DEVICE_PATH_PROTOCOL *FilePath,
|
IN EFI_DEVICE_PATH_PROTOCOL *FilePath,
|
||||||
IN VOID *SourceBuffer OPTIONAL,
|
IN VOID *SourceBuffer OPTIONAL,
|
||||||
IN UINTN SourceSize,
|
IN UINTN SourceSize,
|
||||||
OUT EFI_HANDLE *ImageHandle
|
OUT EFI_HANDLE *ImageHandle
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -626,8 +622,8 @@ UnitTestUnloadImage (
|
|||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
UnitTestExitBootServices (
|
UnitTestExitBootServices (
|
||||||
IN EFI_HANDLE ImageHandle,
|
IN EFI_HANDLE ImageHandle,
|
||||||
IN UINTN MapKey
|
IN UINTN MapKey
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -643,7 +639,7 @@ UnitTestExitBootServices (
|
|||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
UnitTestGetNextMonotonicCount (
|
UnitTestGetNextMonotonicCount (
|
||||||
OUT UINT64 *Count
|
OUT UINT64 *Count
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -659,7 +655,7 @@ UnitTestGetNextMonotonicCount (
|
|||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
UnitTestStall (
|
UnitTestStall (
|
||||||
IN UINTN Microseconds
|
IN UINTN Microseconds
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -687,10 +683,10 @@ UnitTestStall (
|
|||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
UnitTestSetWatchdogTimer (
|
UnitTestSetWatchdogTimer (
|
||||||
IN UINTN Timeout,
|
IN UINTN Timeout,
|
||||||
IN UINT64 WatchdogCode,
|
IN UINT64 WatchdogCode,
|
||||||
IN UINTN DataSize,
|
IN UINTN DataSize,
|
||||||
IN CHAR16 *WatchdogData OPTIONAL
|
IN CHAR16 *WatchdogData OPTIONAL
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -791,12 +787,12 @@ UnitTestDisconnectController (
|
|||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
UnitTestOpenProtocol (
|
UnitTestOpenProtocol (
|
||||||
IN EFI_HANDLE UserHandle,
|
IN EFI_HANDLE UserHandle,
|
||||||
IN EFI_GUID *Protocol,
|
IN EFI_GUID *Protocol,
|
||||||
OUT VOID **Interface OPTIONAL,
|
OUT VOID **Interface OPTIONAL,
|
||||||
IN EFI_HANDLE ImageHandle,
|
IN EFI_HANDLE ImageHandle,
|
||||||
IN EFI_HANDLE ControllerHandle,
|
IN EFI_HANDLE ControllerHandle,
|
||||||
IN UINT32 Attributes
|
IN UINT32 Attributes
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -827,10 +823,10 @@ UnitTestOpenProtocol (
|
|||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
UnitTestCloseProtocol (
|
UnitTestCloseProtocol (
|
||||||
IN EFI_HANDLE UserHandle,
|
IN EFI_HANDLE UserHandle,
|
||||||
IN EFI_GUID *Protocol,
|
IN EFI_GUID *Protocol,
|
||||||
IN EFI_HANDLE AgentHandle,
|
IN EFI_HANDLE AgentHandle,
|
||||||
IN EFI_HANDLE ControllerHandle
|
IN EFI_HANDLE ControllerHandle
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -847,10 +843,10 @@ UnitTestCloseProtocol (
|
|||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
UnitTestOpenProtocolInformation (
|
UnitTestOpenProtocolInformation (
|
||||||
IN EFI_HANDLE UserHandle,
|
IN EFI_HANDLE UserHandle,
|
||||||
IN EFI_GUID *Protocol,
|
IN EFI_GUID *Protocol,
|
||||||
OUT EFI_OPEN_PROTOCOL_INFORMATION_ENTRY **EntryBuffer,
|
OUT EFI_OPEN_PROTOCOL_INFORMATION_ENTRY **EntryBuffer,
|
||||||
OUT UINTN *EntryCount
|
OUT UINTN *EntryCount
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -879,9 +875,9 @@ UnitTestOpenProtocolInformation (
|
|||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
UnitTestProtocolsPerHandle (
|
UnitTestProtocolsPerHandle (
|
||||||
IN EFI_HANDLE UserHandle,
|
IN EFI_HANDLE UserHandle,
|
||||||
OUT EFI_GUID ***ProtocolBuffer,
|
OUT EFI_GUID ***ProtocolBuffer,
|
||||||
OUT UINTN *ProtocolBufferCount
|
OUT UINTN *ProtocolBufferCount
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -909,11 +905,11 @@ UnitTestProtocolsPerHandle (
|
|||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
UnitTestLocateHandleBuffer (
|
UnitTestLocateHandleBuffer (
|
||||||
IN EFI_LOCATE_SEARCH_TYPE SearchType,
|
IN EFI_LOCATE_SEARCH_TYPE SearchType,
|
||||||
IN EFI_GUID *Protocol OPTIONAL,
|
IN EFI_GUID *Protocol OPTIONAL,
|
||||||
IN VOID *SearchKey OPTIONAL,
|
IN VOID *SearchKey OPTIONAL,
|
||||||
IN OUT UINTN *NumberHandles,
|
IN OUT UINTN *NumberHandles,
|
||||||
OUT EFI_HANDLE **Buffer
|
OUT EFI_HANDLE **Buffer
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -964,7 +960,7 @@ UnitTestLocateProtocol (
|
|||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
UnitTestInstallMultipleProtocolInterfaces (
|
UnitTestInstallMultipleProtocolInterfaces (
|
||||||
IN OUT EFI_HANDLE *Handle,
|
IN OUT EFI_HANDLE *Handle,
|
||||||
...
|
...
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -985,7 +981,7 @@ UnitTestInstallMultipleProtocolInterfaces (
|
|||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
UnitTestUninstallMultipleProtocolInterfaces (
|
UnitTestUninstallMultipleProtocolInterfaces (
|
||||||
IN EFI_HANDLE Handle,
|
IN EFI_HANDLE Handle,
|
||||||
...
|
...
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -1007,9 +1003,9 @@ UnitTestUninstallMultipleProtocolInterfaces (
|
|||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
UnitTestCalculateCrc32 (
|
UnitTestCalculateCrc32 (
|
||||||
IN VOID *Data,
|
IN VOID *Data,
|
||||||
IN UINTN DataSize,
|
IN UINTN DataSize,
|
||||||
OUT UINT32 *Crc32
|
OUT UINT32 *Crc32
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1035,11 +1031,11 @@ UnitTestCalculateCrc32 (
|
|||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
UnitTestCreateEventEx (
|
UnitTestCreateEventEx (
|
||||||
IN UINT32 Type,
|
IN UINT32 Type,
|
||||||
IN EFI_TPL NotifyTpl,
|
IN EFI_TPL NotifyTpl,
|
||||||
IN EFI_EVENT_NOTIFY NotifyFunction, OPTIONAL
|
IN EFI_EVENT_NOTIFY NotifyFunction, OPTIONAL
|
||||||
IN CONST VOID *NotifyContext, OPTIONAL
|
IN CONST VOID *NotifyContext, OPTIONAL
|
||||||
IN CONST EFI_GUID *EventGroup, OPTIONAL
|
IN CONST EFI_GUID *EventGroup, OPTIONAL
|
||||||
OUT EFI_EVENT *Event
|
OUT EFI_EVENT *Event
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -29,9 +29,9 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
|||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
UnitTestCreateEvent (
|
UnitTestCreateEvent (
|
||||||
IN UINT32 Type,
|
IN UINT32 Type,
|
||||||
IN EFI_TPL NotifyTpl,
|
IN EFI_TPL NotifyTpl,
|
||||||
IN EFI_EVENT_NOTIFY NotifyFunction, OPTIONAL
|
IN EFI_EVENT_NOTIFY NotifyFunction, OPTIONAL
|
||||||
IN VOID *NotifyContext, OPTIONAL
|
IN VOID *NotifyContext, OPTIONAL
|
||||||
OUT EFI_EVENT *Event
|
OUT EFI_EVENT *Event
|
||||||
)
|
)
|
||||||
@ -57,9 +57,9 @@ UnitTestCreateEvent (
|
|||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
UnitTestSetTimer (
|
UnitTestSetTimer (
|
||||||
IN EFI_EVENT UserEvent,
|
IN EFI_EVENT UserEvent,
|
||||||
IN EFI_TIMER_DELAY Type,
|
IN EFI_TIMER_DELAY Type,
|
||||||
IN UINT64 TriggerTime
|
IN UINT64 TriggerTime
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
return EFI_NOT_AVAILABLE_YET;
|
return EFI_NOT_AVAILABLE_YET;
|
||||||
@ -82,9 +82,9 @@ UnitTestSetTimer (
|
|||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
UnitTestWaitForEvent (
|
UnitTestWaitForEvent (
|
||||||
IN UINTN NumberOfEvents,
|
IN UINTN NumberOfEvents,
|
||||||
IN EFI_EVENT *UserEvents,
|
IN EFI_EVENT *UserEvents,
|
||||||
OUT UINTN *UserIndex
|
OUT UINTN *UserIndex
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
return EFI_NOT_AVAILABLE_YET;
|
return EFI_NOT_AVAILABLE_YET;
|
||||||
@ -102,7 +102,7 @@ UnitTestWaitForEvent (
|
|||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
UnitTestSignalEvent (
|
UnitTestSignalEvent (
|
||||||
IN EFI_EVENT UserEvent
|
IN EFI_EVENT UserEvent
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
return EFI_NOT_AVAILABLE_YET;
|
return EFI_NOT_AVAILABLE_YET;
|
||||||
@ -120,7 +120,7 @@ UnitTestSignalEvent (
|
|||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
UnitTestCloseEvent (
|
UnitTestCloseEvent (
|
||||||
IN EFI_EVENT UserEvent
|
IN EFI_EVENT UserEvent
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
return EFI_NOT_AVAILABLE_YET;
|
return EFI_NOT_AVAILABLE_YET;
|
||||||
@ -139,7 +139,7 @@ UnitTestCloseEvent (
|
|||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
UnitTestCheckEvent (
|
UnitTestCheckEvent (
|
||||||
IN EFI_EVENT UserEvent
|
IN EFI_EVENT UserEvent
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
return EFI_NOT_AVAILABLE_YET;
|
return EFI_NOT_AVAILABLE_YET;
|
||||||
@ -168,11 +168,11 @@ UnitTestCheckEvent (
|
|||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
UnitTestCreateEventEx (
|
UnitTestCreateEventEx (
|
||||||
IN UINT32 Type,
|
IN UINT32 Type,
|
||||||
IN EFI_TPL NotifyTpl,
|
IN EFI_TPL NotifyTpl,
|
||||||
IN EFI_EVENT_NOTIFY NotifyFunction, OPTIONAL
|
IN EFI_EVENT_NOTIFY NotifyFunction, OPTIONAL
|
||||||
IN CONST VOID *NotifyContext, OPTIONAL
|
IN CONST VOID *NotifyContext, OPTIONAL
|
||||||
IN CONST EFI_GUID *EventGroup, OPTIONAL
|
IN CONST EFI_GUID *EventGroup, OPTIONAL
|
||||||
OUT EFI_EVENT *Event
|
OUT EFI_EVENT *Event
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
@ -45,12 +45,12 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
|||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
UnitTestLoadImage (
|
UnitTestLoadImage (
|
||||||
IN BOOLEAN BootPolicy,
|
IN BOOLEAN BootPolicy,
|
||||||
IN EFI_HANDLE ParentImageHandle,
|
IN EFI_HANDLE ParentImageHandle,
|
||||||
IN EFI_DEVICE_PATH_PROTOCOL *FilePath,
|
IN EFI_DEVICE_PATH_PROTOCOL *FilePath,
|
||||||
IN VOID *SourceBuffer OPTIONAL,
|
IN VOID *SourceBuffer OPTIONAL,
|
||||||
IN UINTN SourceSize,
|
IN UINTN SourceSize,
|
||||||
OUT EFI_HANDLE *ImageHandle
|
OUT EFI_HANDLE *ImageHandle
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
return EFI_NOT_AVAILABLE_YET;
|
return EFI_NOT_AVAILABLE_YET;
|
||||||
@ -155,8 +155,8 @@ UnitTestUnloadImage (
|
|||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
UnitTestExitBootServices (
|
UnitTestExitBootServices (
|
||||||
IN EFI_HANDLE ImageHandle,
|
IN EFI_HANDLE ImageHandle,
|
||||||
IN UINTN MapKey
|
IN UINTN MapKey
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
return EFI_NOT_AVAILABLE_YET;
|
return EFI_NOT_AVAILABLE_YET;
|
||||||
|
@ -29,9 +29,9 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
|||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
UnitTestAllocatePages (
|
UnitTestAllocatePages (
|
||||||
IN EFI_ALLOCATE_TYPE Type,
|
IN EFI_ALLOCATE_TYPE Type,
|
||||||
IN EFI_MEMORY_TYPE MemoryType,
|
IN EFI_MEMORY_TYPE MemoryType,
|
||||||
IN UINTN NumberOfPages,
|
IN UINTN NumberOfPages,
|
||||||
IN OUT EFI_PHYSICAL_ADDRESS *Memory
|
IN OUT EFI_PHYSICAL_ADDRESS *Memory
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
@ -52,8 +52,8 @@ UnitTestAllocatePages (
|
|||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
UnitTestFreePages (
|
UnitTestFreePages (
|
||||||
IN EFI_PHYSICAL_ADDRESS Memory,
|
IN EFI_PHYSICAL_ADDRESS Memory,
|
||||||
IN UINTN NumberOfPages
|
IN UINTN NumberOfPages
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
return EFI_NOT_AVAILABLE_YET;
|
return EFI_NOT_AVAILABLE_YET;
|
||||||
@ -138,7 +138,7 @@ UnitTestAllocatePool (
|
|||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
UnitTestFreePool (
|
UnitTestFreePool (
|
||||||
IN VOID *Buffer
|
IN VOID *Buffer
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
return EFI_NOT_AVAILABLE_YET;
|
return EFI_NOT_AVAILABLE_YET;
|
||||||
|
@ -21,7 +21,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
|||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
UnitTestGetNextMonotonicCount (
|
UnitTestGetNextMonotonicCount (
|
||||||
OUT UINT64 *Count
|
OUT UINT64 *Count
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
STATIC UINT64 StaticCount = 0;
|
STATIC UINT64 StaticCount = 0;
|
||||||
@ -44,7 +44,7 @@ UnitTestGetNextMonotonicCount (
|
|||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
UnitTestStall (
|
UnitTestStall (
|
||||||
IN UINTN Microseconds
|
IN UINTN Microseconds
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
return EFI_NOT_AVAILABLE_YET;
|
return EFI_NOT_AVAILABLE_YET;
|
||||||
@ -75,10 +75,10 @@ UnitTestStall (
|
|||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
UnitTestSetWatchdogTimer (
|
UnitTestSetWatchdogTimer (
|
||||||
IN UINTN Timeout,
|
IN UINTN Timeout,
|
||||||
IN UINT64 WatchdogCode,
|
IN UINT64 WatchdogCode,
|
||||||
IN UINTN DataSize,
|
IN UINTN DataSize,
|
||||||
IN CHAR16 *WatchdogData OPTIONAL
|
IN CHAR16 *WatchdogData OPTIONAL
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
return EFI_NOT_AVAILABLE_YET;
|
return EFI_NOT_AVAILABLE_YET;
|
||||||
@ -183,12 +183,12 @@ UnitTestDisconnectController (
|
|||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
UnitTestCalculateCrc32 (
|
UnitTestCalculateCrc32 (
|
||||||
IN VOID *Data,
|
IN VOID *Data,
|
||||||
IN UINTN DataSize,
|
IN UINTN DataSize,
|
||||||
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -14,25 +14,25 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
|||||||
|
|
||||||
#include "UefiBootServicesTableLibUnitTest.h"
|
#include "UefiBootServicesTableLibUnitTest.h"
|
||||||
|
|
||||||
#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
|
/// IHANDLE - contains a list of protocol handles
|
||||||
///
|
///
|
||||||
typedef struct {
|
typedef struct {
|
||||||
UINTN Signature;
|
UINTN Signature;
|
||||||
/// All handles list of IHANDLE
|
/// All handles list of IHANDLE
|
||||||
LIST_ENTRY AllHandles;
|
LIST_ENTRY AllHandles;
|
||||||
/// List of PROTOCOL_INTERFACE's for this handle
|
/// List of PROTOCOL_INTERFACE's for this handle
|
||||||
LIST_ENTRY Protocols;
|
LIST_ENTRY Protocols;
|
||||||
UINTN LocateRequest;
|
UINTN LocateRequest;
|
||||||
/// The Handle Database Key value when this handle was last created or modified
|
/// The Handle Database Key value when this handle was last created or modified
|
||||||
UINT64 Key;
|
UINT64 Key;
|
||||||
} IHANDLE;
|
} IHANDLE;
|
||||||
|
|
||||||
#define ASSERT_IS_HANDLE(a) ASSERT((a)->Signature == EFI_HANDLE_SIGNATURE)
|
#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
|
/// PROTOCOL_ENTRY - each different protocol has 1 entry in the protocol
|
||||||
@ -40,18 +40,17 @@ typedef struct {
|
|||||||
/// with a list of registered notifies.
|
/// with a list of registered notifies.
|
||||||
///
|
///
|
||||||
typedef struct {
|
typedef struct {
|
||||||
UINTN Signature;
|
UINTN Signature;
|
||||||
/// Link Entry inserted to mProtocolDatabase
|
/// Link Entry inserted to mProtocolDatabase
|
||||||
LIST_ENTRY AllEntries;
|
LIST_ENTRY AllEntries;
|
||||||
/// ID of the protocol
|
/// ID of the protocol
|
||||||
EFI_GUID ProtocolID;
|
EFI_GUID ProtocolID;
|
||||||
/// All protocol interfaces
|
/// All protocol interfaces
|
||||||
LIST_ENTRY Protocols;
|
LIST_ENTRY Protocols;
|
||||||
/// Registered notification handlers
|
/// Registered notification handlers
|
||||||
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')
|
||||||
|
|
||||||
///
|
///
|
||||||
@ -59,65 +58,63 @@ typedef struct {
|
|||||||
/// with a protocol interface structure
|
/// with a protocol interface structure
|
||||||
///
|
///
|
||||||
typedef struct {
|
typedef struct {
|
||||||
UINTN Signature;
|
UINTN Signature;
|
||||||
/// Link on IHANDLE.Protocols
|
/// Link on IHANDLE.Protocols
|
||||||
LIST_ENTRY Link;
|
LIST_ENTRY Link;
|
||||||
/// Back pointer
|
/// Back pointer
|
||||||
IHANDLE *Handle;
|
IHANDLE *Handle;
|
||||||
/// Link on PROTOCOL_ENTRY.Protocols
|
/// Link on PROTOCOL_ENTRY.Protocols
|
||||||
LIST_ENTRY ByProtocol;
|
LIST_ENTRY ByProtocol;
|
||||||
/// The protocol ID
|
/// The protocol ID
|
||||||
PROTOCOL_ENTRY *Protocol;
|
PROTOCOL_ENTRY *Protocol;
|
||||||
/// The interface value
|
/// The interface value
|
||||||
VOID *Interface;
|
VOID *Interface;
|
||||||
/// 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')
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
UINTN Signature;
|
UINTN Signature;
|
||||||
///Link on PROTOCOL_INTERFACE.OpenList
|
/// Link on PROTOCOL_INTERFACE.OpenList
|
||||||
LIST_ENTRY Link;
|
LIST_ENTRY Link;
|
||||||
|
|
||||||
EFI_HANDLE AgentHandle;
|
EFI_HANDLE AgentHandle;
|
||||||
EFI_HANDLE ControllerHandle;
|
EFI_HANDLE ControllerHandle;
|
||||||
UINT32 Attributes;
|
UINT32 Attributes;
|
||||||
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')
|
|
||||||
|
|
||||||
///
|
///
|
||||||
/// PROTOCOL_NOTIFY - used for each register notification for a protocol
|
/// PROTOCOL_NOTIFY - used for each register notification for a protocol
|
||||||
///
|
///
|
||||||
typedef struct {
|
typedef struct {
|
||||||
UINTN Signature;
|
UINTN Signature;
|
||||||
PROTOCOL_ENTRY *Protocol;
|
PROTOCOL_ENTRY *Protocol;
|
||||||
/// All notifications for this protocol
|
/// All notifications for this protocol
|
||||||
LIST_ENTRY Link;
|
LIST_ENTRY Link;
|
||||||
/// Event to notify
|
/// Event to notify
|
||||||
EFI_EVENT Event;
|
EFI_EVENT Event;
|
||||||
/// Last position notified
|
/// Last position notified
|
||||||
LIST_ENTRY *Position;
|
LIST_ENTRY *Position;
|
||||||
} PROTOCOL_NOTIFY;
|
} PROTOCOL_NOTIFY;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
EFI_GUID *Protocol;
|
EFI_GUID *Protocol;
|
||||||
VOID *SearchKey;
|
VOID *SearchKey;
|
||||||
LIST_ENTRY *Position;
|
LIST_ENTRY *Position;
|
||||||
PROTOCOL_ENTRY *ProtEntry;
|
PROTOCOL_ENTRY *ProtEntry;
|
||||||
} LOCATE_POSITION;
|
} LOCATE_POSITION;
|
||||||
|
|
||||||
typedef
|
typedef
|
||||||
IHANDLE *
|
IHANDLE *
|
||||||
(* UNIT_TEST_GET_NEXT) (
|
(*UNIT_TEST_GET_NEXT) (
|
||||||
IN OUT LOCATE_POSITION *Position,
|
IN OUT LOCATE_POSITION *Position,
|
||||||
OUT VOID **Interface
|
OUT VOID **Interface
|
||||||
);
|
);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -20,7 +20,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
|||||||
EFI_TPL
|
EFI_TPL
|
||||||
EFIAPI
|
EFIAPI
|
||||||
UnitTestRaiseTpl (
|
UnitTestRaiseTpl (
|
||||||
IN EFI_TPL NewTpl
|
IN EFI_TPL NewTpl
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
return TPL_APPLICATION;
|
return TPL_APPLICATION;
|
||||||
@ -36,7 +36,7 @@ UnitTestRaiseTpl (
|
|||||||
VOID
|
VOID
|
||||||
EFIAPI
|
EFIAPI
|
||||||
UnitTestRestoreTpl (
|
UnitTestRestoreTpl (
|
||||||
IN EFI_TPL NewTpl
|
IN EFI_TPL NewTpl
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
|
Reference in New Issue
Block a user