diff options
author | Marco Peereboom <marco@cvs.openbsd.org> | 2005-08-23 05:29:43 +0000 |
---|---|---|
committer | Marco Peereboom <marco@cvs.openbsd.org> | 2005-08-23 05:29:43 +0000 |
commit | 13cef1d9b742e5bbd96e153148dea3b4a608a2ca (patch) | |
tree | dc6698ea9b1336292317a78b61f10785573d80bd /sys | |
parent | 366ec114735bf6db8d6a55322c553cc3411a3ef4 (diff) |
Test for cold and apply relevant flags for all scsi commands.
ok dlg@ krw@ deraadt@
Diffstat (limited to 'sys')
-rw-r--r-- | sys/scsi/safte.c | 18 | ||||
-rw-r--r-- | sys/scsi/ses.c | 23 |
2 files changed, 27 insertions, 14 deletions
diff --git a/sys/scsi/safte.c b/sys/scsi/safte.c index 78ee318a84a..8d648a25130 100644 --- a/sys/scsi/safte.c +++ b/sys/scsi/safte.c @@ -1,4 +1,4 @@ -/* $OpenBSD: safte.c,v 1.14 2005/08/22 19:24:45 deraadt Exp $ */ +/* $OpenBSD: safte.c,v 1.15 2005/08/23 05:29:42 marco Exp $ */ /* * Copyright (c) 2005 David Gwynne <dlg@openbsd.org> @@ -126,6 +126,7 @@ safte_match(struct device *parent, void *match, void *aux) struct scsi_inquiry_data inqbuf; struct scsi_inquiry cmd; struct safte_inq *si = (struct safte_inq *)&inqbuf.extra; + int flags; if (inq == NULL) return (0); @@ -149,9 +150,13 @@ safte_match(struct device *parent, void *match, void *aux) memset(&inqbuf, 0, sizeof(inqbuf)); memset(&inqbuf.extra, ' ', sizeof(inqbuf.extra)); + flags = SCSI_DATA_IN; + if (cold) + flags |= SCSI_AUTOCONF; + 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|SCSI_AUTOCONF) != 0) + flags) != 0) return (0); if (memcmp(si->ident, SAFTE_IDENT, sizeof(si->ident)) == 0) @@ -281,12 +286,12 @@ 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 | SCSI_AUTOCONF; + flags = SCSI_DATA_IN; #ifndef SCSIDEBUG flags |= SCSI_SILENT; #endif - if (scsi_autoconf) + if (cold) flags |= SCSI_AUTOCONF; if (scsi_scsi_cmd(sc->sc_link, (struct scsi_generic *)&cmd, @@ -422,6 +427,9 @@ safte_read_encstat(struct safte_softc *sc) flags |= SCSI_SILENT; #endif + if (cold) + flags |= SCSI_AUTOCONF; + if (scsi_scsi_cmd(sc->sc_link, (struct scsi_generic *)&cmd, sizeof(cmd), sc->sc_encbuf, sc->sc_encbuflen, 2, 30000, NULL, flags) != 0) @@ -591,6 +599,8 @@ safte_bio_blink(struct safte_softc *sc, struct bioc_blink *blink) #ifndef SCSIDEBUG flags |= SCSI_SILENT; #endif + if (cold) + flags |= SCSI_AUTOCONF; if (scsi_scsi_cmd(sc->sc_link, (struct scsi_generic *)&cmd, sizeof(cmd), (u_char *)op, sizeof(struct safte_slotop), diff --git a/sys/scsi/ses.c b/sys/scsi/ses.c index f8c3d4ade83..66886af5f92 100644 --- a/sys/scsi/ses.c +++ b/sys/scsi/ses.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ses.c,v 1.24 2005/08/22 19:24:45 deraadt Exp $ */ +/* $OpenBSD: ses.c,v 1.25 2005/08/23 05:29:41 marco Exp $ */ /* * Copyright (c) 2005 David Gwynne <dlg@openbsd.org> @@ -111,7 +111,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); +int ses_read_status(struct ses_softc *); int ses_make_sensors(struct ses_softc *, struct ses_type_desc *, int); int ses_refresh_sensors(struct ses_softc *); @@ -306,9 +306,9 @@ ses_read_config(struct ses_softc *sc) flags |= SCSI_SILENT; #endif - if (scsi_autoconf) - flags |= SCSI_AUTOCONF; - + if (cold) + flags |= SCSI_AUTOCONF; + if (scsi_scsi_cmd(sc->sc_link, (struct scsi_generic *)&cmd, sizeof(cmd), buf, SES_BUFLEN, 2, 3000, NULL, flags) != 0) { free(buf, M_DEVBUF); @@ -379,7 +379,7 @@ ses_read_config(struct ses_softc *sc) } int -ses_read_status(struct ses_softc *sc, int autoconf) +ses_read_status(struct ses_softc *sc) { struct ses_scsi_diag cmd; int flags; @@ -393,7 +393,7 @@ ses_read_status(struct ses_softc *sc, int autoconf) #ifndef SCSIDEBUG flags |= SCSI_SILENT; #endif - if (autoconf) + if (cold) flags |= SCSI_AUTOCONF; if (scsi_scsi_cmd(sc->sc_link, (struct scsi_generic *)&cmd, @@ -416,7 +416,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, 1) != 0) + if (ses_read_status(sc) != 0) return (1); memset(typecnt, 0, sizeof(typecnt)); @@ -526,7 +526,7 @@ ses_refresh_sensors(struct ses_softc *sc) struct ses_sensor *sensor; int ret = 0; - if (ses_read_status(sc, 0) != 0) + if (ses_read_status(sc) != 0) return (1); TAILQ_FOREACH(sensor, &sc->sc_sensors, se_entry) { @@ -613,6 +613,9 @@ ses_write_config(struct ses_softc *sc) flags |= SCSI_SILENT; #endif + if (cold) + 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) return (1); @@ -625,7 +628,7 @@ ses_bio_blink(struct ses_softc *sc, struct bioc_blink *blink) { struct ses_slot *slot; - if (ses_read_status(sc, 1) != 0) + if (ses_read_status(sc) != 0) return (EIO); TAILQ_FOREACH(slot, &sc->sc_slots, sl_entry) { |