From 6c22e534beaabad5856609a86d009f3818989a4b Mon Sep 17 00:00:00 2001 From: Brijesh Singh Date: Thu, 6 Jul 2017 09:27:58 -0400 Subject: [PATCH] OvmfPkg: Add PlatformHasIoMmuLib Add the shorter-term library instance outlined in the previous patch to OvmfPkg, so that we can imbue PciHostBridgeDxe with a protocol dependency on gEdkiiIoMmuProtocolGuid OR gIoMmuAbsentProtocolGuid. Cc: Jordan Justen Cc: Laszlo Ersek Contributed-under: TianoCore Contribution Agreement 1.0 Suggested-by: Laszlo Ersek Signed-off-by: Brijesh Singh Reviewed-by: Laszlo Ersek Reviewed-by: Jordan Justen --- .../PlatformHasIoMmuLib/PlatformHasIoMmuLib.c | 33 ++++++++++++++++ .../PlatformHasIoMmuLib.inf | 38 +++++++++++++++++++ 2 files changed, 71 insertions(+) create mode 100644 OvmfPkg/Library/PlatformHasIoMmuLib/PlatformHasIoMmuLib.c create mode 100644 OvmfPkg/Library/PlatformHasIoMmuLib/PlatformHasIoMmuLib.inf diff --git a/OvmfPkg/Library/PlatformHasIoMmuLib/PlatformHasIoMmuLib.c b/OvmfPkg/Library/PlatformHasIoMmuLib/PlatformHasIoMmuLib.c new file mode 100644 index 0000000000..a271be3e8a --- /dev/null +++ b/OvmfPkg/Library/PlatformHasIoMmuLib/PlatformHasIoMmuLib.c @@ -0,0 +1,33 @@ +/** @file + A hook-in library for MdeModulePkg/Bus/Pci/PciHostBridgeDxe. + + Plugging this library instance into PciHostBridgeDxe makes + PciHostBridgeDxe depend on the platform's dynamic decision whether + to provide IOMMU implementation (usually through IoMmuDxe driver). + + Copyright (C) 2017, Red Hat, Inc. + Copyright (C) 2017, AMD, Inc. + + This program and the accompanying materials are licensed and made available + under the terms and conditions of the BSD License which accompanies this + distribution. The full text of the license may be found at + http://opensource.org/licenses/bsd-license.php + + THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WITHOUT + WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +**/ + +#include + +RETURN_STATUS +EFIAPI +PlatformHasIoMmuInitialize ( + VOID + ) +{ + // + // Do nothing, just imbue PciHostBridgeDxe with a protocol dependency on + // gIoMmuAbsentProtocolGuid OR gEdkiiIoMmuProtocolGuid. + // + return RETURN_SUCCESS; +} diff --git a/OvmfPkg/Library/PlatformHasIoMmuLib/PlatformHasIoMmuLib.inf b/OvmfPkg/Library/PlatformHasIoMmuLib/PlatformHasIoMmuLib.inf new file mode 100644 index 0000000000..f8151cfe25 --- /dev/null +++ b/OvmfPkg/Library/PlatformHasIoMmuLib/PlatformHasIoMmuLib.inf @@ -0,0 +1,38 @@ +## @file +# A hook-in library for MdeModulePkg/Bus/Pci/PciHostBridgeDxe. +# +# Plugging this library instance into PciHostBridgeDxe makes +# PciHostBridgeDxe depend on the platform's dynamic decision whether +# to provide IOMMU implementation (usually through IoMmuDxe driver). +# +# Copyright (C) 2017, Red Hat, Inc. +# Copyright (C) 2017, AMD, Inc. +# +# This program and the accompanying materials are licensed and made available +# under the terms and conditions of the BSD License which accompanies this +# distribution. The full text of the license may be found at +# http://opensource.org/licenses/bsd-license.php +# +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WITHOUT +# WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +## + +[Defines] + INF_VERSION = 1.25 + BASE_NAME = PlatformHasIoMmuLib + FILE_GUID = 49b4b018-0558-448b-1e1a-12226342877d + MODULE_TYPE = BASE + VERSION_STRING = 1.0 + LIBRARY_CLASS = PlatformHasIoMmuLib|DXE_DRIVER + CONSTRUCTOR = PlatformHasIoMmuInitialize + +[Sources] + PlatformHasIoMmuLib.c + +[Packages] + MdeModulePkg/MdeModulePkg.dec + MdePkg/MdePkg.dec + OvmfPkg/OvmfPkg.dec + +[Depex] + gEdkiiIoMmuProtocolGuid OR gIoMmuAbsentProtocolGuid