ahci: fix sdb fis semantics
commit7c649ac5b607e2339fb54fc0fc01311ba5eacadd
authorJohn Snow <jsnow@redhat.com>
Sat, 4 Jul 2015 06:06:05 +0000 (4 02:06 -0400)
committerJohn Snow <jsnow@redhat.com>
Sat, 4 Jul 2015 06:06:05 +0000 (4 02:06 -0400)
treec8ac6784155bfcc4fd199d80153030e02e24395a
parent8146d7dc2756138bd4011e8d882ead929f25f2d0
ahci: fix sdb fis semantics

There are two things to fix here:

The first one is subtle: the PxSACT register in the AHCI HBA has different
semantics from the field it is shadowing, the ACT field in the
Set Device Bits FIS.

In the HBA register, PxSACT acts as a bitfield indicating outstanding
NCQ commands where a set bit indicates a pending NCQ operation. The FIS
field however operates as an RWC register update to PxSACT, where a set
bit indicates a *successfully* completed command.

Correct the FIS semantics. At the same time, move the "clear finished"
action to the SDB FIS generation instead of the register read to mimick
how the other shadow registers work, which always just report the last
reported value from a FIS, and not the most current values which may
not have been reported by a FIS yet.

Lastly and more simply, SATA 3.2 section 13.6.4.2 (and later sections)
all specify that the Interrupt bit for the SDB FIS should always be set
to one for NCQ commands. That's currently the only time we generate this
FIS, so set it on all the time.

Signed-off-by: John Snow <jsnow@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-id: 1435767578-32743-16-git-send-email-jsnow@redhat.com
hw/ide/ahci.c