summaryrefslogtreecommitdiffstats
path: root/sys/dev/ahci
diff options
context:
space:
mode:
authormav <mav@FreeBSD.org>2009-12-06 23:56:54 +0000
committermav <mav@FreeBSD.org>2009-12-06 23:56:54 +0000
commitc71533c8cbac572153a2a4715d3cee74df85bb4d (patch)
tree7a3c769013d82749dbd866dea701a2e7ae076548 /sys/dev/ahci
parent07b9b1d87c9c827c726ff5d99e9faa57bca3a7ab (diff)
downloadFreeBSD-src-c71533c8cbac572153a2a4715d3cee74df85bb4d.zip
FreeBSD-src-c71533c8cbac572153a2a4715d3cee74df85bb4d.tar.gz
Add Asynchronous Notification support for controllers without SNTF
capability by snooping SDB FIS receive area. It should be even faster then regular way, but less reliable.
Diffstat (limited to 'sys/dev/ahci')
-rw-r--r--sys/dev/ahci/ahci.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/sys/dev/ahci/ahci.c b/sys/dev/ahci/ahci.c
index 3f6c9fc..84a1630 100644
--- a/sys/dev/ahci/ahci.c
+++ b/sys/dev/ahci/ahci.c
@@ -1129,7 +1129,8 @@ ahci_notify_events(device_t dev, u_int32_t status)
struct cam_path *dpath;
int i;
- ATA_OUTL(ch->r_mem, AHCI_P_SNTF, status);
+ if (ch->caps & AHCI_CAP_SSNTF)
+ ATA_OUTL(ch->r_mem, AHCI_P_SNTF, status);
if (bootverbose)
device_printf(dev, "SNTF 0x%04x\n", status);
for (i = 0; i < 16; i++) {
@@ -1188,8 +1189,16 @@ ahci_ch_intr(void *data)
/* Read command statuses. */
sstatus = ATA_INL(ch->r_mem, AHCI_P_SACT);
cstatus = ATA_INL(ch->r_mem, AHCI_P_CI);
- if ((istatus & AHCI_P_IX_SDB) && (ch->caps & AHCI_CAP_SSNTF))
- sntf = ATA_INL(ch->r_mem, AHCI_P_SNTF);
+ if (istatus & AHCI_P_IX_SDB) {
+ if (ch->caps & AHCI_CAP_SSNTF)
+ sntf = ATA_INL(ch->r_mem, AHCI_P_SNTF);
+ else {
+ u_int8_t *fis = ch->dma.rfis + 0x58;
+
+ if (fis[1] & 0x80)
+ sntf = (1 << (fis[1] & 0x0f));
+ }
+ }
/* Process PHY events */
if (istatus & (AHCI_P_IX_PC | AHCI_P_IX_PRC | AHCI_P_IX_OF |
AHCI_P_IX_IF | AHCI_P_IX_HBD | AHCI_P_IX_HBF | AHCI_P_IX_TFE)) {
OpenPOWER on IntegriCloud