Skip to contentSkip to conversation

post: fix up I/O helper usage

PATCH New Mike Frysinger 2 participants 7 messages May 10, 2011 – Aug 24, 2011

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 post: fix up I/O helper usage

The I/O API from Linux defaults to little endian accesses. In order to do big endian accesses, there are a "be" variants. The "le32" variants are arch-specific and not terribly common, so change it to the normal Linux API funcs.

---
 include/post.h |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
include/post.h +2 -2
index 519cef1..c9ec2f4 100644
@@ -78,12 +78,12 @@
 
 static inline ulong post_word_load (void)
 {
-	return in_le32((volatile void *)(_POST_WORD_ADDR));
+	return inl((volatile void *)(_POST_WORD_ADDR));
 }
 
 static inline void post_word_store (ulong value)
 {
-	out_le32((volatile void *)(_POST_WORD_ADDR), value);
+	outl(value, (volatile void *)(_POST_WORD_ADDR));
 }
 #endif /* defined (CONFIG_POST) || defined(CONFIG_LOGBUFFER) */
 #endif /* __ASSEMBLY__ */
Signature · 1 line
1.7.5.rc3
#1 lore raw

PATCH 1/1 post: fix up I/O helper usage

Dear Mike Frysinger,

Quoted 15 lines · In message <[email protected]> you wrote:

The I/O API from Linux defaults to little endian accesses. In order to do big endian accesses, there are a "be" variants. The "le32" variants are arch-specific and not terribly common, so change it to the normal Linux API funcs.

---
 include/post.h |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
include/post.h +0 -0
index 519cef1..c9ec2f4 100644

include/post.h line 82

Quoted 6 lines
include/post.h +1 -1
@@ -78,12 +78,12 @@
 
 static inline ulong post_word_load (void)
 {
-	return in_le32((volatile void *)(_POST_WORD_ADDR));
+	return inl((volatile void *)(_POST_WORD_ADDR));
 }

Is this supposed to fix any real problem, or just a change according to your personal preferences?

My initial impression is that we lose a bit of documentation (explicitely telling the reader that these are LE accesses has a certain benefit over hoping the reader has this information present).

Best regards,

Wolfgang Denk

Signature · 5 lines
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
Heavier than air flying machines are impossible.
                    -- Lord Kelvin, President, Royal Society, c. 1895
#2 lore raw

PATCH 1/1 post: fix up I/O helper usage

Quoted 10 lines · Wolfgang Denk
Quoted 9 lines · Mike Frysinger you

The I/O API from Linux defaults to little endian accesses. ?In order to do big endian accesses, there are a "be" variants. ?The "le32" variants are arch-specific and not terribly common, so change it to the normal Linux API funcs.

include/post.h +0 -0
@@ -78,12 +78,12 @@
 
Quoted 8 lines

include/post.h line 82

Quoted 5 lines
include/post.h +1 -1
 ?static inline ulong post_word_load (void)
 ?{
- ? ? return in_le32((volatile void *)(_POST_WORD_ADDR));
+ ? ? return inl((volatile void *)(_POST_WORD_ADDR));
 ?}

Is this supposed to fix any real problem, or just a change according to your personal preferences?

the "in_le32" funcs (and all the other related "le32" helpers) never made it into the common Linux API and many
ports (such as the Blackfin arch) never defined them. so it fixes building for all the ports which lack "in_le32". i dont have a source tree by me atm, but i'd imagine that this is most arches. -mike

#3 lore raw

PATCH 1/1 post: fix up I/O helper usage

Dear Mike Frysinger,

Quoted 11 lines · In message <CAJaTeTpdbcSx5oWsQaP=YQfKYnZcVgc-w4G18ZYmka5GgBAcxg@mail.gmail.com>…
Quoted 7 lines

include/post.h line 82

Quoted 4 lines
include/post.h +1 -1
-     return in_le32((volatile void *)(_POST_WORD_ADDR));
+     return inl((volatile void *)(_POST_WORD_ADDR));
 }

Is this supposed to fix any real problem, or just a change according to your personal preferences?

the "in_le32" funcs (and all the other related "le32" helpers) never made it into the common Linux API and many
ports (such as the Blackfin arch) never defined them. so it fixes

