aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/mfi
diff options
context:
space:
mode:
authorDoug Ambrisko <ambrisko@FreeBSD.org>2008-05-28 23:19:27 +0000
committerDoug Ambrisko <ambrisko@FreeBSD.org>2008-05-28 23:19:27 +0000
commit46fb79ea72ae5ad8660ea86edcd18e68a5d1d73e (patch)
treefa880c15ffde5440c1c163cd28940b31d2a30947 /sys/dev/mfi
parent6076cbacea03df99065b932be6a90fb64c20a0ec (diff)
Notes
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 e7e8fd9111e7..69125efdebbd 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 b285996a869b..9da30725a67b 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