summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornwhitehorn <nwhitehorn@FreeBSD.org>2009-04-04 00:26:01 +0000
committernwhitehorn <nwhitehorn@FreeBSD.org>2009-04-04 00:26:01 +0000
commit1b19722cda9cd7e6a91916b21b893dac8324c67f (patch)
treef82df1a88c3ec46ed39207aea4901b6dec1391a7
parentef1e56b6d485dbe76218164db7b0414e30ab423c (diff)
downloadFreeBSD-src-1b19722cda9cd7e6a91916b21b893dac8324c67f.zip
FreeBSD-src-1b19722cda9cd7e6a91916b21b893dac8324c67f.tar.gz
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.
-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 366f9a1..c591d3d 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;
OpenPOWER on IntegriCloud