Date: Fri, 2 Feb 2007 00:57:44 +0000 From: Andrea Bittau <a.bittau@cs.ucl.ac.uk> To: freebsd-current@freebsd.org Cc: sos@FreeBSD.org Subject: [PATCH] Fix VIA 6421 SATA (cardbus) controller---ignore SATA registers Message-ID: <20070202005744.GA1390@shorty.sorbonet.org>
index | next in thread | raw e-mail
This patch makes a cardbus VIA 6421 SATA150 controller that I have work.
Basically, the SATA registers on the card seemed screwed up. I don't know if
it's a good idea to always try and ignore them if "bogus" [in my case,
0xFFFFFFFF] values are returned. In this patch I added a nasty quirk that does
the job for me.
Note, to get this particular card to work, you also need to:
sysctl hw.cbb.start_32_io=0
This is needed because it uses 0xaf0 as a port.
---
Index: ata-chipset.c
===================================================================
RCS file: /home/ncvs/src/sys/dev/ata/ata-chipset.c,v
retrieving revision 1.179
diff -u -p -r1.179 ata-chipset.c
--- ata-chipset.c 4 Jan 2007 16:09:11 -0000 1.179
+++ ata-chipset.c 2 Feb 2007 00:44:20 -0000
@@ -295,6 +295,11 @@ ata_sata_connect(struct ata_channel *ch)
{
u_int32_t status;
int timeout;
+ struct ata_pci_controller *ctlr;
+
+ ctlr = device_get_softc(device_get_parent(ch->dev));
+ if (ctlr->chip->chipid == ATA_VIA6421)
+ goto skip_sr;
/* wait up to 1 second for "connect well" */
for (timeout = 0; timeout < 100 ; timeout++) {
@@ -312,7 +317,7 @@ ata_sata_connect(struct ata_channel *ch)
/* clear SATA error register */
ATA_IDX_OUTL(ch, ATA_SERROR, ATA_IDX_INL(ch, ATA_SERROR));
-
+skip_sr:
/* find out what type device we got poll for spec'd 31 seconds */
/* XXX SOS 10 secs for now as I have little patience */
ch->devices = 0;
@@ -4961,8 +4966,13 @@ static void
ata_via_reset(device_t dev)
{
struct ata_channel *ch = device_get_softc(dev);
+ struct ata_pci_controller *ctlr = device_get_softc(device_get_parent(dev));
- ata_sata_phy_enable(ch);
+ /* SATA registers are messed up on this chip---ignore them. -sorbo */
+ if (ctlr->chip->chipid == ATA_VIA6421)
+ ata_sata_connect(ch);
+ else
+ ata_sata_phy_enable(ch);
}
static void
home |
help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20070202005744.GA1390>
