1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 #ifndef IBMVSCSI_H
17 #define IBMVSCSI_H
18 #include <linux/types.h>
19 #include <linux/list.h>
20 #include <linux/completion.h>
21 #include <linux/interrupt.h>
22 #include <scsi/viosrp.h>
23
24 struct scsi_cmnd;
25 struct Scsi_Host;
26
27
28
29
30
31 #define MAX_INDIRECT_BUFS 10
32
33 #define IBMVSCSI_MAX_REQUESTS_DEFAULT 100
34 #define IBMVSCSI_CMDS_PER_LUN_DEFAULT 16
35 #define IBMVSCSI_MAX_SECTORS_DEFAULT 256
36 #define IBMVSCSI_MAX_CMDS_PER_LUN 64
37 #define IBMVSCSI_MAX_LUN 32
38
39
40
41
42
43 struct crq_queue {
44 struct viosrp_crq *msgs;
45 int size, cur;
46 dma_addr_t msg_token;
47 spinlock_t lock;
48 };
49
50
51 struct srp_event_struct {
52 union viosrp_iu *xfer_iu;
53 struct scsi_cmnd *cmnd;
54 struct list_head list;
55 void (*done) (struct srp_event_struct *);
56 struct viosrp_crq crq;
57 struct ibmvscsi_host_data *hostdata;
58 atomic_t free;
59 union viosrp_iu iu;
60 void (*cmnd_done) (struct scsi_cmnd *);
61 struct completion comp;
62 struct timer_list timer;
63 union viosrp_iu *sync_srp;
64 struct srp_direct_buf *ext_list;
65 dma_addr_t ext_list_token;
66 };
67
68
69 struct event_pool {
70 struct srp_event_struct *events;
71 u32 size;
72 int next;
73 union viosrp_iu *iu_storage;
74 dma_addr_t iu_token;
75 };
76
77 enum ibmvscsi_host_action {
78 IBMVSCSI_HOST_ACTION_NONE = 0,
79 IBMVSCSI_HOST_ACTION_RESET,
80 IBMVSCSI_HOST_ACTION_REENABLE,
81 IBMVSCSI_HOST_ACTION_UNBLOCK,
82 };
83
84
85 struct ibmvscsi_host_data {
86 struct list_head host_list;
87 atomic_t request_limit;
88 int client_migrated;
89 enum ibmvscsi_host_action action;
90 struct device *dev;
91 struct event_pool pool;
92 struct crq_queue queue;
93 struct tasklet_struct srp_task;
94 struct list_head sent;
95 struct Scsi_Host *host;
96 struct task_struct *work_thread;
97 wait_queue_head_t work_wait_q;
98 struct mad_adapter_info_data madapter_info;
99 struct capabilities caps;
100 dma_addr_t caps_addr;
101 dma_addr_t adapter_info_addr;
102 };
103
104 #endif