diff options
author | scottl <scottl@FreeBSD.org> | 2005-09-25 17:12:41 +0000 |
---|---|---|
committer | scottl <scottl@FreeBSD.org> | 2005-09-25 17:12:41 +0000 |
commit | 7279f0e888c34756066142925925665ea127f138 (patch) | |
tree | ace9c1e800f0cfb392c3a1fd36dd6adde43e0989 /sys/dev/ips/ips.h | |
parent | 20b5ed686057365a67abd0c9ed104f39e30f9865 (diff) | |
download | FreeBSD-src-7279f0e888c34756066142925925665ea127f138.zip FreeBSD-src-7279f0e888c34756066142925925665ea127f138.tar.gz |
Overhaul error handling in the IPS driver. Don't use a magic value for
driver-induced errors, instead be better about propagating error status
upwards. Add more error definitions, courtesy of the linux driver. Fix
a command leak in the ioctl handler. Re-arrange some of the command handlers
to localize error handling.
MFC After: 3 days
Diffstat (limited to 'sys/dev/ips/ips.h')
-rw-r--r-- | sys/dev/ips/ips.h | 32 |
1 files changed, 29 insertions, 3 deletions
diff --git a/sys/dev/ips/ips.h b/sys/dev/ips/ips.h index 829bb46..7b7124e 100644 --- a/sys/dev/ips/ips.h +++ b/sys/dev/ips/ips.h @@ -150,9 +150,29 @@ MALLOC_DECLARE(M_IPSBUF); #define IPS_RW_NVRAM_CMD 0xBC #define IPS_FFDC_CMD 0xD7 -/* error information returned by the adapter */ +/* basic_status information returned by the adapter */ #define IPS_MIN_ERROR 0x02 -#define IPS_ERROR_STATUS 0x13000200 /* ahh, magic numbers */ +#define IPS_BASIC_STATUS_MASK 0xFF +#define IPS_GSC_STATUS_MASK 0x0F +#define IPS_CMD_SUCCESS 0x00 +#define IPS_CMD_RECOVERED_ERROR 0x01 +#define IPS_DRV_ERROR 0x02 /* Driver supplied error */ +#define IPS_INVAL_OPCO 0x03 +#define IPS_INVAL_CMD_BLK 0x04 +#define IPS_INVAL_PARM_BLK 0x05 +#define IPS_BUSY 0x08 +#define IPS_CMD_CMPLT_WERROR 0x0C +#define IPS_LD_ERROR 0x0D +#define IPS_CMD_TIMEOUT 0x0E +#define IPS_PHYS_DRV_ERROR 0x0F + +/* extended_status information returned by the adapter */ +#define IPS_ERR_SEL_TO 0xF0 +#define IPS_ERR_OU_RUN 0xF2 +#define IPS_ERR_HOST_RESET 0xF7 +#define IPS_ERR_DEV_RESET 0xF8 +#define IPS_ERR_RECOVERY 0xFC +#define IPS_ERR_CKCOND 0xFF #define IPS_OS_FREEBSD 8 #define IPS_VERSION_MAJOR "0.90" @@ -207,7 +227,12 @@ MALLOC_DECLARE(M_IPSBUF); #define ips_read_request(iobuf) ((iobuf)->bio_cmd == BIO_READ) -#define COMMAND_ERROR(status) (((status)->fields.basic_status & 0x0f) >= IPS_MIN_ERROR) +#define COMMAND_ERROR(command) (((command)->status.fields.basic_status & IPS_GSC_STATUS_MASK) >= IPS_MIN_ERROR) + +#define ips_set_error(command, error) do { \ + (command)->status.fields.basic_status = IPS_DRV_ERROR; \ + (command)->status.fields.reserved = ((error) & 0x0f); \ +} while (0); #ifndef IPS_DEBUG #define DEVICE_PRINTF(x...) @@ -216,6 +241,7 @@ MALLOC_DECLARE(M_IPSBUF); #define DEVICE_PRINTF(level,x...) if(IPS_DEBUG >= level)device_printf(x) #define PRINTF(level,x...) if(IPS_DEBUG >= level)printf(x) #endif + /* * IPS STRUCTS */ |