workqueue: Make worker_attach/detach_pool() update worker->pool
[linux/fpc-iii.git] / drivers / scsi / csiostor / csio_init.h
blob20244254325acb341734e1f33962df9a3ac12488
1 /*
2 * This file is part of the Chelsio FCoE driver for Linux.
4 * Copyright (c) 2008-2012 Chelsio Communications, Inc. All rights reserved.
6 * This software is available to you under a choice of one of two
7 * licenses. You may choose to be licensed under the terms of the GNU
8 * General Public License (GPL) Version 2, available from the file
9 * COPYING in the main directory of this source tree, or the
10 * OpenIB.org BSD license below:
12 * Redistribution and use in source and binary forms, with or
13 * without modification, are permitted provided that the following
14 * conditions are met:
16 * - Redistributions of source code must retain the above
17 * copyright notice, this list of conditions and the following
18 * disclaimer.
20 * - Redistributions in binary form must reproduce the above
21 * copyright notice, this list of conditions and the following
22 * disclaimer in the documentation and/or other materials
23 * provided with the distribution.
25 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
26 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
27 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
28 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
29 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
30 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
31 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
32 * SOFTWARE.
35 #ifndef __CSIO_INIT_H__
36 #define __CSIO_INIT_H__
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>
45 #include "csio_scsi.h"
46 #include "csio_lnode.h"
47 #include "csio_rnode.h"
48 #include "csio_hw.h"
50 #define CSIO_DRV_AUTHOR "Chelsio Communications"
51 #define CSIO_DRV_DESC "Chelsio FCoE driver"
52 #define CSIO_DRV_VERSION "1.0.0-ko"
54 extern struct fc_function_template csio_fc_transport_funcs;
55 extern struct fc_function_template csio_fc_transport_vport_funcs;
57 void csio_fchost_attr_init(struct csio_lnode *);
59 /* INTx handlers */
60 void csio_scsi_intx_handler(struct csio_hw *, void *, uint32_t,
61 struct csio_fl_dma_buf *, void *);
63 void csio_fwevt_intx_handler(struct csio_hw *, void *, uint32_t,
64 struct csio_fl_dma_buf *, void *);
66 /* Common os lnode APIs */
67 void csio_lnodes_block_request(struct csio_hw *);
68 void csio_lnodes_unblock_request(struct csio_hw *);
69 void csio_lnodes_block_by_port(struct csio_hw *, uint8_t);
70 void csio_lnodes_unblock_by_port(struct csio_hw *, uint8_t);
72 struct csio_lnode *csio_shost_init(struct csio_hw *, struct device *, bool,
73 struct csio_lnode *);
74 void csio_shost_exit(struct csio_lnode *);
75 void csio_lnodes_exit(struct csio_hw *, bool);
77 /* DebugFS helper routines */
78 void csio_add_debugfs_mem(struct csio_hw *, const char *,
79 unsigned int, unsigned int);
81 static inline struct Scsi_Host *
82 csio_ln_to_shost(struct csio_lnode *ln)
84 return container_of((void *)ln, struct Scsi_Host, hostdata[0]);
87 /* SCSI -- locking version of get/put ioreqs */
88 static inline struct csio_ioreq *
89 csio_get_scsi_ioreq_lock(struct csio_hw *hw, struct csio_scsim *scsim)
91 struct csio_ioreq *ioreq;
92 unsigned long flags;
94 spin_lock_irqsave(&scsim->freelist_lock, flags);
95 ioreq = csio_get_scsi_ioreq(scsim);
96 spin_unlock_irqrestore(&scsim->freelist_lock, flags);
98 return ioreq;
101 static inline void
102 csio_put_scsi_ioreq_lock(struct csio_hw *hw, struct csio_scsim *scsim,
103 struct csio_ioreq *ioreq)
105 unsigned long flags;
107 spin_lock_irqsave(&scsim->freelist_lock, flags);
108 csio_put_scsi_ioreq(scsim, ioreq);
109 spin_unlock_irqrestore(&scsim->freelist_lock, flags);
112 /* Called in interrupt context */
113 static inline void
114 csio_put_scsi_ioreq_list_lock(struct csio_hw *hw, struct csio_scsim *scsim,
115 struct list_head *reqlist, int n)
117 unsigned long flags;
119 spin_lock_irqsave(&scsim->freelist_lock, flags);
120 csio_put_scsi_ioreq_list(scsim, reqlist, n);
121 spin_unlock_irqrestore(&scsim->freelist_lock, flags);
124 /* Called in interrupt context */
125 static inline void
126 csio_put_scsi_ddp_list_lock(struct csio_hw *hw, struct csio_scsim *scsim,
127 struct list_head *reqlist, int n)
129 unsigned long flags;
131 spin_lock_irqsave(&hw->lock, flags);
132 csio_put_scsi_ddp_list(scsim, reqlist, n);
133 spin_unlock_irqrestore(&hw->lock, flags);
136 #endif /* ifndef __CSIO_INIT_H__ */