public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: Leif Lindholm <leif.lindholm@linaro.org>
To: Chandni Cherukuri <chandni.cherukuri@arm.com>
Cc: edk2-devel@lists.01.org, ard.beisheuvel@linaro.org
Subject: Re: [PATCH v2 edk2-platforms 1/5] Platform/ARM/Sgi: Adapt to changes in system-id DT node.
Date: Fri, 9 Nov 2018 16:29:18 +0000	[thread overview]
Message-ID: <20181109162918.biighqlpmr3ueesw@bivouac.eciton.net> (raw)
In-Reply-To: <1541410019-1781-2-git-send-email-chandni.cherukuri@arm.com>

On Mon, Nov 05, 2018 at 02:56:55PM +0530, Chandni Cherukuri wrote:
> 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.

This gets a bit hairy semantically:
- PlatformId used to be the contents of node "platform-id"
- PlatformId is now the union of the lower 28 bits of node
  "platform-id" and the 4 bottom bits of new node "config-id",
- The result is still called PlatformId.

Is there some better way of describing this? Should the function name
change?

> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Chandni Cherukuri <chandni.cherukuri@arm.com>
> ---
>  .../SgiPkg/Library/SgiPlatformPei/SgiPlatformPeim.c   | 19 ++++++++++++++++++-

Can you ensure you generate patches in accordance with the
instructions at
https://github.com/tianocore/tianocore.github.io/wiki/Laszlo's-unkempt-git-guide-for-edk2-contributors-and-maintainers#contrib-23
?

>  1 file changed, 18 insertions(+), 1 deletion(-)
> 
> diff --git a/Platform/ARM/SgiPkg/Library/SgiPlatformPei/SgiPlatformPeim.c b/Platform/ARM/SgiPkg/Library/SgiPlatformPei/SgiPlatformPeim.c
> index 081d329..8b6c71b 100644
> --- a/Platform/ARM/SgiPkg/Library/SgiPlatformPei/SgiPlatformPeim.c
> +++ b/Platform/ARM/SgiPkg/Library/SgiPlatformPei/SgiPlatformPeim.c
> @@ -42,6 +42,8 @@ GetSgiPlatformId (

Since this is changing what the return value of the function means,
can the function description comment be updated as well?

>    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,22 @@ GetSgiPlatformId (
>      return 0;
>    }
>  
> -  return fdt32_to_cpu (*Property);
> +  PlatformId = fdt32_to_cpu (*Property);
> +
> +  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);
> +
> +  // Concatenate the value of config ID into the platform ID value with
> +  // config ID occupying the upper 4 bits of platform ID.
> +  ConfigId = ConfigId & SGI_CONFIG_MASK;

We are here silently discarding 28 bits of data that need to be set to
0 for the below operation to make sense.
I think an ASSERT might be in order.

I also note that we've neither looked at nor cleared the top four bits
of PlatformId.

> +  PlatformId = PlatformId | (ConfigId << SGI_CONFIG_SHIFT);
> +
> +  return PlatformId;

I would be happier with just the return statement - reusing the
PlatformId variable does not simplify anything.

/
    Leif.

>  }
>  
>  /**
> -- 
> 2.7.4
> 


  reply	other threads:[~2018-11-09 16:29 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-05  9:26 [PATCH v2 edk2-platforms 0/5] Platform/ARM/Sgi: Add support for Clark.Ares and Chandni Cherukuri
2018-11-05  9:26 ` [PATCH v2 edk2-platforms 1/5] Platform/ARM/Sgi: Adapt to changes in system-id DT node Chandni Cherukuri
2018-11-09 16:29   ` Leif Lindholm [this message]
     [not found]     ` <CADXzzgrW-cpXxO99HOeFmgsa5xNEPaasa7tW1ZANWeEFA_S4ig@mail.gmail.com>
2018-11-12 11:25       ` Leif Lindholm
2018-11-12 14:16         ` chandni cherukuri
2018-11-12 16:26           ` Leif Lindholm
2018-11-05  9:26 ` [PATCH v2 edk2-platforms 2/5] Platform/ARM/Sgi: Add ACPI tables for SGI-Clark.Ares platform Chandni Cherukuri
2018-11-05  9:26 ` [PATCH v2 edk2-platforms 3/5] Platform/ARM/Sgi: Add support " Chandni Cherukuri
2018-11-05  9:26 ` [PATCH v2 edk2-platforms 4/5] Platform/ARM/Sgi: Add ACPI tables for SGI-Clark.Helios platform Chandni Cherukuri
2018-11-05  9:26 ` [PATCH v2 edk2-platforms 5/5] Platform/ARM/Sgi: Add platform support for SGI-Clark.Helios Chandni Cherukuri

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=20181109162918.biighqlpmr3ueesw@bivouac.eciton.net \
    --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