qtest/ahci: Add command header helpers

Add command_header_set, command_header_get,
command_destroy and cmd_pick to help quickly
manage the command header information in the
AHCI device.
qtest/ahci: Add build_cmd_table helper

A helper routine to build the command table,
which consists of the Command FIS and the PRD.
qtest/ahci: Add link_cmd_slot helper

Adding link_cmd_slot, which finalizes the command header
that points to a previously created command table.
qtest/ahci: Adding port_check_error helper

A routine that checks a given port's error registers
and asserts that everything from the port-level view
is still OK.
qtest/ahci: Adding issue_command helper

Add a small routine that informs the AHCI device
that we have finalized our command and we'd wish
the device to begin processing it.
qtest/ahci: add port_check_interrupts

A helper that compares a given port's current
interrupts and checks them against a supplied
list of expected interrupt bits, and throws
an error if they do not match.

The helper then resets the requested interrupts
on this port.
qtest/ahci: Add port_check_nonbusy helper

A simple helper that asserts a given port is
not busy processing any commands via the
TFD, Command Issue and SACT registers.
qtest/ahci: Add d2h, pio, and cmd response sanity check helpers

Adds a few helpers to help sanity-check the response of the
AHCI device after a command.

d2h_check_sanity inspects the D2H Register FIS,
pio_check_sanity inspects the PIO Setup FIS,
and cmd_check_sanity inspects the command header.
qtest/ahci: Add human-readable command names

Instead of using direct hex values, use SATA command mnemonics.
qtest/ahci: fixing identify to not use magic constant for size

Fix to correct the use of "512" as a magic constant and define
it as the buffer size for the operation instead.
qtest/ahci: Assert sector size in identify test

A minor sanity check to assert that the sector size is 512.
qtest/ahci: Adding macro boot routine.

Add a routine that can be used to engage the AHCI
device at a not-granular level so that bringing up
the functionality of the HBA is easy in future tests
that are not concerned with testing the bring-up process.
qtest/ahci: Adding simple dma read-write test

Adds a test case for AHCI wherein we write a 4K
block of a changing pattern to sector 0, then
read back that 4K and compare the transmit and
receive buffers.
ide: start extracting ide_restart_dma out of bmdma_restart_dma

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
ide: prepare to move restart to common code

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
ide: introduce ide_register_restart_cb

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
ide: do not use BMDMA in restart callback

Whenever an error stops the VM, ide_handle_rw_error does
"s->bus->dma->unit = s->unit".  So we can just use
idebus_active_if.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
ide: pass IDEBus to the restart_cb

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
ide: move restart callback to common code

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
ide: remove restart_cb callback

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>