From: Scott Wood <scottwood@freescale.com>
To: u-boot@lists.denx.de
Subject: [U-Boot-Users] [PATCH][FDT][UPDATE] Add common memory fixup function
Date: Wed, 28 Nov 2007 16:38:05 -0600 [thread overview]
Message-ID: <474DEDCD.1070009@freescale.com> (raw)
In-Reply-To: <8D4815F8-349A-4A3C-8642-38393F6617CF@kernel.crashing.org>
Kumar Gala wrote:
>
> On Nov 28, 2007, at 4:16 PM, Scott Wood wrote:
>
>> Kumar Gala wrote:
>>> + addrcell = fdt_getprop(blob, 0, "#address-cells", NULL);
>>> + /* use shifts and mask to ensure endianness */
>>> + if ((addrcell) && (*addrcell == 2)) {
>>> + tmp[0] = (start >> 56) & 0xff;
>>> + tmp[1] = (start >> 48) & 0xff;
>>> + tmp[2] = (start >> 40) & 0xff;
>>> + tmp[3] = (start >> 32) & 0xff;
>>> + tmp[4] = (start >> 24) & 0xff;
>>> + tmp[5] = (start >> 16) & 0xff;
>>> + tmp[6] = (start >> 8) & 0xff;
>>> + tmp[7] = (start ) & 0xff;
>>> + len = 8;
>>> + } else {
>>> + tmp[0] = (start >> 24) & 0xff;
>>> + tmp[1] = (start >> 16) & 0xff;
>>> + tmp[2] = (start >> 8) & 0xff;
>>> + tmp[3] = (start ) & 0xff;
>>> + len = 4;
>>> + }
>>
>> Could we please use the existing byteswapping functions?
>
> I don't see how to use them w/o going through an additional memcpy.
>
> If you can provide a better solution I'm all for it. But I don't see
> any reason to hold up the patch at this point.
union {
uint8_t tmp[8];
uint64_t mem64;
uint32_t mem32;
}
int len;
if (addrcell && *addrcell == 2) {
mem64 = cpu_to_fdt64(memsize);
len = 8;
} else {
mem32 = cpu_to_fdt32(memsize);
len = 4;
}
fdt_setprop(..., tmp, len);
-Scott
next prev parent reply other threads:[~2007-11-28 22:38 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-11-28 21:52 [U-Boot-Users] [PATCH][FDT][UPDATE] Add common memory fixup function Kumar Gala
2007-11-28 22:16 ` Scott Wood
2007-11-28 22:35 ` Kumar Gala
2007-11-28 22:38 ` Scott Wood [this message]
2007-11-28 22:48 ` Kumar Gala
2007-11-28 23:04 ` Scott Wood
2007-11-28 23:12 ` Kumar Gala
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=474DEDCD.1070009@freescale.com \
--to=scottwood@freescale.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 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.