--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>\r
+<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">\r
+ <MsaHeader>\r
+ <ModuleName>PeiDxePostCodeLibReportStatusCode</ModuleName>\r
+ <ModuleType>PEIM</ModuleType>\r
+ <GuidValue>e062c52d-78dc-4cc5-b246-b13497a8123c</GuidValue>\r
+ <Version>1.0</Version>\r
+ <Abstract>Post code library based on report status code library</Abstract>\r
+ <Description>PostCode Library for PEIMs and DXE drivers that send PostCode to ReportStatusCode</Description>\r
+ <Copyright>Copyright (c) 2006, Intel Corporation.</Copyright>\r
+ <License>All rights reserved. This program and the accompanying materials
+ are licensed and made available under the terms and conditions of the BSD License
+ which accompanies this distribution. The full text of the license may be found at
+ http://opensource.org/licenses/bsd-license.php
+ THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.</License>\r
+ <Specification>FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052</Specification>\r
+ </MsaHeader>\r
+ <ModuleDefinitions>\r
+ <SupportedArchitectures>IA32 X64 IPF EBC</SupportedArchitectures>\r
+ <BinaryModule>false</BinaryModule>\r
+ <OutputFileBasename>PeiDxePostCodeLibReportStatusCode</OutputFileBasename>\r
+ </ModuleDefinitions>\r
+ <LibraryClassDefinitions>\r
+ <LibraryClass Usage="ALWAYS_PRODUCED" SupModuleList="DXE_CORE DXE_DRIVER DXE_RUNTIME_DRIVER DXE_SAL_DRIVER DXE_SMM_DRIVER PEIM PEI_CORE UEFI_APPLICATION UEFI_DRIVER">\r
+ <Keyword>PostCodeLib</Keyword>\r
+ </LibraryClass>\r
+ <LibraryClass Usage="ALWAYS_CONSUMED">\r
+ <Keyword>ReportStatusCodeLib</Keyword>\r
+ </LibraryClass>\r
+ <LibraryClass Usage="ALWAYS_CONSUMED">\r
+ <Keyword>PcdLib</Keyword>\r
+ </LibraryClass>\r
+ <LibraryClass Usage="ALWAYS_CONSUMED">\r
+ <Keyword>BaseLib</Keyword>\r
+ </LibraryClass>\r
+ </LibraryClassDefinitions>\r
+ <SourceFiles>\r
+ <Filename>PostCode.c</Filename>\r
+ </SourceFiles>\r
+ <PackageDependencies>\r
+ <Package PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>\r
+ </PackageDependencies>\r
+ <Externs>\r
+ <Specification>EFI_SPECIFICATION_VERSION 0x00020000</Specification>\r
+ <Specification>EDK_RELEASE_VERSION 0x00020000</Specification>\r
+ </Externs>\r
+ <PcdCoded>\r
+ <PcdEntry PcdItemType="FIXED_AT_BUILD">\r
+ <C_Name>PcdPostCodePropertyMask</C_Name>\r
+ <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>\r
+ <HelpText>The bitmask of flags that specify the enable/disable of Post
+ Code, Post Code Description.</HelpText>\r
+ </PcdEntry>\r
+ </PcdCoded>\r
+</ModuleSurfaceArea>
\ No newline at end of file
--- /dev/null
+/** @file\r
+ Report Status Code Library Post Code functions for DXE Phase.\r
+\r
+ Copyright (c) 2006, Intel Corporation<BR>\r
+ All rights reserved. This program and the accompanying materials \r
+ are licensed and made available under the terms and conditions of the BSD License \r
+ which accompanies this distribution. The full text of the license may be found at \r
+ http://opensource.org/licenses/bsd-license.php \r
+\r
+ THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
+ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r
+\r
+**/\r
+\r
+/**\r
+ Converts POST code value to status code value.\r
+\r
+ This macro converts the post code to status code value. Bits 0..4 of PostCode \r
+ are mapped to bits 16..20 of status code value, and bits 5..7 of PostCode are mapped to bits \r
+ 24..26 of status code value. \r
+\r
+ @param PostCode POST code value. \r
+\r
+ @return The converted status code value.\r
+\r
+**/\r
+#define POST_CODE_TO_STATUS_CODE_VALUE(PostCode) \\r
+ ((EFI_STATUS_CODE_VALUE) (((PostCode & 0x1f) << 16) | ((PostCode & 0x3) << 19)))\r
+\r
+/**\r
+ Sends an 32-bit value to a POST card.\r
+\r
+ Sends the 32-bit value specified by Value to a POST card, and returns Value. \r
+ Some implementations of this library function may perform I/O operations \r
+ directly to a POST card device. Other implementations may send Value to \r
+ ReportStatusCode(), and the status code reporting mechanism will eventually \r
+ display the 32-bit value on the status reporting device.\r
+ \r
+ PostCode() must actively prevent recursion. If PostCode() is called while \r
+ processing another any other Report Status Code Library function, then \r
+ PostCode() must return Value immediately.\r
+\r
+ @param Value The 32-bit value to write to the POST card.\r
+\r
+ @return Value\r
+\r
+**/\r
+UINT32\r
+EFIAPI\r
+PostCode (\r
+ IN UINT32 Value\r
+ )\r
+{\r
+ REPORT_STATUS_CODE (EFI_PROGRESS_CODE, POST_CODE_TO_STATUS_CODE_VALUE (Value));\r
+ return Value;\r
+}\r
+\r
+\r
+/**\r
+ Sends an 32-bit value to a POST and associated ASCII string.\r
+\r
+ Sends the 32-bit value specified by Value to a POST card, and returns Value.\r
+ If Description is not NULL, then the ASCII string specified by Description is \r
+ also passed to the handler that displays the POST card value. Some \r
+ implementations of this library function may perform I/O operations directly \r
+ to a POST card device. Other implementations may send Value to ReportStatusCode(), \r
+ and the status code reporting mechanism will eventually display the 32-bit \r
+ value on the status reporting device. \r
+\r
+ PostCodeWithDescription()must actively prevent recursion. If \r
+ PostCodeWithDescription() is called while processing another any other Report \r
+ Status Code Library function, then PostCodeWithDescription() must return Value \r
+ immediately.\r
+\r
+ @param Value The 32-bit value to write to the POST card.\r
+ @param Description Pointer to an ASCII string that is a description of the \r
+ POST code value. This is an optional parameter that may \r
+ be NULL.\r
+\r
+ @return Value\r
+\r
+**/\r
+UINT32\r
+EFIAPI\r
+PostCodeWithDescription (\r
+ IN UINT32 Value,\r
+ IN CONST CHAR8 *Description OPTIONAL\r
+ )\r
+{\r
+ if (Description == NULL) { \r
+ REPORT_STATUS_CODE (\r
+ EFI_PROGRESS_CODE,\r
+ POST_CODE_TO_STATUS_CODE_VALUE (Value)\r
+ );\r
+ } else {\r
+ REPORT_STATUS_CODE_WITH_EXTENDED_DATA (\r
+ EFI_PROGRESS_CODE,\r
+ POST_CODE_TO_STATUS_CODE_VALUE (Value),\r
+ Description,\r
+ AsciiStrSize (Description)\r
+ );\r
+ }\r
+\r
+ return Value;\r
+}\r
+\r
+\r
+/**\r
+ Returns TRUE if POST Codes are enabled.\r
+\r
+ This function returns TRUE if the POST_CODE_PROPERTY_POST_CODE_ENABLED \r
+ bit of PcdPostCodePropertyMask is set. Otherwise FALSE is returned.\r
+\r
+ @retval TRUE The POST_CODE_PROPERTY_POST_CODE_ENABLED bit of \r
+ PcdPostCodeProperyMask is set.\r
+ @retval FALSE The POST_CODE_PROPERTY_POST_CODE_ENABLED bit of \r
+ PcdPostCodeProperyMask is clear.\r
+\r
+**/\r
+BOOLEAN\r
+EFIAPI\r
+PostCodeEnabled (\r
+ VOID\r
+ )\r
+{\r
+ return (BOOLEAN) ((PcdGet8(PcdPostCodePropertyMask) & POST_CODE_PROPERTY_POST_CODE_ENABLED) != 0);\r
+}\r
+\r
+\r
+/**\r
+ Returns TRUE if POST code descriptions are enabled.\r
+\r
+ This function returns TRUE if the \r
+ POST_CODE_PROPERTY_POST_CODE_ENABLED bit of \r
+ PcdPostCodePropertyMask is set. Otherwise FALSE is returned.\r
+\r
+ @retval TRUE The POST_CODE_PROPERTY_POST_CODE_ENABLED \r
+ bit of PcdPostCodeProperyMask is set.\r
+ @retval FALSE The POST_CODE_PROPERTY_POST_CODE_ENABLED \r
+ bit of PcdPostCodeProperyMask is clear.\r
+\r
+**/\r
+BOOLEAN\r
+EFIAPI\r
+PostCodeDescriptionEnabled (\r
+ VOID\r
+ )\r
+{\r
+ return (BOOLEAN) ((PcdGet8(PcdPostCodePropertyMask) & POST_CODE_PROPERTY_POST_CODE_ENABLED) != 0);\r
+}\r