--- /dev/null
+/** @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