Check the status registers for garbage before wasting seconds trying to

reset a board that isn't present.
This commit is contained in:
ad 2008-03-29 17:27:50 +00:00
parent 625a7a611a
commit 72afc67c95
2 changed files with 18 additions and 3 deletions

View File

@ -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"
@ -750,6 +750,19 @@ aha_find(iot, ioh, sc)
struct aha_config config;
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

View File

@ -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 */