TianoCore EDK2 master
|
#include <PrmModule.h>
#include <Library/BaseLib.h>
#include <Library/MtrrLib.h>
#include <Library/UefiLib.h>
#include <Register/Intel/ArchitecturalMsr.h>
#include <Register/Intel/Cpuid.h>
#include "Hpet.h"
Go to the source code of this file.
Macros | |
#define | MSR_ACCESS_MICROCODE_SIGNATURE_PRM_HANDLER_GUID {0x2120cd3c, 0x848b, 0x4d8f, {0xab, 0xbb, 0x4b, 0x74, 0xce, 0x64, 0xac, 0x89}} |
#define | MSR_ACCESS_MTRR_DUMP_PRM_HANDLER_GUID {0xea0935a7, 0x506b, 0x4159, {0xbb, 0xbb, 0x48, 0xde, 0xee, 0xcb, 0x6f, 0x58}} |
#define | MMIO_ACCESS_HPET_PRM_HANDLER_GUID {0x1bd1bda9, 0x909a, 0x4614, {0x96, 0x99, 0x25, 0xec, 0x0c, 0x27, 0x83, 0xf7}} |
Functions | |
VOID | MtrrLibInitializeMtrrMask (OUT UINT64 *MtrrValidBitsMask, OUT UINT64 *MtrrValidAddressMask) |
UINT32 | MtrrLibGetRawVariableRanges (IN MTRR_VARIABLE_SETTINGS *VariableSettings, IN UINTN VariableMtrrCount, IN UINT64 MtrrValidBitsMask, IN UINT64 MtrrValidAddressMask, OUT MTRR_MEMORY_RANGE *VariableMtrr) |
RETURN_STATUS | MtrrLibApplyFixedMtrrs (IN MTRR_FIXED_SETTINGS *Fixed, IN OUT MTRR_MEMORY_RANGE *Ranges, IN UINTN RangeCapacity, IN OUT UINTN *RangeCount) |
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) |
VOID EFIAPI | AccessAllMtrrs (VOID) |
UINT64 EFIAPI | HpetRead (IN UINTN Offset) |
VOID EFIAPI | AccessHpetConfiguration (VOID) |
UINT32 | GetMicrocodeSignature (VOID) |
PRM_HANDLER_EXPORT (MsrAccessMicrocodeSignaturePrmHandler) | |
PRM_HANDLER_EXPORT (MsrAccessMtrrDumpPrmHandler) | |
PRM_HANDLER_EXPORT (MmioAccessHpetPrmHandler) | |
PRM_MODULE_EXPORT (PRM_HANDLER_EXPORT_ENTRY(MSR_ACCESS_MICROCODE_SIGNATURE_PRM_HANDLER_GUID, MsrAccessMicrocodeSignaturePrmHandler), PRM_HANDLER_EXPORT_ENTRY(MSR_ACCESS_MTRR_DUMP_PRM_HANDLER_GUID, MsrAccessMtrrDumpPrmHandler),) | |
EFI_STATUS EFIAPI | PrmSampleHardwareAccessModuleInit (IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable) |
Variables | |
CONST CHAR8 * | mMtrrMemoryCacheTypeShortName [] |
A sample PRM Module implementation. This PRM Module provides PRM handlers that perform various types of hardware access. This is simply meant to demonstrate hardware access capabilities from a PRM handler.
Copyright (c) Microsoft Corporation SPDX-License-Identifier: BSD-2-Clause-Patent
Definition in file PrmSampleHardwareAccessModule.c.
#define MMIO_ACCESS_HPET_PRM_HANDLER_GUID {0x1bd1bda9, 0x909a, 0x4614, {0x96, 0x99, 0x25, 0xec, 0x0c, 0x27, 0x83, 0xf7}} |
Definition at line 33 of file PrmSampleHardwareAccessModule.c.
#define MSR_ACCESS_MICROCODE_SIGNATURE_PRM_HANDLER_GUID {0x2120cd3c, 0x848b, 0x4d8f, {0xab, 0xbb, 0x4b, 0x74, 0xce, 0x64, 0xac, 0x89}} |
Definition at line 27 of file PrmSampleHardwareAccessModule.c.
#define MSR_ACCESS_MTRR_DUMP_PRM_HANDLER_GUID {0xea0935a7, 0x506b, 0x4159, {0xbb, 0xbb, 0x48, 0xde, 0xee, 0xcb, 0x6f, 0x58}} |
Definition at line 30 of file PrmSampleHardwareAccessModule.c.
VOID EFIAPI AccessAllMtrrs | ( | VOID | ) |
Accesses MTRR values including architectural and variable MTRRs.
Definition at line 129 of file PrmSampleHardwareAccessModule.c.
VOID EFIAPI AccessHpetConfiguration | ( | VOID | ) |
Accesses HPET configuration information.
Definition at line 221 of file PrmSampleHardwareAccessModule.c.
UINT32 GetMicrocodeSignature | ( | VOID | ) |
Reads the microcode signature from architectural MSR 0x8B.
MicrocodeSignature | The microcode signature value. |
Definition at line 235 of file PrmSampleHardwareAccessModule.c.
Reads a HPET MMIO register.
Reads the 64-bit HPET MMIO register specified by Address.
This function must guarantee that all MMIO read and write operations are serialized.
If Address is not aligned on a 64-bit boundary, zero will be returned.
Offset | Specifies the offset of the HPET register to read. |
Definition at line 195 of file PrmSampleHardwareAccessModule.c.
RETURN_STATUS MtrrLibApplyFixedMtrrs | ( | IN MTRR_FIXED_SETTINGS * | Fixed, |
IN OUT MTRR_MEMORY_RANGE * | Ranges, | ||
IN UINTN | RangeCapacity, | ||
IN OUT UINTN * | RangeCount | ||
) |
Apply the fixed MTRR settings to memory range array.
Fixed | The fixed MTRR settings. |
Ranges | Return the memory range array holding memory type settings for all memory address. |
RangeCapacity | The capacity of memory range array. |
RangeCount | Return the count of memory range. |
RETURN_SUCCESS | The memory range array is returned successfully. |
RETURN_OUT_OF_RESOURCES | The count of memory ranges exceeds capacity. |
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 | ||
) |
Apply the variable MTRR settings to memory range array.
VariableMtrr | The variable MTRR array. |
VariableMtrrCount | The count of variable MTRRs. |
Ranges | Return the memory range array with new MTRR settings applied. |
RangeCapacity | The capacity of memory range array. |
RangeCount | Return the count of memory range. |
RETURN_SUCCESS | The memory range array is returned successfully. |
RETURN_OUT_OF_RESOURCES | The count of memory ranges exceeds capacity. |
UINT32 MtrrLibGetRawVariableRanges | ( | IN MTRR_VARIABLE_SETTINGS * | VariableSettings, |
IN UINTN | VariableMtrrCount, | ||
IN UINT64 | MtrrValidBitsMask, | ||
IN UINT64 | MtrrValidAddressMask, | ||
OUT MTRR_MEMORY_RANGE * | VariableMtrr | ||
) |
Convert variable MTRRs to a RAW MTRR_MEMORY_RANGE array. One MTRR_MEMORY_RANGE element is created for each MTRR setting. The routine doesn't remove the overlap or combine the near-by region.
[in] | VariableSettings | The variable MTRR values to shadow |
[in] | VariableMtrrCount | The number of variable MTRRs |
[in] | MtrrValidBitsMask | The mask for the valid bit of the MTRR |
[in] | MtrrValidAddressMask | The valid address mask for MTRR |
[out] | VariableMtrr | The array to shadow variable MTRRs content |
VOID MtrrLibInitializeMtrrMask | ( | OUT UINT64 * | MtrrValidBitsMask, |
OUT UINT64 * | MtrrValidAddressMask | ||
) |
Initializes the valid bits mask and valid address mask for MTRRs.
This function initializes the valid bits mask and valid address mask for MTRRs.
[out] | MtrrValidBitsMask | The mask for the valid bit of the MTRR |
[out] | MtrrValidAddressMask | The valid address mask for the MTRR |
PRM_HANDLER_EXPORT | ( | MmioAccessHpetPrmHandler | ) |
A sample Platform Runtime Mechanism (PRM) handler.
This sample handler attempts to read from a HPET MMIO resource.
[in] | ParameterBuffer | A pointer to the PRM handler parameter buffer |
[in] | ContextBUffer | A pointer to the PRM handler context buffer |
EFI_STATUS | The PRM handler executed successfully. |
Others | An error occurred in the PRM handler. |
Definition at line 303 of file PrmSampleHardwareAccessModule.c.
PRM_HANDLER_EXPORT | ( | MsrAccessMicrocodeSignaturePrmHandler | ) |
A sample Platform Runtime Mechanism (PRM) handler.
This sample handler attempts to read the microcode update signature.
[in] | ParameterBuffer | A pointer to the PRM handler parameter buffer |
[in] | ContextBUffer | A pointer to the PRM handler context buffer |
EFI_STATUS | The PRM handler executed successfully. |
Others | An error occurred in the PRM handler. |
Definition at line 260 of file PrmSampleHardwareAccessModule.c.
PRM_HANDLER_EXPORT | ( | MsrAccessMtrrDumpPrmHandler | ) |
A sample Platform Runtime Mechanism (PRM) handler.
This sample handler attempts to read the current MTRR settings.
[in] | ParameterBuffer | A pointer to the PRM handler parameter buffer |
[in] | ContextBUffer | A pointer to the PRM handler context buffer |
EFI_STATUS | The PRM handler executed successfully. |
Others | An error occurred in the PRM handler. |
Definition at line 285 of file PrmSampleHardwareAccessModule.c.
EFI_STATUS EFIAPI PrmSampleHardwareAccessModuleInit | ( | IN EFI_HANDLE | ImageHandle, |
IN EFI_SYSTEM_TABLE * | SystemTable | ||
) |
Module entry point.
[in] | ImageHandle | The image handle. |
[in] | SystemTable | A pointer to the system table. |
EFI_SUCCESS | This function always returns success. |
Definition at line 329 of file PrmSampleHardwareAccessModule.c.