1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35#ifndef __CSIO_INIT_H__
36#define __CSIO_INIT_H__
37
38#include <linux/pci.h>
39#include <linux/if_ether.h>
40#include <scsi/scsi.h>
41#include <scsi/scsi_device.h>
42#include <scsi/scsi_host.h>
43#include <scsi/scsi_transport_fc.h>
44
45#include "csio_scsi.h"
46#include "csio_lnode.h"
47#include "csio_rnode.h"
48#include "csio_hw.h"
49
50#define CSIO_DRV_AUTHOR "Chelsio Communications"
51#define CSIO_DRV_LICENSE "Dual BSD/GPL"
52#define CSIO_DRV_DESC "Chelsio FCoE driver"
53#define CSIO_DRV_VERSION "1.0.0"
54
55extern struct fc_function_template csio_fc_transport_funcs;
56extern struct fc_function_template csio_fc_transport_vport_funcs;
57
58void csio_fchost_attr_init(struct csio_lnode *);
59
60
61void csio_scsi_intx_handler(struct csio_hw *, void *, uint32_t,
62 struct csio_fl_dma_buf *, void *);
63
64void csio_fwevt_intx_handler(struct csio_hw *, void *, uint32_t,
65 struct csio_fl_dma_buf *, void *);
66
67
68void csio_lnodes_block_request(struct csio_hw *);
69void csio_lnodes_unblock_request(struct csio_hw *);
70void csio_lnodes_block_by_port(struct csio_hw *, uint8_t);
71void csio_lnodes_unblock_by_port(struct csio_hw *, uint8_t);
72
73struct csio_lnode *csio_shost_init(struct csio_hw *, struct device *, bool,
74 struct csio_lnode *);
75void csio_shost_exit(struct csio_lnode *);
76void csio_lnodes_exit(struct csio_hw *, bool);
77
78
79void csio_add_debugfs_mem(struct csio_hw *, const char *,
80 unsigned int, unsigned int);
81
82static inline struct Scsi_Host *
83csio_ln_to_shost(struct csio_lnode *ln)
84{
85 return container_of((void *)ln, struct Scsi_Host, hostdata[0]);
86}
87
88
89static inline struct csio_ioreq *
90csio_get_scsi_ioreq_lock(struct csio_hw *hw, struct csio_scsim *scsim)
91{
92 struct csio_ioreq *ioreq;
93 unsigned long flags;
94
95 spin_lock_irqsave(&scsim->freelist_lock, flags);
96 ioreq = csio_get_scsi_ioreq(scsim);
97 spin_unlock_irqrestore(&scsim->freelist_lock, flags);
98
99 return ioreq;
100}
101
102static inline void
103csio_put_scsi_ioreq_lock(struct csio_hw *hw, struct csio_scsim *scsim,
104 struct csio_ioreq *ioreq)
105{
106 unsigned long flags;
107
108 spin_lock_irqsave(&scsim->freelist_lock, flags);
109 csio_put_scsi_ioreq(scsim, ioreq);
110 spin_unlock_irqrestore(&scsim->freelist_lock, flags);
111}
112
113
114static inline void
115csio_put_scsi_ioreq_list_lock(struct csio_hw *hw, struct csio_scsim *scsim,
116 struct list_head *reqlist, int n)
117{
118 unsigned long flags;
119
120 spin_lock_irqsave(&scsim->freelist_lock, flags);
121 csio_put_scsi_ioreq_list(scsim, reqlist, n);
122 spin_unlock_irqrestore(&scsim->freelist_lock, flags);
123}
124
125
126static inline void
127csio_put_scsi_ddp_list_lock(struct csio_hw *hw, struct csio_scsim *scsim,
128 struct list_head *reqlist, int n)
129{
130 unsigned long flags;
131
132 spin_lock_irqsave(&hw->lock, flags);
133 csio_put_scsi_ddp_list(scsim, reqlist, n);
134 spin_unlock_irqrestore(&hw->lock, flags);
135}
136
137#endif
138