Current-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Current fails in MONOLITHIC

On 08.08.2011 18:06, David Young wrote:
>> bus_addr_t is a physical address (paddr_t), and with PAE, it's a 64
>> bits entity.
>> You should use PRIxPADDR to print paddr_t/bus_addr_t entities, it
>> will automagically use the proper specifier.
> paddr_t and bus_addr_t are not necessarily the same width, are they?
> ISTM that you could have 32-bit paddr_t and 64-bit bus_addr_t, or
> vice-versa.

That's not something I would expect, except in very specific corner
cases like the A20 gate on old x86 systems (and in this case it's an
ugly fix for old DOS programs, which should have never existed in the
first place IMHO).

I am not an expert architect/engineer who worked on all kinds of systems
and architectures, but having a bus_addr_t and paddr_t set on the same
sizes (the bigger of the two) will save a *lot* of trouble on the long
run especially when you start moving bus_addr_t and paddr_t entities
around; it's really error-prone when you throw in casts/shifts. Porting
PAE to GENERIC had some.

> In any case, every port should #define PRIxBUSADDR, PRIxBUSSIZE, and so
> on.

This makes sense.

Most ports define bus_addr_t as a u_long though, which is the natural
(unsigned) integer. It is reasonable to assume that it can be used
either for scalars or pointers/addresses. However, there are some
exceptions, and this is one of those.

Jean-Yves Migeon

Home | Main Index | Thread Index | Old Index