Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 9 Aug 2011 07:35:57 +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-8@freebsd.org
Subject:   svn commit: r224725 - in stable/8/sys/dev: ahci ata/chipsets
Message-ID:  <201108090735.p797ZvVk082239@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: mav
Date: Tue Aug  9 07:35:56 2011
New Revision: 224725
URL: http://svn.freebsd.org/changeset/base/224725

Log:
  MFC r224603:
  Do not force AHCI mode on NVIDIA MCP89 SATA controllers.  Recent Apple
  Mac with this chipset does not initialize AHCI mode unless it is started
  from EFI loader.  However, legacy ATA mode works.

Modified:
  stable/8/sys/dev/ahci/ahci.c
  stable/8/sys/dev/ata/chipsets/ata-nvidia.c
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)

Modified: stable/8/sys/dev/ahci/ahci.c
==============================================================================
--- stable/8/sys/dev/ahci/ahci.c	Tue Aug  9 04:24:56 2011	(r224724)
+++ stable/8/sys/dev/ahci/ahci.c	Tue Aug  9 07:35:56 2011	(r224725)
@@ -264,7 +264,7 @@ static struct {
 	{0x0abe10de, 0x00, "NVIDIA MCP79",	AHCI_Q_NOAA},
 	{0x0abf10de, 0x00, "NVIDIA MCP79",	AHCI_Q_NOAA},
 	{0x0d8410de, 0x00, "NVIDIA MCP89",	AHCI_Q_NOAA},
-	{0x0d8510de, 0x00, "NVIDIA MCP89",	AHCI_Q_NOAA},
+	{0x0d8510de, 0x00, "NVIDIA MCP89",	AHCI_Q_NOFORCE|AHCI_Q_NOAA},
 	{0x0d8610de, 0x00, "NVIDIA MCP89",	AHCI_Q_NOAA},
 	{0x0d8710de, 0x00, "NVIDIA MCP89",	AHCI_Q_NOAA},
 	{0x0d8810de, 0x00, "NVIDIA MCP89",	AHCI_Q_NOAA},

Modified: stable/8/sys/dev/ata/chipsets/ata-nvidia.c
==============================================================================
--- stable/8/sys/dev/ata/chipsets/ata-nvidia.c	Tue Aug  9 04:24:56 2011	(r224724)
+++ stable/8/sys/dev/ata/chipsets/ata-nvidia.c	Tue Aug  9 07:35:56 2011	(r224725)
@@ -54,6 +54,7 @@ __FBSDID("$FreeBSD$");
 /* local prototypes */
 static int ata_nvidia_chipinit(device_t dev);
 static int ata_nvidia_ch_attach(device_t dev);
+static int ata_nvidia_ch_attach_dumb(device_t dev);
 static int ata_nvidia_status(device_t dev);
 static void ata_nvidia_reset(device_t dev);
 static int ata_nvidia_setmode(device_t dev, int target, int mode);
@@ -62,6 +63,7 @@ static int ata_nvidia_setmode(device_t d
 #define NV4             0x01
 #define NVQ             0x02
 #define NVAHCI          0x04
+#define NVNOFORCE       0x08
 
 
 /*
@@ -158,7 +160,7 @@ ata_nvidia_probe(device_t dev)
      { ATA_NFORCE_MCP79_AA, 0, NVAHCI,  0, ATA_SA300, "nForce MCP79" },
      { ATA_NFORCE_MCP79_AB, 0, NVAHCI,  0, ATA_SA300, "nForce MCP79" },
      { ATA_NFORCE_MCP89_A0, 0, NVAHCI,  0, ATA_SA300, "nForce MCP89" },
-     { ATA_NFORCE_MCP89_A1, 0, NVAHCI,  0, ATA_SA300, "nForce MCP89" },
+     { ATA_NFORCE_MCP89_A1, 0, NVAHCI|NVNOFORCE, 0, ATA_SA300, "nForce MCP89" },
      { ATA_NFORCE_MCP89_A2, 0, NVAHCI,  0, ATA_SA300, "nForce MCP89" },
      { ATA_NFORCE_MCP89_A3, 0, NVAHCI,  0, ATA_SA300, "nForce MCP89" },
      { ATA_NFORCE_MCP89_A4, 0, NVAHCI,  0, ATA_SA300, "nForce MCP89" },
@@ -178,7 +180,9 @@ ata_nvidia_probe(device_t dev)
 	return ENXIO;
 
     ata_set_desc(dev);
-    if (ctlr->chip->cfg1 & NVAHCI)
+    if ((ctlr->chip->cfg1 & NVAHCI) &&
+	((ctlr->chip->cfg1 & NVNOFORCE) == 0 ||
+	 pci_get_subclass(dev) != PCIS_STORAGE_IDE))
 	ctlr->chipinit = ata_ahci_chipinit;
     else
 	ctlr->chipinit = ata_nvidia_chipinit;
@@ -193,7 +197,10 @@ ata_nvidia_chipinit(device_t dev)
     if (ata_setup_interrupt(dev, ata_generic_intr))
 	return ENXIO;
 
-    if (ctlr->chip->max_dma >= ATA_SA150) {
+    if (ctlr->chip->cfg1 & NVAHCI) {
+	ctlr->ch_attach = ata_nvidia_ch_attach_dumb;
+	ctlr->setmode = ata_sata_setmode;
+    } else if (ctlr->chip->max_dma >= ATA_SA150) {
 	if (pci_read_config(dev, PCIR_BAR(5), 1) & 1)
 	    ctlr->r_type2 = SYS_RES_IOPORT;
 	else
@@ -264,6 +271,17 @@ ata_nvidia_ch_attach(device_t dev)
     return 0;
 }
 
+static int
+ata_nvidia_ch_attach_dumb(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_nvidia_status(device_t dev)
 {



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