diff options
author | Marco Peereboom <marco@cvs.openbsd.org> | 2006-05-26 00:53:55 +0000 |
---|---|---|
committer | Marco Peereboom <marco@cvs.openbsd.org> | 2006-05-26 00:53:55 +0000 |
commit | c4932b8a82619169fd00c10a811c6aa4708683e8 (patch) | |
tree | a7a8a0568b3e60d0882a55e6dcaba26a0a287cc6 | |
parent | a19cf3bd7aa8feb27dbecb238728ae4e943afbb7 (diff) |
Add blinking for disks.
-rw-r--r-- | sys/dev/ic/mfi.c | 66 | ||||
-rw-r--r-- | sys/dev/ic/mfireg.h | 4 |
2 files changed, 68 insertions, 2 deletions
diff --git a/sys/dev/ic/mfi.c b/sys/dev/ic/mfi.c index 8fb7fd9f5d8..bd0b505ae42 100644 --- a/sys/dev/ic/mfi.c +++ b/sys/dev/ic/mfi.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mfi.c,v 1.57 2006/05/25 22:04:35 marco Exp $ */ +/* $OpenBSD: mfi.c,v 1.58 2006/05/26 00:53:54 marco Exp $ */ /* * Copyright (c) 2006 Marco Peereboom <marco@peereboom.us> * @@ -100,6 +100,7 @@ int mfi_ioctl_inq(struct mfi_softc *, struct bioc_inq *); int mfi_ioctl_vol(struct mfi_softc *, struct bioc_vol *); int mfi_ioctl_disk(struct mfi_softc *, struct bioc_disk *); int mfi_ioctl_alarm(struct mfi_softc *, struct bioc_alarm *); +int mfi_ioctl_blink(struct mfi_softc *sc, struct bioc_blink *); int mfi_ioctl_setstate(struct mfi_softc *, struct bioc_setstate *); #endif /* NBIO > 0 */ @@ -1229,6 +1230,11 @@ mfi_ioctl(struct device *dev, u_long cmd, caddr_t addr) error = mfi_ioctl_alarm(sc, (struct bioc_alarm *)addr); break; + case BIOCBLINK: + DNPRINTF(MFI_D_IOCTL, "blink\n"); + error = mfi_ioctl_blink(sc, (struct bioc_blink *)addr); + break; + case BIOCSETSTATE: DNPRINTF(MFI_D_IOCTL, "setstate\n"); error = mfi_ioctl_setstate(sc, (struct bioc_setstate *)addr); @@ -1517,6 +1523,64 @@ mfi_ioctl_alarm(struct mfi_softc *sc, struct bioc_alarm *ba) } int +mfi_ioctl_blink(struct mfi_softc *sc, struct bioc_blink *bb) +{ + int i, found, rv = EINVAL; + uint8_t mbox[MFI_MBOX_SIZE]; + uint32_t cmd; + struct mfi_pd_list *pd; + + /* channel 0 means not in an enclosure so can't be blinked */ + if (bb->bb_channel == 0) + return (EINVAL); + + pd = malloc(MFI_PD_LIST_SIZE, M_DEVBUF, M_WAITOK); + + if (mfi_mgmt(sc, MR_DCMD_PD_GET_LIST, MFI_DATA_IN, + MFI_PD_LIST_SIZE, pd, NULL)) + goto done; + + for (i = 0, found = 0; i < pd->mpl_no_pd; i++) + if (bb->bb_channel == pd->mpl_address[i].mpa_enc_index && + bb->bb_target == pd->mpl_address[i].mpa_enc_slot) { + found = 1; + break; + } + + if (!found) + goto done; + + memset(mbox, 0, sizeof mbox); + + switch (bb->bb_status) { + case BIOC_SBUNBLINK: + *((uint16_t *)&mbox) = pd->mpl_address[i].mpa_pd_id;; + cmd = MR_DCMD_PD_UNBLINK; + break; + + case BIOC_SBBLINK: + *((uint16_t *)&mbox) = pd->mpl_address[i].mpa_pd_id;; + cmd = MR_DCMD_PD_BLINK; + break; + + case BIOC_SBALARM: + default: + DNPRINTF(MFI_D_IOCTL, "%s: mfi_ioctl_blink biocblink invalid " + "opcode %x\n", DEVNAME(sc), bb->bb_status); + goto done; + } + + + if (mfi_mgmt(sc, cmd, MFI_DATA_NONE, 0, NULL, mbox)) + goto done; + + rv = 0; +done: + free(pd, M_DEVBUF); + return (rv); +} + +int mfi_ioctl_setstate(struct mfi_softc *sc, struct bioc_setstate *bs) { return (ENOTTY); /* XXX not yet */ diff --git a/sys/dev/ic/mfireg.h b/sys/dev/ic/mfireg.h index 4500b4b4158..68a162aab48 100644 --- a/sys/dev/ic/mfireg.h +++ b/sys/dev/ic/mfireg.h @@ -1,4 +1,4 @@ -/* $OpenBSD: mfireg.h,v 1.22 2006/05/25 04:23:57 marco Exp $ */ +/* $OpenBSD: mfireg.h,v 1.23 2006/05/26 00:53:54 marco Exp $ */ /* * Copyright (c) 2006 Marco Peereboom <marco@peereboom.us> * @@ -94,6 +94,8 @@ #define MR_DCMD_CTRL_EVENT_WAIT 0x01040500 #define MR_DCMD_PD_GET_LIST 0x02010000 #define MR_DCMD_PD_GET_INFO 0x02020000 +#define MR_DCMD_PD_BLINK 0x02070100 +#define MR_DCMD_PD_UNBLINK 0x02070200 #define MR_DCMD_LD_GET_LIST 0x03010000 #define MR_DCMD_LD_GET_INFO 0x03020000 #define MR_DCMD_LD_GET_PROPERTIES 0x03030000 |