From 0be9576a220eee851aeac7aba699f79e1c7a930d Mon Sep 17 00:00:00 2001 From: Matthew Dillon Date: Thu, 1 Oct 2009 12:12:45 -0700 Subject: [PATCH] AHCI - Minor fixes * Fix a conditional testing for hot plug removal. This is mostly cosmetic but prevents a bogus "Device removed" message when plugging IN devices on ports which do not support hot-plug. * Print the port capabilities out for each port during device probe. This makes it easier to diagnose bug reports if people try to use hot-plug on devices (usually old AHCI 1.0 chipsets) which do not support hot-plug. These chipsets do not do device detection on the port change event and also usually do not implement CLO, so there isn't much the driver can do. --- sys/dev/disk/ahci/ahci.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/sys/dev/disk/ahci/ahci.c b/sys/dev/disk/ahci/ahci.c index 9f3d7ad0ce..a612c33a75 100644 --- a/sys/dev/disk/ahci/ahci.c +++ b/sys/dev/disk/ahci/ahci.c @@ -303,6 +303,8 @@ ahci_port_alloc(struct ahci_softc *sc, u_int port) * Sec 10.1.2 - deinitialise port if it is already running */ cmd = ahci_pread(ap, AHCI_PREG_CMD); + kprintf("%s: Caps %b\n", PORTNAME(ap), cmd, AHCI_PFMT_CMD); + if ((cmd & (AHCI_PREG_CMD_ST | AHCI_PREG_CMD_CR | AHCI_PREG_CMD_FRE | AHCI_PREG_CMD_FR)) || (ahci_pread(ap, AHCI_PREG_SCTL) & AHCI_PREG_SCTL_DET)) { @@ -2535,6 +2537,7 @@ finish_error: is & (AHCI_PREG_IS_PCS | AHCI_PREG_IS_PRCS)); is &= ~(AHCI_PREG_IS_PCS | AHCI_PREG_IS_PRCS); ahci_port_stop(ap, 0); + switch (ahci_pread(ap, AHCI_PREG_SSTS) & AHCI_PREG_SSTS_DET) { case AHCI_PREG_SSTS_DET_DEV: if (ap->ap_probe == ATA_PROBE_FAILED) { @@ -2544,7 +2547,7 @@ finish_error: need = NEED_RESTART; break; default: - if (ap->ap_type != ATA_PROBE_FAILED) { + if (ap->ap_probe != ATA_PROBE_FAILED) { need = NEED_HOTPLUG_REMOVE; goto fatal; } -- 2.11.4.GIT