From: "Robert P. J. Day" <rpjday@crashcourse.ca>
To: linux-mips@linux-mips.org
Subject: what is the purpose of the following LE->BE patch to arch/mips/include/asm/io.h?
Date: Fri, 20 Feb 2015 04:53:42 -0500 (EST) [thread overview]
Message-ID: <alpine.LFD.2.11.1502200445290.26212@localhost> (raw)
was recently handed a MIPS-based dev board (can't name the vendor,
NDA) that *typically* runs in LE mode but, because of a proprietary
binary that must be run on the board and was compiled as BE, has to be
run in BE mode.
the vendor supplied a yoctoproject layer that seems to work fine
but, in changing the DEFAULTTUNE to big-endian, the following patch
had to be applied to the 3.14 kernel tree to the file
arch/mips/include/asm/io.h in order to get output from the console
port as the system was booting:
326c326,333
< *__mem = __val; \
---
> { \
> if (sizeof(type) == sizeof(u32)) \
> { \
> *__mem = __cpu_to_le32(__val); \
> } \
> else \
> *__mem = __val; \
> } \
356a364
> { \
357a366,368
> if (sizeof(type) == sizeof(u32)) \
> __val = __cpu_to_le32(__val); \
> } \
without that patch, the initial conclusion was that the board was
just hanging at boot, but i was told, no, it was booting, there was
just no output at the console port. applied the patch and, voila.
can someone explain *precisely* what the above is doing? i am by no
means a MIPS expert, but clearly the above is doing some sort of
explicit BE/LE conversion. can anyone supply more detail? thanks.
rday
--
========================================================================
Robert P. J. Day Ottawa, Ontario, CANADA
http://crashcourse.ca
Twitter: http://twitter.com/rpjday
LinkedIn: http://ca.linkedin.com/in/rpjday
========================================================================
next reply other threads:[~2015-02-20 9:53 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-02-20 9:53 Robert P. J. Day [this message]
2015-02-21 4:00 ` what is the purpose of the following LE->BE patch to arch/mips/include/asm/io.h? Matt Turner
2015-02-21 4:04 ` Matt Turner
2015-02-21 8:11 ` Robert P. J. Day
2015-02-21 8:23 ` Manuel Lauss
2015-02-21 8:27 ` Robert P. J. Day
2015-02-21 20:00 ` Maciej W. Rozycki
2015-02-21 21:03 ` Kevin Cernekee
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=alpine.LFD.2.11.1502200445290.26212@localhost \
--to=rpjday@crashcourse.ca \
--cc=linux-mips@linux-mips.org \
/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