Michael Kubacki 6e8b0b6913 UnitTestFrameworkPkg: Add UnitTestUefiBootServicesTableLib
This library supports a Boot Services table library implementation
that allows code dependent upon UefiBootServicesTableLib to operate
in an isolated execution environment such as within
the context of a host-based unit test framework.

The unit test should initialize the Boot Services database with any
required elements (e.g. protocols, events, handles, etc.) prior to
the services being invoked by code under test.

It is strongly recommended to clean any global databases (e.g.
protocol, event, handles, etc.) after every unit test so the tests
execute in a predictable manner from a clean state.

This library is being moved here from PrmPkg so it can be made more
generally available to other packages and improved upon for others
use.

Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Sean Brogan <sean.brogan@microsoft.com>
Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>
2022-11-07 16:07:33 +00:00

44 lines
863 B
C

/** @file
Implementation of Task Priority Level (TPL) related services in the UEFI Boot Services table for use in unit tests.
Copyright (c) Microsoft Corporation
SPDX-License-Identifier: BSD-2-Clause-Patent
**/
#include "UnitTestUefiBootServicesTableLib.h"
/**
Raise the task priority level to the new level.
High level is implemented by disabling processor interrupts.
@param NewTpl New task priority level
@return The previous task priority level
**/
EFI_TPL
EFIAPI
UnitTestRaiseTpl (
IN EFI_TPL NewTpl
)
{
return TPL_APPLICATION;
}
/**
Lowers the task priority to the previous value. If the new
priority unmasks events at a higher priority, they are dispatched.
@param NewTpl New, lower, task priority
**/
VOID
EFIAPI
UnitTestRestoreTpl (
IN EFI_TPL NewTpl
)
{
return;
}