aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/twe
diff options
context:
space:
mode:
authorMike Smith <msmith@FreeBSD.org>2001-05-07 21:46:44 +0000
committerMike Smith <msmith@FreeBSD.org>2001-05-07 21:46:44 +0000
commit282070b3e8b397cde8f7f6f83dc1647e60e223bb (patch)
tree731c17473db365864ba5d7796087f3fdd41bb476 /sys/dev/twe
parent053c5b3a9e8240103729451ac41eaaa416779468 (diff)
downloadsrc-282070b3e8b397cde8f7f6f83dc1647e60e223bb.tar.gz
src-282070b3e8b397cde8f7f6f83dc1647e60e223bb.zip
Minor updates:
- Rework of twe_report_request to use the command status value rather than the flags register. (Joel Jacobson @ 3ware) - Update to match some changes in -current vs. stable. MFC in: 1 week
Notes
Notes: svn path=/head/; revision=76340
Diffstat (limited to 'sys/dev/twe')
-rw-r--r--sys/dev/twe/twe.c52
-rw-r--r--sys/dev/twe/twe_compat.h7
-rw-r--r--sys/dev/twe/twe_freebsd.c6
-rw-r--r--sys/dev/twe/twereg.h6
-rw-r--r--sys/dev/twe/twevar.h6
5 files changed, 47 insertions, 30 deletions
diff --git a/sys/dev/twe/twe.c b/sys/dev/twe/twe.c
index fadf767fb5aa..73717bfc4afd 100644
--- a/sys/dev/twe/twe.c
+++ b/sys/dev/twe/twe.c
@@ -1637,32 +1637,42 @@ twe_report_request(struct twe_request *tr)
{
struct twe_softc *sc = tr->tr_sc;
TWE_Command *cmd = &tr->tr_command;
- int result;
+ int result = 0;
- switch (cmd->generic.flags) {
- case TWE_FLAGS_SUCCESS:
- result = 0;
- break;
- case TWE_FLAGS_INFORMATIONAL:
- case TWE_FLAGS_WARNING:
- twe_printf(sc, "command completed - %s\n",
- twe_describe_code(twe_table_status, cmd->generic.status));
- result = 0;
- break;
-
- case TWE_FLAGS_FATAL:
- default:
- twe_printf(sc, "command failed - %s\n",
- twe_describe_code(twe_table_status, cmd->generic.status));
+ /*
+ * Check the command status value and handle accordingly.
+ */
+ if (cmd->generic.status == TWE_STATUS_RESET) {
+ /*
+ * The status code 0xff requests a controller reset.
+ */
+ twe_printf(sc, "command returned with controller rest request\n");
+ twe_reset(sc);
result = 1;
-
+ } else if (cmd->generic.status > TWE_STATUS_FATAL) {
/*
- * The status code 0xff requests a controller reset
+ * Fatal errors that don't require controller reset.
*/
- if (cmd->generic.status == 0xff)
- twe_reset(sc);
- break;
+ twe_printf(sc, "command returned fatal status - %s (flags = 0x%x)\n",
+ twe_describe_code(twe_table_status, cmd->generic.status),
+ cmd->generic.flags);
+ result = 1;
+ } else if (cmd->generic.status > TWE_STATUS_WARNING) {
+ /*
+ * Warning level status.
+ */
+ twe_printf(sc, "command returned warning status - %s (flags = 0x%x)\n",
+ twe_describe_code(twe_table_status, cmd->generic.status),
+ cmd->generic.flags);
+ } else if (cmd->generic.status > 0x40) {
+ /*
+ * Info level status.
+ */
+ twe_printf(sc, "command returned info status: %s (flags = 0x%x)\n",
+ twe_describe_code(twe_table_status, cmd->generic.status),
+ cmd->generic.flags);
}
+
return(result);
}
diff --git a/sys/dev/twe/twe_compat.h b/sys/dev/twe/twe_compat.h
index c2f75e1a8708..ed82631a3aa6 100644
--- a/sys/dev/twe/twe_compat.h
+++ b/sys/dev/twe/twe_compat.h
@@ -130,8 +130,11 @@
#define twe_printf(sc, fmt, args...) device_printf(sc->twe_dev, fmt , ##args)
#define twed_printf(twed, fmt, args...) device_printf(twed->twed_dev, fmt , ##args)
-#if __FreeBSD_version < 500003 /* old buf style */
-# include <sys/buf.h>
+#if __FreeBSD_version < 500003
+# include <machine/clock.h>
+# define INTR_ENTROPY 0
+
+# include <sys/buf.h> /* old buf style */
typedef struct buf twe_bio;
typedef struct buf_queue_head twe_bioq;
# define TWE_BIO_QINIT(bq) bufq_init(&bq);
diff --git a/sys/dev/twe/twe_freebsd.c b/sys/dev/twe/twe_freebsd.c
index 677e7af82a33..4b442e1127ff 100644
--- a/sys/dev/twe/twe_freebsd.c
+++ b/sys/dev/twe/twe_freebsd.c
@@ -83,8 +83,7 @@ static struct cdevsw twe_cdevsw = {
TWE_CDEV_MAJOR,
nodump,
nopsize,
- 0,
- -1
+ 0
};
/********************************************************************************
@@ -585,8 +584,7 @@ static struct cdevsw twed_cdevsw = {
TWED_CDEV_MAJOR,
twed_dump,
nopsize,
- D_DISK,
- -1
+ D_DISK
};
static struct cdevsw tweddisk_cdevsw;
diff --git a/sys/dev/twe/twereg.h b/sys/dev/twe/twereg.h
index 3d6d6686827d..e7136df2ac55 100644
--- a/sys/dev/twe/twereg.h
+++ b/sys/dev/twe/twereg.h
@@ -124,6 +124,12 @@
#define TWE_OP_AEN_LISTEN 0x1c
#define TWE_OP_CMD_PACKET 0x1d
+/* command status values */
+#define TWE_STATUS_RESET 0xff /* controller requests reset */
+#define TWE_STATUS_FATAL 0xc0 /* fatal errors not requiring reset */
+#define TWE_STATUS_WARNING 0x80 /* warnings */
+#define TWE_STAUS_INFO 0x40 /* informative status */
+
/* misc defines */
#define TWE_ALIGNMENT 0x200
#define TWE_MAX_UNITS 16
diff --git a/sys/dev/twe/twevar.h b/sys/dev/twe/twevar.h
index 639a4253f8b8..3e06bb5fefdb 100644
--- a/sys/dev/twe/twevar.h
+++ b/sys/dev/twe/twevar.h
@@ -240,7 +240,7 @@ twe_initq_bio(struct twe_softc *sc)
}
static __inline void
-twe_enqueue_bio(struct twe_softc *sc, struct bio *bp)
+twe_enqueue_bio(struct twe_softc *sc, twe_bio *bp)
{
int s;
@@ -250,11 +250,11 @@ twe_enqueue_bio(struct twe_softc *sc, struct bio *bp)
splx(s);
}
-static __inline struct bio *
+static __inline twe_bio *
twe_dequeue_bio(struct twe_softc *sc)
{
int s;
- struct bio *bp;
+ twe_bio *bp;
s = splbio();
if ((bp = TWE_BIO_QFIRST(sc->twe_bioq)) != NULL) {