* [edk2-devel] [edk2-platforms][PATCH v2 1/1] JadePkg: Add ACPI SPMI table
@ 2024-08-15 6:55 Nhi Pham via groups.io
2024-08-22 10:49 ` Chuong Tran
0 siblings, 1 reply; 4+ messages in thread
From: Nhi Pham via groups.io @ 2024-08-15 6:55 UTC (permalink / raw)
To: devel; +Cc: quic_llindhol, chuong, rebecca, nhi
This implements ACPI SPMI table as defined in the IPMI specification.
Signed-off-by: Nhi Pham <nhi@os.amperecomputing.com>
---
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/AcpiPlatformDxe.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
[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/AcpiPlatformDxe.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 = 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.<BR>
+
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include <IndustryStandard/Ipmi.h>
+#include <IndustryStandard/ServiceProcessorManagementInterfaceTable.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_REVISION 0x05
+
+STATIC EFI_ACPI_SERVICE_PROCESSOR_MANAGEMENT_INTERFACE_TABLE mSpmiTable = {
+ __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 compatiblity
+ 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 (SMBUS)
+ 0, // Register Bit Width
+ 0, // Register Bit Offset
+ 0x01, // Address Size: 1 (Byte Access)
+ FixedPcdGet8 (PcdIpmiSsifSmbusSlaveAddr), // Address (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 backward compatiblity
+};
+
+static
+EFI_STATUS
+UpdateIpmiSpecRevision (
+ EFI_ACPI_SERVICE_PROCESSOR_MANAGEMENT_INTERFACE_TABLE *SpmiTable
+ )
+{
+ EFI_STATUS Status;
+ IPMI_GET_DEVICE_ID_RESPONSE DeviceId;
+
+ Status = IpmiGetDeviceId (&DeviceId);
+ if (!EFI_ERROR (Status) && (DeviceId.CompletionCode == IPMI_COMP_CODE_NORMAL)) {
+ // BCD Format
+ SpmiTable->SpecificationRevision = DeviceId.SpecificationVersion & 0xF0;
+ SpmiTable->SpecificationRevision |= (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 = gBS->LocateProtocol (
+ &gEfiAcpiTableProtocolGuid,
+ NULL,
+ (VOID **)&AcpiTableProtocol
+ );
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ Status = UpdateIpmiSpecRevision (&mSpmiTable);
+ if (EFI_ERROR (Status)) {
+ DEBUG ((DEBUG_ERROR, "%a: Failed to update IPMI Specification Revision - %r\n", __func__, Status));
+ return Status;
+ }
+
+ Status = 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;
+}
--
2.25.1
-=-=-=-=-=-=-=-=-=-=-=-
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]
-=-=-=-=-=-=-=-=-=-=-=-
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [edk2-devel] [edk2-platforms][PATCH v2 1/1] JadePkg: Add ACPI SPMI table
2024-08-15 6:55 [edk2-devel] [edk2-platforms][PATCH v2 1/1] JadePkg: Add ACPI SPMI table Nhi Pham via groups.io
@ 2024-08-22 10:49 ` Chuong Tran
2024-08-23 2:51 ` Nhi Pham via groups.io
[not found] ` <17EE3BD6D36E09DB.23723@groups.io>
0 siblings, 2 replies; 4+ messages in thread
From: Chuong Tran @ 2024-08-22 10:49 UTC (permalink / raw)
To: Nhi Pham, devel; +Cc: quic_llindhol, chuong, rebecca
Reviewed-by: Chuong Tran <chuong@os.amperecomputing.com>
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 <nhi@os.amperecomputing.com>
> ---
> 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/AcpiPlatformDxe.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
>
> [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/AcpiPlatformDxe.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 = 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.<BR>
> +
> + SPDX-License-Identifier: BSD-2-Clause-Patent
> +
> +**/
> +
> +#include <IndustryStandard/Ipmi.h>
> +#include <IndustryStandard/ServiceProcessorManagementInterfaceTable.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_REVISION 0x05
> +
> +STATIC EFI_ACPI_SERVICE_PROCESSOR_MANAGEMENT_INTERFACE_TABLE mSpmiTable = {
> + __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 compatiblity
> + 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 (SMBUS)
> + 0, // Register Bit Width
> + 0, // Register Bit Offset
> + 0x01, // Address Size: 1 (Byte Access)
> + FixedPcdGet8 (PcdIpmiSsifSmbusSlaveAddr), // Address (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 backward compatiblity
> +};
> +
> +static
> +EFI_STATUS
> +UpdateIpmiSpecRevision (
> + EFI_ACPI_SERVICE_PROCESSOR_MANAGEMENT_INTERFACE_TABLE *SpmiTable
> + )
> +{
> + EFI_STATUS Status;
> + IPMI_GET_DEVICE_ID_RESPONSE DeviceId;
> +
> + Status = IpmiGetDeviceId (&DeviceId);
> + if (!EFI_ERROR (Status) && (DeviceId.CompletionCode == IPMI_COMP_CODE_NORMAL)) {
> + // BCD Format
> + SpmiTable->SpecificationRevision = DeviceId.SpecificationVersion & 0xF0;
> + SpmiTable->SpecificationRevision |= (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 = gBS->LocateProtocol (
> + &gEfiAcpiTableProtocolGuid,
> + NULL,
> + (VOID **)&AcpiTableProtocol
> + );
> + if (EFI_ERROR (Status)) {
> + return Status;
> + }
> +
> + Status = UpdateIpmiSpecRevision (&mSpmiTable);
> + if (EFI_ERROR (Status)) {
> + DEBUG ((DEBUG_ERROR, "%a: Failed to update IPMI Specification Revision - %r\n", __func__, Status));
> + return Status;
> + }
> +
> + Status = 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;
> +}
-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#120396): https://edk2.groups.io/g/devel/message/120396
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]
-=-=-=-=-=-=-=-=-=-=-=-
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [edk2-devel] [edk2-platforms][PATCH v2 1/1] JadePkg: Add ACPI SPMI table
2024-08-22 10:49 ` Chuong Tran
@ 2024-08-23 2:51 ` Nhi Pham via groups.io
[not found] ` <17EE3BD6D36E09DB.23723@groups.io>
1 sibling, 0 replies; 4+ messages in thread
From: Nhi Pham via groups.io @ 2024-08-23 2:51 UTC (permalink / raw)
To: Chuong Tran OS, devel@edk2.groups.io
Cc: quic_llindhol@quicinc.com, Chuong Tran OS, Rebecca Cran OS
[-- Attachment #1: Type: text/plain, Size: 8623 bytes --]
Thanks for the review. I will push after the IPMI SSIF support is merged.
Regards,
Nhi
________________________________
From: Chuong Tran OS <chuong@amperemail.onmicrosoft.com>
Sent: Thursday, August 22, 2024 5:49 PM
To: Nhi Pham OS <nhi@os.amperecomputing.com>; devel@edk2.groups.io <devel@edk2.groups.io>
Cc: quic_llindhol@quicinc.com <quic_llindhol@quicinc.com>; Chuong Tran OS <chuong@os.amperecomputing.com>; Rebecca Cran OS <rebecca@os.amperecomputing.com>
Subject: Re: [edk2-platforms][PATCH v2 1/1] JadePkg: Add ACPI SPMI table
Reviewed-by: Chuong Tran <chuong@os.amperecomputing.com>
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 <nhi@os.amperecomputing.com>
> ---
> 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/AcpiPlatformDxe.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
>
> [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/AcpiPlatformDxe.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 = 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.<BR>
> +
> + SPDX-License-Identifier: BSD-2-Clause-Patent
> +
> +**/
> +
> +#include <IndustryStandard/Ipmi.h>
> +#include <IndustryStandard/ServiceProcessorManagementInterfaceTable.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_REVISION 0x05
> +
> +STATIC EFI_ACPI_SERVICE_PROCESSOR_MANAGEMENT_INTERFACE_TABLE mSpmiTable = {
> + __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 compatiblity
> + 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 (SMBUS)
> + 0, // Register Bit Width
> + 0, // Register Bit Offset
> + 0x01, // Address Size: 1 (Byte Access)
> + FixedPcdGet8 (PcdIpmiSsifSmbusSlaveAddr), // Address (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 backward compatiblity
> +};
> +
> +static
> +EFI_STATUS
> +UpdateIpmiSpecRevision (
> + EFI_ACPI_SERVICE_PROCESSOR_MANAGEMENT_INTERFACE_TABLE *SpmiTable
> + )
> +{
> + EFI_STATUS Status;
> + IPMI_GET_DEVICE_ID_RESPONSE DeviceId;
> +
> + Status = IpmiGetDeviceId (&DeviceId);
> + if (!EFI_ERROR (Status) && (DeviceId.CompletionCode == IPMI_COMP_CODE_NORMAL)) {
> + // BCD Format
> + SpmiTable->SpecificationRevision = DeviceId.SpecificationVersion & 0xF0;
> + SpmiTable->SpecificationRevision |= (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 = gBS->LocateProtocol (
> + &gEfiAcpiTableProtocolGuid,
> + NULL,
> + (VOID **)&AcpiTableProtocol
> + );
> + if (EFI_ERROR (Status)) {
> + return Status;
> + }
> +
> + Status = UpdateIpmiSpecRevision (&mSpmiTable);
> + if (EFI_ERROR (Status)) {
> + DEBUG ((DEBUG_ERROR, "%a: Failed to update IPMI Specification Revision - %r\n", __func__, Status));
> + return Status;
> + }
> +
> + Status = 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;
> +}
-=-=-=-=-=-=-=-=-=-=-=-
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]
-=-=-=-=-=-=-=-=-=-=-=-
[-- Attachment #2: Type: text/html, Size: 16390 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
[parent not found: <17EE3BD6D36E09DB.23723@groups.io>]
* Re: [edk2-devel] [edk2-platforms][PATCH v2 1/1] JadePkg: Add ACPI SPMI table
[not found] ` <17EE3BD6D36E09DB.23723@groups.io>
@ 2024-08-29 7:19 ` Nhi Pham via groups.io
0 siblings, 0 replies; 4+ messages in thread
From: Nhi Pham via groups.io @ 2024-08-29 7:19 UTC (permalink / raw)
To: Chuong Tran OS, devel@edk2.groups.io, Nhi Pham OS
Cc: quic_llindhol@quicinc.com, Chuong Tran OS, Rebecca Cran OS
[-- Attachment #1: Type: text/plain, Size: 9225 bytes --]
Pushed as 146cb5322498..c400d971093f
Thanks,
Nhi
________________________________
From: devel@edk2.groups.io <devel@edk2.groups.io> on behalf of Nhi Pham via groups.io <nhi=os.amperecomputing.com@groups.io>
Sent: Friday, August 23, 2024 9:51 AM
To: Chuong Tran OS <chuong@amperemail.onmicrosoft.com>; devel@edk2.groups.io <devel@edk2.groups.io>
Cc: quic_llindhol@quicinc.com <quic_llindhol@quicinc.com>; Chuong Tran OS <chuong@os.amperecomputing.com>; Rebecca Cran OS <rebecca@os.amperecomputing.com>
Subject: Re: [edk2-devel] [edk2-platforms][PATCH v2 1/1] JadePkg: Add ACPI SPMI table
Thanks for the review. I will push after the IPMI SSIF support is merged.
Regards,
Nhi
________________________________
From: Chuong Tran OS <chuong@amperemail.onmicrosoft.com>
Sent: Thursday, August 22, 2024 5:49 PM
To: Nhi Pham OS <nhi@os.amperecomputing.com>; devel@edk2.groups.io <devel@edk2.groups.io>
Cc: quic_llindhol@quicinc.com <quic_llindhol@quicinc.com>; Chuong Tran OS <chuong@os.amperecomputing.com>; Rebecca Cran OS <rebecca@os.amperecomputing.com>
Subject: Re: [edk2-platforms][PATCH v2 1/1] JadePkg: Add ACPI SPMI table
Reviewed-by: Chuong Tran <chuong@os.amperecomputing.com>
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 <nhi@os.amperecomputing.com>
> ---
> 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/AcpiPlatformDxe.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
>
> [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/AcpiPlatformDxe.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 = 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.<BR>
> +
> + SPDX-License-Identifier: BSD-2-Clause-Patent
> +
> +**/
> +
> +#include <IndustryStandard/Ipmi.h>
> +#include <IndustryStandard/ServiceProcessorManagementInterfaceTable.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_REVISION 0x05
> +
> +STATIC EFI_ACPI_SERVICE_PROCESSOR_MANAGEMENT_INTERFACE_TABLE mSpmiTable = {
> + __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 compatiblity
> + 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 (SMBUS)
> + 0, // Register Bit Width
> + 0, // Register Bit Offset
> + 0x01, // Address Size: 1 (Byte Access)
> + FixedPcdGet8 (PcdIpmiSsifSmbusSlaveAddr), // Address (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 backward compatiblity
> +};
> +
> +static
> +EFI_STATUS
> +UpdateIpmiSpecRevision (
> + EFI_ACPI_SERVICE_PROCESSOR_MANAGEMENT_INTERFACE_TABLE *SpmiTable
> + )
> +{
> + EFI_STATUS Status;
> + IPMI_GET_DEVICE_ID_RESPONSE DeviceId;
> +
> + Status = IpmiGetDeviceId (&DeviceId);
> + if (!EFI_ERROR (Status) && (DeviceId.CompletionCode == IPMI_COMP_CODE_NORMAL)) {
> + // BCD Format
> + SpmiTable->SpecificationRevision = DeviceId.SpecificationVersion & 0xF0;
> + SpmiTable->SpecificationRevision |= (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 = gBS->LocateProtocol (
> + &gEfiAcpiTableProtocolGuid,
> + NULL,
> + (VOID **)&AcpiTableProtocol
> + );
> + if (EFI_ERROR (Status)) {
> + return Status;
> + }
> +
> + Status = UpdateIpmiSpecRevision (&mSpmiTable);
> + if (EFI_ERROR (Status)) {
> + DEBUG ((DEBUG_ERROR, "%a: Failed to update IPMI Specification Revision - %r\n", __func__, Status));
> + return Status;
> + }
> +
> + Status = 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;
> +}
-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#120428): https://edk2.groups.io/g/devel/message/120428
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]
-=-=-=-=-=-=-=-=-=-=-=-
[-- Attachment #2: Type: text/html, Size: 17908 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2024-08-29 7:19 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-15 6:55 [edk2-devel] [edk2-platforms][PATCH v2 1/1] JadePkg: Add ACPI SPMI table Nhi Pham via groups.io
2024-08-22 10:49 ` Chuong Tran
2024-08-23 2:51 ` Nhi Pham via groups.io
[not found] ` <17EE3BD6D36E09DB.23723@groups.io>
2024-08-29 7:19 ` Nhi Pham via groups.io
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox