tweio.h revision 118508
1258945Sroberto/*-
2258945Sroberto * Copyright (c) 2000 Michael Smith
3258945Sroberto * Copyright (c) 2000 BSDi
4258945Sroberto * All rights reserved.
5258945Sroberto *
6258945Sroberto * Redistribution and use in source and binary forms, with or without
7258945Sroberto * modification, are permitted provided that the following conditions
8258945Sroberto * are met:
9258945Sroberto * 1. Redistributions of source code must retain the above copyright
10280849Scy *    notice, this list of conditions and the following disclaimer.
11280849Scy * 2. Redistributions in binary form must reproduce the above copyright
12258945Sroberto *    notice, this list of conditions and the following disclaimer in the
13258945Sroberto *    documentation and/or other materials provided with the distribution.
14258945Sroberto *
15258945Sroberto * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
16258945Sroberto * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17258945Sroberto * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18258945Sroberto * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
19258945Sroberto * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20258945Sroberto * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21258945Sroberto * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22280849Scy * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23280849Scy * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24280849Scy * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25280849Scy * SUCH DAMAGE.
26258945Sroberto *
27258945Sroberto *	$FreeBSD: head/sys/dev/twe/tweio.h 118508 2003-08-05 19:55:21Z ps $
28258945Sroberto */
29258945Sroberto
30258945Sroberto
31258945Sroberto/*
32258945Sroberto * User-space command
33258945Sroberto *
34258945Sroberto * Note that the command's scatter/gather list will be computed by the
35258945Sroberto * driver, and cannot be filled in by the consumer.
36258945Sroberto */
37258945Srobertostruct twe_usercommand {
38258945Sroberto    TWE_Command	tu_command;	/* command ready for the controller */
39258945Sroberto    void	*tu_data;	/* pointer to data in userspace */
40258945Sroberto    size_t	tu_size;	/* userspace data length */
41258945Sroberto};
42258945Sroberto
43258945Sroberto#define TWEIO_COMMAND		_IOWR('T', 100, struct twe_usercommand)
44258945Sroberto
45258945Sroberto/*
46258945Sroberto * Command queue statistics
47258945Sroberto */
48258945Sroberto#define TWEQ_FREE	0
49258945Sroberto#define TWEQ_BIO	1
50258945Sroberto#define TWEQ_READY	2
51258945Sroberto#define TWEQ_BUSY	3
52258945Sroberto#define TWEQ_COMPLETE	4
53280849Scy#define TWEQ_COUNT	5	/* total number of queues */
54280849Scy
55258945Srobertostruct twe_qstat {
56258945Sroberto    u_int32_t	q_length;
57258945Sroberto    u_int32_t	q_max;
58258945Sroberto};
59258945Sroberto
60280849Scy/*
61258945Sroberto * Statistics request
62258945Sroberto */
63258945Srobertounion twe_statrequest {
64280849Scy    u_int32_t		ts_item;
65258945Sroberto    struct twe_qstat	ts_qstat;
66258945Sroberto};
67258945Sroberto
68258945Sroberto#define TWEIO_STATS		_IOWR('T', 101, union twe_statrequest)
69258945Sroberto
70258945Sroberto/*
71258945Sroberto * AEN listen
72258945Sroberto */
73258945Sroberto#define TWEIO_AEN_POLL		_IOR('T', 102, int)
74258945Sroberto#define TWEIO_AEN_WAIT		_IOR('T', 103, int)
75258945Sroberto
76258945Sroberto/*
77258945Sroberto * Controller parameter access
78258945Sroberto */
79258945Srobertostruct twe_paramcommand {
80258945Sroberto    u_int16_t	tp_table_id;
81258945Sroberto    u_int8_t	tp_param_id;
82258945Sroberto    void	*tp_data;
83258945Sroberto    u_int8_t	tp_size;
84258945Sroberto};
85258945Sroberto
86258945Sroberto#define TWEIO_SET_PARAM		_IOW ('T', 104, struct twe_paramcommand)
87258945Sroberto#define TWEIO_GET_PARAM		_IOW ('T', 105, struct twe_paramcommand)
88258945Sroberto
89258945Sroberto/*
90258945Sroberto * Request a controller soft-reset
91280849Scy */
92280849Scy#define TWEIO_RESET		_IO  ('T', 106)
93258945Sroberto
94258945Sroberto/*
95280849Scy * Request a drive addition or deletion
96258945Sroberto */
97258945Srobertostruct twe_drivecommand {
98258945Sroberto    int		td_unit;
99258945Sroberto};
100258945Sroberto
101258945Sroberto#define TWEIO_ADD_UNIT		_IOW ('U', 107, int)
102258945Sroberto#define TWEIO_DEL_UNIT		_IOW ('U', 108, int)
103258945Sroberto