summaryrefslogtreecommitdiffstats
path: root/sys/dev/twe/tweio.h
diff options
context:
space:
mode:
authormsmith <msmith@FreeBSD.org>2000-10-25 06:59:06 +0000
committermsmith <msmith@FreeBSD.org>2000-10-25 06:59:06 +0000
commita020bb21aa31f25d8afabdd26ae39c3be4e2f3e8 (patch)
tree1a80409022fabbd27d947d98872637c45883493a /sys/dev/twe/tweio.h
parentff18363a3e5e60f38c8f7a52c7e7f4ea1c8b797f (diff)
downloadFreeBSD-src-a020bb21aa31f25d8afabdd26ae39c3be4e2f3e8.zip
FreeBSD-src-a020bb21aa31f25d8afabdd26ae39c3be4e2f3e8.tar.gz
Major update to the 'twe' driver.
- Layout reorganisation to enhance portability. The driver now has a relatively MI 'core' and a FreeBSD-specific layer over the top. Since the NetBSD people have already done their own port, this is largely just to help me with the BSD/OS port. - Request ID allocation changed to improve performance (I'd been considering switching to this approach after having failed to come up with a better way to dynamically allocate request IDs, and seeing Andy Doran use it in the NetBSD port of the driver convinced me that I was wasting my time doing it any other way). Now we just allocate all the requests up front. - Maximum request count bumped back to 255 after characterisation of a firmware issue (off-by-one causing it to crash with 256 outstanding commands). - Control interface implemented. This allows 3ware's '3dm' utility to talk to the controller. 3dm will be available from 3ware shortly. - Controller soft-reset feature added; if the controller signals a firmware or protocol error, the controller will be reset and all outstanding commands will be retried.
Diffstat (limited to 'sys/dev/twe/tweio.h')
-rw-r--r--sys/dev/twe/tweio.h92
1 files changed, 92 insertions, 0 deletions
diff --git a/sys/dev/twe/tweio.h b/sys/dev/twe/tweio.h
new file mode 100644
index 0000000..eaf0d7b
--- /dev/null
+++ b/sys/dev/twe/tweio.h
@@ -0,0 +1,92 @@
+/*-
+ * Copyright (c) 2000 Michael Smith
+ * Copyright (c) 2000 BSDi
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $FreeBSD$
+ */
+
+
+/*
+ * User-space command
+ *
+ * Note that the command's scatter/gather list will be computed by the
+ * driver, and cannot be filled in by the consumer.
+ */
+struct twe_usercommand {
+ TWE_Command tu_command; /* command ready for the controller */
+ void *tu_data; /* pointer to data in userspace */
+ size_t tu_size; /* userspace data length */
+};
+
+#define TWEIO_COMMAND _IOWR('T', 100, struct twe_usercommand)
+
+/*
+ * Command queue statistics
+ */
+#define TWEQ_FREE 0
+#define TWEQ_BIO 1
+#define TWEQ_READY 2
+#define TWEQ_BUSY 3
+#define TWEQ_COMPLETE 4
+#define TWEQ_COUNT 5 /* total number of queues */
+
+struct twe_qstat {
+ u_int32_t q_length;
+ u_int32_t q_max;
+};
+
+/*
+ * Statistics request
+ */
+union twe_statrequest {
+ u_int32_t ts_item;
+ struct twe_qstat ts_qstat;
+};
+
+#define TWEIO_STATS _IOWR('T', 101, union twe_statrequest)
+
+/*
+ * AEN listen
+ */
+#define TWEIO_AEN_POLL _IOR('T', 102, int)
+#define TWEIO_AEN_WAIT _IOR('T', 103, int)
+
+/*
+ * Controller parameter access
+ */
+struct twe_paramcommand {
+ u_int16_t tp_table_id;
+ u_int8_t tp_param_id;
+ void *tp_data;
+ u_int8_t tp_size;
+};
+
+#define TWEIO_SET_PARAM _IOW ('T', 104, struct twe_paramcommand)
+#define TWEIO_GET_PARAM _IOW ('T', 105, struct twe_paramcommand)
+
+/*
+ * Request a controller soft-reset
+ */
+#define TWEIO_RESET _IO ('T', 106)
OpenPOWER on IntegriCloud