summaryrefslogtreecommitdiffstats
path: root/sys/dev/twe/twevar.h
diff options
context:
space:
mode:
authorps <ps@FreeBSD.org>2003-12-02 07:57:20 +0000
committerps <ps@FreeBSD.org>2003-12-02 07:57:20 +0000
commit3a0af1aae72ca3322637a9d2f7f8b765835748c7 (patch)
treeba946a6caff762ad522eba49b289c9bb061bd1d4 /sys/dev/twe/twevar.h
parent61573506be17296e8a4f3b70686c75fb30900e65 (diff)
downloadFreeBSD-src-3a0af1aae72ca3322637a9d2f7f8b765835748c7.zip
FreeBSD-src-3a0af1aae72ca3322637a9d2f7f8b765835748c7.tar.gz
After extensive QA cycles at 3ware, bring the driver in-line with all the
issues which they found and asked to be changed so 3ware can offcially support the driver. Summary of the most significant changes: - TWE_OVERRIDE is no longer supported - If twe_getparam failed, bogus data would be returned to the caller - Cache the device unit in the twe_drive structure to aid debugging - Add the 3ware driver version. - Proper return error codes for many functions. - Track the minimum queue length statistics - 4.x compat: use the cached unit number from the twe_drive structure instead of the the cached si_drv2. 3ware found that after many loads and unloads that si_drv2 became corrupted. This did not happen in -current. Submitted by: Vinod Kashyap (with modifications by me) Approved by: re (rwatson)
Diffstat (limited to 'sys/dev/twe/twevar.h')
-rw-r--r--sys/dev/twe/twevar.h34
1 files changed, 26 insertions, 8 deletions
diff --git a/sys/dev/twe/twevar.h b/sys/dev/twe/twevar.h
index 22fb966..63700da 100644
--- a/sys/dev/twe/twevar.h
+++ b/sys/dev/twe/twevar.h
@@ -27,6 +27,14 @@
* $FreeBSD$
*/
+/*
+ * The scheme for the driver version is:
+ * <major change>.<external release>.<3ware internal release>.<development release>
+ */
+#define TWE_DRIVER_VERSION_STRING "1.50.00.000"
+#define TWE_CDEV_MAJOR 146
+#define TWED_CDEV_MAJOR 147
+
#ifdef TWE_DEBUG
#define debug(level, fmt, args...) \
do { \
@@ -51,7 +59,8 @@ struct twe_drive
int td_cylinders;
int td_heads;
int td_sectors;
- int td_unit;
+ int td_sys_unit; /* device unit number */
+ int td_twe_unit; /* index into sc->twe_drive[] */
/* unit state and type */
u_int8_t td_state;
@@ -151,9 +160,9 @@ extern void twe_print_controller(struct twe_softc *sc);
extern void twe_enable_interrupts(struct twe_softc *sc); /* enable controller interrupts */
extern void twe_disable_interrupts(struct twe_softc *sc); /* disable controller interrupts */
-extern void twe_attach_drive(struct twe_softc *sc,
+extern int twe_attach_drive(struct twe_softc *sc,
struct twe_drive *dr); /* attach drive when found in twe_init */
-extern void twe_detach_drive(struct twe_softc *sc,
+extern int twe_detach_drive(struct twe_softc *sc,
int unit); /* detach drive */
extern void twe_clear_pci_parity_error(struct twe_softc *sc);
extern void twe_clear_pci_abort(struct twe_softc *sc);
@@ -175,11 +184,20 @@ extern void twe_unmap_request(struct twe_request *tr); /* cleanup after transfer
qs->q_max = qs->q_length; \
} while(0)
-#define TWEQ_REMOVE(sc, qname) (sc)->twe_qstat[qname].q_length--
-#define TWEQ_INIT(sc, qname) \
- do { \
- sc->twe_qstat[qname].q_length = 0; \
- sc->twe_qstat[qname].q_max = 0; \
+#define TWEQ_REMOVE(sc, qname) \
+ do { \
+ struct twe_qstat *qs = &(sc)->twe_qstat[qname]; \
+ \
+ qs->q_length--; \
+ if (qs->q_length < qs->q_min) \
+ qs->q_min = qs->q_length; \
+ } while(0);
+
+#define TWEQ_INIT(sc, qname) \
+ do { \
+ sc->twe_qstat[qname].q_length = 0; \
+ sc->twe_qstat[qname].q_max = 0; \
+ sc->twe_qstat[qname].q_min = 0xFFFFFFFF; \
} while(0)
OpenPOWER on IntegriCloud