Skip to content

Commit afaf5a2

Browse files
David SomayajuluJames Bottomley
authored andcommitted
[SCSI] Initial Commit of qla4xxx
open-iSCSI driver for Qlogic Corporation's iSCSI HBAs Signed-off-by: Ravi Anand <[email protected]> Signed-off-by: David Somayajulu <[email protected]> Signed-off-by: Doug Maxey <[email protected]> Signed-off-by: Mike Christie <[email protected]> Signed-off-by: James Bottomley <[email protected]>
1 parent ed542be commit afaf5a2

File tree

18 files changed

+7540
-0
lines changed

18 files changed

+7540
-0
lines changed

drivers/scsi/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1244,6 +1244,7 @@ config SCSI_QLOGICPTI
12441244
module will be called qlogicpti.
12451245

12461246
source "drivers/scsi/qla2xxx/Kconfig"
1247+
source "drivers/scsi/qla4xxx/Kconfig"
12471248

12481249
config SCSI_LPFC
12491250
tristate "Emulex LightPulse Fibre Channel Support"

drivers/scsi/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ obj-$(CONFIG_SCSI_QLOGIC_FAS) += qlogicfas408.o qlogicfas.o
8484
obj-$(CONFIG_PCMCIA_QLOGIC) += qlogicfas408.o
8585
obj-$(CONFIG_SCSI_QLOGIC_1280) += qla1280.o
8686
obj-$(CONFIG_SCSI_QLA_FC) += qla2xxx/
87+
obj-$(CONFIG_SCSI_QLA_ISCSI) += qla4xxx/
8788
obj-$(CONFIG_SCSI_LPFC) += lpfc/
8889
obj-$(CONFIG_SCSI_PAS16) += pas16.o
8990
obj-$(CONFIG_SCSI_SEAGATE) += seagate.o

drivers/scsi/qla4xxx/Kconfig

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
config SCSI_QLA_ISCSI
2+
tristate "QLogic ISP4XXX host adapter family support"
3+
depends on PCI && SCSI
4+
select SCSI_ISCSI_ATTRS
5+
---help---
6+
This driver supports the QLogic 40xx (ISP4XXX) iSCSI host
7+
adapter family.

drivers/scsi/qla4xxx/Makefile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
qla4xxx-y := ql4_os.o ql4_init.o ql4_mbx.o ql4_iocb.o ql4_isr.o \
2+
ql4_nvram.o ql4_dbg.o
3+
4+
obj-$(CONFIG_SCSI_QLA_ISCSI) += qla4xxx.o
5+

drivers/scsi/qla4xxx/ql4_dbg.c

