Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 2 Jan 2012 17:19:58 +0000 (UTC)
From:      Alexander Motin <mav@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
Subject:   svn commit: r229291 - in stable/9: share/man/man4 sys/dev/ahci sys/dev/ata/chipsets
Message-ID:  <201201021719.q02HJw9O076663@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: mav
Date: Mon Jan  2 17:19:58 2012
New Revision: 229291
URL: http://svn.freebsd.org/changeset/base/229291

Log:
  MFC r228200:
  Add hw.ahci.force tunable to control whether AHCI drivers should attach
  to known AHCI-capable chips (AMD/NVIDIA), configured for legacy emulation.
  
  Enabled by default to get additional performance and functionality of AHCI
  when it can't be enabled by BIOS. Can be disabled to honor BIOS settings if
  needed for some reason.

Modified:
  stable/9/share/man/man4/ahci.4
  stable/9/sys/dev/ahci/ahci.c
  stable/9/sys/dev/ata/chipsets/ata-ati.c
  stable/9/sys/dev/ata/chipsets/ata-nvidia.c
Directory Properties:
  stable/9/share/man/man4/   (props changed)
  stable/9/sys/   (props changed)
  stable/9/sys/amd64/include/xen/   (props changed)
  stable/9/sys/boot/   (props changed)
  stable/9/sys/boot/i386/efi/   (props changed)
  stable/9/sys/boot/ia64/efi/   (props changed)
  stable/9/sys/boot/ia64/ski/   (props changed)
  stable/9/sys/boot/powerpc/boot1.chrp/   (props changed)
  stable/9/sys/boot/powerpc/ofw/   (props changed)
  stable/9/sys/cddl/contrib/opensolaris/   (props changed)
  stable/9/sys/conf/   (props changed)
  stable/9/sys/contrib/dev/acpica/   (props changed)
  stable/9/sys/contrib/octeon-sdk/   (props changed)
  stable/9/sys/contrib/pf/   (props changed)
  stable/9/sys/contrib/x86emu/   (props changed)

Modified: stable/9/share/man/man4/ahci.4
==============================================================================
--- stable/9/share/man/man4/ahci.4	Mon Jan  2 17:16:08 2012	(r229290)
+++ stable/9/share/man/man4/ahci.4	Mon Jan  2 17:19:58 2012	(r229291)
@@ -24,7 +24,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd May 17, 2011
+.Dd December 2, 2011
 .Dt AHCI 4
 .Os
 .Sh NAME
@@ -96,6 +96,9 @@ A manual bus reset is needed on device h
 .It Va hint.ahcich. Ns Ar X Ns Va .sata_rev
 setting to nonzero value limits maximum SATA revision (speed).
 Values 1, 2 and 3 are respectively 1.5, 3 and 6Gbps.
+.It Va hw.ahci.force
+setting to nonzero value forces driver attach to some known AHCI-capable
+chips even if they are configured for legacy IDE emulation. Default is 1.
 .El
 .Sh DESCRIPTION
 This driver provides the

