From: Marek Vasut <marex@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v4 1/3] net: designware: fix descriptor layout and warnings on 64-bit archs
Date: Sun, 17 Apr 2016 22:59:11 +0200 [thread overview]
Message-ID: <5713F91F.4040206@denx.de> (raw)
In-Reply-To: <20160417111422.GA10689@gmail.com>
On 04/17/2016 01:14 PM, Beniamino Galvani wrote:
> 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").
Will cast to uintptr_t and then to u32 help ?
It's just a feeling, but casting to ulong just to circumvent compiler
warning does not sound right.
>> 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.
Which code checks that ?
> Beniamino
>
--
Best regards,
Marek Vasut
next prev parent reply other threads:[~2016-04-17 20:59 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-04-17 7:48 [U-Boot] [PATCH v4 0/3] Amlogic Meson GXBaby and ODROID-C2 support Beniamino Galvani
2016-04-17 7:48 ` [U-Boot] [PATCH v4 1/3] net: designware: fix descriptor layout and warnings on 64-bit archs Beniamino Galvani
2016-04-17 9:56 ` Marek Vasut
2016-04-17 11:14 ` Beniamino Galvani
2016-04-17 20:59 ` Marek Vasut [this message]
2016-04-18 10:57 ` Beniamino Galvani
2016-04-18 11:06 ` Alexander Graf
2016-04-18 21:38 ` Beniamino Galvani
2016-04-18 21:52 ` Alexander Graf
2016-04-25 21:43 ` Joe Hershberger
2016-04-18 11:55 ` Andreas Färber
2016-04-18 22:05 ` Beniamino Galvani
2016-04-17 7:48 ` [U-Boot] [PATCH v4 2/3] arm: add initial support for Amlogic Meson and ODROID-C2 Beniamino Galvani
2016-04-17 7:48 ` [U-Boot] [PATCH v4 3/3] arm: meson: implement calls to secure monitor Beniamino Galvani
2016-04-17 9:48 ` Alexander Graf
2016-04-18 21:50 ` Beniamino Galvani
2016-04-17 10:00 ` Marek Vasut
2016-04-18 21:52 ` Beniamino Galvani
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5713F91F.4040206@denx.de \
--to=marex@denx.de \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox