aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/qla2xxx/qla_inline.h
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi/qla2xxx/qla_inline.h')
-rw-r--r--drivers/scsi/qla2xxx/qla_inline.h141
1 files changed, 25 insertions, 116 deletions
diff --git a/drivers/scsi/qla2xxx/qla_inline.h b/drivers/scsi/qla2xxx/qla_inline.h
index 6a05d1b8d48a..b9ff85b03a5f 100644
--- a/drivers/scsi/qla2xxx/qla_inline.h
+++ b/drivers/scsi/qla2xxx/qla_inline.h
@@ -2,7 +2,7 @@
2 * QLOGIC LINUX SOFTWARE 2 * QLOGIC LINUX SOFTWARE
3 * 3 *
4 * QLogic ISP2x00 device driver for Linux 2.6.x 4 * QLogic ISP2x00 device driver for Linux 2.6.x
5 * Copyright (C) 2003-2004 QLogic Corporation 5 * Copyright (C) 2003-2005 QLogic Corporation
6 * (www.qlogic.com) 6 * (www.qlogic.com)
7 * 7 *
8 * This program is free software; you can redistribute it and/or modify it 8 * This program is free software; you can redistribute it and/or modify it
@@ -30,7 +30,7 @@ static __inline__ uint16_t qla2x00_debounce_register(volatile uint16_t __iomem *
30 * register value. 30 * register value.
31 */ 31 */
32static __inline__ uint16_t 32static __inline__ uint16_t
33qla2x00_debounce_register(volatile uint16_t __iomem *addr) 33qla2x00_debounce_register(volatile uint16_t __iomem *addr)
34{ 34{
35 volatile uint16_t first; 35 volatile uint16_t first;
36 volatile uint16_t second; 36 volatile uint16_t second;
@@ -78,7 +78,7 @@ static __inline__ int qla2x00_normalize_dma_addr(
78 * ffffabc1ffffeeee (0x100000000 + e_addr) 78 * ffffabc1ffffeeee (0x100000000 + e_addr)
79 * ffffabc100000000 (0x100000000 + e_addr) & ~(0xffffffff) 79 * ffffabc100000000 (0x100000000 + e_addr) & ~(0xffffffff)
80 * ffffabc100000000 (ne_addr) 80 * ffffabc100000000 (ne_addr)
81 * 81 *
82 * Compute length of second DMA segment: 82 * Compute length of second DMA segment:
83 * 83 *
84 * 00000000ffffeeee (e_addr & 0xffffffff) 84 * 00000000ffffeeee (e_addr & 0xffffffff)
@@ -114,77 +114,10 @@ qla2x00_normalize_dma_addr(
114} 114}
115 115
116static __inline__ void qla2x00_poll(scsi_qla_host_t *); 116static __inline__ void qla2x00_poll(scsi_qla_host_t *);
117static inline void 117static inline void
118qla2x00_poll(scsi_qla_host_t *ha) 118qla2x00_poll(scsi_qla_host_t *ha)
119{ 119{
120 if (IS_QLA2100(ha) || IS_QLA2200(ha)) 120 ha->isp_ops.intr_handler(0, ha, NULL);
121 qla2100_intr_handler(0, ha, NULL);
122 else
123 qla2300_intr_handler(0, ha, NULL);
124}
125
126
127static __inline__ void qla2x00_enable_intrs(scsi_qla_host_t *);
128static __inline__ void qla2x00_disable_intrs(scsi_qla_host_t *);
129
130static inline void
131qla2x00_enable_intrs(scsi_qla_host_t *ha)
132{
133 unsigned long flags = 0;
134 device_reg_t __iomem *reg = ha->iobase;
135
136 spin_lock_irqsave(&ha->hardware_lock, flags);
137 ha->interrupts_on = 1;
138 /* enable risc and host interrupts */
139 WRT_REG_WORD(&reg->ictrl, ICR_EN_INT | ICR_EN_RISC);
140 RD_REG_WORD(&reg->ictrl);
141 spin_unlock_irqrestore(&ha->hardware_lock, flags);
142
143}
144
145static inline void
146qla2x00_disable_intrs(scsi_qla_host_t *ha)
147{
148 unsigned long flags = 0;
149 device_reg_t __iomem *reg = ha->iobase;
150
151 spin_lock_irqsave(&ha->hardware_lock, flags);
152 ha->interrupts_on = 0;
153 /* disable risc and host interrupts */
154 WRT_REG_WORD(&reg->ictrl, 0);
155 RD_REG_WORD(&reg->ictrl);
156 spin_unlock_irqrestore(&ha->hardware_lock, flags);
157}
158
159
160static __inline__ int qla2x00_is_wwn_zero(uint8_t *);
161
162/*
163 * qla2x00_is_wwn_zero - Check for zero node name
164 *
165 * Input:
166 * wwn = Pointer to WW name to check
167 *
168 * Returns:
169 * 1 if name is 0x00 else 0
170 *
171 * Context:
172 * Kernel context.
173 */
174static __inline__ int
175qla2x00_is_wwn_zero(uint8_t *wwn)
176{
177 int cnt;
178
179 for (cnt = 0; cnt < WWN_SIZE ; cnt++, wwn++) {
180 if (*wwn != 0)
181 break;
182 }
183 /* if zero return 1 */
184 if (cnt == WWN_SIZE)
185 return (1);
186 else
187 return (0);
188} 121}
189 122
190static __inline__ void qla2x00_check_fabric_devices(scsi_qla_host_t *); 123static __inline__ void qla2x00_check_fabric_devices(scsi_qla_host_t *);
@@ -192,7 +125,7 @@ static __inline__ void qla2x00_check_fabric_devices(scsi_qla_host_t *);
192 * This routine will wait for fabric devices for 125 * This routine will wait for fabric devices for
193 * the reset delay. 126 * the reset delay.
194 */ 127 */
195static __inline__ void qla2x00_check_fabric_devices(scsi_qla_host_t *ha) 128static __inline__ void qla2x00_check_fabric_devices(scsi_qla_host_t *ha)
196{ 129{
197 uint16_t fw_state; 130 uint16_t fw_state;
198 131
@@ -225,51 +158,27 @@ qla2x00_issue_marker(scsi_qla_host_t *ha, int ha_locked)
225 return (QLA_SUCCESS); 158 return (QLA_SUCCESS);
226} 159}
227 160
228static __inline__ void qla2x00_add_timer_to_cmd(srb_t *, int); 161static inline uint8_t *host_to_fcp_swap(uint8_t *, uint32_t);
229static __inline__ void qla2x00_delete_timer_from_cmd(srb_t *); 162static inline uint8_t *
230 163host_to_fcp_swap(uint8_t *fcp, uint32_t bsize)
231/**************************************************************************
232* qla2x00_add_timer_to_cmd
233*
234* Description:
235* Creates a timer for the specified command. The timeout is usually
236* the command time from kernel minus 2 secs.
237*
238* Input:
239* sp - pointer to validate
240*
241* Returns:
242* None.
243**************************************************************************/
244static inline void
245qla2x00_add_timer_to_cmd(srb_t *sp, int timeout)
246{ 164{
247 init_timer(&sp->timer); 165 uint32_t *ifcp = (uint32_t *) fcp;
248 sp->timer.expires = jiffies + timeout * HZ; 166 uint32_t *ofcp = (uint32_t *) fcp;
249 sp->timer.data = (unsigned long) sp; 167 uint32_t iter = bsize >> 2;
250 sp->timer.function = (void (*) (unsigned long))qla2x00_cmd_timeout; 168
251 add_timer(&sp->timer); 169 for (; iter ; iter--)
170 *ofcp++ = swab32(*ifcp++);
171
172 return fcp;
252} 173}
253 174
254/************************************************************************** 175static inline int qla2x00_is_reserved_id(scsi_qla_host_t *, uint16_t);
255* qla2x00_delete_timer_from_cmd 176static inline int
256* 177qla2x00_is_reserved_id(scsi_qla_host_t *ha, uint16_t loop_id)
257* Description:
258* Delete the timer for the specified command.
259*
260* Input:
261* sp - pointer to validate
262*
263* Returns:
264* None.
265**************************************************************************/
266static inline void
267qla2x00_delete_timer_from_cmd(srb_t *sp)
268{ 178{
269 if (sp->timer.function != NULL) { 179 if (IS_QLA24XX(ha) || IS_QLA25XX(ha))
270 del_timer(&sp->timer); 180 return (loop_id > NPH_LAST_HANDLE);
271 sp->timer.function = NULL;
272 sp->timer.data = (unsigned long) NULL;
273 }
274}
275 181
182 return ((loop_id > ha->last_loop_id && loop_id < SNS_FIRST_LOOP_ID) ||
183 loop_id == MANAGEMENT_SERVER || loop_id == BROADCAST);
184};