[edk2-devel] [edk2-platforms] [PATCH v2 3/5] Platform/ARM/SgiPkg: Add MultiChipMode to Platform Descriptor

Vijayenthiran Subramaniam posted 5 patches 5 years, 12 months ago
There is a newer version of this series
[edk2-devel] [edk2-platforms] [PATCH v2 3/5] Platform/ARM/SgiPkg: Add MultiChipMode to Platform Descriptor
Posted by Vijayenthiran Subramaniam 5 years, 12 months ago
The 'system-id' node of HW_CONFIG device tree has been updated to have
a new property 'multi-chip-mode' which holds the information about the
multi-chip-mode support. To adapt to this change, add 'MultiChipMode'
member to SGI_PLATFORM_DESCRIPTOR structure to get 'multi-chip-mode'
property from fdt.

Signed-off-by: Vijayenthiran Subramaniam <vijayenthiran.subramaniam@arm.com>
---
 Platform/ARM/SgiPkg/Include/SgiPlatform.h                    |  4 ++++
 Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.c        | 13 ++++++++++---
 Platform/ARM/SgiPkg/Library/SgiPlatformPei/SgiPlatformPeim.c |  8 ++++++++
 3 files changed, 22 insertions(+), 3 deletions(-)

diff --git a/Platform/ARM/SgiPkg/Include/SgiPlatform.h b/Platform/ARM/SgiPkg/Include/SgiPlatform.h
index e4a2e8cc0971..7c9322d1cda9 100644
--- a/Platform/ARM/SgiPkg/Include/SgiPlatform.h
+++ b/Platform/ARM/SgiPkg/Include/SgiPlatform.h
@@ -79,10 +79,14 @@
 #define SGI_CONFIG_SHIFT                          0x1C
 #define SGI_PART_NUM_MASK                         0xFFF
 
+#define MULTI_CHIP_MODE_DISABLED                  0x0
+#define MULTI_CHIP_MODE_ENABLED                   0x1
+
 // ARM platform description data.
 typedef struct {
   UINTN  PlatformId;
   UINTN  ConfigId;
+  UINTN  MultiChipMode;
 } SGI_PLATFORM_DESCRIPTOR;
 
 #endif // __SGI_PLATFORM_H__
diff --git a/Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.c b/Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.c
index 4ab0dd768cd1..a2250a37bb57 100644
--- a/Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.c
+++ b/Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.c
@@ -17,10 +17,10 @@ typedef struct {
 } SGI_PLATFORM_ACPI_TABLE_GUID_LOOKUP;
 
 // Macro to construct the SGI_PLATFORM_ACPI_TABLE_GUID_LOOKUP structure
-#define ACPI_GUID_LOOKUP(PART_NUM, CONFIG_NUM, GUID)                           \
+#define ACPI_GUID_LOOKUP(PART_NUM, CONFIG_NUM, MULTI_CHIP_MODE, GUID)          \
 {                                                                              \
   {                                                                            \
-    PART_NUM, CONFIG_NUM                                                       \
+    PART_NUM, CONFIG_NUM, MULTI_CHIP_MODE                                      \
   },                                                                           \
   GUID                                                                         \
 }                                                                              \
@@ -29,14 +29,17 @@ STATIC SGI_PLATFORM_ACPI_TABLE_GUID_LOOKUP AcpiTableGuidLookup[] = {
   ACPI_GUID_LOOKUP (
       SGI575_PART_NUM,
       SGI575_CONF_NUM,
+      MULTI_CHIP_MODE_DISABLED,
       &gSgi575AcpiTablesFileGuid),
   ACPI_GUID_LOOKUP (
       RD_N1E1_EDGE_PART_NUM,
       RD_N1_EDGE_CONF_ID,
+      MULTI_CHIP_MODE_DISABLED,
       &gRdN1EdgeAcpiTablesFileGuid),
   ACPI_GUID_LOOKUP (
       RD_N1E1_EDGE_PART_NUM,
       RD_E1_EDGE_CONF_ID,
+      MULTI_CHIP_MODE_DISABLED,
       &gRdE1EdgeAcpiTablesFileGuid),
 };
 
