]> git.proxmox.com Git - mirror_edk2.git/commitdiff
OvmfPkg/PlatformDebugLibIoPort: factor out debug port detection
authorAnthony PERARD <anthony.perard@citrix.com>
Thu, 23 Apr 2020 09:53:56 +0000 (10:53 +0100)
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Tue, 28 Apr 2020 21:12:01 +0000 (21:12 +0000)
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>
OvmfPkg/Library/PlatformDebugLibIoPort/DebugIoPortQemu.c [new file with mode: 0644]
OvmfPkg/Library/PlatformDebugLibIoPort/DebugLib.c
OvmfPkg/Library/PlatformDebugLibIoPort/DebugLibDetect.h
OvmfPkg/Library/PlatformDebugLibIoPort/PlatformDebugLibIoPort.inf
OvmfPkg/Library/PlatformDebugLibIoPort/PlatformRomDebugLibIoPort.inf

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