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