aac_ioctl.h revision 125574
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: head/sys/sys/aac_ioctl.h 125574 2004-02-07 17:40:38Z scottl $
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)
7281189Sscottl#define FSACTL_LNX_GET_COMM_PERF_DATA	CTL_CODE(FILE_DEVICE_CONTROLLER, 2084, \
7381188Sscottl					METHOD_BUFFERED, FILE_ANY_ACCESS)
7481189Sscottl#define FSACTL_LNX_OPENCLS_COMM_PERF_DATA CTL_CODE(FILE_DEVICE_CONTROLLER, \
7581189Sscottl					2085, METHOD_BUFFERED, FILE_ANY_ACCESS)
7681189Sscottl#define FSACTL_LNX_OPEN_GET_ADAPTER_FIB	CTL_CODE(FILE_DEVICE_CONTROLLER, 2100, \
7781188Sscottl					METHOD_BUFFERED, FILE_ANY_ACCESS)
7881189Sscottl#define FSACTL_LNX_GET_NEXT_ADAPTER_FIB	CTL_CODE(FILE_DEVICE_CONTROLLER, 2101, \
7981188Sscottl					METHOD_BUFFERED, FILE_ANY_ACCESS)
8081189Sscottl#define FSACTL_LNX_CLOSE_GET_ADAPTER_FIB CTL_CODE(FILE_DEVICE_CONTROLLER, \
8181189Sscottl					2102, METHOD_BUFFERED, FILE_ANY_ACCESS)
8281189Sscottl#define FSACTL_LNX_CLOSE_ADAPTER_CONFIG	CTL_CODE(FILE_DEVICE_CONTROLLER, 2104, \
8381188Sscottl					METHOD_BUFFERED, FILE_ANY_ACCESS)
8481189Sscottl#define FSACTL_LNX_OPEN_ADAPTER_CONFIG	CTL_CODE(FILE_DEVICE_CONTROLLER, 2105, \
8581189Sscottl					METHOD_BUFFERED, FILE_ANY_ACCESS)
8681189Sscottl#define FSACTL_LNX_MINIPORT_REV_CHECK	CTL_CODE(FILE_DEVICE_CONTROLLER, 2107, \
8781189Sscottl					METHOD_BUFFERED, FILE_ANY_ACCESS)
8881189Sscottl#define FSACTL_LNX_QUERY_ADAPTER_CONFIG	CTL_CODE(FILE_DEVICE_CONTROLLER, 2113, \
8981189Sscottl					METHOD_BUFFERED, FILE_ANY_ACCESS)
9081189Sscottl#define FSACTL_LNX_GET_PCI_INFO		CTL_CODE(FILE_DEVICE_CONTROLLER, 2119, \
9181189Sscottl					METHOD_BUFFERED, FILE_ANY_ACCESS)
9281189Sscottl#define FSACTL_LNX_FORCE_DELETE_DISK	CTL_CODE(FILE_DEVICE_CONTROLLER, 2120, \
9381189Sscottl					METHOD_NEITHER, FILE_ANY_ACCESS)
9481189Sscottl#define FSACTL_LNX_AIF_THREAD		CTL_CODE(FILE_DEVICE_CONTROLLER, 2127, \
9581189Sscottl					METHOD_NEITHER, FILE_ANY_ACCESS)
9665793Smsmith
9781189Sscottl/* Why these don't follow the previous convention, I don't know */
9881189Sscottl#define FSACTL_LNX_NULL_IO_TEST		0x43
9981189Sscottl#define FSACTL_LNX_SIM_IO_TEST		0x53
10081189Sscottl#define FSACTL_LNX_DOWNLOAD		0x83
10181189Sscottl#define FSACTL_LNX_GET_VAR		0x93
10281189Sscottl#define FSACTL_LNX_SET_VAR		0xa3
10381189Sscottl#define FSACTL_LNX_GET_FIBTIMES		0xb3
10481189Sscottl#define FSACTL_LNX_ZERO_FIBTIMES	0xc3
10581189Sscottl#define FSACTL_LNX_DELETE_DISK		0x163
10681189Sscottl#define FSACTL_LNX_QUERY_DISK		0x173
10781189Sscottl
10882527Sscottl/* Ok, here it gets really lame */
10981189Sscottl#define FSACTL_LNX_PROBE_CONTAINERS	2131	/* Just guessing */
11081189Sscottl
11181189Sscottl/* Do the native version of the ioctls.  Since the BSD encoding scheme
11282527Sscottl * conflicts with the 'standard' AAC encoding scheme, the resulting numbers
11382527Sscottl * will be different.  The '8' comes from the fact that the previous scheme
11481189Sscottl * used 12 bits for the number, with the the 12th bit being the only set
11581189Sscottl * bit above bit 8.  Thus the value of 8, with the lower 8 bits holding the
11682527Sscottl * command number.  9 is used for the odd overflow case.
11781189Sscottl */
11881189Sscottl#define FSACTL_SENDFIB			_IO('8', 2)
11981189Sscottl#define FSACTL_GET_COMM_PERF_DATA	_IO('8', 36)
12081189Sscottl#define FSACTL_OPENCLS_COMM_PERF_DATA	_IO('8', 37)
12181189Sscottl#define FSACTL_OPEN_GET_ADAPTER_FIB	_IO('8', 52)
12281189Sscottl#define FSACTL_GET_NEXT_ADAPTER_FIB	_IO('8', 53)
12381189Sscottl#define FSACTL_CLOSE_GET_ADAPTER_FIB	_IO('8', 54)
12481189Sscottl#define FSACTL_CLOSE_ADAPTER_CONFIG	_IO('8', 56)
12581189Sscottl#define FSACTL_OPEN_ADAPTER_CONFIG	_IO('8', 57)
12681189Sscottl#define FSACTL_MINIPORT_REV_CHECK	_IO('8', 59)
12781189Sscottl#define FSACTL_QUERY_ADAPTER_CONFIG	_IO('8', 65)
12881189Sscottl#define FSACTL_GET_PCI_INFO		_IO('8', 71)
12981189Sscottl#define FSACTL_FORCE_DELETE_DISK	_IO('8', 72)
13081189Sscottl#define FSACTL_AIF_THREAD		_IO('8', 79)
13181189Sscottl
13281189Sscottl#define FSACTL_NULL_IO_TEST		_IO('8', 67)
13381189Sscottl#define FSACTL_SIM_IO_TEST		_IO('8', 83)
13481189Sscottl#define FSACTL_DOWNLOAD			_IO('8', 131)
13581189Sscottl#define FSACTL_GET_VAR			_IO('8', 147)
13681189Sscottl#define FSACTL_SET_VAR			_IO('8', 163)
13781189Sscottl#define FSACTL_GET_FIBTIMES		_IO('8', 179)
13881189Sscottl#define FSACTL_ZERO_FIBTIMES		_IO('8', 195)
13981189Sscottl#define FSACTL_DELETE_DISK		_IO('8', 99)
14081189Sscottl#define FSACTL_QUERY_DISK		_IO('9', 115)
14181189Sscottl
14281189Sscottl#define FSACTL_PROBE_CONTAINERS		_IO('9', 83)	/* Just guessing */
14381189Sscottl
144125541Sscottl#ifdef _KERNEL
14565793Smsmith/*
14665793Smsmith * Support for faking the "miniport" version.
14765793Smsmith */
14865793Smsmithstruct aac_rev_check {
14983114Sscottl	RevComponent		callingComponent;
15083114Sscottl	struct FsaRevision	callingRevision;
15165793Smsmith};
15265793Smsmith
15365793Smsmithstruct aac_rev_check_resp {
15483114Sscottl	int			possiblyCompatible;
15583114Sscottl	struct FsaRevision	adapterSWRevision;
15665793Smsmith};
15765793Smsmith
15865793Smsmith/*
15965793Smsmith * Context passed in by a consumer looking to collect an AIF.
16065793Smsmith */
16165793Smsmithstruct get_adapter_fib_ioctl {
16283114Sscottl	u_int32_t	AdapterFibContext;
16383114Sscottl	int	  	Wait;
16483114Sscottl	caddr_t		AifFib;
16565793Smsmith};
16682527Sscottl
16782527Sscottlstruct aac_query_disk {
16883114Sscottl	int32_t		ContainerNumber;
16983114Sscottl	int32_t		Bus;
17083114Sscottl	int32_t		Target;
17183114Sscottl	int32_t		Lun;
17283114Sscottl	u_int32_t	Valid;
17383114Sscottl	u_int32_t	Locked;
17483114Sscottl	u_int32_t	Deleted;
17583114Sscottl	int32_t		Instance;
17683114Sscottl	char		diskDeviceName[10];
17783114Sscottl	u_int32_t	UnMapped;
17882527Sscottl};
179125541Sscottl#endif
180