]> git.proxmox.com Git - mirror_edk2.git/blame_incremental - OvmfPkg/Library/PlatformDebugLibIoPort/DebugLibDetect.c
OvmfPkg/PlatformDebugLibIoPort: Reword QEMU to hypervisor
[mirror_edk2.git] / OvmfPkg / Library / PlatformDebugLibIoPort / DebugLibDetect.c
... / ...
CommitLineData
1/** @file\r
2 Detection code for hypervisor debug port.\r
3 Non-SEC instance, caches the result of detection.\r
4\r
5 Copyright (c) 2017, Red Hat, Inc.<BR>\r
6 SPDX-License-Identifier: BSD-2-Clause-Patent\r
7\r
8**/\r
9\r
10#include <Base.h>\r
11#include "DebugLibDetect.h"\r
12\r
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
18//\r
19// Set to TRUE if the debug I/O port is enabled\r
20//\r
21STATIC BOOLEAN mDebugIoPortFound = FALSE;\r
22\r
23/**\r
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
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
45\r
46/**\r
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
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
60 if (!mDebugIoPortChecked) {\r
61 mDebugIoPortFound = PlatformDebugLibIoPortDetect ();\r
62 mDebugIoPortChecked = TRUE;\r
63 }\r
64 return mDebugIoPortFound;\r
65}\r