]> git.proxmox.com Git - mirror_edk2.git/blame - OvmfPkg/Library/PlatformDebugLibIoPort/DebugLibDetect.c
OvmfPkg/PlatformDebugLibIoPort: Reword QEMU to hypervisor
[mirror_edk2.git] / OvmfPkg / Library / PlatformDebugLibIoPort / DebugLibDetect.c
CommitLineData
c9eb56e5 1/** @file\r
61ac4fc7 2 Detection code for hypervisor debug port.\r
c09d9571 3 Non-SEC instance, caches the result of detection.\r
c9eb56e5
PB
4\r
5 Copyright (c) 2017, Red Hat, Inc.<BR>\r
b26f0cf9 6 SPDX-License-Identifier: BSD-2-Clause-Patent\r
c9eb56e5
PB
7\r
8**/\r
9\r
10#include <Base.h>\r
c09d9571
PB
11#include "DebugLibDetect.h"\r
12\r
91a5b136
LE
13//\r
14// Set to TRUE if the debug I/O port has been checked\r
15//\r
16STATIC BOOLEAN mDebugIoPortChecked = FALSE;\r
17\r
c09d9571
PB
18//\r
19// Set to TRUE if the debug I/O port is enabled\r
20//\r
21STATIC BOOLEAN mDebugIoPortFound = FALSE;\r
c9eb56e5
PB
22\r
23/**\r
91a5b136
LE
24 This constructor function must not do anything.\r
25\r
26 Some modules consuming this library instance, such as the DXE Core, invoke\r
27 the DEBUG() macro before they explicitly call\r
28 ProcessLibraryConstructorList(). Therefore the auto-generated call from\r
29 ProcessLibraryConstructorList() to this constructor function may be preceded\r
30 by some calls to PlatformDebugLibIoPortFound() below. Hence\r
31 PlatformDebugLibIoPortFound() must not rely on anything this constructor\r
32 could set up.\r
c9eb56e5
PB
33\r
34 @retval RETURN_SUCCESS The constructor always returns RETURN_SUCCESS.\r
35\r
36**/\r
37RETURN_STATUS\r
38EFIAPI\r
39PlatformDebugLibIoPortConstructor (\r
40 VOID\r
41 )\r
42{\r
43 return RETURN_SUCCESS;\r
44}\r
c09d9571
PB
45\r
46/**\r
91a5b136
LE
47 At the first call, check if the debug I/O port device is present, and cache\r
48 the result for later use. At subsequent calls, return the cached result.\r
c09d9571
PB
49\r
50 @retval TRUE if the debug I/O port device was detected.\r
51 @retval FALSE otherwise\r
52\r
53**/\r
54BOOLEAN\r
55EFIAPI\r
56PlatformDebugLibIoPortFound (\r
57 VOID\r
58 )\r
59{\r
91a5b136
LE
60 if (!mDebugIoPortChecked) {\r
61 mDebugIoPortFound = PlatformDebugLibIoPortDetect ();\r
62 mDebugIoPortChecked = TRUE;\r
63 }\r
c09d9571
PB
64 return mDebugIoPortFound;\r
65}\r