Deleted Added
full compact
45c45
< __FBSDID("$FreeBSD: head/sys/dev/mrsas/mrsas_ioctl.c 265555 2014-05-07 16:16:49Z ambrisko $");
---
> __FBSDID("$FreeBSD: head/sys/dev/mrsas/mrsas_ioctl.c 272737 2014-10-08 09:19:35Z kadesai $");
54c54
< int mrsas_passthru(struct mrsas_softc *sc, void *arg);
---
> int mrsas_passthru(struct mrsas_softc *sc, void *arg, u_long ioctlCmd);
57,58d56
< void mrsas_dump_dcmd(struct mrsas_softc *sc, struct mrsas_dcmd_frame* dcmd);
< void mrsas_dump_ioctl(struct mrsas_softc *sc, struct mrsas_iocpacket *user_ioc);
69d66
<
71,142d67
< * mrsas_dump_ioctl: Print debug output for DCMDs
< * input: Adapter instance soft state
< * DCMD frame structure
< *
< * This function is called from mrsas_passthru() to print out debug information
< * in the handling and routing of DCMD commands.
< */
< void mrsas_dump_dcmd( struct mrsas_softc *sc, struct mrsas_dcmd_frame* dcmd )
< {
< int i;
<
< device_printf(sc->mrsas_dev, "dcmd->cmd: 0x%02hhx\n", dcmd->cmd);
< device_printf(sc->mrsas_dev, "dcmd->cmd_status: 0x%02hhx\n", dcmd->cmd_status);
< device_printf(sc->mrsas_dev, "dcmd->sge_count: 0x%02hhx\n", dcmd->sge_count);
< device_printf(sc->mrsas_dev, "dcmd->context: 0x%08x\n", dcmd->context);
< device_printf(sc->mrsas_dev, "dcmd->flags: 0x%04hx\n", dcmd->flags);
< device_printf(sc->mrsas_dev, "dcmd->timeout: 0x%04hx\n", dcmd->timeout);
< device_printf(sc->mrsas_dev, "dcmd->data_xfer_len: 0x%08x\n", dcmd->data_xfer_len);
< device_printf(sc->mrsas_dev, "dcmd->opcode: 0x%08x\n", dcmd->opcode);
< device_printf(sc->mrsas_dev, "dcmd->mbox.w[0]: 0x%08x\n", dcmd->mbox.w[0]);
< device_printf(sc->mrsas_dev, "dcmd->mbox.w[1]: 0x%08x\n", dcmd->mbox.w[1]);
< device_printf(sc->mrsas_dev, "dcmd->mbox.w[2]: 0x%08x\n", dcmd->mbox.w[2]);
< for (i=0; i< MIN(MAX_IOCTL_SGE, dcmd->sge_count); i++) {
< device_printf(sc->mrsas_dev, "sgl[%02d]\n", i);
< device_printf(sc->mrsas_dev, " sge32[%02d].phys_addr: 0x%08x\n",
< i, dcmd->sgl.sge32[i].phys_addr);
< device_printf(sc->mrsas_dev, " sge32[%02d].length: 0x%08x\n",
< i, dcmd->sgl.sge32[i].length);
< device_printf(sc->mrsas_dev, " sge64[%02d].phys_addr: 0x%08llx\n",
< i, (long long unsigned int) dcmd->sgl.sge64[i].phys_addr);
< device_printf(sc->mrsas_dev, " sge64[%02d].length: 0x%08x\n",
< i, dcmd->sgl.sge64[i].length);
< }
< }
<
< /**
< * mrsas_dump_ioctl: Print debug output for ioctl
< * input: Adapter instance soft state
< * iocpacket structure
< *
< * This function is called from mrsas_passthru() to print out debug information
< * in the handling and routing of ioctl commands.
< */
< void mrsas_dump_ioctl(struct mrsas_softc *sc, struct mrsas_iocpacket *user_ioc)
< {
< union mrsas_frame *in_cmd = (union mrsas_frame *) &(user_ioc->frame.raw);
< struct mrsas_dcmd_frame* dcmd = (struct mrsas_dcmd_frame *) &(in_cmd->dcmd);
< int i;
<
< device_printf(sc->mrsas_dev,
< "====== In %s() ======================================\n", __func__);
< device_printf(sc->mrsas_dev, "host_no: 0x%04hx\n", user_ioc->host_no);
< device_printf(sc->mrsas_dev, " __pad1: 0x%04hx\n", user_ioc->__pad1);
< device_printf(sc->mrsas_dev, "sgl_off: 0x%08x\n", user_ioc->sgl_off);
< device_printf(sc->mrsas_dev, "sge_count: 0x%08x\n", user_ioc->sge_count);
< device_printf(sc->mrsas_dev, "sense_off: 0x%08x\n", user_ioc->sense_off);
< device_printf(sc->mrsas_dev, "sense_len: 0x%08x\n", user_ioc->sense_len);
<
< mrsas_dump_dcmd(sc, dcmd);
<
< for (i=0; i< MIN(MAX_IOCTL_SGE, user_ioc->sge_count); i++) {
< device_printf(sc->mrsas_dev, "sge[%02d]\n", i);
< device_printf(sc->mrsas_dev,
< " iov_base: %p\n", user_ioc->sgl[i].iov_base);
< device_printf(sc->mrsas_dev, " iov_len: %p\n",
< (void*)user_ioc->sgl[i].iov_len);
< }
< device_printf(sc->mrsas_dev,
< "==================================================================\n");
< }
<
< /**
150c75
< int mrsas_passthru( struct mrsas_softc *sc, void *arg )
---
> int mrsas_passthru( struct mrsas_softc *sc, void *arg, u_long ioctlCmd )
152a78,80
> #ifdef COMPAT_FREEBSD32
> struct mrsas_iocpacket32 *user_ioc32 = (struct mrsas_iocpacket32 *)arg;
> #endif
163c91
< int i, adapter, ioctl_data_size, ioctl_sense_size, ret=0;
---
> int i, ioctl_data_size=0, ioctl_sense_size, ret=0;
165a94,95
> uint8_t *iov_base_ptrin=NULL;
> size_t iov_len=0;
167,169d96
< /* For debug - uncomment the following line for debug output */
< //mrsas_dump_ioctl(sc, user_ioc);
<
180,186d106
< /* Validate host_no */
< adapter = user_ioc->host_no;
< if (adapter != device_get_unit(sc->mrsas_dev)) {
< device_printf(sc->mrsas_dev, "In %s() IOCTL not for me!\n", __func__);
< return(ENOENT);
< }
<
228,230c148,158
< if (!user_ioc->sgl[i].iov_len)
< continue;
< ioctl_data_size = user_ioc->sgl[i].iov_len;
---
> if (ioctlCmd == MRSAS_IOC_FIRMWARE_PASS_THROUGH64) {
> if (!user_ioc->sgl[i].iov_len)
> continue;
> ioctl_data_size = user_ioc->sgl[i].iov_len;
> #ifdef COMPAT_FREEBSD32
> } else {
> if (!user_ioc32->sgl[i].iov_len)
> continue;
> ioctl_data_size = user_ioc32->sgl[i].iov_len;
> #endif
> }
242,243c170,171
< device_printf(sc->mrsas_dev, "Cannot allocate ioctl data tag\n");
< return (ENOMEM);
---
> device_printf(sc->mrsas_dev, "Cannot allocate ioctl data tag\n");
> return (ENOMEM);
259d186
< kern_sge32[i].length = user_ioc->sgl[i].iov_len;
260a188,201
> if (ioctlCmd == MRSAS_IOC_FIRMWARE_PASS_THROUGH64) {
> kern_sge32[i].length = user_ioc->sgl[i].iov_len;
>
> iov_base_ptrin = user_ioc->sgl[i].iov_base;
> iov_len = user_ioc->sgl[i].iov_len;
> #ifdef COMPAT_FREEBSD32
> } else {
> kern_sge32[i].length = user_ioc32->sgl[i].iov_len;
>
> iov_base_ptrin = PTRIN(user_ioc32->sgl[i].iov_base);
> iov_len = user_ioc32->sgl[i].iov_len;
> #endif
> }
>
262,263c203
< ret = copyin(user_ioc->sgl[i].iov_base, ioctl_data_mem[i],
< user_ioc->sgl[i].iov_len);
---
> ret = copyin(iov_base_ptrin, ioctl_data_mem[i], iov_len);
265,266c205,206
< device_printf(sc->mrsas_dev, "IOCTL copyin failed!\n");
< goto out;
---
> device_printf(sc->mrsas_dev, "IOCTL copyin failed!\n");
> goto out;
270a211
>
314,315c255,265
< ret = copyout(ioctl_data_mem[i], user_ioc->sgl[i].iov_base,
< user_ioc->sgl[i].iov_len);
---
> if (ioctlCmd == MRSAS_IOC_FIRMWARE_PASS_THROUGH64) {
> iov_base_ptrin = user_ioc->sgl[i].iov_base;
> iov_len = user_ioc->sgl[i].iov_len;
> #ifdef COMPAT_FREEBSD32
> } else {
> iov_base_ptrin = PTRIN(user_ioc32->sgl[i].iov_base);
> iov_len = user_ioc32->sgl[i].iov_len;
> #endif
> }
>
> ret = copyout(ioctl_data_mem[i], iov_base_ptrin, iov_len);
371d320
<