summaryrefslogtreecommitdiffstats
path: root/OvmfPkg/Library/PlatformDebugLibIoPort
diff options
context:
space:
mode:
authorAnthony PERARD <anthony.perard@citrix.com>2020-04-23 10:53:56 +0100
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>2020-04-28 21:12:01 +0000
commit52f012129ac497a3abd4aae0dc75f2a32acfd918 (patch)
tree01ebe122638cb98e52e9ffa9f0c7e53bcb363a22 /OvmfPkg/Library/PlatformDebugLibIoPort
parent61ac4fc70d3d38f3369357f7aa20c1469189789a (diff)
downloadedk2-52f012129ac497a3abd4aae0dc75f2a32acfd918.tar.gz
edk2-52f012129ac497a3abd4aae0dc75f2a32acfd918.tar.bz2
edk2-52f012129ac497a3abd4aae0dc75f2a32acfd918.zip
OvmfPkg/PlatformDebugLibIoPort: factor out debug port detection
Factor out debug port detection in PlatformDebugLibIoPort. Signed-off-by: Anthony PERARD <anthony.perard@citrix.com> Message-Id: <20200423095358.2518197-4-anthony.perard@citrix.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Diffstat (limited to 'OvmfPkg/Library/PlatformDebugLibIoPort')
-rw-r--r--OvmfPkg/Library/PlatformDebugLibIoPort/DebugIoPortQemu.c34
-rw-r--r--OvmfPkg/Library/PlatformDebugLibIoPort/DebugLib.c16
-rw-r--r--OvmfPkg/Library/PlatformDebugLibIoPort/DebugLibDetect.h6
-rw-r--r--OvmfPkg/Library/PlatformDebugLibIoPort/PlatformDebugLibIoPort.inf1
-rw-r--r--OvmfPkg/Library/PlatformDebugLibIoPort/PlatformRomDebugLibIoPort.inf1
5 files changed, 36 insertions, 22 deletions
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.<BR>
+ Copyright (c) 2012, Red Hat, Inc.<BR>
+ Copyright (c) 2020, Citrix Systems, Inc.
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include <Library/IoLib.h>
+#include <Library/PcdLib.h>
+#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 <Base.h>
-//
-// 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