public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: Evan Lloyd <Evan.Lloyd@arm.com>
To: Leif Lindholm <leif.lindholm@linaro.org>
Cc: "edk2-devel@lists.01.org" <edk2-devel@lists.01.org>,
	Ard Biesheuvel <ard.biesheuvel@linaro.org>,
	Matteo Carlini <Matteo.Carlini@arm.com>, nd <nd@arm.com>
Subject: Re: [PATCH 1/5] ArmPkg: Tidy GIC code before changes.
Date: Thu, 21 Sep 2017 15:34:07 +0000	[thread overview]
Message-ID: <AM4PR0801MB14441B892C184C1402F872DA8B660@AM4PR0801MB1444.eurprd08.prod.outlook.com> (raw)
In-Reply-To: <20170914164109.foiwrmrdbm7aftd6@bivouac.eciton.net>

Hi Leif.
I agree/accept all the comments, except:

> -----Original Message-----
> From: Leif Lindholm [mailto:leif.lindholm@linaro.org]
> Sent: 14 September 2017 17:41
> To: Evan Lloyd <Evan.Lloyd@arm.com>
> Cc: edk2-devel@lists.01.org; Ard Biesheuvel <ard.biesheuvel@linaro.org>;
> Matteo Carlini <Matteo.Carlini@arm.com>; nd <nd@arm.com>
> Subject: Re: [PATCH 1/5] ArmPkg: Tidy GIC code before changes.
> 
> On Mon, Sep 11, 2017 at 04:23:31PM +0100, evan.lloyd@arm.com wrote:
> > From: Evan Lloyd <evan.lloyd@arm.com>
> >
...
> 
> >    // whereas Affinity3 is defined at [32:39] in MPIDR
> > -  CpuAffinity = (MpId & (ARM_CORE_AFF0 | ARM_CORE_AFF1 |
> > ARM_CORE_AFF2)) | ((MpId & ARM_CORE_AFF3) >> 8);
> > +  CpuAffinity = (MpId & (ARM_CORE_AFF0 | ARM_CORE_AFF1 |
> ARM_CORE_AFF2))
> > +                | ((MpId & ARM_CORE_AFF3) >> 8);
> 
> I can't find an explicit rule on this, but my preference aligns with what
> examples I can see in the Coding Style: moving that lone '|' to the end of the
> preceding line:
> 
>   CpuAffinity = (MpId & (ARM_CORE_AFF0 | ARM_CORE_AFF1 |
> ARM_CORE_AFF2)) |
>                 ((MpId & ARM_CORE_AFF3) >> 8);

[[Evan Lloyd]] 5.2.1.6 and 5.7.2.4 have multiple examples of prefix style, 
  with 5.2.2.11 and 5.7.2.3 providing only 2 instances of a line suffix operator.
  I can change it if you insist, but it will be a clear instance of a 
  maintainer's personal prejudice overriding the coding standard. I strongly
  believe prefix format is much clearer, especially for compound conditions
  with nesting.

> 
> >    if (Revision == ARM_GIC_ARCH_REVISION_3) {
...
> >      // Write set-enable register
> > -    MmioWrite32 (GicCpuRedistributorBase +
> ARM_GICR_CTLR_FRAME_SIZE + ARM_GICR_ISENABLER + (4 * RegOffset), 1
> << RegShift);
> > +    MmioWrite32 (
> > +      (GicCpuRedistributorBase
> > +        + ARM_GICR_CTLR_FRAME_SIZE
> > +        + ARM_GICR_ISENABLER
> > +        + (4 * RegOffset)),
> > +      1 << RegShift
> > +      );
> 
> Maybe rewrite as
> 
> #define SET_ENABLE_ADDRESS(base,offset) ((base) +
> ARM_GICR_CTLR_FRAME_SIZE + \
>                                          ARM_GICR_ISENABLER + (4 * offset))
> 
> (further up)
> 
> then
> 
>     MmioWrite32 (
>       SET_ENABLE_ADDRESS (GicCpuRedistributorBase, RegOffset),
>       1 << RegShift
>       );
> 
> ?

[[Evan Lloyd]] Agree, but I called the macros ISENABLER_ADDRESS and ISENABLER_ADDRESS
(using the register names) because SET_ seemed to imply writing something in this context.

...


  reply	other threads:[~2017-09-21 15:31 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-11 15:23 [PATCH 0/5] Add HardwareInterrupt2 for ARM evan.lloyd
2017-09-11 15:23 ` [PATCH 1/5] ArmPkg: Tidy GIC code before changes evan.lloyd
2017-09-14 16:41   ` Leif Lindholm
2017-09-21 15:34     ` Evan Lloyd [this message]
2017-09-21 17:43       ` Leif Lindholm
2017-09-11 15:23 ` [PATCH 2/5] EmbeddedPkg: Introduce HardwareInterrupt2 protocol evan.lloyd
2017-09-14 16:42   ` Leif Lindholm
2017-09-15  9:21     ` Alexei Fedorov
2017-09-11 15:23 ` [PATCH 3/5] ArmPkg/ArmGicDxe: Expose " evan.lloyd
2017-09-14 17:00   ` Leif Lindholm
2017-09-11 15:23 ` [PATCH 4/5] ArmPkg/GenericWatchdogDxe: Set Watchdog interrupt type evan.lloyd
2017-09-14 17:06   ` Leif Lindholm
2017-09-11 15:23 ` [PATCH 5/5] ArmPkg: Tidy up GenericWatchdogDxe.c evan.lloyd
2017-09-14 17:10   ` Leif Lindholm
  -- strict thread matches above, loose matches on Subject: below --
2017-02-16 22:14 [PATCH 0/5] HardwareInterrupt2 protocol evan.lloyd
2017-02-16 22:14 ` [PATCH 1/5] ArmPkg: Tidy GIC code before changes evan.lloyd

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=AM4PR0801MB14441B892C184C1402F872DA8B660@AM4PR0801MB1444.eurprd08.prod.outlook.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