* [edk2-platforms][PATCH] Platform/RaspberryPi: Fix VPU memory ranges in GPU device container
@ 2020-04-28 1:22 GH Cao
0 siblings, 0 replies; 3+ messages in thread
From: GH Cao @ 2020-04-28 1:22 UTC (permalink / raw)
To: devel; +Cc: GH Cao
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
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [edk2-platforms][PATCH] Platform/RaspberryPi: Fix VPU memory ranges in GPU device container
@ 2020-04-28 5:09 GH Cao
2020-04-28 10:11 ` Pete Batard
0 siblings, 1 reply; 3+ messages in thread
From: GH Cao @ 2020-04-28 5:09 UTC (permalink / raw)
To: devel; +Cc: ard.biesheuvel, leif, pete, GH Cao
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
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [edk2-platforms][PATCH] Platform/RaspberryPi: Fix VPU memory ranges in GPU device container
2020-04-28 5:09 GH Cao
@ 2020-04-28 10:11 ` Pete Batard
0 siblings, 0 replies; 3+ messages in thread
From: Pete Batard @ 2020-04-28 10:11 UTC (permalink / raw)
To: GH Cao, devel; +Cc: ard.biesheuvel, leif
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>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-04-28 10:11 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-04-28 1:22 [edk2-platforms][PATCH] Platform/RaspberryPi: Fix VPU memory ranges in GPU device container GH Cao
-- strict thread matches above, loose matches on Subject: below --
2020-04-28 5:09 GH Cao
2020-04-28 10:11 ` Pete Batard
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox