From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from qq.com (qq.com [203.205.221.155]) by mx.groups.io with SMTP id smtpd.web11.2717.1588036997130616195 for ; Mon, 27 Apr 2020 18:23:17 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@qq.com header.s=s201512 header.b=ovN644QL; spf=pass (domain: foxmail.com, ip: 203.205.221.155, mailfrom: driver1998@foxmail.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qq.com; s=s201512; t=1588036994; bh=ukAGxn+iXn3rUz1OOlszGqiPcWcd4ZRMT719XkqMfg0=; h=From:To:Cc:Subject:Date; b=ovN644QLrHE95aGA/il+yOxKpk+JifMNbPmKksz6u2zXHQH3VpHO9QaJw5i5Y7VwX UvbKhHFM9PsffmLZKPodkz0ZQdAuiPbVmeeKcnkMHHivdANiMPHH1k0Lz3664T69di 9MZUdbX4Me2kJ4uXpyb+5dp+mMvjJViB6IIUlby8= Received: from driver1998-Laptop.localdomain ([112.96.70.88]) by newxmesmtplogicsvrsza7.qq.com (NewEsmtp) with SMTP id 5C60CA11; Tue, 28 Apr 2020 09:23:06 +0800 X-QQ-mid: xmsmtpt1588036986tkqwwumkp X-QQ-XMAILINFO: MYGzeLN4m+PuiYpKhAwfX5DUxiARNT1LvYVPX1ZQMOCEdMEienWE6IXkjHJszm ptunds6584BYlzVJQyqPT3ejpMZUKHsu+561dTsyjEskEfvDpSS+XiosMeC9JrZj9N0BdQviNDtu uWYUpIo0tnPiuJiK/5PU7jkdiqWbTa1/rM1DLrUNw6jVl5KL+ab7KXZrT4yRKKD+kx6AunJ7f57V H6beBQ/ySz6s6zj3K4HG+GCDu3XtYPeDn6T8K3FWX1wuqqW8ubd3xEXISnJ+jVsWeTenTRO8mUSV 8TWi54R9eEehM8N5NjPLpICulKwSgtdya3KypgNWgneOoRUVI6pyFJBW0ABPRDiqUSVltowI6gQy g1pu+CFj1NMAVCxFIflRXUi8h8Cmxp6sbc+wigs2x00dkIJJ774nJ7cr2zncOJxvvc+EyMddPuHR UvRwbR5vfG9GBwOYy23TUZwkmhzXWXIOz3JK1Cb3GSFzc2sliNdc4k0vQNMLMHiP16kWS4W42H40 X8iphkvBSK1q+3vexA/J7A3e5lqoEH/n7keevyNbzhfM62/0ni+EOHfG75vGWX5ECiUbvg3TknV7 +UMwriVy+jcU/mZHEnAQE+BSp1MqOEhwJHrwG2zEHCTtFFA6MC8v+0aFDf8oqoV4D7eVAGz+rFMb 9udVBaq2ZeYrlHJO2T0rRftzHrla47KglSQdX+mZqioz/ydAxJ7wrJYUw= From: GH Cao To: devel@edk2.groups.io Cc: GH Cao Subject: [edk2-platforms][PATCH] Platform/RaspberryPi: Fix VPU memory ranges in GPU device container Date: Tue, 28 Apr 2020 09:22:51 +0800 Message-Id: <20200428012251.24459-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