From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail05.groups.io (mail05.groups.io [45.79.224.7]) by spool.mail.gandi.net (Postfix) with ESMTPS id 5EFCCAC0CD1 for ; Thu, 15 Aug 2024 06:57:39 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=+Pai+X9sT8dcMKfk3BH9MklJ7by0HPlezReR4lMFim4=; c=relaxed/simple; d=groups.io; h=From:To:CC:Subject:Date:Message-ID:MIME-Version:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Resent-Date:Resent-From:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Transfer-Encoding:Content-Type; s=20240206; t=1723705059; v=1; b=T8j1l0DdmYj/Sw9usQUmhot9tg8d+Pwhm56nUbMRVe40VkaM86ocrxP4KLP0wfTdq6Rkc151 75q/ggT4HXtPWoF3tGCVdMqxMAKRYZpqa0wpj7r9pWX/t2OMdZp/fsYPLXA+832IDzSkaRuMRGD TjNVwMZQhHTdifptz5777eVN9WxmCvaZe2W/nitx24gcUdmIS4FMh5fR1F2UXJPRzKIN2+0NQiI eSNqEH8Mri6xhGgvuYDDLb4APl84XQYlz2Aph6iY52byRv9y2LjA/FEgy9VHPu4XrmKF0KbKbEa wdTdHJ+REKl31B2r9TWioqAFYU1OkCb+/FbRHDL8zRD/Q== X-Received: by 127.0.0.2 with SMTP id SODqYY7687511xp0PtS7jyrb; Wed, 14 Aug 2024 23:57:37 -0700 X-Received: from BN8PR05CU002.outbound.protection.outlook.com (BN8PR05CU002.outbound.protection.outlook.com [52.101.57.122]) by mx.groups.io with SMTP id smtpd.web11.117708.1723705056521279552 for ; Wed, 14 Aug 2024 23:57:36 -0700 X-Received: from PH0PR01MB7287.prod.exchangelabs.com (2603:10b6:510:10a::21) by BY3PR01MB6708.prod.exchangelabs.com (2603:10b6:a03:363::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7875.19; Thu, 15 Aug 2024 06:57:32 +0000 X-Received: from PH0PR01MB7287.prod.exchangelabs.com ([fe80::fc79:e629:93aa:8b8f]) by PH0PR01MB7287.prod.exchangelabs.com ([fe80::fc79:e629:93aa:8b8f%3]) with mapi id 15.20.7875.018; Thu, 15 Aug 2024 06:57:31 +0000 From: "Nhi Pham via groups.io" To: devel@edk2.groups.io CC: quic_llindhol@quicinc.com, chuong@os.amperecomputing.com, rebecca@os.amperecomputing.com, nhi@os.amperecomputing.com Subject: [edk2-devel] [edk2-platforms][PATCH v2 1/1] JadePkg: Add ACPI SPMI table Date: Thu, 15 Aug 2024 13:55:51 +0700 Message-ID: <20240815065551.3796734-1-nhi@os.amperecomputing.com> X-ClientProxiedBy: SI2P153CA0004.APCP153.PROD.OUTLOOK.COM (2603:1096:4:140::23) To SA1PR01MB7279.prod.exchangelabs.com (2603:10b6:806:1f2::18) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PH0PR01MB7287:EE_|BY3PR01MB6708:EE_ X-MS-Office365-Filtering-Correlation-Id: b78352a3-9150-42f2-5699-08dcbcf78739 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?LKuFo95F4g9sVDkTohynPMGe+QWOAWxiGxeAlto2TYJSxA3gFW8fL4mEMPta?= =?us-ascii?Q?fvzFUKazi6DaVy4yrUEOzf2tqVtHkV7SEYP70CNTeHg8KIp4sJQiSHgMFKBe?= =?us-ascii?Q?UHYhe7I803j46RhrK4GMZsMpEvd7jjirPKVOBwU4C5xLB2Nm8iaqqhJ/b2NV?= =?us-ascii?Q?FullcJUKZLChXNYBL178sjwPMYrUnWNCbXRTL37oeq3xHmuIAQMKiPjaXqiK?= =?us-ascii?Q?k5FphikR7MZu9M+foKjYZsbITakfhADEYjQRDYQp2RN7l+kB2ufn2DPoxO7e?= =?us-ascii?Q?6Dr3dfP4EMcg+yKMZHBtc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ascii?Q?gg3mHliKckEX8O0jjlyXp1yZMM/IfI8y2IRV2y1n5nYwlUoa167b4HnBwb+Q?= =?us-ascii?Q?99zpU3MG4WJj6LatCG2SlxbVn8PAQ3boEqyAB9+8+riBBLKv7SAQYRbRrGf3?= =?us-ascii?Q?3gUFxRB1EZ0x3ceyWQe1rw3v3yLxOyGF5ga7hJIbjaxpKDQKVmuVnq8+w162?= =?us-ascii?Q?rQAvT3bghWNph+GKkUmsBNM6+Td+4ZfOkx7l2UvBirEw9csO2g=3D=3D?= X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?l2fe/EUj6BX2OlTHbLxYH02hj+jBRhvxdtiBc7CqiNvLO91VplD7/zP9Yyns?= =?us-ascii?Q?m+qsgx2mZDmKYjuh2DDFyBd9fozTBIMUZzDeMxingaNOuLiViEqvalbMAlxG?= =?us-ascii?Q?NlEsoUVfg7S04/Nv7HB9k3K+Jq9QJJth475wpZJdbNhUqBBvzaUqP5Lno0hO?= =?us-ascii?Q?/fXaj0C1AfcF7AZVrXXUByBR1fRBjbnGKIv3lznaF++2n9/xLcemMkkFXpe4?= =?us-ascii?Q?6PRYEEsip1zjEYA4rOdzOlHOvSjgfFr2RbFCREbjuDb2liChoBAFoOLOTJyN?= =?us-ascii?Q?uiEowWoKQvkxnVu149WI2g9M6KSmED8LL/g7xD75OswJUGRqyR1reQxCOcQz?= =?us-ascii?Q?RR0SXU9QhrHJQHbV5lD4WeAyTEtmP1LpJ5hhcYjdJx8qMd6zwxXPizuNpPc5?= =?us-ascii?Q?G+IkUEKr64mssj1Y6Z1l+zt1ziobrBqp7+sTpWTeIR/FTdwsJQ/YkzQaiI/e?= =?us-ascii?Q?+OazAIZMg0pOjFjCBMqDGJmtq90ZUf6kjwF1o9o1CowoHZR6X+HSdl0iDLvN?= =?us-ascii?Q?hytpzeKCJ0QuHGfbwVDixQF0sL5TdlI8ysnVDCd8OIvzLgTRJWIrf2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Y7m56y4hn912EyRrZVfx+oFe65UV?= =?us-ascii?Q?Sl6oy3fMDajt2trmSw0+G2G7y9/Qb4L9C9fd8+89FfAMyZ2ggjh1OQFoNpYc?= =?us-ascii?Q?xNe9s+6966ktczG6JjQJgtAcfxOI7Pz9JBwXcRV4krbFcLZz04KyA/XsuQrM?= =?us-ascii?Q?23whOueiG/jDvfzuCdiSK+g=3D?= X-OriginatorOrg: os.amperecomputing.com X-MS-Exchange-CrossTenant-Network-Message-Id: b78352a3-9150-42f2-5699-08dcbcf78739 X-MS-Exchange-CrossTenant-AuthSource: SA1PR01MB7279.prod.exchangelabs.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Aug 2024 06:57:31.4929 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3bc2b170-fd94-476d-b0ce-4229bdc904a7 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: ACsqPBeMGzsIDCfwZ8burQK0CsqLdqJxVQ+sRubrH4Jp/JcVRDJyN4Bu2+XCXE8qcpaalWuV/2q23rEXB5q6DJU9tzxDh3JjBC622hb34C0= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY3PR01MB6708 Precedence: Bulk List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Resent-Date: Wed, 14 Aug 2024 23:57:37 -0700 Resent-From: nhi@os.amperecomputing.com Reply-To: devel@edk2.groups.io,nhi@os.amperecomputing.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: 2Rq4DNnIMd1mWRsDAmYvoJTPx7686176AA= Content-Transfer-Encoding: quoted-printable Content-Type: text/plain X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20240206 header.b=T8j1l0Dd; dmarc=pass (policy=none) header.from=groups.io; spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 45.79.224.7 as permitted sender) smtp.mailfrom=bounce@groups.io This implements ACPI SPMI table as defined in the IPMI specification. Signed-off-by: Nhi Pham --- v2: + Remove EFIAPI + Make the function UpdateIpmiSpecRevision() static + Change 0x0F to 0xF to be more readable. Platform/Ampere/JadePkg/Drivers/AcpiPlatformDxe/AcpiPlatformDxe.inf | 4 = + Platform/Ampere/JadePkg/Drivers/AcpiPlatformDxe/AcpiPlatform.h | 12 = +++ Platform/Ampere/JadePkg/Drivers/AcpiPlatformDxe/AcpiPlatformDxe.c | 5 = + Platform/Ampere/JadePkg/Drivers/AcpiPlatformDxe/AcpiSpmi.c | 113 = ++++++++++++++++++++ 4 files changed, 134 insertions(+) diff --git a/Platform/Ampere/JadePkg/Drivers/AcpiPlatformDxe/AcpiPlatformDx= e.inf b/Platform/Ampere/JadePkg/Drivers/AcpiPlatformDxe/AcpiPlatformDxe.inf index 8ab6a790ce07..6c26b6e7141c 100644 --- a/Platform/Ampere/JadePkg/Drivers/AcpiPlatformDxe/AcpiPlatformDxe.inf +++ b/Platform/Ampere/JadePkg/Drivers/AcpiPlatformDxe/AcpiPlatformDxe.inf @@ -27,12 +27,14 @@ [Sources.common] AcpiPlatformDxe.c AcpiPptt.c AcpiSlit.c + AcpiSpmi.c AcpiSrat.c =20 [Packages] ArmPkg/ArmPkg.dec ArmPlatformPkg/ArmPlatformPkg.dec EmbeddedPkg/EmbeddedPkg.dec + Features/ManageabilityPkg/ManageabilityPkg.dec MdeModulePkg/MdeModulePkg.dec MdePkg/MdePkg.dec Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dec @@ -46,6 +48,7 @@ [LibraryClasses] DebugLib FlashLib HobLib + IpmiCommandLib MailboxInterfaceLib SystemFirmwareInterfaceLib TimerLib @@ -64,6 +67,7 @@ [Pcd] gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiDefaultCreatorRevision gAmpereTokenSpaceGuid.PcdPmproDbBaseReg gAmpereTokenSpaceGuid.PcdSmproDbBaseReg + gEfiMdePkgTokenSpaceGuid.PcdIpmiSsifSmbusSlaveAddr =20 [Guids] gArmMpCoreInfoGuid diff --git a/Platform/Ampere/JadePkg/Drivers/AcpiPlatformDxe/AcpiPlatform.h= b/Platform/Ampere/JadePkg/Drivers/AcpiPlatformDxe/AcpiPlatform.h index 170aeff24d59..5fac393bb9e8 100644 --- a/Platform/Ampere/JadePkg/Drivers/AcpiPlatformDxe/AcpiPlatform.h +++ b/Platform/Ampere/JadePkg/Drivers/AcpiPlatformDxe/AcpiPlatform.h @@ -83,4 +83,16 @@ AcpiInstallIort ( VOID ); =20 +/** + Install SPMI (Service Processor Management Interface table) table. + + @retval EFI_SUCCESS The table was installed successfully. + @retval Others Failed to install the table. + +**/ +EFI_STATUS +AcpiInstallSpmiTable ( + VOID + ); + #endif /* ACPI_PLATFORM_H_ */ diff --git a/Platform/Ampere/JadePkg/Drivers/AcpiPlatformDxe/AcpiPlatformDx= e.c b/Platform/Ampere/JadePkg/Drivers/AcpiPlatformDxe/AcpiPlatformDxe.c index 28c422dff166..a82a93d23fa2 100644 --- a/Platform/Ampere/JadePkg/Drivers/AcpiPlatformDxe/AcpiPlatformDxe.c +++ b/Platform/Ampere/JadePkg/Drivers/AcpiPlatformDxe/AcpiPlatformDxe.c @@ -114,6 +114,11 @@ InstallAcpiOnReadyToBoot ( DEBUG ((DEBUG_INFO, "Populate BERT record\n")); } =20 + Status =3D AcpiInstallSpmiTable (); + if (!EFI_ERROR (Status)) { + DEBUG ((DEBUG_INFO, "Installed SPMI table\n")); + } + // // Close the event, so it will not be signalled again. // diff --git a/Platform/Ampere/JadePkg/Drivers/AcpiPlatformDxe/AcpiSpmi.c b/P= latform/Ampere/JadePkg/Drivers/AcpiPlatformDxe/AcpiSpmi.c new file mode 100644 index 000000000000..937f02093185 --- /dev/null +++ b/Platform/Ampere/JadePkg/Drivers/AcpiPlatformDxe/AcpiSpmi.c @@ -0,0 +1,113 @@ +/** @file + + Copyright (c) 2024, Ampere Computing LLC. All rights reserved.
+ + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include +#include +#include +#include "AcpiPlatform.h" + +// +// SPMI Revision (as defined in IPMI v2.0 spec.) +// +#define EFI_ACPI_SERVICE_PROCESSOR_MANAGEMENT_INTERFACE_TABLE_REVISION 0x= 05 + +STATIC EFI_ACPI_SERVICE_PROCESSOR_MANAGEMENT_INTERFACE_TABLE mSpmiTable = =3D { + __ACPI_HEADER ( + EFI_ACPI_6_3_SERVER_PLATFORM_MANAGEMENT_INTERFACE_TABLE_SIGNATURE, + EFI_ACPI_SERVICE_PROCESSOR_MANAGEMENT_INTERFACE_TABLE, + EFI_ACPI_SERVICE_PROCESSOR_MANAGEMENT_INTERFACE_TABLE_REVISION + ), + 0x04, // SMBUS System Interface (SSIF) + 0x01, // Reserved - Must be 0x01 for backward compat= iblity + 0, // Specification Revision + 0, // Interrupt Type + 0, // GPE + EFI_ACPI_RESERVED_BYTE, // Reserved + 0, // PCI Device Flag + 0, // Global System Interrupt + { + 0x04, // Address Space ID: 4 (SMBU= S) + 0, // Register Bit Width + 0, // Register Bit Offset + 0x01, // Address Size: 1 (Byte Acc= ess) + FixedPcdGet8 (PcdIpmiSsifSmbusSlaveAddr), // Address (7-bit SMBUS Addr= ess of BMC SSIF) + }, + { + { + 0, // UID Byte 1 + 0, // UID Byte 2 + 0, // UID Byte 3 + 0 // UID Byte 4 + } + }, + EFI_ACPI_RESERVED_BYTE // Reserved for backward compatiblity +}; + +static +EFI_STATUS +UpdateIpmiSpecRevision ( + EFI_ACPI_SERVICE_PROCESSOR_MANAGEMENT_INTERFACE_TABLE *SpmiTable + ) +{ + EFI_STATUS Status; + IPMI_GET_DEVICE_ID_RESPONSE DeviceId; + + Status =3D IpmiGetDeviceId (&DeviceId); + if (!EFI_ERROR (Status) && (DeviceId.CompletionCode =3D=3D IPMI_COMP_COD= E_NORMAL)) { + // BCD Format + SpmiTable->SpecificationRevision =3D DeviceId.SpecificationVersion & = 0xF0; + SpmiTable->SpecificationRevision |=3D (DeviceId.SpecificationVersion &= 0xF) << 8; + } + + return Status; +} + +/** + Install SPMI (Service Processor Management Interface table) table. + + @retval EFI_SUCCESS The table was installed successfully. + @retval Others Failed to install the table. + +**/ +EFI_STATUS +AcpiInstallSpmiTable ( + VOID + ) +{ + EFI_STATUS Status; + EFI_ACPI_TABLE_PROTOCOL *AcpiTableProtocol; + UINTN SpmiTableKey; + + Status =3D gBS->LocateProtocol ( + &gEfiAcpiTableProtocolGuid, + NULL, + (VOID **)&AcpiTableProtocol + ); + if (EFI_ERROR (Status)) { + return Status; + } + + Status =3D UpdateIpmiSpecRevision (&mSpmiTable); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "%a: Failed to update IPMI Specification Revision= - %r\n", __func__, Status)); + return Status; + } + + Status =3D AcpiTableProtocol->InstallAcpiTable ( + AcpiTableProtocol, + (VOID *)&mSpmiTable, + mSpmiTable.Header.Length, + &SpmiTableKey + ); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "%a: Failed to install SPMI table - %r\n", __func= __, Status)); + return Status; + } + + return EFI_SUCCESS; +} --=20 2.25.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 (#120345): https://edk2.groups.io/g/devel/message/120345 Mute This Topic: https://groups.io/mt/107909806/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-