jkh weird problem (reading pci device memory)
John Baldwin
jhb at freebsd.org
Tue Aug 8 18:02:08 UTC 2006
On Monday 07 August 2006 18:05, John-Mark Gurney wrote:
> John Baldwin wrote this message on Mon, Aug 07, 2006 at 15:27 -0400:
> > sc->cfg_table.signature = letoh32(bus_read_4(sc->bar.res, 0));
> > sc->cfg_table.version = letoh16(bus_read_2(sc->bar.res, 4));
> > sc->cfg_table.dummy = bus_read_1(sc->bar.res, 5);
>
> Note that this may or may not be correct... the bus_read_X macros
> do endian conversion if the bus is of different endianness than the
> processor arch... So if the device is on a PCI bus, and the machine
> is sparc64, the bus_read_X will already be swapped as necessary... If
> you don't want the byte swapping to be done for you, there are the
> _stream versions... The are useful for transfering data like disk
> data that needs to maintain the same order...
Then why are folks adding these macros to things like mpt?
--
John Baldwin
More information about the freebsd-hackers
mailing list