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