Cyrix ATA driver boot panic/patch, need more help.

From: Bruce R. Montague <brucem_at_cruzio.com>
Date: Wed, 16 Apr 2003 12:34:22 -0700 (PDT)
Hi, I've hit a solid sys/dev/ata driver panic on
boot due to unitinialized pointer in cyrix ATA
driver init code (and also need advice on additional
investigation).

"FreeBSD 5.0-CURRENT #0: Thu Apr 10"; on a Geode
GX1/5530 (Centaurus II). An earlier backup -Current
works fine (5.0-CURRENT #3: Mon Jan 20), not sure
about other -Current's in between.  The installation
was built from CVS and is completely vanilla, no
local mods.

Panic is due to null "ctrl->chip" value in
"ata-pci.c/ata_pcisub_probe()" at final statement
before final return ("ctrl" value is ok):

 ch->chiptype = ctrl->chip->chipid;

Re-coding routine "ata-chipset.c/ata_cyrix_ident()"
using the template provided by "ata_intel_ident()"
causes the ata driver to successfully probe and
attach. However, I'm not sure this is the only
problem, there appears to be a timing-related
problem, but I'm not sure it's even the driver.
In the course of executing the vanilla rc/driver
w/o debug printfs), the system completely hangs
hard (precluding debugger break etc.).  Inserting
debug I/O and putting set -x in rc alters behavior,
system has come up to prompt in this case).

The following patch causes the probe/attach to work:

=====
--- ata-chipset.c.old   Wed Apr 16 10:18:56 2003
+++ ata-chipset.c       Wed Apr 16 10:22:38 2003
_at__at_ -465,13 +465,20 _at__at_
 ata_cyrix_ident(device_t dev)
 {
     struct ata_pci_controller *ctlr = device_get_softc(dev);
+    struct ata_chip_id *idx;
+    static struct ata_chip_id ids[] =
+    {{ ATA_CYRIX_5530, 0, 0, 0x00, ATA_UDMA2, "Cyrix 5530" },
+     { 0, 0, 0, 0, 0, 0, }};
+    char buffer[64];
 
-    if (pci_get_devid(dev) == ATA_CYRIX_5530) {
-       device_set_desc(dev, "Cyrix 5530 ATA33 controller");
-       ctlr->chipinit = ata_cyrix_chipinit;
-       return 0;
-    }
-    return ENXIO;
+    if (!(idx = ata_match_chip(dev, ids, pci_get_slot(dev))))
+        return ENXIO;
+
+    sprintf(buffer, "%s %s controller", idx->text, ata_mode2str(idx->max_dma));
+    device_set_desc_copy(dev, buffer);
+    ctlr->chip = idx;
+    ctlr->chipinit = ata_cyrix_chipinit;
+    return 0;
 }
 
 static int
=======


Any advice on further debugging? Have I hit this
in the middle of big ata changes in progress
(appears somewhat from the CVS)? Are there other
ata driver areas worth a debugging look, areas
that likely haven't yet been conformed to new
"chip version" support or other changes, etc.?

Any info or help most appreciated, thanks!




 - bruce
Received on Wed Apr 16 2003 - 11:06:33 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:37:03 UTC