True. But the same is also true for any other of the so-called "standard accessors". The fact that some architectures are slow to adapt to the standards does not convince me that we have to always accept the lowest common denominator. We can also push forward, at least sometimes.

Quoted 2 lines

building for all the ports which lack "in_le32". i dont have a source tree by me atm, but i'd imagine that this is most arches.

outl() feels wrong to me - the signature (second argument is an "I/O port") and the definition in Linux (include/asm-generic/io.h: return readl(addr + PCI_IOBASE);) this is for accessing I/O ports. The documentation ("memory-barriers.txt") says:

(*) inX(), outX():

These are intended to talk to I/O space rather than memory space ...

What we should be using (and standardizing for) is probably this (at least some of the PTBs said so in the past):

	 (*) ioreadX(), iowriteX()

              These will perform appropriately for the type of access
              they're actually doing, be it inX()/outX() or
              readX()/writeX().

However, even less architectres have these. [But funny enough, in U-Boot it's BF which leads by example.]

Sorry, but I will not accept inl() here.

Best regards,

Wolfgang Denk

Signature · 6 lines
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
Operating-system software is the program that  orchestrates  all  the
basic functions of a computer.
- The Wall Street Journal, Tuesday, September 15, 1987, page 40
#4 lore raw

PATCH 1/1 post: fix up I/O helper usage

Quoted 12 lines · Wolfgang Denk
Quoted 10 lines · Mike Frysinger
Quoted 6 lines
Quoted 3 lines

- ? ? return in_le32((volatile void *)(_POST_WORD_ADDR));
+ ? ? return inl((volatile void *)(_POST_WORD_ADDR)); ?}

Is this supposed to fix any real problem, or just a change according to your personal preferences?

the "in_le32" funcs (and all the other related "le32" helpers) never made it into the common Linux API and many
ports (such as the Blackfin arch) never defined them. ?so it fixes

Quoted 5 lines

True. ?But the same is also true for any other of the so-called "standard accessors". ?The fact that some architectures are slow to adapt to the standards does not convince me that we have to always accept the lowest common denominator. ?We can also push forward, at least sometimes.

sorry, but i dont think this qualifies. ppc choosing to add some arbitrary new macros by themselves which one or two other arches happen to copy does not make them part of the influx standard. looking at the linux/u-boot trees, ppc seems to be the only one that implements it in both (and perhaps m68k).

Quoted 4 lines

What we should be using (and standardizing for) is probably this (at least some of the PTBs said so in the past):

? ? ? ? (*) ioreadX(), iowriteX()

that's fine by me

Quoted 1 line

Sorry, but I will not accept inl() here.

so not even to fix build failures for most non-ppc arches ? i wont be able to post an updated patch for a while.
-mike

#5 lore raw

PATCH 1/1 post: fix up I/O helper usage

Quoted 4 lines · On Friday, July 29, 2011 14:40:23 Mike Frysinger wrote:
Quoted 3 lines · Wolfgang Denk

What we should be using (and standardizing for) is probably this (at least some of the PTBs said so in the past):

Quoted 8 lines
Quoted 1 line
        (*) ioreadX(), iowriteX()

that's fine by me

Quoted 1 line

Sorry, but I will not accept inl() here.

so not even to fix build failures for most non-ppc arches ? i wont be able to post an updated patch for a while.

so i can post a patch to use io{read,write}32, but then it'll only build for Blackfin targets whereas the patch i posted originally works for all arches. what exactly do you want done ?
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20110814/237189d2/attachment.pgp

#6 lore raw

PATCH 1/1 post: fix up I/O helper usage

Dear Mike Frysinger,

Quoted 9 lines · In message <[email protected]> you wrote:
Quoted 5 lines
Quoted 2 lines

Sorry, but I will not accept inl() here.

so not even to fix build failures for most non-ppc arches ? i wont be able to post an updated patch for a while.

so i can post a patch to use io{read,write}32, but then it'll only build for Blackfin targets whereas the patch i posted originally works for all arches. what exactly do you want done ?

Best would be to add io{read,write}*() support for those architectures that don't have it yet.

Thanks.

Wolfgang Denk

Signature · 5 lines
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
I can type faster than I can move a  mouse,  so  I  find  menu-driven
drawing packages time consuming and frustrating.      - W. R. Stevens