qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] Re: [PATCH] Always swap endianness in DBDMA


From: Paul Brook
Subject: Re: [Qemu-devel] Re: [PATCH] Always swap endianness in DBDMA
Date: Wed, 23 Dec 2009 10:55:30 +0000
User-agent: KMail/1.12.4 (Linux/2.6.32-trunk-amd64; KDE/4.3.4; x86_64; ; )

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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]