summaryrefslogtreecommitdiff
path: root/sys/scsi
diff options
context:
space:
mode:
authorDavid Gwynne <dlg@cvs.openbsd.org>2005-08-23 23:44:29 +0000
committerDavid Gwynne <dlg@cvs.openbsd.org>2005-08-23 23:44:29 +0000
commit0dcd2bb6ca4b6432612531dbc380d4a76f1b598b (patch)
tree4ee2c7241db186f8c0411b82b8e1d283d293f6ce /sys/scsi
parenta9074045d5504c7dbb7754824573fdd5f298751d (diff)
setting the FAULT flag on a device so the alarm led blinks may have
unwanted side effects, eg, disabling both fc ports and powering the disk down. so remove this knob for now. ok deraadt@
Diffstat (limited to 'sys/scsi')
-rw-r--r--sys/scsi/ses.c23
-rw-r--r--sys/scsi/ses.h63
2 files changed, 49 insertions, 37 deletions
diff --git a/sys/scsi/ses.c b/sys/scsi/ses.c
index 66886af5f92..066537e4b08 100644
--- a/sys/scsi/ses.c
+++ b/sys/scsi/ses.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ses.c,v 1.25 2005/08/23 05:29:41 marco Exp $ */
+/* $OpenBSD: ses.c,v 1.26 2005/08/23 23:44:28 dlg Exp $ */
/*
* Copyright (c) 2005 David Gwynne <dlg@openbsd.org>
@@ -632,35 +632,38 @@ ses_bio_blink(struct ses_softc *sc, struct bioc_blink *blink)
return (EIO);
TAILQ_FOREACH(slot, &sc->sc_slots, sl_entry) {
- if (SES_S_DEV_ADDR(slot->sl_stat) == blink->bb_target)
+ if (slot->sl_stat->f1 == blink->bb_target)
break;
}
if (slot == TAILQ_END(&sc->sc_slots))
return (EINVAL);
- /* zero out the config fields */
- slot->sl_stat->f2 = 0x00;
- slot->sl_stat->f3 = 0x00;
+ DPRINTFN(3, "%s: 0x%02x 0x%02x 0x%02x 0x%02x\n", DEVNAME(sc),
+ slot->sl_stat->com, slot->sl_stat->f1, slot->sl_stat->f2,
+ slot->sl_stat->f3);
slot->sl_stat->com = SES_STAT_SELECT;
+ slot->sl_stat->f2 &= SES_C_DEV_F2MASK;
+ slot->sl_stat->f3 &= SES_C_DEV_F3MASK;
switch (blink->bb_status) {
case BIOC_SBUNBLINK:
+ slot->sl_stat->f2 &= ~SES_C_DEV_IDENT;
break;
case BIOC_SBBLINK:
- SES_C_DEV_IDENT(slot->sl_stat);
- break;
-
- case BIOC_SBALARM:
- SES_C_DEV_FAULT(slot->sl_stat);
+ slot->sl_stat->f2 |= SES_C_DEV_IDENT;
break;
default:
return (EINVAL);
}
+ DPRINTFN(3, "%s: 0x%02x 0x%02x 0x%02x 0x%02x\n", DEVNAME(sc),
+ slot->sl_stat->com, slot->sl_stat->f1, slot->sl_stat->f2,
+ slot->sl_stat->f3);
+
if (ses_write_config(sc) != 0)
return (EIO);
diff --git a/sys/scsi/ses.h b/sys/scsi/ses.h
index 21a71e24e1c..245b4e931c8 100644
--- a/sys/scsi/ses.h
+++ b/sys/scsi/ses.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: ses.h,v 1.8 2005/08/22 04:23:58 david Exp $ */
+/* $OpenBSD: ses.h,v 1.9 2005/08/23 23:44:28 dlg Exp $ */
/*
* Copyright (c) 2005 Marco Peereboom
* All rights reserved.
@@ -146,34 +146,43 @@ struct ses_status {
#define SES_STAT_ELEMLEN sizeof(struct ses_status)
/* device status */
-#define SES_S_DEV_ADDR(d) ((d)->f1)
-#define SES_S_DEV_REPORT(d) ((d)->f2 & (1<<0)) /* enc report in progress */
-#define SES_S_DEV_IDENT(d) ((d)->f2 & (1<<1)) /* currently identifying */
-#define SES_S_DEV_REMOVE(d) ((d)->f2 & (1<<2)) /* ready to remove */
-#define SES_S_DEV_INSERT(d) ((d)->f2 & (1<<3)) /* ready to insert */
-#define SES_S_DEV_ENCBYPB(d) ((d)->f2 & (1<<4)) /* port B bypassed by enc */
-#define SES_S_DEV_ENCBYPA(d) ((d)->f2 & (1<<5)) /* port A bypassed by enc */
-#define SES_S_DEV_DONOTREM(d) ((d)->f2 & (1<<6)) /* do not remove */
-#define SES_S_DEV_APPCLBYPA(d) ((d)->f2 & (1<<7)) /* port A bypassed by app */
-#define SES_S_DEV_DEVBYPB(d) ((d)->f3 & (1<<0)) /* port B bypassed by dev */
-#define SES_S_DEV_DEVBYPA(d) ((d)->f3 & (1<<1)) /* port A bypassed by dev */
-#define SES_S_DEV_BYPB(d) ((d)->f3 & (1<<2))
-#define SES_S_DEV_BYPA(d) ((d)->f3 & (1<<3))
-#define SES_S_DEV_OFF(d) ((d)->f3 & (1<<4)) /* device is off */
-#define SES_S_DEV_FAULTRQST(d) ((d)->f3 & (1<<5)) /* fault indicator rqsted */
-#define SES_S_DEV_FAULTSENSE(d) ((d)->f3 & (1<<6)) /* fault sensed */
-#define SES_S_DEV_APPCLBYPB(d) ((d)->f3 & (1<<7)) /* port B bypassed by app */
+/* f1 is the device address */
+/* f2 */
+#define SES_S_DEV_REPORT (1<<0) /* enc report in progress */
+#define SES_S_DEV_IDENT (1<<1) /* currently identifying */
+#define SES_S_DEV_REMOVE (1<<2) /* ready to remove */
+#define SES_S_DEV_INSERT (1<<3) /* ready to insert */
+#define SES_S_DEV_ENCBYPB (1<<4) /* port B bypassed by enc */
+#define SES_S_DEV_ENCBYPA (1<<5) /* port A bypassed by enc */
+#define SES_S_DEV_DONOTREM (1<<6) /* do not remove */
+#define SES_S_DEV_APPCLBYPA (1<<7) /* port A bypassed by app */
+/* f3 */
+#define SES_S_DEV_DEVBYPB (1<<0) /* port B bypassed by dev */
+#define SES_S_DEV_DEVBYPA (1<<1) /* port A bypassed by dev */
+#define SES_S_DEV_BYPB (1<<2)
+#define SES_S_DEV_BYPA (1<<3)
+#define SES_S_DEV_OFF (1<<4) /* device is off */
+#define SES_S_DEV_FAULTRQST (1<<5) /* fault indicator rqsted */
+#define SES_S_DEV_FAULTSENSE (1<<6) /* fault sensed */
+#define SES_S_DEV_APPCLBYPB (1<<7) /* port B bypassed by app */
/* device configuration */
-#define SES_C_DEV_IDENT(d) ((d)->f2 |= (1<<1)) /* ident */
-#define SES_C_DEV_REMOVE(d) ((d)->f2 |= (1<<2)) /* remove */
-#define SES_C_DEV_INSERT(d) ((d)->f2 |= (1<<3)) /* insert */
-#define SES_C_DEV_DONOTREM(d) ((d)->f2 |= (1<<6)) /* do not remove */
-#define SES_C_DEV_ACTIVE(d) ((d)->f2 |= (1<<7)) /* active indicator */
-#define SES_C_DEV_BYPB(d) ((d)->f3 |= (1<<2)) /* port B bypass */
-#define SES_C_DEV_BYPA(d) ((d)->f3 |= (1<<3)) /* port A bypass */
-#define SES_C_DEV_OFF(d) ((d)->f3 |= (1<<4)) /* off */
-#define SES_C_DEV_FAULT(d) ((d)->f3 |= (1<<5)) /* fault indicator */
+/* f1 is reserved */
+/* f2 */
+#define SES_C_DEV_IDENT (1<<1) /* ident */
+#define SES_C_DEV_REMOVE (1<<2) /* remove */
+#define SES_C_DEV_INSERT (1<<3) /* insert */
+#define SES_C_DEV_DONOTREM (1<<6) /* do not remove */
+#define SES_C_DEV_ACTIVE (1<<7) /* active indicator */
+#define SES_C_DEV_F2MASK (SES_C_DEV_IDENT | SES_C_DEV_REMOVE | \
+ SES_C_DEV_INSERT | SES_C_DEV_DONOTREM | SES_C_DEV_ACTIVE )
+/* f3 */
+#define SES_C_DEV_BYPB (1<<2) /* port B bypass */
+#define SES_C_DEV_BYPA (1<<3) /* port A bypass */
+#define SES_C_DEV_OFF (1<<4) /* off */
+#define SES_C_DEV_FAULT (1<<5) /* fault indicator */
+#define SES_C_DEV_F3MASK (SES_C_DEV_BYPB | SES_C_DEV_BYPA | \
+ SES_C_DEV_OFF | SES_C_DEV_FAULT)
/* power supply element */
#define SES_S_PSU_IDENT(d) ((d)->f1 & (1<<6)) /* identify */