1193323Sed/*
2193323Sed * Copyright (c) 2004-07 Applied Micro Circuits Corporation.
3193323Sed * Copyright (c) 2004-05 Vinod Kashyap
4193323Sed * All rights reserved.
5193323Sed *
6193323Sed * Redistribution and use in source and binary forms, with or without
7193323Sed * modification, are permitted provided that the following conditions
8193323Sed * are met:
9193323Sed * 1. Redistributions of source code must retain the above copyright
10193323Sed *    notice, this list of conditions and the following disclaimer.
11193323Sed * 2. Redistributions in binary form must reproduce the above copyright
12193323Sed *    notice, this list of conditions and the following disclaimer in the
13193323Sed *    documentation and/or other materials provided with the distribution.
14193323Sed *
15193323Sed * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
16193323Sed * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17193323Sed * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18193323Sed * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
19193323Sed * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20193323Sed * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21193323Sed * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22193323Sed * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23193323Sed * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24193323Sed * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25193323Sed * SUCH DAMAGE.
26193323Sed *
27193323Sed *	$FreeBSD: releng/11.0/sys/dev/twa/tw_cl_ioctl.h 169400 2007-05-09 04:16:32Z scottl $
28193323Sed */
29193323Sed
30193323Sed/*
31193323Sed * AMCC'S 3ware driver for 9000 series storage controllers.
32193323Sed *
33193323Sed * Author: Vinod Kashyap
34193323Sed * Modifications by: Adam Radford
35193323Sed */
36193323Sed
37193323Sed
38193323Sed
39193323Sed#ifndef TW_CL_IOCTL_H
40193323Sed
41193323Sed#define TW_CL_IOCTL_H
42193323Sed
43198090Srdivacky
44193323Sed/*
45193323Sed * Macros and structures for Common Layer handled ioctls.
46193323Sed */
47193323Sed
48210299Sed
49193323Sed#define TW_CL_AEN_NOT_RETRIEVED	0x1
50193323Sed#define TW_CL_AEN_RETRIEVED	0x2
51193323Sed
52193323Sed#define TW_CL_ERROR_AEN_NO_EVENTS	0x1003	/* No more events */
53193323Sed#define TW_CL_ERROR_AEN_OVERFLOW	0x1004	/* AEN overflow occurred */
54193323Sed
55193323Sed#define TW_CL_ERROR_IOCTL_LOCK_NOT_HELD		0x1001   /* Not locked */
56193323Sed#define TW_CL_ERROR_IOCTL_LOCK_ALREADY_HELD	0x1002   /* Already locked */
57193323Sed
58193323Sed
59193323Sed#pragma pack(1)
60193323Sed
61193323Sed/* Structure used to handle GET/RELEASE LOCK ioctls. */
62193323Sedstruct tw_cl_lock_packet {
63193323Sed	TW_UINT32	timeout_msec;
64198892Srdivacky	TW_UINT32	time_remaining_msec;
65193323Sed	TW_UINT32	force_flag;
66193323Sed};
67193323Sed
68193323Sed
69193323Sed/* Structure used to handle GET COMPATIBILITY INFO ioctl. */
70193323Sedstruct tw_cl_compatibility_packet {
71207618Srdivacky	TW_UINT8	driver_version[32];/* driver version */
72207618Srdivacky	TW_UINT16	working_srl;	/* driver & firmware negotiated srl */
73193323Sed	TW_UINT16	working_branch;	/* branch # of the firmware that the
74193323Sed					driver is compatible with */
75193323Sed	TW_UINT16	working_build;	/* build # of the firmware that the
76193323Sed					driver is compatible with */
77193323Sed	TW_UINT16	driver_srl_high;/* highest driver supported srl */
78193323Sed	TW_UINT16	driver_branch_high;/* highest driver supported branch */
79207618Srdivacky	TW_UINT16	driver_build_high;/* highest driver supported build */
80207618Srdivacky	TW_UINT16	driver_srl_low;/* lowest driver supported srl */
81207618Srdivacky	TW_UINT16	driver_branch_low;/* lowest driver supported branch */
82207618Srdivacky	TW_UINT16	driver_build_low;/* lowest driver supported build */
83193323Sed	TW_UINT16	fw_on_ctlr_srl;	/* srl of running firmware */
84193323Sed	TW_UINT16	fw_on_ctlr_branch;/* branch # of running firmware */
85193323Sed	TW_UINT16	fw_on_ctlr_build;/* build # of running firmware */
86193323Sed};
87193323Sed
88193323Sed
89193323Sed/* Driver understandable part of the ioctl packet built by the API. */
90193323Sedstruct tw_cl_driver_packet {
91193323Sed	TW_UINT32	control_code;
92193323Sed	TW_UINT32	status;
93193323Sed	TW_UINT32	unique_id;
94210299Sed	TW_UINT32	sequence_id;
95193323Sed	TW_UINT32	os_status;
96207618Srdivacky	TW_UINT32	buffer_length;
97207618Srdivacky};
98193323Sed
99193323Sed
100193323Sed/* ioctl packet built by the API. */
101193323Sedstruct tw_cl_ioctl_packet {
102193323Sed	struct tw_cl_driver_packet	driver_pkt;
103193323Sed	TW_INT8				padding[488];
104193323Sed	struct tw_cl_command_packet	cmd_pkt;
105193323Sed	TW_INT8				data_buf[1];
106193323Sed};
107193323Sed
108193323Sed#pragma pack()
109193323Sed
110207618Srdivacky
111193323Sed
112207618Srdivacky#endif /* TW_CL_IOCTL_H */
113207618Srdivacky