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