]>
Commit | Line | Data |
---|---|---|
c9eb56e5 | 1 | /** @file\r |
c09d9571 PB |
2 | Detection code for QEMU debug port.\r |
3 | Non-SEC instance, caches the result of detection.\r | |
c9eb56e5 PB |
4 | \r |
5 | Copyright (c) 2017, Red Hat, Inc.<BR>\r | |
6 | This program and the accompanying materials\r | |
7 | are licensed and made available under the terms and conditions of the BSD License\r | |
8 | which accompanies this distribution. The full text of the license may be found at\r | |
9 | http://opensource.org/licenses/bsd-license.php.\r | |
10 | \r | |
11 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r | |
12 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r | |
13 | \r | |
14 | **/\r | |
15 | \r | |
16 | #include <Base.h>\r | |
c09d9571 PB |
17 | #include "DebugLibDetect.h"\r |
18 | \r | |
91a5b136 LE |
19 | //\r |
20 | // Set to TRUE if the debug I/O port has been checked\r | |
21 | //\r | |
22 | STATIC BOOLEAN mDebugIoPortChecked = FALSE;\r | |
23 | \r | |
c09d9571 PB |
24 | //\r |
25 | // Set to TRUE if the debug I/O port is enabled\r | |
26 | //\r | |
27 | STATIC BOOLEAN mDebugIoPortFound = FALSE;\r | |
c9eb56e5 PB |
28 | \r |
29 | /**\r | |
91a5b136 LE |
30 | This constructor function must not do anything.\r |
31 | \r | |
32 | Some modules consuming this library instance, such as the DXE Core, invoke\r | |
33 | the DEBUG() macro before they explicitly call\r | |
34 | ProcessLibraryConstructorList(). Therefore the auto-generated call from\r | |
35 | ProcessLibraryConstructorList() to this constructor function may be preceded\r | |
36 | by some calls to PlatformDebugLibIoPortFound() below. Hence\r | |
37 | PlatformDebugLibIoPortFound() must not rely on anything this constructor\r | |
38 | could set up.\r | |
c9eb56e5 PB |
39 | \r |
40 | @retval RETURN_SUCCESS The constructor always returns RETURN_SUCCESS.\r | |
41 | \r | |
42 | **/\r | |
43 | RETURN_STATUS\r | |
44 | EFIAPI\r | |
45 | PlatformDebugLibIoPortConstructor (\r | |
46 | VOID\r | |
47 | )\r | |
48 | {\r | |
49 | return RETURN_SUCCESS;\r | |
50 | }\r | |
c09d9571 PB |
51 | \r |
52 | /**\r | |
91a5b136 LE |
53 | At the first call, check if the debug I/O port device is present, and cache\r |
54 | the result for later use. At subsequent calls, return the cached result.\r | |
c09d9571 PB |
55 | \r |
56 | @retval TRUE if the debug I/O port device was detected.\r | |
57 | @retval FALSE otherwise\r | |
58 | \r | |
59 | **/\r | |
60 | BOOLEAN\r | |
61 | EFIAPI\r | |
62 | PlatformDebugLibIoPortFound (\r | |
63 | VOID\r | |
64 | )\r | |
65 | {\r | |
91a5b136 LE |
66 | if (!mDebugIoPortChecked) {\r |
67 | mDebugIoPortFound = PlatformDebugLibIoPortDetect ();\r | |
68 | mDebugIoPortChecked = TRUE;\r | |
69 | }\r | |
c09d9571 PB |
70 | return mDebugIoPortFound;\r |
71 | }\r |