diff --git a/OvmfPkg/Library/PlatformDebugLibIoPort/DebugIoPortQemu.c b/OvmfPkg/Library/PlatformDebugLibIoPort/DebugIoPortQemu.c new file mode 100644 index 0000000000..bf9119807a --- /dev/null +++ b/OvmfPkg/Library/PlatformDebugLibIoPort/DebugIoPortQemu.c @@ -0,0 +1,34 @@ +/** @file + Detection code for QEMU debug port. + + Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.
+ Copyright (c) 2012, Red Hat, Inc.
+ Copyright (c) 2020, Citrix Systems, Inc. + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include +#include +#include "DebugLibDetect.h" + +// +// The constant value that is read from the debug I/O port +// +#define BOCHS_DEBUG_PORT_MAGIC 0xE9 + +/** + Return the result of detecting the debug I/O port device. + + @retval TRUE if the debug I/O port device was detected. + @retval FALSE otherwise + +**/ +BOOLEAN +EFIAPI +PlatformDebugLibIoPortDetect ( + VOID + ) +{ + return IoRead8 (PcdGet16 (PcdDebugIoPort)) == BOCHS_DEBUG_PORT_MAGIC; +} diff --git a/OvmfPkg/Library/PlatformDebugLibIoPort/DebugLib.c b/OvmfPkg/Library/PlatformDebugLibIoPort/DebugLib.c index ec2e677afd..dffb20822d 100644 --- a/OvmfPkg/Library/PlatformDebugLibIoPort/DebugLib.c +++ b/OvmfPkg/Library/PlatformDebugLibIoPort/DebugLib.c @@ -359,19 +359,3 @@ DebugPrintLevelEnabled ( { return (BOOLEAN) ((ErrorLevel & PcdGet32(PcdFixedDebugPrintErrorLevel)) != 0); } - -/** - Return the result of detecting the debug I/O port device. - - @retval TRUE if the debug I/O port device was detected. - @retval FALSE otherwise - -**/ -BOOLEAN -EFIAPI -PlatformDebugLibIoPortDetect ( - VOID - ) -{ - return IoRead8 (PcdGet16 (PcdDebugIoPort)) == BOCHS_DEBUG_PORT_MAGIC; -} diff --git a/OvmfPkg/Library/PlatformDebugLibIoPort/DebugLibDetect.h b/OvmfPkg/Library/PlatformDebugLibIoPort/DebugLibDetect.h index 4677c85ac3..6d08909dbc 100644 --- a/OvmfPkg/Library/PlatformDebugLibIoPort/DebugLibDetect.h +++ b/OvmfPkg/Library/PlatformDebugLibIoPort/DebugLibDetect.h @@ -12,12 +12,6 @@ #include -// -// The constant value that is read from the debug I/O port -// -#define BOCHS_DEBUG_PORT_MAGIC 0xE9 - - /** Helper function to return whether the virtual machine has a debug I/O port. PlatformDebugLibIoPortFound can call this function directly or cache the diff --git a/OvmfPkg/Library/PlatformDebugLibIoPort/PlatformDebugLibIoPort.inf b/OvmfPkg/Library/PlatformDebugLibIoPort/PlatformDebugLibIoPort.inf index c09f312ffb..94ab910507 100644 --- a/OvmfPkg/Library/PlatformDebugLibIoPort/PlatformDebugLibIoPort.inf +++ b/OvmfPkg/Library/PlatformDebugLibIoPort/PlatformDebugLibIoPort.inf @@ -24,6 +24,7 @@ # [Sources] + DebugIoPortQemu.c DebugLib.c DebugLibDetect.c DebugLibDetect.h diff --git a/OvmfPkg/Library/PlatformDebugLibIoPort/PlatformRomDebugLibIoPort.inf b/OvmfPkg/Library/PlatformDebugLibIoPort/PlatformRomDebugLibIoPort.inf index ab27f6327a..8f721d249d 100644 --- a/OvmfPkg/Library/PlatformDebugLibIoPort/PlatformRomDebugLibIoPort.inf +++ b/OvmfPkg/Library/PlatformDebugLibIoPort/PlatformRomDebugLibIoPort.inf @@ -24,6 +24,7 @@ # [Sources] + DebugIoPortQemu.c DebugLib.c DebugLibDetect.h DebugLibDetectRom.c