ide: Add handler to ide_cmd_table
authorKevin Wolf <kwolf@redhat.com>
Tue, 18 Jun 2013 08:25:55 +0000 (10:25 +0200)
committerStefan Hajnoczi <stefanha@redhat.com>
Mon, 24 Jun 2013 08:25:15 +0000 (10:25 +0200)
commita0436e9239d29837955a60e916f876f857d46452
treedf9dc07a893451e30590558ba5f208e700f471c9
parent576156ffed72ab4feb0b752979db86ff8759a2a1
ide: Add handler to ide_cmd_table

As a preparation for moving all IDE commands into their own function
like in the ATAPI code, introduce a 'handler' callback to ide_cmd_table.

Commands using this new infrastructure get some things handled
automatically:

* The BSY flag is set before calling the handler (in order to avoid bugs
  like the one fixed in f68ec837) and reset on completion.

* The (obsolete) DSC flag in the status register is set on completion if
  the command is flagged with SET_DSC in the command table

* An IRQ is triggered on completion.

* The error register and the ERR flag in the status register are cleared
  before calling the handler and on completion it is asserted that
  either none or both of them are set.

No commands are converted at this point.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
hw/ide/core.c