2 Detection code for hypervisor debug port.
3 Non-SEC instance, caches the result of detection.
5 Copyright (c) 2017, Red Hat, Inc.<BR>
6 SPDX-License-Identifier: BSD-2-Clause-Patent
11 #include "DebugLibDetect.h"
14 // Set to TRUE if the debug I/O port has been checked
16 STATIC BOOLEAN mDebugIoPortChecked
= FALSE
;
19 // Set to TRUE if the debug I/O port is enabled
21 STATIC BOOLEAN mDebugIoPortFound
= FALSE
;
24 This constructor function must not do anything.
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
34 @retval RETURN_SUCCESS The constructor always returns RETURN_SUCCESS.
39 PlatformDebugLibIoPortConstructor (
43 return RETURN_SUCCESS
;
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.
50 @retval TRUE if the debug I/O port device was detected.
51 @retval FALSE otherwise
56 PlatformDebugLibIoPortFound (
60 if (!mDebugIoPortChecked
) {
61 mDebugIoPortFound
= PlatformDebugLibIoPortDetect ();
62 mDebugIoPortChecked
= TRUE
;
64 return mDebugIoPortFound
;