tweio.h revision 123103
1284990Scy/*-
2284990Scy * Copyright (c) 2000 Michael Smith
3289999Sglebius * Copyright (c) 2003 Paul Saab
4289999Sglebius * Copyright (c) 2003 Vinod Kashyap
5284990Scy * Copyright (c) 2000 BSDi
6284990Scy * All rights reserved.
7293893Sglebius *
8289999Sglebius * Redistribution and use in source and binary forms, with or without
9289999Sglebius * modification, are permitted provided that the following conditions
10289999Sglebius * are met:
11289999Sglebius * 1. Redistributions of source code must retain the above copyright
12289999Sglebius *    notice, this list of conditions and the following disclaimer.
13289999Sglebius * 2. Redistributions in binary form must reproduce the above copyright
14284990Scy *    notice, this list of conditions and the following disclaimer in the
15294904Sdelphij *    documentation and/or other materials provided with the distribution.
16294904Sdelphij *
17294904Sdelphij * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
18294904Sdelphij * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19294904Sdelphij * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20294904Sdelphij * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
21294904Sdelphij * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22294904Sdelphij * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23294904Sdelphij * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24289999Sglebius * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25293893Sglebius * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26293893Sglebius * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27293893Sglebius * SUCH DAMAGE.
28293893Sglebius *
29293893Sglebius *	$FreeBSD: head/sys/dev/twe/tweio.h 123103 2003-12-02 07:57:20Z ps $
30293893Sglebius */
31293893Sglebius
32294904Sdelphij
33294904Sdelphij/*
34284990Scy * User-space command
35284990Scy *
36284990Scy * Note that the command's scatter/gather list will be computed by the
37284990Scy * driver, and cannot be filled in by the consumer.
38284990Scy */
39284990Scystruct twe_usercommand {
40284990Scy    TWE_Command	tu_command;	/* command ready for the controller */
41284990Scy    void	*tu_data;	/* pointer to data in userspace */
42284990Scy    size_t	tu_size;	/* userspace data length */
43284990Scy};
44284990Scy
45284990Scy#define TWEIO_COMMAND		_IOWR('T', 100, struct twe_usercommand)
46289999Sglebius
47294904Sdelphij/*
48294904Sdelphij * Command queue statistics
49284990Scy */
50284990Scy#define TWEQ_FREE	0
51284990Scy#define TWEQ_BIO	1
52284990Scy#define TWEQ_READY	2
53284990Scy#define TWEQ_BUSY	3
54284990Scy#define TWEQ_COMPLETE	4
55284990Scy#define TWEQ_COUNT	5	/* total number of queues */
56284990Scy
57284990Scystruct twe_qstat {
58284990Scy    u_int32_t	q_length;
59284990Scy    u_int32_t	q_max;
60284990Scy    u_int32_t	q_min;
61289999Sglebius};
62289999Sglebius
63294904Sdelphij/*
64294904Sdelphij * Statistics request
65294904Sdelphij */
66289999Sglebiusunion twe_statrequest {
67284990Scy    u_int32_t		ts_item;
68284990Scy    struct twe_qstat	ts_qstat;
69294904Sdelphij};
70294904Sdelphij
71294904Sdelphij#define TWEIO_STATS		_IOWR('T', 101, union twe_statrequest)
72284990Scy
73284990Scy/*
74284990Scy * AEN listen
75284990Scy */
76284990Scy#define TWEIO_AEN_POLL		_IOR('T', 102, u_int16_t)
77284990Scy#define TWEIO_AEN_WAIT		_IOR('T', 103, u_int16_t)
78284990Scy
79284990Scy/*
80284990Scy * Controller parameter access
81284990Scy */
82284990Scystruct twe_paramcommand {
83284990Scy    u_int16_t	tp_table_id;
84289999Sglebius    u_int8_t	tp_param_id;
85289999Sglebius    void	*tp_data;
86294904Sdelphij    u_int8_t	tp_size;
87289999Sglebius};
88294904Sdelphij
89289999Sglebius#define TWEIO_SET_PARAM		_IOW ('T', 104, struct twe_paramcommand)
90284990Scy#define TWEIO_GET_PARAM		_IOW ('T', 105, struct twe_paramcommand)
91284990Scy
92289999Sglebius/*
93289999Sglebius * Request a controller soft-reset
94294904Sdelphij */
95294904Sdelphij#define TWEIO_RESET		_IO  ('T', 106)
96289999Sglebius
97289999Sglebius/*
98284990Scy * Request a drive addition or deletion
99284990Scy */
100294904Sdelphijstruct twe_drivecommand {
101294904Sdelphij    int		td_unit;
102294904Sdelphij};
103284990Scy
104284990Scy#define TWEIO_ADD_UNIT		_IOW ('U', 107, int)
105284990Scy#define TWEIO_DEL_UNIT		_IOW ('U', 108, int)
106284990Scy