public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Pete Batard" <pete@akeo.ie>
To: GH Cao <driver1998@foxmail.com>, devel@edk2.groups.io
Cc: ard.biesheuvel@arm.com, leif@nuviainc.com
Subject: Re: [edk2-platforms][PATCH] Platform/RaspberryPi: Fix VPU memory ranges in GPU device container
Date: Tue, 28 Apr 2020 11:11:37 +0100	[thread overview]
Message-ID: <e03cb14a-f8bd-d873-d175-d5f8a48233c7@akeo.ie> (raw)
In-Reply-To: <20200428050940.350-1-driver1998@foxmail.com>

On 2020.04.28 06:09, GH Cao wrote:
> The PWM controller device specifies both CPU and VPU memory ranges.
> CPU base addresses are provided as offsets to BCM2836_SOC_REGISTERS,
> and VPU base addresses are constants.
> 
> But in Dsdt.asl, both offsets and constant addresses are seen as offsets
> by QWORDMEMORYSET macro, result in incorrect VPU memory ranges.
> 
> This commits adds a new QWORDBUSMEMORYSET macro to handle VPU memory
> ranges with constant base addresses.
> 
> Signed-off-by: GH Cao <driver1998@foxmail.com>
> ---
>   Platform/RaspberryPi/AcpiTables/Dsdt.asl | 18 +++++++++++++++---
>   1 file changed, 15 insertions(+), 3 deletions(-)
> 
> diff --git a/Platform/RaspberryPi/AcpiTables/Dsdt.asl b/Platform/RaspberryPi/AcpiTables/Dsdt.asl
> index 95766b0..ddaf1d4 100644
> --- a/Platform/RaspberryPi/AcpiTables/Dsdt.asl
> +++ b/Platform/RaspberryPi/AcpiTables/Dsdt.asl
> @@ -31,7 +31,11 @@
>   // The ASL compiler does not support argument arithmetic in functions
>   // like QWordMemory (). So we need to instantiate dummy qword regions
>   // that we can then update the Min, Max and Length attributes of.
> -// The two macros below help accomplish this.
> +// The three macros below help accomplish this.
> +//
> +// QWORDMEMORYSET specifies a CPU memory range (whose base address is
> +// BCM2836_SOC_REGISTERS + Offset), and QWORDBUSMEMORYSET specifies
> +// a VPU memory range (whose base address is provided directly).
>   //
>   #define QWORDMEMORYBUF(Index)                                   \
>     QWordMemory (ResourceProducer,,                               \
> @@ -46,6 +50,14 @@
>     Add (BCM2836_SOC_REGISTERS, Offset, MI ## Index)              \
>     Add (MI ## Index, LE ## Index - 1, MA ## Index)
>   
> +#define QWORDBUSMEMORYSET(Index, Base, Length)                  \
> +  CreateQwordField (RBUF, RB ## Index._MIN, MI ## Index)        \
> +  CreateQwordField (RBUF, RB ## Index._MAX, MA ## Index)        \
> +  CreateQwordField (RBUF, RB ## Index._LEN, LE ## Index)        \
> +  Store (Base, MI ## Index)                                     \
> +  Store (Length, LE ## Index)                                   \
> +  Add (MI ## Index, LE ## Index - 1, MA ## Index)
> +
>   DefinitionBlock ("Dsdt.aml", "DSDT", 5, "RPIFDN", "RPI", 2)
>   {
>     Scope (\_SB_)
> @@ -173,8 +185,8 @@ DefinitionBlock ("Dsdt.aml", "DSDT", 5, "RPIFDN", "RPI", 2)
>           // PWM
>           QWORDMEMORYSET(17, BCM2836_PWM_DMA_OFFSET, BCM2836_PWM_DMA_LENGTH)
>           QWORDMEMORYSET(18, BCM2836_PWM_CTRL_OFFSET, BCM2836_PWM_CTRL_LENGTH)
> -        QWORDMEMORYSET(19, BCM2836_PWM_BUS_BASE_ADDRESS, BCM2836_PWM_BUS_LENGTH)
> -        QWORDMEMORYSET(20, BCM2836_PWM_CTRL_UNCACHED_BASE_ADDRESS, BCM2836_PWM_CTRL_UNCACHED_LENGTH)
> +        QWORDBUSMEMORYSET(19, BCM2836_PWM_BUS_BASE_ADDRESS, BCM2836_PWM_BUS_LENGTH)
> +        QWORDBUSMEMORYSET(20, BCM2836_PWM_CTRL_UNCACHED_BASE_ADDRESS, BCM2836_PWM_CTRL_UNCACHED_LENGTH)
>           QWORDMEMORYSET(21, BCM2836_PWM_CLK_OFFSET, BCM2836_PWM_CLK_LENGTH)
>   
>           // UART
> 

Reviewed-by: Pete Batard <pete@akeo.ie>


  reply	other threads:[~2020-04-28 10:11 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-28  5:09 [edk2-platforms][PATCH] Platform/RaspberryPi: Fix VPU memory ranges in GPU device container GH Cao
2020-04-28 10:11 ` Pete Batard [this message]
2020-04-28 23:02 ` [edk2-devel] " Andrei Warkentin
  -- strict thread matches above, loose matches on Subject: below --
2020-04-28  1:22 GH Cao

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=e03cb14a-f8bd-d873-d175-d5f8a48233c7@akeo.ie \
    --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