165793Smsmith/*- 265793Smsmith * Copyright (c) 2000 Michael Smith 382527Sscottl * Copyright (c) 2000 Scott Long 465793Smsmith * Copyright (c) 2000 BSDi 565793Smsmith * All rights reserved. 665793Smsmith * 765793Smsmith * Redistribution and use in source and binary forms, with or without 865793Smsmith * modification, are permitted provided that the following conditions 965793Smsmith * are met: 1065793Smsmith * 1. Redistributions of source code must retain the above copyright 1165793Smsmith * notice, this list of conditions and the following disclaimer. 1265793Smsmith * 2. Redistributions in binary form must reproduce the above copyright 1365793Smsmith * notice, this list of conditions and the following disclaimer in the 1465793Smsmith * documentation and/or other materials provided with the distribution. 1565793Smsmith * 1665793Smsmith * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 1765793Smsmith * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 1865793Smsmith * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 1965793Smsmith * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 2065793Smsmith * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 2165793Smsmith * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 2265793Smsmith * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 2365793Smsmith * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 2465793Smsmith * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 2565793Smsmith * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 2665793Smsmith * SUCH DAMAGE. 2765793Smsmith * 2865793Smsmith * $FreeBSD$ 2965793Smsmith */ 3065793Smsmith 3170393Smsmith/* 3270393Smsmith * Command queue statistics 3370393Smsmith */ 3470393Smsmith#define AACQ_FREE 0 3570393Smsmith#define AACQ_BIO 1 3670393Smsmith#define AACQ_READY 2 3770393Smsmith#define AACQ_BUSY 3 38125574Sscottl#define AACQ_COUNT 4 /* total number of queues */ 3970393Smsmith 4070393Smsmithstruct aac_qstat { 4183114Sscottl u_int32_t q_length; 4283114Sscottl u_int32_t q_max; 4370393Smsmith}; 4470393Smsmith 4570393Smsmith/* 4670393Smsmith * Statistics request 4770393Smsmith */ 4870393Smsmithunion aac_statrequest { 4983114Sscottl u_int32_t as_item; 5083114Sscottl struct aac_qstat as_qstat; 5170393Smsmith}; 5270393Smsmith 5370393Smsmith#define AACIO_STATS _IOWR('T', 101, union aac_statrequest) 5470393Smsmith 5565793Smsmith/* 5665793Smsmith * Ioctl commands likely to be submitted from a Linux management application. 5765793Smsmith * These bit encodings are actually descended from Windows NT. Ick. 5865793Smsmith */ 5965793Smsmith 6082527Sscottl#define CTL_CODE(devType, func, meth, acc) (((devType) << 16) | ((acc) << 14) | ((func) << 2) | (meth)) 6165793Smsmith#define METHOD_BUFFERED 0 6265793Smsmith#define METHOD_IN_DIRECT 1 6365793Smsmith#define METHOD_OUT_DIRECT 2 6465793Smsmith#define METHOD_NEITHER 3 6565793Smsmith#define FILE_ANY_ACCESS 0 6665793Smsmith#define FILE_READ_ACCESS ( 0x0001 ) 6765793Smsmith#define FILE_WRITE_ACCESS ( 0x0002 ) 6865793Smsmith#define FILE_DEVICE_CONTROLLER 0x00000004 6965793Smsmith 7081189Sscottl#define FSACTL_LNX_SENDFIB CTL_CODE(FILE_DEVICE_CONTROLLER, 2050, \ 7181188Sscottl METHOD_BUFFERED, FILE_ANY_ACCESS) 72177462Semaste#define FSACTL_LNX_SEND_RAW_SRB CTL_CODE(FILE_DEVICE_CONTROLLER, 2067, \ 73177462Semaste METHOD_BUFFERED, FILE_ANY_ACCESS) 7481189Sscottl#define FSACTL_LNX_GET_COMM_PERF_DATA CTL_CODE(FILE_DEVICE_CONTROLLER, 2084, \ 7581188Sscottl METHOD_BUFFERED, FILE_ANY_ACCESS) 7681189Sscottl#define FSACTL_LNX_OPENCLS_COMM_PERF_DATA CTL_CODE(FILE_DEVICE_CONTROLLER, \ 7781189Sscottl 2085, METHOD_BUFFERED, FILE_ANY_ACCESS) 7881189Sscottl#define FSACTL_LNX_OPEN_GET_ADAPTER_FIB CTL_CODE(FILE_DEVICE_CONTROLLER, 2100, \ 7981188Sscottl METHOD_BUFFERED, FILE_ANY_ACCESS) 8081189Sscottl#define FSACTL_LNX_GET_NEXT_ADAPTER_FIB CTL_CODE(FILE_DEVICE_CONTROLLER, 2101, \ 8181188Sscottl METHOD_BUFFERED, FILE_ANY_ACCESS) 8281189Sscottl#define FSACTL_LNX_CLOSE_GET_ADAPTER_FIB CTL_CODE(FILE_DEVICE_CONTROLLER, \ 8381189Sscottl 2102, METHOD_BUFFERED, FILE_ANY_ACCESS) 8481189Sscottl#define FSACTL_LNX_CLOSE_ADAPTER_CONFIG CTL_CODE(FILE_DEVICE_CONTROLLER, 2104, \ 8581188Sscottl METHOD_BUFFERED, FILE_ANY_ACCESS) 8681189Sscottl#define FSACTL_LNX_OPEN_ADAPTER_CONFIG CTL_CODE(FILE_DEVICE_CONTROLLER, 2105, \ 8781189Sscottl METHOD_BUFFERED, FILE_ANY_ACCESS) 8881189Sscottl#define FSACTL_LNX_MINIPORT_REV_CHECK CTL_CODE(FILE_DEVICE_CONTROLLER, 2107, \ 8981189Sscottl METHOD_BUFFERED, FILE_ANY_ACCESS) 9081189Sscottl#define FSACTL_LNX_QUERY_ADAPTER_CONFIG CTL_CODE(FILE_DEVICE_CONTROLLER, 2113, \ 9181189Sscottl METHOD_BUFFERED, FILE_ANY_ACCESS) 9281189Sscottl#define FSACTL_LNX_GET_PCI_INFO CTL_CODE(FILE_DEVICE_CONTROLLER, 2119, \ 9381189Sscottl METHOD_BUFFERED, FILE_ANY_ACCESS) 9481189Sscottl#define FSACTL_LNX_FORCE_DELETE_DISK CTL_CODE(FILE_DEVICE_CONTROLLER, 2120, \ 9581189Sscottl METHOD_NEITHER, FILE_ANY_ACCESS) 9681189Sscottl#define FSACTL_LNX_AIF_THREAD CTL_CODE(FILE_DEVICE_CONTROLLER, 2127, \ 9781189Sscottl METHOD_NEITHER, FILE_ANY_ACCESS) 98177462Semaste#define FSACTL_LNX_SEND_LARGE_FIB CTL_CODE(FILE_DEVICE_CONTROLLER, 2138, \ 99177462Semaste METHOD_BUFFERED, FILE_ANY_ACCESS) 100177695Semaste#define FSACTL_LNX_GET_FEATURES CTL_CODE(FILE_DEVICE_CONTROLLER, 2139, \ 101177695Semaste METHOD_BUFFERED, FILE_ANY_ACCESS) 10265793Smsmith 10381189Sscottl/* Why these don't follow the previous convention, I don't know */ 10481189Sscottl#define FSACTL_LNX_NULL_IO_TEST 0x43 10581189Sscottl#define FSACTL_LNX_SIM_IO_TEST 0x53 10681189Sscottl#define FSACTL_LNX_DOWNLOAD 0x83 10781189Sscottl#define FSACTL_LNX_GET_VAR 0x93 10881189Sscottl#define FSACTL_LNX_SET_VAR 0xa3 10981189Sscottl#define FSACTL_LNX_GET_FIBTIMES 0xb3 11081189Sscottl#define FSACTL_LNX_ZERO_FIBTIMES 0xc3 11181189Sscottl#define FSACTL_LNX_DELETE_DISK 0x163 11281189Sscottl#define FSACTL_LNX_QUERY_DISK 0x173 11381189Sscottl 11482527Sscottl/* Ok, here it gets really lame */ 11581189Sscottl#define FSACTL_LNX_PROBE_CONTAINERS 2131 /* Just guessing */ 11681189Sscottl 11781189Sscottl/* Do the native version of the ioctls. Since the BSD encoding scheme 11882527Sscottl * conflicts with the 'standard' AAC encoding scheme, the resulting numbers 11982527Sscottl * will be different. The '8' comes from the fact that the previous scheme 120218909Sbrucec * used 12 bits for the number, with the 12th bit being the only set 12181189Sscottl * bit above bit 8. Thus the value of 8, with the lower 8 bits holding the 12282527Sscottl * command number. 9 is used for the odd overflow case. 12381189Sscottl */ 12481189Sscottl#define FSACTL_SENDFIB _IO('8', 2) 125177462Semaste#define FSACTL_SEND_RAW_SRB _IO('8', 19) 12681189Sscottl#define FSACTL_GET_COMM_PERF_DATA _IO('8', 36) 12781189Sscottl#define FSACTL_OPENCLS_COMM_PERF_DATA _IO('8', 37) 12881189Sscottl#define FSACTL_OPEN_GET_ADAPTER_FIB _IO('8', 52) 12981189Sscottl#define FSACTL_GET_NEXT_ADAPTER_FIB _IO('8', 53) 13081189Sscottl#define FSACTL_CLOSE_GET_ADAPTER_FIB _IO('8', 54) 13181189Sscottl#define FSACTL_CLOSE_ADAPTER_CONFIG _IO('8', 56) 13281189Sscottl#define FSACTL_OPEN_ADAPTER_CONFIG _IO('8', 57) 13381189Sscottl#define FSACTL_MINIPORT_REV_CHECK _IO('8', 59) 13481189Sscottl#define FSACTL_QUERY_ADAPTER_CONFIG _IO('8', 65) 13581189Sscottl#define FSACTL_GET_PCI_INFO _IO('8', 71) 13681189Sscottl#define FSACTL_FORCE_DELETE_DISK _IO('8', 72) 13781189Sscottl#define FSACTL_AIF_THREAD _IO('8', 79) 138177462Semaste#define FSACTL_SEND_LARGE_FIB _IO('8', 90) 139177695Semaste#define FSACTL_GET_FEATURES _IO('8', 91) 14081189Sscottl 14181189Sscottl#define FSACTL_NULL_IO_TEST _IO('8', 67) 14281189Sscottl#define FSACTL_SIM_IO_TEST _IO('8', 83) 14381189Sscottl#define FSACTL_DOWNLOAD _IO('8', 131) 14481189Sscottl#define FSACTL_GET_VAR _IO('8', 147) 14581189Sscottl#define FSACTL_SET_VAR _IO('8', 163) 14681189Sscottl#define FSACTL_GET_FIBTIMES _IO('8', 179) 14781189Sscottl#define FSACTL_ZERO_FIBTIMES _IO('8', 195) 14881189Sscottl#define FSACTL_DELETE_DISK _IO('8', 99) 14981189Sscottl#define FSACTL_QUERY_DISK _IO('9', 115) 15081189Sscottl 15181189Sscottl#define FSACTL_PROBE_CONTAINERS _IO('9', 83) /* Just guessing */ 15281189Sscottl 153125541Sscottl#ifdef _KERNEL 15465793Smsmith/* 15565793Smsmith * Support for faking the "miniport" version. 15665793Smsmith */ 15765793Smsmithstruct aac_rev_check { 15883114Sscottl RevComponent callingComponent; 15983114Sscottl struct FsaRevision callingRevision; 16065793Smsmith}; 16165793Smsmith 16265793Smsmithstruct aac_rev_check_resp { 16383114Sscottl int possiblyCompatible; 16483114Sscottl struct FsaRevision adapterSWRevision; 16565793Smsmith}; 16665793Smsmith 16765793Smsmith/* 16865793Smsmith * Context passed in by a consumer looking to collect an AIF. 16965793Smsmith */ 17065793Smsmithstruct get_adapter_fib_ioctl { 17183114Sscottl u_int32_t AdapterFibContext; 17283114Sscottl int Wait; 17383114Sscottl caddr_t AifFib; 17465793Smsmith}; 17582527Sscottl 17682527Sscottlstruct aac_query_disk { 17783114Sscottl int32_t ContainerNumber; 17883114Sscottl int32_t Bus; 17983114Sscottl int32_t Target; 18083114Sscottl int32_t Lun; 18183114Sscottl u_int32_t Valid; 18283114Sscottl u_int32_t Locked; 18383114Sscottl u_int32_t Deleted; 18483114Sscottl int32_t Instance; 18583114Sscottl char diskDeviceName[10]; 18683114Sscottl u_int32_t UnMapped; 18782527Sscottl}; 188177695Semaste 189177695Semaste/* Features, asked from the tools to know if the driver 190177695Semaste * supports drives >2TB 191177695Semaste */ 192177695Semastetypedef union { 193177695Semaste struct { 194177695Semaste u_int32_t largeLBA : 1; /* disk support greater 2TB */ 195198619Semaste u_int32_t IoctlBuf : 1; /* ARCIOCTL call support */ 196198619Semaste u_int32_t AIFSupport: 1; /* AIF support */ 197198619Semaste u_int32_t JBODSupport:1; /* fw + driver support JBOD */ 198198619Semaste u_int32_t fReserved : 28; 199177695Semaste } fBits; 200177695Semaste u_int32_t fValue; 201177695Semaste} featuresState; 202177695Semaste 203177695Semastestruct aac_features { 204177695Semaste featuresState feat; 205177695Semaste u_int32_t data[31]; 206177695Semaste u_int32_t reserved[32]; 207177695Semaste} __packed; 208125541Sscottl#endif 209