From nobody Sun May 5 08:54:08 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+77670+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+77670+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=arm.com ARC-Seal: i=1; a=rsa-sha256; t=1625934286; cv=none; d=zohomail.com; s=zohoarc; b=DQpBzdgH7yGKJaKiIMsYqExMjIw9Y6aEttDlk2Wo+ofoaVPARKRaKats8BoVpct6lOv2zTNl/RlNkKQ4YCzMi6ZdMVafQNjBfy2NxVtgLEXBMAOiCN3U8A0ze8prhX8UoeAaeWVX1PiW1DK3PpQ8CEA/CbMEtyB5sqhpe6974Y8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1625934286; 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=arY2Agjc+t4e2ugjk7Ao43r8b7/TCJnJt6mzGvr97Lo=; b=BQKXa69j/JxBZc6FWueDFcztoUYANx15KxgxdTHgfEi881ckMkJY2HgyKmjaei+Nicwy2VnJJ1+eyL8BoTfrtuFod55aFmzK7ba5mUQt7V9EcSQUW3IID14B8Srlt9GU2dhmZt1QZJp5Nt3bJrjATLmIZbr0VYyimUTYCRDLbrU= 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+77670+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 1625934286580592.3314880890556; Sat, 10 Jul 2021 09:24:46 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id r2P8YY1788612xRKUStBoPru; Sat, 10 Jul 2021 09:24:46 -0700 X-Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web08.26028.1625934280298779104 for ; Sat, 10 Jul 2021 09:24: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 D4CEA1063; Sat, 10 Jul 2021 09:24:39 -0700 (PDT) X-Received: from usa.arm.com (a077433.blr.arm.com [10.162.4.33]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 6E0733F5A1; Sat, 10 Jul 2021 09:24:38 -0700 (PDT) From: "Omkar Anand Kulkarni" To: devel@edk2.groups.io Cc: Ard Biesheuvel , Sami Mujawar Subject: [edk2-devel] [edk2-platforms][PATCH v2 1/5] Platform/ARM: Add DMC-620 ECC error handling driver Date: Sat, 10 Jul 2021 21:54:26 +0530 Message-Id: <20210710162430.31691-2-omkar.kulkarni@arm.com> In-Reply-To: <20210710162430.31691-1-omkar.kulkarni@arm.com> References: <20210710162430.31691-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: 2BIPMBMcHtV4VhKyr06PH26sx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1625934286; bh=LrPjAAeChF/hqPYO72z0N2PkI4TkKpBZ4N491xHKhl4=; h=Cc:Date:From:Reply-To:Subject:To; b=PixGHFD5lIRaw835pGNaU+qFmLC9zr9Z8hxs3tdMXtmt6QNNlEasDWiIpo6OwkpSL9n xK3r5nr3/2FtawTuYwmsG+wLgsxtjf9ip88/g4/BP/vAtq9AZ5yxauqqCCuWrATe/R1As HybyXl8cqvpJTKoFucdDEE8wDHs5Y3LtFLk= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1625934287709100015 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 | 60 ++++ Platform/ARM/Drivers/Dmc620Mm/Dmc620Mm.h | 175 ++++++++++ Platform/ARM/Drivers/Dmc620Mm/Dmc620Mm.c | 360 ++++++++++++= ++++++++ Platform/ARM/Drivers/Dmc620Mm/Dmc620MmErrorSourceInfo.c | 198 +++++++++++ 5 files changed, 823 insertions(+) diff --git a/Platform/ARM/Drivers/Dmc620Mm/Dmc620Mm.dec b/Platform/ARM/Driv= ers/Dmc620Mm/Dmc620Mm.dec new file mode 100644 index 000000000000..b111ae59322c --- /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.PcdDmc620NumCtrl|2|UINT32|0x00000001 + gDmc620MmTokenSpaceGuid.PcdDmc620RegisterBase|0x4E000000|UINT64|0x000000= 02 + gDmc620MmTokenSpaceGuid.PcdDmc620CtrlSize|0x100000|UINT32|0x00000003 + gDmc620MmTokenSpaceGuid.PcdDmc620CorrectableErrorThreshold|10|UINT32|0x0= 0000004 + gDmc620MmTokenSpaceGuid.PcdDmc620ErrSourceCount|1|UINT32|0x00000005 + gDmc620MmTokenSpaceGuid.PcdDmc620DramErrorSdeiEventBase|0|UINT32|0x00000= 006 + gDmc620MmTokenSpaceGuid.PcdDmc620DramOneBitErrorDataBase|0|UINT64|0x0000= 0007 + gDmc620MmTokenSpaceGuid.PcdDmc620DramOneBitErrorDataSize|0|UINT64|0x0000= 0008 + gDmc620MmTokenSpaceGuid.PcdDmc620DramOneBitErrorSourceId|0|UINT16|0x0000= 0009 diff --git a/Platform/ARM/Drivers/Dmc620Mm/Dmc620Mm.inf b/Platform/ARM/Driv= ers/Dmc620Mm/Dmc620Mm.inf new file mode 100644 index 000000000000..3f470d466725 --- /dev/null +++ b/Platform/ARM/Drivers/Dmc620Mm/Dmc620Mm.inf @@ -0,0 +1,60 @@ +## @file +# StandaloneMM driver for the DMC620 Memory Controller. +# +# Driver to handle 1-bit Corrected DRAM errors for DMC(s). +# +# Copyright (c) 2020, 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 + MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec + Platform/ARM/Drivers/Dmc620Mm/Dmc620Mm.dec + StandaloneMmPkg/StandaloneMmPkg.dec + +[LibraryClasses] + StandaloneMmDriverEntryPoint + DebugLib + ArmSvcLib + ArmLib + BaseMemoryLib + +[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..c114b1b24c4e --- /dev/null +++ b/Platform/ARM/Drivers/Dmc620Mm/Dmc620Mm.h @@ -0,0 +1,175 @@ +/** @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..dfc06ca61f96 --- /dev/null +++ b/Platform/ARM/Drivers/Dmc620Mm/Dmc620Mm.c @@ -0,0 +1,360 @@ +/** @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_STRUCTU= RE) + + sizeof(EFI_ACPI_6_3_GENERIC_ERROR_DATA_ENTRY_STRUCT= URE)), + .RawDataLength =3D 0, + .DataLength =3D (sizeof(EFI_ACPI_6_3_GENERIC_ERROR_DATA_ENTRY_STRUCT= URE) + + 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..f5ee62beed67 --- /dev/null +++ b/Platform/ARM/Drivers/Dmc620Mm/Dmc620MmErrorSourceInfo.c @@ -0,0 +1,198 @@ +/** @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 + EFI_ACPI_6_3_GENERIC_ERROR_STATUS_STRUCTURE_INIT ( + (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 + EFI_ACPI_6_3_GENERIC_ERROR_STATUS_STRUCTURE_INIT (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 (#77670): https://edk2.groups.io/g/devel/message/77670 Mute This Topic: https://groups.io/mt/84115313/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 08:54:08 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+77671+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+77671+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=arm.com ARC-Seal: i=1; a=rsa-sha256; t=1625934282; cv=none; d=zohomail.com; s=zohoarc; b=kEqPbVehMyFus3NxHyEU4EQhE94Fe0XLc6CQ3j3M7B6itwPcdUI10iqdPiVBG8+IaaZSpisrFjGN14XpSj4ni+x2P2vJElB6nBX0/UYfeRD4bYMhQnjDhLfz1m+B0BBwkKzKJfYQu6vK3PJT6aEyPGahXvu6kJf8pe1Nnn99Q8k= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1625934282; 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=BkpXDdzbwssbgFK2tBKV3SxbKa2eXl7cvnZyRzzxKyk=; b=QclhRqUEe1uPniQO8LFEeDiWF5df5yFUF9NQKj28BZGSx8Vd5/+Q/6ZNlpz00Via2DURZV+xOnpu1+4+0A6o1wlE2BL9JV4+sc8g4VQ+Gy/HmeCReuyRsRY0N4pgM8LgFNdVpRJCwdeTOYL16wbrbiTFa/wpAsgLgeA38auMZHc= 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+77671+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 1625934282924955.721290469424; Sat, 10 Jul 2021 09:24:42 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id 3t6pYY1788612xSbhsvcvlS0; Sat, 10 Jul 2021 09:24:42 -0700 X-Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web12.25910.1625934281925652193 for ; Sat, 10 Jul 2021 09:24: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 7C57C31B; Sat, 10 Jul 2021 09:24:41 -0700 (PDT) X-Received: from usa.arm.com (a077433.blr.arm.com [10.162.4.33]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 4EFAA3F5A1; Sat, 10 Jul 2021 09:24:40 -0700 (PDT) From: "Omkar Anand Kulkarni" To: devel@edk2.groups.io Cc: Ard Biesheuvel , Sami Mujawar Subject: [edk2-devel] [edk2-platforms][PATCH v2 2/5] Platform/Sgi: dmc-620 firmware-first error handling Date: Sat, 10 Jul 2021 21:54:27 +0530 Message-Id: <20210710162430.31691-3-omkar.kulkarni@arm.com> In-Reply-To: <20210710162430.31691-1-omkar.kulkarni@arm.com> References: <20210710162430.31691-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: 7oHN7qva5rZoQPf9IDAzclvPx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1625934282; bh=cLAuze5obJZr9dO9vRPcF8rsDtgn+zUaj61yTzToCsc=; h=Cc:Date:From:Reply-To:Subject:To; b=G+m1BXISQlQ8h0U44FL5QPtAOWSxIPQQvLGYAAs+BNHRo3gDORNZjhjdLnAVHloibLM ZWx9n1pALK+Iut2hu7zxzbAR22VvXnfzybZjjdrKEPtWjr4zXujrQ9ab9Rlk0mZKKToBi pfRViFXD6sbqZfZV13LCWrGwQvBUaPxbJF8= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1625934283445100003 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 --- 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..1eb80c29ca3b 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 + # + ArmPlatformPkg/Drivers/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 2b461d5afbcb..c3a240ac8ee1 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 474c9c0ce764..3a97871815ef 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..a7100743bbc4 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 ArmPlatformPkg/Drivers/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 (#77671): https://edk2.groups.io/g/devel/message/77671 Mute This Topic: https://groups.io/mt/84115314/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 08:54:08 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+77672+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+77672+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=arm.com ARC-Seal: i=1; a=rsa-sha256; t=1625934289; cv=none; d=zohomail.com; s=zohoarc; b=j+E0wT7HCO2Yijb72P70R6gUQppSm2fo1/qWntgqMSIlUQC384m1e/rZe04lFIzDm/dzIkRA9Q9xsuKM6cm7UwgoUvtCjCJPBqQK/4O+S9/RAsJLlWIR2Jf0kAAqcWCAUkjDlO8NFKQWddjdTYvTZF9Qt8pBPIzL4xn85By/Brc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1625934289; 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=hjrH+rzSHS1GmQIrZrwqX+ObPSmMyMHK78YLokWlHU8=; b=a/IcpgVPfYc2FCclQ7XnUZa8UPIkoFqUjMGIMSN5fyNzYaEcYfkxwcsHZMExU0aq+MtRnyJDiBUto683o/sKssGAHrGbstXEeQI8cnxWDGlZU8izH+jmptaaR1Uh3SLOao2PLeDrlpnZVlucBNfkQa8sOb/KLR2GfuNPrULO+18= 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+77672+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 1625934289483619.2935690396769; Sat, 10 Jul 2021 09:24:49 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id uIkhYY1788612xklvbg0RWwk; Sat, 10 Jul 2021 09:24:49 -0700 X-Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web08.26029.1625934283581523227 for ; Sat, 10 Jul 2021 09:24:43 -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 2351731B; Sat, 10 Jul 2021 09:24:43 -0700 (PDT) X-Received: from usa.arm.com (a077433.blr.arm.com [10.162.4.33]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id EA6FA3F5A1; Sat, 10 Jul 2021 09:24:41 -0700 (PDT) From: "Omkar Anand Kulkarni" To: devel@edk2.groups.io Cc: Ard Biesheuvel , Sami Mujawar Subject: [edk2-devel] [edk2-platforms][PATCH v2 3/5] Platform/Sgi: define memory region for GHES error status block Date: Sat, 10 Jul 2021 21:54:28 +0530 Message-Id: <20210710162430.31691-4-omkar.kulkarni@arm.com> In-Reply-To: <20210710162430.31691-1-omkar.kulkarni@arm.com> References: <20210710162430.31691-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: hzaVXRRdlb09wxYIwY1DRLnCx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1625934289; bh=uBNUE2GxK9pZG3McZVnbMRwiLlSzlGwoY/6pSst50WU=; h=Cc:Date:From:Reply-To:Subject:To; b=Iwsy3yLyOlxaJI6gYB4+OrlOsA0bsknsg0X1H86IovbqXE2aUm+6Ck13zgCR98a82MJ rxb5KNw84h+q8UlIrm3uee2eotqog+NNPkd714QmOAAOEp75Pgk0ouNm2IWd/PzRKqCC0 FpLaivSv3eLv8e5XK75S1ryUeq05mz2lt28= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1625934289768100020 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 --- 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..84c0d963586e 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|0x00000021 =20 [PcdsFixedAtBuild] gArmSgiTokenSpaceGuid.PcdDramBlock2Base|0|UINT64|0x00000002 diff --git a/Platform/ARM/SgiPkg/SgiPlatform.dsc.inc b/Platform/ARM/SgiPkg/= SgiPlatform.dsc.inc index 1eb80c29ca3b..5c8fb482f89d 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 (#77672): https://edk2.groups.io/g/devel/message/77672 Mute This Topic: https://groups.io/mt/84115316/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 08:54:08 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+77673+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+77673+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=arm.com ARC-Seal: i=1; a=rsa-sha256; t=1625934286; cv=none; d=zohomail.com; s=zohoarc; b=Bpyh9d6jt1RrVNqzPVVEAAw3rim6SzvPjocbXS2TIxgDhDg4gHatevQcsJpLwfc2EH7F0bzO0zn09We3Sx/r2Vrxb1uMeMEUNkqJRGI32JEjp2dolGAje3pQEcSCQIoJO8IsWwkBnq1Y91pYomcqkFbnR1oKTbl2ESGwM1x7zvs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1625934286; 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=6uyBoawTkLJ5aCHDqyz5ZDZIbdjvoIyCjPpGZ/mjjhg=; b=XtMnzfwpcDMIQSoLXt+cnmhNjjqWKGWYMs0gWToDnjapVrhJlc+SCDgI34hW3pRn2AV3rb3j9rwV6c6eMyULTA2mUNdZ5Zk1jj4LfD4eQqTAVq973ApQozjXNi0t6OicwoD4pVXJ4T9s4+IbX3rTAtY0Tl2cDY16mlPZj7MTkgw= 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+77673+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 1625934286190133.16010040771027; Sat, 10 Jul 2021 09:24:46 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id cG7cYY1788612xd921qtLzCu; Sat, 10 Jul 2021 09:24:45 -0700 X-Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web12.25913.1625934285208664968 for ; Sat, 10 Jul 2021 09:24: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 C79371063; Sat, 10 Jul 2021 09:24:44 -0700 (PDT) X-Received: from usa.arm.com (a077433.blr.arm.com [10.162.4.33]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 9127F3F5A1; Sat, 10 Jul 2021 09:24:43 -0700 (PDT) From: "Omkar Anand Kulkarni" To: devel@edk2.groups.io Cc: Ard Biesheuvel , Sami Mujawar Subject: [edk2-devel] [edk2-platforms][PATCH v2 4/5] Platform/Sgi: Define values for ACPI table header Date: Sat, 10 Jul 2021 21:54:29 +0530 Message-Id: <20210710162430.31691-5-omkar.kulkarni@arm.com> In-Reply-To: <20210710162430.31691-1-omkar.kulkarni@arm.com> References: <20210710162430.31691-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: llWTvxtYxy1XGdA9Z9ulSVlvx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1625934285; bh=EDJcRGpQcSpR5I4dcCXAdljFTxEF7N4KfeT9PGQZkqY=; h=Cc:Date:From:Reply-To:Subject:To; b=OqZIJFF91eWJuH/ilp7DDgxBSgwg7vwYldCAaOlKIoEGU7rTcBe4K/EE3e3qds2akZu l85maPE/0fZAGEx9qfh5WkKogqBraWzHG6hEPDOPBnna5jqYB1bRjHY0ogLbcL1BxE6qJ Ek2Du73RRmshKEP3j6OXX4R5xPezUhJHvfs= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1625934287580100011 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 --- 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 5c8fb482f89d..87803c4e5785 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 (#77673): https://edk2.groups.io/g/devel/message/77673 Mute This Topic: https://groups.io/mt/84115317/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 08:54:08 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+77674+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+77674+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=arm.com ARC-Seal: i=1; a=rsa-sha256; t=1625934292; cv=none; d=zohomail.com; s=zohoarc; b=epiyqb27+hTujXBk08Cl1b0yiEHwTGYHiwNVon3uY+oGDe1Gv5DIaIc7/Q5QOudr3m60o2R3z6ssuWsjBoC44FGObyLqpdXOVXZMdr3nE0LBccyWEMppZnVB55HtRKIN4ddgo6MtXi8ohP+/TpD1N2kBUYa6HEPO10zpElJf0Go= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1625934292; 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=4Q1ucLe73FPBhq5HZnll+fnIV7cWH0vvxeqO3wT7q+c=; b=AFJ05kKIg/j+NvNH1YrtPTQ6hpva99VUFIxHsceJE9z4mEPIN28KA4flatO2hPXIUEwC7/MRWTGMsTjTt03V43EiPE0yfhnTV8QpNwuAYBesogqR5Zs/VZ6uyvnxsyxxtXm0H+FSj0V86o1JgCi4PODq7mgPTr0hR9ojRW3oZz8= 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+77674+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 1625934292871350.9783711957315; Sat, 10 Jul 2021 09:24:52 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id 00OQYY1788612xl9PqzWYVVO; Sat, 10 Jul 2021 09:24:52 -0700 X-Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web11.26085.1625934286858255156 for ; Sat, 10 Jul 2021 09:24: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 6E50931B; Sat, 10 Jul 2021 09:24:46 -0700 (PDT) X-Received: from usa.arm.com (a077433.blr.arm.com [10.162.4.33]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 4150C3F5A1; Sat, 10 Jul 2021 09:24:45 -0700 (PDT) From: "Omkar Anand Kulkarni" To: devel@edk2.groups.io Cc: Ard Biesheuvel , Sami Mujawar Subject: [edk2-devel] [edk2-platforms][PATCH v2 5/5] Platform/Sgi: Add platform error handling driver Date: Sat, 10 Jul 2021 21:54:30 +0530 Message-Id: <20210710162430.31691-6-omkar.kulkarni@arm.com> In-Reply-To: <20210710162430.31691-1-omkar.kulkarni@arm.com> References: <20210710162430.31691-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: nYYs3UAsyMwT4eIc9lq0QmJRx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1625934292; bh=G4hI+k6WcRSLdTbQeGymETbQ8bNVVPgJfaOpMcOHgyU=; h=Cc:Date:From:Reply-To:Subject:To; b=d0UMErFcadH7K8J6GFHghE++zBnTpH9wGX8s0iLSQXSpHmMEn9H5VgASeImbEZE24uQ KtT0hZ5eTt1unzp7wEC4XI/9b9JPW86YfSsq96j4eoe3xlLnXNs7gliebNamnT9na1Bs4 7Muw5cNch6bFP9R8WKCElsKqqwvOS6/22KE= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1625934293892100001 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 87803c4e5785..f9bae632b1f6 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 a7100743bbc4..ecc99edf115b 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 (#77674): https://edk2.groups.io/g/devel/message/77674 Mute This Topic: https://groups.io/mt/84115319/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-