summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorDavid Gwynne <dlg@cvs.openbsd.org>2005-08-10 10:55:34 +0000
committerDavid Gwynne <dlg@cvs.openbsd.org>2005-08-10 10:55:34 +0000
commita4620586128de6a982adc1482981cc8b28ef41fb (patch)
tree6eb44637d48b17ace68e39933ee25479d51943b0 /sys
parentb8e55f5b24eca4e18c90b90471a400ab07ddb363 (diff)
use the appropriate flags to scsi_scsi_cmd during autoconf so we dont spin
forever on mp kernels problem reported by matthieu baptiste
Diffstat (limited to 'sys')
-rw-r--r--sys/scsi/safte.c16
-rw-r--r--sys/scsi/ses.c12
2 files changed, 16 insertions, 12 deletions
diff --git a/sys/scsi/safte.c b/sys/scsi/safte.c
index fb846811e3c..a501dbda807 100644
--- a/sys/scsi/safte.c
+++ b/sys/scsi/safte.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: safte.c,v 1.6 2005/08/08 18:43:09 marco Exp $ */
+/* $OpenBSD: safte.c,v 1.7 2005/08/10 10:55:33 dlg Exp $ */
/*
* Copyright (c) 2005 David Gwynne <dlg@openbsd.org>
@@ -89,7 +89,7 @@ struct safte_thread {
void safte_create_thread(void *);
void safte_refresh(void *);
int safte_read_config(struct safte_softc *);
-int safte_read_encstat(struct safte_softc *);
+int safte_read_encstat(struct safte_softc *, int);
int64_t safte_temp2uK(u_int8_t, int);
@@ -121,7 +121,7 @@ safte_match(struct device *parent, void *match, void *aux)
if (scsi_scsi_cmd(sa->sa_sc_link, (struct scsi_generic *)&cmd,
sizeof(cmd), (u_char *)&inqbuf, cmd.length, 2, 10000, NULL,
- SCSI_DATA_IN) != 0)
+ SCSI_DATA_IN|SCSI_AUTOCONF) != 0)
return (0);
if (memcmp(si->ident, SAFTE_IDENT, sizeof(si->ident)) == 0)
@@ -202,7 +202,7 @@ safte_attach(struct device *parent, struct device *self, void *aux)
return;
}
- if (safte_read_encstat(sc) != 0) {
+ if (safte_read_encstat(sc, 1) != 0) {
free(sc->sc_encbuf, M_DEVBUF);
free(sc->sc_sensors, M_DEVBUF);
free(sc->sc_thread, M_DEVBUF);
@@ -262,7 +262,7 @@ safte_refresh(void *arg)
int ok = 1;
while (thread->running) {
- if (safte_read_encstat(sc) != 0) {
+ if (safte_read_encstat(sc, 0) != 0) {
if (ok)
printf("%s: error getting enclosure status\n",
DEVNAME(sc));
@@ -293,7 +293,7 @@ safte_read_config(struct safte_softc *sc)
cmd.flags |= SAFTE_RD_MODE;
cmd.bufferid = SAFTE_RD_CONFIG;
cmd.length = htobe16(sizeof(config));
- flags = SCSI_DATA_IN;
+ flags = SCSI_DATA_IN | SCSI_AUTOCONF;
#ifndef SCSIDEBUG
flags |= SCSI_SILENT;
#endif
@@ -322,7 +322,7 @@ safte_read_config(struct safte_softc *sc)
}
int
-safte_read_encstat(struct safte_softc *sc)
+safte_read_encstat(struct safte_softc *sc, int autoconf)
{
struct safte_readbuf_cmd cmd;
int flags, i;
@@ -338,6 +338,8 @@ safte_read_encstat(struct safte_softc *sc)
#ifndef SCSIDEBUG
flags |= SCSI_SILENT;
#endif
+ if (autoconf)
+ flags |= SCSI_AUTOCONF;
if (scsi_scsi_cmd(sc->sc_link, (struct scsi_generic *)&cmd,
sizeof(cmd), sc->sc_encbuf, sc->sc_encstatlen, 2, 30000, NULL,
diff --git a/sys/scsi/ses.c b/sys/scsi/ses.c
index 7c46b39dba5..3b2c1402e36 100644
--- a/sys/scsi/ses.c
+++ b/sys/scsi/ses.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ses.c,v 1.19 2005/08/09 11:37:02 dlg Exp $ */
+/* $OpenBSD: ses.c,v 1.20 2005/08/10 10:55:33 dlg Exp $ */
/*
* Copyright (c) 2005 David Gwynne <dlg@openbsd.org>
@@ -94,7 +94,7 @@ void ses_create_thread(void *);
void ses_refresh(void *);
int ses_read_config(struct ses_softc *);
-int ses_read_status(struct ses_softc *);
+int ses_read_status(struct ses_softc *, int);
int ses_make_sensors(struct ses_softc *, struct ses_type_desc *, int);
int ses_refresh_sensors(struct ses_softc *);
@@ -331,7 +331,7 @@ ses_read_config(struct ses_softc *sc)
}
int
-ses_read_status(struct ses_softc *sc)
+ses_read_status(struct ses_softc *sc, int autoconf)
{
struct ses_scsi_diag cmd;
int flags;
@@ -345,6 +345,8 @@ ses_read_status(struct ses_softc *sc)
#ifndef SCSIDEBUG
flags |= SCSI_SILENT;
#endif
+ if (autoconf)
+ flags |= SCSI_AUTOCONF;
if (scsi_scsi_cmd(sc->sc_link, (struct scsi_generic *)&cmd,
sizeof(cmd), sc->sc_buf, sc->sc_buflen, 2, 3000, NULL, flags) != 0)
@@ -365,7 +367,7 @@ ses_make_sensors(struct ses_softc *sc, struct ses_type_desc *types, int ntypes)
int typecnt[SES_NUM_TYPES];
int i, j;
- if (ses_read_status(sc) != 0)
+ if (ses_read_status(sc, 1) != 0)
return (1);
memset(typecnt, 0, sizeof(typecnt));
@@ -449,7 +451,7 @@ ses_refresh_sensors(struct ses_softc *sc)
struct ses_sensor *sensor;
int ret = 0;
- if (ses_read_status(sc) != 0)
+ if (ses_read_status(sc, 0) != 0)
return (1);
TAILQ_FOREACH(sensor, &sc->sc_sensors, se_entry) {