]> git.proxmox.com Git - mirror_edk2.git/blame - OvmfPkg/Library/PlatformDebugLibIoPort/DebugIoPortQemu.c
OvmfPkg/PlatformDebugLibIoPort: factor out debug port detection
[mirror_edk2.git] / OvmfPkg / Library / PlatformDebugLibIoPort / DebugIoPortQemu.c
CommitLineData
52f01212
AP
1/** @file\r
2 Detection code for QEMU debug port.\r
3\r
4 Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.<BR>\r
5 Copyright (c) 2012, Red Hat, Inc.<BR>\r
6 Copyright (c) 2020, Citrix Systems, Inc.\r
7 SPDX-License-Identifier: BSD-2-Clause-Patent\r
8\r
9**/\r
10\r
11#include <Library/IoLib.h>\r
12#include <Library/PcdLib.h>\r
13#include "DebugLibDetect.h"\r
14\r
15//\r
16// The constant value that is read from the debug I/O port\r
17//\r
18#define BOCHS_DEBUG_PORT_MAGIC 0xE9\r
19\r
20/**\r
21 Return the result of detecting the debug I/O port device.\r
22\r
23 @retval TRUE if the debug I/O port device was detected.\r
24 @retval FALSE otherwise\r
25\r
26**/\r
27BOOLEAN\r
28EFIAPI\r
29PlatformDebugLibIoPortDetect (\r
30 VOID\r
31 )\r
32{\r
33 return IoRead8 (PcdGet16 (PcdDebugIoPort)) == BOCHS_DEBUG_PORT_MAGIC;\r
34}\r