From nobody Sun May 5 03:13:56 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+79750+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+79750+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=arm.com ARC-Seal: i=1; a=rsa-sha256; t=1629784841; cv=none; d=zohomail.com; s=zohoarc; b=Yg/Y3CD+YVkggE+WOy+2mDGwE07Qh7wyLiP3Ehwe222ugQ1kMFFDzYvjcKGTZKQBcREscb21Ac53dETDS0YnDoIdPwmZRhH1oilkS8gQOLIb5vN5BMbbcnF6VhIXG8Z2VBOD+A7qEAV9LEIhCo+zpJDVXSXrsRdQ29Go1Qkj2Tc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1629784841; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=LnwKrr+HJkt2RNDkwz9Mq094EUzlQNpcRT+imqyX6UI=; b=GziwMZ/p0hxz18kmOKqx0WVd7Q9vj2X1Cpf3tgKpqzUq8zA60woUKOziK+CamiivQw3zSRYFjCzigAAwDDfDhNkyFhP0DP4l4bHUSJ6ssLSCAsQL7NhvXxPJ1RDGD/3BclZYXUada0XIWo2CTlIfOdFgn2yshsNtc5nMf25DhGU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+79750+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1629784841758175.22538943827522; Mon, 23 Aug 2021 23:00:41 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id vYPaYY1788612xXguTtHTofb; Mon, 23 Aug 2021 23:00:41 -0700 X-Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web10.35767.1629784840771448428 for ; Mon, 23 Aug 2021 23:00:40 -0700 X-Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 570AA1042; Mon, 23 Aug 2021 23:00:40 -0700 (PDT) X-Received: from usa.arm.com (a077433.blr.arm.com [10.162.46.10]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id DC5403F766; Mon, 23 Aug 2021 23:00:38 -0700 (PDT) From: "Omkar Anand Kulkarni" To: devel@edk2.groups.io Cc: Ard Biesheuvel , Sami Mujawar Subject: [edk2-devel] [edk2-platforms][PATCH v3 1/5] Platform/ARM: Add DMC-620 ECC error handling driver Date: Tue, 24 Aug 2021 11:30:23 +0530 Message-Id: <20210824060027.27246-2-omkar.kulkarni@arm.com> In-Reply-To: <20210824060027.27246-1-omkar.kulkarni@arm.com> References: <20210824060027.27246-1-omkar.kulkarni@arm.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,omkar.kulkarni@arm.com X-Gm-Message-State: J7Mc3sbmNocDBFSWhhzEqn8ox1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1629784841; bh=bKIlSDpIiHKwyAGq/sDXp376RpCiOHwNY/XswTyO5S4=; h=Cc:Date:From:Reply-To:Subject:To; b=EubSd0/uJ4bQ4xc6IOpEPeYlECiJrVLHXxtf1Yt07/+1nawfWa8Pkh+BavAzbSGDcjd gi0LpbdyNK+TwJKAUM83p7wNWc0FMvTc6csZW8I64J72NvYEgfSHFdHvN5se9WV7KTL/2 0aMwsYsQ1IExl8gQtUCZs71bTL6Qne8B+dg= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1629784843874100001 Content-Type: text/plain; charset="utf-8" DMC-620 memory controller improves system reliability by generating interrupts on detecting ECC errors on the data. Add a initial DMC-620 MM driver that implements a MMI handler for handling single-bit ECC error events originating from the DRAM. The driver implements the HEST error source descriptor protocol in order to publish the GHES error source descriptor for single-bit DRAM errors. The GHES error source descriptor that is published is of type 'memory error'. A GHES error source descriptor is published for each instances if the DMC-620 controller in the system. The driver registers a MMI handler for handling 1-bit DRAM ECC error events. The MMI handler, when invoked, reads the DMC-620 error record registers and populates the EFI_PLATFORM_MEMORY_ERROR_DATA type error section information structure with the corresponding information read from the error record registers. Co-authored-by: Thomas Abraham Signed-off-by: Omkar Anand Kulkarni --- Platform/ARM/Drivers/Dmc620Mm/Dmc620Mm.dec | 30 ++ Platform/ARM/Drivers/Dmc620Mm/Dmc620Mm.inf | 61 ++++ Platform/ARM/Drivers/Dmc620Mm/Dmc620Mm.h | 174 ++++++++++ Platform/ARM/Drivers/Dmc620Mm/Dmc620Mm.c | 362 ++++++++++++= ++++++++ Platform/ARM/Drivers/Dmc620Mm/Dmc620MmErrorSourceInfo.c | 194 +++++++++++ 5 files changed, 821 insertions(+) diff --git a/Platform/ARM/Drivers/Dmc620Mm/Dmc620Mm.dec b/Platform/ARM/Driv= ers/Dmc620Mm/Dmc620Mm.dec new file mode 100644 index 000000000000..8f3508574203 --- /dev/null +++ b/Platform/ARM/Drivers/Dmc620Mm/Dmc620Mm.dec @@ -0,0 +1,30 @@ +## @file +# DMC-620 MM driver specific declrations. +# +# This file defines GUIDs and declares PCD values for DMC-620 MM driver. +# +# Copyright (c) 2020 - 2021, ARM Limited. All rights reserved. +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +## + +[Defines] + DEC_SPECIFICATION =3D 0x0001001A + PACKAGE_NAME =3D Dmc620Mm + PACKAGE_GUID =3D 94110B10-8E72-42A0-8963-D2B57FCF0F38 + PACKAGE_VERSION =3D 0.1 + +[Guids] + gDmc620MmTokenSpaceGuid =3D {0xc305f72a, 0xd10d, 0x45e8, { 0x81, 0x78, 0= x51, 0x8b, 0x78, 0x62, 0x77, 0x79 } } + gArmDmcEventHandlerGuid =3D { 0x5ef0afd5, 0xe01a, 0x4c30, { 0x86, 0x19, = 0x45, 0x46, 0x26, 0x91, 0x80, 0x98 }} + +[PcdsFixedAtBuild.common] + gDmc620MmTokenSpaceGuid.PcdDmc620CorrectableErrorThreshold|10|UINT32|0x0= 0000004 + gDmc620MmTokenSpaceGuid.PcdDmc620CtrlSize|0x100000|UINT32|0x00000003 + gDmc620MmTokenSpaceGuid.PcdDmc620DramErrorSdeiEventBase|0|UINT32|0x00000= 006 + gDmc620MmTokenSpaceGuid.PcdDmc620DramOneBitErrorDataBase|0|UINT64|0x0000= 0007 + gDmc620MmTokenSpaceGuid.PcdDmc620DramOneBitErrorDataSize|0|UINT64|0x0000= 0008 + gDmc620MmTokenSpaceGuid.PcdDmc620DramOneBitErrorSourceId|0|UINT16|0x0000= 0009 + gDmc620MmTokenSpaceGuid.PcdDmc620ErrSourceCount|1|UINT32|0x00000005 + gDmc620MmTokenSpaceGuid.PcdDmc620NumCtrl|2|UINT32|0x00000001 + gDmc620MmTokenSpaceGuid.PcdDmc620RegisterBase|0x4E000000|UINT64|0x000000= 02 diff --git a/Platform/ARM/Drivers/Dmc620Mm/Dmc620Mm.inf b/Platform/ARM/Driv= ers/Dmc620Mm/Dmc620Mm.inf new file mode 100644 index 000000000000..8cad07749a23 --- /dev/null +++ b/Platform/ARM/Drivers/Dmc620Mm/Dmc620Mm.inf @@ -0,0 +1,61 @@ +## @file +# StandaloneMM driver for the DMC620 Memory Controller. +# +# Driver to handle 1-bit Corrected DRAM errors for DMC(s). +# +# Copyright (c) 2020 - 2021, ARM Limited. All rights reserved. +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +## + +[Defines] + INF_VERSION =3D 0x0001001A + BASE_NAME =3D StandaloneMmDmc620Driver + FILE_GUID =3D CB53ACD9-A1A1-43B3-A638-AC74DA5D9DA2 + MODULE_TYPE =3D MM_STANDALONE + VERSION_STRING =3D 1.0 + PI_SPECIFICATION_VERSION =3D 0x00010032 + ENTRY_POINT =3D Dmc620MmDriverInitialize + +[Sources] + Dmc620Mm.c + Dmc620MmErrorSourceInfo.c + +[Packages] + ArmPkg/ArmPkg.dec + ArmPlatformPkg/ArmPlatformPkg.dec + EmbeddedPkg/EmbeddedPkg.dec + MdeModulePkg/MdeModulePkg.dec + MdePkg/MdePkg.dec + Platform/ARM/Drivers/Dmc620Mm/Dmc620Mm.dec + StandaloneMmPkg/StandaloneMmPkg.dec + +[LibraryClasses] + ArmLib + ArmSvcLib + BaseMemoryLib + DebugLib + StandaloneMmDriverEntryPoint + +[Protocols] + gMmHestErrorSourceDescProtocolGuid ##PRODUCES + +[FixedPcd] + gArmPlatformTokenSpaceGuid.PcdGhesGenericErrorDataMmBufferBase + gArmPlatformTokenSpaceGuid.PcdGhesGenericErrorDataMmBufferSize + + gDmc620MmTokenSpaceGuid.PcdDmc620CorrectableErrorThreshold + gDmc620MmTokenSpaceGuid.PcdDmc620CtrlSize + gDmc620MmTokenSpaceGuid.PcdDmc620DramErrorSdeiEventBase + gDmc620MmTokenSpaceGuid.PcdDmc620DramOneBitErrorDataBase + gDmc620MmTokenSpaceGuid.PcdDmc620DramOneBitErrorDataSize + gDmc620MmTokenSpaceGuid.PcdDmc620DramOneBitErrorSourceId + gDmc620MmTokenSpaceGuid.PcdDmc620ErrSourceCount + gDmc620MmTokenSpaceGuid.PcdDmc620NumCtrl + gDmc620MmTokenSpaceGuid.PcdDmc620RegisterBase + +[Guids] + gArmDmcEventHandlerGuid + +[Depex] + TRUE diff --git a/Platform/ARM/Drivers/Dmc620Mm/Dmc620Mm.h b/Platform/ARM/Driver= s/Dmc620Mm/Dmc620Mm.h new file mode 100644 index 000000000000..f5c96396b870 --- /dev/null +++ b/Platform/ARM/Drivers/Dmc620Mm/Dmc620Mm.h @@ -0,0 +1,174 @@ +/** @file + DMC-620 memory controller MM driver definitions. + + Macros and structure definitions for DMC-620 error handling MM driver. + + Copyright (c) 2020 - 2021, ARM Limited. All rights reserved. + SPDX-License-Identifier: BSD-2-Clause-Patent +**/ + +#ifndef DMC620_MM_DRIVER_H_ +#define DMC620_MM_DRIVER_H_ + +#include +#include +#include +#include +#include +#include +#include +#include + +// DMC-620 memc register field values and masks. +#define DMC620_MEMC_STATUS_MASK (BIT2|BIT1|BIT0) +#define DMC620_MEMC_STATUS_READY (BIT1|BIT0) +#define DMC620_MEMC_CMD_EXECUTE_DRAIN (BIT2|BIT0) + +// DMC-620 Error Record Status register fields values and masks. +#define DMC620_ERR_STATUS_MV BIT26 +#define DMC620_ERR_STATUS_AV BIT31 + +// DMC-620 Error Record MISC-0 register fields values and masks. +#define DMC620_ERR_MISC0_COLUMN_MASK \ + (BIT9|BIT8|BIT7|BIT6|BIT5|BIT4|BIT3|BIT2|BIT1|BIT0) +#define DMC620_ERR_MISC0_ROW_MASK (0x0FFFFC00) +#define DMC620_ERR_MISC0_ROW_SHIFT 10 +#define DMC620_ERR_MISC0_RANK_MASK (BIT30|BIT29|BIT28) +#define DMC620_ERR_MISC0_RANK_SHIFT 28 +#define DMC620_ERR_MISC0_VAILD BIT31 + +// DMC-620 Error Record register fields values and mask. +#define DMC620_ERR_MISC1_VAILD BIT31 +#define DMC620_ERR_MISC1_BANK_MASK (BIT3|BIT2|BIT1|BIT0) + +// DMC-620 Error Record Global Status register bit field. +#define DMC620_ERR_GSR_ECC_CORRECTED_FH BIT1 + +// +// DMC-620 Memory Mapped register definitions. +// + +// Unused DMC-620 register fields. +#define RESV_0 0x1BD +#define RESV_1 0x2C +#define RESV_2 0x8 +#define RESV_3 0x58 + +#pragma pack(1) +typedef struct { + UINT32 MemcStatus; + UINT32 MemcConfig; + UINT32 MemcCmd; + UINT32 Reserved[RESV_0]; + UINT32 Err0Fr; + UINT32 Reserved1; + UINT32 Err0Ctlr0; + UINT32 Err0Ctlr1; + UINT32 Err0Status; + UINT8 Reserved2[RESV_1]; + UINT32 Err1Fr; + UINT32 Reserved3; + UINT32 Err1Ctlr; + UINT32 Reserved4; + UINT32 Err1Status; + UINT32 Reserved5; + UINT32 Err1Addr0; + UINT32 Err1Addr1; + UINT32 Err1Misc0; + UINT32 Err1Misc1; + UINT32 Err1Misc2; + UINT32 Err1Misc3; + UINT32 Err1Misc4; + UINT32 Err1Misc5; + UINT8 Reserved6[RESV_2]; + UINT32 Err2Fr; + UINT32 Reserved7; + UINT32 Err2Ctlr; + UINT32 Reserved8; + UINT32 Err2Status; + UINT32 Reserved9; + UINT32 Err2Addr0; + UINT32 Err2Addr1; + UINT32 Err2Misc0; + UINT32 Err2Misc1; + UINT32 Err2Misc2; + UINT32 Err2Misc3; + UINT32 Err2Misc4; + UINT32 Err2Misc5; + UINT8 Reserved10[RESV_2]; + UINT32 Reserved11[RESV_3]; + UINT32 Errgsr; +} DMC620_REGS_TYPE; + +// DMC-620 Typical Error Record register definition. +typedef struct { + UINT32 ErrFr; + UINT32 Reserved; + UINT32 ErrCtlr; + UINT32 Reserved1; + UINT32 ErrStatus; + UINT32 Reserved2; + UINT32 ErrAddr0; + UINT32 ErrAddr1; + UINT32 ErrMisc0; + UINT32 ErrMisc1; + UINT32 ErrMisc2; + UINT32 ErrMisc3; + UINT32 ErrMisc4; + UINT32 ErrMisc5; + UINT8 Reserved3[RESV_2]; +} DMC620_ERR_REGS_TYPE; +#pragma pack() + +// List of supported error sources by DMC-620. +typedef enum { + DramEccCfh =3D 0, + DramEccFh, + ChiFh, + SramEccCfh, + SramEccFh, + DmcErrRecovery +} DMC_ERR_SOURCES; + +/** + MMI handler implementing the HEST error source desc protocol. + + Returns the error source descriptor information for all DMC(s) error sou= rces + and also returns its count and length. + + @param[in] This Pointer for this protocol. + @param[out] Buffer HEST error source descriptor Information + buffer. + @param[out] ErrorSourcesLength Total length of Error Source Descriptor= s. + @param[out] ErrorSourceCount Total number of supported error sources. + + @retval EFI_SUCCESS Buffer has valid Error Source descriptor + information. + @retval EFI_INVALID_PARAMETER Buffer is NULL. +**/ +EFI_STATUS +EFIAPI +DmcErrorSourceDescInfoGet ( + IN MM_HEST_ERROR_SOURCE_DESC_PROTOCOL *This, + OUT VOID **Buffer, + OUT UINTN *ErrorSourcesLength, + OUT UINTN *ErrorSourcesCount + ); + +/** + Allow reporting of supported DMC-620 error sources. + + Install the HEST Error Source Descriptor protocol handler to allow publi= shing + of the supported DMC-620 memory controller error sources. + + @param[in] MmSystemTable Pointer to System table. + + @retval EFI_SUCCESS Protocol installation successful. + @retval EFI_INVALID_PARAMETER Invalid system table parameter. +**/ +EFI_STATUS +Dmc620InstallErrorSourceDescProtocol ( + IN EFI_MM_SYSTEM_TABLE *MmSystemTable + ); + +#endif // DMC620_MM_DRIVER_H_ diff --git a/Platform/ARM/Drivers/Dmc620Mm/Dmc620Mm.c b/Platform/ARM/Driver= s/Dmc620Mm/Dmc620Mm.c new file mode 100644 index 000000000000..91daf713f275 --- /dev/null +++ b/Platform/ARM/Drivers/Dmc620Mm/Dmc620Mm.c @@ -0,0 +1,362 @@ +/** @file + DMC-620 Memory Controller error handling (Standalone MM) driver. + + Supports 1-bit Bit DRAM error handling for multiple DMC instances. On a = error + event, publishes the CPER error record of Memory Error type. + + Copyright (c) 2020 - 2021, ARM Limited. All rights reserved. + SPDX-License-Identifier: BSD-2-Clause-Patent + + @par Specification Reference + - DMC620 Dynamic Memory Controller, revision r1p0. + - UEFI Reference Specification 2.8, Section N.2.5 Memory Error Section +**/ + +#include + +/** + Helper function to handle the DMC-620 DRAM errors. + + Reads the DRAM error record registers. Creates a CPER error record of ty= pe + 'Memory Error' and populates it with information collected from DRAM err= or + record registers. + + @param[in] DmcCtrl A pointer to DMC control registers. + @param[in] DmcInstance DMC instance which raised the fault e= vent. + @param[in] ErrRecType A type of the DMC error record. + @param[in] ErrorBlockBaseAddress Unique address for populating the err= or + block status for given DMC error sour= ce. +**/ +STATIC +VOID +Dmc620HandleDramError ( + IN DMC620_REGS_TYPE *DmcCtrl, + IN UINTN DmcInstance, + IN UINTN ErrRecType, + IN UINTN ErrorBlockBaseAddress + ) +{ + EFI_ACPI_6_3_GENERIC_ERROR_DATA_ENTRY_STRUCTURE *ErrBlockSectionDesc; + EFI_ACPI_6_3_GENERIC_ERROR_STATUS_STRUCTURE *ErrBlockStatusHeaderDat= a; + EFI_PLATFORM_MEMORY_ERROR_DATA MemorySectionInfo =3D {0= }; + DMC620_ERR_REGS_TYPE *ErrRecord; + EFI_GUID SectionType; + UINT32 ResetReg; + VOID *ErrBlockSectionData; + UINTN *ErrorStatusRegister; + UINTN *ReadAckRegister; + UINTN *ErrStatusBlock; + UINTN ErrStatus; + UINTN ErrAddr0; + UINTN ErrAddr1; + UINTN ErrMisc0; + UINTN ErrMisc1; + UINT8 CorrectedError; + + // + // Check the type of DRAM error (1-bit or 2-bit) and accordingly select + // error record to use. + // + if (ErrRecType =3D=3D DMC620_ERR_GSR_ECC_CORRECTED_FH) { + DEBUG (( + DEBUG_INFO, + "%a: DRAM ECC Corrected Fault (1-Bit ECC error)\n", + __FUNCTION__ + )); + ErrRecord =3D (DMC620_ERR_REGS_TYPE *)&DmcCtrl->Err1Fr; + CorrectedError =3D 1; + } else { + DEBUG (( + DEBUG_INFO, + "%a: DRAM ECC Fault Handling (2-bit ECC error)\n", + __FUNCTION__ + )); + ErrRecord =3D (DMC620_ERR_REGS_TYPE *)&DmcCtrl->Err2Fr; + CorrectedError =3D 0; + } + + // Read most recent DRAM error record registers. + ErrStatus =3D MmioRead32 ((UINTN)&ErrRecord->ErrStatus); + ErrAddr0 =3D MmioRead32 ((UINTN)&ErrRecord->ErrAddr0); + ErrAddr1 =3D MmioRead32 ((UINTN)&ErrRecord->ErrAddr1); + ErrMisc0 =3D MmioRead32 ((UINTN)&ErrRecord->ErrMisc0); + ErrMisc1 =3D MmioRead32 ((UINTN)&ErrRecord->ErrMisc1); + + // Clear the status register so that new error records are populated. + ResetReg =3D MmioRead32 ((UINTN)&ErrRecord->ErrStatus); + MmioWrite32 ((UINTN)&ErrRecord->ErrStatus, ResetReg); + + // + // Get Physical address of DRAM error from Error Record Address register + // and populate Memory Error Section. + // + if (ErrStatus & DMC620_ERR_STATUS_AV) { + DEBUG (( + DEBUG_INFO, + "%a: DRAM Error: Address_0 : 0x%x Address_1 : 0x%x\n", + __FUNCTION__, + ErrAddr0, + ErrAddr1 + )); + + // + // Populate Memory CPER section with DRAM error address (48 bits) and + // address mask fields. + // + MemorySectionInfo.ValidFields |=3D + EFI_PLATFORM_MEMORY_PHY_ADDRESS_MASK_VALID | + EFI_PLATFORM_MEMORY_PHY_ADDRESS_VALID; + MemorySectionInfo.PhysicalAddressMask =3D 0xFFFFFFFFFFFF; + MemorySectionInfo.PhysicalAddress =3D (ErrAddr1 << 32) | ErrAddr0; + } + + // + // Read the Error Record Misc registers and populate relevant fields in + // Memory CPER error section. + // + if ((ErrStatus & DMC620_ERR_STATUS_MV) + && (ErrMisc0 & DMC620_ERR_MISC0_VAILD)) + { + // Populate Memory error section wih DRAM column information. + MemorySectionInfo.ValidFields |=3D EFI_PLATFORM_MEMORY_COLUMN_VALID; + MemorySectionInfo.Column =3D ErrMisc0 & DMC620_ERR_MISC0_COLUMN_MASK; + + // + // Populate Memory Error Section with DRAM row information. + // Row bits (bit 16 and 17) are to be filled as extended. + // + MemorySectionInfo.ValidFields |=3D + EFI_PLATFORM_MEMORY_ERROR_EXTENDED_ROW_BIT_16_17_VALID; + MemorySectionInfo.Row =3D + (ErrMisc0 & DMC620_ERR_MISC0_ROW_MASK) >> DMC620_ERR_MISC0_ROW_SHIFT; + MemorySectionInfo.Extended =3D + ((ErrMisc0 & DMC620_ERR_MISC0_ROW_MASK) >> + (DMC620_ERR_MISC0_ROW_SHIFT + 16)); + + // Populate Memory Error Section wih DRAM rank information. + MemorySectionInfo.ValidFields |=3D EFI_PLATFORM_MEMORY_ERROR_RANK_NUM_= VALID; + MemorySectionInfo.RankNum =3D (ErrMisc0 & DMC620_ERR_MISC0_RANK_MASK) = >> + DMC620_ERR_MISC0_RANK_SHIFT; + } + + // Read Error Record MISC1 register and populate the Memory Error Sectio= n. + if ((ErrStatus & DMC620_ERR_STATUS_MV) + && (ErrMisc1 & DMC620_ERR_MISC1_VAILD)) + { + MemorySectionInfo.ValidFields |=3D EFI_PLATFORM_MEMORY_BANK_VALID; + MemorySectionInfo.Bank =3D (ErrMisc1 & DMC620_ERR_MISC1_BANK_MASK); + } + + // + // Misc registers 2..5 are not used and convey only the error counter + // information. They are cleared as they do not contribute in Error + // Record creation. + // + if (ErrStatus & DMC620_ERR_STATUS_MV) { + ResetReg =3D 0x0; + MmioWrite32 ((UINTN)&ErrRecord->ErrMisc2, ResetReg); + MmioWrite32 ((UINTN)&ErrRecord->ErrMisc3, ResetReg); + MmioWrite32 ((UINTN)&ErrRecord->ErrMisc4, ResetReg); + MmioWrite32 ((UINTN)&ErrRecord->ErrMisc5, ResetReg); + } + + // + // Reset error records Status register for recording new DRAM error synd= rome + // information. + // + ResetReg =3D MmioRead32 ((UINTN)&ErrRecord->ErrStatus); + MmioWrite32 ((UINTN)&ErrRecord->ErrStatus, ResetReg); + + // + // Allocate memory for Error Acknowledge register, Error Status register= and + // Error status block data. + // + ReadAckRegister =3D (UINTN *)ErrorBlockBaseAddress; + ErrorStatusRegister =3D (UINTN *)ErrorBlockBaseAddress + 1; + ErrStatusBlock =3D (UINTN *)ErrorStatusRegister + 1; + + // Initialize Error Status Register with Error Status Block address. + *ErrorStatusRegister =3D (UINTN)ErrStatusBlock; + + // + // Locate Block Status Header base address and populate it with Error St= atus + // Block Header information. + // + ErrBlockStatusHeaderData =3D (EFI_ACPI_6_3_GENERIC_ERROR_STATUS_STRUCTUR= E *) + ErrStatusBlock; + *ErrBlockStatusHeaderData =3D + (EFI_ACPI_6_3_GENERIC_ERROR_STATUS_STRUCTURE) { + .BlockStatus =3D { + .UncorrectableErrorValid =3D ((CorrectedError =3D=3D 0) ? 0 : = 1), + .CorrectableErrorValid =3D ((CorrectedError =3D=3D 1) ? 1 : = 0), + .MultipleUncorrectableErrors =3D 0x0, + .MultipleCorrectableErrors =3D 0x0, + .ErrorDataEntryCount =3D 0x1 + }, + .RawDataOffset =3D + (sizeof (EFI_ACPI_6_3_GENERIC_ERROR_STATUS_STRUCTURE) + + sizeof (EFI_ACPI_6_3_GENERIC_ERROR_DATA_ENTRY_STRUCTURE)), + .RawDataLength =3D 0, + .DataLength =3D + (sizeof (EFI_ACPI_6_3_GENERIC_ERROR_DATA_ENTRY_STRUCTURE) + + sizeof(EFI_PLATFORM_MEMORY_ERROR_DATA)), + .ErrorSeverity =3D ((CorrectedError =3D=3D 1) ? + EFI_ACPI_6_3_ERROR_SEVERITY_CORRECTED : + EFI_ACPI_6_3_ERROR_SEVERITY_FATAL), + }; + + // + // Locate Section Descriptor base address and populate Error Status Sect= ion + // Descriptor data. + // + ErrBlockSectionDesc =3D (EFI_ACPI_6_3_GENERIC_ERROR_DATA_ENTRY_STRUCTURE= *) + (ErrBlockStatusHeaderData + 1); + *ErrBlockSectionDesc =3D + (EFI_ACPI_6_3_GENERIC_ERROR_DATA_ENTRY_STRUCTURE) { + .ErrorSeverity =3D ((CorrectedError =3D=3D 1) ? + EFI_ACPI_6_3_ERROR_SEVERITY_CORRECTED : + EFI_ACPI_6_3_ERROR_SEVERITY_FATAL), + .Revision =3D EFI_ACPI_6_3_GENERIC_ERROR_DATA_ENTRY_REVISION, + .ValidationBits =3D 0, + .Flags =3D 0, + .ErrorDataLength =3D sizeof (EFI_PLATFORM_MEMORY_ERROR_DATA), + .FruId =3D {0}, + .FruText =3D {0}, + .Timestamp =3D {0}, + }; + SectionType =3D (EFI_GUID) EFI_ERROR_SECTION_PLATFORM_MEMORY_GUID; + CopyGuid ((EFI_GUID *)ErrBlockSectionDesc->SectionType, &SectionType); + + // Locate Section base address and populate Memory Error Section(Cper) d= ata. + ErrBlockSectionData =3D (VOID *)(ErrBlockSectionDesc + 1); + CopyMem ( + ErrBlockSectionData, + (VOID *)&MemorySectionInfo, + sizeof (EFI_PLATFORM_MEMORY_ERROR_DATA) + ); +} + +/** + DMC-620 1-bit ECC event handler. + + Supports multiple DMC error processing. Current implementation handles t= he + DRAM ECC errors. + + @param[in] DispatchHandle The unique handle assigned to this hand= ler by + MmiHandlerRegister(). + @param[in] Context Points to an optional handler context w= hich + was specified when the handler was + registered. + @param[in, out] CommBuffer Buffer passed from Non-MM to MM environ= mvent. + @param[in, out] CommBufferSize The size of the CommBuffer. + + @retval EFI_SUCCESS Event handler successful. + @retval Other Failure of event handler. +**/ +STATIC +EFI_STATUS +EFIAPI +Dmc620ErrorEventHandler ( + IN EFI_HANDLE DispatchHandle, + IN CONST VOID *Context, OPTIONAL + IN OUT VOID *CommBuffer, OPTIONAL + IN OUT UINTN *CommBufferSize OPTIONAL + ) +{ + DMC620_REGS_TYPE *DmcCtrl; + UINTN DmcIdx; + UINTN ErrGsr; + + // DMC instance which raised the error event. + DmcIdx =3D *(UINTN *)CommBuffer; + // Error Record Base address for that DMC instance. + DmcCtrl =3D (DMC620_REGS_TYPE *)(FixedPcdGet64 (PcdDmc620RegisterBase) + + (FixedPcdGet64 (PcdDmc620CtrlSize) * DmcIdx)); + + DEBUG (( + DEBUG_INFO, + "%a: DMC error event raised for DMC: %d with DmcBaseAddr: 0x%x \n", + __FUNCTION__, + DmcIdx, + (UINTN)DmcCtrl + )); + + ErrGsr =3D MmioRead32 ((UINTN)&DmcCtrl->Errgsr); + + if (ErrGsr & DMC620_ERR_GSR_ECC_CORRECTED_FH) { + // Handle corrected 1-bit DRAM ECC error. + Dmc620HandleDramError ( + DmcCtrl, + DmcIdx, + DMC620_ERR_GSR_ECC_CORRECTED_FH, + FixedPcdGet64 ( + PcdDmc620DramOneBitErrorDataBase) + + (FixedPcdGet64 (PcdDmc620DramOneBitErrorDataSize) * DmcIdx) + ); + } else { + DEBUG (( + DEBUG_ERROR, + "%a: Unsupported DMC-620 error reported, ignoring\n", + __FUNCTION__ + )); + } + + // No data to send using the MM communication buffer so clear the comm b= uffer + // size. + *CommBufferSize =3D 0; + + return EFI_SUCCESS; +} + +/** + Initialize function for the driver. + + Registers MMI handlers to process fault events on DMC and installs requi= red + protocols to publish the error source descriptors. + + @param[in] ImageHandle Handle to image. + @param[in] SystemTable Pointer to System table. + + @retval EFI_SUCCESS On successful installation of error event handler = for + DMC. + @retval Other Failure in installing error event handlers for DMC. +**/ +EFI_STATUS +EFIAPI +Dmc620MmDriverInitialize ( + IN EFI_HANDLE ImageHandle, + IN EFI_MM_SYSTEM_TABLE *SystemTable + ) +{ + EFI_MM_SYSTEM_TABLE *mMmst; + EFI_STATUS Status; + EFI_HANDLE DispatchHandle; + + ASSERT (SystemTable !=3D NULL); + mMmst =3D SystemTable; + + // Register MMI handlers for DMC-620 error events. + Status =3D mMmst->MmiHandlerRegister ( + Dmc620ErrorEventHandler, + &gArmDmcEventHandlerGuid, + &DispatchHandle + ); + if (EFI_ERROR(Status)) { + DEBUG (( + DEBUG_ERROR, + "%a: Registration failed for DMC error event handler, Status:%r\n", + __FUNCTION__, + Status + )); + + return Status; + } + + // Installs the HEST error source descriptor protocol. + Status =3D Dmc620InstallErrorSourceDescProtocol (SystemTable); + if (EFI_ERROR(Status)) { + mMmst->MmiHandlerUnRegister (DispatchHandle); + } + + return Status; +} diff --git a/Platform/ARM/Drivers/Dmc620Mm/Dmc620MmErrorSourceInfo.c b/Plat= form/ARM/Drivers/Dmc620Mm/Dmc620MmErrorSourceInfo.c new file mode 100644 index 000000000000..59dcff019a07 --- /dev/null +++ b/Platform/ARM/Drivers/Dmc620Mm/Dmc620MmErrorSourceInfo.c @@ -0,0 +1,194 @@ +/** @file + Create and populate DMC-620 HEST error source descriptors. + + Implements the HEST Error Source Descriptor protocol. Creates the GHESv2 + type error source descriptors for supported hardware errors. Appends + the created descriptors to the Buffer parameter of the protocol. + + Copyright (c) 2020 - 2021, ARM Limited. All rights reserved. + SPDX-License-Identifier: BSD-2-Clause-Patent + + @par Specification Reference: + - ACPI Reference Specification 6.3, Table 18-393 GHESv2 Structure. +**/ + +#include +#include + +/** + Populate the DMC-620 DRAM Error Source Descriptor. + + Creates error source descriptor of GHESv2 type to be appended to the Hest + table. The error source descriptor is populated with appropriate values + based on the instance number of DMC-620. Allocates and initializes memory + for Error Status Block(Cper) section for each error source. + + @param[in] ErrorDesc HEST error source descriptor Information. + @param[in] DmcIdx Instance number of the DMC-620. +**/ +STATIC +VOID +EFIAPI +Dmc620SetupDramErrorDescriptor ( + IN EFI_ACPI_6_3_GENERIC_HARDWARE_ERROR_SOURCE_VERSION_2_STRUCTURE *Erro= rDesc, + IN UINTN DmcIdx + ) +{ + UINTN ErrorBlockData; + + // + // Address of reserved memory for the error status block that will be us= ed + // to hold the information about the DRAM error. Initialize this memory + // with 0. + // + ErrorBlockData =3D FixedPcdGet64 (PcdDmc620DramOneBitErrorDataBase) + + (FixedPcdGet64 (PcdDmc620DramOneBitErrorDataSize) * + DmcIdx); + SetMem ( + (VOID *)ErrorBlockData, + FixedPcdGet64 (PcdDmc620DramOneBitErrorDataSize), + 0 + ); + + // Build the DRAM error source descriptor. + *ErrorDesc =3D + (EFI_ACPI_6_3_GENERIC_HARDWARE_ERROR_SOURCE_VERSION_2_STRUCTURE) { + .Type =3D EFI_ACPI_6_3_GENERIC_HARDWARE_ERROR_VERSION_2, + .SourceId =3D FixedPcdGet16 (PcdDmc620DramOneBitErrorSourceId) + Dmc= Idx, + .RelatedSourceId =3D 0xFFFF, + .Flags =3D 0, + .Enabled =3D 1, + .NumberOfRecordsToPreAllocate =3D 1, + .MaxSectionsPerRecord =3D 1, + .MaxRawDataLength =3D sizeof (EFI_PLATFORM_MEMORY_ERROR_DATA), + .ErrorStatusAddress =3D ARM_GAS64 (ErrorBlockData + 8), + .NotificationStructure =3D + EFI_ACPI_6_3_HARDWARE_ERROR_NOTIFICATION_STRUCTURE_INIT ( + EFI_ACPI_6_3_HARDWARE_ERROR_NOTIFICATION_SOFTWARE_DELEGATED_EXCE= PTION, + 0, + FixedPcdGet32 (PcdDmc620DramErrorSdeiEventBase) + DmcIdx + ), + .ErrorStatusBlockLength =3D + sizeof (EFI_ACPI_6_3_GENERIC_ERROR_STATUS_STRUCTURE) + + sizeof (EFI_ACPI_6_3_GENERIC_ERROR_DATA_ENTRY_STRUCTURE) + + sizeof (EFI_PLATFORM_MEMORY_ERROR_DATA), + .ReadAckRegister =3D ARM_GAS64 (ErrorBlockData), + .ReadAckPreserve =3D 0, + .ReadAckWrite =3D 0 + }; +} + +/** + MMI handler implementing the HEST error source descriptor protocol. + + Returns the error source descriptor information for all supported hardwa= re + error sources. As mentioned in the HEST Error Source Decriptor protocol = this + handler returns with error source count and length when Buffer parameter= is + NULL. + + @param[in] This Pointer for this protocol. + @param[out] Buffer HEST error source descriptor Information + buffer. + @param[out] ErrorSourcesLength Total length of Error Source Descriptors + @param[out] ErrorSourceCount Total number of supported error spurces. + + @retval EFI_SUCCESS Buffer has valid Error Source descriptor + information. + @retval EFI_INVALID_PARAMETER Buffer is NULL. +**/ +STATIC +EFI_STATUS +EFIAPI +Dmc620ErrorSourceDescInfoGet ( + IN MM_HEST_ERROR_SOURCE_DESC_PROTOCOL *This, + OUT VOID **Buffer, + OUT UINTN *ErrorSourcesLength, + OUT UINTN *ErrorSourcesCount + ) +{ + EFI_ACPI_6_3_GENERIC_HARDWARE_ERROR_SOURCE_VERSION_2_STRUCTURE *ErrorDes= criptor; + UINTN DmcIdx; + + // + // Update the error source length and error source count parameters. + // + *ErrorSourcesLength =3D + FixedPcdGet64 (PcdDmc620NumCtrl) * + FixedPcdGet64 (PcdDmc620ErrSourceCount) * + sizeof (EFI_ACPI_6_3_GENERIC_HARDWARE_ERROR_SOURCE_VERSION_2_STRUCTURE= ); + *ErrorSourcesCount =3D FixedPcdGet64 (PcdDmc620NumCtrl) * + FixedPcdGet64 (PcdDmc620ErrSourceCount); + + // + // If 'Buffer' is NULL return, as this invocation of the protocol handle= r is + // to determine the total size of all the error source descriptor instan= ces. + // + if (Buffer =3D=3D NULL) { + return EFI_INVALID_PARAMETER; + } + + // Buffer to be updated with error source descriptor(s) information. + ErrorDescriptor =3D + (EFI_ACPI_6_3_GENERIC_HARDWARE_ERROR_SOURCE_VERSION_2_STRUCTURE *)*Buf= fer; + + // + // Create and populate the available error source descriptor for all DMC= (s). + // + for (DmcIdx =3D 0; DmcIdx < FixedPcdGet64 (PcdDmc620NumCtrl); DmcIdx++) { + // Add the one-bit DRAM error source descriptor. + Dmc620SetupDramErrorDescriptor (ErrorDescriptor, DmcIdx); + ErrorDescriptor++; + } + + return EFI_SUCCESS; +} + +// +// DMC-620 MM_HEST_ERROR_SOURCE_DESC_PROTOCOL protocol instance. +// +STATIC MM_HEST_ERROR_SOURCE_DESC_PROTOCOL mDmc620ErrorSourceDesc =3D { + Dmc620ErrorSourceDescInfoGet +}; + +/** + Allow reporting of supported DMC-620 error sources. + + Install the HEST Error Source Descriptor protocol handler to allow publi= shing + of the supported Dmc(s) hardware error sources. + + @param[in] MmSystemTable Pointer to System table. + + @retval EFI_SUCCESS Protocol installation successful. + @retval EFI_INVALID_PARAMETER Invalid system table parameter. +**/ +EFI_STATUS +Dmc620InstallErrorSourceDescProtocol ( + IN EFI_MM_SYSTEM_TABLE *MmSystemTable + ) +{ + EFI_HANDLE mDmcHandle =3D NULL; + EFI_STATUS Status; + + // Check if the MmSystemTable is initialized. + if (MmSystemTable =3D=3D NULL) { + return EFI_INVALID_PARAMETER; + } + + // Install HEST error source descriptor protocol for DMC(s). + Status =3D MmSystemTable->MmInstallProtocolInterface ( + &mDmcHandle, + &gMmHestErrorSourceDescProtocolGuid, + EFI_NATIVE_INTERFACE, + &mDmc620ErrorSourceDesc + ); + if (EFI_ERROR(Status)) { + DEBUG (( + DEBUG_ERROR, + "%a: Failed installing HEST error source protocol, status: %r\n", + __FUNCTION__, + Status + )); + } + + return Status; +} --=20 2.17.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#79750): https://edk2.groups.io/g/devel/message/79750 Mute This Topic: https://groups.io/mt/85104845/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Sun May 5 03:13:56 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+79751+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+79751+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=arm.com ARC-Seal: i=1; a=rsa-sha256; t=1629784843; cv=none; d=zohomail.com; s=zohoarc; b=XKJXMnoTndQBgwt+fXxGI/bNKs2t5vmqoRw0/dbK8A4GYsR06bMnJSUxgWM1Du77/w7dUyHsM37F802ed+OmvxCuDsIIKePI0h+lihQ7LHpJ3Jy9TN+jg0AxQ3N1Pq3ZTOrYjpMub6TJMLkU6fpX6cvaoOSRfTBDFIdrRGoZcEg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1629784843; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=ZimC2GE8jisuhCCX/9t9y+k/zOIiv6MiLoOlp3u3Eu0=; b=fNOsZWIKqyO5TQvX2aCeDtTq77Et9UWKkPHd5ssjYb8gRyokSp75XTBTH5r+47jEI2GLd2bR6jPLgK0cCHKrF87dlewFuaAW1dnbsEj0fsAX+kZDy+7XDsg6SASj/8LAYb1SyR1+2B8zsIlCI71Bl+UpJriRoxKRhrYPXQwUdrg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+79751+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1629784843351373.9910908169711; Mon, 23 Aug 2021 23:00:43 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id 4yYRYY1788612xQRveriwRZY; Mon, 23 Aug 2021 23:00:43 -0700 X-Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web08.35410.1629784842437506351 for ; Mon, 23 Aug 2021 23:00:42 -0700 X-Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 07A501042; Mon, 23 Aug 2021 23:00:42 -0700 (PDT) X-Received: from usa.arm.com (a077433.blr.arm.com [10.162.46.10]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id C91F33F766; Mon, 23 Aug 2021 23:00:40 -0700 (PDT) From: "Omkar Anand Kulkarni" To: devel@edk2.groups.io Cc: Ard Biesheuvel , Sami Mujawar Subject: [edk2-devel] [edk2-platforms][PATCH v3 2/5] Platform/Sgi: dmc-620 firmware-first error handling Date: Tue, 24 Aug 2021 11:30:24 +0530 Message-Id: <20210824060027.27246-3-omkar.kulkarni@arm.com> In-Reply-To: <20210824060027.27246-1-omkar.kulkarni@arm.com> References: <20210824060027.27246-1-omkar.kulkarni@arm.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,omkar.kulkarni@arm.com X-Gm-Message-State: iNty7KL8atqhNJC30PT2qD8Yx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1629784843; bh=0yWzaICEdgZtiij5qzj7GDEQGIMrkvZMvOHJsl78TFI=; h=Cc:Date:From:Reply-To:Subject:To; b=Er4WpQKkhw9FsbmZ7G25wt+u1UhEEaFIbnkb2PwzokceIwIilvOvLSFWRPZxH3tklTr FCUwfVcoQmMYcc7G8McZKkG8YId4PNRL9dcTSekjmVkn+j+A8B6p1d11UtRGgayDGggzA ZwrMwx/NSpwG+frm1FPqXvAgEchQ9VwA7jE= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1629784844148100005 Content-Type: text/plain; charset="utf-8" Enable the use of HEST table generation protocol, GHES error source descriptor protocol and DMC-620 MM driver on ARM Neoverse Reference Design platforms. This allows firmware-first error handling and reporting of DMC-620 memory controller's 1-bit DRAM ECC errors. Co-authored-by: Thomas Abraham Signed-off-by: Omkar Anand Kulkarni Reviewed-by: Sami Mujawar --- Platform/ARM/SgiPkg/SgiPlatform.dsc.inc | 17 +++++++++++ Platform/ARM/SgiPkg/SgiPlatformMm.dsc.inc | 30 ++++++++++++++++++++ Platform/ARM/SgiPkg/PlatformStandaloneMm.fdf | 6 ++++ Platform/ARM/SgiPkg/SgiPlatform.fdf | 6 ++++ 4 files changed, 59 insertions(+) diff --git a/Platform/ARM/SgiPkg/SgiPlatform.dsc.inc b/Platform/ARM/SgiPkg/= SgiPlatform.dsc.inc index 7e37732fb93c..bb32584de63d 100644 --- a/Platform/ARM/SgiPkg/SgiPlatform.dsc.inc +++ b/Platform/ARM/SgiPkg/SgiPlatform.dsc.inc @@ -21,6 +21,9 @@ DEFINE LPI_EN =3D FALSE DEFINE CPPC_EN =3D FALSE =20 + # To allow firmware first error handling, set this to TRUE. + DEFINE ENABLE_GHES_MM =3D FALSE + [BuildOptions] *_*_*_CC_FLAGS =3D -D DISABLE_NEW_DEPRECATED_INTERFACES =20 @@ -208,6 +211,12 @@ gArmTokenSpaceGuid.PcdMmBufferBase|0xFF600000 gArmTokenSpaceGuid.PcdMmBufferSize|0x10000 =20 +!if $(ENABLE_GHES_MM) =3D=3D TRUE + ## GHESv2 Generic Error memory space + gArmPlatformTokenSpaceGuid.PcdGhesGenericErrorDataMmBufferBase|0xFF610000 + gArmPlatformTokenSpaceGuid.PcdGhesGenericErrorDataMmBufferSize|0x20000 +!endif + ##########################################################################= ###### # # Components Section - list of all EDK II Modules needed by this Platform @@ -365,3 +374,11 @@ !else ArmPkg/Drivers/MmCommunicationDxe/MmCommunication.inf !endif + + # + # GHESv2 HEST error sources support + # + MdeModulePkg/Universal/Apei/HestDxe/HestDxe.inf +!if $(ENABLE_GHES_MM) =3D=3D TRUE + ArmPlatformPkg/Drivers/HestMmErrorSources/HestErrorSourceDxe.inf +!endif diff --git a/Platform/ARM/SgiPkg/SgiPlatformMm.dsc.inc b/Platform/ARM/SgiPk= g/SgiPlatformMm.dsc.inc index 5287e1f8e568..dbba82c74f39 100644 --- a/Platform/ARM/SgiPkg/SgiPlatformMm.dsc.inc +++ b/Platform/ARM/SgiPkg/SgiPlatformMm.dsc.inc @@ -11,6 +11,10 @@ # Library Class section - list of all Library Classes needed by this Platf= orm. # ##########################################################################= ###### +[Defines] + # To enable DMC-620 MM driver, set this to TRUE. + DEFINE ENABLE_DMC620_MM =3D FALSE + [LibraryClasses] # # Basic @@ -94,6 +98,25 @@ gEfiSecurityPkgTokenSpaceGuid.PcdUserPhysicalPresence|TRUE !endif =20 +!if $(ENABLE_GHES_MM) =3D=3D TRUE + ## GHESv2 Generic Error Memory Space + gArmPlatformTokenSpaceGuid.PcdGhesGenericErrorDataMmBufferBase|0xFF610000 + gArmPlatformTokenSpaceGuid.PcdGhesGenericErrorDataMmBufferSize|0x20000 +!endif + +!if $(ENABLE_DMC620_MM) =3D=3D TRUE + ## DMC620 + gDmc620MmTokenSpaceGuid.PcdDmc620NumCtrl|2 + gDmc620MmTokenSpaceGuid.PcdDmc620RegisterBase|0x4E000000 + gDmc620MmTokenSpaceGuid.PcdDmc620CtrlSize|0x100000 + gDmc620MmTokenSpaceGuid.PcdDmc620CorrectableErrorThreshold|10 + gDmc620MmTokenSpaceGuid.PcdDmc620ErrSourceCount|1 + gDmc620MmTokenSpaceGuid.PcdDmc620DramErrorSdeiEventBase|804 + gDmc620MmTokenSpaceGuid.PcdDmc620DramOneBitErrorDataBase|0xFF610000 + gDmc620MmTokenSpaceGuid.PcdDmc620DramOneBitErrorDataSize|0x100 + gDmc620MmTokenSpaceGuid.PcdDmc620DramOneBitErrorSourceId|0 +!endif + ##########################################################################= ######################### # # Components Section - list of the modules and components that will be pro= cessed by compilation @@ -134,6 +157,13 @@ } !endif =20 +!if $(ENABLE_GHES_MM) =3D=3D TRUE + ArmPlatformPkg/Drivers/HestMmErrorSources/HestErrorSourceStandaloneMm.inf +!endif +!if $(ENABLE_DMC620_MM) =3D=3D TRUE + Platform/ARM/Drivers/Dmc620Mm/Dmc620Mm.inf +!endif + ##########################################################################= ######################### # # BuildOptions Section - Define the module specific tool chain flags that = should be used as diff --git a/Platform/ARM/SgiPkg/PlatformStandaloneMm.fdf b/Platform/ARM/Sg= iPkg/PlatformStandaloneMm.fdf index c1c24b747fa5..e029b9164570 100644 --- a/Platform/ARM/SgiPkg/PlatformStandaloneMm.fdf +++ b/Platform/ARM/SgiPkg/PlatformStandaloneMm.fdf @@ -48,6 +48,12 @@ READ_STATUS =3D TRUE READ_LOCK_CAP =3D TRUE READ_LOCK_STATUS =3D TRUE =20 +!if $(ENABLE_GHES_MM) =3D=3D TRUE + INF ArmPlatformPkg/Drivers/HestMmErrorSources/HestErrorSourceStandaloneM= m.inf +!endif +!if $(ENABLE_DMC620_MM) =3D=3D TRUE + INF Platform/ARM/Drivers/Dmc620Mm/Dmc620Mm.inf +!endif INF StandaloneMmPkg/Core/StandaloneMmCore.inf !if $(SECURE_STORAGE_ENABLE) =3D=3D TRUE INF ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashStandaloneMm.inf diff --git a/Platform/ARM/SgiPkg/SgiPlatform.fdf b/Platform/ARM/SgiPkg/SgiP= latform.fdf index 8227ae03330c..d6e942e19b81 100644 --- a/Platform/ARM/SgiPkg/SgiPlatform.fdf +++ b/Platform/ARM/SgiPkg/SgiPlatform.fdf @@ -179,6 +179,12 @@ READ_LOCK_STATUS =3D TRUE # MM Communicate INF ArmPkg/Drivers/MmCommunicationDxe/MmCommunication.inf =20 + # Hest Error Source Support + INF MdeModulePkg/Universal/Apei/HestDxe/HestDxe.inf +!if $(ENABLE_GHES_MM) =3D=3D TRUE + INF ArmPlatformPkg/Drivers/HestMmErrorSources/HestErrorSourceDxe.inf +!endif + # # Platform driver # --=20 2.17.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#79751): https://edk2.groups.io/g/devel/message/79751 Mute This Topic: https://groups.io/mt/85104847/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Sun May 5 03:13:56 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+79752+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+79752+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=arm.com ARC-Seal: i=1; a=rsa-sha256; t=1629784845; cv=none; d=zohomail.com; s=zohoarc; b=CIO+E8gc8UWmDUggh1WVzXbs+S1ESShehcAGlAPZilC2dkfS1wh5lEnMVc5byZ5jy24HKV70NJKC5FUMKTata3dYb1pJnT06lfnSVjzAryvV5yiML/Goe074eOA369ghPELXcAnKGYEPw5JWHB1vWkcK107iLziu8ZdKzhoDpqo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1629784845; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=6b0OMGT6E5LRS4ZgaeVLB5wIcbYflerFUFhOLWzLyvk=; b=emYsjgvUvHqtfJ9a2A4RsGGyBHeIz43lQe7HQFnS6WU64PoxokSCH4BSluZ+Uq3CmeVIGic6te00zKVzIZi44Av2oY7KPK/Fek25RSvN3Y82rwIAEN+lSFgHpXm8R2WMwFVbxTFSaJeOLBTA53selzX1ayhg3x1P9WA0V88FVck= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+79752+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1629784845082924.7885171407843; Mon, 23 Aug 2021 23:00:45 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id JomPYY1788612xeZjqaGqcZp; Mon, 23 Aug 2021 23:00:44 -0700 X-Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web08.35411.1629784844086923301 for ; Mon, 23 Aug 2021 23:00:44 -0700 X-Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id AC92813A1; Mon, 23 Aug 2021 23:00:43 -0700 (PDT) X-Received: from usa.arm.com (a077433.blr.arm.com [10.162.46.10]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 7960D3F766; Mon, 23 Aug 2021 23:00:42 -0700 (PDT) From: "Omkar Anand Kulkarni" To: devel@edk2.groups.io Cc: Ard Biesheuvel , Sami Mujawar Subject: [edk2-devel] [edk2-platforms][PATCH v3 3/5] Platform/Sgi: define memory region for GHES error status block Date: Tue, 24 Aug 2021 11:30:25 +0530 Message-Id: <20210824060027.27246-4-omkar.kulkarni@arm.com> In-Reply-To: <20210824060027.27246-1-omkar.kulkarni@arm.com> References: <20210824060027.27246-1-omkar.kulkarni@arm.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,omkar.kulkarni@arm.com X-Gm-Message-State: dN6apeOyk7rPNjTX6xPWpj5Xx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1629784844; bh=AAtbNA4O2PjmeovRX6pfFBqwK1GUm3gwX/zaMmYollw=; h=Cc:Date:From:Reply-To:Subject:To; b=jGZKyegQLfZndZlHadUFzmzFyr3+wW7Fvgrj9C+N2g5T4GbxtdVIRA8BlefqskpVwQ0 S3/Plyi426AGzVRBe56Gb7/r9T3dlM7y+JGE8lEJgWPcoBlqmPBTi24cZmF20BsgDMUFd WDXrt3sqTzfosHXMi0V+cLbXkqtPVCNPUfA= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1629784846466100001 Content-Type: text/plain; charset="utf-8" Allow platforms to define the base address and size of the memory region that is reserved for MM drivers to populate the GHES generic error status block with information about the platform error. Co-authored-by: Thomas Abraham Signed-off-by: Omkar Anand Kulkarni Reviewed-by: Sami Mujawar --- Platform/ARM/SgiPkg/SgiPlatform.dec | 1 + Platform/ARM/SgiPkg/SgiPlatform.dsc.inc | 4 ++++ Platform/ARM/SgiPkg/Library/PlatformLib/PlatformLib.inf | 6 ++++++ Platform/ARM/SgiPkg/Library/PlatformLib/PlatformLibMem.c | 13 +++++++++++-- 4 files changed, 22 insertions(+), 2 deletions(-) diff --git a/Platform/ARM/SgiPkg/SgiPlatform.dec b/Platform/ARM/SgiPkg/SgiP= latform.dec index 8cd818a9bf64..e46fa5d9a1d5 100644 --- a/Platform/ARM/SgiPkg/SgiPlatform.dec +++ b/Platform/ARM/SgiPkg/SgiPlatform.dec @@ -31,6 +31,7 @@ [PcdsFeatureFlag.common] gArmSgiTokenSpaceGuid.PcdVirtioBlkSupported|FALSE|BOOLEAN|0x00000001 gArmSgiTokenSpaceGuid.PcdVirtioNetSupported|FALSE|BOOLEAN|0x00000010 + gArmSgiTokenSpaceGuid.PcdGhesMmSupported|FALSE|BOOLEAN|0x00000027 =20 [PcdsFixedAtBuild] gArmSgiTokenSpaceGuid.PcdDramBlock2Base|0|UINT64|0x00000002 diff --git a/Platform/ARM/SgiPkg/SgiPlatform.dsc.inc b/Platform/ARM/SgiPkg/= SgiPlatform.dsc.inc index bb32584de63d..5307280ef9a3 100644 --- a/Platform/ARM/SgiPkg/SgiPlatform.dsc.inc +++ b/Platform/ARM/SgiPkg/SgiPlatform.dsc.inc @@ -107,6 +107,10 @@ gArmSgiTokenSpaceGuid.PcdVirtioNetSupported|TRUE gEfiMdeModulePkgTokenSpaceGuid.PcdEnableVariableRuntimeCache|FALSE =20 +!if $(ENABLE_GHES_MM) =3D=3D TRUE + gArmSgiTokenSpaceGuid.PcdGhesMmSupported|TRUE +!endif + [PcdsFixedAtBuild.common] gArmTokenSpaceGuid.PcdVFPEnabled|1 gEfiMdeModulePkgTokenSpaceGuid.PcdMaxVariableSize|0x2000 diff --git a/Platform/ARM/SgiPkg/Library/PlatformLib/PlatformLib.inf b/Plat= form/ARM/SgiPkg/Library/PlatformLib/PlatformLib.inf index 22e247ea4fae..8cc362ea194f 100644 --- a/Platform/ARM/SgiPkg/Library/PlatformLib/PlatformLib.inf +++ b/Platform/ARM/SgiPkg/Library/PlatformLib/PlatformLib.inf @@ -79,10 +79,16 @@ gArmSgiTokenSpaceGuid.PcdWdogBase gArmSgiTokenSpaceGuid.PcdWdogSize =20 + gArmPlatformTokenSpaceGuid.PcdGhesGenericErrorDataMmBufferBase + gArmPlatformTokenSpaceGuid.PcdGhesGenericErrorDataMmBufferSize + gEfiMdePkgTokenSpaceGuid.PcdPciExpressBaseAddress gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableBase64 gEfiMdeModulePkgTokenSpaceGuid.PcdSerialRegisterBase =20 +[FeaturePcd] + gArmSgiTokenSpaceGuid.PcdGhesMmSupported + [Guids] gArmSgiPlatformIdDescriptorGuid gEfiHobListGuid ## CONSUMES ## SystemTable diff --git a/Platform/ARM/SgiPkg/Library/PlatformLib/PlatformLibMem.c b/Pla= tform/ARM/SgiPkg/Library/PlatformLib/PlatformLibMem.c index 8139b75d8ee4..fd4a90bbc0ef 100644 --- a/Platform/ARM/SgiPkg/Library/PlatformLib/PlatformLibMem.c +++ b/Platform/ARM/SgiPkg/Library/PlatformLib/PlatformLibMem.c @@ -1,6 +1,6 @@ /** @file * -* Copyright (c) 2018-2020, ARM Limited. All rights reserved. +* Copyright (c) 2018-2021, ARM Limited. All rights reserved. * * SPDX-License-Identifier: BSD-2-Clause-Patent * @@ -17,7 +17,8 @@ =20 // Total number of descriptors, including the final "end-of-table" descrip= tor. #define MAX_VIRTUAL_MEMORY_MAP_DESCRIPTORS \ - (14 + (FixedPcdGet32 (PcdChipCount) * 2)) + (14 + (FixedPcdGet32 (PcdChipCount) * 2)) + \ + (FeaturePcdGet (PcdGhesMmSupported)) =20 /** Returns the Virtual Memory Map of the platform. @@ -239,6 +240,14 @@ ArmPlatformGetVirtualMemoryMap ( VirtualMemoryTable[Index].Length =3D PcdGet64 (PcdMmBufferSize); VirtualMemoryTable[Index].Attributes =3D ARM_MEMORY_REGION_ATTRIBUT= E_UNCACHED_UNBUFFERED; =20 + if (FeaturePcdGet (PcdGhesMmSupported)) { + // GHESv2 Generic Error Memory Space + VirtualMemoryTable[++Index].PhysicalBase =3D PcdGet64 (PcdGhesGeneric= ErrorDataMmBufferBase); + VirtualMemoryTable[Index].VirtualBase =3D PcdGet64 (PcdGhesGeneric= ErrorDataMmBufferBase); + VirtualMemoryTable[Index].Length =3D PcdGet64 (PcdGhesGeneric= ErrorDataMmBufferSize); + VirtualMemoryTable[Index].Attributes =3D ARM_MEMORY_REGION_ATTRIB= UTE_DEVICE; + } + // End of Table VirtualMemoryTable[++Index].PhysicalBase =3D 0; VirtualMemoryTable[Index].VirtualBase =3D 0; --=20 2.17.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#79752): https://edk2.groups.io/g/devel/message/79752 Mute This Topic: https://groups.io/mt/85104849/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Sun May 5 03:13:56 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+79753+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+79753+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=arm.com ARC-Seal: i=1; a=rsa-sha256; t=1629784846; cv=none; d=zohomail.com; s=zohoarc; b=RT2jotfzVLlw4L/EuFaqhAlk8W37lF5wBHKSzYQkCB96Yz3SPcm1KkkfrzeEl0h/5tpM09s0cz3umu7s0/KQBrJbRGU/Dj+MgqIJvQR+FgpG1xklMARH6Ccr08S00KQbXP+HdUVXE6s7ps3M729oMu332nSVqmQjRyrAC3Y3e20= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1629784846; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=g4No+pdameBNHNcXVxGfGbC6ai8QPr2eFRlNu1MlVjY=; b=HCn1Ktw4BbqVqoZGqlMgc0oRSa3mOdCwJUXToJESmRfaY8OWx1g7SgZVVEeBvyHD33MM76uW4zMsH/lgulBf+X7IttZBv7clX13WCADkCXEltdhWxd2AZno/lOZdzPXHvNBPd6SWQiAIxkdgNG43yWu/1ii9njYHoMvZdxsgs5A= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+79753+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1629784846594306.031720721625; Mon, 23 Aug 2021 23:00:46 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id LZxgYY1788612xjHLd76rjQh; Mon, 23 Aug 2021 23:00:46 -0700 X-Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web11.35778.1629784845802157561 for ; Mon, 23 Aug 2021 23:00:45 -0700 X-Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 67B651042; Mon, 23 Aug 2021 23:00:45 -0700 (PDT) X-Received: from usa.arm.com (a077433.blr.arm.com [10.162.46.10]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 2A0473F766; Mon, 23 Aug 2021 23:00:43 -0700 (PDT) From: "Omkar Anand Kulkarni" To: devel@edk2.groups.io Cc: Ard Biesheuvel , Sami Mujawar Subject: [edk2-devel] [edk2-platforms][PATCH v3 4/5] Platform/Sgi: Define values for ACPI table header Date: Tue, 24 Aug 2021 11:30:26 +0530 Message-Id: <20210824060027.27246-5-omkar.kulkarni@arm.com> In-Reply-To: <20210824060027.27246-1-omkar.kulkarni@arm.com> References: <20210824060027.27246-1-omkar.kulkarni@arm.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,omkar.kulkarni@arm.com X-Gm-Message-State: RetwiE87WZMIHyIlKMhxUiTXx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1629784846; bh=PGWhzI6qFSVrhRtHK93Zj1/iypIs9/z7cWEuhysrJnA=; h=Cc:Date:From:Reply-To:Subject:To; b=tJ+RZOh52k6doUdtK7gzITzY5JR3gG73Vbt6XwHLcJQhvUJCVwNhSk8OTnBGnEk1OpN fnkzw5kof9vQ6rb/dbapzjSj5hjh8rQp7iIXEiygmVxkY1y6ZLyZta7ZJsRIscXleE2Xx nARVkS2BK6HpXriAW9ghU0gtaRHPPo2gq7k= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1629784848526100005 Content-Type: text/plain; charset="utf-8" For ACPI tables that are generated dynamically, define the ACPI table header values that have to be used to build the table header. Co-authored-by: Thomas Abraham Signed-off-by: Omkar Anand Kulkarni Reviewed-by: Sami Mujawar --- Platform/ARM/SgiPkg/SgiPlatform.dsc.inc | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Platform/ARM/SgiPkg/SgiPlatform.dsc.inc b/Platform/ARM/SgiPkg/= SgiPlatform.dsc.inc index 5307280ef9a3..102d7926bde1 100644 --- a/Platform/ARM/SgiPkg/SgiPlatform.dsc.inc +++ b/Platform/ARM/SgiPkg/SgiPlatform.dsc.inc @@ -221,6 +221,13 @@ gArmPlatformTokenSpaceGuid.PcdGhesGenericErrorDataMmBufferSize|0x20000 !endif =20 + # ACPI Table Header IDs + gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiDefaultOemId|"ARMLTD" + gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiDefaultOemTableId|0x4152464e494645= 52 # REFINFRA + gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiDefaultOemRevision|0x20200831 + gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiDefaultCreatorId|0x204d5241 # ARM + gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiDefaultCreatorRevision|1 + ##########################################################################= ###### # # Components Section - list of all EDK II Modules needed by this Platform --=20 2.17.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#79753): https://edk2.groups.io/g/devel/message/79753 Mute This Topic: https://groups.io/mt/85104851/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Sun May 5 03:13:56 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+79754+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+79754+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=arm.com ARC-Seal: i=1; a=rsa-sha256; t=1629784848; cv=none; d=zohomail.com; s=zohoarc; b=EwyJ98FhUWgARR16Csr1lSd720FIudray+czS0vCaF6176oVbIwZ1wnDd8lKej/45p961201bvrFgWrcbJ4eOI4plJOfxeAQ8XM6sP8UC5PVJ81G99gbCB4Ag37LwMN0+AUSaPgP6ACpT75Lo/Vruq4tAH+95nN5UEnxmlAZWeM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1629784848; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=TTckP+pdOKryoO5XAuZWEmRF0++TsqNBJrO+2el9/a4=; b=RqjYS7Q2PstptMSU2/sdhjkNLlJ7hlgVYZW4FPhequFo0HQM4oqvpS9+mp84ct9s4NHBea27GqfL2NFk7t4VUSfDeqOS9KLhrKN7LRB5BCPmZDdpLHyRTc2zHF2z0gYGWM9iSF/4aw6j+u7ASmx9uuDt33PfRiHnOJV/KEuL1KA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+79754+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1629784848477501.16426552833275; Mon, 23 Aug 2021 23:00:48 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id WNCYYY1788612x69MBygwaIq; Mon, 23 Aug 2021 23:00:48 -0700 X-Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web10.35768.1629784847461016943 for ; Mon, 23 Aug 2021 23:00:47 -0700 X-Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 1955E1042; Mon, 23 Aug 2021 23:00:47 -0700 (PDT) X-Received: from usa.arm.com (a077433.blr.arm.com [10.162.46.10]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id D98A93F766; Mon, 23 Aug 2021 23:00:45 -0700 (PDT) From: "Omkar Anand Kulkarni" To: devel@edk2.groups.io Cc: Ard Biesheuvel , Sami Mujawar Subject: [edk2-devel] [edk2-platforms][PATCH v3 5/5] Platform/Sgi: Add platform error handling driver Date: Tue, 24 Aug 2021 11:30:27 +0530 Message-Id: <20210824060027.27246-6-omkar.kulkarni@arm.com> In-Reply-To: <20210824060027.27246-1-omkar.kulkarni@arm.com> References: <20210824060027.27246-1-omkar.kulkarni@arm.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,omkar.kulkarni@arm.com X-Gm-Message-State: 7Qdwa0FxaWKn9UqHyVQn25jox1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1629784848; bh=zbMZDd+YMfmGh+c+k1rBqVFs4HVq/q8TQ2GRdnwAbl8=; h=Cc:Date:From:Reply-To:Subject:To; b=PBYuZbyFgxKT7mIB6hu2w7BBPZciZQEA64t9eWiOE0weIu0URrTwqeIn6xcL3Qt3HDu VIvNAznabSuUmwtIxcRfVIdumJV7R4Ah3ULeDf5T2Y8G9ImD+Ln6fTvshXG+C6u00lBMj cdy1BzCP1pHBuvKIzDO/YZ1Ayb8Eg2wMvoc= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1629784848915100010 Content-Type: text/plain; charset="utf-8" Enables firmware first error handling on the given platform. Installs and publishes the SDEI and HEST ACPI tables required for firmware first error handling. Signed-off-by: Omkar Anand Kulkarni --- Platform/ARM/SgiPkg/SgiPlatform.dsc.inc = | 10 ++ Platform/ARM/SgiPkg/SgiPlatform.fdf = | 7 + Platform/ARM/SgiPkg/Drivers/PlatformErrorHandlerDxe/PlatformErrorHandlerDx= e.inf | 51 ++++++ Platform/ARM/SgiPkg/Drivers/PlatformErrorHandlerDxe/PlatformErrorHandlerDx= e.c | 171 ++++++++++++++++++++ 4 files changed, 239 insertions(+) diff --git a/Platform/ARM/SgiPkg/SgiPlatform.dsc.inc b/Platform/ARM/SgiPkg/= SgiPlatform.dsc.inc index 102d7926bde1..20f003b96cdb 100644 --- a/Platform/ARM/SgiPkg/SgiPlatform.dsc.inc +++ b/Platform/ARM/SgiPkg/SgiPlatform.dsc.inc @@ -24,6 +24,9 @@ # To allow firmware first error handling, set this to TRUE. DEFINE ENABLE_GHES_MM =3D FALSE =20 + # To allow firmware first error handling, set this to TRUE. + DEFINE ENABLE_FIRWARE_FIRST =3D FALSE + [BuildOptions] *_*_*_CC_FLAGS =3D -D DISABLE_NEW_DEPRECATED_INTERFACES =20 @@ -326,6 +329,13 @@ # Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.inf =20 + # + # platform error handler driver + # +!if $(ENABLE_FIRMWARE_FIRST) =3D=3D TRUE + Platform/ARM/SgiPkg/Drivers/PlatformErrorHandlerDxe/PlatformErrorHandler= Dxe.inf +!endif + # # FAT filesystem + GPT/MBR partitioning # diff --git a/Platform/ARM/SgiPkg/SgiPlatform.fdf b/Platform/ARM/SgiPkg/SgiP= latform.fdf index d6e942e19b81..b1d088610c4c 100644 --- a/Platform/ARM/SgiPkg/SgiPlatform.fdf +++ b/Platform/ARM/SgiPkg/SgiPlatform.fdf @@ -190,6 +190,13 @@ READ_LOCK_STATUS =3D TRUE # INF Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.inf =20 + # + # platform error handler driver + # +!if $(ENABLE_FIRMWARE_FIRST) =3D=3D TRUE + INF Platform/ARM/SgiPkg/Drivers/PlatformErrorHandlerDxe/PlatformErrorHan= dlerDxe.inf +!endif + # # Bds # diff --git a/Platform/ARM/SgiPkg/Drivers/PlatformErrorHandlerDxe/PlatformEr= rorHandlerDxe.inf b/Platform/ARM/SgiPkg/Drivers/PlatformErrorHandlerDxe/Pla= tformErrorHandlerDxe.inf new file mode 100644 index 000000000000..fe9ed4175b0b --- /dev/null +++ b/Platform/ARM/SgiPkg/Drivers/PlatformErrorHandlerDxe/PlatformErrorHand= lerDxe.inf @@ -0,0 +1,51 @@ +## @file +# Dxe driver to handle platform errors. +# +# This driver installs SDEI and HEST ACPI tables required for firmware fi= rst +# error handling. +# +# Copyright (c) 2020 - 2021, ARM Limited. All rights reserved. +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +## + +[Defines] + INF_VERSION =3D 0x0001001A + BASE_NAME =3D PlatformErrorHandlerDxe + FILE_GUID =3D a3187ea4-feb4-415f-b11e-2312623ffa6f + MODULE_TYPE =3D DXE_DRIVER + VERSION_STRING =3D 1.0 + ENTRY_POINT =3D PlatformErrorHandlerEntryPoint + +[Sources.common] + PlatformErrorHandlerDxe.c + +[Packages] + ArmPlatformPkg/ArmPlatformPkg.dec + EmbeddedPkg/EmbeddedPkg.dec + MdeModulePkg/MdeModulePkg.dec + MdePkg/MdePkg.dec + Platform/ARM/SgiPkg/SgiPlatform.dec + +[LibraryClasses] + AcpiLib + BaseLib + DebugLib + UefiDriverEntryPoint + +[Guids] + gArmSgiAcpiTablesGuid + +[Protocols] + gEfiAcpiTableProtocolGuid ## PROTOCOL ALWAYS_CONSUMED + gHestTableProtocolGuid ## PROTOCOL ALWAYS_CONSUMED + +[FixedPcd] + gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiDefaultCreatorId + gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiDefaultCreatorRevision + gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiDefaultOemId + gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiDefaultOemRevision + gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiDefaultOemTableId + +[Depex] + AFTER gArmPlatformHestErrorSourcesGuid diff --git a/Platform/ARM/SgiPkg/Drivers/PlatformErrorHandlerDxe/PlatformEr= rorHandlerDxe.c b/Platform/ARM/SgiPkg/Drivers/PlatformErrorHandlerDxe/Platf= ormErrorHandlerDxe.c new file mode 100644 index 000000000000..25b29152f1bb --- /dev/null +++ b/Platform/ARM/SgiPkg/Drivers/PlatformErrorHandlerDxe/PlatformErrorHand= lerDxe.c @@ -0,0 +1,171 @@ +/** @file + Driver to handle and support all platform errors. + + Installs the SDEI and HEST ACPI tables for firmware first error handling. + + Copyright (c) 2020 - 2021, ARM Limited. All rights reserved. + SPDX-License-Identifier: BSD-2-Clause-Patent + + @par Specification Reference: + - ACPI 6.3, Table 18-382, Hardware Error Source Table + - SDEI Platform Design Document, revision b, 10 Appendix C, ACPI table + definitions for SDEI +**/ + +#include + +#include +#include +#include +#include + +#include +#include + + +/** + Build and install the SDEI ACPI table. + + For platforms that allow firmware-first platform error handling, SDEI is= used + as the notification mechanism for those errors. + + @retval EFI_SUCCESS SDEI table installed successfully. + @retval Other For any error during installation. +**/ +STATIC +EFI_STATUS +InstallSdeiTable (VOID) +{ + EFI_ACPI_TABLE_PROTOCOL *mAcpiTableProtocol =3D NULL; + EFI_ACPI_DESCRIPTION_HEADER Header; + EFI_STATUS Status; + UINTN AcpiTableHandle; + + Header =3D + (EFI_ACPI_DESCRIPTION_HEADER) { + EFI_ACPI_6_3_SOFTWARE_DELEGATED_EXCEPTIONS_INTERFACE_TABLE_SIGNATURE, + sizeof (EFI_ACPI_DESCRIPTION_HEADER), // Length + 0x01, // Revision + 0x00, // Checksum + {'A', 'R', 'M', 'L', 'T', 'D'}, // OemId + 0x4152464e49464552, // OemTableId:"REFINFRA" + 0x20201027, // OemRevision + 0x204d5241, // CreatorId:"ARM " + 0x00000001, // CreatorRevision + }; + + Header.Checksum =3D CalculateCheckSum8 ((UINT8 *)&Header, Header.Length); + Status =3D gBS->LocateProtocol ( + &gEfiAcpiTableProtocolGuid, + NULL, + (VOID **)&mAcpiTableProtocol + ); + if (EFI_ERROR (Status)) { + DEBUG (( + DEBUG_ERROR, + "%a: Failed to locate ACPI table protocol, status: %r\n", + __FUNCTION__, + Status + )); + return Status; + } + + Status =3D mAcpiTableProtocol->InstallAcpiTable ( + mAcpiTableProtocol, + &Header, + Header.Length, + &AcpiTableHandle + ); + if (EFI_ERROR (Status)) { + DEBUG (( + DEBUG_ERROR, + "%a: Failed to install SDEI ACPI table, status: %r\n", + __FUNCTION__, + Status + )); + } + + return Status; +} + +/** + Install the HEST ACPI table. + + HEST ACPI table is used to list the platform errors for which the error + handling has been supported. Use the HEST table generation protocol to + install the HEST table. + + @retval EFI_SUCCESS HEST table installed successfully. + @retval Other For any error during installation. +**/ +STATIC +EFI_STATUS +InstallHestTable (VOID) +{ + HEST_TABLE_PROTOCOL *HestProtocol; + EFI_STATUS Status; + + Status =3D gBS->LocateProtocol ( + &gHestTableProtocolGuid, + NULL, + (VOID **)&HestProtocol + ); + if (EFI_ERROR (Status)) { + DEBUG (( + DEBUG_ERROR, + "%a: Failed to locate HEST DXE Protocol, status: %r\n", + __FUNCTION__, + Status + )); + return Status; + } + + Status =3D HestProtocol->InstallHestTable (); + if (EFI_ERROR (Status)) { + DEBUG (( + DEBUG_ERROR, + "%a: Failed to install HEST table, status: %r\n", + __FUNCTION__, + Status + )); + } + + return Status; +} + +/** + Entry point for the DXE driver. + + This function installs the HEST ACPI table, using the HEST table generat= ion + protocol. Also creates and installs the SDEI ACPI table required for fir= mware + first error handling. + + @param[in] ImageHandle Handle to the EFI image. + @param[in] SystemTable A pointer to the EFI System Table. + + @retval EFI_SUCCESS On successful installation of ACPI tables + @retval Other On Failure +**/ +EFI_STATUS +EFIAPI +PlatformErrorHandlerEntryPoint ( + IN EFI_HANDLE ImageHandle, + IN EFI_SYSTEM_TABLE *SystemTable + ) +{ + EFI_STATUS Status; + + // Build and install SDEI table. + Status =3D InstallSdeiTable (); + if (EFI_ERROR (Status)) { + return Status; + } + + // Install the created HEST table. + Status =3D InstallHestTable (); + if (EFI_ERROR (Status)) { + return Status; + } + + return EFI_SUCCESS; +} --=20 2.17.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#79754): https://edk2.groups.io/g/devel/message/79754 Mute This Topic: https://groups.io/mt/85104852/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-