From mboxrd@z Thu Jan 1 00:00:00 1970 From: Beniamino Galvani Date: Sun, 17 Apr 2016 13:14:22 +0200 Subject: [U-Boot] [PATCH v4 1/3] net: designware: fix descriptor layout and warnings on 64-bit archs In-Reply-To: <57135DEA.4000609@denx.de> References: <1460879338-7671-1-git-send-email-b.galvani@gmail.com> <1460879338-7671-2-git-send-email-b.galvani@gmail.com> <57135DEA.4000609@denx.de> Message-ID: <20160417111422.GA10689@gmail.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On Sun, Apr 17, 2016 at 11:56:58AM +0200, Marek Vasut wrote: > > - desc_p->dmamac_addr = &txbuffs[idx * CONFIG_ETH_BUFSIZE]; > > - desc_p->dmamac_next = &desc_table_p[idx + 1]; > > + desc_p->dmamac_addr = (ulong)&txbuffs[idx * CONFIG_ETH_BUFSIZE]; > > + desc_p->dmamac_next = (ulong)&desc_table_p[idx + 1]; > > Why don't you use u32 instead of ulong ? The u32 is well defined. > DTTO all over the place. &txbuffs[idx * CONFIG_ETH_BUFSIZE] is a pointer (and hence has the size of a ulong) and casting it to u32 would give a warning on 64 bit archs ("cast from pointer to integer of different size"). > btw just curious, but what will happen if the descriptors get allocated > in area above 4GiB ? Will the code silently corrupt memory by discarding > the top bits in the descriptor pointer? No, if the driver private structure (which contains buffers and descriptors) is above 4GiB, designware_initialize() will complain and return an error. Beniamino