diff options
author | Kevin Wolf <kwolf@redhat.com> | 2013-06-18 10:26:11 +0200 |
---|---|---|
committer | Stefan Hajnoczi <stefanha@redhat.com> | 2013-06-24 10:25:16 +0200 |
commit | dfe1ea8fc49b93ab2bfaad67046c659a0dae708f (patch) | |
tree | 5f953b884e1776ddf1f7a71ead5ffc0e0f722278 /hw/ide | |
parent | ff3526773080de2840481ec237db13ae3cbc7166 (diff) | |
download | qemu-dfe1ea8fc49b93ab2bfaad67046c659a0dae708f.zip qemu-dfe1ea8fc49b93ab2bfaad67046c659a0dae708f.tar.gz qemu-dfe1ea8fc49b93ab2bfaad67046c659a0dae708f.tar.bz2 |
ide: Clean up ide_exec_cmd()
All commands are now converted to ide_cmd_table handlers, so it can be
unconditional now and the old switch block can go.
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Diffstat (limited to 'hw/ide')
-rw-r--r-- | hw/ide/core.c | 36 |
1 files changed, 12 insertions, 24 deletions
diff --git a/hw/ide/core.c b/hw/ide/core.c index 1c8f414..03d1cfa 100644 --- a/hw/ide/core.c +++ b/hw/ide/core.c @@ -1694,6 +1694,7 @@ static bool ide_cmd_permitted(IDEState *s, uint32_t cmd) void ide_exec_cmd(IDEBus *bus, uint32_t val) { IDEState *s; + bool complete; #if defined(DEBUG_IDE) printf("ide: CMD=%02x\n", val); @@ -1708,37 +1709,24 @@ void ide_exec_cmd(IDEBus *bus, uint32_t val) return; if (!ide_cmd_permitted(s, val)) { - goto abort_cmd; + ide_abort_command(s); + ide_set_irq(s->bus); + return; } - if (ide_cmd_table[val].handler != NULL) { - bool complete; - - s->status = READY_STAT | BUSY_STAT; - s->error = 0; - - complete = ide_cmd_table[val].handler(s, val); - if (complete) { - s->status &= ~BUSY_STAT; - assert(!!s->error == !!(s->status & ERR_STAT)); + s->status = READY_STAT | BUSY_STAT; + s->error = 0; - if ((ide_cmd_table[val].flags & SET_DSC) && !s->error) { - s->status |= SEEK_STAT; - } + complete = ide_cmd_table[val].handler(s, val); + if (complete) { + s->status &= ~BUSY_STAT; + assert(!!s->error == !!(s->status & ERR_STAT)); - ide_set_irq(s->bus); + if ((ide_cmd_table[val].flags & SET_DSC) && !s->error) { + s->status |= SEEK_STAT; } - return; - } - - switch(val) { - default: - /* should not be reachable */ - abort_cmd: - ide_abort_command(s); ide_set_irq(s->bus); - break; } } |