]> git.proxmox.com Git - mirror_edk2.git/blob - OvmfPkg/Library/PlatformDebugLibIoPort/DebugLibDetect.c
OvmfPkg/VirtioMmioDeviceLib: improve style of mMmioDeviceProtocolTemplate
[mirror_edk2.git] / OvmfPkg / Library / PlatformDebugLibIoPort / DebugLibDetect.c
1 /** @file
2 Detection code for QEMU debug port.
3 Non-SEC instance, caches the result of detection.
4
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.
10
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.
13
14 **/
15
16 #include <Base.h>
17 #include "DebugLibDetect.h"
18
19 //
20 // Set to TRUE if the debug I/O port is enabled
21 //
22 STATIC BOOLEAN mDebugIoPortFound = FALSE;
23
24 /**
25 This constructor function checks if the debug I/O port device is present,
26 caching the result for later use.
27
28 @retval RETURN_SUCCESS The constructor always returns RETURN_SUCCESS.
29
30 **/
31 RETURN_STATUS
32 EFIAPI
33 PlatformDebugLibIoPortConstructor (
34 VOID
35 )
36 {
37 mDebugIoPortFound = PlatformDebugLibIoPortDetect();
38 return RETURN_SUCCESS;
39 }
40
41 /**
42 Return the cached result of detecting the debug I/O port device.
43
44 @retval TRUE if the debug I/O port device was detected.
45 @retval FALSE otherwise
46
47 **/
48 BOOLEAN
49 EFIAPI
50 PlatformDebugLibIoPortFound (
51 VOID
52 )
53 {
54 return mDebugIoPortFound;
55 }