diff options
author | Chandni Cherukuri <chandni.cherukuri@arm.com> | 2019-05-03 12:09:16 +0530 |
---|---|---|
committer | Thomas Abraham <thomas.abraham@arm.com> | 2020-04-16 13:02:15 +0530 |
commit | f84f63f3182b7fe69b2cea75d0ff31f91736b8b8 (patch) | |
tree | d446eb5efee76783c7d3b75f22df3c1165330c84 | |
parent | c02481238db51ca4f1a24bcd063ab701bfba8730 (diff) |
CperLib: Fix for the CPER memory error structureRD-INFRA-2020.04.16
This fix corrects the CPER structure for the memory type error.
https://jira.arm.com/browse/PLATFORMS-1607
Change-Id: I2533c201f042d72fe51148168f73bf11ea18f556
Signed-off-by: Daniil Egranov <daniil.egranov@arm.com>
Signed-off-by: Sughosh Ganu <sughosh.ganu@arm.com>
-rw-r--r-- | StandaloneMmPkg/Library/CperLib/CperLib.c | 71 |
1 files changed, 41 insertions, 30 deletions
diff --git a/StandaloneMmPkg/Library/CperLib/CperLib.c b/StandaloneMmPkg/Library/CperLib/CperLib.c index 5cf9f7ee8b..aed292dd8e 100644 --- a/StandaloneMmPkg/Library/CperLib/CperLib.c +++ b/StandaloneMmPkg/Library/CperLib/CperLib.c @@ -164,53 +164,60 @@ CperWrite ( UINT32 _DataLength; UINTN CperAddress; - EFI_COMMON_ERROR_RECORD_HEADER *ErrorRecordHeader; - EFI_ERROR_SECTION_DESCRIPTOR *_ErrorRecordDescriptor; + //EFI_COMMON_ERROR_RECORD_HEADER *ErrorRecordHeader; + //EFI_ERROR_SECTION_DESCRIPTOR *_ErrorRecordDescriptor; VOID *_ErrorRecord; + UINTN *_ErrorRecordStart; //For Generic Error Status Block EFI_ACPI_6_1_GENERIC_ERROR_STATUS_STRUCTURE *GenericErrorStatusBlock; EFI_ACPI_6_1_GENERIC_ERROR_DATA_ENTRY_STRUCTURE *GenericErrorDataEntry; GenericErrorStatusBlock = (EFI_ACPI_6_1_GENERIC_ERROR_STATUS_STRUCTURE *) - ErrorRecordAddress; + (ErrorRecordAddress + sizeof (UINTN)); GenericErrorDataEntry = (EFI_ACPI_6_1_GENERIC_ERROR_DATA_ENTRY_STRUCTURE *) (ErrorRecordAddress + - sizeof(EFI_ACPI_6_1_GENERIC_ERROR_STATUS_STRUCTURE)); + sizeof(EFI_ACPI_6_1_GENERIC_ERROR_STATUS_STRUCTURE) + + sizeof (UINTN)); CperAddress = ErrorRecordAddress + sizeof(EFI_ACPI_6_1_GENERIC_ERROR_STATUS_STRUCTURE) + - sizeof(EFI_ACPI_6_1_GENERIC_ERROR_DATA_ENTRY_STRUCTURE); + sizeof(EFI_ACPI_6_1_GENERIC_ERROR_DATA_ENTRY_STRUCTURE) + + sizeof (UINTN); + DEBUG ((DEBUG_INFO, "CperWrite - CperAddress@0x%x\n", CperAddress)); DEBUG ((DEBUG_INFO, "CperWrite - %d Section@%p, Length %d, SectionType@%p \n", SectionInfo->SectionCount, SectionInfo->Section, SectionInfo->DataLength, SectionInfo->SectionType)); - ErrorRecordHeader = (EFI_COMMON_ERROR_RECORD_HEADER *)CperAddress; - _ErrorRecordDescriptor = (EFI_ERROR_SECTION_DESCRIPTOR *) - (CperAddress + - sizeof(EFI_COMMON_ERROR_RECORD_HEADER)); - _ErrorRecord = (VOID *)_ErrorRecordDescriptor + - sizeof(EFI_ERROR_SECTION_DESCRIPTOR) * SectionInfo->SectionCount; + //ErrorRecordHeader = (EFI_COMMON_ERROR_RECORD_HEADER *)CperAddress; + //_ErrorRecordDescriptor = (EFI_ERROR_SECTION_DESCRIPTOR *) + // (CperAddress + + // sizeof(EFI_COMMON_ERROR_RECORD_HEADER)); + //_ErrorRecord = (VOID *)_ErrorRecordDescriptor + + // sizeof(EFI_ERROR_SECTION_DESCRIPTOR) * SectionInfo->SectionCount; + + _ErrorRecord = (VOID *) CperAddress; + _ErrorRecordStart = (UINTN *) ErrorRecordAddress; _ErrorSention = SectionInfo->Section; ErrorSention_end = _ErrorSention + SectionInfo->DataLength; //Init the Record Header - ErrorRecordHeader->SignatureStart = EFI_ERROR_RECORD_SIGNATURE_START; - ErrorRecordHeader->Revision = EFI_ERROR_RECORD_REVISION; - ErrorRecordHeader->SignatureEnd = EFI_ERROR_RECORD_SIGNATURE_END; + //ErrorRecordHeader->SignatureStart = EFI_ERROR_RECORD_SIGNATURE_START; + //ErrorRecordHeader->Revision = EFI_ERROR_RECORD_REVISION; + //ErrorRecordHeader->SignatureEnd = EFI_ERROR_RECORD_SIGNATURE_END; //TODO - ErrorRecordHeader->ValidationBits = 0; + //ErrorRecordHeader->ValidationBits = 0; //CopyGuid(&ErrorRecordHeader->PlatformID, ); //CopyGuid(&ErrorRecordHeader->PartitionID, ); //CopyGuid(&ErrorRecordHeader->CreatorID, ); - Status = GetTimestamp(&ErrorRecordHeader->TimeStamp); - if (EFI_ERROR(Status)) - return Status; + //Status = GetTimestamp(&ErrorRecordHeader->TimeStamp); + //if (EFI_ERROR(Status)) + //return Status; //TODO: How to get this? //Caller know this info, so can caller pass it to this function? @@ -321,17 +328,17 @@ CperWrite ( } //Init the Record Descriptor - _ErrorRecordDescriptor->SectionOffset = _ErrorSention - (VOID *)CperAddress; - _ErrorRecordDescriptor->SectionLength = _DataLength; - _ErrorRecordDescriptor->Revision = EFI_ERROR_SECTION_REVISION; - CopyGuid(&_ErrorRecordDescriptor->SectionType, _ErrorSentionType); + //_ErrorRecordDescriptor->SectionOffset = _ErrorSention - (VOID *)CperAddress; + //_ErrorRecordDescriptor->SectionLength = _DataLength; + //_ErrorRecordDescriptor->Revision = EFI_ERROR_SECTION_REVISION; + //CopyGuid(&_ErrorRecordDescriptor->SectionType, _ErrorSentionType); //TODO: Get this info from Cper data //_ErrorRecordDescriptor->SectionFlags = ; //_ErrorRecordDescriptor->Severity = ; //TODO: These fields must to be filled according to the Hardware. - _ErrorRecordDescriptor->SecValidMask = 0x0; + //_ErrorRecordDescriptor->SecValidMask = 0x0; //CopyGuid(_ErrorRecordDescriptor->FruId, ); //_ErrorRecordDescriptor->FruString = ; @@ -343,11 +350,11 @@ CperWrite ( //increace address of error record descriptor _ErrorSention += _DataLength; _ErrorRecord += _DataLength; - _ErrorRecordDescriptor += 1; + //_ErrorRecordDescriptor += 1; } - ErrorRecordHeader->SectionCount = j; - ErrorRecordHeader->RecordLength = _ErrorRecord - (VOID *)CperAddress; + //ErrorRecordHeader->SectionCount = j; + //ErrorRecordHeader->RecordLength = _ErrorRecord - (VOID *)CperAddress; //TODO: How to decide this info? //ErrorRecordHeader->ErrorSeverity = ; @@ -365,29 +372,33 @@ CperWrite ( GenericErrorStatusBlock->BlockStatus.ErrorDataEntryCount = 1; //TODO: what is the definition of "Raw Data" - GenericErrorStatusBlock->RawDataOffset = ErrorRecordHeader->RecordLength; + GenericErrorStatusBlock->RawDataOffset = 0; GenericErrorStatusBlock->RawDataLength = 0; - GenericErrorStatusBlock->DataLength = ErrorRecordHeader->RecordLength + + GenericErrorStatusBlock->DataLength = _DataLength + sizeof(EFI_ACPI_6_1_GENERIC_ERROR_DATA_ENTRY_STRUCTURE); //TODO: set this value according to the error blob above //GenericErrorStatusBlock->ErrorSeverity = ; //TODO: which SectionType we should use if we have multiple sections? //CopyGuid(GenericErrorDataEntry->SectionType, _ErrorSentionType); + CopyGuid((EFI_GUID *)GenericErrorDataEntry->SectionType, _ErrorSentionType); //TODO: what ErrorSeverity we should set? //GenericErrorDataEntry->ErrorSeverity = ; + GenericErrorDataEntry->ErrorSeverity = EFI_ACPI_6_1_ERROR_SEVERITY_CORRECTED; GenericErrorDataEntry->Revision = EFI_ACPI_6_1_GENERIC_ERROR_DATA_ENTRY_REVISION; //TODO: Get this info from Cper data //GenericErrorDataEntry->Flags = ; - GenericErrorDataEntry->ErrorDataLength = ErrorRecordHeader->RecordLength; + GenericErrorDataEntry->Flags = 0; + GenericErrorDataEntry->ErrorDataLength = _DataLength; - GenericErrorDataEntry->ValidationBits = 0x04; + GenericErrorDataEntry->ValidationBits = 0x03; //TODO: These fields must to be filled according to the Hardware. //CopyGuid(GenericErrorDataEntry->FruId, ); //GenericErrorDataEntry->FruText = ; Status = GetTimestamp((EFI_ERROR_TIME_STAMP *)GenericErrorDataEntry->Timestamp); + *_ErrorRecordStart = ErrorRecordAddress + sizeof (UINTN); return Status; } |