Lines changed: 197 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,197 @@
1+
/*
2+
* QLogic iSCSI HBA Driver
3+
* Copyright (c) 2003-2006 QLogic Corporation
4+
*
5+
* See LICENSE.qla4xxx for copyright and licensing details.
6+
*/
7+
8+
#include "ql4_def.h"
9+
#include <scsi/scsi_dbg.h>
10+
11+
static void qla4xxx_print_srb_info(struct srb * srb)
12+
{
13+
printk("%s: srb = 0x%p, flags=0x%02x\n", __func__, srb, srb->flags);
14+
printk("%s: cmd = 0x%p, saved_dma_handle = 0x%lx\n",
15+
__func__, srb->cmd, (unsigned long) srb->dma_handle);
16+
printk("%s: fw_ddb_index = %d, lun = %d\n",
17+
__func__, srb->fw_ddb_index, srb->cmd->device->lun);
18+
printk("%s: iocb_tov = %d\n",
19+
__func__, srb->iocb_tov);
20+
printk("%s: cc_stat = 0x%x, r_start = 0x%lx, u_start = 0x%lx\n\n",
21+
__func__, srb->cc_stat, srb->r_start, srb->u_start);
22+
}
23+
24+
void qla4xxx_print_scsi_cmd(struct scsi_cmnd *cmd)
25+
{
26+
printk("SCSI Command = 0x%p, Handle=0x%p\n", cmd, cmd->host_scribble);
27+
printk(" b=%d, t=%02xh, l=%02xh, cmd_len = %02xh\n",
28+
cmd->device->channel, cmd->device->id, cmd->device->lun,
29+
cmd->cmd_len);
30+
scsi_print_command(cmd);
31+
printk(" seg_cnt = %d\n", cmd->use_sg);
32+
printk(" request buffer = 0x%p, request buffer len = 0x%x\n",
33+
cmd->request_buffer, cmd->request_bufflen);
34+
if (cmd->use_sg) {
35+
struct scatterlist *sg;
36+
sg = (struct scatterlist *)cmd->request_buffer;
37+
printk(" SG buffer: \n");
38+
qla4xxx_dump_buffer((caddr_t) sg,
39+
(cmd->use_sg * sizeof(*sg)));
40+
}
41+
printk(" tag = %d, transfersize = 0x%x \n", cmd->tag,
42+
cmd->transfersize);
43+
printk(" Pid = %d, SP = 0x%p\n", (int)cmd->pid, cmd->SCp.ptr);
44+
printk(" underflow size = 0x%x, direction=0x%x\n", cmd->underflow,
45+
cmd->sc_data_direction);
46+
printk(" Current time (jiffies) = 0x%lx, "
47+
"timeout expires = 0x%lx\n", jiffies, cmd->eh_timeout.expires);
48+
qla4xxx_print_srb_info((struct srb *) cmd->SCp.ptr);
49+
}
50+
51+
void __dump_registers(struct scsi_qla_host *ha)
52+
{
53+
uint8_t i;
54+
for (i = 0; i < MBOX_REG_COUNT; i++) {
55+
printk(KERN_INFO "0x%02X mailbox[%d] = 0x%08X\n",
56+
(uint8_t) offsetof(struct isp_reg, mailbox[i]), i,
57+
readw(&ha->reg->mailbox[i]));
58+
}
59+
printk(KERN_INFO "0x%02X flash_address = 0x%08X\n",
60+
(uint8_t) offsetof(struct isp_reg, flash_address),
61+
readw(&ha->reg->flash_address));
62+
printk(KERN_INFO "0x%02X flash_data = 0x%08X\n",
63+
(uint8_t) offsetof(struct isp_reg, flash_data),
64+
readw(&ha->reg->flash_data));
65+
printk(KERN_INFO "0x%02X ctrl_status = 0x%08X\n",
66+
(uint8_t) offsetof(struct isp_reg, ctrl_status),
67+
readw(&ha->reg->ctrl_status));
68+
if (is_qla4010(ha)) {
69+
printk(KERN_INFO "0x%02X nvram = 0x%08X\n",
70+
(uint8_t) offsetof(struct isp_reg, u1.isp4010.nvram),
71+
readw(&ha->reg->u1.isp4010.nvram));
72+
}
73+
74+
else if (is_qla4022(ha)) {
75+
printk(KERN_INFO "0x%02X intr_mask = 0x%08X\n",
76+
(uint8_t) offsetof(struct isp_reg,
77+
u1.isp4022.intr_mask),
78+
readw(&ha->reg->u1.isp4022.intr_mask));
79+
printk(KERN_INFO "0x%02X nvram = 0x%08X\n",
80+
(uint8_t) offsetof(struct isp_reg, u1.isp4022.nvram),
81+
readw(&ha->reg->u1.isp4022.nvram));
82+
printk(KERN_INFO "0x%02X semaphore = 0x%08X\n",
83+
(uint8_t) offsetof(struct isp_reg,
84+
u1.isp4022.semaphore),
85+
readw(&ha->reg->u1.isp4022.semaphore));
86+
}
87+
printk(KERN_INFO "0x%02X req_q_in = 0x%08X\n",
88+
(uint8_t) offsetof(struct isp_reg, req_q_in),
89+
readw(&ha->reg->req_q_in));
90+
printk(KERN_INFO "0x%02X rsp_q_out = 0x%08X\n",
91+
(uint8_t) offsetof(struct isp_reg, rsp_q_out),
92+
readw(&ha->reg->rsp_q_out));
93+
if (is_qla4010(ha)) {
94+
printk(KERN_INFO "0x%02X ext_hw_conf = 0x%08X\n",
95+
(uint8_t) offsetof(struct isp_reg,
96+
u2.isp4010.ext_hw_conf),
97+
readw(&ha->reg->u2.isp4010.ext_hw_conf));
98+
printk(KERN_INFO "0x%02X port_ctrl = 0x%08X\n",
99+
(uint8_t) offsetof(struct isp_reg,
100+
u2.isp4010.port_ctrl),
101+
readw(&ha->reg->u2.isp4010.port_ctrl));
102+
printk(KERN_INFO "0x%02X port_status = 0x%08X\n",
103+
(uint8_t) offsetof(struct isp_reg,
104+
u2.isp4010.port_status),
105+
readw(&ha->reg->u2.isp4010.port_status));
106+
printk(KERN_INFO "0x%02X req_q_out = 0x%08X\n",
107+
(uint8_t) offsetof(struct isp_reg,
108+
u2.isp4010.req_q_out),
109+
readw(&ha->reg->u2.isp4010.req_q_out));
110+
printk(KERN_INFO "0x%02X gp_out = 0x%08X\n",
111+
(uint8_t) offsetof(struct isp_reg, u2.isp4010.gp_out),
112+
readw(&ha->reg->u2.isp4010.gp_out));
113+
printk(KERN_INFO "0x%02X gp_in = 0x%08X\n",
114+
(uint8_t) offsetof(struct isp_reg, u2.isp4010.gp_in),
115+
readw(&ha->reg->u2.isp4010.gp_in));
116+
printk(KERN_INFO "0x%02X port_err_status = 0x%08X\n",
117+
(uint8_t) offsetof(struct isp_reg,
118+
u2.isp4010.port_err_status),
119+
readw(&ha->reg->u2.isp4010.port_err_status));
120+
}
121+
122+
else if (is_qla4022(ha)) {
123+
printk(KERN_INFO "Page 0 Registers:\n");
124+
printk(KERN_INFO "0x%02X ext_hw_conf = 0x%08X\n",
125+
(uint8_t) offsetof(struct isp_reg,
126+
u2.isp4022.p0.ext_hw_conf),
127+
readw(&ha->reg->u2.isp4022.p0.ext_hw_conf));
128+
printk(KERN_INFO "0x%02X port_ctrl = 0x%08X\n",
129+
(uint8_t) offsetof(struct isp_reg,
130+
u2.isp4022.p0.port_ctrl),
131+
readw(&ha->reg->u2.isp4022.p0.port_ctrl));
132+
printk(KERN_INFO "0x%02X port_status = 0x%08X\n",
133+
(uint8_t) offsetof(struct isp_reg,
134+
u2.isp4022.p0.port_status),
135+
readw(&ha->reg->u2.isp4022.p0.port_status));
136+
printk(KERN_INFO "0x%02X gp_out = 0x%08X\n",
137+
(uint8_t) offsetof(struct isp_reg,
138+
u2.isp4022.p0.gp_out),
139+
readw(&ha->reg->u2.isp4022.p0.gp_out));
140+
printk(KERN_INFO "0x%02X gp_in = 0x%08X\n",
141+
(uint8_t) offsetof(struct isp_reg, u2.isp4022.p0.gp_in),
142+
readw(&ha->reg->u2.isp4022.p0.gp_in));
143+
printk(KERN_INFO "0x%02X port_err_status = 0x%08X\n",
144+
(uint8_t) offsetof(struct isp_reg,
145+
u2.isp4022.p0.port_err_status),
146+
readw(&ha->reg->u2.isp4022.p0.port_err_status));
147+
printk(KERN_INFO "Page 1 Registers:\n");
148+
writel(HOST_MEM_CFG_PAGE & set_rmask(CSR_SCSI_PAGE_SELECT),
149+
&ha->reg->ctrl_status);
150+
printk(KERN_INFO "0x%02X req_q_out = 0x%08X\n",
151+
(uint8_t) offsetof(struct isp_reg,
152+
u2.isp4022.p1.req_q_out),
153+
readw(&ha->reg->u2.isp4022.p1.req_q_out));
154+
writel(PORT_CTRL_STAT_PAGE & set_rmask(CSR_SCSI_PAGE_SELECT),
155+
&ha->reg->ctrl_status);
156+
}
157+
}
158+
159+
void qla4xxx_dump_mbox_registers(struct scsi_qla_host *ha)
160+
{
161+
unsigned long flags = 0;
162+
int i = 0;
163+
spin_lock_irqsave(&ha->hardware_lock, flags);
164+
for (i = 1; i < MBOX_REG_COUNT; i++)
165+
printk(KERN_INFO " Mailbox[%d] = %08x\n", i,
166+
readw(&ha->reg->mailbox[i]));
167+
spin_unlock_irqrestore(&ha->hardware_lock, flags);
168+
}
169+
170+
void qla4xxx_dump_registers(struct scsi_qla_host *ha)
171+
{
172+
unsigned long flags = 0;
173+
spin_lock_irqsave(&ha->hardware_lock, flags);
174+
__dump_registers(ha);
175+
spin_unlock_irqrestore(&ha->hardware_lock, flags);
176+
}
177+
178+
void qla4xxx_dump_buffer(void *b, uint32_t size)
179+
{
180+
uint32_t cnt;
181+
uint8_t *c = b;
182+
183+
printk(" 0 1 2 3 4 5 6 7 8 9 Ah Bh Ch Dh Eh "
184+
"Fh\n");
185+
printk("------------------------------------------------------------"
186+
"--\n");
187+
for (cnt = 0; cnt < size; cnt++, c++) {
188+
printk(KERN_DEBUG "%02x", *c);
189+
if (!(cnt % 16))
190+
printk(KERN_DEBUG "\n");
191+
192+
else
193+
printk(KERN_DEBUG " ");
194+
}
195+
if (cnt % 16)
196+
printk(KERN_DEBUG "\n");
197+
}

drivers/scsi/qla4xxx/ql4_dbg.h

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
/*
2+
* QLogic iSCSI HBA Driver
3+
* Copyright (c) 2003-2006 QLogic Corporation
4+
*
5+
* See LICENSE.qla4xxx for copyright and licensing details.
6+
*/
7+
8+
/*
9+
* Driver debug definitions.
10+
*/
11+
/* #define QL_DEBUG */ /* DEBUG messages */
12+
/* #define QL_DEBUG_LEVEL_3 */ /* Output function tracing */
13+
/* #define QL_DEBUG_LEVEL_4 */
14+
/* #define QL_DEBUG_LEVEL_5 */
15+
/* #define QL_DEBUG_LEVEL_9 */
16+
17+
#define QL_DEBUG_LEVEL_2 /* ALways enable error messagess */
18+
#if defined(QL_DEBUG)
19+
#define DEBUG(x) do {x;} while (0);
20+
#else
21+
#define DEBUG(x) do {} while (0);
22+
#endif
23+
24+
#if defined(QL_DEBUG_LEVEL_2)
25+
#define DEBUG2(x) do {if(extended_error_logging == 2) x;} while (0);
26+
#define DEBUG2_3(x) do {x;} while (0);
27+
#else /* */
28+
#define DEBUG2(x) do {} while (0);
29+
#endif /* */
30+
31+
#if defined(QL_DEBUG_LEVEL_3)
32+
#define DEBUG3(x) do {if(extended_error_logging == 3) x;} while (0);
33+
#else /* */
34+
#define DEBUG3(x) do {} while (0);
35+
#if !defined(QL_DEBUG_LEVEL_2)
36+
#define DEBUG2_3(x) do {} while (0);
37+
#endif /* */
38+
#endif /* */
39+
#if defined(QL_DEBUG_LEVEL_4)
40+
#define DEBUG4(x) do {x;} while (0);
41+
#else /* */
42+
#define DEBUG4(x) do {} while (0);
43+
#endif /* */
44+
45+
#if defined(QL_DEBUG_LEVEL_5)
46+
#define DEBUG5(x) do {x;} while (0);
47+
#else /* */
48+
#define DEBUG5(x) do {} while (0);
49+
#endif /* */
50+
51+
#if defined(QL_DEBUG_LEVEL_9)
52+
#define DEBUG9(x) do {x;} while (0);
53+
#else /* */
54+
#define DEBUG9(x) do {} while (0);
55+
#endif /* */

0 commit comments

Comments
 (0)