Subject: Re: PATA disk drive not being configured in 2.0.2
To: Dieter <netbsd@sopwith.solgatos.com>
From: Manuel Bouyer <bouyer@antioche.eu.org>
List: port-alpha
Date: 06/10/2005 21:28:38
--gBBFr7Ir9EOA20Yy
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

On Tue, Jun 07, 2005 at 05:06:08PM +0100, Dieter wrote:
> Alpha 164LX running 2.0.2
> 1 CD/DVD drive connected to the onboard CMD PATA controller.
> 
> > Can you try a kernel compiled with ddb (to get a stack trace), and with
> > makeoptions     DEBUG="-g"
> > Then get a stack trace, and also use gdb to find the line where it faults:
> > gdb netbsd.gdb
> > list *(0xfffffc00004f4b74)
> 
> cmdide0 at pci0 dev 11 function 0
> cmdide0: CMD Technology PCI0646 (rev. 0x01)
> cmdide0: bus-master DMA support present
> cmdide0: primary channel wired to compatibility mode
> cmdide0: primary channel interrupting at isa irq 14
> atabus2 at cmdide0 channel 0
> cmdide0: secondary channel wired to compatibility mode
> cmdide0: secondary channel interrupting at isa irq 15
> atabus3 at cmdide0 channel 1
> isa0 at sio0
> 
> [ ... ]
> 
> satalink0: port 1: device present, speed: 1.5Gb/s
> wd0 at atabus1 drive 0scsibus0: waiting 2 seconds for devices to settle...
> : <ST3250823AS>
> wd0: drive supports 16-sector PIO transfers, LBA48 addressing
> wd0: 232 GB, 484521 cyl, 16 head, 63 sec, 512 bytes/sect x 488397168 sectors
> 
> unexpected machine check:
> 
>     mces    = 0x1
>     vector  = 0x670
>     param   = 0xfffffc0000006068
>     pc      = 0xfffffc00004fddb4
>     ra      = 0xfffffc00004e98b8
>     code    = 0x98
>     curlwp = 0xfffffc0000ade780
>         pid = 9.1, comm = atabus2
> 
> panic: machine check
> syncing disks... done
> rebooting...
> 
> ======================================================
> 
> (gdb) list *(0xfffffc00004fddb4)
> 0xfffffc00004fddb4 is in cia_swiz_io_read_1 (pci_swiz_bus_io_chipdep.c:673).
> 668             tmpioh = ioh + off;
> 669             offset = tmpioh & 3;
> 670             port = (u_int32_t *)((tmpioh << CHIP_ADDR_SHIFT) |
> 671                 (0 << CHIP_SIZE_SHIFT));
> 672             val = *port;
> 673             rval = ((val) >> (8 * offset)) & 0xff;
> 674
> 675             return rval;
> 676     }
> 677
> (gdb) 
> 
> ======================================================
> unexpected machine check:
> 
>     mces    = 0x1
>     vector  = 0x670
>     param   = 0xfffffc0000006068
>     pc      = 0xfffffc00004fddb4
>     ra      = 0xfffffc00004e98b8
>     code    = 0x98
>     curlwp = 0xfffffc0000ade780
>         pid = 9.1, comm = atabus2
> 
> panic: machine check
> Stopped in pid 9.1 (atabus2) at netbsd:cpu_Debugger+0x4:        ret     zero,(ra
> )
> db> bt
> cpu_Debugger() at netbsd:cpu_Debugger+0x4
> panic() at netbsd:panic+0x1e8
> machine_check() at netbsd:machine_check+0x234
> interrupt() at netbsd:interrupt+0x1e8
> XentInt() at netbsd:XentInt+0x1c
> --- interrupt (from ipl 4) ---
> cia_swiz_io_read_1() at netbsd:cia_swiz_io_read_1+0x14
> pciide_irqack() at netbsd:pciide_irqack+0x38
> cmd646_9_irqack() at netbsd:cmd646_9_irqack+0xb8
> wdcprobe1() at netbsd:wdcprobe1+0xc5c
> wdc_drvprobe() at netbsd:wdc_drvprobe+0x44
> atabusconfig() at netbsd:atabusconfig+0x78
> atabus_thread() at netbsd:atabus_thread+0x7c
> exception_return() at netbsd:exception_return
> --- root of call graph ---
> db>

It looks like it can't access the DMA registers. This can be because dma_iohs[]
contains the wrong values.
Can you try the attached patch an report what it prints ?

-- 
Manuel Bouyer <bouyer@antioche.eu.org>
     NetBSD: 26 ans d'experience feront toujours la difference
--

--gBBFr7Ir9EOA20Yy
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=diff

Index: pciide_common.c
===================================================================
RCS file: /cvsroot/src/sys/dev/pci/pciide_common.c,v
retrieving revision 1.27
diff -u -r1.27 pciide_common.c
--- pciide_common.c	29 May 2005 22:16:00 -0000	1.27
+++ pciide_common.c	10 Jun 2005 19:28:20 -0000
@@ -437,6 +437,8 @@
 					      "size %lu", reg, (u_long)size);
 				return;
 			}
+			printf("pciide_mapreg_dma: reg %d addr 0x%lx\n",
+			    reg, pc->dma_iohs[reg]);
 		}
 	}
 }
@@ -767,6 +769,7 @@
 	struct pciide_softc *sc = CHAN_TO_PCIIDE(chp);
 
 	/* clear status bits in IDE DMA registers */
+	printf("pciide_irqack: reg 0x%lx\n", cp->dma_iohs[IDEDMA_CTL]);
 	bus_space_write_1(sc->sc_dma_iot, cp->dma_iohs[IDEDMA_CTL], 0,
 	    bus_space_read_1(sc->sc_dma_iot, cp->dma_iohs[IDEDMA_CTL], 0));
 }

--gBBFr7Ir9EOA20Yy--