Module Name: src Committed By: simonb Date: Sat Jan 18 11:26:11 UTC 2020
Modified Files: src/sys/dev/ic: ahcisata_core.c ahcisatavar.h src/sys/dev/pci: ahcisata_pci.c Log Message: Add new AHCI_QUIRK_BADNCQ quick for controllers that have issues with NCQ on (some) drives. Enable this quirk for ATI (AMD) SB600/SB700 controllers. Alternate fix for kern/54790 and kern/54855. ok jdolecek@, tested on my SB700 chipset and tsutsui's SB600 chipset. To generate a diff of this commit: cvs rdiff -u -r1.80 -r1.81 src/sys/dev/ic/ahcisata_core.c cvs rdiff -u -r1.23 -r1.24 src/sys/dev/ic/ahcisatavar.h cvs rdiff -u -r1.56 -r1.57 src/sys/dev/pci/ahcisata_pci.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/dev/ic/ahcisata_core.c diff -u src/sys/dev/ic/ahcisata_core.c:1.80 src/sys/dev/ic/ahcisata_core.c:1.81 --- src/sys/dev/ic/ahcisata_core.c:1.80 Fri Dec 27 09:41:50 2019 +++ src/sys/dev/ic/ahcisata_core.c Sat Jan 18 11:26:11 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: ahcisata_core.c,v 1.80 2019/12/27 09:41:50 msaitoh Exp $ */ +/* $NetBSD: ahcisata_core.c,v 1.81 2020/01/18 11:26:11 simonb Exp $ */ /* * Copyright (c) 2006 Manuel Bouyer. @@ -26,7 +26,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: ahcisata_core.c,v 1.80 2019/12/27 09:41:50 msaitoh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ahcisata_core.c,v 1.81 2020/01/18 11:26:11 simonb Exp $"); #include <sys/types.h> #include <sys/malloc.h> @@ -276,6 +276,11 @@ ahci_attach(struct ahci_softc *sc) "ignoring broken port multiplier support\n"); sc->sc_ahci_cap &= ~AHCI_CAP_SPM; } + if (sc->sc_ahci_quirks & AHCI_QUIRK_BADNCQ) { + aprint_verbose_dev(sc->sc_atac.atac_dev, + "ignoring broken NCQ support\n"); + sc->sc_ahci_cap &= ~AHCI_CAP_NCQ; + } sc->sc_atac.atac_nchannels = (sc->sc_ahci_cap & AHCI_CAP_NPMASK) + 1; sc->sc_ncmds = ((sc->sc_ahci_cap & AHCI_CAP_NCS) >> 8) + 1; ahci_rev = AHCI_READ(sc, AHCI_VS); Index: src/sys/dev/ic/ahcisatavar.h diff -u src/sys/dev/ic/ahcisatavar.h:1.23 src/sys/dev/ic/ahcisatavar.h:1.24 --- src/sys/dev/ic/ahcisatavar.h:1.23 Sun Sep 29 21:16:14 2019 +++ src/sys/dev/ic/ahcisatavar.h Sat Jan 18 11:26:11 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: ahcisatavar.h,v 1.23 2019/09/29 21:16:14 jakllsch Exp $ */ +/* $NetBSD: ahcisatavar.h,v 1.24 2020/01/18 11:26:11 simonb Exp $ */ /* * Copyright (c) 2006 Manuel Bouyer. @@ -59,6 +59,7 @@ struct ahci_softc { #define AHCI_PCI_QUIRK_BAD64 __BIT(1) /* broken 64-bit DMA */ #define AHCI_QUIRK_BADPMP __BIT(2) /* broken PMP support, ignore */ #define AHCI_QUIRK_SKIP_RESET __BIT(4) /* skip drive reset sequence */ +#define AHCI_QUIRK_BADNCQ __BIT(5) /* possibly broken NCQ support, ignore */ uint32_t sc_ahci_cap; /* copy of AHCI_CAP */ int sc_ncmds; /* number of command slots */ Index: src/sys/dev/pci/ahcisata_pci.c diff -u src/sys/dev/pci/ahcisata_pci.c:1.56 src/sys/dev/pci/ahcisata_pci.c:1.57 --- src/sys/dev/pci/ahcisata_pci.c:1.56 Fri Oct 18 17:16:50 2019 +++ src/sys/dev/pci/ahcisata_pci.c Sat Jan 18 11:26:11 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: ahcisata_pci.c,v 1.56 2019/10/18 17:16:50 tnn Exp $ */ +/* $NetBSD: ahcisata_pci.c,v 1.57 2020/01/18 11:26:11 simonb Exp $ */ /* * Copyright (c) 2006 Manuel Bouyer. @@ -26,7 +26,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: ahcisata_pci.c,v 1.56 2019/10/18 17:16:50 tnn Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ahcisata_pci.c,v 1.57 2020/01/18 11:26:11 simonb Exp $"); #ifdef _KERNEL_OPT #include "opt_ahcisata_pci.h" @@ -179,17 +179,17 @@ static const struct ahci_pci_quirk ahci_ AHCI_PCI_QUIRK_FORCE }, /* ATI SB600 AHCI 64-bit DMA only works on some boards/BIOSes */ { PCI_VENDOR_ATI, PCI_PRODUCT_ATI_SB600_SATA_1, - AHCI_PCI_QUIRK_BAD64 | AHCI_QUIRK_BADPMP }, + AHCI_PCI_QUIRK_BAD64 | AHCI_QUIRK_BADPMP | AHCI_QUIRK_BADNCQ }, { PCI_VENDOR_ATI, PCI_PRODUCT_ATI_SB700_SATA_AHCI, - AHCI_QUIRK_BADPMP }, + AHCI_QUIRK_BADPMP | AHCI_QUIRK_BADNCQ }, { PCI_VENDOR_ATI, PCI_PRODUCT_ATI_SB700_SATA_RAID, - AHCI_QUIRK_BADPMP }, + AHCI_QUIRK_BADPMP | AHCI_QUIRK_BADNCQ }, { PCI_VENDOR_ATI, PCI_PRODUCT_ATI_SB700_SATA_RAID5, - AHCI_QUIRK_BADPMP }, + AHCI_QUIRK_BADPMP | AHCI_QUIRK_BADNCQ }, { PCI_VENDOR_ATI, PCI_PRODUCT_ATI_SB700_SATA_AHCI2, - AHCI_QUIRK_BADPMP }, + AHCI_QUIRK_BADPMP | AHCI_QUIRK_BADNCQ }, { PCI_VENDOR_ATI, PCI_PRODUCT_ATI_SB700_SATA_STORAGE, - AHCI_QUIRK_BADPMP }, + AHCI_QUIRK_BADPMP | AHCI_QUIRK_BADNCQ }, { PCI_VENDOR_VIATECH, PCI_PRODUCT_VIATECH_VT8237R_SATA, AHCI_QUIRK_BADPMP }, { PCI_VENDOR_VIATECH, PCI_PRODUCT_VIATECH_VT8251_SATA,