diff options
| author | ad <ad@NetBSD.org> | 2008-03-29 17:27:50 +0000 |
|---|---|---|
| committer | ad <ad@NetBSD.org> | 2008-03-29 17:27:50 +0000 |
| commit | 72afc67c953e8512951839cd552d09c0dd78cbb7 (patch) | |
| tree | b26bc72b1b76bb85e439732b7f2d346d2406c7d1 /sys/dev | |
| parent | 625a7a611a2ca6ed77b782764f9db2fb79dfb11c (diff) | |
Check the status registers for garbage before wasting seconds trying to
reset a board that isn't present.
Diffstat (limited to 'sys/dev')
| -rw-r--r-- | sys/dev/ic/aha.c | 17 | ||||
| -rw-r--r-- | sys/dev/ic/ahareg.h | 4 |
2 files changed, 18 insertions, 3 deletions
diff --git a/sys/dev/ic/aha.c b/sys/dev/ic/aha.c index bfff8af02b4..88616c1b7c6 100644 --- a/sys/dev/ic/aha.c +++ b/sys/dev/ic/aha.c @@ -1,4 +1,4 @@ -/* $NetBSD: aha.c,v 1.54 2007/10/19 11:59:46 ad Exp $ */ +/* $NetBSD: aha.c,v 1.55 2008/03/29 17:27:50 ad Exp $ */ /*- * Copyright (c) 1997, 1998 The NetBSD Foundation, Inc. @@ -53,7 +53,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: aha.c,v 1.54 2007/10/19 11:59:46 ad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: aha.c,v 1.55 2008/03/29 17:27:50 ad Exp $"); #include "opt_ddb.h" @@ -751,6 +751,19 @@ aha_find(iot, ioh, sc) int irq, drq; /* + * assume invalid status means the board is not present. + */ + + sts = bus_space_read_1(iot, ioh, AHA_STAT_PORT); + if (sts == 0) + return (0); + if ((sts & (AHA_STAT_STST|AHA_STAT_RSVD|AHA_STAT_CDF)) != 0) + return (0); + sts = bus_space_read_1(iot, ioh, AHA_INTR_PORT); + if ((sts & AHA_INTR_RSVD) != 0) + return (0); + + /* * reset board, If it doesn't respond, assume * that it's not there.. good for the probe */ diff --git a/sys/dev/ic/ahareg.h b/sys/dev/ic/ahareg.h index dfc85424127..4030a0b811d 100644 --- a/sys/dev/ic/ahareg.h +++ b/sys/dev/ic/ahareg.h @@ -1,4 +1,4 @@ -/* $NetBSD: ahareg.h,v 1.12 2005/12/11 12:21:25 christos Exp $ */ +/* $NetBSD: ahareg.h,v 1.13 2008/03/29 17:27:50 ad Exp $ */ /*- * Copyright (c) 1997-99 The NetBSD Foundation, Inc. @@ -83,6 +83,7 @@ typedef u_int8_t physlen[3]; #define AHA_STAT_IDLE 0x10 /* Host Adapter Idle */ #define AHA_STAT_CDF 0x08 /* cmd/data out port full */ #define AHA_STAT_DF 0x04 /* Data in port full */ +#define AHA_STAT_RSVD 0x02 /* Unused */ #define AHA_STAT_INVDCMD 0x01 /* Invalid command */ /* @@ -112,6 +113,7 @@ typedef u_int8_t physlen[3]; * AHA_INTR bits */ #define AHA_INTR_ANYINTR 0x80 /* Any interrupt */ +#define AHA_INTR_RSVD 0x70 /* unused bits */ #define AHA_INTR_SCRD 0x08 /* SCSI reset detected */ #define AHA_INTR_HACC 0x04 /* Command complete */ #define AHA_INTR_MBOA 0x02 /* MBX out empty */ |
