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.
This commit is contained in:
Nathan Whitehorn 2009-04-04 00:26:01 +00:00
parent 1c96bdd146
commit 95b2008950
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=190682

View File

@ -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;