TianoCore EDK2 master
|
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdarg.h>
#include <stddef.h>
#include <setjmp.h>
#include <cmocka.h>
#include <time.h>
#include <Uefi.h>
#include <Library/BaseLib.h>
#include <Library/BaseMemoryLib.h>
#include <Library/DebugLib.h>
#include <Library/UnitTestLib.h>
#include <Library/MtrrLib.h>
#include <Library/UnitTestHostBaseLib.h>
#include <Register/ArchitecturalMsr.h>
#include <Register/Cpuid.h>
#include <Register/Msr.h>
Go to the source code of this file.
Data Structures | |
struct | MTRR_LIB_SYSTEM_PARAMETER |
Macros | |
#define | UNIT_TEST_APP_NAME "MtrrLib Unit Tests" |
#define | UNIT_TEST_APP_VERSION "1.0" |
#define | SCRATCH_BUFFER_SIZE SIZE_16KB |
Functions | |
UNIT_TEST_STATUS EFIAPI | InitializeMtrrRegs (IN MTRR_LIB_SYSTEM_PARAMETER *SystemParameter) |
UNIT_TEST_STATUS EFIAPI | InitializeSystem (IN UNIT_TEST_CONTEXT Context) |
MTRR_MEMORY_CACHE_TYPE | GenerateRandomCacheType (VOID) |
VOID | GenerateValidAndConfigurableMtrrPairs (IN UINT32 PhysicalAddressBits, IN OUT MTRR_MEMORY_RANGE *RawMemoryRanges, IN UINT32 UcCount, IN UINT32 WtCount, IN UINT32 WbCount, IN UINT32 WpCount, IN UINT32 WcCount) |
VOID | GetEffectiveMemoryRanges (IN MTRR_MEMORY_CACHE_TYPE DefaultType, IN UINT32 PhysicalAddressBits, IN MTRR_MEMORY_RANGE *RawMemoryRanges, IN UINT32 RawMemoryRangeCount, OUT MTRR_MEMORY_RANGE *MemoryRanges, OUT UINTN *MemoryRangeCount) |
VOID | GenerateRandomMtrrPair (IN UINT32 PhysicalAddressBits, IN MTRR_MEMORY_CACHE_TYPE CacheType, OUT MTRR_VARIABLE_SETTING *MtrrPair OPTIONAL, OUT MTRR_MEMORY_RANGE *MtrrMemoryRange OPTIONAL) |
VOID | CollectTestResult (IN MTRR_MEMORY_CACHE_TYPE DefaultType, IN UINT32 PhysicalAddressBits, IN UINT32 VariableMtrrCount, IN MTRR_SETTINGS *Mtrrs, OUT MTRR_MEMORY_RANGE *Ranges, IN OUT UINTN *RangeCount, OUT UINT32 *MtrrCount) |
UINT64 | Random64 (UINT64 Start, UINT64 Limit) |
UINT32 | Random32 (UINT32 Start, UINT32 Limit) |
VOID | GenerateRandomNumbers (CHAR8 *FilePath, UINTN Count) |
Variables | |
UINT32 | mFixedMtrrsIndex [] |
BOOLEAN | mRandomInput |
Copyright (c) 2020 - 2023, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent
Definition in file MtrrLibUnitTest.h.
#define SCRATCH_BUFFER_SIZE SIZE_16KB |
Definition at line 35 of file MtrrLibUnitTest.h.
#define UNIT_TEST_APP_NAME "MtrrLib Unit Tests" |
Definition at line 32 of file MtrrLibUnitTest.h.
#define UNIT_TEST_APP_VERSION "1.0" |
Definition at line 33 of file MtrrLibUnitTest.h.
VOID CollectTestResult | ( | IN MTRR_MEMORY_CACHE_TYPE | DefaultType, |
IN UINT32 | PhysicalAddressBits, | ||
IN UINT32 | VariableMtrrCount, | ||
IN MTRR_SETTINGS * | Mtrrs, | ||
OUT MTRR_MEMORY_RANGE * | Ranges, | ||
IN OUT UINTN * | RangeCount, | ||
OUT UINT32 * | MtrrCount | ||
) |
Collect the test result.
DefaultType | Default memory type. |
PhysicalAddressBits | Physical address bits. |
VariableMtrrCount | Count of variable MTRRs. |
Mtrrs | MTRR settings to collect from. |
Ranges | Return the memory ranges. |
RangeCount | Return the count of memory ranges. |
MtrrCount | Return the count of variable MTRRs being used. |
MTRR_MEMORY_CACHE_TYPE GenerateRandomCacheType | ( | VOID | ) |
VOID GenerateRandomMtrrPair | ( | IN UINT32 | PhysicalAddressBits, |
IN MTRR_MEMORY_CACHE_TYPE | CacheType, | ||
OUT MTRR_VARIABLE_SETTING *MtrrPair | OPTIONAL, | ||
OUT MTRR_MEMORY_RANGE *MtrrMemoryRange | OPTIONAL | ||
) |
VOID GenerateRandomNumbers | ( | CHAR8 * | FilePath, |
UINTN | Count | ||
) |
VOID GenerateValidAndConfigurableMtrrPairs | ( | IN UINT32 | PhysicalAddressBits, |
IN OUT MTRR_MEMORY_RANGE * | RawMemoryRanges, | ||
IN UINT32 | UcCount, | ||
IN UINT32 | WtCount, | ||
IN UINT32 | WbCount, | ||
IN UINT32 | WpCount, | ||
IN UINT32 | WcCount | ||
) |
Generate random MTRRs.
PhysicalAddressBits | Physical address bits. |
RawMemoryRanges | Return the randomly generated MTRRs. |
UcCount | Count of Uncacheable MTRRs. |
WtCount | Count of Write Through MTRRs. |
WbCount | Count of Write Back MTRRs. |
WpCount | Count of Write Protected MTRRs. |
WcCount | Count of Write Combining MTRRs. |
Generate random MTRRs.
PhysicalAddressBits | Physical address bits. |
RawMemoryRanges | Return the randomly generated MTRRs. |
UcCount | Count of Uncacheable MTRRs. |
WtCount | Count of Write Through MTRRs. |
WbCount | Count of Write Back MTRRs. |
WpCount | Count of Write Protected MTRRs. |
WcCount | Count of Write Combine MTRRs. |
VOID GetEffectiveMemoryRanges | ( | IN MTRR_MEMORY_CACHE_TYPE | DefaultType, |
IN UINT32 | PhysicalAddressBits, | ||
IN MTRR_MEMORY_RANGE * | RawMemoryRanges, | ||
IN UINT32 | RawMemoryRangeCount, | ||
OUT MTRR_MEMORY_RANGE * | MemoryRanges, | ||
OUT UINTN * | MemoryRangeCount | ||
) |
Convert the MTRR BASE/MASK array to memory ranges.
DefaultType | Default memory type. |
PhysicalAddressBits | Physical address bits. |
RawMemoryRanges | Raw memory ranges. |
RawMemoryRangeCount | Count of raw memory ranges. |
MemoryRanges | Memory ranges. |
MemoryRangeCount | Count of memory ranges. |
UNIT_TEST_STATUS EFIAPI InitializeMtrrRegs | ( | IN MTRR_LIB_SYSTEM_PARAMETER * | SystemParameter | ) |
UNIT_TEST_STATUS EFIAPI InitializeSystem | ( | IN UNIT_TEST_CONTEXT | Context | ) |
UINT32 Random32 | ( | UINT32 | Start, |
UINT32 | Limit | ||
) |
Return a 32bit random number.
Start | Start of the random number range. |
Limit | Limit of the random number range. |
Return a 32bit random number.
Start | Start of the random number range. |
Limit | Limit of the random number range, and return value can be Limit. |
Definition at line 92 of file RandomTest.c.
UINT64 Random64 | ( | UINT64 | Start, |
UINT64 | Limit | ||
) |
Return a 64bit random number.
Start | Start of the random number range. |
Limit | Limit of the random number range. |
Return a 64bit random number.
Start | Start of the random number range. |
Limit | Limit of the random number range, and return value can be Limit. |
Definition at line 111 of file RandomTest.c.
|
extern |
Definition at line 42 of file MtrrLibUnitTest.c.