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.web10.5638.1574859407688932660 for ; Wed, 27 Nov 2019 04:56:48 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@akeo-ie.20150623.gappssmtp.com header.s=20150623 header.b=hRssJ613; 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 g7so5873863wrw.4 for ; Wed, 27 Nov 2019 04:56:47 -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=ByNNGc6wLb708vW3/Zs0ZjWg1CJjGO9kLirMSrGQFmY=; b=hRssJ613b2Ej6TE5y3yvQgpECIF+xP2FmaXc9P6EdHr9ipIaU38ubtIelGs7JanF4P 6x8wUadQtGvsGVhAmpVkgld67cU4R6Ki/+Pw/6w7Xf5DS5CjC5Jrz63u2F8i9MDOqn7S p4q6QMwlPJBKzcveEpVMykmNhMenYyVjL6mTxYCa6cJ75Y37X0bIn94pTQGzYp1Mrc8X R8l+Z5t6w8su4MKiBkmCWoYga5Pumn1wayjtQs9JnsE3yfrODvnXwo4c8TUqt8qZjAC1 8ef9SETisymYI+cy+Att1HOExS+aAE56lKKJfXQyUf+pn2rfd/NwU4YMzopluQP/+hBR U5DA== 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=ByNNGc6wLb708vW3/Zs0ZjWg1CJjGO9kLirMSrGQFmY=; b=kFm9g6Oj+/ReuHNY4z6FdFYzvogkdxrpQDZlIMECZqMsG2rq5vOcjGV2AHDPkLBAEw H0B3ZgVCopdy229wli3O04MyiCOf7fdbgJHZLZ4bzV9Epg3UrhLNyvV8Op9tjtbFst74 QxEiYovUZemZlLhkieByM65U6u26Kt/ktVeXv9sMQOpO4rJvJrxPl8knuotsi6ypr8c7 UY4qUL+10Hr2cwTgFwgHy1LEoYTpH5VzgliWVBy1DC4q35kLvWRERkWCGNJ0z6TUq1LH tO4nwScEtcX2m/V4Ujp6ba8b9WS9dGpoDtbnvgivVLYHEqB7sEGrUXferTxnu1l2LyEZ 7VGA== X-Gm-Message-State: APjAAAW91vkvAzrEdnRExdWgUDw4I16NR5zNtjrGSz74nSPYguFnNxqf l3mkolG3sLj8MwfbRY54ddxtLw== X-Google-Smtp-Source: APXvYqzJzK6XlRGczb8g9ZkgigEiZ9c474YMWrTBGJksOh3wBPCWFQ6v6rcukAgDMEPWovGDW9he9A== X-Received: by 2002:adf:f2d0:: with SMTP id d16mr1285421wrp.314.1574859406241; Wed, 27 Nov 2019 04:56:46 -0800 (PST) Return-Path: Received: from [10.0.0.122] ([84.203.37.1]) by smtp.googlemail.com with ESMTPSA id u13sm6268982wmm.45.2019.11.27.04.56.44 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 27 Nov 2019 04:56:45 -0800 (PST) Subject: Re: [edk2-platforms][PATCH 1/5] Silicon/Bcm283x: Clean up Bcm2836.h header To: Ard Biesheuvel Cc: edk2-devel-groups-io , Leif Lindholm , =?UTF-8?Q?Philippe_Mathieu-Daud=c3=a9?= , samer.el-haj-mahmoud@arm.com, "Andrei E. Warkentin" References: <20191127123706.4604-1-pete@akeo.ie> <20191127123706.4604-2-pete@akeo.ie> From: "Pete Batard" Message-ID: Date: Wed, 27 Nov 2019 12:56:43 +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: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-GB Content-Transfer-Encoding: 7bit On 2019.11.27 12:48, Ard Biesheuvel wrote: > On Wed, 27 Nov 2019 at 13:37, Pete Batard wrote: >> >> Add missing RNG registers, prefer reusing shorter define's >> instead of PCDs and clean up spacing. >> > > Is there a source for these register definitions? I used the most recent Linux driver I could find (but I guess I need to point out that it was used for reference with regards to the registers. Especially, no code was copied from that source). > It seems the Linux > driver deviates from the below (and the warmup count thing uses the > status register as well), so it would be helpful to quote the > authoritative reference here. https://github.com/raspberrypi/linux/blob/rpi-5.4.y/drivers/char/hw_random/iproc-rng200.c#L223-L224 seems to indicate that RNG_WARMUP_COUNT (0x40000) should go into RNG_TOTAL_BIT_COUNT_THRESHOLD_OFFSET (them) / RNG_BIT_COUNT_THRESHOLD (us) and not the status register. Now, of course, since we don't have a public datasheet, it's hard to have absolute certainty on what's the proper register to write, but I guess the most recent code with a Broadcom Corporation copyright has to our next best thing when it comes to authoritative answer... 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__ */ >> -- >> 2.21.0.windows.1 >>