Date: Tue, 8 Aug 2006 14:00:46 -0700 From: John-Mark Gurney <gurney_j@resnet.uoregon.edu> To: John Baldwin <jhb@freebsd.org> Cc: freebsd-hackers@freebsd.org Subject: Re: jkh weird problem (reading pci device memory) Message-ID: <20060808210046.GH99774@funkthat.com> In-Reply-To: <200608081342.51800.jhb@freebsd.org> References: <44D4A5DC.7080403@cytexbg.com> <200608071527.50711.jhb@freebsd.org> <20060807220550.GF99774@funkthat.com> <200608081342.51800.jhb@freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
John Baldwin wrote this message on Tue, Aug 08, 2006 at 13:42 -0400:
> 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?
I haven't seen the patches for mpt, but usually they are only doing
the byte swapping to data structures that are to be dma'd to/from
the card... As when dma happens, there is no byte swapping done..
--
John-Mark Gurney Voice: +1 415 225 5579
"All that I will do, has been done, All that I have, has not."
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20060808210046.GH99774>
