blob: 9a7a9e6a9967962dad9c3d81b63662f1aac1ea87 [file] [log] [blame]
Vishal Bhoj82c80712015-12-15 21:13:33 +05301/** @file
2 Provides services to send progress/error codes to a POST card.
3
4Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
5This program and the accompanying materials
6are licensed and made available under the terms and conditions of the BSD License
7which accompanies this distribution. The full text of the license may be found at
8http://opensource.org/licenses/bsd-license.php
9
10THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
12
13**/
14
15#ifndef __POST_CODE_LIB_H__
16#define __POST_CODE_LIB_H__
17
18#define POST_CODE_PROPERTY_POST_CODE_ENABLED 0x00000008
19#define POST_CODE_PROPERTY_POST_CODE_DESCRIPTION_ENABLED 0x00000010
20
21/**
22 Sends a 32-bit value to a POST card.
23
24 Sends the 32-bit value specified by Value to a POST card, and returns Value.
25 Some implementations of this library function may perform I/O operations
26 directly to a POST card device. Other implementations may send Value to
27 ReportStatusCode(), and the status code reporting mechanism will eventually
28 display the 32-bit value on the status reporting device.
29
30 PostCode() must actively prevent recursion. If PostCode() is called while
31 processing another Post Code Library function, then
32 PostCode() must return Value immediately.
33
34 @param Value The 32-bit value to write to the POST card.
35
36 @return The 32-bit value to write to the POST card.
37
38**/
39UINT32
40EFIAPI
41PostCode (
42 IN UINT32 Value
43 );
44
45
46/**
47 Sends a 32-bit value to a POST and associated ASCII string.
48
49 Sends the 32-bit value specified by Value to a POST card, and returns Value.
50 If Description is not NULL, then the ASCII string specified by Description is
51 also passed to the handler that displays the POST card value. Some
52 implementations of this library function may perform I/O operations directly
53 to a POST card device. Other implementations may send Value to ReportStatusCode(),
54 and the status code reporting mechanism will eventually display the 32-bit
55 value on the status reporting device.
56
57 PostCodeWithDescription()must actively prevent recursion. If
58 PostCodeWithDescription() is called while processing another any other Post
59 Code Library function, then PostCodeWithDescription() must return Value
60 immediately.
61
62 @param Value The 32-bit value to write to the POST card.
63 @param Description Pointer to an ASCII string that is a description of the
64 POST code value. This is an optional parameter that may
65 be NULL.
66
67 @return The 32-bit value to write to the POST card.
68
69**/
70UINT32
71EFIAPI
72PostCodeWithDescription (
73 IN UINT32 Value,
74 IN CONST CHAR8 *Description OPTIONAL
75 );
76
77
78/**
79 Returns TRUE if POST Codes are enabled.
80
81 This function returns TRUE if the POST_CODE_PROPERTY_POST_CODE_ENABLED
82 bit of PcdPostCodePropertyMask is set. Otherwise FALSE is returned.
83
84 @retval TRUE The POST_CODE_PROPERTY_POST_CODE_ENABLED bit of
85 PcdPostCodeProperyMask is set.
86 @retval FALSE The POST_CODE_PROPERTY_POST_CODE_ENABLED bit of
87 PcdPostCodeProperyMask is clear.
88
89**/
90BOOLEAN
91EFIAPI
92PostCodeEnabled (
93 VOID
94 );
95
96
97/**
98 Returns TRUE if POST code descriptions are enabled.
99
100 This function returns TRUE if the POST_CODE_PROPERTY_POST_CODE_DESCRIPTION_ENABLED
101 bit of PcdPostCodePropertyMask is set. Otherwise FALSE is returned.
102
103 @retval TRUE The POST_CODE_PROPERTY_POST_CODE_DESCRIPTION_ENABLED bit of
104 PcdPostCodeProperyMask is set.
105 @retval FALSE The POST_CODE_PROPERTY_POST_CODE_DESCRIPTION_ENABLED bit of
106 PcdPostCodeProperyMask is clear.
107
108**/
109BOOLEAN
110EFIAPI
111PostCodeDescriptionEnabled (
112 VOID
113 );
114
115
116/**
117 Sends a 32-bit value to a POST card.
118
119 If POST codes are enabled in PcdPostCodeProperyMask, then call PostCode()
120 passing in Value. Value is returned.
121
122 @param Value The 32-bit value to write to the POST card.
123
124 @return Value The 32-bit value to write to the POST card.
125
126**/
127#define POST_CODE(Value) PostCodeEnabled() ? PostCode(Value) : Value
128
129/**
130 Sends a 32-bit value to a POST and associated ASCII string.
131
132 If POST codes and POST code descriptions are enabled in
133 PcdPostCodeProperyMask, then call PostCodeWithDescription() passing in
134 Value and Description. If only POST codes are enabled, then call PostCode()
135 passing in Value. Value is returned.
136
137 @param Value The 32-bit value to write to the POST card.
138 @param Description Pointer to an ASCII string that is a description of the
139 POST code value.
140
141 @return Value The 32-bit value to write to the POST card.
142**/
143#define POST_CODE_WITH_DESCRIPTION(Value,Description) \
144 PostCodeEnabled() ? \
145 (PostCodeDescriptionEnabled() ? \
146 PostCodeWithDescription(Value,Description) : \
147 PostCode(Value)) : \
148 Value
149
150#endif