diff mbox

[v2,02/10] fdc: set busy bit when starting a command

Message ID 1326613915-3282-3-git-send-email-hpoussin@reactos.org
State New
Headers show

Commit Message

Hervé Poussineau Jan. 15, 2012, 7:51 a.m. UTC
This bit must be active while a command is currently executed.

Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
---
 hw/fdc.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

Comments

Kevin Wolf Jan. 16, 2012, 9:33 a.m. UTC | #1
Am 15.01.2012 08:51, schrieb Hervé Poussineau:
> This bit must be active while a command is currently executed.
> 
> Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>

I believe this could use some more cleanup. The flag is set and reset
multiple times in places that aren't quite obvious. Not saying it should
be done in this patch, but maybe in a follow-up series.

Kevin
diff mbox

Patch

diff --git a/hw/fdc.c b/hw/fdc.c
index c1898a6..1b9f303 100644
--- a/hw/fdc.c
+++ b/hw/fdc.c
@@ -1446,7 +1446,6 @@  static void fdctrl_handle_readid(FDCtrl *fdctrl, int direction)
 {
     FDrive *cur_drv = get_cur_drv(fdctrl);
 
-    /* XXX: should set main status register to busy */
     cur_drv->head = (fdctrl->fifo[1] >> 2) & 1;
     qemu_mod_timer(fdctrl->result_timer,
                    qemu_get_clock_ns(vm_clock) + (get_ticks_per_sec() / 50));
@@ -1734,6 +1733,7 @@  static void fdctrl_write_data(FDCtrl *fdctrl, uint32_t value)
         pos = command_to_handler[value & 0xff];
         FLOPPY_DPRINTF("%s command\n", handlers[pos].name);
         fdctrl->data_len = handlers[pos].parameters + 1;
+        fdctrl->msr |= FD_MSR_CMDBUSY;
     }
 
     FLOPPY_DPRINTF("%s: %02x\n", __func__, value);