aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNathan Whitehorn <nwhitehorn@FreeBSD.org>2009-04-04 00:26:01 +0000
committerNathan Whitehorn <nwhitehorn@FreeBSD.org>2009-04-04 00:26:01 +0000
commit95b2008950e6dbdba99dd375a852206e8cf16cb3 (patch)
treef82df1a88c3ec46ed39207aea4901b6dec1391a7
parent1c96bdd14645b8778bd1ec4e0ddcdda18195a99f (diff)
downloadsrc-95b2008950e6dbdba99dd375a852206e8cf16cb3.tar.gz
src-95b2008950e6dbdba99dd375a852206e8cf16cb3.zip
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.
Notes
Notes: svn path=/head/; revision=190682
-rw-r--r--sys/dev/ata/chipsets/ata-serverworks.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/sys/dev/ata/chipsets/ata-serverworks.c b/sys/dev/ata/chipsets/ata-serverworks.c
index 366f9a185ec7..c591d3d0ae9a 100644
--- a/sys/dev/ata/chipsets/ata-serverworks.c
+++ b/sys/dev/ata/chipsets/ata-serverworks.c
@@ -58,6 +58,9 @@ static int ata_serverworks_ch_detach(device_t 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;