aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/fc4/fcp_impl.h
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
commit1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 (patch)
tree0bba044c4ce775e45a88a51686b5d9f90697ea9d /drivers/fc4/fcp_impl.h
Linux-2.6.12-rc2v2.6.12-rc2
Initial git repository build. I'm not bothering with the full history, even though we have it. We can create a separate "historical" git archive of that later if we want to, and in the meantime it's about 3.2GB when imported into git - space that would just make the early git days unnecessarily complicated, when we don't have a lot of good infrastructure for it. Let it rip!
Diffstat (limited to 'drivers/fc4/fcp_impl.h')
-rw-r--r--drivers/fc4/fcp_impl.h164
1 files changed, 164 insertions, 0 deletions
diff --git a/drivers/fc4/fcp_impl.h b/drivers/fc4/fcp_impl.h
new file mode 100644
index 000000000000..e44d652a83dc
--- /dev/null
+++ b/drivers/fc4/fcp_impl.h
@@ -0,0 +1,164 @@
1/* fcp_impl.h: Generic SCSI on top of FC4 - our interface defines.
2 *
3 * Copyright (C) 1997-1999 Jakub Jelinek (jj@ultra.linux.cz)
4 * Copyright (C) 1998 Jirka Hanika (geo@ff.cuni.cz)
5 */
6
7#ifndef _FCP_SCSI_H
8#define _FCP_SCSI_H
9
10#include <linux/types.h>
11#include "../scsi/scsi.h"
12
13#include "fc.h"
14#include "fcp.h"
15#include "fc-al.h"
16
17#include <asm/io.h>
18#ifdef __sparc__
19#include <asm/sbus.h>
20#endif
21
22/* 0 or 1 */
23#define FCP_SCSI_USE_NEW_EH_CODE 0
24
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
32
33#define PROTO_OFFLINE 0x02
34#define PROTO_REPORT_AL_MAP 0x03
35#define PROTO_FORCE_LIP 0x06
36
37struct _fc_channel;
38
39typedef struct fcp_cmnd {
40 struct fcp_cmnd *next;
41 struct fcp_cmnd *prev;
42 void (*done)(Scsi_Cmnd *);
43 unsigned short proto;
44 unsigned short token;
45 unsigned int did;
46 /* FCP SCSI stuff */
47 dma_addr_t data;
48 /* From now on this cannot be touched for proto == TYPE_SCSI_FCP */
49 fc_hdr fch;
50 dma_addr_t cmd;
51 dma_addr_t rsp;
52 int cmdlen;
53 int rsplen;
54 int class;
55 int datalen;
56 /* This is just used as a verification during login */
57 struct _fc_channel *fc;
58 void *ls;
59} fcp_cmnd;
60
61typedef struct {
62 unsigned int len;
63 unsigned char list[0];
64} fcp_posmap;
65
66typedef struct _fc_channel {
67 struct _fc_channel *next;
68 int irq;
69 int state;
70 int sid;
71 int did;
72 char name[16];
73 void (*fcp_register)(struct _fc_channel *, u8, int);
74 void (*reset)(struct _fc_channel *);
75 int (*hw_enque)(struct _fc_channel *, fcp_cmnd *);
76 fc_wwn wwn_node;
77 fc_wwn wwn_nport;
78 fc_wwn wwn_dest;
79 common_svc_parm *common_svc;
80 svc_parm *class_svcs;
81#ifdef __sparc__
82 struct sbus_dev *dev;
83#else
84 struct pci_dev *dev;
85#endif
86 struct module *module;
87 /* FCP SCSI stuff */
88 short can_queue;
89 short abort_count;
90 int rsp_size;
91 fcp_cmd *scsi_cmd_pool;
92 char *scsi_rsp_pool;
93 dma_addr_t dma_scsi_cmd, dma_scsi_rsp;
94 long *scsi_bitmap;
95 long scsi_bitmap_end;
96 int scsi_free;
97 int (*encode_addr)(Scsi_Cmnd *, u16 *, struct _fc_channel *, fcp_cmnd *);
98 fcp_cmnd *scsi_que;
99 char scsi_name[4];
100 fcp_cmnd **cmd_slots;
101 int channels;
102 int targets;
103 long *ages;
104 Scsi_Cmnd *rst_pkt;
105 fcp_posmap *posmap;
106 /* LOGIN stuff */
107 fcp_cmnd *login;
108 void *ls;
109} fc_channel;
110
111extern fc_channel *fc_channels;
112
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
119
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
142
143void fcp_queue_empty(fc_channel *);
144int fcp_init(fc_channel *);
145void fcp_release(fc_channel *fc_chain, int count);
146void fcp_receive_solicited(fc_channel *, int, int, int, fc_hdr *);
147void fcp_state_change(fc_channel *, int);
148int fc_do_plogi(fc_channel *, unsigned char, fc_wwn *, fc_wwn *);
149int fc_do_prli(fc_channel *, unsigned char);
150
151#define for_each_fc_channel(fc) \
152 for (fc = fc_channels; fc; fc = fc->next)
153
154#define for_each_online_fc_channel(fc) \
155 for_each_fc_channel(fc) \
156 if (fc->state == FC_STATE_ONLINE)
157
158int fcp_scsi_queuecommand(Scsi_Cmnd *, void (* done)(Scsi_Cmnd *));
159int fcp_scsi_abort(Scsi_Cmnd *);
160int fcp_scsi_dev_reset(Scsi_Cmnd *);
161int fcp_scsi_bus_reset(Scsi_Cmnd *);
162int fcp_scsi_host_reset(Scsi_Cmnd *);
163
164#endif /* !(_FCP_SCSI_H) */