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