qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [RFC] Floppy controller: break relation with PC-style D


From: Hervé Poussineau
Subject: Re: [Qemu-devel] [RFC] Floppy controller: break relation with PC-style DMA
Date: Sat, 22 Nov 2008 14:48:06 +0100
User-agent: Thunderbird 2.0.0.14 (Windows/20080421)

Blue Swirl a écrit :
On 11/22/08, Hervé Poussineau <address@hidden> wrote:
Hi,

 Currently, floppy disk controller is tied to PC-style DMA controller.
 Attached patch is an attempt to break the link between those, by
introducing function pointers for dma operations (read, write, hold,
release).

Isn't it possible to move the i8257 DMA helpers to for example dma.c?
Then I could eliminate some dummy DMA_xx functions from sun4m.c and I
think fdctrl_i8257_init would not be needed.

That's a little bit hard for 3 reasons:
a) i8257_dma_hold() checks if DMA is well programmed before doing the transfer. I suppose the check should be moved to DMA engine, or at least to the _read and _write handlers. b) There is also the problem at initialization, where each i8257 client calls DMA_register_channel() to register itself, and gives a callback function (fdctrl_transfer_handler for fdc.c). c) This callback will then be called to feed destination DMA buffer part by part (see dma_pos and dma_len in fdctrl_transfer_handler), instead of in one big transfer. That also explains the data_pos parameter when calling DMA_read_memory/DMA_write_memory

Yet, I've no good idea to solve problem b) and c).

I suppose we really need a generic DMA framework, as it seems each DMA controller is using its own scheme. For me, a first step in this direction is to break links between devices and DMA engines, like it has already be done for esp adapter. Then, something good can emerge. You should also notice that I chose _read and _write callbacks for fdc to be exactly the same as in esp.

You are calling fdctrl->dma_memory_write and _read without checking
that they are not NULL.

Ok, I'll add checks for fdctrl->dma_memory_write and _read.
In all cases, one without the other should be an error at initialization, and then, DMA should be avoided/prevented if they are not defined.

Hervé




reply via email to

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