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