is responsible for allocating a buffer large enough for the standard header and\r
the extended data passed into this function. The standard header is filled in\r
with a GUID specified by ExtendedDataGuid. If ExtendedDataGuid is NULL, then a\r
- GUID of gEfiStatusCodeSpecificDatauid is used. The status code is reported with\r
+ GUID of gEfiStatusCodeSpecificDataGuid is used. The status code is reported with\r
an instance specified by Instance and a caller ID specified by CallerId. If\r
CallerId is NULL, then a caller ID of gEfiCallerIdGuid is used.\r
\r
//\r
AsciiStrCpy (Temp + AsciiStrLen (FileName) + 1, Description);\r
\r
- REPORT_STATUS_CODE_WITH_EXTENDED_DATA (\r
+ REPORT_STATUS_CODE_EX (\r
(EFI_ERROR_CODE | EFI_ERROR_UNRECOVERED),\r
(EFI_SOFTWARE_DXE_BS_DRIVER | EFI_SW_EC_ILLEGAL_SOFTWARE_STATE),\r
+ 0,\r
+ NULL,\r
+ &gEfiStatusCodeDataTypeAssertGuid,\r
AssertData,\r
TotalSize\r
);\r
\r
[Guids.common]\r
gEfiStatusCodeDataTypeDebugGuid\r
+ gEfiStatusCodeDataTypeAssertGuid\r
+ \r
\ No newline at end of file
gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdPciCfgDisable\r
gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdPciCfg2Disable\r
\r
-[FixedPcd.common]\r
- ##\r
- # Disable ASSERT for unalign PCI IO access according to PI Volume 1 and PeiCis Spec\r
- # Spec has not this requirement.\r
- ##\r
- gEfiMdePkgTokenSpaceGuid.PcdDebugPropertyMask|0x0E\r
-\r
[Depex]\r
TRUE\r
\r
UINTN PciLibAddress;\r
\r
PciLibAddress = PciCfgAddressConvert ((EFI_PEI_PCI_CFG_PPI_PCI_ADDRESS *) &Address);\r
- switch (Width) {\r
- case EfiPeiPciCfgWidthUint8:\r
- * (UINT8 *) Buffer = PciRead8 (PciLibAddress);\r
- break;\r
\r
- case EfiPeiPciCfgWidthUint16:\r
- * (UINT16 *) Buffer = PciRead16 (PciLibAddress);\r
- break;\r
-\r
- case EfiPeiPciCfgWidthUint32:\r
- * (UINT32 *) Buffer = PciRead32 (PciLibAddress);\r
- break;\r
-\r
- default:\r
- return EFI_INVALID_PARAMETER;\r
+ if (Width == EfiPeiPciCfgWidthUint8) {\r
+ *((UINT8 *) Buffer) = PciRead8 (PciLibAddress);\r
+ } else if (Width == EfiPeiPciCfgWidthUint16) {\r
+ if ((PciLibAddress & 0x01) == 0) {\r
+ //\r
+ // Aligned Pci address access\r
+ //\r
+ WriteUnaligned16 (((UINT16 *) Buffer), PciRead16 (PciLibAddress));\r
+ } else {\r
+ //\r
+ // Unaligned Pci address access, break up the request into byte by byte.\r
+ //\r
+ *((UINT8 *) Buffer) = PciRead8 (PciLibAddress);\r
+ *((UINT8 *) Buffer + 1) = PciRead8 (PciLibAddress + 1);\r
+ }\r
+ } else if (Width == EfiPeiPciCfgWidthUint32) {\r
+ if ((PciLibAddress & 0x03) == 0) {\r
+ //\r
+ // Aligned Pci address access\r
+ //\r
+ WriteUnaligned32 (((UINT32 *) Buffer), PciRead32 (PciLibAddress));\r
+ } else if ((PciLibAddress & 0x01) == 0) {\r
+ //\r
+ // Unaligned Pci address access, break up the request into word by word.\r
+ //\r
+ WriteUnaligned16 (((UINT16 *) Buffer), PciRead16 (PciLibAddress));\r
+ WriteUnaligned16 (((UINT16 *) Buffer + 1), PciRead16 (PciLibAddress + 2));\r
+ } else {\r
+ //\r
+ // Unaligned Pci address access, break up the request into byte by byte.\r
+ //\r
+ *((UINT8 *) Buffer) = PciRead8 (PciLibAddress);\r
+ *((UINT8 *) Buffer + 1) = PciRead8 (PciLibAddress + 1);\r
+ *((UINT8 *) Buffer + 2) = PciRead8 (PciLibAddress + 2);\r
+ *((UINT8 *) Buffer + 3) = PciRead8 (PciLibAddress + 3);\r
+ }\r
+ } else {\r
+ return EFI_INVALID_PARAMETER;\r
}\r
+\r
return EFI_SUCCESS;\r
}\r
\r
UINTN PciLibAddress;\r
\r
PciLibAddress = PciCfgAddressConvert ((EFI_PEI_PCI_CFG_PPI_PCI_ADDRESS *) &Address);\r
- switch (Width) {\r
- case EfiPeiPciCfgWidthUint8:\r
- PciWrite8 (PciLibAddress, *(UINT8 *) Buffer);\r
- break;\r
-\r
- case EfiPeiPciCfgWidthUint16:\r
- PciWrite16 (PciLibAddress, *(UINT16 *) Buffer);\r
- break;\r
\r
- case EfiPeiPciCfgWidthUint32:\r
- PciWrite32 (PciLibAddress, *(UINT32 *) Buffer);\r
- break;\r
-\r
- default:\r
- return EFI_INVALID_PARAMETER;\r
+ if (Width == EfiPeiPciCfgWidthUint8) {\r
+ PciWrite8 (PciLibAddress, *((UINT8 *) Buffer));\r
+ } else if (Width == EfiPeiPciCfgWidthUint16) {\r
+ if ((PciLibAddress & 0x01) == 0) {\r
+ //\r
+ // Aligned Pci address access\r
+ //\r
+ PciWrite16 (PciLibAddress, ReadUnaligned16 ((UINT16 *) Buffer));\r
+ } else {\r
+ //\r
+ // Unaligned Pci address access, break up the request into byte by byte.\r
+ //\r
+ PciWrite8 (PciLibAddress, *((UINT8 *) Buffer));\r
+ PciWrite8 (PciLibAddress + 1, *((UINT8 *) Buffer + 1)); \r
+ }\r
+ } else if (Width == EfiPeiPciCfgWidthUint32) {\r
+ if ((PciLibAddress & 0x03) == 0) {\r
+ //\r
+ // Aligned Pci address access\r
+ //\r
+ PciWrite32 (PciLibAddress, ReadUnaligned32 ((UINT32 *) Buffer));\r
+ } else if ((PciLibAddress & 0x01) == 0) {\r
+ //\r
+ // Unaligned Pci address access, break up the request into word by word.\r
+ //\r
+ PciWrite16 (PciLibAddress, ReadUnaligned16 ((UINT16 *) Buffer));\r
+ PciWrite16 (PciLibAddress + 2, ReadUnaligned16 ((UINT16 *) Buffer + 1));\r
+ } else {\r
+ //\r
+ // Unaligned Pci address access, break up the request into byte by byte.\r
+ //\r
+ PciWrite8 (PciLibAddress, *((UINT8 *) Buffer));\r
+ PciWrite8 (PciLibAddress + 1, *((UINT8 *) Buffer + 1)); \r
+ PciWrite8 (PciLibAddress + 2, *((UINT8 *) Buffer + 2)); \r
+ PciWrite8 (PciLibAddress + 3, *((UINT8 *) Buffer + 3)); \r
+ }\r
+ } else {\r
+ return EFI_INVALID_PARAMETER;\r
}\r
+\r
return EFI_SUCCESS;\r
}\r
\r
UINTN PciLibAddress;\r
\r
PciLibAddress = PciCfgAddressConvert ((EFI_PEI_PCI_CFG_PPI_PCI_ADDRESS *) &Address);\r
- switch (Width) {\r
- case EfiPeiPciCfgWidthUint8:\r
- PciAndThenOr8 (PciLibAddress, (UINT8)~ClearBits, (UINT8)SetBits);\r
- break;\r
-\r
- case EfiPeiPciCfgWidthUint16:\r
+ if (Width == EfiPeiPciCfgWidthUint8) {\r
+ PciAndThenOr8 (PciLibAddress, (UINT8)~ClearBits, (UINT8)SetBits);\r
+ } else if (Width == EfiPeiPciCfgWidthUint16) {\r
+ if ((PciLibAddress & 0x01) == 0) {\r
+ //\r
+ // Aligned Pci address access\r
+ //\r
PciAndThenOr16 (PciLibAddress, (UINT16)~ClearBits, (UINT16)SetBits);\r
- break;\r
-\r
- case EfiPeiPciCfgWidthUint32:\r
+ } else {\r
+ //\r
+ // Unaligned Pci address access, break up the request into byte by byte.\r
+ //\r
+ PciAndThenOr8 (PciLibAddress, (UINT8)~ClearBits, (UINT8)SetBits);\r
+ PciAndThenOr8 (PciLibAddress + 1, (UINT8)~(ClearBits >> 8), (UINT8)(SetBits >> 8));\r
+ }\r
+ } else if (Width == EfiPeiPciCfgWidthUint32) {\r
+ if ((PciLibAddress & 0x03) == 0) {\r
+ //\r
+ // Aligned Pci address access\r
+ //\r
PciAndThenOr32 (PciLibAddress, (UINT32)~ClearBits, (UINT32)SetBits);\r
- break;\r
-\r
- default:\r
- return EFI_INVALID_PARAMETER;\r
+ } else if ((PciLibAddress & 0x01) == 0) {\r
+ //\r
+ // Unaligned Pci address access, break up the request into word by word.\r
+ //\r
+ PciAndThenOr16 (PciLibAddress, (UINT16)~ClearBits, (UINT16)SetBits);\r
+ PciAndThenOr16 (PciLibAddress + 2, (UINT16)~(ClearBits >> 16), (UINT16)(SetBits >> 16));\r
+ } else {\r
+ //\r
+ // Unaligned Pci address access, break up the request into byte by byte.\r
+ //\r
+ PciAndThenOr8 (PciLibAddress, (UINT8)~ClearBits, (UINT8)SetBits);\r
+ PciAndThenOr8 (PciLibAddress + 1, (UINT8)~(ClearBits >> 8), (UINT8)(SetBits >> 8));\r
+ PciAndThenOr8 (PciLibAddress + 2, (UINT8)~(ClearBits >> 16), (UINT8)(SetBits >> 16));\r
+ PciAndThenOr8 (PciLibAddress + 3, (UINT8)~(ClearBits >> 24), (UINT8)(SetBits >> 24));\r
+ }\r
+ } else {\r
+ return EFI_INVALID_PARAMETER;\r
}\r
+\r
return EFI_SUCCESS;\r
}\r
\r
if (Width == EfiPeiPciCfgWidthUint8) {\r
*((UINT8 *) Buffer) = PciRead8 (PciLibAddress);\r
} else if (Width == EfiPeiPciCfgWidthUint16) {\r
- *((UINT16 *) Buffer) = PciRead16 (PciLibAddress);\r
+ if ((PciLibAddress & 0x01) == 0) {\r
+ //\r
+ // Aligned Pci address access\r
+ //\r
+ WriteUnaligned16 (((UINT16 *) Buffer), PciRead16 (PciLibAddress));\r
+ } else {\r
+ //\r
+ // Unaligned Pci address access, break up the request into byte by byte.\r
+ //\r
+ *((UINT8 *) Buffer) = PciRead8 (PciLibAddress);\r
+ *((UINT8 *) Buffer + 1) = PciRead8 (PciLibAddress + 1);\r
+ }\r
} else if (Width == EfiPeiPciCfgWidthUint32) {\r
- *((UINT32 *) Buffer) = PciRead32 (PciLibAddress);\r
+ if ((PciLibAddress & 0x03) == 0) {\r
+ //\r
+ // Aligned Pci address access\r
+ //\r
+ WriteUnaligned32 (((UINT32 *) Buffer), PciRead32 (PciLibAddress));\r
+ } else if ((PciLibAddress & 0x01) == 0) {\r
+ //\r
+ // Unaligned Pci address access, break up the request into word by word.\r
+ //\r
+ WriteUnaligned16 (((UINT16 *) Buffer), PciRead16 (PciLibAddress));\r
+ WriteUnaligned16 (((UINT16 *) Buffer + 1), PciRead16 (PciLibAddress + 2));\r
+ } else {\r
+ //\r
+ // Unaligned Pci address access, break up the request into byte by byte.\r
+ //\r
+ *((UINT8 *) Buffer) = PciRead8 (PciLibAddress);\r
+ *((UINT8 *) Buffer + 1) = PciRead8 (PciLibAddress + 1);\r
+ *((UINT8 *) Buffer + 2) = PciRead8 (PciLibAddress + 2);\r
+ *((UINT8 *) Buffer + 3) = PciRead8 (PciLibAddress + 3);\r
+ }\r
} else {\r
return EFI_INVALID_PARAMETER;\r
}\r
if (Width == EfiPeiPciCfgWidthUint8) {\r
PciWrite8 (PciLibAddress, *((UINT8 *) Buffer));\r
} else if (Width == EfiPeiPciCfgWidthUint16) {\r
- PciWrite16 (PciLibAddress, *((UINT16 *) Buffer));\r
+ if ((PciLibAddress & 0x01) == 0) {\r
+ //\r
+ // Aligned Pci address access\r
+ //\r
+ PciWrite16 (PciLibAddress, ReadUnaligned16 ((UINT16 *) Buffer));\r
+ } else {\r
+ //\r
+ // Unaligned Pci address access, break up the request into byte by byte.\r
+ //\r
+ PciWrite8 (PciLibAddress, *((UINT8 *) Buffer));\r
+ PciWrite8 (PciLibAddress + 1, *((UINT8 *) Buffer + 1)); \r
+ }\r
} else if (Width == EfiPeiPciCfgWidthUint32) {\r
- PciWrite32 (PciLibAddress, *((UINT32 *) Buffer));\r
+ if ((PciLibAddress & 0x03) == 0) {\r
+ //\r
+ // Aligned Pci address access\r
+ //\r
+ PciWrite32 (PciLibAddress, ReadUnaligned32 ((UINT32 *) Buffer));\r
+ } else if ((PciLibAddress & 0x01) == 0) {\r
+ //\r
+ // Unaligned Pci address access, break up the request into word by word.\r
+ //\r
+ PciWrite16 (PciLibAddress, ReadUnaligned16 ((UINT16 *) Buffer));\r
+ PciWrite16 (PciLibAddress + 2, ReadUnaligned16 ((UINT16 *) Buffer + 1));\r
+ } else {\r
+ //\r
+ // Unaligned Pci address access, break up the request into byte by byte.\r
+ //\r
+ PciWrite8 (PciLibAddress, *((UINT8 *) Buffer));\r
+ PciWrite8 (PciLibAddress + 1, *((UINT8 *) Buffer + 1)); \r
+ PciWrite8 (PciLibAddress + 2, *((UINT8 *) Buffer + 2)); \r
+ PciWrite8 (PciLibAddress + 3, *((UINT8 *) Buffer + 3)); \r
+ }\r
} else {\r
return EFI_INVALID_PARAMETER;\r
}\r
if (Width == EfiPeiPciCfgWidthUint8) {\r
PciAndThenOr8 (PciLibAddress, (UINT8) (~(*(UINT8 *) ClearBits)), *((UINT8 *) SetBits));\r
} else if (Width == EfiPeiPciCfgWidthUint16) {\r
- ClearValue16 = (UINT16) (~ReadUnaligned16 ((UINT16 *) ClearBits));\r
- SetValue16 = ReadUnaligned16 ((UINT16 *) SetBits);\r
- PciAndThenOr16 (PciLibAddress, ClearValue16, SetValue16);\r
+ if ((PciLibAddress & 0x01) == 0) {\r
+ //\r
+ // Aligned Pci address access\r
+ //\r
+ ClearValue16 = (UINT16) (~ReadUnaligned16 ((UINT16 *) ClearBits));\r
+ SetValue16 = ReadUnaligned16 ((UINT16 *) SetBits);\r
+ PciAndThenOr16 (PciLibAddress, ClearValue16, SetValue16);\r
+ } else {\r
+ //\r
+ // Unaligned Pci address access, break up the request into byte by byte.\r
+ //\r
+ PciAndThenOr8 (PciLibAddress, (UINT8) (~(*(UINT8 *) ClearBits)), *((UINT8 *) SetBits));\r
+ PciAndThenOr8 (PciLibAddress + 1, (UINT8) (~(*((UINT8 *) ClearBits + 1))), *((UINT8 *) SetBits + 1));\r
+ }\r
} else if (Width == EfiPeiPciCfgWidthUint32) {\r
- ClearValue32 = (UINT32) (~ReadUnaligned32 ((UINT32 *) ClearBits));\r
- SetValue32 = ReadUnaligned32 ((UINT32 *) SetBits);\r
- PciAndThenOr32 (PciLibAddress, ClearValue32, SetValue32);\r
+ if ((PciLibAddress & 0x03) == 0) {\r
+ //\r
+ // Aligned Pci address access\r
+ //\r
+ ClearValue32 = (UINT32) (~ReadUnaligned32 ((UINT32 *) ClearBits));\r
+ SetValue32 = ReadUnaligned32 ((UINT32 *) SetBits);\r
+ PciAndThenOr32 (PciLibAddress, ClearValue32, SetValue32);\r
+ } else if ((PciLibAddress & 0x01) == 0) {\r
+ //\r
+ // Unaligned Pci address access, break up the request into word by word.\r
+ //\r
+ ClearValue16 = (UINT16) (~ReadUnaligned16 ((UINT16 *) ClearBits));\r
+ SetValue16 = ReadUnaligned16 ((UINT16 *) SetBits);\r
+ PciAndThenOr16 (PciLibAddress, ClearValue16, SetValue16);\r
+\r
+ ClearValue16 = (UINT16) (~ReadUnaligned16 ((UINT16 *) ClearBits + 1));\r
+ SetValue16 = ReadUnaligned16 ((UINT16 *) SetBits + 1);\r
+ PciAndThenOr16 (PciLibAddress + 2, ClearValue16, SetValue16);\r
+ } else {\r
+ //\r
+ // Unaligned Pci address access, break up the request into byte by byte.\r
+ //\r
+ PciAndThenOr8 (PciLibAddress, (UINT8) (~(*(UINT8 *) ClearBits)), *((UINT8 *) SetBits));\r
+ PciAndThenOr8 (PciLibAddress + 1, (UINT8) (~(*((UINT8 *) ClearBits + 1))), *((UINT8 *) SetBits + 1));\r
+ PciAndThenOr8 (PciLibAddress + 2, (UINT8) (~(*((UINT8 *) ClearBits + 2))), *((UINT8 *) SetBits + 2));\r
+ PciAndThenOr8 (PciLibAddress + 3, (UINT8) (~(*((UINT8 *) ClearBits + 3))), *((UINT8 *) SetBits + 3));\r
+ }\r
} else {\r
return EFI_INVALID_PARAMETER;\r
}\r
[Guids]\r
gEfiDataHubStatusCodeRecordGuid # SOMETIMES_CONSUMED\r
gMemoryStatusCodeRecordGuid # SOMETIMES_CONSUMED\r
- gEfiStatusCodeSpecificDataGuid # SOMETIMES_CONSUMED\r
gEfiStatusCodeDataTypeDebugGuid # PROTOCOL ALWAYS_CONSUMED\r
\r
[Protocols]\r
**/\r
\r
#include "DxeStatusCode.h"\r
-#include "DebugInfo.h"\r
\r
EFI_SERIAL_IO_PROTOCOL *mSerialIoProtocol;\r
\r
UINT32 LineNumber;\r
UINTN CharCount;\r
VA_LIST Marker;\r
- EFI_DEBUG_INFO *DebugInfo;\r
EFI_TPL CurrentTpl;\r
\r
\r
Format, \r
Marker\r
);\r
- } else if (Data != NULL && \r
- CompareGuid (&Data->Type, &gEfiStatusCodeSpecificDataGuid) &&\r
- (CodeType & EFI_STATUS_CODE_TYPE_MASK) == EFI_DEBUG_CODE) {\r
- //\r
- // Print specific data into output buffer.\r
- //\r
- DebugInfo = (EFI_DEBUG_INFO *) (Data + 1);\r
- Marker = (VA_LIST) (DebugInfo + 1);\r
- Format = (CHAR8 *) (((UINT64 *) Marker) + 12);\r
-\r
- CharCount = AsciiVSPrint (Buffer, EFI_STATUS_CODE_DATA_MAX_SIZE, Format, Marker);\r
} else if ((CodeType & EFI_STATUS_CODE_TYPE_MASK) == EFI_ERROR_CODE) {\r
//\r
// Print ERROR information into output buffer.\r
**/\r
\r
#include "PeiStatusCode.h"\r
-#include "DebugInfo.h"\r
\r
/**\r
Convert status code value and extended data to readable ASCII string, send string to serial I/O device.\r
UINT32 LineNumber;\r
UINTN CharCount;\r
VA_LIST Marker;\r
- EFI_DEBUG_INFO *DebugInfo;\r
\r
Buffer[0] = '\0';\r
\r
Format,\r
Marker\r
);\r
- } else if (Data != NULL &&\r
- CompareGuid (&Data->Type, &gEfiStatusCodeSpecificDataGuid) &&\r
- (CodeType & EFI_STATUS_CODE_TYPE_MASK) == EFI_DEBUG_CODE) {\r
- //\r
- // Print specific data into output buffer.\r
- //\r
- DebugInfo = (EFI_DEBUG_INFO *) (Data + 1);\r
- Marker = (VA_LIST) (DebugInfo + 1);\r
- Format = (CHAR8 *) (((UINT64 *) Marker) + 12);\r
-\r
- CharCount = AsciiVSPrint (Buffer, EFI_STATUS_CODE_DATA_MAX_SIZE, Format, Marker);\r
} else if ((CodeType & EFI_STATUS_CODE_TYPE_MASK) == EFI_ERROR_CODE) {\r
//\r
// Print ERROR information into output buffer.\r