public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Andrei Warkentin" <andrey.warkentin@gmail.com>
To: devel@edk2.groups.io, driver1998@foxmail.com
Subject: Re: [edk2-devel] [edk2-platforms][PATCH] Platform/RaspberryPi: Fix VPU memory ranges in GPU device container
Date: Tue, 28 Apr 2020 18:02:28 -0500	[thread overview]
Message-ID: <CANz0V+59_UgUtsws+LWZSdFkdL=-pTbRw+eUKA2SA9wXBXG31A@mail.gmail.com> (raw)
In-Reply-To: <20200428050940.350-1-driver1998@foxmail.com>

[-- Attachment #1: Type: text/plain, Size: 3636 bytes --]

Reviewed-by: Andrei Warkentin <andrey.warkentin@gmail.com>

Note that this not normal - ACPI resources aren't supposed to encode bus
and CPU resources in this fashion. This may mean the device will fail
admission on some OSes, and ultimately may mean the PWM device definition
will be hidden behind an "OS choice" UEFI setup option. I get that this is
how the driver is consuming it, but consider that the driver (
https://github.com/ms-iot/rpi-iotcore/tree/master/drivers/pwm) is also open
source and should be evolving as well.

A

On Tue, Apr 28, 2020 at 1:34 AM GH Cao <driver1998@foxmail.com> 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
> --
> 2.17.1
>
>
> 
>
>

-- 
A

[-- Attachment #2: Type: text/html, Size: 4685 bytes --]

      parent reply	other threads:[~2020-04-28 23:02 UTC|newest]

Thread overview: 3+ 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
2020-04-28 23:02 ` Andrei Warkentin [this message]

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='CANz0V+59_UgUtsws+LWZSdFkdL=-pTbRw+eUKA2SA9wXBXG31A@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