mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-08 18:23:57 -06:00
fdc/i8257: implement verify transfer mode
While working on the Tulip driver i tried to write some Teledisk images to a floppy image which didn't work. Turned out that Teledisk checks the written data by issuing a READ command to the FDC but running the DMA controller in VERIFY mode. As we ignored the DMA request in that case, the DMA transfer never finished, and Teledisk reported an error. The i8257 spec says about verify transfers: 3) DMA verify, which does not actually involve the transfer of data. When an 8257 channel is in the DMA verify mode, it will respond the same as described for transfer operations, except that no memory or I/O read/write control signals will be generated. Hervé proposed to remove all the dma_mode_ok stuff from fdc to have a more clear boundary between DMA and FDC, so this patch also does that. Suggested-by: Hervé Poussineau <hpoussin@reactos.org> Signed-off-by: Sven Schnelle <svens@stackframe.org> Reviewed-by: Hervé Poussineau <hpoussin@reactos.org>
This commit is contained in:
parent
cfe68ae025
commit
9e58f17270
3 changed files with 31 additions and 51 deletions
|
@ -292,12 +292,6 @@ static uint64_t i8257_read_cont(void *opaque, hwaddr nport, unsigned size)
|
|||
return val;
|
||||
}
|
||||
|
||||
static IsaDmaTransferMode i8257_dma_get_transfer_mode(IsaDma *obj, int nchan)
|
||||
{
|
||||
I8257State *d = I8257(obj);
|
||||
return (d->regs[nchan & 3].mode >> 2) & 3;
|
||||
}
|
||||
|
||||
static bool i8257_dma_has_autoinitialization(IsaDma *obj, int nchan)
|
||||
{
|
||||
I8257State *d = I8257(obj);
|
||||
|
@ -400,6 +394,11 @@ static void i8257_dma_register_channel(IsaDma *obj, int nchan,
|
|||
r->opaque = opaque;
|
||||
}
|
||||
|
||||
static bool i8257_is_verify_transfer(I8257Regs *r)
|
||||
{
|
||||
return (r->mode & 0x0c) == 0;
|
||||
}
|
||||
|
||||
static int i8257_dma_read_memory(IsaDma *obj, int nchan, void *buf, int pos,
|
||||
int len)
|
||||
{
|
||||
|
@ -407,6 +406,10 @@ static int i8257_dma_read_memory(IsaDma *obj, int nchan, void *buf, int pos,
|
|||
I8257Regs *r = &d->regs[nchan & 3];
|
||||
hwaddr addr = ((r->pageh & 0x7f) << 24) | (r->page << 16) | r->now[ADDR];
|
||||
|
||||
if (i8257_is_verify_transfer(r)) {
|
||||
return len;
|
||||
}
|
||||
|
||||
if (r->mode & 0x20) {
|
||||
int i;
|
||||
uint8_t *p = buf;
|
||||
|
@ -431,6 +434,10 @@ static int i8257_dma_write_memory(IsaDma *obj, int nchan, void *buf, int pos,
|
|||
I8257Regs *r = &s->regs[nchan & 3];
|
||||
hwaddr addr = ((r->pageh & 0x7f) << 24) | (r->page << 16) | r->now[ADDR];
|
||||
|
||||
if (i8257_is_verify_transfer(r)) {
|
||||
return len;
|
||||
}
|
||||
|
||||
if (r->mode & 0x20) {
|
||||
int i;
|
||||
uint8_t *p = buf;
|
||||
|
@ -597,7 +604,6 @@ static void i8257_class_init(ObjectClass *klass, void *data)
|
|||
dc->vmsd = &vmstate_i8257;
|
||||
device_class_set_props(dc, i8257_properties);
|
||||
|
||||
idc->get_transfer_mode = i8257_dma_get_transfer_mode;
|
||||
idc->has_autoinitialization = i8257_dma_has_autoinitialization;
|
||||
idc->read_memory = i8257_dma_read_memory;
|
||||
idc->write_memory = i8257_dma_write_memory;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue