]> git.proxmox.com Git - mirror_edk2.git/blame - MdePkg/Library/BasePostCodeLibDebug/PostCode.c
MdePkg: Replace BSD License with BSD+Patent License
[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
39 DEBUG((EFI_D_INFO, "POST %08x\n", Value));\r
40 return Value;\r
41}\r
42\r
43\r
44/**\r
45 Sends an 32-bit value to a POST and associated ASCII string.\r
46\r
47 Sends the 32-bit value specified by Value to a POST card, and returns Value.\r
9095d37b
LG
48 If Description is not NULL, then the ASCII string specified by Description is\r
49 also passed to the handler that displays the POST card value. Some\r
50 implementations of this library function may perform I/O operations directly\r
51 to a POST card device. Other implementations may send Value to ReportStatusCode(),\r
52 and the status code reporting mechanism will eventually display the 32-bit\r
53 value on the status reporting device.\r
54\r
55 PostCodeWithDescription()must actively prevent recursion. If\r
56 PostCodeWithDescription() is called while processing another any other Post\r
57 Code Library function, then PostCodeWithDescription() must return Value\r
e1f414b6 58 immediately.\r
59\r
60 @param Value The 32-bit value to write to the POST card.\r
9095d37b
LG
61 @param Description The pointer to an ASCII string that is a description of the\r
62 POST code value. This is an optional parameter that may\r
e1f414b6 63 be NULL.\r
64\r
afa22326 65 @return The 32-bit value to write to the POST card.\r
e1f414b6 66\r
67**/\r
68UINT32\r
69EFIAPI\r
70PostCodeWithDescription (\r
71 IN UINT32 Value,\r
72 IN CONST CHAR8 *Description OPTIONAL\r
73 )\r
74{\r
75 DEBUG((EFI_D_INFO, "POST %08x - %s\n", Value, Description));\r
76 return Value;\r
77}\r
78\r
79\r
80/**\r
81 Returns TRUE if POST Codes are enabled.\r
82\r
9095d37b 83 This function returns TRUE if the POST_CODE_PROPERTY_POST_CODE_ENABLED\r
e1f414b6 84 bit of PcdPostCodePropertyMask is set. Otherwise FALSE is returned.\r
85\r
9095d37b 86 @retval TRUE The POST_CODE_PROPERTY_POST_CODE_ENABLED bit of\r
e1f414b6 87 PcdPostCodeProperyMask is set.\r
9095d37b 88 @retval FALSE The POST_CODE_PROPERTY_POST_CODE_ENABLED bit of\r
e1f414b6 89 PcdPostCodeProperyMask is clear.\r
90\r
91**/\r
92BOOLEAN\r
93EFIAPI\r
94PostCodeEnabled (\r
95 VOID\r
96 )\r
97{\r
98 return (BOOLEAN) ((PcdGet8(PcdPostCodePropertyMask) & POST_CODE_PROPERTY_POST_CODE_ENABLED) != 0);\r
99}\r
100\r
101\r
102/**\r
103 Returns TRUE if POST code descriptions are enabled.\r
104\r
eceb3a4c 105 This function returns TRUE if the POST_CODE_PROPERTY_POST_CODE_DESCRIPTION_ENABLED\r
e1f414b6 106 bit of PcdPostCodePropertyMask is set. Otherwise FALSE is returned.\r
107\r
eceb3a4c 108 @retval TRUE The POST_CODE_PROPERTY_POST_CODE_DESCRIPTION_ENABLED bit of\r
e1f414b6 109 PcdPostCodeProperyMask is set.\r
eceb3a4c 110 @retval FALSE The POST_CODE_PROPERTY_POST_CODE_DESCRIPTION_ENABLED bit of\r
e1f414b6 111 PcdPostCodeProperyMask is clear.\r
112\r
113**/\r
114BOOLEAN\r
115EFIAPI\r
116PostCodeDescriptionEnabled (\r
117 VOID\r
118 )\r
119{\r
eceb3a4c 120 return (BOOLEAN) ((PcdGet8(PcdPostCodePropertyMask) & POST_CODE_PROPERTY_POST_CODE_DESCRIPTION_ENABLED) != 0);\r
e1f414b6 121}\r