TianoCore EDK2 master
|
#include "MtrrLibUnitTest.h"
Go to the source code of this file.
Data Structures | |
struct | MTRR_LIB_TEST_CONTEXT |
struct | MTRR_LIB_GET_FIRMWARE_VARIABLE_MTRR_COUNT_CONTEXT |
Variables | |
STATIC CONST MTRR_LIB_SYSTEM_PARAMETER | mDefaultSystemParameter |
STATIC MTRR_LIB_SYSTEM_PARAMETER | mSystemParameters [] |
UINT32 | mFixedMtrrsIndex [] |
STATIC CHAR8 * | mCacheDescription [] = { "UC", "WC", "N/A", "N/A", "WT", "WP", "WB" } |
Unit tests of the MtrrLib instance of the MtrrLib class
Copyright (c) 2020 - 2023, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent
Definition in file MtrrLibUnitTest.c.
VOID DumpMemoryRanges | ( | MTRR_MEMORY_RANGE * | Ranges, |
UINTN | RangeCount | ||
) |
Dump the memory ranges.
Ranges | Memory ranges to dump. |
RangeCount | Count of memory ranges. |
Definition at line 115 of file MtrrLibUnitTest.c.
VOID GenerateRandomMemoryTypeCombination | ( | IN UINT32 | TotalCount, |
OUT UINT32 * | UcCount, | ||
OUT UINT32 * | WtCount, | ||
OUT UINT32 * | WbCount, | ||
OUT UINT32 * | WpCount, | ||
OUT UINT32 * | WcCount | ||
) |
Generate random count of MTRRs for each cache type.
TotalCount | Total MTRR count. |
UcCount | Return count of Uncacheable type. |
WtCount | Return count of Write Through type. |
WbCount | Return count of Write Back type. |
WpCount | Return count of Write Protected type. |
WcCount | Return count of Write Combining type. |
Definition at line 141 of file MtrrLibUnitTest.c.
INT32 main | ( | INT32 | Argc, |
CHAR8 * | Argv[] | ||
) |
Standard POSIX C entry point for host based unit test execution.
Argc | Number of arguments. |
Argv | Array of arguments. |
Definition at line 1299 of file MtrrLibUnitTest.c.
VOID EFIAPI RestorePcdValue | ( | UNIT_TEST_CONTEXT | Context | ) |
Clean up routine for UnitTestGetFirmwareVariableMtrrCount().
Context | Point to a UINT32 data to save the PcdCpuNumberOfReservedVariableMtrrs. |
Definition at line 1195 of file MtrrLibUnitTest.c.
UNIT_TEST_STATUS EFIAPI SavePcdValue | ( | UNIT_TEST_CONTEXT | Context | ) |
Prep routine for UnitTestGetFirmwareVariableMtrrCount().
Context | Point to a UINT32 data to save the PcdCpuNumberOfReservedVariableMtrrs. |
Definition at line 1177 of file MtrrLibUnitTest.c.
VOID SetRandomlyGeneratedMtrrSettings | ( | IN MTRR_LIB_SYSTEM_PARAMETER * | SystemParameter, |
IN MTRR_SETTINGS * | ExpectedMtrrs | ||
) |
Set Random Variable and Fixed MTRRs Settings for unit test of UnitTestMtrrGetAllMtrrs.
SystemParameter | System parameter that controls the MTRR registers initialization. |
ExpectedMtrrs | Expected Fixed and Variable MTRRs. |
Definition at line 692 of file MtrrLibUnitTest.c.
UNIT_TEST_STATUS EFIAPI UnitTestGetFirmwareVariableMtrrCount | ( | IN UNIT_TEST_CONTEXT | Context | ) |
Unit test of MtrrLib service GetFirmwareVariableMtrrCount()
[in] | Context | Ignored |
UNIT_TEST_PASSED | The Unit test has completed and the test case was successful. |
UNIT_TEST_ERROR_TEST_FAILED | A test case assertion has failed. |
Definition at line 517 of file MtrrLibUnitTest.c.
UNIT_TEST_STATUS EFIAPI UnitTestGetVariableMtrrCount | ( | IN UNIT_TEST_CONTEXT | Context | ) |
Unit test of MtrrLib service GetVariableMtrrCount()
[in] | Context | Ignored |
UNIT_TEST_PASSED | The Unit test has completed and the test case was successful. |
UNIT_TEST_ERROR_TEST_FAILED | A test case assertion has failed. |
Definition at line 457 of file MtrrLibUnitTest.c.
STATIC EFI_STATUS EFIAPI UnitTestingEntry | ( | UINTN | Iteration | ) |
Initialize the unit test framework, suite, and unit tests for the ResetSystemLib and run the ResetSystemLib unit test.
Iteration | Iteration of testing MtrrSetMemoryAttributeInMtrrSettings and MtrrSetMemoryAttributesInMtrrSettings using random inputs. |
EFI_SUCCESS | All test cases were dispatched. |
EFI_OUT_OF_RESOURCES | There are not enough resources available to initialize the unit tests. |
Definition at line 1219 of file MtrrLibUnitTest.c.
UNIT_TEST_STATUS EFIAPI UnitTestInvalidMemoryLayouts | ( | IN UNIT_TEST_CONTEXT | Context | ) |
Test routine to check whether invalid base/size can be rejected.
Context | Pointer to MTRR_LIB_SYSTEM_PARAMETER. |
Definition at line 333 of file MtrrLibUnitTest.c.
UNIT_TEST_STATUS EFIAPI UnitTestIsMtrrSupported | ( | IN UNIT_TEST_CONTEXT | Context | ) |
Unit test of MtrrLib service IsMtrrSupported()
[in] | Context | Ignored |
UNIT_TEST_PASSED | The Unit test has completed and the test case was successful. |
UNIT_TEST_ERROR_TEST_FAILED | A test case assertion has failed. |
Definition at line 389 of file MtrrLibUnitTest.c.
UNIT_TEST_STATUS EFIAPI UnitTestMtrrDebugPrintAllMtrrs | ( | IN UNIT_TEST_CONTEXT | Context | ) |
Unit test of MtrrLib service MtrrDebugPrintAllMtrrs()
[in] | Context | Ignored |
UNIT_TEST_PASSED | The Unit test has completed and the test case was successful. |
UNIT_TEST_ERROR_TEST_FAILED | A test case assertion has failed. |
Definition at line 957 of file MtrrLibUnitTest.c.
UNIT_TEST_STATUS EFIAPI UnitTestMtrrGetAllMtrrs | ( | IN UNIT_TEST_CONTEXT | Context | ) |
Unit test of MtrrLib service MtrrGetAllMtrrs()
[in] | Context | Ignored |
UNIT_TEST_PASSED | The Unit test has completed and the test case was successful. |
UNIT_TEST_ERROR_TEST_FAILED | A test case assertion has failed. |
Definition at line 742 of file MtrrLibUnitTest.c.
UNIT_TEST_STATUS EFIAPI UnitTestMtrrGetDefaultMemoryType | ( | IN UNIT_TEST_CONTEXT | Context | ) |
Unit test of MtrrLib service MtrrGetDefaultMemoryType().
[in] | Context | Ignored |
UNIT_TEST_PASSED | The Unit test has completed and the test case was successful. |
UNIT_TEST_ERROR_TEST_FAILED | A test case assertion has failed. |
Definition at line 976 of file MtrrLibUnitTest.c.
UNIT_TEST_STATUS EFIAPI UnitTestMtrrGetFixedMtrr | ( | IN UNIT_TEST_CONTEXT | Context | ) |
Unit test of MtrrLib service MtrrGetFixedMtrr()
[in] | Context | Ignored |
UNIT_TEST_PASSED | The Unit test has completed and the test case was successful. |
UNIT_TEST_ERROR_TEST_FAILED | A test case assertion has failed. |
Definition at line 617 of file MtrrLibUnitTest.c.
UNIT_TEST_STATUS EFIAPI UnitTestMtrrGetMemoryAttribute | ( | IN UNIT_TEST_CONTEXT | Context | ) |
Unit test of MtrrLib service MtrrGetMemoryAttribute()
[in] | Context | Ignored |
UNIT_TEST_PASSED | The Unit test has completed and the test case was successful. |
UNIT_TEST_ERROR_TEST_FAILED | A test case assertion has failed. |
Definition at line 598 of file MtrrLibUnitTest.c.
UNIT_TEST_STATUS EFIAPI UnitTestMtrrGetMemoryAttributeInVariableMtrr | ( | IN UNIT_TEST_CONTEXT | Context | ) |
Unit test of MtrrLib service MtrrGetMemoryAttributeInVariableMtrr()
[in] | Context | Ignored |
UNIT_TEST_PASSED | The Unit test has completed and the test case was successful. |
UNIT_TEST_ERROR_TEST_FAILED | A test case assertion has failed. |
Definition at line 883 of file MtrrLibUnitTest.c.
UNIT_TEST_STATUS EFIAPI UnitTestMtrrSetAllMtrrs | ( | IN UNIT_TEST_CONTEXT | Context | ) |
Unit test of MtrrLib service MtrrSetAllMtrrs()
[in] | Context | Ignored |
UNIT_TEST_PASSED | The Unit test has completed and the test case was successful. |
UNIT_TEST_ERROR_TEST_FAILED | A test case assertion has failed. |
Definition at line 824 of file MtrrLibUnitTest.c.
UNIT_TEST_STATUS EFIAPI UnitTestMtrrSetAndGetMemoryAttributesInMtrrSettings | ( | IN UNIT_TEST_CONTEXT | Context | ) |
Unit test of MtrrLib service MtrrGetMemoryAttributesInMtrrSettings() and MtrrSetMemoryAttributesInMtrrSettings()
[in] | Context | Ignored |
UNIT_TEST_PASSED | The Unit test has completed and the test case was successful. |
UNIT_TEST_ERROR_TEST_FAILED | A test case assertion has failed. |
Definition at line 192 of file MtrrLibUnitTest.c.
UNIT_TEST_STATUS EFIAPI UnitTestMtrrSetMemoryAttributeAndGetMemoryAttributesInMtrrSettings | ( | IN UNIT_TEST_CONTEXT | Context | ) |
Unit test of MtrrLib service MtrrSetMemoryAttributeInMtrrSettings() and MtrrGetMemoryAttributesInMtrrSettings().
[in] | Context | Ignored |
UNIT_TEST_PASSED | The Unit test has completed and the test case was successful. |
UNIT_TEST_ERROR_TEST_FAILED | A test case assertion has failed. |
Definition at line 1049 of file MtrrLibUnitTest.c.
UNIT_TEST_STATUS VerifyMemoryRanges | ( | IN MTRR_MEMORY_RANGE * | ExpectedMemoryRanges, |
IN UINTN | ExpectedMemoryRangeCount, | ||
IN MTRR_MEMORY_RANGE * | ActualRanges, | ||
IN UINTN | ActualRangeCount | ||
) |
Compare the actual memory ranges against expected memory ranges and return PASS when they match.
ExpectedMemoryRanges | Expected memory ranges. |
ExpectedMemoryRangeCount | Count of expected memory ranges. |
ActualRanges | Actual memory ranges. |
ActualRangeCount | Count of actual memory ranges. |
UNIT_TEST_PASSED | Test passed. |
others | Test failed. |
Definition at line 89 of file MtrrLibUnitTest.c.
STATIC CHAR8* mCacheDescription[] = { "UC", "WC", "N/A", "N/A", "WT", "WP", "WB" } |
Definition at line 75 of file MtrrLibUnitTest.c.
STATIC CONST MTRR_LIB_SYSTEM_PARAMETER mDefaultSystemParameter |
Definition at line 11 of file MtrrLibUnitTest.c.
UINT32 mFixedMtrrsIndex[] |
Definition at line 42 of file MtrrLibUnitTest.c.
STATIC MTRR_LIB_SYSTEM_PARAMETER mSystemParameters[] |
Definition at line 15 of file MtrrLibUnitTest.c.