diff --git a/sys/dev/aac/aac.c b/sys/dev/aac/aac.c index 75f01358841..dc646c936a3 100644 --- a/sys/dev/aac/aac.c +++ b/sys/dev/aac/aac.c @@ -157,14 +157,9 @@ static d_ioctl_t aac_ioctl; static int aac_ioctl_sendfib(struct aac_softc *sc, caddr_t ufib); static void aac_handle_aif(struct aac_softc *sc, struct aac_aif_command *aif); -#ifdef AAC_COMPAT_LINUX -static int aac_linux_rev_check(struct aac_softc *sc, - caddr_t udata); -static int aac_linux_getnext_aif(struct aac_softc *sc, - caddr_t arg); -static int aac_linux_return_aif(struct aac_softc *sc, - caddr_t uptr); -#endif +static int aac_rev_check(struct aac_softc *sc, caddr_t udata); +static int aac_getnext_aif(struct aac_softc *sc, caddr_t arg); +static int aac_return_aif(struct aac_softc *sc, caddr_t uptr); #define AAC_CDEV_MAJOR 150 @@ -1775,9 +1770,7 @@ aac_ioctl(dev_t dev, u_long cmd, caddr_t arg, int flag, struct proc *p) union aac_statrequest *as = (union aac_statrequest *)arg; struct aac_softc *sc = dev->si_drv1; int error = 0; -#ifdef AAC_COMPAT_LINUX int i; -#endif debug_called(2); @@ -1798,16 +1791,20 @@ aac_ioctl(dev_t dev, u_long cmd, caddr_t arg, int flag, struct proc *p) } break; -#ifdef AAC_COMPAT_LINUX case FSACTL_SENDFIB: + arg = *(caddr_t *)arg; + case FSACTL_LNX_SENDFIB: debug(1, "FSACTL_SENDFIB"); error = aac_ioctl_sendfib(sc, arg); break; case FSACTL_AIF_THREAD: + case FSACTL_LNX_AIF_THREAD: debug(1, "FSACTL_AIF_THREAD"); error = EINVAL; break; case FSACTL_OPEN_GET_ADAPTER_FIB: + arg = *(caddr_t *)arg; + case FSACTL_LNX_OPEN_GET_ADAPTER_FIB: debug(1, "FSACTL_OPEN_GET_ADAPTER_FIB"); /* * Pass the caller out an AdapterFibContext. @@ -1823,18 +1820,22 @@ aac_ioctl(dev_t dev, u_long cmd, caddr_t arg, int flag, struct proc *p) error = copyout(&i, arg, sizeof(i)); break; case FSACTL_GET_NEXT_ADAPTER_FIB: + arg = *(caddr_t *)arg; + case FSACTL_LNX_GET_NEXT_ADAPTER_FIB: debug(1, "FSACTL_GET_NEXT_ADAPTER_FIB"); - error = aac_linux_getnext_aif(sc, arg); + error = aac_getnext_aif(sc, arg); break; case FSACTL_CLOSE_GET_ADAPTER_FIB: + case FSACTL_LNX_CLOSE_GET_ADAPTER_FIB: debug(1, "FSACTL_CLOSE_GET_ADAPTER_FIB"); /* don't do anything here */ break; case FSACTL_MINIPORT_REV_CHECK: + arg = *(caddr_t *)arg; + case FSACTL_LNX_MINIPORT_REV_CHECK: debug(1, "FSACTL_MINIPORT_REV_CHECK"); - error = aac_linux_rev_check(sc, arg); + error = aac_rev_check(sc, arg); break; -#endif default: device_printf(sc->aac_dev, "unsupported cmd 0x%lx\n", cmd); error = EINVAL; @@ -1969,6 +1970,8 @@ aac_linux_ioctl(struct proc *p, struct linux_ioctl_args *args) return(fo_ioctl(fp, cmd, (caddr_t)args->arg, p)); } +#endif + /****************************************************************************** * Return the Revision of the driver to userspace and check to see if the * userspace app is possibly compatible. This is extremely bogus right now @@ -1976,7 +1979,7 @@ aac_linux_ioctl(struct proc *p, struct linux_ioctl_args *args) * needed, though, to get aaccli working. */ static int -aac_linux_rev_check(struct aac_softc *sc, caddr_t udata) +aac_rev_check(struct aac_softc *sc, caddr_t udata) { struct aac_rev_check rev_check; struct aac_rev_check_resp rev_check_resp; @@ -2009,7 +2012,7 @@ aac_linux_rev_check(struct aac_softc *sc, caddr_t udata) * Pass the caller the next AIF in their queue */ static int -aac_linux_getnext_aif(struct aac_softc *sc, caddr_t arg) +aac_getnext_aif(struct aac_softc *sc, caddr_t arg) { struct get_adapter_fib_ioctl agf; int error, s; @@ -2026,14 +2029,14 @@ aac_linux_getnext_aif(struct aac_softc *sc, caddr_t arg) } else { s = splbio(); - error = aac_linux_return_aif(sc, agf.AifFib); + error = aac_return_aif(sc, agf.AifFib); if ((error == EAGAIN) && (agf.Wait)) { sc->aac_state |= AAC_STATE_AIF_SLEEPER; while (error == EAGAIN) { error = tsleep(sc->aac_aifq, PRIBIO | PCATCH, "aacaif", 0); if (error == 0) - error = aac_linux_return_aif(sc, agf.AifFib); + error = aac_return_aif(sc, agf.AifFib); } sc->aac_state &= ~AAC_STATE_AIF_SLEEPER; } @@ -2047,7 +2050,7 @@ aac_linux_getnext_aif(struct aac_softc *sc, caddr_t arg) * Hand the next AIF off the top of the queue out to userspace. */ static int -aac_linux_return_aif(struct aac_softc *sc, caddr_t uptr) +aac_return_aif(struct aac_softc *sc, caddr_t uptr) { int error, s; @@ -2065,6 +2068,3 @@ aac_linux_return_aif(struct aac_softc *sc, caddr_t uptr) splx(s); return(error); } - - -#endif /* AAC_COMPAT_LINUX */ diff --git a/sys/dev/aac/aac_ioctl.h b/sys/dev/aac/aac_ioctl.h index a4f675a54cd..abfde7c8609 100644 --- a/sys/dev/aac/aac_ioctl.h +++ b/sys/dev/aac/aac_ioctl.h @@ -72,18 +72,80 @@ union aac_statrequest { #define FILE_WRITE_ACCESS ( 0x0002 ) #define FILE_DEVICE_CONTROLLER 0x00000004 -#define FSACTL_SENDFIB CTL_CODE(FILE_DEVICE_CONTROLLER, 2050, \ +#define FSACTL_LNX_SENDFIB CTL_CODE(FILE_DEVICE_CONTROLLER, 2050, \ METHOD_BUFFERED, FILE_ANY_ACCESS) -#define FSACTL_AIF_THREAD CTL_CODE(FILE_DEVICE_CONTROLLER, 2127, \ +#define FSACTL_LNX_GET_COMM_PERF_DATA CTL_CODE(FILE_DEVICE_CONTROLLER, 2084, \ + METHOD_BUFFERED, FILE_ANY_ACCESS) +#define FSACTL_LNX_OPENCLS_COMM_PERF_DATA CTL_CODE(FILE_DEVICE_CONTROLLER, \ + 2085, METHOD_BUFFERED, FILE_ANY_ACCESS) +#define FSACTL_LNX_OPEN_GET_ADAPTER_FIB CTL_CODE(FILE_DEVICE_CONTROLLER, 2100, \ + METHOD_BUFFERED, FILE_ANY_ACCESS) +#define FSACTL_LNX_GET_NEXT_ADAPTER_FIB CTL_CODE(FILE_DEVICE_CONTROLLER, 2101, \ + METHOD_BUFFERED, FILE_ANY_ACCESS) +#define FSACTL_LNX_CLOSE_GET_ADAPTER_FIB CTL_CODE(FILE_DEVICE_CONTROLLER, \ + 2102, METHOD_BUFFERED, FILE_ANY_ACCESS) +#define FSACTL_LNX_CLOSE_ADAPTER_CONFIG CTL_CODE(FILE_DEVICE_CONTROLLER, 2104, \ + METHOD_BUFFERED, FILE_ANY_ACCESS) +#define FSACTL_LNX_OPEN_ADAPTER_CONFIG CTL_CODE(FILE_DEVICE_CONTROLLER, 2105, \ + METHOD_BUFFERED, FILE_ANY_ACCESS) +#define FSACTL_LNX_MINIPORT_REV_CHECK CTL_CODE(FILE_DEVICE_CONTROLLER, 2107, \ + METHOD_BUFFERED, FILE_ANY_ACCESS) +#define FSACTL_LNX_QUERY_ADAPTER_CONFIG CTL_CODE(FILE_DEVICE_CONTROLLER, 2113, \ + METHOD_BUFFERED, FILE_ANY_ACCESS) +#define FSACTL_LNX_GET_PCI_INFO CTL_CODE(FILE_DEVICE_CONTROLLER, 2119, \ + METHOD_BUFFERED, FILE_ANY_ACCESS) +#define FSACTL_LNX_FORCE_DELETE_DISK CTL_CODE(FILE_DEVICE_CONTROLLER, 2120, \ METHOD_NEITHER, FILE_ANY_ACCESS) -#define FSACTL_OPEN_GET_ADAPTER_FIB CTL_CODE(FILE_DEVICE_CONTROLLER, 2100, \ - METHOD_BUFFERED, FILE_ANY_ACCESS) -#define FSACTL_GET_NEXT_ADAPTER_FIB CTL_CODE(FILE_DEVICE_CONTROLLER, 2101, \ - METHOD_BUFFERED, FILE_ANY_ACCESS) -#define FSACTL_CLOSE_GET_ADAPTER_FIB CTL_CODE(FILE_DEVICE_CONTROLLER, 2102, \ - METHOD_BUFFERED, FILE_ANY_ACCESS) -#define FSACTL_MINIPORT_REV_CHECK CTL_CODE(FILE_DEVICE_CONTROLLER, 2107, \ - METHOD_BUFFERED, FILE_ANY_ACCESS) +#define FSACTL_LNX_AIF_THREAD CTL_CODE(FILE_DEVICE_CONTROLLER, 2127, \ + METHOD_NEITHER, FILE_ANY_ACCESS) + +/* Why these don't follow the previous convention, I don't know */ +#define FSACTL_LNX_NULL_IO_TEST 0x43 +#define FSACTL_LNX_SIM_IO_TEST 0x53 +#define FSACTL_LNX_DOWNLOAD 0x83 +#define FSACTL_LNX_GET_VAR 0x93 +#define FSACTL_LNX_SET_VAR 0xa3 +#define FSACTL_LNX_GET_FIBTIMES 0xb3 +#define FSACTL_LNX_ZERO_FIBTIMES 0xc3 +#define FSACTL_LNX_DELETE_DISK 0x163 +#define FSACTL_LNX_QUERY_DISK 0x173 + +/* Ok, this one is really lame */ +#define FSACTL_LNX_PROBE_CONTAINERS 2131 /* Just guessing */ + +/* Do the native version of the ioctls. Since the BSD encoding scheme + * conflicts with the 'standard' AAC encoding scheme, the resulting values + * must be different. The '8' comes from the fact that the previous scheme + * used 12 bits for the number, with the the 12th bit being the only set + * bit above bit 8. Thus the value of 8, with the lower 8 bits holding the + * command number. 9 is used for the odd overflow/collision case. + */ +#define FSACTL_SENDFIB _IO('8', 2) +#define FSACTL_GET_COMM_PERF_DATA _IO('8', 36) +#define FSACTL_OPENCLS_COMM_PERF_DATA _IO('8', 37) +#define FSACTL_OPEN_GET_ADAPTER_FIB _IO('8', 52) +#define FSACTL_GET_NEXT_ADAPTER_FIB _IO('8', 53) +#define FSACTL_CLOSE_GET_ADAPTER_FIB _IO('8', 54) +#define FSACTL_CLOSE_ADAPTER_CONFIG _IO('8', 56) +#define FSACTL_OPEN_ADAPTER_CONFIG _IO('8', 57) +#define FSACTL_MINIPORT_REV_CHECK _IO('8', 59) +#define FSACTL_QUERY_ADAPTER_CONFIG _IO('8', 65) +#define FSACTL_GET_PCI_INFO _IO('8', 71) +#define FSACTL_FORCE_DELETE_DISK _IO('8', 72) +#define FSACTL_AIF_THREAD _IO('8', 79) + +#define FSACTL_NULL_IO_TEST _IO('8', 67) +#define FSACTL_SIM_IO_TEST _IO('8', 83) +#define FSACTL_DOWNLOAD _IO('8', 131) +#define FSACTL_GET_VAR _IO('8', 147) +#define FSACTL_SET_VAR _IO('8', 163) +#define FSACTL_GET_FIBTIMES _IO('8', 179) +#define FSACTL_ZERO_FIBTIMES _IO('8', 195) +#define FSACTL_DELETE_DISK _IO('8', 99) +#define FSACTL_QUERY_DISK _IO('9', 115) + +#define FSACTL_PROBE_CONTAINERS _IO('9', 83) /* Just guessing */ + /* * Support for faking the "miniport" version. diff --git a/sys/sys/aac_ioctl.h b/sys/sys/aac_ioctl.h index a4f675a54cd..abfde7c8609 100644 --- a/sys/sys/aac_ioctl.h +++ b/sys/sys/aac_ioctl.h @@ -72,18 +72,80 @@ union aac_statrequest { #define FILE_WRITE_ACCESS ( 0x0002 ) #define FILE_DEVICE_CONTROLLER 0x00000004 -#define FSACTL_SENDFIB CTL_CODE(FILE_DEVICE_CONTROLLER, 2050, \ +#define FSACTL_LNX_SENDFIB CTL_CODE(FILE_DEVICE_CONTROLLER, 2050, \ METHOD_BUFFERED, FILE_ANY_ACCESS) -#define FSACTL_AIF_THREAD CTL_CODE(FILE_DEVICE_CONTROLLER, 2127, \ +#define FSACTL_LNX_GET_COMM_PERF_DATA CTL_CODE(FILE_DEVICE_CONTROLLER, 2084, \ + METHOD_BUFFERED, FILE_ANY_ACCESS) +#define FSACTL_LNX_OPENCLS_COMM_PERF_DATA CTL_CODE(FILE_DEVICE_CONTROLLER, \ + 2085, METHOD_BUFFERED, FILE_ANY_ACCESS) +#define FSACTL_LNX_OPEN_GET_ADAPTER_FIB CTL_CODE(FILE_DEVICE_CONTROLLER, 2100, \ + METHOD_BUFFERED, FILE_ANY_ACCESS) +#define FSACTL_LNX_GET_NEXT_ADAPTER_FIB CTL_CODE(FILE_DEVICE_CONTROLLER, 2101, \ + METHOD_BUFFERED, FILE_ANY_ACCESS) +#define FSACTL_LNX_CLOSE_GET_ADAPTER_FIB CTL_CODE(FILE_DEVICE_CONTROLLER, \ + 2102, METHOD_BUFFERED, FILE_ANY_ACCESS) +#define FSACTL_LNX_CLOSE_ADAPTER_CONFIG CTL_CODE(FILE_DEVICE_CONTROLLER, 2104, \ + METHOD_BUFFERED, FILE_ANY_ACCESS) +#define FSACTL_LNX_OPEN_ADAPTER_CONFIG CTL_CODE(FILE_DEVICE_CONTROLLER, 2105, \ + METHOD_BUFFERED, FILE_ANY_ACCESS) +#define FSACTL_LNX_MINIPORT_REV_CHECK CTL_CODE(FILE_DEVICE_CONTROLLER, 2107, \ + METHOD_BUFFERED, FILE_ANY_ACCESS) +#define FSACTL_LNX_QUERY_ADAPTER_CONFIG CTL_CODE(FILE_DEVICE_CONTROLLER, 2113, \ + METHOD_BUFFERED, FILE_ANY_ACCESS) +#define FSACTL_LNX_GET_PCI_INFO CTL_CODE(FILE_DEVICE_CONTROLLER, 2119, \ + METHOD_BUFFERED, FILE_ANY_ACCESS) +#define FSACTL_LNX_FORCE_DELETE_DISK CTL_CODE(FILE_DEVICE_CONTROLLER, 2120, \ METHOD_NEITHER, FILE_ANY_ACCESS) -#define FSACTL_OPEN_GET_ADAPTER_FIB CTL_CODE(FILE_DEVICE_CONTROLLER, 2100, \ - METHOD_BUFFERED, FILE_ANY_ACCESS) -#define FSACTL_GET_NEXT_ADAPTER_FIB CTL_CODE(FILE_DEVICE_CONTROLLER, 2101, \ - METHOD_BUFFERED, FILE_ANY_ACCESS) -#define FSACTL_CLOSE_GET_ADAPTER_FIB CTL_CODE(FILE_DEVICE_CONTROLLER, 2102, \ - METHOD_BUFFERED, FILE_ANY_ACCESS) -#define FSACTL_MINIPORT_REV_CHECK CTL_CODE(FILE_DEVICE_CONTROLLER, 2107, \ - METHOD_BUFFERED, FILE_ANY_ACCESS) +#define FSACTL_LNX_AIF_THREAD CTL_CODE(FILE_DEVICE_CONTROLLER, 2127, \ + METHOD_NEITHER, FILE_ANY_ACCESS) + +/* Why these don't follow the previous convention, I don't know */ +#define FSACTL_LNX_NULL_IO_TEST 0x43 +#define FSACTL_LNX_SIM_IO_TEST 0x53 +#define FSACTL_LNX_DOWNLOAD 0x83 +#define FSACTL_LNX_GET_VAR 0x93 +#define FSACTL_LNX_SET_VAR 0xa3 +#define FSACTL_LNX_GET_FIBTIMES 0xb3 +#define FSACTL_LNX_ZERO_FIBTIMES 0xc3 +#define FSACTL_LNX_DELETE_DISK 0x163 +#define FSACTL_LNX_QUERY_DISK 0x173 + +/* Ok, this one is really lame */ +#define FSACTL_LNX_PROBE_CONTAINERS 2131 /* Just guessing */ + +/* Do the native version of the ioctls. Since the BSD encoding scheme + * conflicts with the 'standard' AAC encoding scheme, the resulting values + * must be different. The '8' comes from the fact that the previous scheme + * used 12 bits for the number, with the the 12th bit being the only set + * bit above bit 8. Thus the value of 8, with the lower 8 bits holding the + * command number. 9 is used for the odd overflow/collision case. + */ +#define FSACTL_SENDFIB _IO('8', 2) +#define FSACTL_GET_COMM_PERF_DATA _IO('8', 36) +#define FSACTL_OPENCLS_COMM_PERF_DATA _IO('8', 37) +#define FSACTL_OPEN_GET_ADAPTER_FIB _IO('8', 52) +#define FSACTL_GET_NEXT_ADAPTER_FIB _IO('8', 53) +#define FSACTL_CLOSE_GET_ADAPTER_FIB _IO('8', 54) +#define FSACTL_CLOSE_ADAPTER_CONFIG _IO('8', 56) +#define FSACTL_OPEN_ADAPTER_CONFIG _IO('8', 57) +#define FSACTL_MINIPORT_REV_CHECK _IO('8', 59) +#define FSACTL_QUERY_ADAPTER_CONFIG _IO('8', 65) +#define FSACTL_GET_PCI_INFO _IO('8', 71) +#define FSACTL_FORCE_DELETE_DISK _IO('8', 72) +#define FSACTL_AIF_THREAD _IO('8', 79) + +#define FSACTL_NULL_IO_TEST _IO('8', 67) +#define FSACTL_SIM_IO_TEST _IO('8', 83) +#define FSACTL_DOWNLOAD _IO('8', 131) +#define FSACTL_GET_VAR _IO('8', 147) +#define FSACTL_SET_VAR _IO('8', 163) +#define FSACTL_GET_FIBTIMES _IO('8', 179) +#define FSACTL_ZERO_FIBTIMES _IO('8', 195) +#define FSACTL_DELETE_DISK _IO('8', 99) +#define FSACTL_QUERY_DISK _IO('9', 115) + +#define FSACTL_PROBE_CONTAINERS _IO('9', 83) /* Just guessing */ + /* * Support for faking the "miniport" version.