From: "Anthony PERARD" <anthony.perard@citrix.com>
To: <devel@edk2.groups.io>
Cc: Laszlo Ersek <lersek@redhat.com>,
Ard Biesheuvel <ard.biesheuvel@arm.com>,
Jordan Justen <jordan.l.justen@intel.com>,
Julien Grall <julien@xen.org>,
Anthony Perard <anthony.perard@citrix.com>
Subject: [PATCH v2 3/5] OvmfPkg/PlatformDebugLibIoPort: factor out debug port detection
Date: Thu, 23 Apr 2020 10:53:56 +0100 [thread overview]
Message-ID: <20200423095358.2518197-4-anthony.perard@citrix.com> (raw)
In-Reply-To: <20200423095358.2518197-1-anthony.perard@citrix.com>
Factor out debug port detection in PlatformDebugLibIoPort.
Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
---
.../PlatformDebugLibIoPort.inf | 1 +
.../PlatformRomDebugLibIoPort.inf | 1 +
.../PlatformDebugLibIoPort/DebugLibDetect.h | 6 ----
.../PlatformDebugLibIoPort/DebugIoPortQemu.c | 34 +++++++++++++++++++
.../Library/PlatformDebugLibIoPort/DebugLib.c | 16 ---------
5 files changed, 36 insertions(+), 22 deletions(-)
create mode 100644 OvmfPkg/Library/PlatformDebugLibIoPort/DebugIoPortQemu.c
diff --git a/OvmfPkg/Library/PlatformDebugLibIoPort/PlatformDebugLibIoPort.inf b/OvmfPkg/Library/PlatformDebugLibIoPort/PlatformDebugLibIoPort.inf
index c09f312ffb1d..94ab9105077a 100644
--- a/OvmfPkg/Library/PlatformDebugLibIoPort/PlatformDebugLibIoPort.inf
+++ b/OvmfPkg/Library/PlatformDebugLibIoPort/PlatformDebugLibIoPort.inf
@@ -24,6 +24,7 @@ [Defines]
#
[Sources]
+ DebugIoPortQemu.c
DebugLib.c
DebugLibDetect.c
DebugLibDetect.h
diff --git a/OvmfPkg/Library/PlatformDebugLibIoPort/PlatformRomDebugLibIoPort.inf b/OvmfPkg/Library/PlatformDebugLibIoPort/PlatformRomDebugLibIoPort.inf
index ab27f6327a38..8f721d249dd5 100644
--- a/OvmfPkg/Library/PlatformDebugLibIoPort/PlatformRomDebugLibIoPort.inf
+++ b/OvmfPkg/Library/PlatformDebugLibIoPort/PlatformRomDebugLibIoPort.inf
@@ -24,6 +24,7 @@ [Defines]
#
[Sources]
+ DebugIoPortQemu.c
DebugLib.c
DebugLibDetect.h
DebugLibDetectRom.c
diff --git a/OvmfPkg/Library/PlatformDebugLibIoPort/DebugLibDetect.h b/OvmfPkg/Library/PlatformDebugLibIoPort/DebugLibDetect.h
index 4677c85ac3c4..6d08909dbc58 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/DebugIoPortQemu.c b/OvmfPkg/Library/PlatformDebugLibIoPort/DebugIoPortQemu.c
new file mode 100644
index 000000000000..bf9119807a6c
--- /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 ec2e677afd8d..dffb20822d18 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;
-}
--
Anthony PERARD
next prev parent reply other threads:[~2020-04-23 9:54 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-23 9:53 [PATCH v2 0/5] OvmfXen: Cleanup debug options Anthony PERARD
2020-04-23 9:53 ` [PATCH v2 1/5] OvmfPkg/OvmfXen: Remove DEBUG_ON_SERIAL_PORT Anthony PERARD
2020-04-23 10:52 ` [edk2-devel] " Philippe Mathieu-Daudé
2020-04-23 9:53 ` [PATCH v2 2/5] OvmfPkg/PlatformDebugLibIoPort: Reword QEMU to hypervisor Anthony PERARD
2020-04-24 17:48 ` [edk2-devel] " Laszlo Ersek
2020-04-23 9:53 ` Anthony PERARD [this message]
2020-04-23 10:50 ` [edk2-devel] [PATCH v2 3/5] OvmfPkg/PlatformDebugLibIoPort: factor out debug port detection Philippe Mathieu-Daudé
2020-04-24 17:52 ` Laszlo Ersek
2020-04-23 9:53 ` [PATCH v2 4/5] OvmfPkg/PlatformDebugLibIoPort: Introduce a Nocheck variant Anthony PERARD
2020-04-24 17:58 ` [edk2-devel] " Laszlo Ersek
2020-04-27 14:19 ` Anthony PERARD
2020-04-23 9:53 ` [PATCH v2 5/5] OvmfPkg/OvmfXen: Introduce DEBUG_ON_HYPERVISOR_CONSOLE build flag Anthony PERARD
2020-04-24 18:05 ` [edk2-devel] " Laszlo Ersek
2020-04-27 14:22 ` Anthony PERARD
2020-04-28 21:23 ` [edk2-devel] [PATCH v2 0/5] OvmfXen: Cleanup debug options Laszlo Ersek
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200423095358.2518197-4-anthony.perard@citrix.com \
--to=devel@edk2.groups.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox