diff --git a/sys/dev/ic/ispmbox.h b/sys/dev/ic/ispmbox.h index 0969bf33ca84..369e4334fd48 100644 --- a/sys/dev/ic/ispmbox.h +++ b/sys/dev/ic/ispmbox.h @@ -1,7 +1,6 @@ -/* $NetBSD: ispmbox.h,v 1.7 1998/07/18 21:05:39 mjacob Exp $ */ -/* $Id: ispmbox.h,v 1.7 1998/07/18 21:05:39 mjacob Exp $ */ +/* $Id: ispmbox.h,v 1.8 1998/09/08 07:24:23 mjacob Exp $ */ /* - * Mailbox and Command Definitions for for Qlogic ISP SCSI adapters. + * Mailbox and Queue Entry Definitions for for Qlogic ISP SCSI adapters. * *--------------------------------------- * Copyright (c) 1997, 1998 by Matthew Jacob @@ -123,6 +122,9 @@ #define MBOX_CLEAR_TASK_SET 0x67 #define MBOX_ABORT_TASK_SET 0x68 #define MBOX_GET_FW_STATE 0x69 +#define MBOX_GET_LINK_STATUS 0x6a +#define MBOX_INIT_LIP_RESET 0x6c +#define MBOX_INIT_LIP_LOGIN 0x72 #define ISP2100_SET_PCI_PARAM 0x00ff @@ -132,6 +134,42 @@ typedef struct { u_int16_t param[8]; } mbreg_t; +/* + * Mailbox Command Complete Status Codes + */ +#define MBOX_COMMAND_COMPLETE 0x4000 +#define MBOX_INVALID_COMMAND 0x4001 +#define MBOX_HOST_INTERFACE_ERROR 0x4002 +#define MBOX_TEST_FAILED 0x4003 +#define MBOX_COMMAND_ERROR 0x4005 +#define MBOX_COMMAND_PARAM_ERROR 0x4006 + +/* + * Asynchronous event status codes + */ +#define ASYNC_BUS_RESET 0x8001 +#define ASYNC_SYSTEM_ERROR 0x8002 +#define ASYNC_RQS_XFER_ERR 0x8003 +#define ASYNC_RSP_XFER_ERR 0x8004 +#define ASYNC_QWAKEUP 0x8005 +#define ASYNC_TIMEOUT_RESET 0x8006 +#define ASYNC_UNSPEC_TMODE 0x8007 +#define ASYNC_EXTMSG_UNDERRUN 0x800A +#define ASYNC_SCAM_INT 0x800B +#define ASYNC_HUNG_SCSI 0x800C +#define ASYNC_KILLED_BUS 0x800D +#define ASYNC_BUS_TRANSIT 0x800E /* LVD -> HVD, eg. */ +#define ASYNC_CMD_CMPLT 0x8020 +#define ASYNC_CTIO_DONE 0x8021 + +/* for ISP2100 only */ +#define ASYNC_LIP_OCCURRED 0x8010 +#define ASYNC_LOOP_UP 0x8011 +#define ASYNC_LOOP_DOWN 0x8012 +#define ASYNC_LOOP_RESET 0x8013 +#define ASYNC_PDB_CHANGED 0x8014 /* Port Database Changed */ +#define ASYNC_CHANGE_NOTIFY 0x8015 + /* * Command Structure Definitions */ @@ -162,14 +200,31 @@ typedef struct { #define RQSFLAG_BADPACKET 0x08 /* RQS entry_type definitions */ -#define RQSTYPE_REQUEST 1 -#define RQSTYPE_DATASEG 2 -#define RQSTYPE_RESPONSE 3 -#define RQSTYPE_MARKER 4 -#define RQSTYPE_CMDONLY 5 -#define RQSTYPE_T2RQS 17 -#define RQSTYPE_T3RQS 25 -#define RQSTYPE_T1DSEG 10 +#define RQSTYPE_REQUEST 0x01 +#define RQSTYPE_DATASEG 0x02 +#define RQSTYPE_RESPONSE 0x03 +#define RQSTYPE_MARKER 0x04 +#define RQSTYPE_CMDONLY 0x05 +#define RQSTYPE_ATIO 0x06 /* Target Mode */ +#define RQSTYPE_CTIO0 0x07 /* Target Mode */ +#define RQSTYPE_SCAM 0x08 +#define RQSTYPE_A64 0x09 +#define RQSTYPE_A64_CONT 0x0a +#define RQSTYPE_ENABLE_LUN 0x0b /* Target Mode */ +#define RQSTYPE_MODIFY_LUN 0x0c /* Target Mode */ +#define RQSTYPE_NOTIFY 0x0d /* Target Mode */ +#define RQSTYPE_NOTIFY_ACK 0x0e /* Target Mode */ +#define RQSTYPE_CTIO1 0x0f /* Target Mode */ +#define RQSTYPE_STATUS_CONT 0x10 +#define RQSTYPE_T2RQS 0x11 + +#define RQSTYPE_T4RQS 0x15 +#define RQSTYPE_ATIO2 0x16 +#define RQSTYPE_CTIO2 0x17 +#define RQSTYPE_CSET0 0x18 +#define RQSTYPE_T3RQS 0x19 + +#define RQSTYPE_CTIO3 0x1f #define ISP_RQDSEG 4 @@ -227,6 +282,13 @@ typedef struct { #define REQFLAG_DATA_UNKNOWN 0x0060 #define REQFLAG_DISARQ 0x0100 +#define REQFLAG_FRC_ASYNC 0x0200 +#define REQFLAG_FRC_SYNC 0x0400 +#define REQFLAG_FRC_WIDE 0x0800 +#define REQFLAG_NOPARITY 0x1000 +#define REQFLAG_STOPQ 0x2000 +#define REQFLAG_XTRASNS 0x4000 +#define REQFLAG_PRIORITY 0x8000 typedef struct { isphdr_t req_header; @@ -321,6 +383,17 @@ typedef struct { #define RQCS_ID_MSG_FAILED 0x0013 #define RQCS_UNEXP_BUS_FREE 0x0014 #define RQCS_DATA_UNDERRUN 0x0015 +#define RQCS_XACT_ERR1 0x0018 +#define RQCS_XACT_ERR2 0x0019 +#define RQCS_XACT_ERR3 0x001A +#define RQCS_BAD_ENTRY 0x001B +#define RQCS_QUEUE_FULL 0x001C +#define RQCS_PHASE_SKIPPED 0x001D +#define RQCS_ARQS_FAILED 0x001E +#define RQCS_WIDE_FAILED 0x001F +#define RQCS_SYNCXFER_FAILED 0x0020 +#define RQCS_LVD_BUSERR 0x0021 + /* 2100 Only Completion Codes */ #define RQCS_PORT_UNAVAILABLE 0x0028 #define RQCS_PORT_LOGGED_OUT 0x0029 @@ -350,12 +423,94 @@ typedef struct { #define RQSTF_TIMEOUT 0x0040 #define RQSTF_NEGOTIATION 0x0080 +/* + * Target Mode Structures + */ +/* + * Used for Enable LUN and Modify Lun types. + * (for FC, pre-1.14 FW layout revision). + */ +typedef struct { + isphdr_t req_header; + u_int32_t req_handle; +#if BYTE_ORDER == BIG_ENDIAN + u_int8_t _reserved0; + u_int8_t req_lun; /* HOST->FW: LUN to enable */ +#else + u_int8_t req_lun; /* HOST->FW: LUN to enable */ + u_int8_t _reserved0; +#endif + u_int16_t _reserved1[3]; +#if BYTE_ORDER == BIG_ENDIAN + u_int8_t _reserved2; + u_int8_t req_status; /* FW->HOST: Status of Request */ + u_int8_t req_imcount; /* HOST->FW: Immediate Notify Count */ + u_int8_t req_cmdcount; /* HOST->FW: ATIO Count */ +#else + u_int8_t req_status; /* FW->HOST: Status of Request */ + u_int8_t _reserved2; + u_int8_t req_cmdcount; /* HOST->FW: ATIO Count */ + u_int8_t req_imcount; /* HOST->FW: Immediate Notify Count */ +#endif + u_int16_t _reserved3; + u_int16_t req_timeout; /* HOST->FW: Lun timeout value */ +} isplun_t; + +typedef struct { + isphdr_t req_header; + u_int32_t req_handle; +#if BYTE_ORDER == BIG_ENDIAN + u_int8_t req_initiator; + u_int8_t req_lun; +#else + u_int8_t req_lun; + u_int8_t req_initiator; +#endif + u_int16_t _reserved1[3]; + u_int16_t req_status; + u_int16_t req_task_flags; + u_int16_t req_sequence; +} ispnotify_t; + +typedef struct { + isphdr_t req_header; + u_int32_t req_handle; +#if BYTE_ORDER == BIG_ENDIAN + u_int8_t req_initiator; + u_int8_t req_lun; +#else + u_int8_t req_lun; + u_int8_t req_initiator; +#endif + u_int16_t req_rxid; + u_int16_t req_flags; + u_int16_t req_status; +#if BYTE_ORDER == BIG_ENDIAN + u_int8_t req_taskcodes; + u_int8_t _reserved0; + u_int8_t req_execodes; + u_int8_t req_taskflags; +#else + u_int8_t _reserved0; + u_int8_t req_taskcodes; + u_int8_t req_taskflags; + u_int8_t req_execodes; +#endif + u_int32_t req_cdb[4]; + u_int32_t req_datalen; + u_int32_t _reserved1;; + u_int16_t req_scsi_status; + u_int8_t req_sense[8]; +} ispatiot2_t; + /* * FC (ISP2100) specific data structures */ /* * Initialization Control Block + * + * Version One format. */ typedef struct { #if BYTE_ORDER == BIG_ENDIAN @@ -376,9 +531,16 @@ typedef struct { u_int8_t icb_retry_count; u_int8_t icb_retry_delay; #endif - u_int16_t icb_nodename[4]; + u_int8_t icb_nodename[8]; u_int16_t icb_hardaddr; - u_int16_t _reserved1[5]; +#if BYTE_ORDER == BIG_ENDIAN + u_int8_t _reserved1; + u_int8_t icb_iqdevtype; +#else + u_int8_t icb_iqdevtype; + u_int8_t _reserved1; +#endif + u_int8_t icb_portname[8]; u_int16_t icb_rqstout; u_int16_t icb_rspnsin; u_int16_t icb_rqstqlen; @@ -386,10 +548,63 @@ typedef struct { u_int16_t icb_rqstaddr[4]; u_int16_t icb_respaddr[4]; } isp_icb_t; +#define ICB_VERSION1 1 -#define ICB_DFLT_FRMLEN 1024 -#define MAKE_NODE_NAME(isp, icbp) \ - (icbp)->icb_nodename[0] = 0, (icbp)->icb_nodename[1] = 0x5355,\ - (icbp)->icb_nodename[2] = 0x4E57, (icbp)->icb_nodename[3] = 0 +#define ICBOPT_HARD_ADDRESS (1<<0) +#define ICBOPT_FAIRNESS (1<<1) +#define ICBOPT_FULL_DUPLEX (1<<2) +#define ICBOPT_FAST_POST (1<<3) +#define ICBOPT_TGT_ENABLE (1<<4) +#define ICBOPT_INI_DISABLE (1<<5) +#define ICBOPT_INI_ADISC (1<<6) +#define ICBOPT_INI_TGTTYPE (1<<7) +#define ICBOPT_PDBCHANGE_AE (1<<8) +#define ICBOPT_NOLIP (1<<9) +#define ICBOPT_SRCHDOWN (1<<10) +#define ICBOPT_PREVLOOP (1<<11) +#define ICBOPT_STOP_ON_QFULL (1<<12) +#define ICBOPT_FULL_LOGIN (1<<13) +#define ICBOPT_USE_PORTNAME (1<<14) + + +#define ICB_MIN_FRMLEN 256 +#define ICB_MAX_FRMLEN 2112 +#define ICB_DFLT_FRMLEN 1024 + +#define RQRSP_ADDR0015 0 +#define RQRSP_ADDR1631 1 +#define RQRSP_ADDR3247 2 +#define RQRSP_ADDR4863 3 + + +#if BYTE_ORDER == BIG_ENDIAN +#define ICB_NNM0 6 +#define ICB_NNM1 7 +#define ICB_NNM2 4 +#define ICB_NNM3 5 +#define ICB_NNM4 2 +#define ICB_NNM5 3 +#define ICB_NNM6 0 +#define ICB_NNM7 1 +#else +#define ICB_NNM0 7 +#define ICB_NNM1 6 +#define ICB_NNM2 5 +#define ICB_NNM3 4 +#define ICB_NNM4 3 +#define ICB_NNM5 2 +#define ICB_NNM6 1 +#define ICB_NNM7 0 +#endif + +#define MAKE_NODE_NAME_FROM_WWN(array, wwn) \ + array[ICB_NNM0] = (u_int8_t) ((wwn >> 0) & 0xff), \ + array[ICB_NNM1] = (u_int8_t) ((wwn >> 8) & 0xff), \ + array[ICB_NNM2] = (u_int8_t) ((wwn >> 16) & 0xff), \ + array[ICB_NNM3] = (u_int8_t) ((wwn >> 24) & 0xff), \ + array[ICB_NNM4] = (u_int8_t) ((wwn >> 32) & 0xff), \ + array[ICB_NNM5] = (u_int8_t) ((wwn >> 40) & 0xff), \ + array[ICB_NNM6] = (u_int8_t) ((wwn >> 48) & 0xff), \ + array[ICB_NNM7] = (u_int8_t) ((wwn >> 56) & 0xff) #endif /* _ISPMBOX_H */