[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] Re: [PATCH] Always swap endianness in DBDMA
From: |
Laurent Vivier |
Subject: |
Re: [Qemu-devel] Re: [PATCH] Always swap endianness in DBDMA |
Date: |
Thu, 24 Dec 2009 00:39:36 +0100 |
Le mercredi 23 décembre 2009 à 10:55 +0000, Paul Brook a écrit :
> > The problem is that the whole define is just plain wrong which tells me
> > that the code is using the bswap functions incorrectly. This really
> > needs to be fixed by someone who knows the dbdma device. I don't see how
> > calling incorrect calls even more incorrect makes any difference.
>
> The real problem is that devices shouldn't be doing byteswapping at all. This
> should be determined by the (currently non-existant) bus layers and
> implemented in generic code before the device callback.
>
> The current code[1] is a nasty hack that sort-of works for most of the
> current
> machines because all devices happen to be connected the same way. However
> there are other machines (e.g. ixp4xx) some peripherals are connected
> natively, whereas others are cross-wired.
>
> On a related note, I'm not sure what the author of mac_bdbma.c was
> smoking[2].
I didn't smoke... just need some sleep.
> It appears to keep register values in big-endian form for no good reason.
> Much
> easier would be to store them in native form, and just do the byteswapping
> when accessed by the CPU.
>
> Paul
>
> [1] e.g. vga.c:vga_mem_readw
> [2] My guess is that the code is cribbed from elsewhere, and the original
> source gave the CPU direct access to the ch->regs[] array.
>From pearpc io/macio/macio.cc.
Regards,
Laurent
--
--------------------- address@hidden ----------------------
"Tout ce qui est impossible reste à accomplir" Jules Verne
"Things are only impossible until they're not" Jean-Luc Picard