From ea828b0636ed21d83f74d8a8987f023e14464ce9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B8ren=20Schmidt?= Date: Mon, 8 Dec 2003 08:27:52 +0000 Subject: [PATCH] Fix more problems with the Silicon Image 3112A: Setup decent transfer mode defaults as some BIOS's seem to put in things that it *knows* doesn't work. (Note to BIOS writers: stop doing that nonsense, we will get things working with your crappy HW anyways, and then recommend users to buy someone else's products that "just works", thankyou.. ) Limit the device transfer mode to ATA100/UDMA5 on generic SATA. Since we dont know if the user is using a pure SATA device or an old PATA drive with a SATA converter dongle, we need to limit the speed used here to cover up the problems with Marvell ATA-SATA bridges used in lots of SATA products. This workaround is enabled for all detectable SATA controllers as they seem to have semilar problems here. One notable exception is all the Promise pdc2037x chips which just always work (cudos to Promise!). --- sys/dev/ata/ata-chipset.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/sys/dev/ata/ata-chipset.c b/sys/dev/ata/ata-chipset.c index 9c03dc3ac2e9..217499d4423c 100644 --- a/sys/dev/ata/ata-chipset.c +++ b/sys/dev/ata/ata-chipset.c @@ -171,7 +171,13 @@ ata_generic_setmode(struct ata_device *atadev, int mode) static void ata_sata_setmode(struct ata_device *atadev, int mode) { - mode = ata_limit_mode(atadev, mode, ATA_DMA_MAX); + /* + * we limit the transfer mode to UDMA5/ATA100 as some chips/drive + * comboes that use the Marvell SATA->PATA converters has trouble + * with UDMA6/ATA133. This doesn't really matter as real SATA + * devices doesn't use this anyway. + */ + mode = ata_limit_mode(atadev, mode, ATA_UDMA5); if (!ata_controlcmd(atadev, ATA_SETFEATURES, ATA_SF_SETXFER, 0, mode)) atadev->mode = mode; } @@ -1633,6 +1639,16 @@ ata_sii_chipinit(device_t dev) /* enable interrupt as BIOS might not */ pci_write_config(dev, 0x8a, (pci_read_config(dev, 0x8a, 1) & 0x3f), 1); + /* setup chipset defaults as BIOS might not */ + pci_write_config(dev, 0xa2, 0x328a, 2); + pci_write_config(dev, 0xa4, 0x328a328a, 4); + pci_write_config(dev, 0xa8, 0x22082208, 4); + pci_write_config(dev, 0xac, 0x40094009, 4); + pci_write_config(dev, 0xe2, 0x328a, 2); + pci_write_config(dev, 0xe4, 0x328a328a, 4); + pci_write_config(dev, 0xe8, 0x22082208, 4); + pci_write_config(dev, 0xec, 0x40094009, 4); + ctlr->allocate = ata_sii_mio_allocate; if (ctlr->chip->max_dma >= ATA_SA150) ctlr->setmode = ata_sata_setmode;