VirtualBox

source: vbox/trunk/src/VBox/Devices/EFI/FirmwareNew/OvmfPkg/Library/PlatformDebugLibIoPort/DebugLibDetect.c

Last change on this file was 99404, checked in by vboxsync, 2 years ago

Devices/EFI/FirmwareNew: Update to edk2-stable202302 and make it build, bugref:4643

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

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette