]> 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 Sends a 32-bit value to a POST and associated ASCII string.
41
42 Sends the 32-bit value specified by Value to a POST card, and returns Value.
43 If Description is not NULL, then the ASCII string specified by Description is
44 also passed to the handler that displays the POST card value. Some
45 implementations of this library function may perform I/O operations directly
46 to a POST card device. Other implementations may send Value to ReportStatusCode(),
47 and the status code reporting mechanism will eventually display the 32-bit
48 value on the status reporting device.
49
50 PostCodeWithDescription()must actively prevent recursion. If
51 PostCodeWithDescription() is called while processing another any other Post
52 Code Library function, then PostCodeWithDescription() must return Value
53 immediately.
54
55 @param Value The 32-bit value to write to the POST card.
56 @param Description Pointer to an ASCII string that is a description of the
57 POST code value. This is an optional parameter that may
58 be NULL.
59
60 @return The 32-bit value to write to the POST card.
61
62 **/
63 UINT32
64 EFIAPI
65 PostCodeWithDescription (
66 IN UINT32 Value,
67 IN CONST CHAR8 *Description OPTIONAL
68 );
69
70 /**
71 Returns TRUE if POST Codes are enabled.
72
73 This function returns TRUE if the POST_CODE_PROPERTY_POST_CODE_ENABLED
74 bit of PcdPostCodePropertyMask is set. Otherwise FALSE is returned.
75
76 @retval TRUE The POST_CODE_PROPERTY_POST_CODE_ENABLED bit of
77 PcdPostCodeProperyMask is set.
78 @retval FALSE The POST_CODE_PROPERTY_POST_CODE_ENABLED bit of
79 PcdPostCodeProperyMask is clear.
80
81 **/
82 BOOLEAN
83 EFIAPI
84 PostCodeEnabled (
85 VOID
86 );
87
88 /**
89 Returns TRUE if POST code descriptions are enabled.
90
91 This function returns TRUE if the POST_CODE_PROPERTY_POST_CODE_DESCRIPTION_ENABLED
92 bit of PcdPostCodePropertyMask is set. Otherwise FALSE is returned.
93
94 @retval TRUE The POST_CODE_PROPERTY_POST_CODE_DESCRIPTION_ENABLED bit of
95 PcdPostCodeProperyMask is set.
96 @retval FALSE The POST_CODE_PROPERTY_POST_CODE_DESCRIPTION_ENABLED bit of
97 PcdPostCodeProperyMask is clear.
98
99 **/
100 BOOLEAN
101 EFIAPI
102 PostCodeDescriptionEnabled (
103 VOID
104 );
105
106 /**
107 Sends a 32-bit value to a POST card.
108
109 If POST codes are enabled in PcdPostCodeProperyMask, then call PostCode()
110 passing in Value. Value is returned.
111
112 @param Value The 32-bit value to write to the POST card.
113
114 @return Value The 32-bit value to write to the POST card.
115
116 **/
117 #define POST_CODE(Value) PostCodeEnabled() ? PostCode(Value) : Value
118
119 /**
120 Sends a 32-bit value to a POST and associated ASCII string.
121
122 If POST codes and POST code descriptions are enabled in
123 PcdPostCodeProperyMask, then call PostCodeWithDescription() passing in
124 Value and Description. If only POST codes are enabled, then call PostCode()
125 passing in Value. Value is returned.
126
127 @param Value The 32-bit value to write to the POST card.
128 @param Description Pointer to an ASCII string that is a description of the
129 POST code value.
130
131 @return Value The 32-bit value to write to the POST card.
132 **/
133 #define POST_CODE_WITH_DESCRIPTION(Value, Description) \
134 PostCodeEnabled() ? \
135 (PostCodeDescriptionEnabled() ? \
136 PostCodeWithDescription(Value,Description) : \
137 PostCode(Value)) : \
138 Value
139
140 #endif