[U-Boot] [PATCH] post: fix up I/O helper usage

Wolfgang Denk wd at denx.de
Thu Jul 28 16:23:25 CEST 2011


Dear Mike Frysinger,

In message <CAJaTeTpdbcSx5oWsQaP=YQfKYnZcVgc-w4G18ZYmka5GgBAcxg at mail.gmail.com> you wrote:
>
> >> -     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.

> 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

-- 
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


More information about the U-Boot mailing list