]> git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Include/Library/PostCodeLib.h
UefiCpuPkg: Move AsmRelocateApLoopStart from Mpfuncs.nasm to AmdSev.nasm
[mirror_edk2.git] / MdePkg / Include / Library / PostCodeLib.h
1 /** @file
2 Provides services to send progress/error codes to a POST card.
3
4 Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
5 SPDX-License-Identifier: BSD-2-Clause-Patent
6
7 **/
8
9 #ifndef __POST_CODE_LIB_H__
10 #define __POST_CODE_LIB_H__
11
12 #define POST_CODE_PROPERTY_POST_CODE_ENABLED 0x00000008
13 #define POST_CODE_PROPERTY_POST_CODE_DESCRIPTION_ENABLED 0x00000010
14
15 /**
16 Sends a 32-bit value to a POST card.
17
18 Sends the 32-bit value specified by Value to a POST card, and returns Value.
19 Some implementations of this library function may perform I/O operations
20 directly to a POST card device. Other implementations may send Value to
21 ReportStatusCode(), and the status code reporting mechanism will eventually
22 display the 32-bit value on the status reporting device.
23
24 PostCode() must actively prevent recursion. If PostCode() is called while
25 processing another Post Code Library function, then
26 PostCode() must return Value immediately.
27
28 @param Value The 32-bit value to write to the POST card.
29
30 @return The 32-bit value to write to the POST card.
31
32 **/
33 UINT32
34 EFIAPI
35 PostCode (
36 IN UINT32 Value
37 );
38
39
40 /**
41 Sends a 32-bit value to a POST and associated ASCII string.
42
43 Sends the 32-bit value specified by Value to a POST card, and returns Value.
44 If Description is not NULL, then the ASCII string specified by Description is
45 also passed to the handler that displays the POST card value. Some
46 implementations of this library function may perform I/O operations directly
47 to a POST card device. Other implementations may send Value to ReportStatusCode(),
48 and the status code reporting mechanism will eventually display the 32-bit
49 value on the status reporting device.
50
51 PostCodeWithDescription()must actively prevent recursion. If
52 PostCodeWithDescription() is called while processing another any other Post
53 Code Library function, then PostCodeWithDescription() must return Value
54 immediately.
55
56 @param Value The 32-bit value to write to the POST card.
57 @param Description Pointer to an ASCII string that is a description of the
58 POST code value. This is an optional parameter that may
59 be NULL.
60
61 @return The 32-bit value to write to the POST card.
62
63 **/
64 UINT32
65 EFIAPI
66 PostCodeWithDescription (
67 IN UINT32 Value,
68 IN CONST CHAR8 *Description OPTIONAL
69 );
70
71
72 /**
73 Returns TRUE if POST Codes are enabled.
74
75 This function returns TRUE if the POST_CODE_PROPERTY_POST_CODE_ENABLED
76 bit of PcdPostCodePropertyMask is set. Otherwise FALSE is returned.
77
78 @retval TRUE The POST_CODE_PROPERTY_POST_CODE_ENABLED bit of
79 PcdPostCodeProperyMask is set.
80 @retval FALSE The POST_CODE_PROPERTY_POST_CODE_ENABLED bit of
81 PcdPostCodeProperyMask is clear.
82
83 **/
84 BOOLEAN
85 EFIAPI
86 PostCodeEnabled (
87 VOID
88 );
89
90
91 /**
92 Returns TRUE if POST code descriptions are enabled.
93
94 This function returns TRUE if the POST_CODE_PROPERTY_POST_CODE_DESCRIPTION_ENABLED
95 bit of PcdPostCodePropertyMask is set. Otherwise FALSE is returned.
96
97 @retval TRUE The POST_CODE_PROPERTY_POST_CODE_DESCRIPTION_ENABLED bit of
98 PcdPostCodeProperyMask is set.
99 @retval FALSE The POST_CODE_PROPERTY_POST_CODE_DESCRIPTION_ENABLED bit of
100 PcdPostCodeProperyMask is clear.
101
102 **/
103 BOOLEAN
104 EFIAPI
105 PostCodeDescriptionEnabled (
106 VOID
107 );
108
109
110 /**
111 Sends a 32-bit value to a POST card.
112
113 If POST codes are enabled in PcdPostCodeProperyMask, then call PostCode()
114 passing in Value. Value is returned.
115
116 @param Value The 32-bit value to write to the POST card.
117
118 @return Value The 32-bit value to write to the POST card.
119
120 **/
121 #define POST_CODE(Value) PostCodeEnabled() ? PostCode(Value) : Value
122
123 /**
124 Sends a 32-bit value to a POST and associated ASCII string.
125
126 If POST codes and POST code descriptions are enabled in
127 PcdPostCodeProperyMask, then call PostCodeWithDescription() passing in
128 Value and Description. If only POST codes are enabled, then call PostCode()
129 passing in Value. Value is returned.
130
131 @param Value The 32-bit value to write to the POST card.
132 @param Description Pointer to an ASCII string that is a description of the
133 POST code value.
134
135 @return Value The 32-bit value to write to the POST card.
136 **/
137 #define POST_CODE_WITH_DESCRIPTION(Value,Description) \
138 PostCodeEnabled() ? \
139 (PostCodeDescriptionEnabled() ? \
140 PostCodeWithDescription(Value,Description) : \
141 PostCode(Value)) : \
142 Value
143
144 #endif