summaryrefslogtreecommitdiffstats
path: root/sys/dev/mfi
diff options
context:
space:
mode:
authorambrisko <ambrisko@FreeBSD.org>2008-05-28 23:19:27 +0000
committerambrisko <ambrisko@FreeBSD.org>2008-05-28 23:19:27 +0000
commit8cdfff139ad4284c3bb507f66b9d00bd8b7a5de3 (patch)
treefa880c15ffde5440c1c163cd28940b31d2a30947 /sys/dev/mfi
parent9d56b1ea5480d63c8cfcb59441c2b9b71d21965b (diff)
downloadFreeBSD-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')
-rw-r--r--sys/dev/mfi/mfi.c42
-rw-r--r--sys/dev/mfi/mfi_ioctl.h20
2 files changed, 62 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");
diff --git a/sys/dev/mfi/mfi_ioctl.h b/sys/dev/mfi/mfi_ioctl.h
index b285996..9da3072 100644
--- a/sys/dev/mfi/mfi_ioctl.h
+++ b/sys/dev/mfi/mfi_ioctl.h
@@ -67,6 +67,23 @@ struct mfi_ioc_packet {
struct iovec mfi_sgl[MAX_IOCTL_SGE];
} __packed;
+#ifdef __amd64__
+struct mfi_ioc_packet32 {
+ uint16_t mfi_adapter_no;
+ uint16_t mfi_pad1;
+ uint32_t mfi_sgl_off;
+ uint32_t mfi_sge_count;
+ uint32_t mfi_sense_off;
+ uint32_t mfi_sense_len;
+ union {
+ uint8_t raw[128];
+ struct mfi_frame_header hdr;
+ } mfi_frame;
+
+ struct iovec32 mfi_sgl[MAX_IOCTL_SGE];
+} __packed;
+#endif
+
struct mfi_ioc_aen {
uint16_t aen_adapter_no;
uint16_t aen_pad1;
@@ -75,6 +92,9 @@ struct mfi_ioc_aen {
} __packed;
#define MFI_CMD _IOWR('M', 1, struct mfi_ioc_packet)
+#ifdef __amd64__
+#define MFI_CMD32 _IOWR('M', 1, struct mfi_ioc_packet32)
+#endif
#define MFI_SET_AEN _IOW('M', 3, struct mfi_ioc_aen)
#define MAX_LINUX_IOCTL_SGE 16
OpenPOWER on IntegriCloud