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 821B1D8083D for ; Wed, 14 Aug 2024 03:35:40 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=ZqFBLAWSlxAIA1pndJV+wZq02nS6oKOmy76f/xMQYvA=; 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=1723606540; v=1; b=iKEh4cEYE4RYuBq7qBleDyYuCNuIPotIkTkU6wH6ZWo0iaBTkanpPjPZ7pemvTBSG9MSapkl lc6oWX7AyuqJT2vWqocAx67jJXYOED/76YmewL7mUSi0WRtSOSY8f+qcqS7MAklBZtLOXiPvfUs BbrV5lKUGf5hbFGB7eDqFPlOF5RiEzVts9CYuFrvaFV0eJgK7QrQVekgpWI4LmqBt36DvbTTQYN O5B5L+mWjB5Lsb3CP4RmzLR3j96Ch9ZSqew0y4OmBIfB/oAkVBCm0GHSRfwTOKkS56flNKWVJLL LIEf2O25YA/NPJb7rTTg1P3uuB4l/xvBF1Zytpta8NdJQ== X-Received: by 127.0.0.2 with SMTP id Mmk4YY7687511xcCRkbmxW9v; Tue, 13 Aug 2024 20:35:38 -0700 X-Received: from CH1PR05CU001.outbound.protection.outlook.com (CH1PR05CU001.outbound.protection.outlook.com [52.101.193.107]) by mx.groups.io with SMTP id smtpd.web11.89976.1723606538043013028 for ; Tue, 13 Aug 2024 20:35:38 -0700 X-Received: from PH0PR01MB7287.prod.exchangelabs.com (2603:10b6:510:10a::21) by SA3PR01MB7941.prod.exchangelabs.com (2603:10b6:806:316::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7849.23; Wed, 14 Aug 2024 03:35:10 +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.016; Wed, 14 Aug 2024 03:35:10 +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 1/1] JadePkg: Add ACPI SPMI table Date: Wed, 14 Aug 2024 10:33:33 +0700 Message-ID: <20240814033333.2360719-1-nhi@os.amperecomputing.com> X-ClientProxiedBy: SI1PR02CA0017.apcprd02.prod.outlook.com (2603:1096:4:1f4::10) To PH0PR01MB7287.prod.exchangelabs.com (2603:10b6:510:10a::21) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PH0PR01MB7287:EE_|SA3PR01MB7941:EE_ X-MS-Office365-Filtering-Correlation-Id: 8619ff2c-4316-4fbc-7edc-08dcbc121987 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?bwDPjRFbjFHcMOrLeAtJBbPBbml8P3GsgHSY6O5pCO4yY+HCOTCCSlqbFbea?= =?us-ascii?Q?7IA4EU62AQQV0PyK8DyN9HSz3HmLwW2/Xl6IXowwq2g79u+Wyev9olsD7jSX?= =?us-ascii?Q?t+86/+IuuiHeUnjbWcfLcXmnBhurifZjKvd0gWXFYYbnArmurqcRQHU99OOI?= =?us-ascii?Q?RD3J+VJBfRNmENwGk9xkMVqeJEoS/GMcUjIHYoO6kbvJ79zFt7QmaGDQrpmK?= =?us-ascii?Q?hSnPlhLTmpfIihRe5JG8kxlpwapicFpJOu8AV0lkA8DhIgjruFhZ5H367o44?= =?us-ascii?Q?tw3PpmYxoZSjEtsFVzFO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5?= =?us-ascii?Q?2vKHypHhvmqvKDjvdzx+Ae/IgtThS9jzCtKKDHi/XgrUy/SL5v12iXK2WdHN?= =?us-ascii?Q?DhDwbLSKPtDvoI81D3d9YJ2x4pK3xdqaYNYcPo4dHThzamZSWJcBMuSQ9TqL?= =?us-ascii?Q?nuABBgAvS9bd1KjUCPORSrB0swxK3xeHldxbMsg728XxfTIDC9/otAujx9UM?= =?us-ascii?Q?2mNvjAYSFkoeI81EGsUx6VB3wP0SvvBdR7kPpj/g+59Asze+KQ=3D=3D?= X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?2ROdoioxf1RsDe5GzdHTCsc8CoPGbeC3Ky74kGwwc3nldTduseS5kpr3YftY?= =?us-ascii?Q?5tU/MofLXL268SL17pdR+6G85XvWrzi7Ch97r+zsUjnazCK9YT8qwPIRGgH2?= =?us-ascii?Q?P4KianfXA6FlHV+gQQ+RhoFmnY5CdRZzMxO4NDybliYdJQ7FxK46NxQHWTSN?= =?us-ascii?Q?/8dUpuX/crt6ofaRTc3GnKAqrRXJVbu7RGbfTD4N503cKacaGf6RRkIE/hKW?= =?us-ascii?Q?y5HiWfw/V9EVryhyxwZy1mB3z1nxVvEemx+MMj/t4HZYnNZ4cJlq57v+/e4Z?= =?us-ascii?Q?slTfMBiHsIgDRFYOdl8uDzyar6DD5o3jBF8stKhqNrHztgp6QRGUPMJzZ8IV?= =?us-ascii?Q?0g3wc59Ol5fXdSLQAkBtqrbFEUQJi1c0vRJuSkF0v4PkLE2XZx34guVku+eo?= =?us-ascii?Q?IP+RPZJZVF0jscspBzOruppAt+d45bRx2kDfdRweY3rLKFQYoUrcD5TOR3Ic?= =?us-ascii?Q?jB8z0+Ip0HUMu34k+Tqv0n9PmtwF/J6GuKAA25ztbOFrcHGtAEdFkmhCX9Ea?= =?us-ascii?Q?2MFf6/Li3UnUl5lXr3dW/emjsYRF9f1ZCSfFZWVzUSdfRmv7abuL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+pbncgS/vhr2Ng5h3qHBJjJIFpAb+q?= =?us-ascii?Q?IpC/O8pucYfg3/AIcdt1349fgo5YQ1UGxzSZkPdaI+AeH5u4ke+NRL5p73Mx?= =?us-ascii?Q?oHHxaO5XWlxKZk+atLPoL33LfL98R1OPqbBH2mIBUgSD9+L5q8gqBr9j7nJ9?= =?us-ascii?Q?tvmttFPRfur0soXtWSBYJCE=3D?= X-OriginatorOrg: os.amperecomputing.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8619ff2c-4316-4fbc-7edc-08dcbc121987 X-MS-Exchange-CrossTenant-AuthSource: PH0PR01MB7287.prod.exchangelabs.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Aug 2024 03:35:10.6163 (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: S+DZLkGODnYpBkOFbor7sdtrq6tP0h20nl1K16TGqhSlw+QWDzbkecLqdZPItaMkmbefkbYeRvYlLq2hCZB1YrgTGC6oixN3IaFBNDiIBLk= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA3PR01MB7941 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: Tue, 13 Aug 2024 20:35:38 -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: 7cZcvbMRpZLEojXO49V2R1Qfx7686176AA= 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=iKEh4cEY; spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 45.79.224.7 as permitted sender) smtp.mailfrom=bounce@groups.io; dmarc=pass (policy=none) header.from=groups.io This implements ACPI SPMI table as defined in the IPMI specification. Signed-off-by: Nhi Pham --- Platform/Ampere/JadePkg/Drivers/AcpiPlatformDxe/AcpiPlatformDxe.inf | 4 = + Platform/Ampere/JadePkg/Drivers/AcpiPlatformDxe/AcpiPlatform.h | 13 = +++ Platform/Ampere/JadePkg/Drivers/AcpiPlatformDxe/AcpiPlatformDxe.c | 5 = + Platform/Ampere/JadePkg/Drivers/AcpiPlatformDxe/AcpiSpmi.c | 112 = ++++++++++++++++++++ 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..ff60bbe9fc27 100644 --- a/Platform/Ampere/JadePkg/Drivers/AcpiPlatformDxe/AcpiPlatform.h +++ b/Platform/Ampere/JadePkg/Drivers/AcpiPlatformDxe/AcpiPlatform.h @@ -83,4 +83,17 @@ 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 +EFIAPI +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..eefc419b07aa --- /dev/null +++ b/Platform/Ampere/JadePkg/Drivers/AcpiPlatformDxe/AcpiSpmi.c @@ -0,0 +1,112 @@ +/** @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 +}; + +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 &= 0x0F) << 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 (#120335): https://edk2.groups.io/g/devel/message/120335 Mute This Topic: https://groups.io/mt/107889268/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-