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 - 2010, Intel Corporation. All rights reserved.<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.
19 #include <Library/PostCodeLib.h>
20 #include <Library/ReportStatusCodeLib.h>
21 #include <Library/PcdLib.h>
22 #include <Library/BaseLib.h>
25 Converts POST code value to status code value.
27 This macro converts the post code to status code value. Bits 0..4 of PostCode
28 are mapped to bits 16..20 of status code value, and bits 5..7 of PostCode are mapped to bits
29 24..26 of status code value.
31 @param PostCode POST code value.
33 @return The converted status code value.
36 #define POST_CODE_TO_STATUS_CODE_VALUE(PostCode) \
37 ((EFI_STATUS_CODE_VALUE) (((PostCode & 0x1f) << 16) | ((PostCode & 0x3) << 19)))
40 Sends an 32-bit value to a POST card.
42 Sends the 32-bit value specified by Value to a POST card, and returns Value.
43 Some implementations of this library function may perform I/O operations
44 directly to a POST card device. Other implementations may send Value to
45 ReportStatusCode(), and the status code reporting mechanism will eventually
46 display the 32-bit value on the status reporting device.
48 PostCode() must actively prevent recursion. If PostCode() is called while
49 processing another any other Post Code Library function, then
50 PostCode() must return Value immediately.
52 @param Value The 32-bit value to write to the POST card.
54 @return The 32-bit value to write to the POST card.
63 REPORT_STATUS_CODE (EFI_PROGRESS_CODE
, POST_CODE_TO_STATUS_CODE_VALUE (Value
));
69 Sends an 32-bit value to a POST and associated ASCII string.
71 Sends the 32-bit value specified by Value to a POST card, and returns Value.
72 If Description is not NULL, then the ASCII string specified by Description is
73 also passed to the handler that displays the POST card value. Some
74 implementations of this library function may perform I/O operations directly
75 to a POST card device. Other implementations may send Value to ReportStatusCode(),
76 and the status code reporting mechanism will eventually display the 32-bit
77 value on the status reporting device.
79 PostCodeWithDescription()must actively prevent recursion. If
80 PostCodeWithDescription() is called while processing another any other Post
81 Code Library function, then PostCodeWithDescription() must return Value
84 @param Value The 32-bit value to write to the POST card.
85 @param Description The pointer to an ASCII string that is a description of the
86 POST code value. This is an optional parameter that may
89 @return The 32-bit value to write to the POST card.
94 PostCodeWithDescription (
96 IN CONST CHAR8
*Description OPTIONAL
99 if (Description
== NULL
) {
102 POST_CODE_TO_STATUS_CODE_VALUE (Value
)
105 REPORT_STATUS_CODE_WITH_EXTENDED_DATA (
107 POST_CODE_TO_STATUS_CODE_VALUE (Value
),
109 AsciiStrSize (Description
)
118 Returns TRUE if POST Codes are enabled.
120 This function returns TRUE if the POST_CODE_PROPERTY_POST_CODE_ENABLED
121 bit of PcdPostCodePropertyMask is set. Otherwise FALSE is returned.
123 @retval TRUE The POST_CODE_PROPERTY_POST_CODE_ENABLED bit of
124 PcdPostCodeProperyMask is set.
125 @retval FALSE The POST_CODE_PROPERTY_POST_CODE_ENABLED bit of
126 PcdPostCodeProperyMask is clear.
135 return (BOOLEAN
) ((PcdGet8(PcdPostCodePropertyMask
) & POST_CODE_PROPERTY_POST_CODE_ENABLED
) != 0);
140 Returns TRUE if POST code descriptions are enabled.
142 This function returns TRUE if the POST_CODE_PROPERTY_POST_CODE_DESCRIPTION_ENABLED
143 bit of PcdPostCodePropertyMask is set. Otherwise FALSE is returned.
145 @retval TRUE The POST_CODE_PROPERTY_POST_CODE_DESCRIPTION_ENABLED bit of
146 PcdPostCodeProperyMask is set.
147 @retval FALSE The POST_CODE_PROPERTY_POST_CODE_DESCRIPTION_ENABLED bit of
148 PcdPostCodeProperyMask is clear.
153 PostCodeDescriptionEnabled (
157 return (BOOLEAN
) ((PcdGet8(PcdPostCodePropertyMask
) & POST_CODE_PROPERTY_POST_CODE_DESCRIPTION_ENABLED
) != 0);