Vishal Bhoj | 82c8071 | 2015-12-15 21:13:33 +0530 | [diff] [blame] | 1 | /** @file
|
| 2 | The instance of Post Code Library that layers on top of a Debug Library instance.
|
| 3 |
|
| 4 | Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
|
| 5 | 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 | #include <Base.h>
|
| 16 |
|
| 17 | #include <Library/PostCodeLib.h>
|
| 18 | #include <Library/DebugLib.h>
|
| 19 | #include <Library/PcdLib.h>
|
| 20 |
|
| 21 | /**
|
| 22 | Sends an 32-bit value to a POST card.
|
| 23 |
|
| 24 | Sends the 32-bit value specified by Value to a POST card, and returns Value.
|
| 25 | Some implementations of this library function may perform I/O operations
|
| 26 | directly to a POST card device. Other implementations may send Value to
|
| 27 | ReportStatusCode(), and the status code reporting mechanism will eventually
|
| 28 | display the 32-bit value on the status reporting device.
|
| 29 |
|
| 30 | PostCode() must actively prevent recursion. If PostCode() is called while
|
| 31 | processing another any other Post Code Library function, then
|
| 32 | PostCode() must return Value immediately.
|
| 33 |
|
| 34 | @param Value The 32-bit value to write to the POST card.
|
| 35 |
|
| 36 | @return The 32-bit value to write to the POST card.
|
| 37 |
|
| 38 | **/
|
| 39 | UINT32
|
| 40 | EFIAPI
|
| 41 | PostCode (
|
| 42 | IN UINT32 Value
|
| 43 | )
|
| 44 | {
|
| 45 | DEBUG((EFI_D_INFO, "POST %08x\n", Value));
|
| 46 | return Value;
|
| 47 | }
|
| 48 |
|
| 49 |
|
| 50 | /**
|
| 51 | Sends an 32-bit value to a POST and associated ASCII string.
|
| 52 |
|
| 53 | Sends the 32-bit value specified by Value to a POST card, and returns Value.
|
| 54 | If Description is not NULL, then the ASCII string specified by Description is
|
| 55 | also passed to the handler that displays the POST card value. Some
|
| 56 | implementations of this library function may perform I/O operations directly
|
| 57 | to a POST card device. Other implementations may send Value to ReportStatusCode(),
|
| 58 | and the status code reporting mechanism will eventually display the 32-bit
|
| 59 | value on the status reporting device.
|
| 60 |
|
| 61 | PostCodeWithDescription()must actively prevent recursion. If
|
| 62 | PostCodeWithDescription() is called while processing another any other Post
|
| 63 | Code Library function, then PostCodeWithDescription() must return Value
|
| 64 | immediately.
|
| 65 |
|
| 66 | @param Value The 32-bit value to write to the POST card.
|
| 67 | @param Description The pointer to an ASCII string that is a description of the
|
| 68 | POST code value. This is an optional parameter that may
|
| 69 | be NULL.
|
| 70 |
|
| 71 | @return The 32-bit value to write to the POST card.
|
| 72 |
|
| 73 | **/
|
| 74 | UINT32
|
| 75 | EFIAPI
|
| 76 | PostCodeWithDescription (
|
| 77 | IN UINT32 Value,
|
| 78 | IN CONST CHAR8 *Description OPTIONAL
|
| 79 | )
|
| 80 | {
|
| 81 | DEBUG((EFI_D_INFO, "POST %08x - %s\n", Value, Description));
|
| 82 | return Value;
|
| 83 | }
|
| 84 |
|
| 85 |
|
| 86 | /**
|
| 87 | Returns TRUE if POST Codes are enabled.
|
| 88 |
|
| 89 | This function returns TRUE if the POST_CODE_PROPERTY_POST_CODE_ENABLED
|
| 90 | bit of PcdPostCodePropertyMask is set. Otherwise FALSE is returned.
|
| 91 |
|
| 92 | @retval TRUE The POST_CODE_PROPERTY_POST_CODE_ENABLED bit of
|
| 93 | PcdPostCodeProperyMask is set.
|
| 94 | @retval FALSE The POST_CODE_PROPERTY_POST_CODE_ENABLED bit of
|
| 95 | PcdPostCodeProperyMask is clear.
|
| 96 |
|
| 97 | **/
|
| 98 | BOOLEAN
|
| 99 | EFIAPI
|
| 100 | PostCodeEnabled (
|
| 101 | VOID
|
| 102 | )
|
| 103 | {
|
| 104 | return (BOOLEAN) ((PcdGet8(PcdPostCodePropertyMask) & POST_CODE_PROPERTY_POST_CODE_ENABLED) != 0);
|
| 105 | }
|
| 106 |
|
| 107 |
|
| 108 | /**
|
| 109 | Returns TRUE if POST code descriptions are enabled.
|
| 110 |
|
| 111 | This function returns TRUE if the POST_CODE_PROPERTY_POST_CODE_DESCRIPTION_ENABLED
|
| 112 | bit of PcdPostCodePropertyMask is set. Otherwise FALSE is returned.
|
| 113 |
|
| 114 | @retval TRUE The POST_CODE_PROPERTY_POST_CODE_DESCRIPTION_ENABLED bit of
|
| 115 | PcdPostCodeProperyMask is set.
|
| 116 | @retval FALSE The POST_CODE_PROPERTY_POST_CODE_DESCRIPTION_ENABLED bit of
|
| 117 | PcdPostCodeProperyMask is clear.
|
| 118 |
|
| 119 | **/
|
| 120 | BOOLEAN
|
| 121 | EFIAPI
|
| 122 | PostCodeDescriptionEnabled (
|
| 123 | VOID
|
| 124 | )
|
| 125 | {
|
| 126 | return (BOOLEAN) ((PcdGet8(PcdPostCodePropertyMask) & POST_CODE_PROPERTY_POST_CODE_DESCRIPTION_ENABLED) != 0);
|
| 127 | }
|