1 | /** @file
|
---|
2 | The instance of Post Code Library that layers on top of a Debug Library instance.
|
---|
3 |
|
---|
4 | Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
|
---|
5 | SPDX-License-Identifier: BSD-2-Clause-Patent
|
---|
6 |
|
---|
7 | **/
|
---|
8 |
|
---|
9 | #include <Base.h>
|
---|
10 |
|
---|
11 | #include <Library/PostCodeLib.h>
|
---|
12 | #include <Library/DebugLib.h>
|
---|
13 | #include <Library/PcdLib.h>
|
---|
14 |
|
---|
15 | /**
|
---|
16 | Sends an 32-bit value to a POST card.
|
---|
17 |
|
---|
18 | Sends the 32-bit value specified by Value to a POST card, and returns Value.
|
---|
19 | Some implementations of this library function may perform I/O operations
|
---|
20 | directly to a POST card device. Other implementations may send Value to
|
---|
21 | ReportStatusCode(), and the status code reporting mechanism will eventually
|
---|
22 | display the 32-bit value on the status reporting device.
|
---|
23 |
|
---|
24 | PostCode() must actively prevent recursion. If PostCode() is called while
|
---|
25 | processing another any other Post Code Library function, then
|
---|
26 | PostCode() must return Value immediately.
|
---|
27 |
|
---|
28 | @param Value The 32-bit value to write to the POST card.
|
---|
29 |
|
---|
30 | @return The 32-bit value to write to the POST card.
|
---|
31 |
|
---|
32 | **/
|
---|
33 | UINT32
|
---|
34 | EFIAPI
|
---|
35 | PostCode (
|
---|
36 | IN UINT32 Value
|
---|
37 | )
|
---|
38 | {
|
---|
39 | DEBUG ((DEBUG_INFO, "POST %08x\n", Value));
|
---|
40 | return Value;
|
---|
41 | }
|
---|
42 |
|
---|
43 | /**
|
---|
44 | Sends an 32-bit value to a POST and associated ASCII string.
|
---|
45 |
|
---|
46 | Sends the 32-bit value specified by Value to a POST card, and returns Value.
|
---|
47 | If Description is not NULL, then the ASCII string specified by Description is
|
---|
48 | also passed to the handler that displays the POST card value. Some
|
---|
49 | implementations of this library function may perform I/O operations directly
|
---|
50 | to a POST card device. Other implementations may send Value to ReportStatusCode(),
|
---|
51 | and the status code reporting mechanism will eventually display the 32-bit
|
---|
52 | value on the status reporting device.
|
---|
53 |
|
---|
54 | PostCodeWithDescription()must actively prevent recursion. If
|
---|
55 | PostCodeWithDescription() is called while processing another any other Post
|
---|
56 | Code Library function, then PostCodeWithDescription() must return Value
|
---|
57 | immediately.
|
---|
58 |
|
---|
59 | @param Value The 32-bit value to write to the POST card.
|
---|
60 | @param Description The pointer to an ASCII string that is a description of the
|
---|
61 | POST code value. This is an optional parameter that may
|
---|
62 | be NULL.
|
---|
63 |
|
---|
64 | @return The 32-bit value to write to the POST card.
|
---|
65 |
|
---|
66 | **/
|
---|
67 | UINT32
|
---|
68 | EFIAPI
|
---|
69 | PostCodeWithDescription (
|
---|
70 | IN UINT32 Value,
|
---|
71 | IN CONST CHAR8 *Description OPTIONAL
|
---|
72 | )
|
---|
73 | {
|
---|
74 | DEBUG ((DEBUG_INFO, "POST %08x - %s\n", Value, Description));
|
---|
75 | return Value;
|
---|
76 | }
|
---|
77 |
|
---|
78 | /**
|
---|
79 | Returns TRUE if POST Codes are enabled.
|
---|
80 |
|
---|
81 | This function returns TRUE if the POST_CODE_PROPERTY_POST_CODE_ENABLED
|
---|
82 | bit of PcdPostCodePropertyMask is set. Otherwise FALSE is returned.
|
---|
83 |
|
---|
84 | @retval TRUE The POST_CODE_PROPERTY_POST_CODE_ENABLED bit of
|
---|
85 | PcdPostCodeProperyMask is set.
|
---|
86 | @retval FALSE The POST_CODE_PROPERTY_POST_CODE_ENABLED bit of
|
---|
87 | PcdPostCodeProperyMask is clear.
|
---|
88 |
|
---|
89 | **/
|
---|
90 | BOOLEAN
|
---|
91 | EFIAPI
|
---|
92 | PostCodeEnabled (
|
---|
93 | VOID
|
---|
94 | )
|
---|
95 | {
|
---|
96 | return (BOOLEAN)((PcdGet8 (PcdPostCodePropertyMask) & POST_CODE_PROPERTY_POST_CODE_ENABLED) != 0);
|
---|
97 | }
|
---|
98 |
|
---|
99 | /**
|
---|
100 | Returns TRUE if POST code descriptions are enabled.
|
---|
101 |
|
---|
102 | This function returns TRUE if the POST_CODE_PROPERTY_POST_CODE_DESCRIPTION_ENABLED
|
---|
103 | bit of PcdPostCodePropertyMask is set. Otherwise FALSE is returned.
|
---|
104 |
|
---|
105 | @retval TRUE The POST_CODE_PROPERTY_POST_CODE_DESCRIPTION_ENABLED bit of
|
---|
106 | PcdPostCodeProperyMask is set.
|
---|
107 | @retval FALSE The POST_CODE_PROPERTY_POST_CODE_DESCRIPTION_ENABLED bit of
|
---|
108 | PcdPostCodeProperyMask is clear.
|
---|
109 |
|
---|
110 | **/
|
---|
111 | BOOLEAN
|
---|
112 | EFIAPI
|
---|
113 | PostCodeDescriptionEnabled (
|
---|
114 | VOID
|
---|
115 | )
|
---|
116 | {
|
---|
117 | return (BOOLEAN)((PcdGet8 (PcdPostCodePropertyMask) & POST_CODE_PROPERTY_POST_CODE_DESCRIPTION_ENABLED) != 0);
|
---|
118 | }
|
---|