]> git.proxmox.com Git - mirror_edk2.git/blame - MdePkg/Library/BasePostCodeLibDebug/PostCode.c
UefiCpuPkg: Move AsmRelocateApLoopStart from Mpfuncs.nasm to AmdSev.nasm
[mirror_edk2.git] / MdePkg / Library / BasePostCodeLibDebug / PostCode.c
CommitLineData
e1f414b6 1/** @file\r
afa22326 2 The instance of Post Code Library that layers on top of a Debug Library instance.\r
e1f414b6 3\r
9095d37b 4 Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>\r
9344f092 5 SPDX-License-Identifier: BSD-2-Clause-Patent\r
e1f414b6 6\r
7**/\r
8\r
c7d265a9 9#include <Base.h>\r
c892d846 10\r
c7d265a9 11#include <Library/PostCodeLib.h>\r
12#include <Library/DebugLib.h>\r
13#include <Library/PcdLib.h>\r
e1f414b6 14\r
15/**\r
16 Sends an 32-bit value to a POST card.\r
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
e1f414b6 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 any other Post Code Library function, then\r
e1f414b6 26 PostCode() must return Value immediately.\r
27\r
122e2191 28 @param Value The 32-bit value to write to the POST card.\r
e1f414b6 29\r
122e2191 30 @return The 32-bit value to write to the POST card.\r
e1f414b6 31\r
32**/\r
33UINT32\r
34EFIAPI\r
35PostCode (\r
36 IN UINT32 Value\r
37 )\r
38{\r
2f88bd3a 39 DEBUG ((DEBUG_INFO, "POST %08x\n", Value));\r
e1f414b6 40 return Value;\r
41}\r
42\r
e1f414b6 43/**\r
44 Sends an 32-bit value to a POST and associated ASCII string.\r
45\r
46 Sends the 32-bit value specified by Value to a POST card, and returns Value.\r
9095d37b
LG
47 If Description is not NULL, then the ASCII string specified by Description is\r
48 also passed to the handler that displays the POST card value. Some\r
49 implementations of this library function may perform I/O operations directly\r
50 to a POST card device. Other implementations may send Value to ReportStatusCode(),\r
51 and the status code reporting mechanism will eventually display the 32-bit\r
52 value on the status reporting device.\r
53\r
54 PostCodeWithDescription()must actively prevent recursion. If\r
55 PostCodeWithDescription() is called while processing another any other Post\r
56 Code Library function, then PostCodeWithDescription() must return Value\r
e1f414b6 57 immediately.\r
58\r
59 @param Value The 32-bit value to write to the POST card.\r
9095d37b
LG
60 @param Description The pointer to an ASCII string that is a description of the\r
61 POST code value. This is an optional parameter that may\r
e1f414b6 62 be NULL.\r
63\r
afa22326 64 @return The 32-bit value to write to the POST card.\r
e1f414b6 65\r
66**/\r
67UINT32\r
68EFIAPI\r
69PostCodeWithDescription (\r
70 IN UINT32 Value,\r
71 IN CONST CHAR8 *Description OPTIONAL\r
72 )\r
73{\r
2f88bd3a 74 DEBUG ((DEBUG_INFO, "POST %08x - %s\n", Value, Description));\r
e1f414b6 75 return Value;\r
76}\r
77\r
e1f414b6 78/**\r
79 Returns TRUE if POST Codes are enabled.\r
80\r
9095d37b 81 This function returns TRUE if the POST_CODE_PROPERTY_POST_CODE_ENABLED\r
e1f414b6 82 bit of PcdPostCodePropertyMask is set. Otherwise FALSE is returned.\r
83\r
9095d37b 84 @retval TRUE The POST_CODE_PROPERTY_POST_CODE_ENABLED bit of\r
e1f414b6 85 PcdPostCodeProperyMask is set.\r
9095d37b 86 @retval FALSE The POST_CODE_PROPERTY_POST_CODE_ENABLED bit of\r
e1f414b6 87 PcdPostCodeProperyMask is clear.\r
88\r
89**/\r
90BOOLEAN\r
91EFIAPI\r
92PostCodeEnabled (\r
93 VOID\r
94 )\r
95{\r
2f88bd3a 96 return (BOOLEAN)((PcdGet8 (PcdPostCodePropertyMask) & POST_CODE_PROPERTY_POST_CODE_ENABLED) != 0);\r
e1f414b6 97}\r
98\r
e1f414b6 99/**\r
100 Returns TRUE if POST code descriptions are enabled.\r
101\r
eceb3a4c 102 This function returns TRUE if the POST_CODE_PROPERTY_POST_CODE_DESCRIPTION_ENABLED\r
e1f414b6 103 bit of PcdPostCodePropertyMask is set. Otherwise FALSE is returned.\r
104\r
eceb3a4c 105 @retval TRUE The POST_CODE_PROPERTY_POST_CODE_DESCRIPTION_ENABLED bit of\r
e1f414b6 106 PcdPostCodeProperyMask is set.\r
eceb3a4c 107 @retval FALSE The POST_CODE_PROPERTY_POST_CODE_DESCRIPTION_ENABLED bit of\r
e1f414b6 108 PcdPostCodeProperyMask is clear.\r
109\r
110**/\r
111BOOLEAN\r
112EFIAPI\r
113PostCodeDescriptionEnabled (\r
114 VOID\r
115 )\r
116{\r
2f88bd3a 117 return (BOOLEAN)((PcdGet8 (PcdPostCodePropertyMask) & POST_CODE_PROPERTY_POST_CODE_DESCRIPTION_ENABLED) != 0);\r
e1f414b6 118}\r