public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: Ryan Harkin <ryan.harkin@linaro.org>
To: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: "edk2-devel@lists.01.org" <edk2-devel@lists.01.org>,
	Leif Lindholm <leif.lindholm@linaro.org>
Subject: Re: [PATCH] ArmPkg/ArmLib: remove indirection layer from timer register accessors
Date: Fri, 20 Jan 2017 15:50:43 +0000	[thread overview]
Message-ID: <CAD0U-hKvot_M=7rNPT5mz90iAF+r_z_J4htHwq82=1UqsxEqsw@mail.gmail.com> (raw)
In-Reply-To: <CAKv+Gu_Jf0CwssqT79JwmkDQHWB1D3XbYuF9f=uFtb7gjSAG-w@mail.gmail.com>

On 20 January 2017 at 14:35, Ard Biesheuvel <ard.biesheuvel@linaro.org> wrote:
> On 20 January 2017 at 14:32, Ryan Harkin <ryan.harkin@linaro.org> wrote:
>> Hi Ard,
>>
>> On 20 January 2017 at 12:06, Ard Biesheuvel <ard.biesheuvel@linaro.org> wrote:
>>> The generic timer support libraries call the actual system register
>>> accessor function via a single pair of functions ArmArchTimerReadReg()
>>> and ArmArchTimerWriteReg(), which take an enum to argument to identify
>>> the register, and return output values by pointer reference.
>>>
>>> Since these functions are never called with a non-immediate argument,
>>> we can simply replace each invocation with the underlying system register
>>> accessor instead. This is mostly functionally equivalent, with the
>>> exception of the bounds check for the enum (which is pointless given the
>>> fact that we never pass a variable), the check for the presence of the
>>> architected timer (which only makes sense for ARMv7, but is highly unlikely
>>> to vary between platforms that are similar enough to run the same firmware
>>> image), and a check for enum values that refer to the HYP view of the timer,
>>> which we never referred to anywhere in the code in the first place.
>>>
>>> So get rid of the middle man, and update the ArmGenericTimerPhyCounterLib
>>> and ArmGenericTimerVirtCounterLib implementations to call the system
>>> register accessors directly.
>>>
>>> Contributed-under: TianoCore Contribution Agreement 1.0
>>> Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
>>
>> Are there any other patches needed to get this working?
>>
>> I've just applied it to the head of EDK2 [1] and I get this error when
>> building for TC2, FVP and Juno:
>>
>> Building ... /linaro/platforms/uefi/edk2/ArmPkg/Library/ArmArchTimerLib/ArmArchTimerLib.inf
>> [AARCH64]
>> /linaro/platforms/uefi/edk2/ArmPkg/Library/ArmGenericTimerPhyCounterLib/ArmGenericTimerPhyCounterLib.c:
>> In function 'ArmGenericTimerSetTimerFreq':
>> /linaro/platforms/uefi/edk2/ArmPkg/Library/ArmGenericTimerPhyCounterLib/ArmGenericTimerPhyCounterLib.c:51:19:
>> error: 'CntFrq' undeclared (first use in this function)
>>    ArmWriteCntFrq (CntFrq);
>>                    ^
>> /linaro/platforms/uefi/edk2/ArmPkg/Library/ArmGenericTimerPhyCounterLib/ArmGenericTimerPhyCounterLib.c:51:19:
>> note: each undeclared identifier is reported only once for each
>> function it appears in
>> GNUmakefile:304: recipe for target
>> '/linaro/platforms/uefi/edk2/Build/ArmVExpress-FVP-AArch64/DEBUG_GCC5/AARCH64/ArmPkg/Library/ArmGenericTimerPhyCounterLib/ArmGenericTimerPhyCounterLib/OUTPUT/ArmGenericTimerPhyCounterLib.obj'
>> failed
>> make: *** [/linaro/platforms/uefi/edk2/Build/ArmVExpress-FVP-AArch64/DEBUG_GCC5/AARCH64/ArmPkg/Library/ArmGenericTimerPhyCounterLib/ArmGenericTimerPhyCounterLib/OUTPUT/ArmGenericTimerPhyCounterLib.obj]
>> Error 1
>>
>
>
> Oops! Poor testing on my part: that should be FreqInHz not CntFrq

Naughty! ;-)

Okay, so with that change, it works on TC2, FVP Foundation & AEMv8 and
Juno R0/R1/R2:

Tested-by: Ryan Harkin <ryan.harkin@linaro.org>


  reply	other threads:[~2017-01-20 15:50 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-20 12:06 [PATCH] ArmPkg/ArmLib: remove indirection layer from timer register accessors Ard Biesheuvel
2017-01-20 14:21 ` Leif Lindholm
2017-01-20 14:32 ` Ryan Harkin
2017-01-20 14:35   ` Ard Biesheuvel
2017-01-20 15:50     ` Ryan Harkin [this message]
2017-01-20 15:51       ` Ard Biesheuvel

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='CAD0U-hKvot_M=7rNPT5mz90iAF+r_z_J4htHwq82=1UqsxEqsw@mail.gmail.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