@@ -58,6 +61,7 @@ ArmSgiPkgEntryPoint (
   UINT8                   i;
   UINT32                  ConfigId;
   UINT32                  PartNum;
+  UINT32                  MultiChipMode;
 
   SystemIdHob = GetFirstGuidHob (&gArmSgiPlatformIdDescriptorGuid);
   if (SystemIdHob == NULL) {
@@ -69,13 +73,16 @@ ArmSgiPkgEntryPoint (
 
   PartNum = HobData->PlatformId;
   ConfigId = HobData->ConfigId;
+  MultiChipMode = HobData->MultiChipMode;
 
   Status = EFI_UNSUPPORTED;
 
   // Walk through the AcpiTableGuidLookup lookup array
   for (i = 0; i < ARRAY_SIZE (AcpiTableGuidLookup); i++) {
     if ((PartNum == AcpiTableGuidLookup[i].SgiPlafromDescriptor.PlatformId) &&
-        (ConfigId == AcpiTableGuidLookup[i].SgiPlafromDescriptor.ConfigId)) {
+        (ConfigId == AcpiTableGuidLookup[i].SgiPlafromDescriptor.ConfigId)  &&
+        (MultiChipMode ==
+         AcpiTableGuidLookup[i].SgiPlafromDescriptor.MultiChipMode)) {
       Status = LocateAndInstallAcpiFromFv (AcpiTableGuidLookup[i].AcpiTableGuid);
       break;
     }
diff --git a/Platform/ARM/SgiPkg/Library/SgiPlatformPei/SgiPlatformPeim.c b/Platform/ARM/SgiPkg/Library/SgiPlatformPei/SgiPlatformPeim.c
index 4daa1832dfaf..7df52cc4fd7c 100644
--- a/Platform/ARM/SgiPkg/Library/SgiPlatformPei/SgiPlatformPeim.c
+++ b/Platform/ARM/SgiPkg/Library/SgiPlatformPei/SgiPlatformPeim.c
@@ -75,6 +75,14 @@ GetSgiSystemId (
 
   HobData->ConfigId = fdt32_to_cpu (*Property);
 
+  Property = fdt_getprop (NtFwCfgDtBlob, Offset, "multi-chip-mode", NULL);
+  if (Property == NULL) {
+    DEBUG ((DEBUG_WARN, "multi-chip-mode property not found\n"));
+    HobData->MultiChipMode = 0;
+  } else {
+    HobData->MultiChipMode = fdt32_to_cpu (*Property);
+  }
+
   return EFI_SUCCESS;
 }
 
-- 
2.7.4


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#54292): https://edk2.groups.io/g/devel/message/54292
Mute This Topic: https://groups.io/mt/71211943/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-

Re: [edk2-devel] [edk2-platforms] [PATCH v2 3/5] Platform/ARM/SgiPkg: Add MultiChipMode to Platform Descriptor
Posted by Leif Lindholm 5 years, 12 months ago
On Wed, Feb 12, 2020 at 18:59:25 +0530, Vijayenthiran Subramaniam wrote:
> The 'system-id' node of HW_CONFIG device tree has been updated to have
> a new property 'multi-chip-mode' which holds the information about the
> multi-chip-mode support. To adapt to this change, add 'MultiChipMode'
> member to SGI_PLATFORM_DESCRIPTOR structure to get 'multi-chip-mode'
> property from fdt.
> 
> Signed-off-by: Vijayenthiran Subramaniam <vijayenthiran.subramaniam@arm.com>

Apart from the "i" variable:
Reviewed-by: Leif Lindholm <leif@nuviainc.com>

As long as that is the only thing that changes, please keep that R-b
when sending out v3.

/
    Leif

> ---
>  Platform/ARM/SgiPkg/Include/SgiPlatform.h                    |  4 ++++
>  Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.c        | 13 ++++++++++---
>  Platform/ARM/SgiPkg/Library/SgiPlatformPei/SgiPlatformPeim.c |  8 ++++++++
>  3 files changed, 22 insertions(+), 3 deletions(-)
> 
> diff --git a/Platform/ARM/SgiPkg/Include/SgiPlatform.h b/Platform/ARM/SgiPkg/Include/SgiPlatform.h
> index e4a2e8cc0971..7c9322d1cda9 100644
> --- a/Platform/ARM/SgiPkg/Include/SgiPlatform.h
> +++ b/Platform/ARM/SgiPkg/Include/SgiPlatform.h
> @@ -79,10 +79,14 @@
>  #define SGI_CONFIG_SHIFT                          0x1C
>  #define SGI_PART_NUM_MASK                         0xFFF
>  
> +#define MULTI_CHIP_MODE_DISABLED                  0x0
> +#define MULTI_CHIP_MODE_ENABLED                   0x1
> +
>  // ARM platform description data.
>  typedef struct {
>    UINTN  PlatformId;
>    UINTN  ConfigId;
> +  UINTN  MultiChipMode;
>  } SGI_PLATFORM_DESCRIPTOR;
>  
>  #endif // __SGI_PLATFORM_H__
> diff --git a/Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.c b/Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.c
> index 4ab0dd768cd1..a2250a37bb57 100644
> --- a/Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.c
> +++ b/Platform/ARM/SgiPkg/Drivers/PlatformDxe/PlatformDxe.c
> @@ -17,10 +17,10 @@ typedef struct {
>  } SGI_PLATFORM_ACPI_TABLE_GUID_LOOKUP;
>  
>  // Macro to construct the SGI_PLATFORM_ACPI_TABLE_GUID_LOOKUP structure
> -#define ACPI_GUID_LOOKUP(PART_NUM, CONFIG_NUM, GUID)                           \
> +#define ACPI_GUID_LOOKUP(PART_NUM, CONFIG_NUM, MULTI_CHIP_MODE, GUID)          \
>  {                                                                              \
>    {                                                                            \
> -    PART_NUM, CONFIG_NUM                                                       \
> +    PART_NUM, CONFIG_NUM, MULTI_CHIP_MODE                                      \
>    },                                                                           \
>    GUID                                                                         \
>  }                                                                              \
> @@ -29,14 +29,17 @@ STATIC SGI_PLATFORM_ACPI_TABLE_GUID_LOOKUP AcpiTableGuidLookup[] = {
>    ACPI_GUID_LOOKUP (
>        SGI575_PART_NUM,
>        SGI575_CONF_NUM,
> +      MULTI_CHIP_MODE_DISABLED,
>        &gSgi575AcpiTablesFileGuid),
>    ACPI_GUID_LOOKUP (
>        RD_N1E1_EDGE_PART_NUM,
>        RD_N1_EDGE_CONF_ID,
> +      MULTI_CHIP_MODE_DISABLED,
>        &gRdN1EdgeAcpiTablesFileGuid),
>    ACPI_GUID_LOOKUP (
>        RD_N1E1_EDGE_PART_NUM,
>        RD_E1_EDGE_CONF_ID,
> +      MULTI_CHIP_MODE_DISABLED,
>        &gRdE1EdgeAcpiTablesFileGuid),
>  };
>  
> @@ -58,6 +61,7 @@ ArmSgiPkgEntryPoint (
>    UINT8                   i;
>    UINT32                  ConfigId;
>    UINT32                  PartNum;
> +  UINT32                  MultiChipMode;
>  
>    SystemIdHob = GetFirstGuidHob (&gArmSgiPlatformIdDescriptorGuid);
>    if (SystemIdHob == NULL) {
> @@ -69,13 +73,16 @@ ArmSgiPkgEntryPoint (
>  
>    PartNum = HobData->PlatformId;
>    ConfigId = HobData->ConfigId;
> +  MultiChipMode = HobData->MultiChipMode;
>  
>    Status = EFI_UNSUPPORTED;
>  
>    // Walk through the AcpiTableGuidLookup lookup array
>    for (i = 0; i < ARRAY_SIZE (AcpiTableGuidLookup); i++) {
>      if ((PartNum == AcpiTableGuidLookup[i].SgiPlafromDescriptor.PlatformId) &&
> -        (ConfigId == AcpiTableGuidLookup[i].SgiPlafromDescriptor.ConfigId)) {
> +        (ConfigId == AcpiTableGuidLookup[i].SgiPlafromDescriptor.ConfigId)  &&
> +        (MultiChipMode ==
> +         AcpiTableGuidLookup[i].SgiPlafromDescriptor.MultiChipMode)) {
>        Status = LocateAndInstallAcpiFromFv (AcpiTableGuidLookup[i].AcpiTableGuid);
>        break;
>      }
> diff --git a/Platform/ARM/SgiPkg/Library/SgiPlatformPei/SgiPlatformPeim.c b/Platform/ARM/SgiPkg/Library/SgiPlatformPei/SgiPlatformPeim.c
> index 4daa1832dfaf..7df52cc4fd7c 100644
> --- a/Platform/ARM/SgiPkg/Library/SgiPlatformPei/SgiPlatformPeim.c
> +++ b/Platform/ARM/SgiPkg/Library/SgiPlatformPei/SgiPlatformPeim.c
> @@ -75,6 +75,14 @@ GetSgiSystemId (
>  
>    HobData->ConfigId = fdt32_to_cpu (*Property);
>  
> +  Property = fdt_getprop (NtFwCfgDtBlob, Offset, "multi-chip-mode", NULL);
> +  if (Property == NULL) {
> +    DEBUG ((DEBUG_WARN, "multi-chip-mode property not found\n"));
> +    HobData->MultiChipMode = 0;
> +  } else {
> +    HobData->MultiChipMode = fdt32_to_cpu (*Property);
> +  }
> +
>    return EFI_SUCCESS;
>  }
>  
> -- 
> 2.7.4
> 

-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#54372): https://edk2.groups.io/g/devel/message/54372
Mute This Topic: https://groups.io/mt/71211943/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-