From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wr1-f65.google.com (mail-wr1-f65.google.com [209.85.221.65]) by mx.groups.io with SMTP id smtpd.web10.7118.1574866775964974298 for ; Wed, 27 Nov 2019 06:59:36 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@akeo-ie.20150623.gappssmtp.com header.s=20150623 header.b=rswdUjWT; spf=none, err=permanent DNS error (domain: akeo.ie, ip: 209.85.221.65, mailfrom: pete@akeo.ie) Received: by mail-wr1-f65.google.com with SMTP id c14so2430704wrn.7 for ; Wed, 27 Nov 2019 06:59:35 -0800 (PST) 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=jrvncUCD2MorePD0i0qGDtAY1mdgbrHclfH4PyGi47I=; b=rswdUjWTySoSU6Q7r9Ibme0oUoQ54Q1AF68WSNIkTeTM+O13YDzdrDX+eerWAZwsgX ZPDvjIYdIE4vaX0y54qOju7ZnN2nNNRu4ZJBU+s6n229FbXfbLpfpRWtw5YK77NWn/bn fp8TzjYThqxYek92MR1crr4FPmIwWDtVsJOU3Ry8ueVnH6UiReNm+KeNxH1Vuq5Borcp YdqlsyP9Az1X1w/+1EWc9d7/mEOOykWT4s4p90+V3nkflLhy9ZK+0ACPr4FE19AKim3B 8D4clwAsEWU6vxmwB6rvDte1kReNXExUuLAxqtG96qbphPw9YwCJvdBeDu3Ha+HuAbah mOQw== 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=jrvncUCD2MorePD0i0qGDtAY1mdgbrHclfH4PyGi47I=; b=CM4oA+qyH8uYF6ygHzEFOrCGlzzT6ucTRVIxJqFNAVdFZeV8STRKhYOzTHTMa10oIV +b3XK91EOhIwzPfzUfGc3dN+46r6MlB/9HhUct154mFNLmNf0aUGgko6fcHEJ9NhgUUz HHiZ8xneL+hpXptOt5IbqLtBL3p3e0fQF831fnR2OAXQ+Qik+otRLq1H6GlLg2Oo+3xS xB0HTHOOmvN9MrxUleTbIx9/+6+0QGyaEBih4W4kSCTk5XLU9lIQ/fXOgZgOi6pw3RTM ojuYO+Fc0nn1nBHtRrqDy1uukrIBfVgUDn1FRBMkB/wqZEuJzkpdC5ZI4MKKirb+xqkH th9w== X-Gm-Message-State: APjAAAWeEzETTe2XE+qzscRiBXRSn/IED16Iyt1QM39M5nuRvMPOXN1t Ng9PmoPFHMn12kQokli8xGG5ug== X-Google-Smtp-Source: APXvYqyRDZE714+sCQnmz1txPmz8h2iSVFTrRiQdCJOCQApB1l2QB5KFoujAHEuuBOLUGgFlKLK1Xw== X-Received: by 2002:a5d:49cf:: with SMTP id t15mr35162332wrs.183.1574866774473; Wed, 27 Nov 2019 06:59:34 -0800 (PST) Return-Path: Received: from [10.0.0.122] ([84.203.37.1]) by smtp.googlemail.com with ESMTPSA id m15sm19554128wrj.52.2019.11.27.06.59.31 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 27 Nov 2019 06:59:32 -0800 (PST) Subject: Re: [edk2-devel] [edk2-platforms][PATCH 1/5] Silicon/Bcm283x: Clean up Bcm2836.h header To: devel@edk2.groups.io, philmd@redhat.com 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: "Pete Batard" Message-ID: Date: Wed, 27 Nov 2019 14:59:30 +0000 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.9.1 MIME-Version: 1.0 In-Reply-To: <6832e7c5-5aa7-04e4-0ed6-91165ae900e8@redhat.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-GB Content-Transfer-Encoding: 8bit On 2019.11.27 14:47, Philippe Mathieu-Daudé 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. All these changes belong to a "cleanup" category, which is what, globally, this patch is all about. Of course, I expect people to argue that adding trivial missing data does not count as cleaning up, which I'd disagree with, but then again, it's not my repo. > Why suddenly go back to fixed PERIPHERAL block base address? Earlier version was: #define BCM2836_WDOG_BASE_ADDRESS 0x3f100000 which we replaced with: #define BCM2836_WDOG_BASE_ADDRESS (FixedPcdGet64 (PcdBcm283xRegistersAddress) + BCM2836_WDOG_OFFSET) But considering that we have "BCM2836_SOC_REGISTERS" that now equates "(FixedPcdGet64 (PcdBcm283xRegistersAddress))" we can write the exact same thing as above, only shorter, which we do. I personally find this more understandable for newcomers who'll be looking at the code and easier to maintain. But I'm not the maintainer, so I'll go with whatever suits you. Regards, /Pete > >> >> Signed-off-by: Pete Batard >> --- >>   Silicon/Broadcom/Bcm283x/Include/IndustryStandard/Bcm2836.h | 23 >> ++++++++++++-------- >>   1 file changed, 14 insertions(+), 9 deletions(-) >> >> diff --git >> a/Silicon/Broadcom/Bcm283x/Include/IndustryStandard/Bcm2836.h >> 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 @@ >>   /* watchdog constants */ >>   #define BCM2836_WDOG_OFFSET                                 0x00100000 >> -#define BCM2836_WDOG_BASE_ADDRESS >> (FixedPcdGet64 (PcdBcm283xRegistersAddress) \ >> -                                                            + >> BCM2836_WDOG_OFFSET) >> +#define BCM2836_WDOG_BASE_ADDRESS >> (BCM2836_SOC_REGISTERS + BCM2836_WDOG_OFFSET) >>   #define BCM2836_WDOG_PASSWORD                               0x5a000000 >>   #define BCM2836_WDOG_RSTC_OFFSET                            0x0000001c >>   #define BCM2836_WDOG_WDOG_OFFSET                            0x00000024 >> @@ -34,8 +33,7 @@ >>   /* mailbox interface constants */ >>   #define BCM2836_MBOX_OFFSET                                 0x0000b880 >> -#define BCM2836_MBOX_BASE_ADDRESS >> (FixedPcdGet64 (PcdBcm283xRegistersAddress) \ >> -                                                            + >> BCM2836_MBOX_OFFSET) >> +#define BCM2836_MBOX_BASE_ADDRESS >> (BCM2836_SOC_REGISTERS + BCM2836_MBOX_OFFSET) >>   #define BCM2836_MBOX_READ_OFFSET                            0x00000000 >>   #define BCM2836_MBOX_STATUS_OFFSET                          0x00000018 >>   #define BCM2836_MBOX_CONFIG_OFFSET                          0x0000001c >> @@ -51,12 +49,19 @@ >>   #define BCM2836_INTC_TIMER_PENDING_OFFSET                   0x00000060 >>   /* random number generator */ >> -#define RNG_BASE_ADDRESS   (BCM2836_SOC_REGISTERS + 0x00104000) >> +#define BCM2836_RNG_OFFSET                                  0x00104000 >> +#define RNG_BASE_ADDRESS >> (BCM2836_SOC_REGISTERS + BCM2836_RNG_OFFSET) >> -#define RNG_CTRL           (RNG_BASE_ADDRESS + 0x0) >> -#define RNG_STATUS         (RNG_BASE_ADDRESS + 0x4) >> -#define RNG_DATA           (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    0x1 >> +#define RNG_CTRL_ENABLE                                     0x1 >>   #endif /*__BCM2836_H__ */ >> > > > >