From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wr1-f67.google.com (mail-wr1-f67.google.com [209.85.221.67]) by mx.groups.io with SMTP id smtpd.web12.4576.1588068700455465059 for ; Tue, 28 Apr 2020 03:11:40 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@akeo-ie.20150623.gappssmtp.com header.s=20150623 header.b=s2mKrY2E; spf=none, err=permanent DNS error (domain: akeo.ie, ip: 209.85.221.67, mailfrom: pete@akeo.ie) Received: by mail-wr1-f67.google.com with SMTP id j1so23963748wrt.1 for ; Tue, 28 Apr 2020 03:11:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=akeo-ie.20150623.gappssmtp.com; s=20150623; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=HspDCwmUYi9huuUHvvSMeMBs/1RzlWBf5P+i9swZTZ8=; b=s2mKrY2Ezdk1Pz5vqn81uaq+Bvr41t9vqjefQPws9R8a17NPk5cbUY73w1MwMrrO0H zZdT1S/uASZfnPKVflZ683ykolIa2Vc3W69SziQ9Ur75UoyOYR6/YNnc3Kpks0XgRNjE NVsqhwyhtREi8MJtBX/V4HKsfIem5vMoC1OuZSfqGKP13J0rh+xjxXSfLEjBomxpuW93 bsS0FbvBgTzB7nhIO0OMHm5PlAHW0PxFqPdlVLEkO5dQiuxgCoCMATuq9OlcX3boyNxm JLcEHO6jnEzEfBMLLgiHbXT0XnPYlmrYgLhvrjZCXvuhxKTPPPXSYJa6u0v5yDC8S1pS B1qA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=HspDCwmUYi9huuUHvvSMeMBs/1RzlWBf5P+i9swZTZ8=; b=GQQfyDzWl+Qe+2JWpiaYwwQrc6eItPXjKa3urmcDq79EPke/Nt8IFmwYR3xJFlDB6e MGG9BsXT0xnrOMTqVCn3PaPWsHh2UrZCcLV0MOx9E/w57wP0V/5/4Nz6QnsXtGy8EjPm K9E6yOoNZE/oHAgVDdkREPIN+SnQMM19aZN8bpT7Zs2GeUZiV33gRUMf0SF/U/TxAHkI EgY1Pvso0kbcErl9yM4Db5QJ6FfCbJupZudXUHoYxEblztp5lECZLAMwYUQ2X8Bfpljb 90Yhd+AZwbkZA34XDm+n1PNuSEcOd0Rr8RW1ERxYzqxfnIszoZTfAlUA0JD50HHVb5JC vI4w== X-Gm-Message-State: AGi0PuY9UpYBHk479g/xKWbY6jRwC5eZtnOwBw999xy4VdgK36gRHEfz 76nKEfKjZ2wBhiM4LUUqPPiuTg== X-Google-Smtp-Source: APiQypLaeJE7KyDlc4f8FSzF+2yQot8Z5aU45MZUnzGuC8F47WftOWT123zSwhu3NnR/Lvxu50ZwQw== X-Received: by 2002:a05:6000:108b:: with SMTP id y11mr29938189wrw.380.1588068698963; Tue, 28 Apr 2020 03:11:38 -0700 (PDT) Return-Path: Received: from [10.0.0.122] ([84.203.75.87]) by smtp.googlemail.com with ESMTPSA id h3sm24466711wrm.73.2020.04.28.03.11.37 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 28 Apr 2020 03:11:38 -0700 (PDT) Subject: Re: [edk2-platforms][PATCH] Platform/RaspberryPi: Fix VPU memory ranges in GPU device container To: GH Cao , devel@edk2.groups.io Cc: ard.biesheuvel@arm.com, leif@nuviainc.com References: <20200428050940.350-1-driver1998@foxmail.com> From: "Pete Batard" Message-ID: Date: Tue, 28 Apr 2020 11:11:37 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.7.0 MIME-Version: 1.0 In-Reply-To: <20200428050940.350-1-driver1998@foxmail.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-GB Content-Transfer-Encoding: 7bit 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 > --- > 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