diff options
author | ambrisko <ambrisko@FreeBSD.org> | 2008-05-28 23:19:27 +0000 |
---|---|---|
committer | ambrisko <ambrisko@FreeBSD.org> | 2008-05-28 23:19:27 +0000 |
commit | 8cdfff139ad4284c3bb507f66b9d00bd8b7a5de3 (patch) | |
tree | fa880c15ffde5440c1c163cd28940b31d2a30947 /sys/dev/mfi/mfi.c | |
parent | 9d56b1ea5480d63c8cfcb59441c2b9b71d21965b (diff) | |
download | FreeBSD-src-8cdfff139ad4284c3bb507f66b9d00bd8b7a5de3.zip FreeBSD-src-8cdfff139ad4284c3bb507f66b9d00bd8b7a5de3.tar.gz |
Add support to talk to the LSI ioctl path on with FreeBSD 32 bit app's
on amd64. Note the only difference is the iovec32 part so I use the
native structure for everything else.
Also I plan to MFC all the changes in -current to 7-stable and 6-stable
shortly since I've been running them. This does not include the cam
changes.
MFC after: 3 days
Diffstat (limited to 'sys/dev/mfi/mfi.c')
-rw-r--r-- | sys/dev/mfi/mfi.c | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/sys/dev/mfi/mfi.c b/sys/dev/mfi/mfi.c index e7e8fd9..69125ef 100644 --- a/sys/dev/mfi/mfi.c +++ b/sys/dev/mfi/mfi.c @@ -2108,6 +2108,9 @@ mfi_ioctl(struct cdev *dev, u_long cmd, caddr_t arg, int flag, d_thread_t *td) struct mfi_softc *sc; union mfi_statrequest *ms; struct mfi_ioc_packet *ioc; +#ifdef __amd64__ + struct mfi_ioc_packet32 *ioc32; +#endif struct mfi_ioc_aen *aen; struct mfi_command *cm = NULL; uint32_t context; @@ -2165,6 +2168,9 @@ mfi_ioctl(struct cdev *dev, u_long cmd, caddr_t arg, int flag, d_thread_t *td) break; } case MFI_CMD: +#ifdef __amd64__ + case MFI_CMD32: +#endif { devclass_t devclass; ioc = (struct mfi_ioc_packet *)arg; @@ -2222,9 +2228,27 @@ mfi_ioctl(struct cdev *dev, u_long cmd, caddr_t arg, int flag, d_thread_t *td) temp = data; if (cm->cm_flags & MFI_CMD_DATAOUT) { for (i = 0; i < ioc->mfi_sge_count; i++) { +#ifdef __amd64__ + if (cmd == MFI_CMD) { + /* Native */ + error = copyin(ioc->mfi_sgl[i].iov_base, + temp, + ioc->mfi_sgl[i].iov_len); + } else { + void *temp_convert; + /* 32bit */ + ioc32 = (struct mfi_ioc_packet32 *)ioc; + temp_convert = + PTRIN(ioc32->mfi_sgl[i].iov_base); + error = copyin(temp_convert, + temp, + ioc32->mfi_sgl[i].iov_len); + } +#else error = copyin(ioc->mfi_sgl[i].iov_base, temp, ioc->mfi_sgl[i].iov_len); +#endif if (error != 0) { device_printf(sc->mfi_dev, "Copy in failed\n"); @@ -2257,9 +2281,27 @@ mfi_ioctl(struct cdev *dev, u_long cmd, caddr_t arg, int flag, d_thread_t *td) temp = data; if (cm->cm_flags & MFI_CMD_DATAIN) { for (i = 0; i < ioc->mfi_sge_count; i++) { +#ifdef __amd64__ + if (cmd == MFI_CMD) { + /* Native */ + error = copyout(temp, + ioc->mfi_sgl[i].iov_base, + ioc->mfi_sgl[i].iov_len); + } else { + void *temp_convert; + /* 32bit */ + ioc32 = (struct mfi_ioc_packet32 *)ioc; + temp_convert = + PTRIN(ioc32->mfi_sgl[i].iov_base); + error = copyout(temp, + temp_convert, + ioc32->mfi_sgl[i].iov_len); + } +#else error = copyout(temp, ioc->mfi_sgl[i].iov_base, ioc->mfi_sgl[i].iov_len); +#endif if (error != 0) { device_printf(sc->mfi_dev, "Copy out failed\n"); |