From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.81]) by mx.groups.io with SMTP id smtpd.web12.7408.1574867896927775626 for ; Wed, 27 Nov 2019 07:18:17 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=fmMqr+Sg; spf=pass (domain: redhat.com, ip: 207.211.31.81, mailfrom: philmd@redhat.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1574867895; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=6rwu2g4S5ueLzZgZKfS18AdQhPDCFIBnr1IfXdnrizU=; b=fmMqr+SgY8SmLO2MITl8fzNEVi8pKflIfYANI4PnIAfg3n8S3nXtwcYAy110NCsMcNqObO ER9uWUkvYQLDiYH5o2FuPkpeQAeU21bQbaWkuffBCVmysMgAQn4bcK5CRABd6jyrTa9jBh xAw/x5NbUcAnUVdmmSjstLtIQodOYQE= Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-23-BbVBPHjyNDOLg-9n6FCLHw-1; Wed, 27 Nov 2019 10:18:14 -0500 Received: by mail-wm1-f70.google.com with SMTP id m68so2632223wme.7 for ; Wed, 27 Nov 2019 07:18:13 -0800 (PST) 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=7dNQ2BYYiEIlbeBo20LtLPLECZsVtGrjPC98ODLn3Lk=; b=lu/KPAr0d6XWrg2Ll1kroPkUmsg2CwbEaohyrx20l65x2Bx01S15+ckABgv7Zj5QR3 VmsHKpjzgWtNeCE3bNAf/ofAwbNxrBNvfMhdT7u5PczbC+VlPOWKiUeRUX3Btm305QM+ LXybxYzn7efXfl6vBrZjLcRgnGb+2YYNLDw9hr8r6XPm/ac9do8xsUYTkwIJzU4dKpqq IBQSVFqGQkDj1Sgq6ijdEIXfGaivdRuG8TFf9JyMC3DAxhSdhpDi66X4wbOHfkH73t12 vQNbyPpZxOdWWzr18IpSWlv733FLIAZw3MgGW3CLEF5RmDLAJDpyKINKej54AXhkzNXL tTUw== X-Gm-Message-State: APjAAAWk//ISHkt2Y5u0++FWaL1DUBnP7EdIEf/ngmWNEx2w2NAKShW6 ottI8lPxrr5mvis8vRrdOqJu80sOIhw/UOhb0mR2GSc7sCM1omGDY9q8azVQztHfNoe5twPNvXG ezMxw9Rfg1bV23A== X-Received: by 2002:adf:ef51:: with SMTP id c17mr46573106wrp.266.1574867892111; Wed, 27 Nov 2019 07:18:12 -0800 (PST) X-Google-Smtp-Source: APXvYqz3ywbzGvpYN/S5qH/fgxl1huGAi4U3rB0hE3L+Sys7ygzntuVd16NM+DSdsBnRyX7jVINtsQ== X-Received: by 2002:adf:ef51:: with SMTP id c17mr46573075wrp.266.1574867891814; Wed, 27 Nov 2019 07:18:11 -0800 (PST) Return-Path: Received: from [192.168.1.35] (182.red-88-21-103.staticip.rima-tde.net. [88.21.103.182]) by smtp.gmail.com with ESMTPSA id w4sm7283378wmk.29.2019.11.27.07.18.10 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 27 Nov 2019 07:18:10 -0800 (PST) Subject: Re: [edk2-devel] [edk2-platforms][PATCH 1/5] Silicon/Bcm283x: Clean up Bcm2836.h header To: Pete Batard , devel@edk2.groups.io Cc: ard.biesheuvel@linaro.org, leif.lindholm@linaro.org, samer.el-haj-mahmoud@arm.com, andrey.warkentin@gmail.com References: <20191127123706.4604-1-pete@akeo.ie> <20191127123706.4604-2-pete@akeo.ie> <6832e7c5-5aa7-04e4-0ed6-91165ae900e8@redhat.com> From: =?UTF-8?B?UGhpbGlwcGUgTWF0aGlldS1EYXVkw6k=?= Message-ID: <887fe65d-1279-db7f-5478-26dd180b2880@redhat.com> Date: Wed, 27 Nov 2019 16:18:08 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.1.1 MIME-Version: 1.0 In-Reply-To: X-MC-Unique: BbVBPHjyNDOLg-9n6FCLHw-1 X-Mimecast-Spam-Score: 0 Content-Language: en-US Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: quoted-printable On 11/27/19 3:59 PM, Pete Batard wrote: > On 2019.11.27 14:47, Philippe Mathieu-Daud=C3=A9 wrote: >> On 11/27/19 1:37 PM, Pete Batard wrote: >>> Add missing RNG registers, >> >> This is one change. >> >>> prefer reusing shorter define's >>> instead of PCDs and clean up spacing. >> >> This is another change. >=20 > All these changes belong to a "cleanup" category, which is what,=20 > globally, this patch is all about. Of course, I expect people to argue= =20 > that adding trivial missing data does not count as cleaning up, which=20 > I'd disagree with, but then again, it's not my repo. >=20 >> Why suddenly go back to fixed PERIPHERAL block base address? >=20 > Earlier version was: >=20 > #define BCM2836_WDOG_BASE_ADDRESS=C2=A0=C2=A0=C2=A0 0x3f100000 >=20 > which we replaced with: >=20 > #define BCM2836_WDOG_BASE_ADDRESS=C2=A0=C2=A0 (FixedPcdGet64=20 > (PcdBcm283xRegistersAddress) + BCM2836_WDOG_OFFSET) >=20 > But considering that we have "BCM2836_SOC_REGISTERS" that now equates=20 > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0 "(FixedPcdGet64=20 > (PcdBcm283xRegistersAddress))" we can write the exact same thing as=20 > above, only shorter, which we do. I apologize I misread the code, you are right it is cleaner to use=20 BCM2836_SOC_REGISTERS. Thanks for taking time to clarify. > I personally find this more understandable for newcomers who'll be=20 > looking at the code and easier to maintain. But I'm not the maintainer,= =20 > so I'll go with whatever suits you. Neither am I, however I'll appreciate if you can keep patches simple,=20 trying to do one atomic change per patch. So my suggestion to split this= =20 patch in 2 stands. Anyhow Ard asked for a clone for the RNG part, so this patch need rework. >>> >>> Signed-off-by: Pete Batard >>> --- >>> =C2=A0 Silicon/Broadcom/Bcm283x/Include/IndustryStandard/Bcm2836.h | 2= 3=20 >>> ++++++++++++-------- >>> =C2=A0 1 file changed, 14 insertions(+), 9 deletions(-) >>> >>> diff --git=20 >>> a/Silicon/Broadcom/Bcm283x/Include/IndustryStandard/Bcm2836.h=20 >>> b/Silicon/Broadcom/Bcm283x/Include/IndustryStandard/Bcm2836.h >>> index 72c8e9dc4b14..744c7ac3b9f4 100644 >>> --- a/Silicon/Broadcom/Bcm283x/Include/IndustryStandard/Bcm2836.h >>> +++ b/Silicon/Broadcom/Bcm283x/Include/IndustryStandard/Bcm2836.h >>> @@ -24,8 +24,7 @@ >>> =C2=A0 /* watchdog constants */ >>> =C2=A0 #define BCM2836_WDOG_OFFSET=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= = =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0 0x00100000 >>> -#define BCM2836_WDOG_BASE_ADDRESS (FixedPcdGet64=20 >>> (PcdBcm283xRegistersAddress) \ >>> -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= = =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 +=20 >>> BCM2836_WDOG_OFFSET) >>> +#define BCM2836_WDOG_BASE_ADDRESS (BCM2836_SOC_REGISTERS +=20 >>> BCM2836_WDOG_OFFSET) >>> =C2=A0 #define BCM2836_WDOG_PASSWORD=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0 0x5a000000 >>> =C2=A0 #define BCM2836_WDOG_RSTC_OFFSET=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 0x0000001c >>> =C2=A0 #define BCM2836_WDOG_WDOG_OFFSET=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 0x00000024 >>> @@ -34,8 +33,7 @@ >>> =C2=A0 /* mailbox interface constants */ >>> =C2=A0 #define BCM2836_MBOX_OFFSET=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= = =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0 0x0000b880 >>> -#define BCM2836_MBOX_BASE_ADDRESS (FixedPcdGet64=20 >>> (PcdBcm283xRegistersAddress) \ >>> -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= = =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 +=20 >>> BCM2836_MBOX_OFFSET) >>> +#define BCM2836_MBOX_BASE_ADDRESS (BCM2836_SOC_REGISTERS +=20 >>> BCM2836_MBOX_OFFSET) >>> =C2=A0 #define BCM2836_MBOX_READ_OFFSET=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 0x00000000 >>> =C2=A0 #define BCM2836_MBOX_STATUS_OFFSET=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 0x00000018 >>> =C2=A0 #define BCM2836_MBOX_CONFIG_OFFSET=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 0x0000001c >>> @@ -51,12 +49,19 @@ >>> =C2=A0 #define BCM2836_INTC_TIMER_PENDING_OFFSET=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0 0x00000060 >>> =C2=A0 /* random number generator */ >>> -#define RNG_BASE_ADDRESS=C2=A0=C2=A0 (BCM2836_SOC_REGISTERS + 0x00104= 000) >>> +#define BCM2836_RNG_OFFSET=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0 0x00104000 >>> +#define RNG_BASE_ADDRESS (BCM2836_SOC_REGISTERS + BCM2836_RNG_OFFSET) >>> -#define RNG_CTRL=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0 (RNG_BASE_ADDRESS + 0x0) >>> -#define RNG_STATUS=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (R= NG_BASE_ADDRESS + 0x4) >>> -#define RNG_DATA=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0 (RNG_BASE_ADDRESS + 0x8) >>> +#define RNG_CTRL (RNG_BASE_ADDRESS + 0x0) >>> +#define RNG_STATUS (RNG_BASE_ADDRESS + 0x4) >>> +#define RNG_DATA (RNG_BASE_ADDRESS + 0x8) >>> +#define RNG_BIT_COUNT (RNG_BASE_ADDRESS + 0xc) >>> +#define RNG_BIT_COUNT_THRESHOLD (RNG_BASE_ADDRESS + 0x10) >>> +#define RNG_INT_STATUS (RNG_BASE_ADDRESS + 0x18) >>> +#define RNG_INT_ENABLE (RNG_BASE_ADDRESS + 0x1c) >>> +#define RNG_FIFO_DATA (RNG_BASE_ADDRESS + 0x20) >>> +#define RNG_FIFO_COUNT (RNG_BASE_ADDRESS + 0x24) >>> -#define RNG_CTRL_ENABLE=C2=A0=C2=A0=C2=A0 0x1 >>> +#define RNG_CTRL_ENABLE=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0 0x1 >>> =C2=A0 #endif /*__BCM2836_H__ */ >>> >> >> >>=20 >> >=20