From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from qq.com (qq.com [203.205.251.85]) by mx.groups.io with SMTP id smtpd.web12.1855.1588050586681976754 for ; Mon, 27 Apr 2020 22:09:47 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@qq.com header.s=s201512 header.b=wdj3HP2H; spf=pass (domain: foxmail.com, ip: 203.205.251.85, mailfrom: driver1998@foxmail.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qq.com; s=s201512; t=1588050584; bh=ukAGxn+iXn3rUz1OOlszGqiPcWcd4ZRMT719XkqMfg0=; h=From:To:Cc:Subject:Date; b=wdj3HP2Hyn8u0rtjGn8mG15Zr+wPOgGHFaBMlzPWBrRs9I9IZpfGhIfwblTPAZIzD R0RHFyK2oCMZ+9jTMj2pkKu3yoEjOVCd9Q9jfNTM9oA0Ou7TQakZGdZqtzUnJRBwZI GM3BPjy1qrbmeZX6udlX9iL3S/BWyx/tzHf+a9Ls= Received: from driver1998-Laptop.localdomain ([112.96.194.138]) by newxmesmtplogicsvrszc9.qq.com (NewEsmtp) with SMTP id 26988ABE; Tue, 28 Apr 2020 13:09:41 +0800 X-QQ-mid: xmsmtpt1588050581tuouojsy5 X-QQ-XMAILINFO: MxFHUJXUAyD8eO+aL84c64IcqNjuOtRuAVcDe7Boad3GtueI3/QmOwtTjt9HdN 2up/1diOCxOjEoCp/UjJoC9g4TI4RGiSepDTfE+KiHqunSW1FnNVG4pgb/saEQ5aYvVwhn8abObu 6tANty16uA6a0RxnFZd7kNtaN7fkcnJCJy9LF/c1iyy2SuNYiSEGRPeBZQ+z4Yu6RzJ/sWSfB27C 60a6YEuSSoozAUij6eGeT4pTYGzW1x2TjW09O56yv/WQ32g7eYBeU8xLyJrwPshYqEKREzUNRzEj vX+ArdRr0ZLANfT2ocHP4L3pUBgRBxgQDz4nl/AjGQ0IOq0DNmxousUZLLWdyQFQGRenzrtlmDDq 33Eq8MGwmpKMp0lyRc10lQ7qU0ZvqDSNZLoVpbb9Da47GkWsrKn+PnJcfpoTaJ9u8u2Un0CGCtIZ VgLVp0/I2nybxxzOVd64yJXabN307UWzEp2N2lYeJ+qkzDhmltwG9TTv+Kw/KuP4bMw4pMRuAvg8 DB56FzgQIvBzqSE6x4Tj+Yh9M0k7cGSLcvzQ9o2SlCn0U5L/7h8gJ0309h1Vx1MNLUS9DEyiqsHH aazSEFqTVroOQq5+S9B8Otviw0d4VLIWOb7VV1R3moHidvsY6rni4cu9W0ty5fpMUwMircQwoVsT I+fZffzAh//4VpsYnpY+myXeaptfWKnhXZZ8xkiwKI5F3RW9Nq+PQAsMZRG1yIEfvu8g== From: "GH Cao" To: devel@edk2.groups.io Cc: ard.biesheuvel@arm.com, leif@nuviainc.com, pete@akeo.ie, GH Cao Subject: [edk2-platforms][PATCH] Platform/RaspberryPi: Fix VPU memory ranges in GPU device container Date: Tue, 28 Apr 2020 13:09:40 +0800 Message-Id: <20200428050940.350-1-driver1998@foxmail.com> X-Mailer: git-send-email 2.17.1 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 --- 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