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