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 EF1767803CD for ; Fri, 23 Aug 2024 02:51:47 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=qa5W0HJ2/xXiyWtIdFM6WhbkRmE9jNdEkgc0Ol1fRjw=; c=relaxed/simple; d=groups.io; h=From:To:CC:Subject:Thread-Topic:Thread-Index:Date:Message-ID:References:In-Reply-To:Accept-Language:msip_labels: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-Language:Content-Type; s=20240206; t=1724381507; v=1; b=DERaL9bAdGOB+bO0cszZv25T2NyLyJwJacc/G5E72YCSGMbSLRg/wNONGTilS6MiBJVlFcx4 Q5D0ejbd0Jp8cRFqdA9SkOdKoAwDrirY35FrB8UxZhug5cGk2+eCDZ5uVRkk+6AimDd8hjwte81 NAZ6t98H55TfTUjdWmaDIquJdkYgm9G7meaqcrkAwDP3szUB1QKAC9dc8DA0cj9qH7e4WMnYZ+r 0IlgYTZ9n7QeM6D+NKxQw175Xah6ZzSzMKoAk9UgjzG6O5Zlvgb5mRFGsLVnbwq6K5k5mTvM90p tHCjZ5LNQl6zYMXxGQIlx8TAHs0AvqjFlbRVCwa1fFvlA== X-Received: by 127.0.0.2 with SMTP id TiEDYY7687511x5FNNYiliSZ; Thu, 22 Aug 2024 19:51:46 -0700 X-Received: from CH1PR05CU001.outbound.protection.outlook.com (CH1PR05CU001.outbound.protection.outlook.com [52.101.193.132]) by mx.groups.io with SMTP id smtpd.web10.8317.1724381500900494417 for ; Thu, 22 Aug 2024 19:51:41 -0700 X-Received: from PH0PR01MB7287.prod.exchangelabs.com (2603:10b6:510:10a::21) by LV3PR01MB8486.prod.exchangelabs.com (2603:10b6:408:19d::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7897.18; Fri, 23 Aug 2024 02:51:34 +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.7897.014; Fri, 23 Aug 2024 02:51:34 +0000 From: "Nhi Pham via groups.io" To: Chuong Tran OS , "devel@edk2.groups.io" CC: "quic_llindhol@quicinc.com" , Chuong Tran OS , "Rebecca Cran OS" Subject: Re: [edk2-devel] [edk2-platforms][PATCH v2 1/1] JadePkg: Add ACPI SPMI table Thread-Topic: [edk2-platforms][PATCH v2 1/1] JadePkg: Add ACPI SPMI table Thread-Index: AQHa7uBlqKGFsvBN3kScU7PjkBGL27IzJBmAgAEMy4c= Date: Fri, 23 Aug 2024 02:51:34 +0000 Message-ID: References: <20240815065551.3796734-1-nhi@os.amperecomputing.com> In-Reply-To: Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: msip_labels: MSIP_Label_5b82cb1d-c2e0-4643-920a-bbe7b2d7cc47_Enabled=True;MSIP_Label_5b82cb1d-c2e0-4643-920a-bbe7b2d7cc47_SiteId=3bc2b170-fd94-476d-b0ce-4229bdc904a7;MSIP_Label_5b82cb1d-c2e0-4643-920a-bbe7b2d7cc47_SetDate=2024-08-23T02:51:33.877Z;MSIP_Label_5b82cb1d-c2e0-4643-920a-bbe7b2d7cc47_Name=Confidential;MSIP_Label_5b82cb1d-c2e0-4643-920a-bbe7b2d7cc47_ContentBits=0;MSIP_Label_5b82cb1d-c2e0-4643-920a-bbe7b2d7cc47_Method=Standard; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: PH0PR01MB7287:EE_|LV3PR01MB8486:EE_ x-ms-office365-filtering-correlation-id: 6038e299-4839-4b55-9e27-08dcc31e802b x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam-message-info: =?us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wnR5kY37NcgMAW7b?= =?us-ascii?Q?A6NjfvJNIGRBDtjzOdcWSc+slrEKQQOTyk7dF0iefvDEg2okYVsKjUAW4sw1?= =?us-ascii?Q?hrbgLgceFJggmO6yV9cFZNIfvAe9U/6chrGrLarCE51a2M0LotPwjI3ALzC2?= =?us-ascii?Q?qBDlNWukgJ1OvW4diNgJbOj8pcKW4Fy8/fRfVes9kehpsuMSsSEfgkqUhByh?= =?us-ascii?Q?KZCntGQMWSsSUA8kc0ASsc3nR+/l6AnmZCZ7K7qcSo42Cdc04zkKEYcuq3nh?= =?us-ascii?Q?mFw9t5GB5abYvydZYBtX8JRWAI5duqHctqsPXNcOvd/9h/J/vf7A5s4Ra/nR?= =?us-ascii?Q?dPlXXKfhKVwqretqtJ+8kSNn0T/chYIcux+yNk8mYWvJ2DVv5Z5kVrQTxM9l?= =?us-ascii?Q?xS1UKLteQa9XclHtpAWTM1n5IFSLXBsGF8KBy5IRPZtDs/h+p81sKTzHS1i6?= =?us-ascii?Q?Lw8PagvcBFoFrsNgo2cuuHTf/3zuVSF+u/AZmN7FJYMO2EVLekdPQunLqgMu?= =?us-ascii?Q?jjwlY7FtVKWBoUCbnWMlrQD1tVqJs7b8ernjNSBbwyD1d9/wYw=3D=3D?= x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?nLPnG1fiM6Cp3rvBFgdPydT04gzhAy/YQXPcF8QYkPDzVj5ImFjPiw5KlrKu?= =?us-ascii?Q?N3Rzv6llCzlYLvbIKj0RN6ti7sgk4P7dPuFaaR568iWh8sTg0+PpDYcTcQbh?= =?us-ascii?Q?32JGt2SRksd/pwwCr2/KVcIrAfgziiuR3xGeYslwEaMyEFU6AZ5HPs2egQxK?= =?us-ascii?Q?HDz68XlBxGdYbUREabkcQwjS8kMHNCWdMk9a1m6dhFh5c49FvQQ4Jw4gwJ4J?= =?us-ascii?Q?eySNzFV+ozoEhVZfEerGsnro4dj2MzYPl1IMAemp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4dGPIXhGorjMPtT9L0MixYVunFKff3NOki++7?= =?us-ascii?Q?MXq5BwRSLyuy9sLIlMGfjYnCatS3CoYzQs2X+ezJ6x+L1O8nWAeYcMKszZ/f?= =?us-ascii?Q?ypW0UC9WkMeC4Eax7sJfljq65rXM9l69Thq52E3KWfZQp981zkc30D2HKFVb?= =?us-ascii?Q?Cy2v1RKTC3gkLCb+XGy82TTm2Aumc43HR6tIB+PfgVKKhaS6VMe8cWurYoWh?= =?us-ascii?Q?V8y+USBd4DPwCyAoBBbowxsgF3ZDLaZOp7PapyBq8n3lOZGgm3N7UpvRIQRr?= =?us-ascii?Q?5XBEo8+2qDe9zCifVhuZOvc/Ofx8uT8cmVIZmrZVoXx4SHRVz5kZXYRWhXZ0?= =?us-ascii?Q?BLKmZpS3JsA3gjr3moJiCoZFWVduFghU5iotT1TxiLAqvga4zTHWiBW4tHHz?= =?us-ascii?Q?y3xyU3tOLZBuJ9idBKwnpuo7DT/NiwUgKe9rl3Nc4JjT/AeSil6UpMSipSEu?= =?us-ascii?Q?rw=3D=3D?= MIME-Version: 1.0 X-OriginatorOrg: os.amperecomputing.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: PH0PR01MB7287.prod.exchangelabs.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6038e299-4839-4b55-9e27-08dcc31e802b X-MS-Exchange-CrossTenant-originalarrivaltime: 23 Aug 2024 02:51:34.6179 (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: 4W7MflR8C8ul86k+qPEZYf0Hv/yqVHnEUECszD60t2ioz3E0/soir8+O5Hdg3DYfsSNYOjqlnobK2bwlurXboSd2tWla0sRZ/sOdJQlJxLs= X-MS-Exchange-Transport-CrossTenantHeadersStamped: LV3PR01MB8486 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: Thu, 22 Aug 2024 19:51:41 -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: cBloicO8AxijHNf20Xlt1Honx7686176AA= Content-Language: en-US Content-Type: multipart/alternative; boundary="_000_PH0PR01MB7287E48C320E4E51A528264896882PH0PR01MB7287prod_" X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20240206 header.b=DERaL9bA; 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 --_000_PH0PR01MB7287E48C320E4E51A528264896882PH0PR01MB7287prod_ Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Thanks for the review. I will push after the IPMI SSIF support is merged. Regards, Nhi ________________________________ From: Chuong Tran OS Sent: Thursday, August 22, 2024 5:49 PM To: Nhi Pham OS ; devel@edk2.groups.io Cc: quic_llindhol@quicinc.com ; Chuong Tran OS <= chuong@os.amperecomputing.com>; Rebecca Cran OS Subject: Re: [edk2-platforms][PATCH v2 1/1] JadePkg: Add ACPI SPMI table Reviewed-by: Chuong Tran Thanks, Chuong On 8/15/2024 1:55 PM, Nhi Pham wrote: > 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 | 1= 13 ++++++++++++++++++++ > 4 files changed, 134 insertions(+) > > diff --git a/Platform/Ampere/JadePkg/Drivers/AcpiPlatformDxe/AcpiPlatform= Dxe.inf b/Platform/Ampere/JadePkg/Drivers/AcpiPlatformDxe/AcpiPlatformDxe.i= nf > 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 > > [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 > > [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 > ); > > +/** > + 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/AcpiPlatform= Dxe.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")); > } > > + 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= /Platform/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 = 0x05 > + > +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 comp= atiblity > + 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 (SM= BUS) > + 0, // Register Bit Width > + 0, // Register Bit Offset > + 0x01, // Address Size: 1 (Byte A= ccess) > + FixedPcdGet8 (PcdIpmiSsifSmbusSlaveAddr), // Address (7-bit SMBUS Ad= dress 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_C= ODE_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 Revisi= on - %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", __fu= nc__, Status)); > + return Status; > + } > + > + return EFI_SUCCESS; > +} -=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 (#120399): https://edk2.groups.io/g/devel/message/120399 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- --_000_PH0PR01MB7287E48C320E4E51A528264896882PH0PR01MB7287prod_ Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable
Thanks for the review. I will push after the IPMI SSIF support is merged.

Regards,
Nhi

From: Chuong Tran OS <ch= uong@amperemail.onmicrosoft.com>
Sent: Thursday, August 22, 2024 5:49 PM
To: Nhi Pham OS <nhi@os.amperecomputing.com>; devel@edk2.group= s.io <devel@edk2.groups.io>
Cc: quic_llindhol@quicinc.com <quic_llindhol@quicinc.com>; Chu= ong Tran OS <chuong@os.amperecomputing.com>; Rebecca Cran OS <rebe= cca@os.amperecomputing.com>
Subject: Re: [edk2-platforms][PATCH v2 1/1] JadePkg: Add ACPI SPMI t= able
 
Reviewed-by: Chuong Tran <chuong@os.amperecompu= ting.com>

Thanks,
Chuong

On 8/15/2024 1:55 PM, Nhi Pham wrote:
> This implements ACPI SPMI table as defined in the IPMI specification.<= br> >
> Signed-off-by: Nhi Pham <nhi@os.amperecomputing.com>
> ---
> v2:
>      + Remove EFIAPI
>      + Make the function UpdateIpmiSpecRevisi= on() static
>      + Change 0x0F to 0xF to be more readable= .
>
>   Platform/Ampere/JadePkg/Drivers/AcpiPlatformDxe/AcpiPlatfo= rmDxe.inf |   4 +
>   Platform/Ampere/JadePkg/Drivers/AcpiPlatformDxe/AcpiPlatfo= rm.h      |  12 +++
>   Platform/Ampere/JadePkg/Drivers/AcpiPlatformDxe/AcpiPlatfo= rmDxe.c   |   5 +
>   Platform/Ampere/JadePkg/Drivers/AcpiPlatformDxe/AcpiSpmi.c=           | 113 ++++++++++++++= ++++++
>   4 files changed, 134 insertions(+)
>
> diff --git a/Platform/Ampere/JadePkg/Drivers/AcpiPlatformDxe/AcpiPlatf= ormDxe.inf b/Platform/Ampere/JadePkg/Drivers/AcpiPlatformDxe/AcpiPlatformDx= e.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
>  
>   [Packages]
>     ArmPkg/ArmPkg.dec
>     ArmPlatformPkg/ArmPlatformPkg.dec
>     EmbeddedPkg/EmbeddedPkg.dec
> +  Features/ManageabilityPkg/ManageabilityPkg.dec
>     MdeModulePkg/MdeModulePkg.dec
>     MdePkg/MdePkg.dec
>     Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.d= ec
> @@ -46,6 +48,7 @@ [LibraryClasses]
>     DebugLib
>     FlashLib
>     HobLib
> +  IpmiCommandLib
>     MailboxInterfaceLib
>     SystemFirmwareInterfaceLib
>     TimerLib
> @@ -64,6 +67,7 @@ [Pcd]
>     gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiDefaultC= reatorRevision
>     gAmpereTokenSpaceGuid.PcdPmproDbBaseReg
>     gAmpereTokenSpaceGuid.PcdSmproDbBaseReg
> +  gEfiMdePkgTokenSpaceGuid.PcdIpmiSsifSmbusSlaveAddr
>  
>   [Guids]
>     gArmMpCoreInfoGuid
> diff --git a/Platform/Ampere/JadePkg/Drivers/AcpiPlatformDxe/AcpiPlatf= orm.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
>     );
>  
> +/**
> +  Install SPMI (Service Processor Management Interface table) ta= ble.
> +
> +  @retval EFI_SUCCESS   The table was installed succes= sfully.
> +  @retval Others        Faile= d to install the table.
> +
> +**/
> +EFI_STATUS
> +AcpiInstallSpmiTable (
> +  VOID
> +  );
> +
>   #endif /* ACPI_PLATFORM_H_ */
> diff --git a/Platform/Ampere/JadePkg/Drivers/AcpiPlatformDxe/AcpiPlatf= ormDxe.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"));
>     }
>  
> +  Status =3D AcpiInstallSpmiTable ();
> +  if (!EFI_ERROR (Status)) {
> +    DEBUG ((DEBUG_INFO, "Installed SPMI table\n&q= uot;));
> +  }
> +
>     //
>     // Close the event, so it will not be signalle= d again.
>     //
> diff --git a/Platform/Ampere/JadePkg/Drivers/AcpiPlatformDxe/AcpiSpmi.= c b/Platform/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.= <BR>
> +
> +  SPDX-License-Identifier: BSD-2-Clause-Patent
> +
> +**/
> +
> +#include <IndustryStandard/Ipmi.h>
> +#include <IndustryStandard/ServiceProcessorManagementInterfaceTabl= e.h>
> +#include <Library/IpmiCommandLib.h>
> +#include "AcpiPlatform.h"
> +
> +//
> +// SPMI Revision (as defined in IPMI v2.0 spec.)
> +//
> +#define EFI_ACPI_SERVICE_PROCESSOR_MANAGEMENT_INTERFACE_TABLE_REVISIO= N  0x05
> +
> +STATIC EFI_ACPI_SERVICE_PROCESSOR_MANAGEMENT_INTERFACE_TABLE  mS= pmiTable =3D {
> +  __ACPI_HEADER (
> +    EFI_ACPI_6_3_SERVER_PLATFORM_MANAGEMENT_INTERFACE_= TABLE_SIGNATURE,
> +    EFI_ACPI_SERVICE_PROCESSOR_MANAGEMENT_INTERFACE_TA= BLE,
> +    EFI_ACPI_SERVICE_PROCESSOR_MANAGEMENT_INTERFACE_TA= BLE_REVISION
> +    ),
> +  0x04,         &nb= sp;           // SMBUS Sy= stem Interface (SSIF)
> +  0x01,         &nb= sp;           // Reserved= - Must be 0x01 for backward compatiblity
> +  0,          =             &nb= sp; // Specification Revision
> +  0,          =             &nb= sp; // Interrupt Type
> +  0,          =             &nb= sp; // GPE
> +  EFI_ACPI_RESERVED_BYTE,   // Reserved
> +  0,          =             &nb= sp; // PCI Device Flag
> +  0,          =             &nb= sp; // Global System Interrupt
> +  {
> +    0x04,       &nb= sp;            =             &nb= sp;    // Address Space ID: 4 (SMBUS)
> +    0,        =             &nb= sp;            =        // Register Bit Width
> +    0,        =             &nb= sp;            =        // Register Bit Offset
> +    0x01,       &nb= sp;            =             &nb= sp;    // Address Size: 1 (Byte Access)
> +    FixedPcdGet8 (PcdIpmiSsifSmbusSlaveAddr), // Addre= ss (7-bit SMBUS Address 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 backw= ard compatiblity
> +};
> +
> +static
> +EFI_STATUS
> +UpdateIpmiSpecRevision (
> +  EFI_ACPI_SERVICE_PROCESSOR_MANAGEMENT_INTERFACE_TABLE  *S= pmiTable
> +  )
> +{
> +  EFI_STATUS        &nbs= p;          Status;
> +  IPMI_GET_DEVICE_ID_RESPONSE  DeviceId;
> +
> +  Status =3D IpmiGetDeviceId (&DeviceId);
> +  if (!EFI_ERROR (Status) && (DeviceId.CompletionCode = =3D=3D IPMI_COMP_CODE_NORMAL)) {
> +    // BCD Format
> +    SpmiTable->SpecificationRevision  =3D Devi= ceId.SpecificationVersion & 0xF0;
> +    SpmiTable->SpecificationRevision |=3D (DeviceId= .SpecificationVersion & 0xF) << 8;
> +  }
> +
> +  return Status;
> +}
> +
> +/**
> +  Install SPMI (Service Processor Management Interface table) ta= ble.
> +
> +  @retval EFI_SUCCESS   The table was installed succes= sfully.
> +  @retval Others        Faile= d to install the table.
> +
> +**/
> +EFI_STATUS
> +AcpiInstallSpmiTable (
> +  VOID
> +  )
> +{
> +  EFI_STATUS        &nbs= p;      Status;
> +  EFI_ACPI_TABLE_PROTOCOL  *AcpiTableProtocol;
> +  UINTN         &nb= sp;          SpmiTableKey;
> +
> +  Status =3D gBS->LocateProtocol (
> +           &nb= sp;      &gEfiAcpiTableProtocolGuid,
> +           &nb= sp;      NULL,
> +           &nb= sp;      (VOID **)&AcpiTableProtocol
> +           &nb= sp;      );
> +  if (EFI_ERROR (Status)) {
> +    return Status;
> +  }
> +
> +  Status =3D UpdateIpmiSpecRevision (&mSpmiTable);
> +  if (EFI_ERROR (Status)) {
> +    DEBUG ((DEBUG_ERROR, "%a: Failed to update IP= MI Specification Revision - %r\n", __func__, Status));
> +    return Status;
> +  }
> +
> +  Status =3D AcpiTableProtocol->InstallAcpiTable (
> +           &nb= sp;            =         AcpiTableProtocol,
> +           &nb= sp;            =         (VOID *)&mSpmiTable,
> +           &nb= sp;            =         mSpmiTable.Header.Length,
> +           &nb= sp;            =         &SpmiTableKey
> +           &nb= sp;            =         );
> +  if (EFI_ERROR (Status)) {
> +    DEBUG ((DEBUG_ERROR, "%a: Failed to install S= PMI table - %r\n", __func__, Status));
> +    return Status;
> +  }
> +
> +  return EFI_SUCCESS;
> +}

_._,_._,_

Groups.io Links:

=20 You receive all messages sent to this group. =20 =20

View/Reply Online (#120399) | =20 | Mute= This Topic | New Topic
Your Subscriptio= n | Contact Group Owner | Unsubscribe [rebecca@openfw.io]

_._,_._,_
--_000_PH0PR01MB7287E48C320E4E51A528264896882PH0PR01MB7287prod_--