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