Modified: stable/9/sys/dev/ahci/ahci.c
==============================================================================
--- stable/9/sys/dev/ahci/ahci.c	Mon Jan  2 17:16:08 2012	(r229290)
+++ stable/9/sys/dev/ahci/ahci.c	Mon Jan  2 17:19:58 2012	(r229291)
@@ -291,6 +291,9 @@ static struct {
 #define RECOVERY_REQUEST_SENSE	2
 #define recovery_slot		spriv_field1
 
+static int force_ahci = 1;
+TUNABLE_INT("hw.ahci.force", &force_ahci);
+
 static int
 ahci_probe(device_t dev)
 {
@@ -308,7 +311,8 @@ ahci_probe(device_t dev)
 	for (i = 0; ahci_ids[i].id != 0; i++) {
 		if (ahci_ids[i].id == devid &&
 		    ahci_ids[i].rev <= revid &&
-		    (valid || !(ahci_ids[i].quirks & AHCI_Q_NOFORCE))) {
+		    (valid || (force_ahci == 1 &&
+		     !(ahci_ids[i].quirks & AHCI_Q_NOFORCE)))) {
 			/* Do not attach JMicrons with single PCI function. */
 			if (pci_get_vendor(dev) == 0x197b &&
 			    (pci_read_config(dev, 0xdf, 1) & 0x40) == 0)

Modified: stable/9/sys/dev/ata/chipsets/ata-ati.c
==============================================================================
--- stable/9/sys/dev/ata/chipsets/ata-ati.c	Mon Jan  2 17:16:08 2012	(r229290)
+++ stable/9/sys/dev/ata/chipsets/ata-ati.c	Mon Jan  2 17:19:58 2012	(r229291)
@@ -53,6 +53,7 @@ __FBSDID("$FreeBSD$");
 
 /* local prototypes */
 static int ata_ati_chipinit(device_t dev);
+static int ata_ati_dumb_ch_attach(device_t dev);
 static int ata_ati_ixp700_ch_attach(device_t dev);
 static int ata_ati_setmode(device_t dev, int target, int mode);
 
@@ -63,6 +64,8 @@ static int ata_ati_setmode(device_t dev,
 #define SII_MEMIO       1
 #define SII_BUG         0x04
 
+static int force_ahci = 1;
+TUNABLE_INT("hw.ahci.force", &force_ahci);
 
 /*
  * ATI chipset support functions
@@ -111,7 +114,10 @@ ata_ati_probe(device_t dev)
 	ctlr->chipinit = ata_sii_chipinit;
 	break;
     case ATI_AHCI:
-	ctlr->chipinit = ata_ahci_chipinit;
+	if (force_ahci == 1 || pci_get_subclass(dev) != PCIS_STORAGE_IDE)
+		ctlr->chipinit = ata_ahci_chipinit;
+	else
+		ctlr->chipinit = ata_ati_chipinit;
 	break;
     }
     return (BUS_PROBE_DEFAULT);
@@ -127,6 +133,11 @@ ata_ati_chipinit(device_t dev)
     if (ata_setup_interrupt(dev, ata_generic_intr))
 	return ENXIO;
 
+    if (ctlr->chip->cfg1 == ATI_AHCI) {
+	ctlr->ch_attach = ata_ati_dumb_ch_attach;
+	ctlr->setmode = ata_sata_setmode;
+	return (0);
+    }
     switch (ctlr->chip->chipid) {
     case ATA_ATI_IXP600:
 	/* IXP600 only has 1 PATA channel */
@@ -165,6 +176,17 @@ ata_ati_chipinit(device_t dev)
 }
 
 static int
+ata_ati_dumb_ch_attach(device_t dev)
+{
+	struct ata_channel *ch = device_get_softc(dev);
+
+	if (ata_pci_ch_attach(dev))
+		return ENXIO;
+	ch->flags |= ATA_SATA;
+	return (0);
+}
+
+static int
 ata_ati_ixp700_ch_attach(device_t dev)
 {
 	struct ata_pci_controller *ctlr = device_get_softc(device_get_parent(dev));

Modified: stable/9/sys/dev/ata/chipsets/ata-nvidia.c
==============================================================================
--- stable/9/sys/dev/ata/chipsets/ata-nvidia.c	Mon Jan  2 17:16:08 2012	(r229290)
+++ stable/9/sys/dev/ata/chipsets/ata-nvidia.c	Mon Jan  2 17:19:58 2012	(r229291)
@@ -65,6 +65,8 @@ static int ata_nvidia_setmode(device_t d
 #define NVAHCI          0x04
 #define NVNOFORCE       0x08
 
+static int force_ahci = 1;
+TUNABLE_INT("hw.ahci.force", &force_ahci);
 
 /*
  * nVidia chipset support functions
@@ -181,7 +183,7 @@ ata_nvidia_probe(device_t dev)
 
     ata_set_desc(dev);
     if ((ctlr->chip->cfg1 & NVAHCI) &&
-	((ctlr->chip->cfg1 & NVNOFORCE) == 0 ||
+	((force_ahci == 1 && (ctlr->chip->cfg1 & NVNOFORCE) == 0) ||
 	 pci_get_subclass(dev) != PCIS_STORAGE_IDE))
 	ctlr->chipinit = ata_ahci_chipinit;
     else



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201201021719.q02HJw9O076663>