Remove library class warning messages and consistently link reset
logic across phases.

- Set all `HwResetSystemLib` instances to QEMU platform-specific
  reset logic.
- Set Standalone MM driver and core `HwResetSystemLib` instances
  to `BaseResetSystemLib.inf` in `QemuQ35Pkg`.
- QemuQ35Pkg:
  - Add `HwResetSystemLib` library class to `BaseResetSystemLib`
    and `DxeResetSystemLib` library instances.
  - Drop phase bindings in `BaseResetSystemLib` as content is not
    specific to those phases.

Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
This commit is contained in:
Michael Kubacki 2023-07-28 12:07:41 -04:00
Родитель aa4b42d4b9
Коммит a6f7e2859a
14 изменённых файлов: 189 добавлений и 25 удалений

Просмотреть файл

@ -1,5 +1,5 @@
/** @file
Base Reset System Library Shutdown API implementation for OVMF.
Base Reset System Library Shutdown API implementation for QEMU.
Copyright (C) 2020, Red Hat, Inc.
Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.<BR>

Просмотреть файл

@ -1,5 +1,5 @@
## @file
# Base library instance for ResetSystem library class for OVMF
# Base library instance for ResetSystem library class for QEMU.
#
# Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
# SPDX-License-Identifier: BSD-2-Clause-Patent
@ -12,7 +12,8 @@
FILE_GUID = 66564872-21d4-4d2a-a68b-1e844f980820
MODULE_TYPE = BASE
VERSION_STRING = 1.0
LIBRARY_CLASS = ResetSystemLib|SEC PEI_CORE PEIM DXE_CORE
LIBRARY_CLASS = HwResetSystemLib
LIBRARY_CLASS = ResetSystemLib
#
# The following information is for reference only and not required by the build

Просмотреть файл

@ -1,5 +1,5 @@
## @file
# DXE library instance for ResetSystem library class for OVMF
# DXE library instance for ResetSystem library class for QEMU.
#
# Copyright (C) 2020, Red Hat, Inc.
# Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>

Просмотреть файл

@ -0,0 +1,34 @@
/** @file
DXE Reset System Library Shutdown API implementation for QEMU.
Copyright (C) 2020, Red Hat, Inc.
Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.<BR>
Copyright (c) Microsoft Corporation.
SPDX-License-Identifier: BSD-2-Clause-Patent
**/
#include <PiDxe.h>
#include "ResetSystemLibInternal.h"
/**
Constructor for the DXE library instance.
@param[in] ImageHandle Image handle of this driver.
@param[in] SystemTable A Pointer to the EFI System Table.
@retval EFI_SUCEESS Always returns success.
**/
EFI_STATUS
EFIAPI
DxeConstructor (
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
)
{
SaveHardwareContext ();
return EFI_SUCCESS;
}

Просмотреть файл

@ -1,20 +1,23 @@
## @file
# DXE library instance for ResetSystem library class for OVMF
# DXE library instance for ResetSystem library class for QEMU.
#
# Copyright (C) 2020, Red Hat, Inc.
# Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
# Copyright (c) Microsoft Corporation.
#
# SPDX-License-Identifier: BSD-2-Clause-Patent
#
##
[Defines]
INF_VERSION = 1.29
BASE_NAME = DxeResetSystemLib
FILE_GUID = bc7835ea-4094-41fe-b770-bad9e6c479b2
MODULE_TYPE = DXE_DRIVER
VERSION_STRING = 1.0
LIBRARY_CLASS = ResetSystemLib|DXE_DRIVER DXE_RUNTIME_DRIVER SMM_CORE DXE_SMM_DRIVER UEFI_DRIVER UEFI_APPLICATION
CONSTRUCTOR = DxeResetInit
INF_VERSION = 1.29
BASE_NAME = DxeResetSystemLib
FILE_GUID = bc7835ea-4094-41fe-b770-bad9e6c479b2
MODULE_TYPE = DXE_DRIVER
VERSION_STRING = 1.0
LIBRARY_CLASS = ResetSystemLib|DXE_DRIVER DXE_RUNTIME_DRIVER SMM_CORE DXE_SMM_DRIVER UEFI_DRIVER UEFI_APPLICATION
LIBRARY_CLASS = HwResetSystemLib|DXE_DRIVER DXE_RUNTIME_DRIVER SMM_CORE DXE_SMM_DRIVER UEFI_DRIVER UEFI_APPLICATION
CONSTRUCTOR = DxeConstructor
#
# The following information is for reference only and not required by the build
@ -24,8 +27,10 @@
#
[Sources]
DxeResetShutdown.c
DxeResetSystemLib.c
ResetSystemLib.c
ResetSystemLibInternal.h
RuntimeResetSystemLib.c
[Packages]
MdeModulePkg/MdeModulePkg.dec

