Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 10 Mar 2003 07:10:43 +0100 (CET)
From:      Soeren Schmidt <sos@spider.deepcore.dk>
To:        "Bruce R. Montague" <brucem@cruzio.com>
Cc:        freebsd-current@FreeBSD.ORG, sos@FreeBSD.ORG
Subject:   Re: ATA CS5530 (cyrix) driver panic (ata_cyrix_setmode())
Message-ID:  <200303100610.h2A6AhX5044154@spider.deepcore.dk>
In-Reply-To: <200303100606.h2A66tn01508@cruzio.com>

next in thread | previous in thread | raw e-mail | index | archive | help
It seems Bruce R. Montague wrote:
> 
> /* is busmastering supported ? */
> if ((cmd & (PCIM_CMD_PORTEN | PCIM_CMD_BUSMASTEREN)) ==
> (PCIM_CMD_PORTEN | PCIM_CMD_BUSMASTEREN)) {
> 
> failed because "cmd" was 0x01 instead of 0x05 (the
> PORTEN | BUSMASTEREN is 0x05). The 5530 datasheet
> (well, SC1200 datasheet) says cmd bit 2 (Bus
> Master) must be set to 1...  why isnt it?
> 
> Changing the code at the top of ata_pci_attach()
> from:
>  cmd = pci_read_config(dev, PCIR_COMMAND, 2);
> 
> to:
>  pci_write_config(dev, PCIR_COMMAND, 0x05, 2 );
>  cmd = pci_read_config(dev, PCIR_COMMAND, 2);
> 
> causes the driver to not to panic on "ata_cyrix_setmode()";
> it appears to complete both the probe and attach boot
> operations.
>
> Now the driver is dying (the system is hanging)
> at the first attempt to use dma, that is, after
> the first call to "ata_dmastart()".  The
> "ata_dmastart()" completes ok, but the system
> immediatly hangs (it appears up, but spinning at
> interrupt level or somesuch, I can sometimes break
> into ddb or scroll the console a bit before things
> totally freeze). I'll see what else I can find.

Thats probably because the HW hasn't been setup to be able to
do busmastering.

> The older version of -current doesn't have this
> problem. I'll see if I can find why. It's the
> same hardware, I can boot either system and the
> old ata driver works ok. I'm debugging the new
> -current under the old working -current. Did
> something change in the PCI initialization that's
> likely a cause?

Setting up busmastering and the enabled bit is a BIOS thing, I
only test for it being enabled and that has not changed in the
ATA driver for a loooog time. 

Now the driver fails to survive a missing DMA bit, and thats a
bug alright, the following patch should solve that:

Index: ata-chipset.c
===================================================================
RCS file: /home/ncvs/src/sys/dev/ata/ata-chipset.c,v
retrieving revision 1.11
diff -u -r1.11 ata-chipset.c
--- ata-chipset.c	3 Mar 2003 11:51:08 -0000	1.11
+++ ata-chipset.c	9 Mar 2003 21:58:52 -0000
@@ -480,7 +480,10 @@
     if (ata_default_interrupt(dev))
 	return ENXIO;
 
-    ctlr->setmode = ata_cyrix_setmode;
+    if (ctlr->r_bmio)
+	ctlr->setmode = ata_cyrix_setmode;
+    else
+	ctlr->setmode = ata_generic_setmode;
     return 0;
 }
 
-Søren

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200303100610.h2A6AhX5044154>