svn commit: r190682 - head/sys/dev/ata/chipsets

Nathan Whitehorn nwhitehorn at FreeBSD.org
Fri Apr 3 17:26:02 PDT 2009


Author: nwhitehorn
Date: Sat Apr  4 00:26:01 2009
New Revision: 190682
URL: http://svn.freebsd.org/changeset/base/190682

Log:
  The Serverworks SATA chipsets used in Apple G5 systems require requiring
  the ATA status register with a 4-byte read request. This updates it, and
  subsequent 1-byte reads will return the correct result.
  
  This commit adds a hack to do this, which is currently ifdef'd powerpc,
  although Linux and Darwin do this unconditionally on all platforms.

Modified:
  head/sys/dev/ata/chipsets/ata-serverworks.c

Modified: head/sys/dev/ata/chipsets/ata-serverworks.c
==============================================================================
--- head/sys/dev/ata/chipsets/ata-serverworks.c	Sat Apr  4 00:22:44 2009	(r190681)
+++ head/sys/dev/ata/chipsets/ata-serverworks.c	Sat Apr  4 00:26:01 2009	(r190682)
@@ -58,6 +58,9 @@ static int ata_serverworks_ch_detach(dev
 static void ata_serverworks_tf_read(struct ata_request *request);
 static void ata_serverworks_tf_write(struct ata_request *request);
 static void ata_serverworks_setmode(device_t dev, int mode);
+#ifdef __powerpc__
+static int ata_serverworks_status(device_t dev);
+#endif
 
 /* misc defines */
 #define SWKS_33		0
@@ -98,6 +101,23 @@ ata_serverworks_probe(device_t dev)
     return 0;
 }
 
+#ifdef __powerpc__
+static int
+ata_serverworks_status(device_t dev)
+{
+    struct ata_channel *ch = device_get_softc(dev);
+
+    /*
+     * We need to do a 4-byte read on the status reg before the values
+     * will report correctly
+     */
+
+    ATA_IDX_INL(ch,ATA_STATUS);
+
+    return ata_pci_status(dev);
+}
+#endif
+
 static int
 ata_serverworks_chipinit(device_t dev)
 {
@@ -186,6 +206,9 @@ ata_serverworks_ch_attach(device_t dev)
     ata_pci_hw(dev);
     ch->hw.tf_read = ata_serverworks_tf_read;
     ch->hw.tf_write = ata_serverworks_tf_write;
+#ifdef __powerpc__
+    ch->hw.status = ata_serverworks_status;
+#endif
 
     /* chip does not reliably do 64K DMA transfers */
     ch->dma.max_iosize = 64 * DEV_BSIZE;


More information about the svn-src-head mailing list