Просмотреть файл

@ -1,5 +1,5 @@
/** @file
Reset System Library functions for OVMF
Reset System Library functions for QEMU.
Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent

Просмотреть файл

@ -1,5 +1,5 @@
## @file
# DXE library instance for ResetSystem library class for OVMF
# DXE library instance for ResetSystem library class for QEMU.
#
# Copyright (C) 2020, Red Hat, Inc.
# Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>

Просмотреть файл

@ -1,5 +1,5 @@
/** @file
Reset System Library functions for OVMF
Reset System Library functions for QEMU.
Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent

Просмотреть файл

@ -0,0 +1,25 @@
/** @file
Local header file with internal library internal functionality.
Copyright (c) Microsoft Corporation.
SPDX-License-Identifier: BSD-2-Clause-Patents
**/
#ifndef RESET_SYSTEM_LIB_INTERNAL_H_
#define RESET_SYSTEM_LIB_INTERNAL_H_
/**
Stores hardware reset context for later use.
@retval EFI_SUCCESS The hardware information was saved successfully.
@retval EFI_UNSUPPORTED The host bridge PCI device ID is invalid or unexpected.
**/
EFI_STATUS
SaveHardwareContext (
VOID
);
#endif

Просмотреть файл

@ -1,5 +1,5 @@
/** @file
Reset System Library functions for OVMF
Reset System Library functions for QEMU.
Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent

Просмотреть файл

@ -1,9 +1,13 @@
/** @file
DXE Reset System Library Shutdown API implementation for OVMF.
Reset System Library Shutdown API implementation that can be used at
runtime.
Copyright (C) 2020, Red Hat, Inc.
Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.<BR>
Copyright (c) Microsoft Corporation.
SPDX-License-Identifier: BSD-2-Clause-Patent
**/
#include <Base.h> // BIT13
@ -15,14 +19,21 @@
#include <Library/ResetSystemLib.h> // ResetShutdown()
#include <OvmfPlatforms.h> // PIIX4_PMBA_VALUE
#include "ResetSystemLibInternal.h"
STATIC UINT16 mAcpiPmBaseAddress;
STATIC UINT16 mAcpiHwReducedSleepCtl;
/**
Stores hardware reset context for later use.
@retval EFI_SUCCESS The hardware information was saved successfully.
@retval EFI_UNSUPPORTED The host bridge PCI device ID is invalid or unexpected.
**/
EFI_STATUS
EFIAPI
DxeResetInit (
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
SaveHardwareContext (
VOID
)
{
UINT16 HostBridgeDevId;

Просмотреть файл

@ -0,0 +1,34 @@
/** @file
Standalone MM Reset System Library Shutdown API implementation for QEMU.
Copyright (C) 2020, Red Hat, Inc.
Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.<BR>
Copyright (c) Microsoft Corporation.
SPDX-License-Identifier: BSD-2-Clause-Patent
**/
#include <PiMm.h>
#include "ResetSystemLibInternal.h"
/**
Constructor for the Standalone MM library instance.
@param[in] ImageHandle Image handle of this driver.
@param[in] SystemTable A Pointer to the MM System Table.
@retval EFI_SUCEESS Always returns success.
**/
EFI_STATUS
EFIAPI
StandaloneMmConstructor (
IN EFI_HANDLE ImageHandle,
IN EFI_MM_SYSTEM_TABLE *SystemTable
)
{
SaveHardwareContext ();
return EFI_SUCCESS;
}

Просмотреть файл

@ -0,0 +1,50 @@
## @file
# Standalone MM library instance for ResetSystem library class for QEMU.
#
# Copyright (C) 2020, Red Hat, Inc.
# Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
# Copyright (c) Microsoft Corporation.
#
# SPDX-License-Identifier: BSD-2-Clause-Patent
#
##
[Defines]
INF_VERSION = 0x0001001A
BASE_NAME = StandaloneMmResetSystemLib
FILE_GUID = F95BE63D-2DD4-43AC-8C80-46F7741E8061
MODULE_TYPE = MM_STANDALONE
PI_SPECIFICATION_VERSION = 0x00010032
VERSION_STRING = 1.0
LIBRARY_CLASS = ResetSystemLib|MM_STANDALONE MM_CORE_STANDALONE
LIBRARY_CLASS = HwResetSystemLib|MM_STANDALONE MM_CORE_STANDALONE
CONSTRUCTOR = StandaloneMmConstructor
#
# The following information is for reference only and not required by the build
# tools.
#
# VALID_ARCHITECTURES = IA32 X64
#
[Sources]
ResetSystemLib.c
ResetSystemLibInternal.h
RuntimeResetSystemLib.c
StandaloneMmResetSystemLib.c
[Packages]
MdeModulePkg/MdeModulePkg.dec
MdePkg/MdePkg.dec
QemuPkg/QemuPkg.dec
QemuQ35Pkg/QemuQ35Pkg.dec
[LibraryClasses]
BaseLib
DebugLib
IoLib
PcdLib
TimerLib
[Pcd]
gQemuPkgTokenSpaceGuid.PcdOvmfHostBridgePciDevId ## CONSUMES

Просмотреть файл

@ -463,7 +463,7 @@
PcdLib |MdePkg/Library/DxePcdLib/DxePcdLib.inf
HobLib |MdePkg/Library/DxeHobLib/DxeHobLib.inf
ResetSystemLib |MdeModulePkg/Library/DxeResetSystemLib/DxeResetSystemLib.inf
HwResetSystemLib |MdeModulePkg/Library/DxeResetSystemLib/DxeResetSystemLib.inf
HwResetSystemLib |QemuQ35Pkg/Library/ResetSystemLib/BaseResetSystemLib.inf
DxeCoreEntryPoint |MdePkg/Library/DxeCoreEntryPoint/DxeCoreEntryPoint.inf
MemoryAllocationLib |MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAllocationLib.inf
CpuExceptionHandlerLib |UefiCpuPkg/Library/CpuExceptionHandlerLib/DxeCpuExceptionHandlerLib.inf
@ -570,7 +570,7 @@
DevicePathLib|MdePkg/Library/UefiDevicePathLib/UefiDevicePathLibStandaloneMm.inf
SortLib|MdeModulePkg/Library/BaseSortLib/BaseSortLib.inf
SmmPolicyGateLib|MmSupervisorPkg/Library/SmmPolicyGateLib/SmmPolicyGateLib.inf
HwResetSystemLib|PcAtChipsetPkg/Library/ResetSystemLib/ResetSystemLib.inf
HwResetSystemLib|QemuQ35Pkg/Library/ResetSystemLib/StandaloneMmResetSystemLib.inf
IhvSmmSaveStateSupervisionLib|MmSupervisorPkg/Library/IhvMmSaveStateSupervisionLib/IhvMmSaveStateSupervisionLib.inf
[LibraryClasses.common.MM_STANDALONE]
@ -582,7 +582,7 @@
LockBoxLib|MdeModulePkg/Library/SmmLockBoxLib/SmmLockBoxStandaloneMmLib.inf
CpuExceptionHandlerLib|UefiCpuPkg/Library/CpuExceptionHandlerLib/SmmCpuExceptionHandlerLib.inf
ReportStatusCodeLib|MdeModulePkg/Library/SmmReportStatusCodeLib/StandaloneMmReportStatusCodeLib.inf
HwResetSystemLib|PcAtChipsetPkg/Library/ResetSystemLib/ResetSystemLib.inf
HwResetSystemLib|QemuQ35Pkg/Library/ResetSystemLib/StandaloneMmResetSystemLib.inf
StandaloneMmDriverEntryPoint|MmSupervisorPkg/Library/StandaloneMmDriverEntryPoint/StandaloneMmDriverEntryPoint.inf
# TODO: ShareCrypto support
BaseCryptLib|CryptoPkg/Library/BaseCryptLib/SmmCryptLib.inf
@ -924,6 +924,10 @@
!include CryptoPkg/Driver/Bin/CryptoDriver.inc.dsc
!endif
QemuQ35Pkg/Library/ResetSystemLib/BaseResetSystemLib.inf
QemuQ35Pkg/Library/ResetSystemLib/DxeResetSystemLib.inf
QemuQ35Pkg/Library/ResetSystemLib/StandaloneMmResetSystemLib.inf
[Components.IA32]
QemuQ35Pkg/ResetVector/ResetVector.inf