]> xenbits.xensource.com Git - seabios.git/commit
ahci: handle TFES irq correctly
authorNiklas Cassel via SeaBIOS <seabios@seabios.org>
Tue, 30 May 2023 13:44:05 +0000 (15:44 +0200)
committerKevin O'Connor <kevin@koconnor.net>
Thu, 22 Jun 2023 02:02:32 +0000 (22:02 -0400)
commit1281e340ad1d90c0cc8e8d902bb34f1871eb48cf
tree2c0e1ab64ae7bc673a95e0172a03cc81d607191a
parentcd933454b5e3e1f86379a44b5ae1852c2a01a485
ahci: handle TFES irq correctly

According to AHCI 1.3.1, 5.3.8.1 RegFIS:Entry, if ERR_STAT is set in the
received FIS, the HBA shall jump to state ERR:FatalTaskfile, which will
raise a TFES IRQ.

This means that if ERR_STAT is set in the recevied FIS, PxIS.TFES will
be set, without either PxIS.DHRS or PxIS.PSS being set.

SeaBIOS function ahci_port_setup() will try to identify an AHCI device
by sending an ATAPI identify device command. However, such a command
will be aborted with ERR_STAT set for a regular (non-ATAPI) device.

ahci_command() already performs the correct error recovery steps when
status is correctly set, so simply modify ahci_command() to read the
correct status when PxIS.TFES is set.

It is safe to read PxTFD when PxIS.TFES is set, even for systems with a
port multiplier, see AHCI 1.3.1, 9.3.7 PxTFD Register Information:
"When a taskfile error occurs (PxIS.TFES is set to '1'), the host may
refer to the values in PxTFD. The values in PxTFD at this time are
guaranteed to correspond to the device that reported the taskfile error
condition."

Without this, each boot will be delayed by 32 seconds, waiting for the
AHCI command to timeout.

Signed-off-by: Niklas Cassel <niklas.cassel@wdc.com>
Tested-by: Gerd Hoffmann <kraxel@redhat.com>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
src/hw/ahci.c