* [U-Boot] [RFC v2] Fix memory commands for 64-bit platforms
@ 2014-02-12 23:55 York Sun
2014-02-13 7:16 ` Wolfgang Denk
2014-02-21 19:59 ` [U-Boot] [U-Boot, RFC, " Tom Rini
0 siblings, 2 replies; 5+ messages in thread
From: York Sun @ 2014-02-12 23:55 UTC (permalink / raw)
To: u-boot
For aarch64, unsigned long is 64-bit data. Memory commands should be fixed
with u32 for 32-bit address access. To be clear, ushort is replace with
u16, u_char is replaced with u8.
Signed-off-by: York Sun <yorksun@freescale.com>
---
Change log:
v1: Replace ulong with u32, ushort with u16, u_char with u8. Add 64-bit data support.
v2: Drop 64-bit data support. Change subject.
common/cmd_mem.c | 72 +++++++++++++++++++++++++++---------------------------
1 file changed, 36 insertions(+), 36 deletions(-)
diff --git a/common/cmd_mem.c b/common/cmd_mem.c
index c3aab3d..1cc8f21 100644
--- a/common/cmd_mem.c
+++ b/common/cmd_mem.c
@@ -188,11 +188,11 @@ static int do_mem_mw(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
buf = map_sysmem(addr, bytes);
while (count-- > 0) {
if (size == 4)
- *((ulong *)buf) = (ulong)writeval;
+ *((u32 *)buf) = (u32)writeval;
else if (size == 2)
- *((ushort *)buf) = (ushort)writeval;
+ *((u16 *)buf) = (u16)writeval;
else
- *((u_char *)buf) = (u_char)writeval;
+ *((u8 *)buf) = (u8)writeval;
buf += size;
}
unmap_sysmem(buf);
@@ -300,14 +300,14 @@ static int do_mem_cmp(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
for (ngood = 0; ngood < count; ++ngood) {
ulong word1, word2;
if (size == 4) {
- word1 = *(ulong *)buf1;
- word2 = *(ulong *)buf2;
+ word1 = *(u32 *)buf1;
+ word2 = *(u32 *)buf2;
} else if (size == 2) {
- word1 = *(ushort *)buf1;
- word2 = *(ushort *)buf2;
+ word1 = *(u16 *)buf1;
+ word2 = *(u16 *)buf2;
} else {
- word1 = *(u_char *)buf1;
- word2 = *(u_char *)buf2;
+ word1 = *(u8 *)buf1;
+ word2 = *(u8 *)buf2;
}
if (word1 != word2) {
ulong offset = buf1 - base;
@@ -433,11 +433,11 @@ static int do_mem_cp(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
src = map_sysmem(addr, bytes);
while (count-- > 0) {
if (size == 4)
- *((ulong *)buf) = *((ulong *)src);
+ *((u32 *)buf) = *((u32 *)src);
else if (size == 2)
- *((ushort *)buf) = *((ushort *)src);
+ *((u16 *)buf) = *((u16 *)src);
else
- *((u_char *)buf) = *((u_char *)src);
+ *((u8 *)buf) = *((u8 *)src);
src += size;
buf += size;
@@ -467,9 +467,9 @@ static int do_mem_loop(cmd_tbl_t *cmdtp, int flag, int argc,
{
ulong addr, length, i, bytes;
int size;
- volatile uint *longp;
- volatile ushort *shortp;
- volatile u_char *cp;
+ volatile u32 *longp;
+ volatile u16 *shortp;
+ volatile u8 *cp;
const void *buf;
if (argc < 3)
@@ -498,23 +498,23 @@ static int do_mem_loop(cmd_tbl_t *cmdtp, int flag, int argc,
*/
if (length == 1) {
if (size == 4) {
- longp = (uint *)buf;
+ longp = (u32 *)buf;
for (;;)
i = *longp;
}
if (size == 2) {
- shortp = (ushort *)buf;
+ shortp = (u16 *)buf;
for (;;)
i = *shortp;
}
- cp = (u_char *)buf;
+ cp = (u8 *)buf;
for (;;)
i = *cp;
}
if (size == 4) {
for (;;) {
- longp = (uint *)buf;
+ longp = (u32 *)buf;
i = length;
while (i-- > 0)
*longp++;
@@ -522,14 +522,14 @@ static int do_mem_loop(cmd_tbl_t *cmdtp, int flag, int argc,
}
if (size == 2) {
for (;;) {
- shortp = (ushort *)buf;
+ shortp = (u16 *)buf;
i = length;
while (i-- > 0)
*shortp++;
}
}
for (;;) {
- cp = (u_char *)buf;
+ cp = (u8 *)buf;
i = length;
while (i-- > 0)
*cp++;
@@ -544,9 +544,9 @@ int do_mem_loopw (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
{
ulong addr, length, i, data, bytes;
int size;
- volatile uint *longp;
- volatile ushort *shortp;
- volatile u_char *cp;
+ volatile u32 *longp;
+ volatile u16 *shortp;
+ volatile u8 *cp;
void *buf;
if (argc < 4)
@@ -578,23 +578,23 @@ int do_mem_loopw (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
*/
if (length == 1) {
if (size == 4) {
- longp = (uint *)buf;
+ longp = (u32 *)buf;
for (;;)
*longp = data;
}
if (size == 2) {
- shortp = (ushort *)buf;
+ shortp = (u16 *)buf;
for (;;)
*shortp = data;
}
- cp = (u_char *)buf;
+ cp = (u8 *)buf;
for (;;)
*cp = data;
}
if (size == 4) {
for (;;) {
- longp = (uint *)buf;
+ longp = (u32 *)buf;
i = length;
while (i-- > 0)
*longp++ = data;
@@ -602,14 +602,14 @@ int do_mem_loopw (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
}
if (size == 2) {
for (;;) {
- shortp = (ushort *)buf;
+ shortp = (u16 *)buf;
i = length;
while (i-- > 0)
*shortp++ = data;
}
}
for (;;) {
- cp = (u_char *)buf;
+ cp = (u8 *)buf;
i = length;
while (i-- > 0)
*cp++ = data;
@@ -1050,11 +1050,11 @@ mod_mem(cmd_tbl_t *cmdtp, int incrflag, int flag, int argc, char * const argv[])
ptr = map_sysmem(addr, size);
printf("%08lx:", addr);
if (size == 4)
- printf(" %08x", *((uint *)ptr));
+ printf(" %08x", *((u32 *)ptr));
else if (size == 2)
- printf(" %04x", *((ushort *)ptr));
+ printf(" %04x", *((u16 *)ptr));
else
- printf(" %02x", *((u_char *)ptr));
+ printf(" %02x", *((u8 *)ptr));
nbytes = readline (" ? ");
if (nbytes == 0 || (nbytes == 1 && console_buffer[0] == '-')) {
@@ -1084,11 +1084,11 @@ mod_mem(cmd_tbl_t *cmdtp, int incrflag, int flag, int argc, char * const argv[])
reset_cmd_timeout();
#endif
if (size == 4)
- *((uint *)ptr) = i;
+ *((u32 *)ptr) = i;
else if (size == 2)
- *((ushort *)ptr) = i;
+ *((u16 *)ptr) = i;
else
- *((u_char *)ptr) = i;
+ *((u8 *)ptr) = i;
if (incrflag)
addr += size;
}
--
1.7.9.5
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [U-Boot] [RFC v2] Fix memory commands for 64-bit platforms
2014-02-12 23:55 [U-Boot] [RFC v2] Fix memory commands for 64-bit platforms York Sun
@ 2014-02-13 7:16 ` Wolfgang Denk
2014-02-13 16:57 ` York Sun
2014-02-21 19:59 ` [U-Boot] [U-Boot, RFC, " Tom Rini
1 sibling, 1 reply; 5+ messages in thread
From: Wolfgang Denk @ 2014-02-13 7:16 UTC (permalink / raw)
To: u-boot
Dear York Sun,
In message <1392249335-29538-1-git-send-email-yorksun@freescale.com> you wrote:
> For aarch64, unsigned long is 64-bit data. Memory commands should be fixed
> with u32 for 32-bit address access. To be clear, ushort is replace with
> u16, u_char is replaced with u8.
>
> Signed-off-by: York Sun <yorksun@freescale.com>
> ---
> Change log:
> v1: Replace ulong with u32, ushort with u16, u_char with u8. Add 64-bit data support.
> v2: Drop 64-bit data support. Change subject.
Acked-by: Wolfgang Denk <wd@denx.de>
Can you please submit another patch adding the 64 bit support again?
I agree with Albert's comment that it makes sense to implement it such
that it is automatically active on 64 bit systems, but can optionally
also enabled on 32 bit systems.
Thanks in advance.
Best regards,
Wolfgang Denk
--
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
The following statement is not true. The previous statement is true.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [U-Boot] [RFC v2] Fix memory commands for 64-bit platforms
2014-02-13 7:16 ` Wolfgang Denk
@ 2014-02-13 16:57 ` York Sun
2014-02-13 17:22 ` Wolfgang Denk
0 siblings, 1 reply; 5+ messages in thread
From: York Sun @ 2014-02-13 16:57 UTC (permalink / raw)
To: u-boot
On 02/12/2014 11:16 PM, Wolfgang Denk wrote:
> Dear York Sun,
>
> In message <1392249335-29538-1-git-send-email-yorksun@freescale.com> you wrote:
>> For aarch64, unsigned long is 64-bit data. Memory commands should be fixed
>> with u32 for 32-bit address access. To be clear, ushort is replace with
>> u16, u_char is replaced with u8.
>>
>> Signed-off-by: York Sun <yorksun@freescale.com>
>> ---
>> Change log:
>> v1: Replace ulong with u32, ushort with u16, u_char with u8. Add 64-bit data support.
>> v2: Drop 64-bit data support. Change subject.
>
> Acked-by: Wolfgang Denk <wd@denx.de>
>
>
> Can you please submit another patch adding the 64 bit support again?
> I agree with Albert's comment that it makes sense to implement it such
> that it is automatically active on 64 bit systems, but can optionally
> also enabled on 32 bit systems.
>
OK. Will do.
Since you acked this patch, I will let Tom pick it up without resending a new
version with RFC removed from subject.
York
^ permalink raw reply [flat|nested] 5+ messages in thread
* [U-Boot] [RFC v2] Fix memory commands for 64-bit platforms
2014-02-13 16:57 ` York Sun
@ 2014-02-13 17:22 ` Wolfgang Denk
0 siblings, 0 replies; 5+ messages in thread
From: Wolfgang Denk @ 2014-02-13 17:22 UTC (permalink / raw)
To: u-boot
Dear York,
In message <52FCF971.7070208@freescale.com> you wrote:
> >
> > Can you please submit another patch adding the 64 bit support again?
> > I agree with Albert's comment that it makes sense to implement it such
> > that it is automatically active on 64 bit systems, but can optionally
> > also enabled on 32 bit systems.
>
> OK. Will do.
Thanks.
> Since you acked this patch, I will let Tom pick it up without resending a new
> version with RFC removed from subject.
Makes sense.
Best regards,
Wolfgang Denk
--
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Every revolutionary idea - in science, politics, art, or whatever -
evokes three stages of reaction in a hearer:
1. It is completely impossible - don't waste my time.
2. It is possible, but it is not worth doing.
3. I said it was a good idea all along.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [U-Boot] [U-Boot, RFC, v2] Fix memory commands for 64-bit platforms
2014-02-12 23:55 [U-Boot] [RFC v2] Fix memory commands for 64-bit platforms York Sun
2014-02-13 7:16 ` Wolfgang Denk
@ 2014-02-21 19:59 ` Tom Rini
1 sibling, 0 replies; 5+ messages in thread
From: Tom Rini @ 2014-02-21 19:59 UTC (permalink / raw)
To: u-boot
On Wed, Feb 12, 2014 at 03:55:35PM -0800, York Sun wrote:
> For aarch64, unsigned long is 64-bit data. Memory commands should be fixed
> with u32 for 32-bit address access. To be clear, ushort is replace with
> u16, u_char is replaced with u8.
>
> Signed-off-by: York Sun <yorksun@freescale.com>
> Acked-by: Wolfgang Denk <wd@denx.de>
Applied to u-boot/master, thanks!
--
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20140221/eb50c62d/attachment.pgp>
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2014-02-21 19:59 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-02-12 23:55 [U-Boot] [RFC v2] Fix memory commands for 64-bit platforms York Sun
2014-02-13 7:16 ` Wolfgang Denk
2014-02-13 16:57 ` York Sun
2014-02-13 17:22 ` Wolfgang Denk
2014-02-21 19:59 ` [U-Boot] [U-Boot, RFC, " Tom Rini
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.