167555Smsmith/*-
267555Smsmith * Copyright (c) 2000 Michael Smith
3123103Sps * Copyright (c) 2003 Paul Saab
4123103Sps * Copyright (c) 2003 Vinod Kashyap
567555Smsmith * Copyright (c) 2000 BSDi
667555Smsmith * All rights reserved.
767555Smsmith *
867555Smsmith * Redistribution and use in source and binary forms, with or without
967555Smsmith * modification, are permitted provided that the following conditions
1067555Smsmith * are met:
1167555Smsmith * 1. Redistributions of source code must retain the above copyright
1267555Smsmith *    notice, this list of conditions and the following disclaimer.
1367555Smsmith * 2. Redistributions in binary form must reproduce the above copyright
1467555Smsmith *    notice, this list of conditions and the following disclaimer in the
1567555Smsmith *    documentation and/or other materials provided with the distribution.
1667555Smsmith *
1767555Smsmith * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
1867555Smsmith * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1967555Smsmith * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
2067555Smsmith * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
2167555Smsmith * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2267555Smsmith * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2367555Smsmith * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2467555Smsmith * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2567555Smsmith * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2667555Smsmith * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2767555Smsmith * SUCH DAMAGE.
2867555Smsmith *
2967555Smsmith *	$FreeBSD$
3067555Smsmith */
3167555Smsmith
3267555Smsmith
3367555Smsmith/*
3467555Smsmith * User-space command
3567555Smsmith *
3667555Smsmith * Note that the command's scatter/gather list will be computed by the
3767555Smsmith * driver, and cannot be filled in by the consumer.
3867555Smsmith */
3967555Smsmithstruct twe_usercommand {
4067555Smsmith    TWE_Command	tu_command;	/* command ready for the controller */
4167555Smsmith    void	*tu_data;	/* pointer to data in userspace */
4267555Smsmith    size_t	tu_size;	/* userspace data length */
4367555Smsmith};
4467555Smsmith
4567555Smsmith#define TWEIO_COMMAND		_IOWR('T', 100, struct twe_usercommand)
4667555Smsmith
4767555Smsmith/*
4867555Smsmith * Command queue statistics
4967555Smsmith */
5067555Smsmith#define TWEQ_FREE	0
5167555Smsmith#define TWEQ_BIO	1
5267555Smsmith#define TWEQ_READY	2
5367555Smsmith#define TWEQ_BUSY	3
5467555Smsmith#define TWEQ_COMPLETE	4
5567555Smsmith#define TWEQ_COUNT	5	/* total number of queues */
5667555Smsmith
5767555Smsmithstruct twe_qstat {
5867555Smsmith    u_int32_t	q_length;
5967555Smsmith    u_int32_t	q_max;
60123103Sps    u_int32_t	q_min;
6167555Smsmith};
6267555Smsmith
6367555Smsmith/*
6467555Smsmith * Statistics request
6567555Smsmith */
6667555Smsmithunion twe_statrequest {
6767555Smsmith    u_int32_t		ts_item;
6867555Smsmith    struct twe_qstat	ts_qstat;
6967555Smsmith};
7067555Smsmith
7167555Smsmith#define TWEIO_STATS		_IOWR('T', 101, union twe_statrequest)
7267555Smsmith
7367555Smsmith/*
7467555Smsmith * AEN listen
7567555Smsmith */
76123103Sps#define TWEIO_AEN_POLL		_IOR('T', 102, u_int16_t)
77123103Sps#define TWEIO_AEN_WAIT		_IOR('T', 103, u_int16_t)
7867555Smsmith
7967555Smsmith/*
8067555Smsmith * Controller parameter access
8167555Smsmith */
8267555Smsmithstruct twe_paramcommand {
8367555Smsmith    u_int16_t	tp_table_id;
8467555Smsmith    u_int8_t	tp_param_id;
8567555Smsmith    void	*tp_data;
8667555Smsmith    u_int8_t	tp_size;
8767555Smsmith};
8867555Smsmith
8967555Smsmith#define TWEIO_SET_PARAM		_IOW ('T', 104, struct twe_paramcommand)
9067555Smsmith#define TWEIO_GET_PARAM		_IOW ('T', 105, struct twe_paramcommand)
9167555Smsmith
9267555Smsmith/*
9367555Smsmith * Request a controller soft-reset
9467555Smsmith */
9567555Smsmith#define TWEIO_RESET		_IO  ('T', 106)
96118508Sps
97118508Sps/*
98118508Sps * Request a drive addition or deletion
99118508Sps */
100118508Spsstruct twe_drivecommand {
101118508Sps    int		td_unit;
102118508Sps};
103118508Sps
104118508Sps#define TWEIO_ADD_UNIT		_IOW ('U', 107, int)
105118508Sps#define TWEIO_DEL_UNIT		_IOW ('U', 108, int)
106