diff options
author | mjacob <mjacob@FreeBSD.org> | 2006-07-10 22:39:32 +0000 |
---|---|---|
committer | mjacob <mjacob@FreeBSD.org> | 2006-07-10 22:39:32 +0000 |
commit | 34d639efec9370034aaa0458e9c0d7b88b2027bb (patch) | |
tree | 3ccc6b4dee4293ba71bdd2c21deac7321469072e /sys/dev/isp/isp_freebsd.c | |
parent | cfc179a934e59efac00bc180f5be3a2b057380e2 (diff) | |
download | FreeBSD-src-34d639efec9370034aaa0458e9c0d7b88b2027bb.zip FreeBSD-src-34d639efec9370034aaa0458e9c0d7b88b2027bb.tar.gz |
Clean up the ioctl to not process nonsense on SCSI isp cards.
MFC after: 1 month
Diffstat (limited to 'sys/dev/isp/isp_freebsd.c')
-rw-r--r-- | sys/dev/isp/isp_freebsd.c | 84 |
1 files changed, 44 insertions, 40 deletions
diff --git a/sys/dev/isp/isp_freebsd.c b/sys/dev/isp/isp_freebsd.c index d387c0e..b600da9 100644 --- a/sys/dev/isp/isp_freebsd.c +++ b/sys/dev/isp/isp_freebsd.c @@ -290,37 +290,40 @@ ispioctl(_DEV dev, u_long c, caddr_t addr, int flags, _IOP *td) switch (c) { #ifdef ISP_FW_CRASH_DUMP case ISP_GET_FW_CRASH_DUMP: - { - uint16_t *ptr = FCPARAM(isp)->isp_dump_data; - size_t sz; + if (IS_FC(isp)) { + uint16_t *ptr = FCPARAM(isp)->isp_dump_data; + size_t sz; - retval = 0; - if (IS_2200(isp)) - sz = QLA2200_RISC_IMAGE_DUMP_SIZE; - else - sz = QLA2300_RISC_IMAGE_DUMP_SIZE; - ISP_LOCK(isp); - if (ptr && *ptr) { - void *uaddr = *((void **) addr); - if (copyout(ptr, uaddr, sz)) { - retval = EFAULT; + retval = 0; + if (IS_2200(isp)) { + sz = QLA2200_RISC_IMAGE_DUMP_SIZE; } else { - *ptr = 0; + sz = QLA2300_RISC_IMAGE_DUMP_SIZE; } - } else { - retval = ENXIO; + ISP_LOCK(isp); + if (ptr && *ptr) { + void *uaddr = *((void **) addr); + if (copyout(ptr, uaddr, sz)) { + retval = EFAULT; + } else { + *ptr = 0; + } + } else { + retval = ENXIO; + } + ISP_UNLOCK(isp); } - ISP_UNLOCK(isp); break; - } - case ISP_FORCE_CRASH_DUMP: - ISP_LOCK(isp); - isp_freeze_loopdown(isp, "ispioctl(ISP_FORCE_CRASH_DUMP)"); - isp_fw_dump(isp); - isp_reinit(isp); - ISP_UNLOCK(isp); - retval = 0; + if (IS_FC(isp)) { + ISP_LOCK(isp); + isp_freeze_loopdown(isp, + "ispioctl(ISP_FORCE_CRASH_DUMP)"); + isp_fw_dump(isp); + isp_reinit(isp); + ISP_UNLOCK(isp); + retval = 0; + } break; #endif case ISP_SDBLEV: @@ -377,6 +380,9 @@ ispioctl(_DEV dev, u_long c, caddr_t addr, int flags, _IOP *td) struct isp_fc_device *ifc = (struct isp_fc_device *) addr; struct lportdb *lp; + if (IS_SCSI(isp)) { + break; + } if (ifc->loopid < 0 || ifc->loopid >= MAX_FC_TARG) { retval = EINVAL; break; @@ -434,19 +440,20 @@ ispioctl(_DEV dev, u_long c, caddr_t addr, int flags, _IOP *td) { struct isp_hba_device *hba = (struct isp_hba_device *) addr; MEMZERO(hba, sizeof (*hba)); - ISP_LOCK(isp); + hba->fc_fw_major = ISP_FW_MAJORX(isp->isp_fwrev); hba->fc_fw_minor = ISP_FW_MINORX(isp->isp_fwrev); hba->fc_fw_micro = ISP_FW_MICROX(isp->isp_fwrev); - hba->fc_speed = FCPARAM(isp)->isp_gbspeed; - hba->fc_scsi_supported = 1; - hba->fc_topology = FCPARAM(isp)->isp_topo + 1; - hba->fc_loopid = FCPARAM(isp)->isp_loopid; - hba->nvram_node_wwn = FCPARAM(isp)->isp_nodewwn; - hba->nvram_port_wwn = FCPARAM(isp)->isp_portwwn; - hba->active_node_wwn = ISP_NODEWWN(isp); - hba->active_port_wwn = ISP_PORTWWN(isp); - ISP_UNLOCK(isp); + if (IS_FC(isp)) { + hba->fc_speed = FCPARAM(isp)->isp_gbspeed; + hba->fc_scsi_supported = 1; + hba->fc_topology = FCPARAM(isp)->isp_topo + 1; + hba->fc_loopid = FCPARAM(isp)->isp_loopid; + hba->nvram_node_wwn = FCPARAM(isp)->isp_nodewwn; + hba->nvram_port_wwn = FCPARAM(isp)->isp_portwwn; + hba->active_node_wwn = ISP_NODEWWN(isp); + hba->active_port_wwn = ISP_PORTWWN(isp); + } retval = 0; break; } @@ -454,8 +461,7 @@ ispioctl(_DEV dev, u_long c, caddr_t addr, int flags, _IOP *td) { struct isp_fc_param *f = (struct isp_fc_param *) addr; - if (!IS_FC(isp)) { - retval = EINVAL; + if (IS_SCSI(isp)) { break; } f->parameter = 0; @@ -488,8 +494,7 @@ ispioctl(_DEV dev, u_long c, caddr_t addr, int flags, _IOP *td) struct isp_fc_param *f = (struct isp_fc_param *) addr; uint32_t param = f->parameter; - if (!IS_FC(isp)) { - retval = EINVAL; + if (IS_SCSI(isp)) { break; } f->parameter = 0; @@ -546,7 +551,6 @@ ispioctl(_DEV dev, u_long c, caddr_t addr, int flags, _IOP *td) mbreg_t mbs; if (IS_SCSI(isp)) { - retval = EINVAL; break; } |