2 Post code library instace bases on report status code library
3 PostCode Library for PEIMs and DXE drivers that send PostCode to ReportStatusCode
5 Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
6 SPDX-License-Identifier: BSD-2-Clause-Patent
12 #include <Library/PostCodeLib.h>
13 #include <Library/ReportStatusCodeLib.h>
14 #include <Library/PcdLib.h>
15 #include <Library/BaseLib.h>
18 Converts POST code value to status code value.
20 This macro converts the post code to status code value. Bits 0..4 of PostCode
21 are mapped to bits 16..20 of status code value, and bits 5..7 of PostCode are mapped to bits
22 24..26 of status code value.
24 @param PostCode POST code value.
26 @return The converted status code value.
29 #define POST_CODE_TO_STATUS_CODE_VALUE(PostCode) \
30 ((EFI_STATUS_CODE_VALUE) (((PostCode & 0x1f) << 16) | ((PostCode & 0x3) << 19)))
33 Sends an 32-bit value to a POST card.
35 Sends the 32-bit value specified by Value to a POST card, and returns Value.
36 Some implementations of this library function may perform I/O operations
37 directly to a POST card device. Other implementations may send Value to
38 ReportStatusCode(), and the status code reporting mechanism will eventually
39 display the 32-bit value on the status reporting device.
41 PostCode() must actively prevent recursion. If PostCode() is called while
42 processing another any other Post Code Library function, then
43 PostCode() must return Value immediately.
45 @param Value The 32-bit value to write to the POST card.
47 @return The 32-bit value to write to the POST card.
56 REPORT_STATUS_CODE (EFI_PROGRESS_CODE
, POST_CODE_TO_STATUS_CODE_VALUE (Value
));
61 Sends an 32-bit value to a POST and associated ASCII string.
63 Sends the 32-bit value specified by Value to a POST card, and returns Value.
64 If Description is not NULL, then the ASCII string specified by Description is
65 also passed to the handler that displays the POST card value. Some
66 implementations of this library function may perform I/O operations directly
67 to a POST card device. Other implementations may send Value to ReportStatusCode(),
68 and the status code reporting mechanism will eventually display the 32-bit
69 value on the status reporting device.
71 PostCodeWithDescription()must actively prevent recursion. If
72 PostCodeWithDescription() is called while processing another any other Post
73 Code Library function, then PostCodeWithDescription() must return Value
76 @param Value The 32-bit value to write to the POST card.
77 @param Description The pointer to an ASCII string that is a description of the
78 POST code value. This is an optional parameter that may
81 @return The 32-bit value to write to the POST card.
86 PostCodeWithDescription (
88 IN CONST CHAR8
*Description OPTIONAL
91 if (Description
== NULL
) {
94 POST_CODE_TO_STATUS_CODE_VALUE (Value
)
97 REPORT_STATUS_CODE_WITH_EXTENDED_DATA (
99 POST_CODE_TO_STATUS_CODE_VALUE (Value
),
101 AsciiStrSize (Description
)
109 Returns TRUE if POST Codes are enabled.
111 This function returns TRUE if the POST_CODE_PROPERTY_POST_CODE_ENABLED
112 bit of PcdPostCodePropertyMask is set. Otherwise FALSE is returned.
114 @retval TRUE The POST_CODE_PROPERTY_POST_CODE_ENABLED bit of
115 PcdPostCodeProperyMask is set.
116 @retval FALSE The POST_CODE_PROPERTY_POST_CODE_ENABLED bit of
117 PcdPostCodeProperyMask is clear.
126 return (BOOLEAN
)((PcdGet8 (PcdPostCodePropertyMask
) & POST_CODE_PROPERTY_POST_CODE_ENABLED
) != 0);
130 Returns TRUE if POST code descriptions are enabled.
132 This function returns TRUE if the POST_CODE_PROPERTY_POST_CODE_DESCRIPTION_ENABLED
133 bit of PcdPostCodePropertyMask is set. Otherwise FALSE is returned.
135 @retval TRUE The POST_CODE_PROPERTY_POST_CODE_DESCRIPTION_ENABLED bit of
136 PcdPostCodeProperyMask is set.
137 @retval FALSE The POST_CODE_PROPERTY_POST_CODE_DESCRIPTION_ENABLED bit of
138 PcdPostCodeProperyMask is clear.
143 PostCodeDescriptionEnabled (
147 return (BOOLEAN
)((PcdGet8 (PcdPostCodePropertyMask
) & POST_CODE_PROPERTY_POST_CODE_DESCRIPTION_ENABLED
) != 0);