2 Detection code for QEMU debug port.
3 Non-SEC instance, caches the result of detection.
5 Copyright (c) 2017, Red Hat, Inc.<BR>
6 This program and the accompanying materials
7 are licensed and made available under the terms and conditions of the BSD License
8 which accompanies this distribution. The full text of the license may be found at
9 http://opensource.org/licenses/bsd-license.php.
11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
12 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
17 #include "DebugLibDetect.h"
20 // Set to TRUE if the debug I/O port has been checked
22 STATIC BOOLEAN mDebugIoPortChecked
= FALSE
;
25 // Set to TRUE if the debug I/O port is enabled
27 STATIC BOOLEAN mDebugIoPortFound
= FALSE
;
30 This constructor function must not do anything.
32 Some modules consuming this library instance, such as the DXE Core, invoke
33 the DEBUG() macro before they explicitly call
34 ProcessLibraryConstructorList(). Therefore the auto-generated call from
35 ProcessLibraryConstructorList() to this constructor function may be preceded
36 by some calls to PlatformDebugLibIoPortFound() below. Hence
37 PlatformDebugLibIoPortFound() must not rely on anything this constructor
40 @retval RETURN_SUCCESS The constructor always returns RETURN_SUCCESS.
45 PlatformDebugLibIoPortConstructor (
49 return RETURN_SUCCESS
;
53 At the first call, check if the debug I/O port device is present, and cache
54 the result for later use. At subsequent calls, return the cached result.
56 @retval TRUE if the debug I/O port device was detected.
57 @retval FALSE otherwise
62 PlatformDebugLibIoPortFound (
66 if (!mDebugIoPortChecked
) {
67 mDebugIoPortFound
= PlatformDebugLibIoPortDetect ();
68 mDebugIoPortChecked
= TRUE
;
70 return mDebugIoPortFound
;