summaryrefslogtreecommitdiff
path: root/sys/dev/ic/mpt_openbsd.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/dev/ic/mpt_openbsd.c')
-rw-r--r--sys/dev/ic/mpt_openbsd.c108
1 files changed, 83 insertions, 25 deletions
diff --git a/sys/dev/ic/mpt_openbsd.c b/sys/dev/ic/mpt_openbsd.c
index 1d5ca612388..efd2103f4e0 100644
--- a/sys/dev/ic/mpt_openbsd.c
+++ b/sys/dev/ic/mpt_openbsd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mpt_openbsd.c,v 1.15 2004/08/23 20:52:15 marco Exp $ */
+/* $OpenBSD: mpt_openbsd.c,v 1.16 2004/10/22 04:54:26 marco Exp $ */
/* $NetBSD: mpt_netbsd.c,v 1.7 2003/07/14 15:47:11 lukem Exp $ */
/*
@@ -119,6 +119,9 @@ void mpt_event_notify_reply(mpt_softc_t *, MSG_EVENT_NOTIFY_REPLY *);
int mpt_action(struct scsi_xfer *);
void mpt_minphys(struct buf *);
+#if NBIO > 0
+int mpt_ioctl(struct device *, u_long, caddr_t);
+#endif
struct cfdriver mpt_cd = {
NULL, "mpt", DV_DULL
};
@@ -403,8 +406,6 @@ void
mpt_attach(mpt_softc_t *mpt)
{
struct scsi_link *lptr = &mpt->sc_link;
- struct _CONFIG_PAGE_IOC_2 iocp2;
- int rv;
mpt->bus = 0; /* XXX ?? */
@@ -432,29 +433,18 @@ mpt_attach(mpt_softc_t *mpt)
mpt->verbose = 2;
#endif
- /* Read IOC page 2 to figure out if we have IM */
- rv = mpt_read_cfg_header(mpt, MPI_CONFIG_PAGETYPE_IOC, 2,
- 0, &iocp2.Header);
- if (rv) {
- mpt_prt(mpt, "Could not retrieve IOC PAGE 2 to determine"
- "RAID capabilities.");
- }
- else {
- mpt->im_support = iocp2.CapabilitiesFlags &
- (MPI_IOCPAGE2_CAP_FLAGS_IS_SUPPORT |
- MPI_IOCPAGE2_CAP_FLAGS_IME_SUPPORT |
- MPI_IOCPAGE2_CAP_FLAGS_IM_SUPPORT);
+#if NBIO > 0
+ if (bio_register(&mpt->mpt_dev, mpt_ioctl) != 0)
+ panic("%s: controller registration failed",
+ mpt->mpt_dev.dv_xname);
+#endif
- if (mpt->verbose > 1) {
- mpt_prt(mpt, "IOC Page 2: %x %x %x %x %x",
- iocp2.CapabilitiesFlags,
- iocp2.NumActiveVolumes,
- iocp2.MaxVolumes,
- iocp2.NumActivePhysDisks,
- iocp2.MaxPhysDisks);
- mpt_prt(mpt, "IM support: %x", mpt->im_support);
- }
- }
+ mpt->im_support = mpt->mpt_ioc_page2.CapabilitiesFlags &
+ (MPI_IOCPAGE2_CAP_FLAGS_IS_SUPPORT |
+ MPI_IOCPAGE2_CAP_FLAGS_IME_SUPPORT |
+ MPI_IOCPAGE2_CAP_FLAGS_IM_SUPPORT);
+
+ mpt_prt(mpt, "IM support: %x", mpt->im_support);
(void) config_found(&mpt->mpt_dev, lptr, scsiprint);
@@ -1625,3 +1615,71 @@ mpt_free_fw_mem(mpt_softc_t *mpt)
bus_dmamem_unmap(mpt->sc_dmat, (caddr_t)mpt->fw, mpt->fw_image_size);
bus_dmamem_free(mpt->sc_dmat, &mpt->fw_seg, mpt->fw_rseg);
}
+
+#if NBIO > 0
+int
+mpt_ioctl(dev, cmd, addr)
+ struct device *dev;
+ u_long cmd;
+ caddr_t addr;
+{
+ int error = 0;
+ int rv;
+ struct mpt_dummy *dummy;
+ struct mpt_mfg0 *pmfg0;
+ fCONFIG_PAGE_MANUFACTURING_0 mfgp0;
+ mpt_softc_t *mpt = (mpt_softc_t *)dev;
+
+ switch (cmd) {
+ case MPT_IOCTL_DUMMY:
+ dummy = (struct mpt_dummy *)addr;
+ if (mpt->verbose > 2) {
+ printf("%s: MPT_IOCTL_DUMMY %d\n",
+ dev->dv_xname, dummy->x++);
+ }
+ break;
+ /* Retrieve Manufacturing Page 0 */
+ case MPT_IOCTL_MFG0:
+ mfgp0.Header.PageNumber = 0;
+ mfgp0.Header.PageType = MPI_CONFIG_PAGETYPE_MANUFACTURING;
+ rv = mpt_read_cfg_page(mpt, 0, &mfgp0.Header);
+ if (rv) {
+ mpt_prt(mpt, "Could not retrieve MFG PAGE 0.");
+ error = EINVAL;
+ }
+ else {
+ if (mpt->verbose > 2) {
+ printf("Chip name: %s\n",
+ mfgp0.ChipName);
+ printf("Chip Revision: %s\n",
+ mfgp0.ChipRevision);
+ printf("Board name: %s\n",
+ mfgp0.BoardName);
+ printf("Board assembly: %s\n",
+ mfgp0.BoardAssembly);
+ printf("Board tracer number: %s\n",
+ mfgp0.BoardTracerNumber);
+ }
+ pmfg0 = (struct mpt_mfg0 *)addr;
+ memcpy(&pmfg0->cpm0, &mfgp0,
+ sizeof(fCONFIG_PAGE_MANUFACTURING_0));
+ }
+ break;
+ /* Retrieve Manufacturing Page 1 */
+ case MPT_IOCTL_MFG1:
+ break;
+ /* Retrieve Manufacturing Page 2 */
+ case MPT_IOCTL_MFG2:
+ break;
+ /* Retrieve Manufacturing Page 3 */
+ case MPT_IOCTL_MFG3:
+ break;
+ /* Retrieve Manufacturing Page 4 */
+ case MPT_IOCTL_MFG4:
+ break;
+ default:
+ error = EINVAL;
+ }
+ return (error);
+}
+#endif