]> git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Library/BasePostCodeLibPort80/PostCode.c
Checked in part of MDE library instances following PI and UEFI. It includes:
[mirror_edk2.git] / MdePkg / Library / BasePostCodeLibPort80 / 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 // The package level header files this module uses
18 //
19 #include <Base.h>
20 //
21 // The protocols, PPI and GUID defintions for this module
22 //
23 //
24 // The Library classes this module consumes
25 //
26 #include <Library/PostCodeLib.h>
27 #include <Library/PcdLib.h>
28 #include <Library/IoLib.h>
29
30 /**
31 Sends an 32-bit value to a POST card.
32
33 Sends the 32-bit value specified by Value to a POST card, and returns Value.
34 Some implementations of this library function may perform I/O operations
35 directly to a POST card device. Other implementations may send Value to
36 ReportStatusCode(), and the status code reporting mechanism will eventually
37 display the 32-bit value on the status reporting device.
38
39 PostCode() must actively prevent recursion. If PostCode() is called while
40 processing another any other Report Status Code Library function, then
41 PostCode() must return Value immediately.
42
43 @param Value The 32-bit value to write to the POST card.
44
45 @return Value
46
47 **/
48 UINT32
49 EFIAPI
50 PostCode (
51 IN UINT32 Value
52 )
53 {
54 IoWrite8 (0x80, (UINT8)(Value));
55 return Value;
56 }
57
58
59 /**
60 Sends an 32-bit value to a POST and associated ASCII string.
61
62 Sends the 32-bit value specified by Value to a POST card, and returns Value.
63 If Description is not NULL, then the ASCII string specified by Description is
64 also passed to the handler that displays the POST card value. Some
65 implementations of this library function may perform I/O operations directly
66 to a POST card device. Other implementations may send Value to ReportStatusCode(),
67 and the status code reporting mechanism will eventually display the 32-bit
68 value on the status reporting device.
69
70 PostCodeWithDescription()must actively prevent recursion. If
71 PostCodeWithDescription() is called while processing another any other Report
72 Status Code Library function, then PostCodeWithDescription() must return Value
73 immediately.
74
75 @param Value The 32-bit value to write to the POST card.
76 @param Description Pointer to an ASCII string that is a description of the
77 POST code value. This is an optional parameter that may
78 be NULL.
79
80 @return Value
81
82 **/
83 UINT32
84 EFIAPI
85 PostCodeWithDescription (
86 IN UINT32 Value,
87 IN CONST CHAR8 *Description OPTIONAL
88 )
89 {
90 IoWrite8 (0x80, (UINT8)(Value));
91 return Value;
92 }
93
94
95 /**
96 Returns TRUE if POST Codes are enabled.
97
98 This function returns TRUE if the POST_CODE_PROPERTY_POST_CODE_ENABLED
99 bit of PcdPostCodePropertyMask is set. Otherwise FALSE is returned.
100
101 @retval TRUE The POST_CODE_PROPERTY_POST_CODE_ENABLED bit of
102 PcdPostCodeProperyMask is set.
103 @retval FALSE The POST_CODE_PROPERTY_POST_CODE_ENABLED bit of
104 PcdPostCodeProperyMask is clear.
105
106 **/
107 BOOLEAN
108 EFIAPI
109 PostCodeEnabled (
110 VOID
111 )
112 {
113 return (BOOLEAN) ((PcdGet8(PcdPostCodePropertyMask) & POST_CODE_PROPERTY_POST_CODE_ENABLED) != 0);
114 }
115
116
117 /**
118 Returns TRUE if POST code descriptions are enabled.
119
120 This function returns TRUE if the
121 POST_CODE_PROPERTY_POST_CODE_ENABLED bit of
122 PcdPostCodePropertyMask is set. Otherwise FALSE is returned.
123
124 @retval TRUE The POST_CODE_PROPERTY_POST_CODE_ENABLED
125 bit of PcdPostCodeProperyMask is set.
126 @retval FALSE The POST_CODE_PROPERTY_POST_CODE_ENABLED
127 bit of PcdPostCodeProperyMask is clear.
128
129 **/
130 BOOLEAN
131 EFIAPI
132 PostCodeDescriptionEnabled (
133 VOID
134 )
135 {
136 return (BOOLEAN) ((PcdGet8(PcdPostCodePropertyMask) & POST_CODE_PROPERTY_POST_CODE_ENABLED) != 0);
137 }