]> git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Library/BaseReportStatusCodeLibNull/PostCode.c
3d0ce7cb8ff9b80c05d79642f94542ab26e8f108
[mirror_edk2.git] / MdePkg / Library / BaseReportStatusCodeLibNull / PostCode.c
1 /** @file
2 Report Status Code Library Post Code functions for DXE Phase.
3
4 Copyright (c) 2006, Intel Corporation<BR>
5 All rights reserved. This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php
9
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
12
13 **/
14
15
16 /**
17 Sends an 32-bit value to a POST card.
18
19 Sends the 32-bit value specified by Value to a POST card, and returns Value.
20 Some implementations of this library function may perform I/O operations
21 directly to a POST card device. Other implementations may send Value to
22 ReportStatusCode(), and the status code reporting mechanism will eventually
23 display the 32-bit value on the status reporting device.
24
25 PostCode() must actively prevent recursion. If PostCode() is called while
26 processing another any other Report Status Code Library function, then
27 PostCode() must return Value immediately.
28
29 @param Value The 32-bit value to write to the POST card.
30
31 @return Value
32
33 **/
34 UINT32
35 EFIAPI
36 PostCode (
37 IN UINT32 Value
38 )
39 {
40 DEBUG((EFI_D_INFO, "POST %08x\n", Value));
41 IoWrite8 (0x80, (UINT8)(Value));
42 return Value;
43 }
44
45
46 /**
47 Sends an 32-bit value to a POST and associated ASCII string.
48
49 Sends the 32-bit value specified by Value to a POST card, and returns Value.
50 If Description is not NULL, then the ASCII string specified by Description is
51 also passed to the handler that displays the POST card value. Some
52 implementations of this library function may perform I/O operations directly
53 to a POST card device. Other implementations may send Value to ReportStatusCode(),
54 and the status code reporting mechanism will eventually display the 32-bit
55 value on the status reporting device.
56
57 PostCodeWithDescription()must actively prevent recursion. If
58 PostCodeWithDescription() is called while processing another any other Report
59 Status Code Library function, then PostCodeWithDescription() must return Value
60 immediately.
61
62 @param Value The 32-bit value to write to the POST card.
63 @param Description Pointer to an ASCII string that is a description of the
64 POST code value. This is an optional parameter that may
65 be NULL.
66
67 @return Value
68
69 **/
70 UINT32
71 EFIAPI
72 PostCodeWithDescription (
73 IN UINT32 Value,
74 IN CONST CHAR8 *Description OPTIONAL
75 )
76 {
77 DEBUG((EFI_D_INFO, "POST %08x - %s\n", Value, Description));
78 IoWrite8 (0x80, (UINT8)(Value));
79 return Value;
80 }
81
82
83 /**
84 Returns TRUE if POST Codes are enabled.
85
86 This function returns TRUE if the REPORT_STATUS_CODE_PROPERTY_POST_CODE_ENABLED
87 bit of PcdReportStatusCodeProperyMask is set. Otherwise FALSE is returned.
88
89 @retval TRUE The REPORT_STATUS_CODE_PROPERTY_POST_CODE_ENABLED bit of
90 PcdReportStatusCodeProperyMask is set.
91 @retval FALSE The REPORT_STATUS_CODE_PROPERTY_POST_CODE_ENABLED bit of
92 PcdReportStatusCodeProperyMask is clear.
93
94 **/
95 BOOLEAN
96 EFIAPI
97 ReportPostCodeEnabled (
98 VOID
99 )
100 {
101 return ((PcdGet8(PcdReportStatusCodePropertyMask) & REPORT_STATUS_CODE_PROPERTY_POST_CODE_ENABLED) != 0);
102 }
103
104
105 /**
106 Returns TRUE if POST code descriptions are enabled.
107
108 This function returns TRUE if the
109 REPORT_STATUS_CODE_PROPERTY_POST_CODE_DESCRIPTIONS_ENABLED bit of
110 PcdReportStatusCodeProperyMask is set. Otherwise FALSE is returned.
111
112 @retval TRUE The REPORT_STATUS_CODE_PROPERTY_POST_CODE_DESCRIPTIONS_ENABLED
113 bit of PcdReportStatusCodeProperyMask is set.
114 @retval FALSE The REPORT_STATUS_CODE_PROPERTY_POST_CODE_DESCRIPTIONS_ENABLED
115 bit of PcdReportStatusCodeProperyMask is clear.
116
117 **/
118 BOOLEAN
119 EFIAPI
120 ReportPostCodeDescriptionEnabled (
121 VOID
122 )
123 {
124 return ((PcdGet8(PcdReportStatusCodePropertyMask) & REPORT_STATUS_CODE_PROPERTY_POST_CODE_DESCRIPTION_ENABLED) != 0);
125 }