]>
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 | |
c892d846 | 15 | \r |
bad46384 | 16 | #include <PiPei.h>\r |
c892d846 | 17 | \r |
bad46384 | 18 | #include <Library/PostCodeLib.h>\r |
19 | #include <Library/ReportStatusCodeLib.h>\r | |
20 | #include <Library/PcdLib.h>\r | |
21 | #include <Library/BaseLib.h>\r | |
22 | \r | |
cdffda11 | 23 | /**\r |
24 | Converts POST code value to status code value.\r | |
25 | \r | |
bad46384 | 26 | This macro converts the post code to status code value. Bits 0..4 of PostCode\r |
27 | are mapped to bits 16..20 of status code value, and bits 5..7 of PostCode are mapped to bits\r | |
28 | 24..26 of status code value.\r | |
cdffda11 | 29 | \r |
bad46384 | 30 | @param PostCode POST code value.\r |
cdffda11 | 31 | \r |
32 | @return The converted status code value.\r | |
33 | \r | |
34 | **/\r | |
35 | #define POST_CODE_TO_STATUS_CODE_VALUE(PostCode) \\r | |
36 | ((EFI_STATUS_CODE_VALUE) (((PostCode & 0x1f) << 16) | ((PostCode & 0x3) << 19)))\r | |
37 | \r | |
38 | /**\r | |
39 | Sends an 32-bit value to a POST card.\r | |
40 | \r | |
bad46384 | 41 | Sends the 32-bit value specified by Value to a POST card, and returns Value.\r |
42 | Some implementations of this library function may perform I/O operations\r | |
43 | directly to a POST card device. Other implementations may send Value to\r | |
44 | ReportStatusCode(), and the status code reporting mechanism will eventually\r | |
cdffda11 | 45 | display the 32-bit value on the status reporting device.\r |
bad46384 | 46 | \r |
47 | PostCode() must actively prevent recursion. If PostCode() is called while\r | |
48 | processing another any other Report Status Code Library function, then\r | |
cdffda11 | 49 | PostCode() must return Value immediately.\r |
50 | \r | |
51 | @param Value The 32-bit value to write to the POST card.\r | |
52 | \r | |
53 | @return Value\r | |
54 | \r | |
55 | **/\r | |
56 | UINT32\r | |
57 | EFIAPI\r | |
58 | PostCode (\r | |
59 | IN UINT32 Value\r | |
60 | )\r | |
61 | {\r | |
62 | REPORT_STATUS_CODE (EFI_PROGRESS_CODE, POST_CODE_TO_STATUS_CODE_VALUE (Value));\r | |
63 | return Value;\r | |
64 | }\r | |
65 | \r | |
66 | \r | |
67 | /**\r | |
68 | Sends an 32-bit value to a POST and associated ASCII string.\r | |
69 | \r | |
70 | Sends the 32-bit value specified by Value to a POST card, and returns Value.\r | |
bad46384 | 71 | If Description is not NULL, then the ASCII string specified by Description is\r |
72 | also passed to the handler that displays the POST card value. Some\r | |
73 | implementations of this library function may perform I/O operations directly\r | |
74 | to a POST card device. Other implementations may send Value to ReportStatusCode(),\r | |
75 | and the status code reporting mechanism will eventually display the 32-bit\r | |
76 | value on the status reporting device.\r | |
77 | \r | |
78 | PostCodeWithDescription()must actively prevent recursion. If\r | |
79 | PostCodeWithDescription() is called while processing another any other Report\r | |
80 | Status Code Library function, then PostCodeWithDescription() must return Value\r | |
cdffda11 | 81 | immediately.\r |
82 | \r | |
83 | @param Value The 32-bit value to write to the POST card.\r | |
bad46384 | 84 | @param Description Pointer to an ASCII string that is a description of the\r |
85 | POST code value. This is an optional parameter that may\r | |
cdffda11 | 86 | be NULL.\r |
87 | \r | |
88 | @return Value\r | |
89 | \r | |
90 | **/\r | |
91 | UINT32\r | |
92 | EFIAPI\r | |
93 | PostCodeWithDescription (\r | |
94 | IN UINT32 Value,\r | |
95 | IN CONST CHAR8 *Description OPTIONAL\r | |
96 | )\r | |
97 | {\r | |
bad46384 | 98 | if (Description == NULL) {\r |
cdffda11 | 99 | REPORT_STATUS_CODE (\r |
100 | EFI_PROGRESS_CODE,\r | |
101 | POST_CODE_TO_STATUS_CODE_VALUE (Value)\r | |
102 | );\r | |
103 | } else {\r | |
104 | REPORT_STATUS_CODE_WITH_EXTENDED_DATA (\r | |
105 | EFI_PROGRESS_CODE,\r | |
106 | POST_CODE_TO_STATUS_CODE_VALUE (Value),\r | |
107 | Description,\r | |
108 | AsciiStrSize (Description)\r | |
109 | );\r | |
110 | }\r | |
111 | \r | |
112 | return Value;\r | |
113 | }\r | |
114 | \r | |
115 | \r | |
116 | /**\r | |
117 | Returns TRUE if POST Codes are enabled.\r | |
118 | \r | |
bad46384 | 119 | This function returns TRUE if the POST_CODE_PROPERTY_POST_CODE_ENABLED\r |
cdffda11 | 120 | bit of PcdPostCodePropertyMask is set. Otherwise FALSE is returned.\r |
121 | \r | |
bad46384 | 122 | @retval TRUE The POST_CODE_PROPERTY_POST_CODE_ENABLED bit of\r |
cdffda11 | 123 | PcdPostCodeProperyMask is set.\r |
bad46384 | 124 | @retval FALSE The POST_CODE_PROPERTY_POST_CODE_ENABLED bit of\r |
cdffda11 | 125 | PcdPostCodeProperyMask is clear.\r |
126 | \r | |
127 | **/\r | |
128 | BOOLEAN\r | |
129 | EFIAPI\r | |
130 | PostCodeEnabled (\r | |
131 | VOID\r | |
132 | )\r | |
133 | {\r | |
134 | return (BOOLEAN) ((PcdGet8(PcdPostCodePropertyMask) & POST_CODE_PROPERTY_POST_CODE_ENABLED) != 0);\r | |
135 | }\r | |
136 | \r | |
137 | \r | |
138 | /**\r | |
139 | Returns TRUE if POST code descriptions are enabled.\r | |
140 | \r | |
bad46384 | 141 | This function returns TRUE if the\r |
142 | POST_CODE_PROPERTY_POST_CODE_ENABLED bit of\r | |
cdffda11 | 143 | PcdPostCodePropertyMask is set. Otherwise FALSE is returned.\r |
144 | \r | |
bad46384 | 145 | @retval TRUE The POST_CODE_PROPERTY_POST_CODE_ENABLED\r |
cdffda11 | 146 | bit of PcdPostCodeProperyMask is set.\r |
bad46384 | 147 | @retval FALSE The POST_CODE_PROPERTY_POST_CODE_ENABLED\r |
cdffda11 | 148 | bit of PcdPostCodeProperyMask is clear.\r |
149 | \r | |
150 | **/\r | |
151 | BOOLEAN\r | |
152 | EFIAPI\r | |
153 | PostCodeDescriptionEnabled (\r | |
154 | VOID\r | |
155 | )\r | |
156 | {\r | |
157 | return (BOOLEAN) ((PcdGet8(PcdPostCodePropertyMask) & POST_CODE_PROPERTY_POST_CODE_ENABLED) != 0);\r | |
158 | }\r |