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:
Michael Kubacki
2022-03-15 14:46:34 -04:00
committed by mergify[bot]
parent f3c11224b5
commit a298a84478
40 changed files with 1501 additions and 1431 deletions

View File

@@ -17,10 +17,14 @@
STATIC EFI_HANDLE mPrmConfigProtocolHandle;
// {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}
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.
@@ -34,8 +38,8 @@ STATIC CONST EFI_GUID mCheckParamBufferPrmHandlerGuid = {0x2e4f2d13, 0x6240, 0x4
EFI_STATUS
EFIAPI
AcpiParameterBufferModuleConfigLibConstructor (
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
)
{
EFI_STATUS Status;
@@ -43,9 +47,9 @@ AcpiParameterBufferModuleConfigLibConstructor (
ACPI_PARAMETER_BUFFER_DESCRIPTOR *AcpiParamBufferDescriptor;
PRM_CONFIG_PROTOCOL *PrmConfigProtocol;
AcpiParameterBuffer = NULL;
AcpiParameterBuffer = NULL;
AcpiParamBufferDescriptor = NULL;
PrmConfigProtocol = NULL;
PrmConfigProtocol = NULL;
/*
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;
goto Done;
}
CopyGuid (&PrmConfigProtocol->ModuleContextBuffers.ModuleGuid, &mPrmModuleGuid);
// Populate the ACPI Parameter Buffer Descriptor structure
CopyGuid (&AcpiParamBufferDescriptor->HandlerGuid, &mCheckParamBufferPrmHandlerGuid);
AcpiParamBufferDescriptor->AcpiParameterBufferAddress = (UINT64) (UINTN) AcpiParameterBuffer;
AcpiParamBufferDescriptor->AcpiParameterBufferAddress = (UINT64)(UINTN)AcpiParameterBuffer;
// Populate the PRM Module Context Buffers structure
PrmConfigProtocol->ModuleContextBuffers.AcpiParameterBufferDescriptorCount = 1;
PrmConfigProtocol->ModuleContextBuffers.AcpiParameterBufferDescriptors = AcpiParamBufferDescriptor;
PrmConfigProtocol->ModuleContextBuffers.AcpiParameterBufferDescriptors = AcpiParamBufferDescriptor;
//
// Install the PRM Configuration Protocol for this module. This indicates the configuration
@@ -100,7 +105,7 @@ AcpiParameterBufferModuleConfigLibConstructor (
&mPrmConfigProtocolHandle,
&gPrmConfigProtocolGuid,
EFI_NATIVE_INTERFACE,
(VOID *) PrmConfigProtocol
(VOID *)PrmConfigProtocol
);
Done:
@@ -108,9 +113,11 @@ Done:
if (AcpiParameterBuffer != NULL) {
FreePool (AcpiParameterBuffer);
}
if (AcpiParamBufferDescriptor != NULL) {
FreePool (AcpiParamBufferDescriptor);
}
if (PrmConfigProtocol != NULL) {
FreePool (PrmConfigProtocol);
}

View File

@@ -15,14 +15,14 @@
// TEMP
#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
//
// {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.
@@ -39,13 +39,12 @@
@retval Others An error occurred in the PRM handler.
**/
PRM_HANDLER_EXPORT (CheckParamBufferPrmHandler)
{
PRM_HANDLER_EXPORT (CheckParamBufferPrmHandler) {
if (ParameterBuffer == NULL) {
return EFI_INVALID_PARAMETER;
}
if (*((UINT32 *) ParameterBuffer) == PARAM_BUFFER_TEST_SIGNATURE) {
if (*((UINT32 *)ParameterBuffer) == PARAM_BUFFER_TEST_SIGNATURE) {
return EFI_SUCCESS;
}
@@ -71,8 +70,8 @@ PRM_MODULE_EXPORT (
EFI_STATUS
EFIAPI
PrmSampleAcpiParameterBufferModuleInit (
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
)
{
return EFI_SUCCESS;

View File

@@ -13,12 +13,12 @@
#include <Base.h>
#define SOME_VALUE_ARRAY_MAX_VALUES 16
#define SOME_VALUE_ARRAY_MAX_VALUES 16
typedef struct {
BOOLEAN Policy1Enabled;
BOOLEAN Policy2Enabled;
UINT8 SomeValueArray[SOME_VALUE_ARRAY_MAX_VALUES];
BOOLEAN Policy1Enabled;
BOOLEAN Policy2Enabled;
UINT8 SomeValueArray[SOME_VALUE_ARRAY_MAX_VALUES];
} STATIC_DATA_SAMPLE_CONTEXT_BUFFER_MODULE;
#endif

View File

@@ -21,10 +21,14 @@
STATIC EFI_HANDLE mPrmConfigProtocolHandle;
// {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}
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.
@@ -70,16 +74,17 @@ PopulateStaticDataBuffer (
**/
EFI_STATUS
GetStaticDataBuffer (
OUT PRM_DATA_BUFFER **StaticDataBuffer
OUT PRM_DATA_BUFFER **StaticDataBuffer
)
{
EFI_STATUS Status;
PRM_DATA_BUFFER *DataBuffer;
UINTN DataBufferLength;
EFI_STATUS Status;
PRM_DATA_BUFFER *DataBuffer;
UINTN DataBufferLength;
if (StaticDataBuffer == NULL) {
return EFI_INVALID_PARAMETER;
}
*StaticDataBuffer = NULL;
//
@@ -96,9 +101,9 @@ GetStaticDataBuffer (
// Initialize the data buffer header
//
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);
*StaticDataBuffer = DataBuffer;
@@ -117,17 +122,17 @@ GetStaticDataBuffer (
EFI_STATUS
EFIAPI
ContextBufferModuleConfigLibConstructor (
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
)
{
EFI_STATUS Status;
PRM_CONTEXT_BUFFER *PrmContextBuffer;
PRM_DATA_BUFFER *StaticDataBuffer;
PRM_CONFIG_PROTOCOL *PrmConfigProtocol;
EFI_STATUS Status;
PRM_CONTEXT_BUFFER *PrmContextBuffer;
PRM_DATA_BUFFER *StaticDataBuffer;
PRM_CONFIG_PROTOCOL *PrmConfigProtocol;
PrmContextBuffer = NULL;
StaticDataBuffer = NULL;
PrmContextBuffer = NULL;
StaticDataBuffer = NULL;
PrmConfigProtocol = NULL;
/*
@@ -144,7 +149,7 @@ ContextBufferModuleConfigLibConstructor (
//
Status = GetStaticDataBuffer (&StaticDataBuffer);
ASSERT_EFI_ERROR (Status);
if (EFI_ERROR (Status) || StaticDataBuffer == NULL) {
if (EFI_ERROR (Status) || (StaticDataBuffer == NULL)) {
goto Done;
}
@@ -166,9 +171,10 @@ ContextBufferModuleConfigLibConstructor (
Status = EFI_OUT_OF_RESOURCES;
goto Done;
}
CopyGuid (&PrmContextBuffer->HandlerGuid, &mCheckStaticDataBufferPrmHandlerGuid);
PrmContextBuffer->Signature = PRM_CONTEXT_BUFFER_SIGNATURE;
PrmContextBuffer->Version = PRM_CONTEXT_BUFFER_INTERFACE_VERSION;
PrmContextBuffer->Signature = PRM_CONTEXT_BUFFER_SIGNATURE;
PrmContextBuffer->Version = PRM_CONTEXT_BUFFER_INTERFACE_VERSION;
PrmContextBuffer->StaticDataBuffer = StaticDataBuffer;
PrmConfigProtocol = AllocateZeroPool (sizeof (*PrmConfigProtocol));
@@ -177,9 +183,10 @@ ContextBufferModuleConfigLibConstructor (
Status = EFI_OUT_OF_RESOURCES;
goto Done;
}
CopyGuid (&PrmConfigProtocol->ModuleContextBuffers.ModuleGuid, &mPrmModuleGuid);
PrmConfigProtocol->ModuleContextBuffers.BufferCount = 1;
PrmConfigProtocol->ModuleContextBuffers.Buffer = PrmContextBuffer;
PrmConfigProtocol->ModuleContextBuffers.Buffer = PrmContextBuffer;
//
// Install the PRM Configuration Protocol for this module. This indicates the configuration
@@ -189,7 +196,7 @@ ContextBufferModuleConfigLibConstructor (
&mPrmConfigProtocolHandle,
&gPrmConfigProtocolGuid,
EFI_NATIVE_INTERFACE,
(VOID *) PrmConfigProtocol
(VOID *)PrmConfigProtocol
);
Done:
@@ -197,9 +204,11 @@ Done:
if (StaticDataBuffer != NULL) {
FreePool (StaticDataBuffer);
}
if (PrmContextBuffer != NULL) {
FreePool (PrmContextBuffer);
}
if (PrmConfigProtocol != NULL) {
FreePool (PrmConfigProtocol);
}

View File

@@ -21,7 +21,7 @@
//
// {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.
@@ -35,8 +35,7 @@
@retval Others An error occurred in the PRM handler.
**/
PRM_HANDLER_EXPORT (CheckStaticDataBufferPrmHandler)
{
PRM_HANDLER_EXPORT (CheckStaticDataBufferPrmHandler) {
if (ContextBuffer == NULL) {
return EFI_INVALID_PARAMETER;
}
@@ -49,8 +48,9 @@ PRM_HANDLER_EXPORT (CheckStaticDataBufferPrmHandler)
// Verify PRM data buffer signature is valid
//
if (
ContextBuffer->Signature != PRM_CONTEXT_BUFFER_SIGNATURE ||
ContextBuffer->StaticDataBuffer->Header.Signature != PRM_DATA_BUFFER_HEADER_SIGNATURE) {
(ContextBuffer->Signature != PRM_CONTEXT_BUFFER_SIGNATURE) ||
(ContextBuffer->StaticDataBuffer->Header.Signature != PRM_DATA_BUFFER_HEADER_SIGNATURE))
{
return EFI_NOT_FOUND;
}
@@ -76,8 +76,8 @@ PRM_MODULE_EXPORT (
EFI_STATUS
EFIAPI
PrmSampleContextBufferModuleInit (
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
)
{
return EFI_SUCCESS;

View File

@@ -15,8 +15,8 @@
#ifndef HPET_REGISTER_H_
#define HPET_REGISTER_H_
#define HPET_BASE_ADDRESS 0xFED00000
#define HPET_RANGE_LENGTH 0x1000
#define HPET_BASE_ADDRESS 0xFED00000
#define HPET_RANGE_LENGTH 0x1000
///
/// HPET General Register Offsets
@@ -28,15 +28,15 @@
///
/// HPET Timer Register Offsets
///
#define HPET_MAIN_COUNTER_OFFSET 0x0F0
#define HPET_TIMER_CONFIGURATION_OFFSET 0x100
#define HPET_TIMER_COMPARATOR_OFFSET 0x108
#define HPET_TIMER_MSI_ROUTE_OFFSET 0x110
#define HPET_MAIN_COUNTER_OFFSET 0x0F0
#define HPET_TIMER_CONFIGURATION_OFFSET 0x100
#define HPET_TIMER_COMPARATOR_OFFSET 0x108
#define HPET_TIMER_MSI_ROUTE_OFFSET 0x110
///
/// Stride between sets of HPET Timer Registers
///
#define HPET_TIMER_STRIDE 0x20
#define HPET_TIMER_STRIDE 0x20
#pragma pack(1)
@@ -45,15 +45,15 @@
///
typedef union {
struct {
UINT32 Revision:8;
UINT32 NumberOfTimers:5;
UINT32 CounterSize:1;
UINT32 Reserved0:1;
UINT32 LegacyRoute:1;
UINT32 VendorId:16;
UINT32 CounterClockPeriod:32;
UINT32 Revision : 8;
UINT32 NumberOfTimers : 5;
UINT32 CounterSize : 1;
UINT32 Reserved0 : 1;
UINT32 LegacyRoute : 1;
UINT32 VendorId : 16;
UINT32 CounterClockPeriod : 32;
} Bits;
UINT64 Uint64;
UINT64 Uint64;
} HPET_GENERAL_CAPABILITIES_ID_REGISTER;
///
@@ -61,12 +61,12 @@ typedef union {
///
typedef union {
struct {
UINT32 MainCounterEnable:1;
UINT32 LegacyRouteEnable:1;
UINT32 Reserved0:30;
UINT32 Reserved1:32;
UINT32 MainCounterEnable : 1;
UINT32 LegacyRouteEnable : 1;
UINT32 Reserved0 : 30;
UINT32 Reserved1 : 32;
} Bits;
UINT64 Uint64;
UINT64 Uint64;
} HPET_GENERAL_CONFIGURATION_REGISTER;
///
@@ -74,22 +74,22 @@ typedef union {
///
typedef union {
struct {
UINT32 Reserved0:1;
UINT32 LevelTriggeredInterrupt:1;
UINT32 InterruptEnable:1;
UINT32 PeriodicInterruptEnable:1;
UINT32 PeriodicInterruptCapability:1;
UINT32 CounterSizeCapability:1;
UINT32 ValueSetEnable:1;
UINT32 Reserved1:1;
UINT32 CounterSizeEnable:1;
UINT32 InterruptRoute:5;
UINT32 MsiInterruptEnable:1;
UINT32 MsiInterruptCapability:1;
UINT32 Reserved2:16;
UINT32 InterruptRouteCapability;
UINT32 Reserved0 : 1;
UINT32 LevelTriggeredInterrupt : 1;
UINT32 InterruptEnable : 1;
UINT32 PeriodicInterruptEnable : 1;
UINT32 PeriodicInterruptCapability : 1;
UINT32 CounterSizeCapability : 1;
UINT32 ValueSetEnable : 1;
UINT32 Reserved1 : 1;
UINT32 CounterSizeEnable : 1;
UINT32 InterruptRoute : 5;
UINT32 MsiInterruptEnable : 1;
UINT32 MsiInterruptCapability : 1;
UINT32 Reserved2 : 16;
UINT32 InterruptRouteCapability;
} Bits;
UINT64 Uint64;
UINT64 Uint64;
} HPET_TIMER_CONFIGURATION_REGISTER;
///
@@ -97,10 +97,10 @@ typedef union {
///
typedef union {
struct {
UINT32 Value:32;
UINT32 Address:32;
UINT32 Value : 32;
UINT32 Address : 32;
} Bits;
UINT64 Uint64;
UINT64 Uint64;
} HPET_TIMER_MSI_ROUTE_REGISTER;
#pragma pack()

View File

@@ -18,7 +18,9 @@
STATIC EFI_HANDLE mPrmConfigProtocolHandle;
// {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.
@@ -32,13 +34,13 @@ STATIC CONST EFI_GUID mPrmModuleGuid = {0x0ef93ed7, 0x14ae, 0x425b, {0x92, 0x8f,
EFI_STATUS
EFIAPI
HardwareAccessModuleConfigLibConstructor (
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
)
{
EFI_STATUS Status;
PRM_RUNTIME_MMIO_RANGES *RuntimeMmioRanges;
PRM_CONFIG_PROTOCOL *PrmConfigProtocol;
EFI_STATUS Status;
PRM_RUNTIME_MMIO_RANGES *RuntimeMmioRanges;
PRM_CONFIG_PROTOCOL *PrmConfigProtocol;
RuntimeMmioRanges = NULL;
PrmConfigProtocol = NULL;
@@ -70,12 +72,13 @@ HardwareAccessModuleConfigLibConstructor (
Status = EFI_OUT_OF_RESOURCES;
goto Done;
}
CopyGuid (&PrmConfigProtocol->ModuleContextBuffers.ModuleGuid, &mPrmModuleGuid);
// Populate the Runtime MMIO Ranges structure
RuntimeMmioRanges->Count = 1;
RuntimeMmioRanges->Count = 1;
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;
@@ -87,7 +90,7 @@ HardwareAccessModuleConfigLibConstructor (
&mPrmConfigProtocolHandle,
&gPrmConfigProtocolGuid,
EFI_NATIVE_INTERFACE,
(VOID *) PrmConfigProtocol
(VOID *)PrmConfigProtocol
);
Done:
@@ -95,6 +98,7 @@ Done:
if (RuntimeMmioRanges != NULL) {
FreePool (RuntimeMmioRanges);
}
if (PrmConfigProtocol != NULL) {
FreePool (PrmConfigProtocol);
}

View File

@@ -24,18 +24,18 @@
//
// {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}
#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}
#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
//
extern CONST CHAR8 *mMtrrMemoryCacheTypeShortName[];
extern CONST CHAR8 *mMtrrMemoryCacheTypeShortName[];
/**
Initializes the valid bits mask and valid address mask for MTRRs.
@@ -48,8 +48,8 @@ extern CONST CHAR8 *mMtrrMemoryCacheTypeShortName[];
**/
VOID
MtrrLibInitializeMtrrMask (
OUT UINT64 *MtrrValidBitsMask,
OUT UINT64 *MtrrValidAddressMask
OUT UINT64 *MtrrValidBitsMask,
OUT UINT64 *MtrrValidAddressMask
);
/**
@@ -109,11 +109,11 @@ MtrrLibApplyFixedMtrrs (
**/
RETURN_STATUS
MtrrLibApplyVariableMtrrs (
IN CONST MTRR_MEMORY_RANGE *VariableMtrr,
IN UINT32 VariableMtrrCount,
IN OUT MTRR_MEMORY_RANGE *Ranges,
IN UINTN RangeCapacity,
IN OUT UINTN *RangeCount
IN CONST MTRR_MEMORY_RANGE *VariableMtrr,
IN UINT32 VariableMtrrCount,
IN OUT MTRR_MEMORY_RANGE *Ranges,
IN UINTN RangeCapacity,
IN OUT UINTN *RangeCount
);
//
@@ -130,17 +130,17 @@ AccessAllMtrrs (
VOID
)
{
MTRR_SETTINGS LocalMtrrs;
MTRR_SETTINGS *Mtrrs;
UINTN RangeCount;
UINT64 MtrrValidBitsMask;
UINT64 MtrrValidAddressMask;
UINT32 VariableMtrrCount;
MTRR_SETTINGS LocalMtrrs;
MTRR_SETTINGS *Mtrrs;
UINTN RangeCount;
UINT64 MtrrValidBitsMask;
UINT64 MtrrValidAddressMask;
UINT32 VariableMtrrCount;
MTRR_MEMORY_RANGE Ranges[
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 Ranges[
MTRR_NUMBER_OF_FIXED_MTRR * sizeof (UINT64) + 2 * ARRAY_SIZE (Mtrrs->Variables.Mtrr) + 1
];
MTRR_MEMORY_RANGE RawVariableRanges[ARRAY_SIZE (Mtrrs->Variables.Mtrr)];
if (!IsMtrrSupported ()) {
return;
@@ -155,15 +155,21 @@ AccessAllMtrrs (
Ranges[0].BaseAddress = 0;
Ranges[0].Length = MtrrValidBitsMask + 1;
Ranges[0].Type = MtrrGetDefaultMemoryType ();
RangeCount = 1;
RangeCount = 1;
MtrrLibGetRawVariableRanges (
&Mtrrs->Variables, VariableMtrrCount,
MtrrValidBitsMask, MtrrValidAddressMask, RawVariableRanges
&Mtrrs->Variables,
VariableMtrrCount,
MtrrValidBitsMask,
MtrrValidAddressMask,
RawVariableRanges
);
MtrrLibApplyVariableMtrrs (
RawVariableRanges, VariableMtrrCount,
Ranges, ARRAY_SIZE (Ranges), &RangeCount
RawVariableRanges,
VariableMtrrCount,
Ranges,
ARRAY_SIZE (Ranges),
&RangeCount
);
MtrrLibApplyFixedMtrrs (&Mtrrs->Fixed, Ranges, ARRAY_SIZE (Ranges), &RangeCount);
@@ -187,11 +193,11 @@ AccessAllMtrrs (
UINT64
EFIAPI
HpetRead (
IN UINTN Offset
IN UINTN Offset
)
{
UINTN Address;
UINT64 Value;
UINTN Address;
UINT64 Value;
Address = HPET_BASE_ADDRESS + Offset;
@@ -200,7 +206,7 @@ HpetRead (
}
MemoryFence ();
Value = *(volatile UINT64*)Address;
Value = *(volatile UINT64 *)Address;
MemoryFence ();
return Value;
@@ -251,8 +257,7 @@ GetMicrocodeSignature (
@retval Others An error occurred in the PRM handler.
**/
PRM_HANDLER_EXPORT (MsrAccessMicrocodeSignaturePrmHandler)
{
PRM_HANDLER_EXPORT (MsrAccessMicrocodeSignaturePrmHandler) {
UINT32 MicrocodeSignature;
MicrocodeSignature = 0;
@@ -277,8 +282,7 @@ PRM_HANDLER_EXPORT (MsrAccessMicrocodeSignaturePrmHandler)
@retval Others An error occurred in the PRM handler.
**/
PRM_HANDLER_EXPORT (MsrAccessMtrrDumpPrmHandler)
{
PRM_HANDLER_EXPORT (MsrAccessMtrrDumpPrmHandler) {
AccessAllMtrrs ();
return EFI_SUCCESS;
@@ -296,8 +300,7 @@ PRM_HANDLER_EXPORT (MsrAccessMtrrDumpPrmHandler)
@retval Others An error occurred in the PRM handler.
**/
PRM_HANDLER_EXPORT (MmioAccessHpetPrmHandler)
{
PRM_HANDLER_EXPORT (MmioAccessHpetPrmHandler) {
AccessHpetConfiguration ();
return EFI_SUCCESS;
@@ -324,8 +327,8 @@ PRM_MODULE_EXPORT (
EFI_STATUS
EFIAPI
PrmSampleHardwareAccessModuleInit (
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
)
{
return EFI_SUCCESS;