From: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 2/4] MIPS: Fix _ACAST32_ for pointers on MIPS64
Date: Thu, 26 May 2016 01:18:21 +0200 [thread overview]
Message-ID: <574632BD.3000602@gmail.com> (raw)
In-Reply-To: <1463482602-24982-3-git-send-email-paul.burton@imgtec.com>
Am 17.05.2016 um 12:56 schrieb Paul Burton:
> When building for MIPS64 and providing a pointer to _ACAST32_,
> optionally via CPHYSADDR or one of the CKSEGxADDR macros, the cast
> directly to a 32 bit int leads to compilation warnings such as the
> following:
>
> In file included from ./arch/mips/include/asm/io.h:17:0,
> from drivers/net/pcnet.c:14:
> drivers/net/pcnet.c: In function ?pcnet_virt_to_mem?:
> ./arch/mips/include/asm/addrspace.h:39:29: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
> #define _ACAST32_ (_ATYPE_)(_ATYPE32_) /* widen if necessary */
> ^
> ./arch/mips/include/asm/addrspace.h:51:25: note: in expansion of macro ?_ACAST32_?
> #define CPHYSADDR(a) ((_ACAST32_(a)) & 0x1fffffff)
> ^
> ./arch/mips/include/asm/addrspace.h:71:25: note: in expansion of macro ?CPHYSADDR?
> #define CKSEG0ADDR(a) (CPHYSADDR(a) | CKSEG0)
> ^
> drivers/net/pcnet.c:144:23: note: in expansion of macro ?CKSEG0ADDR?
> virt_addr = (void *)CKSEG0ADDR(addr);
> ^
>
> Fix this by first casting provided values to a pointer-width integer,
> then truncating to a 32 bit int & widening back to pointer-width.
>
> Signed-off-by: Paul Burton <paul.burton@imgtec.com>
> ---
>
> arch/mips/include/asm/addrspace.h | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/arch/mips/include/asm/addrspace.h b/arch/mips/include/asm/addrspace.h
> index 0994e96..fe497b5 100644
> --- a/arch/mips/include/asm/addrspace.h
> +++ b/arch/mips/include/asm/addrspace.h
> @@ -36,8 +36,8 @@
> #define _ACAST32_
> #define _ACAST64_
> #else
> -#define _ACAST32_ (_ATYPE_)(_ATYPE32_) /* widen if necessary */
> -#define _ACAST64_ (_ATYPE64_) /* do _not_ narrow */
> +#define _ACAST32_ (_ATYPE_)(_ATYPE32_)(_ATYPE_) /* widen if necessary */
> +#define _ACAST64_ (_ATYPE64_) /* do _not_ narrow */
> #endif
>
> /*
>
could you fix this in the pcnet driver? If possible I want to avoid
U-Boot specific changes on files imported from Linux.
--
- Daniel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: OpenPGP digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160526/21e6301d/attachment.sig>
next prev parent reply other threads:[~2016-05-25 23:18 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-05-17 10:56 [U-Boot] [PATCH 0/4] Malta MIPS64 support Paul Burton
2016-05-17 10:56 ` [U-Boot] [PATCH 1/4] MIPS: Move CONFIG_SYS_TEXT_BASE to Kconfig Paul Burton
2016-05-25 23:01 ` Daniel Schwierzeck
2016-05-17 10:56 ` [U-Boot] [PATCH 2/4] MIPS: Fix _ACAST32_ for pointers on MIPS64 Paul Burton
2016-05-25 23:18 ` Daniel Schwierzeck [this message]
2016-05-26 13:51 ` Paul Burton
2016-05-26 14:46 ` Daniel Schwierzeck
2016-05-17 10:56 ` [U-Boot] [PATCH 3/4] net: pcnet: Make 64 bit safe Paul Burton
2016-05-24 15:25 ` Joe Hershberger
2016-05-24 15:32 ` Paul Burton
2016-05-24 15:38 ` Joe Hershberger
2016-05-17 10:56 ` [U-Boot] [PATCH 4/4] malta: Allow MIPS64 builds Paul Burton
2016-05-17 11:30 ` [U-Boot] [PATCH 0/4] Malta MIPS64 support Daniel Schwierzeck
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=574632BD.3000602@gmail.com \
--to=daniel.schwierzeck@gmail.com \
--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