public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: Chandni Cherukuri <chandni.cherukuri@arm.com>
To: edk2-devel@lists.01.org
Subject: [PATCH v3 edk2-platforms 1/5] Platform/ARM/Sgi: Adapt to changes in system-id DT node.
Date: Mon, 12 Nov 2018 17:11:52 +0530	[thread overview]
Message-ID: <1542022916-24462-2-git-send-email-chandni.cherukuri@arm.com> (raw)
In-Reply-To: <1542022916-24462-1-git-send-email-chandni.cherukuri@arm.com>

The 'system-id' node of HW_CONFIG device tree has been updated to have
a new property 'config-id' to hold the platform configuration value.
Prior to this, configuration ID value was represented by the the upper
four bits of the 'platform ID' property value but it now has a seperate
property of its own in the 'system-id' node. So adapt to these changes
in the 'system-id' node.

Contributed-under: TianoCore Contribution Agreement 1.1
Cc: Leif Lindholm <leif.lindholm@linaro.org>
Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Chandni Cherukuri <chandni.cherukuri@arm.com>
---
 Platform/ARM/SgiPkg/Library/SgiPlatformPei/SgiPlatformPeim.c | 24 +++++++++++++++++++-
 1 file changed, 23 insertions(+), 1 deletion(-)

diff --git a/Platform/ARM/SgiPkg/Library/SgiPlatformPei/SgiPlatformPeim.c b/Platform/ARM/SgiPkg/Library/SgiPlatformPei/SgiPlatformPeim.c
index 081d329..5bdf20c 100644
--- a/Platform/ARM/SgiPkg/Library/SgiPlatformPei/SgiPlatformPeim.c
+++ b/Platform/ARM/SgiPkg/Library/SgiPlatformPei/SgiPlatformPeim.c
@@ -42,6 +42,8 @@ GetSgiPlatformId (
   CONST VOID                    *HwCfgDtBlob;
   SGI_HW_CONFIG_INFO_PPI        *HwConfigInfoPpi;
   EFI_STATUS                    Status;
+  UINT32                        PlatformId;
+  UINT32                        ConfigId;
 
   Status = PeiServicesLocatePpi (&gHwConfigDtInfoPpiGuid, 0, NULL,
              (VOID**)&HwConfigInfoPpi);
@@ -69,7 +71,27 @@ GetSgiPlatformId (
     return 0;
   }
 
-  return fdt32_to_cpu (*Property);
+  PlatformId = fdt32_to_cpu (*Property);
+
+  // Ensure upper 4-bits of platform-id is set to zero.
+  ASSERT ((PlatformId >> SGI_CONFIG_SHIFT) == 0);
+
+  Property = fdt_getprop (HwCfgDtBlob, Offset, "config-id", NULL);
+  if (Property == NULL) {
+    DEBUG ((DEBUG_ERROR, "Config Id is NULL\n"));
+    return 0;
+  }
+
+  ConfigId = fdt32_to_cpu (*Property);
+
+  // Ensure upper 28-bits of config-id is set to zero.
+  ASSERT ((ConfigId >> SGI_CONFIG_MASK) == 0);
+
+  // Concatenate the value of config ID into the platform ID value with
+  // config ID occupying the upper 4 bits of platform ID.
+  PlatformId = PlatformId | (ConfigId << SGI_CONFIG_SHIFT);
+
+  return PlatformId;
 }
 
 /**
-- 
2.7.4



  reply	other threads:[~2018-11-12 11:42 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-12 11:41 [PATCH v3 edk2-platforms 0/5] Platform/ARM/Sgi: Add support for Clark.Ares and Clark.Helios platforms Chandni Cherukuri
2018-11-12 11:41 ` Chandni Cherukuri [this message]
2018-11-12 11:41 ` [PATCH v3 edk2-platforms 2/5] Platform/ARM/Sgi: Add ACPI tables for SGI-Clark.Ares platform Chandni Cherukuri
2018-11-19 15:35   ` Leif Lindholm
2018-11-12 11:41 ` [PATCH v3 edk2-platforms 3/5] Platform/ARM/Sgi: Add initial support " Chandni Cherukuri
2018-11-19 15:13   ` Leif Lindholm
2018-11-12 11:41 ` [PATCH v3 edk2-platforms 4/5] Platform/ARM/Sgi: Add ACPI tables for SGI-Clark.Helios platform Chandni Cherukuri
2018-11-19 16:30   ` Leif Lindholm
2018-11-12 11:41 ` [PATCH v3 edk2-platforms 5/5] Platform/ARM/Sgi: Add initial support " Chandni Cherukuri
2018-11-19 16:34   ` Leif Lindholm
2018-11-12 16:27 ` [PATCH v3 edk2-platforms 0/5] Platform/ARM/Sgi: Add support for Clark.Ares and Clark.Helios platforms Leif Lindholm
2018-11-19 11:30   ` chandni cherukuri
2018-11-19 12:04     ` Leif Lindholm

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1542022916-24462-2-git-send-email-chandni.cherukuri@arm.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox