diff options
author | msmith <msmith@FreeBSD.org> | 2001-05-07 21:46:44 +0000 |
---|---|---|
committer | msmith <msmith@FreeBSD.org> | 2001-05-07 21:46:44 +0000 |
commit | 070fb85396f929304a380050efc2e70fcf370daa (patch) | |
tree | f62ad0a81f7b2b28b649424c01829daec70317bf /sys/dev/twe/twe.c | |
parent | b47830be3e58e44dd6ae03b8dc4c9c034f7a2074 (diff) | |
download | FreeBSD-src-070fb85396f929304a380050efc2e70fcf370daa.zip FreeBSD-src-070fb85396f929304a380050efc2e70fcf370daa.tar.gz |
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
Diffstat (limited to 'sys/dev/twe/twe.c')
-rw-r--r-- | sys/dev/twe/twe.c | 52 |
1 files changed, 31 insertions, 21 deletions
diff --git a/sys/dev/twe/twe.c b/sys/dev/twe/twe.c index fadf767..73717bf 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); } |