NetBSD Problem Report #7324
Received: (qmail 8170 invoked from network); 5 Apr 1999 11:48:33 -0000
Message-Id: <199904051136.MAA02078@black-star.demon.co.uk>
Date: Mon, 5 Apr 1999 12:36:40 +0100 (BST)
From: mpumford@black-star.demon.co.uk
Reply-To: mpumford@black-star.demon.co.uk
To: gnats-bugs@gnats.netbsd.org
Subject: Fails to detect IDE devices on Simtec IDE interface
X-Send-Pr-Version: 3.95
>Number: 7324
>Category: port-arm32
>Synopsis: Fails to detect IDE devices on Simtec IDE interface
>Confidential: no
>Severity: serious
>Priority: high
>Responsible: port-arm32-maintainer
>State: closed
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Mon Apr 05 04:50:00 +0000 1999
>Closed-Date: Tue Apr 13 12:59:14 +0000 1999
>Last-Modified: Tue Apr 13 13:00:13 +0000 1999
>Originator: Mike Pumford
>Release: All kernels supped 11/03/1999 until 01/04/1999
>Organization:
>Environment:
Acorn RiscPC 48MB RAM 2MB VRAM
Acorn SCSI Card
Simtec IDE Interface
Seagate 6.4GB UDMA drive attached to Simtec interface
Pioneer DRM-602X CDROM attached to Acorn SCSI interface.
System: NetBSD black-star.demon.co.uk 1.3K NetBSD 1.3K (BLACK-STAR) #40: Thu Mar 25 01:18:39 GMT 1999 mpumford@black-star.demon.co.uk:/usr/src/netbsd/sys/arch/arm32/compile/BLACK-STAR arm32
>Description:
The kernel fails to detect devices attached to the Simtec IDE card at boot and
as a consequence fails to find wd0 the root device.
Reverting to v1.60 of sys/dev/ic/wdc.c solves this problem and allows the boot
to continue.
>How-To-Repeat:
Boot the kernel.
>Fix:
>Release-Note:
>Audit-Trail:
From: Manuel Bouyer <bouyer@antioche.lip6.fr>
To: mpumford@black-star.demon.co.uk
Cc: gnats-bugs@gnats.netbsd.org
Subject: Re: port-arm32/7324: Fails to detect IDE devices on Simtec IDE interface
Date: Mon, 5 Apr 1999 16:21:14 +0200
On Apr 5, mpumford@black-star.demon.co.uk wrote
>
> >Description:
> The kernel fails to detect devices attached to the Simtec IDE card at boot and
> as a consequence fails to find wd0 the root device.
>
> Reverting to v1.60 of sys/dev/ic/wdc.c solves this problem and allows the boot
> to continue.
>
What version of sys/dev/ic/wdc.c did you use ? Current version is
1.66 (1.66.0.2 on the 1.4 branch), please give it a try.
--
Manuel Bouyer, LIP6, Universite Paris VI. Manuel.Bouyer@lip6.fr
--
From: Mark Brinicombe <mark@causality.com>
To: mpumford@black-star.demon.co.uk
Cc: gnats-bugs@gnats.netbsd.org
Subject: Re: port-arm32/7324: Fails to detect IDE devices on Simtec IDE interface
Date: Tue, 6 Apr 1999 00:06:03 -0700 (PDT)
Hi,
Can you try the 1.4_ALPHA kernels that are online. With these kernels I
see the card/cable fault error (needs fixing) but was able to probe and
attach the IDE disk fitted to the card.
Mark
From: Mike Pumford <mpumford@black-star.demon.co.uk>
To: mark@causality.com
Cc: gnats-bugs@gnats.netbsd.org
Subject: Re: port-arm32/7324: Fails to detect IDE devices on Simtec IDE interface
Date: Tue, 06 Apr 1999 23:34:26 +0100
> Hi,
> Can you try the 1.4_ALPHA kernels that are online. With these kernels I
> see the card/cable fault error (needs fixing) but was able to probe and
> attach the IDE disk fitted to the card.
>
No luck I'm afraid. I also tried the disk on the internal IDE interface. It
was probed correctly but the kernel panicked immediately afterwards with a
prefetch abort in supervisor mode.
Mike
From: Mike Pumford <mpumford@black-star.demon.co.uk>
To: Manuel Bouyer <bouyer@antioche.lip6.fr>
Cc: gnats-bugs@gnats.netbsd.org
Subject: Re: port-arm32/7324: Fails to detect IDE devices on Simtec IDE interface
Date: Wed, 07 Apr 1999 19:17:51 +0100
> Oh well ... could you turn on debugging messages and send me the dmesg output ?
> Set wdcdebug_atapi_mask, wdcdebug_mask and wdcdebug_wd_mask to 0x10
> (DEBUG_PROBE). This can be done in sources, or with gdb on the binary:
> gdb --write /netbsd
> set wdcdebug_atapi_mask=0x10
> set wdcdebug_mask=0x10
> set wdcdebug_wd_mask=0x10
> quit
>
I patched both the last working kernel I have (with v1.60) and the kernel
which fails to probe.
This is the standard RISCPC 1.4_ALPHA distribution kernel on ftp.netbsd.org
patched as described above.
The drive is the master on the primary device:
simide0 at podulebus0 [podule 1]:
simide0:0: before reset, st0=0x50, st1=0x0
simide0:0: wdcwait_reset() end, st0=0x50, st1=0x0
simide0:0: after reset, ret_value=0x3
simide0:0:0: after reset, sc=0x0 sn=0x27 cl=0x7a ch=0xc
simide0:0:1: after reset, sc=0x0 sn=0x27 cl=0x7a ch=0xc
simide0:0:1: not ready
wdcattach: ch_drive_flags 0x4 0x0
simide0:0: wdcwait_reset() end, st0=0x50, st1=0x0
simide0:1: before reset, st0=0xff, st1=0xff
This is the last working kernel I built for myself again patched as described
above with the same hardware configuration.
simide0 at podulebus0 [ podule 1 ]:
simide0:0: before reset, st0=0x50, st1=0x0
simide0:0: after reset, ret_value=0x3
simide0:0:0: after reset, sc=0x0 sn=0x1 cl=0x69 ch=0xd
simide0:0:1: after reset, sc=0x0 sn=0x1 cl=0x69 ch=0xd
simide0:0:1: not ready
wdcattach: ch_drive_flags 0x1 0x0
wd0 at simide0 channel 0 drive 0wdattach
: <ST36451A>
wd0: drive supports 16-sector pio transfers, lba addressing
wd0: 6149MB, 13328 cyl, 15 head, 63 sec, 512 bytes/sect x 12594960 sectors
wd0: atap_dmatiming_mimi=120, atap_dmatiming_recom=120
wd0: drive supports PIO mode 4, DMA mode 2, Ultra-DMA mode 2
simide0:1: before reset, st0=0xff, st1=0xff
Mike
From: Manuel Bouyer <bouyer@antioche.lip6.fr>
To: Mike Pumford <mpumford@black-star.demon.co.uk>
Cc: gnats-bugs@gnats.netbsd.org, port-arm32@netbsd.org
Subject: Re: port-arm32/7324: Fails to detect IDE devices on Simtec IDE interface
Date: Thu, 8 Apr 1999 16:22:37 +0200
On Apr 7, Mike Pumford wrote
> I patched both the last working kernel I have (with v1.60) and the kernel
> which fails to probe.
>
> This is the standard RISCPC 1.4_ALPHA distribution kernel on ftp.netbsd.org
> patched as described above.
>
> The drive is the master on the primary device:
>
> simide0 at podulebus0 [podule 1]:
> simide0:0: before reset, st0=0x50, st1=0x0
> simide0:0: wdcwait_reset() end, st0=0x50, st1=0x0
> simide0:0: after reset, ret_value=0x3
> simide0:0:0: after reset, sc=0x0 sn=0x27 cl=0x7a ch=0xc
> simide0:0:1: after reset, sc=0x0 sn=0x27 cl=0x7a ch=0xc
> simide0:0:1: not ready
> wdcattach: ch_drive_flags 0x4 0x0
> simide0:0: wdcwait_reset() end, st0=0x50, st1=0x0
> simide0:1: before reset, st0=0xff, st1=0xff
Well, i've at last found a bug: your drive should have been attached as
an ST506 :)
The problem here is that after the reset we read random values in the
registers instead of the required 'ata signature'.
Could you try to increase the delay() values ?
I saw this problem recently on a i386, the problem turned out to be
that on i386, delay(1) was equivalent to delay(0) (now fixed). I bumped
all delays to 10. Maybe it's not enouth for arm32 ?
Can you try to bump all delay(10) to delay(100) in sys/dev/ic/wdc.c ?
This should be safe, all delay(10) present here are not in an interrupt path
as far as I can tell ...
>
> This is the last working kernel I built for myself again patched as described
> above with the same hardware configuration.
>
> simide0 at podulebus0 [ podule 1 ]:
> simide0:0: before reset, st0=0x50, st1=0x0
> simide0:0: after reset, ret_value=0x3
> simide0:0:0: after reset, sc=0x0 sn=0x1 cl=0x69 ch=0xd
> simide0:0:1: after reset, sc=0x0 sn=0x1 cl=0x69 ch=0xd
> simide0:0:1: not ready
> wdcattach: ch_drive_flags 0x1 0x0
> wd0 at simide0 channel 0 drive 0wdattach
> : <ST36451A>
> wd0: drive supports 16-sector pio transfers, lba addressing
> wd0: 6149MB, 13328 cyl, 15 head, 63 sec, 512 bytes/sect x 12594960 sectors
> wd0: atap_dmatiming_mimi=120, atap_dmatiming_recom=120
> wd0: drive supports PIO mode 4, DMA mode 2, Ultra-DMA mode 2
> simide0:1: before reset, st0=0xff, st1=0xff
Same problem here (random values in registers) but this code didn't rely on
ata signature.
--
Manuel Bouyer, LIP6, Universite Paris VI. Manuel.Bouyer@lip6.fr
--
From: Mike Pumford <mpumford@black-star.demon.co.uk>
To: Manuel Bouyer <bouyer@antioche.lip6.fr>
Cc: gnats-bugs@gnats.netbsd.org
Subject: Re: port-arm32/7324: Fails to detect IDE devices on Simtec IDE interface
Date: Sat, 10 Apr 1999 19:23:35 +0100
>
> Well, i've at last found a bug: your drive should have been attached as
> an ST506 :)
>
> The problem here is that after the reset we read random values in the
> registers instead of the required 'ata signature'.
> Could you try to increase the delay() values ?
> I saw this problem recently on a i386, the problem turned out to be
> that on i386, delay(1) was equivalent to delay(0) (now fixed). I bumped
> all delays to 10. Maybe it's not enouth for arm32 ?
> Can you try to bump all delay(10) to delay(100) in sys/dev/ic/wdc.c ?
> This should be safe, all delay(10) present here are not in an interrupt path
> as far as I can tell ...
>
Changing the delay value makes no difference. Also the drive is successfully
detected when attached to the motherboard IDE interface of the machine.
I do have a patch which allows my system to boot but I don't propose it as a
fix for the problem (but it does at least let me test out 1.4_ALPHA some more.)
I have attached the patch as it may help others with the same problem.
-------------------------------------------------------
*** wdc.c 1999/04/05 18:29:25 1.1.1.19
--- wdc.c 1999/04/10 18:17:12
***************
*** 261,266 ****
--- 261,272 ----
} else if (sc == 0x01 && sn == 0x01 &&
cl == 0x00 && ch == 0x00) {
chp->ch_drive[drive].drive_flags |= DRIVE_ATA;
+ }
+ /* SIMIDE_HACK (assume any drive without ATA signature is
+ * an ATA Drive).
+ */
+ else {
+ chp->ch_drive[drive].drive_flags |= DRIVE_ATA;
}
}
/*
-------------------------------------------------------
Mike
From: Manuel Bouyer <bouyer@antioche.lip6.fr>
To: Mike Pumford <mpumford@black-star.demon.co.uk>
Cc: gnats-bugs@gnats.netbsd.org
Subject: Re: port-arm32/7324: Fails to detect IDE devices on Simtec IDE interface
Date: Sun, 11 Apr 1999 22:57:27 +0200
--RYliJ5NKNqkz5buL
Content-Type: text/plain; charset=us-ascii
On Apr 10, Mike Pumford wrote
> Changing the delay value makes no difference. Also the drive is successfully
> detected when attached to the motherboard IDE interface of the machine.
Ok, as some other IDE controllers seems to behave this way as well, I
changed the probe to try to deal with this more gracefully.
Could you try the attached patch ? I just commited it, and will ask a pullup
--
Manuel Bouyer, LIP6, Universite Paris VI. Manuel.Bouyer@lip6.fr
--
--RYliJ5NKNqkz5buL
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=wdc_diff
Index: dev/ic/wdc.c
===================================================================
RCS file: /cvsroot/src/sys/dev/ic/wdc.c,v
retrieving revision 1.66
diff -u -r1.66 wdc.c
--- wdc.c 1999/04/01 21:46:29 1.66
+++ wdc.c 1999/04/11 20:31:36
@@ -231,9 +231,9 @@
/*
* Test presence of drives. First test register signatures looking for
- * ATAPI devices , then rescan and try an ATA command, in case it's an
- * old drive.
- * Fill in drive_flags accordingly
+ * ATAPI devices. If it's not an ATAPI and reset said there may be
+ * something here assume it's ATA or OLD. Ghost will be killed later in
+ * attach routine.
*/
for (drive = 0; drive < 2; drive++) {
if ((ret_value & (0x01 << drive)) == 0)
@@ -253,63 +253,16 @@
chp->channel, drive, sc, sn, cl, ch), DEBUG_PROBE);
/*
* sc is supposted to be 0x1 for ATAPI but at last one drive
- * set it to 0x0.
+ * set it to 0x0 - or maybe it's the controller.
*/
if ((sc == 0x00 || sc == 0x01) && sn == 0x01 &&
cl == 0x14 && ch == 0xeb) {
chp->ch_drive[drive].drive_flags |= DRIVE_ATAPI;
- } else if (sc == 0x01 && sn == 0x01 &&
- cl == 0x00 && ch == 0x00) {
- chp->ch_drive[drive].drive_flags |= DRIVE_ATA;
- }
- }
- /*
- * Maybe there's an old device, try to detect it if we didn't
- * find a ATA or ATAPI device.
- */
- if ((chp->ch_drive[0].drive_flags & DRIVE) != 0 ||
- (chp->ch_drive[1].drive_flags & DRIVE) != 0)
- return (ret_value);
- for (drive = 0; drive < 2; drive++) {
- if ((ret_value & (0x01 << drive)) == 0)
- continue;
- bus_space_write_1(chp->cmd_iot, chp->cmd_ioh, wd_sdh,
- WDSD_IBM | (drive << 4));
- delay(10);
- /*
- * Test registers writability (Error register not writable,
- * but cyllo is), then try an ATA command.
- */
- bus_space_write_1(chp->cmd_iot, chp->cmd_ioh, wd_error, 0x58);
- bus_space_write_1(chp->cmd_iot, chp->cmd_ioh, wd_cyl_lo, 0xa5);
- if (bus_space_read_1(chp->cmd_iot, chp->cmd_ioh, wd_error) ==
- 0x58 ||
- bus_space_read_1(chp->cmd_iot, chp->cmd_ioh, wd_cyl_lo) !=
- 0xa5) {
- WDCDEBUG_PRINT(("%s:%d:%d: register writability "
- "failed\n",
- chp->wdc ? chp->wdc->sc_dev.dv_xname : "wdcprobe",
- chp->channel, drive), DEBUG_PROBE);
- ret_value &= ~(0x01 << drive);
- continue;
- }
- if (wait_for_ready(chp, 10000) != 0) {
- WDCDEBUG_PRINT(("%s:%d:%d: not ready\n",
- chp->wdc ? chp->wdc->sc_dev.dv_xname : "wdcprobe",
- chp->channel, drive), DEBUG_PROBE);
- ret_value &= ~(0x01 << drive);
- continue;
- }
- bus_space_write_1(chp->cmd_iot, chp->cmd_ioh, wd_command,
- WDCC_RECAL);
- if (wait_for_ready(chp, 10000) == 0) {
- chp->ch_drive[drive].drive_flags |=
- DRIVE_OLD;
} else {
- WDCDEBUG_PRINT(("%s:%d:%d: WDCC_RECAL failed\n",
- chp->wdc ? chp->wdc->sc_dev.dv_xname : "wdcprobe",
- chp->channel, drive), DEBUG_PROBE);
- ret_value &= ~(0x01 << drive);
+ chp->ch_drive[drive].drive_flags |= DRIVE_ATA;
+ if (chp->wdc == NULL ||
+ (chp->wdc->cap & WDC_CAPABILITY_PREATA) != 0)
+ chp->ch_drive[drive].drive_flags |= DRIVE_OLD;
}
}
return (ret_value);
@@ -351,12 +304,42 @@
(WDC_CAPABILITY_DATA16 | WDC_CAPABILITY_DATA32)) ==
WDC_CAPABILITY_DATA32)
chp->ch_drive[i].drive_flags |= DRIVE_CAP32;
+ if ((chp->ch_drive[i].drive_flags & DRIVE) == 0)
+ continue;
/* Issue a IDENTIFY command, to try to detect slave ghost */
- if (ata_get_params(&chp->ch_drive[i], AT_POLL, ¶ms) !=
+ if (ata_get_params(&chp->ch_drive[i], AT_POLL, ¶ms) ==
CMD_OK) {
+ /* If IDENTIFY succeded, this is not an OLD ctrl */
+ chp->ch_drive[0].drive_flags &= ~DRIVE_OLD;
+ chp->ch_drive[1].drive_flags &= ~DRIVE_OLD;
+ } else {
chp->ch_drive[i].drive_flags &=
~(DRIVE_ATA | DRIVE_ATAPI);
+ WDCDEBUG_PRINT(("%s:%d:%d: IDENTIFY failed\n",
+ chp->wdc->sc_dev.dv_xname,
+ chp->channel, i), DEBUG_PROBE);
+ if ((chp->ch_drive[i].drive_flags & DRIVE_OLD) == 0)
+ continue;
+ /* Pre-ATA drive ? */
+ bus_space_write_1(chp->cmd_iot, chp->cmd_ioh, wd_sdh,
+ WDSD_IBM | (i << 4));
+ delay(100);
+ if (wait_for_ready(chp, 10000) != 0) {
+ WDCDEBUG_PRINT(("%s:%d:%d: not ready\n",
+ chp->wdc->sc_dev.dv_xname,
+ chp->channel, i), DEBUG_PROBE);
+ chp->ch_drive[i].drive_flags &= ~DRIVE_OLD;
+ continue;
+ }
+ bus_space_write_1(chp->cmd_iot, chp->cmd_ioh,
+ wd_command, WDCC_RECAL);
+ if (wait_for_ready(chp, 10000) != 0) {
+ WDCDEBUG_PRINT(("%s:%d:%d: WDCC_RECAL failed\n",
+ chp->wdc->sc_dev.dv_xname,
+ chp->channel, i), DEBUG_PROBE);
+ chp->ch_drive[i].drive_flags &= ~DRIVE_OLD;
+ }
}
}
ctrl_flags = chp->wdc->sc_dev.dv_cfdata->cf_flags;
@@ -366,6 +349,11 @@
chp->ch_drive[0].drive_flags, chp->ch_drive[1].drive_flags),
DEBUG_PROBE);
+ /* If no drives, abort here */
+ if ((chp->ch_drive[0].drive_flags & DRIVE) == 0 &&
+ (chp->ch_drive[1].drive_flags & DRIVE) == 0)
+ return;
+
/*
* Attach an ATAPI bus, if needed.
*/
@@ -391,7 +379,8 @@
}
for (i = 0; i < 2; i++) {
- if ((chp->ch_drive[i].drive_flags & DRIVE_ATA) == 0) {
+ if ((chp->ch_drive[i].drive_flags &
+ (DRIVE_ATA | DRIVE_OLD)) == 0) {
continue;
}
memset(&aa_link, 0, sizeof(struct ata_atapi_attach));
Index: dev/ic/wdcvar.h
===================================================================
RCS file: /cvsroot/src/sys/dev/ic/wdcvar.h,v
retrieving revision 1.16
diff -u -r1.16 wdcvar.h
--- wdcvar.h 1999/04/01 21:46:30 1.16
+++ wdcvar.h 1999/04/11 20:31:36
@@ -90,6 +90,7 @@
#define WDC_CAPABILITY_ATA_NOSTREAM 0x0040 /* Don't use stream funcs on ATA */
#define WDC_CAPABILITY_ATAPI_NOSTREAM 0x0080 /* Don't use stream f on ATAPI */
#define WDC_CAPABILITY_NO_EXTRA_RESETS 0x0100 /* only reset once */
+#define WDC_CAPABILITY_PREATA 0x0200 /* ctrl can be a pre-ata one */
u_int8_t PIO_cap; /* highest PIO mode supported */
u_int8_t DMA_cap; /* highest DMA mode supported */
u_int8_t UDMA_cap; /* highest UDMA mode supported */
Index: dev/isa/wdc_isa.c
===================================================================
RCS file: /cvsroot/src/sys/dev/isa/wdc_isa.c,v
retrieving revision 1.13
diff -u -r1.13 wdc_isa.c
--- wdc_isa.c 1999/02/22 03:24:33 1.13
+++ wdc_isa.c 1999/04/11 20:31:36
@@ -150,7 +150,8 @@
sc->sc_wdcdev.dma_finish = wdc_isa_dma_finish;
wdc_isa_dma_setup(sc);
}
- sc->sc_wdcdev.cap |= WDC_CAPABILITY_DATA16 | WDC_CAPABILITY_DATA32;
+ sc->sc_wdcdev.cap |= WDC_CAPABILITY_DATA16 | WDC_CAPABILITY_DATA32 |
+ WDC_CAPABILITY_PREATA;
sc->sc_wdcdev.PIO_cap = 0;
sc->wdc_chanptr = &sc->wdc_channel;
sc->sc_wdcdev.channels = &sc->wdc_chanptr;
--RYliJ5NKNqkz5buL--
State-Changed-From-To: open->feedback
State-Changed-By: bouyer
State-Changed-When: Mon Apr 12 02:22:23 PDT 1999
State-Changed-Why:
I just commited a fix to the 1.4 branch (which should be identical to
the patch I sent you yesterday). Could you compile a new kernel and tell me how
it goes ?
State-Changed-From-To: feedback->closed
State-Changed-By: bouyer
State-Changed-When: Tue Apr 13 05:59:14 PDT 1999
State-Changed-Why:
Mike said the patch I sent him solved the problem. Since then this patch has
been pulled up to the branch
>Unformatted:
(Contact us)
$NetBSD: query-full-pr,v 1.51 2026/08/10 02:28:17 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026
The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.