]>
Commit | Line | Data |
---|---|---|
cdffda11 | 1 | /** @file\r |
2 | Report Status Code Library Post Code functions for DXE Phase.\r | |
3 | \r | |
4 | Copyright (c) 2006, Intel Corporation<BR>\r | |
bad46384 | 5 | All rights reserved. This program and the accompanying materials\r |
6 | are licensed and made available under the terms and conditions of the BSD License\r | |
7 | which accompanies this distribution. The full text of the license may be found at\r | |
8 | http://opensource.org/licenses/bsd-license.php\r | |
cdffda11 | 9 | \r |
bad46384 | 10 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r |
11 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r | |
cdffda11 | 12 | \r |
13 | **/\r | |
14 | \r | |
bad46384 | 15 | //\r |
16 | // The package level header files this module uses\r | |
17 | //\r | |
18 | #include <PiPei.h>\r | |
19 | //\r | |
20 | // The Library classes this module consumes\r | |
21 | //\r | |
22 | #include <Library/PostCodeLib.h>\r | |
23 | #include <Library/ReportStatusCodeLib.h>\r | |
24 | #include <Library/PcdLib.h>\r | |
25 | #include <Library/BaseLib.h>\r | |
26 | \r | |
cdffda11 | 27 | /**\r |
28 | Converts POST code value to status code value.\r | |
29 | \r | |
bad46384 | 30 | This macro converts the post code to status code value. Bits 0..4 of PostCode\r |
31 | are mapped to bits 16..20 of status code value, and bits 5..7 of PostCode are mapped to bits\r | |
32 | 24..26 of status code value.\r | |
cdffda11 | 33 | \r |
bad46384 | 34 | @param PostCode POST code value.\r |
cdffda11 | 35 | \r |
36 | @return The converted status code value.\r | |
37 | \r | |
38 | **/\r | |
39 | #define POST_CODE_TO_STATUS_CODE_VALUE(PostCode) \\r | |
40 | ((EFI_STATUS_CODE_VALUE) (((PostCode & 0x1f) << 16) | ((PostCode & 0x3) << 19)))\r | |
41 | \r | |
42 | /**\r | |
43 | Sends an 32-bit value to a POST card.\r | |
44 | \r | |
bad46384 | 45 | Sends the 32-bit value specified by Value to a POST card, and returns Value.\r |
46 | Some implementations of this library function may perform I/O operations\r | |
47 | directly to a POST card device. Other implementations may send Value to\r | |
48 | ReportStatusCode(), and the status code reporting mechanism will eventually\r | |
cdffda11 | 49 | display the 32-bit value on the status reporting device.\r |
bad46384 | 50 | \r |
51 | PostCode() must actively prevent recursion. If PostCode() is called while\r | |
52 | processing another any other Report Status Code Library function, then\r | |
cdffda11 | 53 | PostCode() must return Value immediately.\r |
54 | \r | |
55 | @param Value The 32-bit value to write to the POST card.\r | |
56 | \r | |
57 | @return Value\r | |
58 | \r | |
59 | **/\r | |
60 | UINT32\r | |
61 | EFIAPI\r | |
62 | PostCode (\r | |
63 | IN UINT32 Value\r | |
64 | )\r | |
65 | {\r | |
66 | REPORT_STATUS_CODE (EFI_PROGRESS_CODE, POST_CODE_TO_STATUS_CODE_VALUE (Value));\r | |
67 | return Value;\r | |
68 | }\r | |
69 | \r | |
70 | \r | |
71 | /**\r | |
72 | Sends an 32-bit value to a POST and associated ASCII string.\r | |
73 | \r | |
74 | Sends the 32-bit value specified by Value to a POST card, and returns Value.\r | |
bad46384 | 75 | If Description is not NULL, then the ASCII string specified by Description is\r |
76 | also passed to the handler that displays the POST card value. Some\r | |
77 | implementations of this library function may perform I/O operations directly\r | |
78 | to a POST card device. Other implementations may send Value to ReportStatusCode(),\r | |
79 | and the status code reporting mechanism will eventually display the 32-bit\r | |
80 | value on the status reporting device.\r | |
81 | \r | |
82 | PostCodeWithDescription()must actively prevent recursion. If\r | |
83 | PostCodeWithDescription() is called while processing another any other Report\r | |
84 | Status Code Library function, then PostCodeWithDescription() must return Value\r | |
cdffda11 | 85 | immediately.\r |
86 | \r | |
87 | @param Value The 32-bit value to write to the POST card.\r | |
bad46384 | 88 | @param Description Pointer to an ASCII string that is a description of the\r |
89 | POST code value. This is an optional parameter that may\r | |
cdffda11 | 90 | be NULL.\r |
91 | \r | |
92 | @return Value\r | |
93 | \r | |
94 | **/\r | |
95 | UINT32\r | |
96 | EFIAPI\r | |
97 | PostCodeWithDescription (\r | |
98 | IN UINT32 Value,\r | |
99 | IN CONST CHAR8 *Description OPTIONAL\r | |
100 | )\r | |
101 | {\r | |
bad46384 | 102 | if (Description == NULL) {\r |
cdffda11 | 103 | REPORT_STATUS_CODE (\r |
104 | EFI_PROGRESS_CODE,\r | |
105 | POST_CODE_TO_STATUS_CODE_VALUE (Value)\r | |
106 | );\r | |
107 | } else {\r | |
108 | REPORT_STATUS_CODE_WITH_EXTENDED_DATA (\r | |
109 | EFI_PROGRESS_CODE,\r | |
110 | POST_CODE_TO_STATUS_CODE_VALUE (Value),\r | |
111 | Description,\r | |
112 | AsciiStrSize (Description)\r | |
113 | );\r | |
114 | }\r | |
115 | \r | |
116 | return Value;\r | |
117 | }\r | |
118 | \r | |
119 | \r | |
120 | /**\r | |
121 | Returns TRUE if POST Codes are enabled.\r | |
122 | \r | |
bad46384 | 123 | This function returns TRUE if the POST_CODE_PROPERTY_POST_CODE_ENABLED\r |
cdffda11 | 124 | bit of PcdPostCodePropertyMask is set. Otherwise FALSE is returned.\r |
125 | \r | |
bad46384 | 126 | @retval TRUE The POST_CODE_PROPERTY_POST_CODE_ENABLED bit of\r |
cdffda11 | 127 | PcdPostCodeProperyMask is set.\r |
bad46384 | 128 | @retval FALSE The POST_CODE_PROPERTY_POST_CODE_ENABLED bit of\r |
cdffda11 | 129 | PcdPostCodeProperyMask is clear.\r |
130 | \r | |
131 | **/\r | |
132 | BOOLEAN\r | |
133 | EFIAPI\r | |
134 | PostCodeEnabled (\r | |
135 | VOID\r | |
136 | )\r | |
137 | {\r | |
138 | return (BOOLEAN) ((PcdGet8(PcdPostCodePropertyMask) & POST_CODE_PROPERTY_POST_CODE_ENABLED) != 0);\r | |
139 | }\r | |
140 | \r | |
141 | \r | |
142 | /**\r | |
143 | Returns TRUE if POST code descriptions are enabled.\r | |
144 | \r | |
bad46384 | 145 | This function returns TRUE if the\r |
146 | POST_CODE_PROPERTY_POST_CODE_ENABLED bit of\r | |
cdffda11 | 147 | PcdPostCodePropertyMask is set. Otherwise FALSE is returned.\r |
148 | \r | |
bad46384 | 149 | @retval TRUE The POST_CODE_PROPERTY_POST_CODE_ENABLED\r |
cdffda11 | 150 | bit of PcdPostCodeProperyMask is set.\r |
bad46384 | 151 | @retval FALSE The POST_CODE_PROPERTY_POST_CODE_ENABLED\r |
cdffda11 | 152 | bit of PcdPostCodeProperyMask is clear.\r |
153 | \r | |
154 | **/\r | |
155 | BOOLEAN\r | |
156 | EFIAPI\r | |
157 | PostCodeDescriptionEnabled (\r | |
158 | VOID\r | |
159 | )\r | |
160 | {\r | |
161 | return (BOOLEAN) ((PcdGet8(PcdPostCodePropertyMask) & POST_CODE_PROPERTY_POST_CODE_ENABLED) != 0);\r | |
162 | }\r |