Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* fcp.h: Definitions for Fibre Channel Protocol. |
| 2 | * |
| 3 | * Copyright (C) 1997 Jakub Jelinek (jj@sunsite.mff.cuni.cz) |
| 4 | * |
| 5 | */ |
| 6 | |
| 7 | #ifndef __FCP_H |
| 8 | #define __FCP_H |
| 9 | |
| 10 | /* FCP addressing is hierarchical with up to 4 layers, MS first. |
| 11 | Exact meaning of the addresses is up to the vendor */ |
| 12 | |
| 13 | /* fcp_cntl field */ |
| 14 | #define FCP_CNTL_WRITE 0x00000001 /* Initiator write */ |
| 15 | #define FCP_CNTL_READ 0x00000002 /* Initiator read */ |
| 16 | #define FCP_CNTL_ABORT_TSK 0x00000200 /* Abort task set */ |
| 17 | #define FCP_CNTL_CLR_TASK 0x00000400 /* Clear task set */ |
| 18 | #define FCP_CNTL_RESET 0x00002000 /* Reset */ |
| 19 | #define FCP_CNTL_CLR_ACA 0x00004000 /* Clear ACA */ |
| 20 | #define FCP_CNTL_KILL_TASK 0x00008000 /* Terminate task */ |
| 21 | #define FCP_CNTL_QTYPE_MASK 0x00070000 /* Tagged queueing type */ |
| 22 | #define FCP_CNTL_QTYPE_SIMPLE 0x00000000 |
| 23 | #define FCP_CNTL_QTYPE_HEAD_OF_Q 0x00010000 |
| 24 | #define FCP_CNTL_QTYPE_ORDERED 0x00020000 |
| 25 | #define FCP_CNTL_QTYPE_ACA_Q_TAG 0x00040000 |
| 26 | #define FCP_CNTL_QTYPE_UNTAGGED 0x00050000 |
| 27 | |
| 28 | typedef struct { |
| 29 | u16 fcp_addr[4]; |
| 30 | u32 fcp_cntl; |
| 31 | u8 fcp_cdb[16]; |
| 32 | u32 fcp_data_len; |
| 33 | } fcp_cmd; |
| 34 | |
| 35 | /* fcp_status field */ |
| 36 | #define FCP_STATUS_MASK 0x000000ff /* scsi status of command */ |
| 37 | #define FCP_STATUS_RSP_LEN 0x00000100 /* response_len != 0 */ |
| 38 | #define FCP_STATUS_SENSE_LEN 0x00000200 /* sense_len != 0 */ |
| 39 | #define FCP_STATUS_RESID 0x00000400 /* resid != 0 */ |
| 40 | |
| 41 | typedef struct { |
| 42 | u32 xxx[2]; |
| 43 | u32 fcp_status; |
| 44 | u32 fcp_resid; |
| 45 | u32 fcp_sense_len; |
| 46 | u32 fcp_response_len; |
| 47 | /* u8 fcp_sense[fcp_sense_len]; */ |
| 48 | /* u8 fcp_response[fcp_response_len]; */ |
| 49 | } fcp_rsp; |
| 50 | |
| 51 | /* fcp errors */ |
| 52 | |
| 53 | /* rsp_info_type field */ |
| 54 | #define FCP_RSP_SCSI_BUS_ERR 0x01 |
| 55 | #define FCP_RSP_SCSI_PORT_ERR 0x02 |
| 56 | #define FCP_RSP_CARD_ERR 0x03 |
| 57 | |
| 58 | /* isp_status field */ |
| 59 | #define FCP_RSP_CMD_COMPLETE 0x0000 |
| 60 | #define FCP_RSP_CMD_INCOMPLETE 0x0001 |
| 61 | #define FCP_RSP_CMD_DMA_ERR 0x0002 |
| 62 | #define FCP_RSP_CMD_TRAN_ERR 0x0003 |
| 63 | #define FCP_RSP_CMD_RESET 0x0004 |
| 64 | #define FCP_RSP_CMD_ABORTED 0x0005 |
| 65 | #define FCP_RSP_CMD_TIMEOUT 0x0006 |
| 66 | #define FCP_RSP_CMD_OVERRUN 0x0007 |
| 67 | |
| 68 | /* isp_state_flags field */ |
| 69 | #define FCP_RSP_ST_GOT_BUS 0x0100 |
| 70 | #define FCP_RSP_ST_GOT_TARGET 0x0200 |
| 71 | #define FCP_RSP_ST_SENT_CMD 0x0400 |
| 72 | #define FCP_RSP_ST_XFRD_DATA 0x0800 |
| 73 | #define FCP_RSP_ST_GOT_STATUS 0x1000 |
| 74 | #define FCP_RSP_ST_GOT_SENSE 0x2000 |
| 75 | |
| 76 | /* isp_stat_flags field */ |
| 77 | #define FCP_RSP_STAT_DISC 0x0001 |
| 78 | #define FCP_RSP_STAT_SYNC 0x0002 |
| 79 | #define FCP_RSP_STAT_PERR 0x0004 |
| 80 | #define FCP_RSP_STAT_BUS_RESET 0x0008 |
| 81 | #define FCP_RSP_STAT_DEV_RESET 0x0010 |
| 82 | #define FCP_RSP_STAT_ABORTED 0x0020 |
| 83 | #define FCP_RSP_STAT_TIMEOUT 0x0040 |
| 84 | #define FCP_RSP_STAT_NEGOTIATE 0x0080 |
| 85 | |
| 86 | typedef struct { |
| 87 | u8 rsp_info_type; |
| 88 | u8 xxx; |
| 89 | u16 isp_status; |
| 90 | u16 isp_state_flags; |
| 91 | u16 isp_stat_flags; |
| 92 | } fcp_scsi_err; |
| 93 | |
| 94 | #endif /* !(__FCP_H) */ |