1 /* fcp_impl.h: Generic SCSI on top of FC4 - our interface defines.
3 * Copyright (C) 1997-1999 Jakub Jelinek (jj@ultra.linux.cz)
4 * Copyright (C) 1998 Jirka Hanika (geo@ff.cuni.cz)
10 #include <linux/types.h>
11 #include "../scsi/scsi.h"
23 #define FCP_SCSI_USE_NEW_EH_CODE 0
25 #define FC_CLASS_OUTBOUND 0x01
26 #define FC_CLASS_INBOUND 0x02
27 #define FC_CLASS_SIMPLE 0x03
28 #define FC_CLASS_IO_WRITE 0x04
29 #define FC_CLASS_IO_READ 0x05
30 #define FC_CLASS_UNSOLICITED 0x06
31 #define FC_CLASS_OFFLINE 0x08
33 #define PROTO_OFFLINE 0x02
34 #define PROTO_REPORT_AL_MAP 0x03
35 #define PROTO_FORCE_LIP 0x06
39 typedef struct fcp_cmnd
{
40 struct fcp_cmnd
*next
;
41 struct fcp_cmnd
*prev
;
42 void (*done
)(Scsi_Cmnd
*);
48 /* From now on this cannot be touched for proto == TYPE_SCSI_FCP */
56 /* This is just used as a verification during login */
57 struct _fc_channel
*fc
;
63 unsigned char list
[0];
66 typedef struct _fc_channel
{
67 struct _fc_channel
*next
;
73 void (*fcp_register
)(struct _fc_channel
*, u8
, int);
74 void (*reset
)(struct _fc_channel
*);
75 int (*hw_enque
)(struct _fc_channel
*, fcp_cmnd
*);
79 common_svc_parm
*common_svc
;
86 struct module
*module
;
91 fcp_cmd
*scsi_cmd_pool
;
93 dma_addr_t dma_scsi_cmd
, dma_scsi_rsp
;
97 int (*encode_addr
)(Scsi_Cmnd
*, u16
*, struct _fc_channel
*, fcp_cmnd
*);
100 fcp_cmnd
**cmd_slots
;
111 extern fc_channel
*fc_channels
;
113 #define FC_STATE_UNINITED 0
114 #define FC_STATE_ONLINE 1
115 #define FC_STATE_OFFLINE 2
116 #define FC_STATE_RESETING 3
117 #define FC_STATE_FPORT_OK 4
118 #define FC_STATE_MAYBEOFFLINE 5
120 #define FC_STATUS_OK 0
121 #define FC_STATUS_P_RJT 2
122 #define FC_STATUS_F_RJT 3
123 #define FC_STATUS_P_BSY 4
124 #define FC_STATUS_F_BSY 5
125 #define FC_STATUS_ERR_OFFLINE 0x11
126 #define FC_STATUS_TIMEOUT 0x12
127 #define FC_STATUS_ERR_OVERRUN 0x13
128 #define FC_STATUS_POINTTOPOINT 0x15
129 #define FC_STATUS_AL 0x16
130 #define FC_STATUS_UNKNOWN_CQ_TYPE 0x20
131 #define FC_STATUS_BAD_SEG_CNT 0x21
132 #define FC_STATUS_MAX_XCHG_EXCEEDED 0x22
133 #define FC_STATUS_BAD_XID 0x23
134 #define FC_STATUS_XCHG_BUSY 0x24
135 #define FC_STATUS_BAD_POOL_ID 0x25
136 #define FC_STATUS_INSUFFICIENT_CQES 0x26
137 #define FC_STATUS_ALLOC_FAIL 0x27
138 #define FC_STATUS_BAD_SID 0x28
139 #define FC_STATUS_NO_SEQ_INIT 0x29
140 #define FC_STATUS_TIMED_OUT -1
141 #define FC_STATUS_BAD_RSP -2
143 void fcp_queue_empty(fc_channel
*);
144 int fcp_init(fc_channel
*);
145 void fcp_release(fc_channel
*fc_chain
, int count
);
146 void fcp_receive_solicited(fc_channel
*, int, int, int, fc_hdr
*);
147 void fcp_state_change(fc_channel
*, int);
148 int fc_do_plogi(fc_channel
*, unsigned char, fc_wwn
*, fc_wwn
*);
149 int fc_do_prli(fc_channel
*, unsigned char);
151 #define for_each_fc_channel(fc) \
152 for (fc = fc_channels; fc; fc = fc->next)
154 #define for_each_online_fc_channel(fc) \
155 for_each_fc_channel(fc) \
156 if (fc->state == FC_STATE_ONLINE)
158 int fcp_scsi_queuecommand(Scsi_Cmnd
*, void (* done
)(Scsi_Cmnd
*));
159 int fcp_scsi_abort(Scsi_Cmnd
*);
160 int fcp_scsi_dev_reset(Scsi_Cmnd
*);
161 int fcp_scsi_bus_reset(Scsi_Cmnd
*);
162 int fcp_scsi_host_reset(Scsi_Cmnd
*);
164 #endif /* !(_FCP_SCSI_H) */