Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 360221
b: refs/heads/master
c: aa230bc
h: refs/heads/master
i:
  360219: d51f9e8
v: v3
  • Loading branch information
Arun Easi authored and James Bottomley committed Feb 22, 2013
1 parent e01bb79 commit f1be57b
Show file tree
Hide file tree
Showing 9 changed files with 188 additions and 26 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 3c290d0b5f8ff7b0fd2c964c5ec2c14191a9e790
refs/heads/master: aa230bc55c169b76a229ff3f927141edf02e7b3a
2 changes: 1 addition & 1 deletion trunk/drivers/scsi/qla2xxx/qla_dbg.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
* | MultiQ | 0xc00c | |
* | Misc | 0xd010 | |
* | Target Mode | 0xe06f | |
* | Target Mode Management | 0xf071 | |
* | Target Mode Management | 0xf072 | |
* | Target Mode Task Management | 0x1000b | |
* ----------------------------------------------------------------------
*/
Expand Down
8 changes: 8 additions & 0 deletions trunk/drivers/scsi/qla2xxx/qla_def.h
Original file line number Diff line number Diff line change
Expand Up @@ -537,6 +537,8 @@ struct device_reg_25xxmq {
uint32_t req_q_out;
uint32_t rsp_q_in;
uint32_t rsp_q_out;
uint32_t atio_q_in;
uint32_t atio_q_out;
};

typedef union {
Expand All @@ -563,6 +565,9 @@ typedef union {
&(reg)->u.isp2100.mailbox5 : \
&(reg)->u.isp2300.rsp_q_out)

#define ISP_ATIO_Q_IN(vha) (vha->hw->tgt.atio_q_in)
#define ISP_ATIO_Q_OUT(vha) (vha->hw->tgt.atio_q_out)

#define MAILBOX_REG(ha, reg, num) \
(IS_QLA2100(ha) || IS_QLA2200(ha) ? \
(num < 8 ? \
Expand Down Expand Up @@ -2559,6 +2564,8 @@ struct qlt_hw_data {
struct atio *atio_ring_ptr; /* Current address. */
uint16_t atio_ring_index; /* Current index. */
uint16_t atio_q_length;
uint32_t __iomem *atio_q_in;
uint32_t __iomem *atio_q_out;

void *target_lport_ptr;
struct qla_tgt_func_tmpl *tgt_ops;
Expand Down Expand Up @@ -2790,6 +2797,7 @@ struct qla_hw_data {
#define IS_PI_SPLIT_DET_CAPABLE_HBA(ha) (IS_QLA83XX(ha))
#define IS_PI_SPLIT_DET_CAPABLE(ha) (IS_PI_SPLIT_DET_CAPABLE_HBA(ha) && \
(((ha)->fw_attributes_h << 16 | (ha)->fw_attributes) & BIT_22))
#define IS_ATIO_MSIX_CAPABLE(ha) (IS_QLA83XX(ha))

/* HBA serial number */
uint8_t serial0;
Expand Down
3 changes: 2 additions & 1 deletion trunk/drivers/scsi/qla2xxx/qla_fw.h
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,8 @@ struct init_cb_24xx {
uint32_t prio_request_q_address[2];

uint16_t msix;
uint8_t reserved_2[6];
uint16_t msix_atio;
uint8_t reserved_2[4];

uint16_t atio_q_inpointer;
uint16_t atio_q_length;
Expand Down
6 changes: 5 additions & 1 deletion trunk/drivers/scsi/qla2xxx/qla_init.c
Original file line number Diff line number Diff line change
Expand Up @@ -1964,7 +1964,7 @@ qla24xx_config_rings(struct scsi_qla_host *vha)
WRT_REG_DWORD(&reg->isp24.rsp_q_in, 0);
WRT_REG_DWORD(&reg->isp24.rsp_q_out, 0);
}
qlt_24xx_config_rings(vha, reg);
qlt_24xx_config_rings(vha);

/* PCI posting */
RD_REG_DWORD(&ioreg->hccr);
Expand Down Expand Up @@ -5579,6 +5579,8 @@ qla81xx_nvram_config(scsi_qla_host_t *vha)
if (IS_T10_PI_CAPABLE(ha))
nv->frame_payload_size &= ~7;

qlt_81xx_config_nvram_stage1(vha, nv);

/* Reset Initialization control block */
memset(icb, 0, ha->init_cb_size);

Expand Down Expand Up @@ -5619,6 +5621,8 @@ qla81xx_nvram_config(scsi_qla_host_t *vha)
qla2x00_set_model_info(vha, nv->model_name, sizeof(nv->model_name),
"QLE8XXX");

qlt_81xx_config_nvram_stage2(vha, icb);

/* Use alternate WWN? */
if (nv->host_p & __constant_cpu_to_le32(BIT_15)) {
memcpy(icb->node_name, nv->alternate_node_name, WWN_SIZE);
Expand Down
16 changes: 14 additions & 2 deletions trunk/drivers/scsi/qla2xxx/qla_isr.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
#include <scsi/scsi_bsg_fc.h>
#include <scsi/scsi_eh.h>

#include "qla_target.h"

static void qla2x00_mbx_completion(scsi_qla_host_t *, uint16_t);
static void qla2x00_process_completed_request(struct scsi_qla_host *,
struct req_que *, uint32_t);
Expand Down Expand Up @@ -2751,6 +2753,12 @@ static struct qla_init_msix_entry qla82xx_msix_entries[2] = {
{ "qla2xxx (rsp_q)", qla82xx_msix_rsp_q },
};

static struct qla_init_msix_entry qla83xx_msix_entries[3] = {
{ "qla2xxx (default)", qla24xx_msix_default },
{ "qla2xxx (rsp_q)", qla24xx_msix_rsp_q },
{ "qla2xxx (atio_q)", qla83xx_msix_atio_q },
};

static void
qla24xx_disable_msix(struct qla_hw_data *ha)
{
Expand Down Expand Up @@ -2831,9 +2839,13 @@ qla24xx_enable_msix(struct qla_hw_data *ha, struct rsp_que *rsp)
}

/* Enable MSI-X vectors for the base queue */
for (i = 0; i < 2; i++) {
for (i = 0; i < ha->msix_count; i++) {
qentry = &ha->msix_entries[i];
if (IS_QLA82XX(ha)) {
if (QLA_TGT_MODE_ENABLED() && IS_ATIO_MSIX_CAPABLE(ha)) {
ret = request_irq(qentry->vector,
qla83xx_msix_entries[i].handler,
0, qla83xx_msix_entries[i].name, rsp);
} else if (IS_QLA82XX(ha)) {
ret = request_irq(qentry->vector,
qla82xx_msix_entries[i].handler,
0, qla82xx_msix_entries[i].name, rsp);
Expand Down
4 changes: 4 additions & 0 deletions trunk/drivers/scsi/qla2xxx/qla_os.c
Original file line number Diff line number Diff line change
Expand Up @@ -1812,6 +1812,9 @@ qla83xx_iospace_config(struct qla_hw_data *ha)

mqiobase_exit:
ha->msix_count = ha->max_rsp_queues + 1;

qlt_83xx_iospace_config(ha);

ql_dbg_pci(ql_dbg_init, ha->pdev, 0x011f,
"MSIX Count:%d.\n", ha->msix_count);
return 0;
Expand Down Expand Up @@ -2390,6 +2393,7 @@ qla2x00_probe_one(struct pci_dev *pdev, const struct pci_device_id *id)
ha->mbx_count = MAILBOX_REGISTER_COUNT;
req_length = REQUEST_ENTRY_CNT_24XX;
rsp_length = RESPONSE_ENTRY_CNT_2300;
ha->tgt.atio_q_length = ATIO_ENTRY_CNT_24XX;
ha->max_loop_id = SNS_LAST_LOOP_ID_2300;
ha->init_cb_size = sizeof(struct mid_init_cb_81xx);
ha->gid_list_info_size = 8;
Expand Down
159 changes: 143 additions & 16 deletions trunk/drivers/scsi/qla2xxx/qla_target.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ MODULE_PARM_DESC(qlini_mode,
"\"disabled\" - initiator mode will never be enabled; "
"\"enabled\" (default) - initiator mode will always stay enabled.");

static int ql2x_ini_mode = QLA2XXX_INI_MODE_EXCLUSIVE;
int ql2x_ini_mode = QLA2XXX_INI_MODE_EXCLUSIVE;

/*
* From scsi/fc/fc_fcp.h
Expand Down Expand Up @@ -1119,6 +1119,7 @@ static void qlt_send_notify_ack(struct scsi_qla_host *vha,
nack->u.isp24.srr_rx_id = ntfy->u.isp24.srr_rx_id;
nack->u.isp24.status = ntfy->u.isp24.status;
nack->u.isp24.status_subcode = ntfy->u.isp24.status_subcode;
nack->u.isp24.fw_handle = ntfy->u.isp24.fw_handle;
nack->u.isp24.exchange_address = ntfy->u.isp24.exchange_address;
nack->u.isp24.srr_rel_offs = ntfy->u.isp24.srr_rel_offs;
nack->u.isp24.srr_ui = ntfy->u.isp24.srr_ui;
Expand Down Expand Up @@ -4666,7 +4667,6 @@ void
qlt_24xx_process_atio_queue(struct scsi_qla_host *vha)
{
struct qla_hw_data *ha = vha->hw;
struct device_reg_24xx __iomem *reg = &ha->iobase->isp24;
struct atio_from_isp *pkt;
int cnt, i;

Expand Down Expand Up @@ -4694,26 +4694,28 @@ qlt_24xx_process_atio_queue(struct scsi_qla_host *vha)
}

/* Adjust ring index */
WRT_REG_DWORD(&reg->atio_q_out, ha->tgt.atio_ring_index);
WRT_REG_DWORD(ISP_ATIO_Q_OUT(vha), ha->tgt.atio_ring_index);
}

void
qlt_24xx_config_rings(struct scsi_qla_host *vha, device_reg_t __iomem *reg)
qlt_24xx_config_rings(struct scsi_qla_host *vha)
{
struct qla_hw_data *ha = vha->hw;
if (!QLA_TGT_MODE_ENABLED())
return;

/* FIXME: atio_q in/out for ha->mqenable=1..? */
if (ha->mqenable) {
#if 0
WRT_REG_DWORD(&reg->isp25mq.atio_q_in, 0);
WRT_REG_DWORD(&reg->isp25mq.atio_q_out, 0);
RD_REG_DWORD(&reg->isp25mq.atio_q_out);
#endif
} else {
/* Setup APTIO registers for target mode */
WRT_REG_DWORD(&reg->isp24.atio_q_in, 0);
WRT_REG_DWORD(&reg->isp24.atio_q_out, 0);
RD_REG_DWORD(&reg->isp24.atio_q_out);
WRT_REG_DWORD(ISP_ATIO_Q_IN(vha), 0);
WRT_REG_DWORD(ISP_ATIO_Q_OUT(vha), 0);
RD_REG_DWORD(ISP_ATIO_Q_OUT(vha));

if (IS_ATIO_MSIX_CAPABLE(ha)) {
struct qla_msix_entry *msix = &ha->msix_entries[2];
struct init_cb_24xx *icb = (struct init_cb_24xx *)ha->init_cb;

icb->msix_atio = cpu_to_le16(msix->entry);
ql_dbg(ql_dbg_init, vha, 0xf072,
"Registering ICB vector 0x%x for atio que.\n",
msix->entry);
}
}

Expand Down Expand Up @@ -4796,6 +4798,101 @@ qlt_24xx_config_nvram_stage2(struct scsi_qla_host *vha,
}
}

void
qlt_81xx_config_nvram_stage1(struct scsi_qla_host *vha, struct nvram_81xx *nv)
{
struct qla_hw_data *ha = vha->hw;

if (!QLA_TGT_MODE_ENABLED())
return;

if (qla_tgt_mode_enabled(vha)) {
if (!ha->tgt.saved_set) {
/* We save only once */
ha->tgt.saved_exchange_count = nv->exchange_count;
ha->tgt.saved_firmware_options_1 =
nv->firmware_options_1;
ha->tgt.saved_firmware_options_2 =
nv->firmware_options_2;
ha->tgt.saved_firmware_options_3 =
nv->firmware_options_3;
ha->tgt.saved_set = 1;
}

nv->exchange_count = __constant_cpu_to_le16(0xFFFF);

/* Enable target mode */
nv->firmware_options_1 |= __constant_cpu_to_le32(BIT_4);

/* Disable ini mode, if requested */
if (!qla_ini_mode_enabled(vha))
nv->firmware_options_1 |=
__constant_cpu_to_le32(BIT_5);

/* Disable Full Login after LIP */
nv->firmware_options_1 &= __constant_cpu_to_le32(~BIT_13);
/* Enable initial LIP */
nv->firmware_options_1 &= __constant_cpu_to_le32(~BIT_9);
/* Enable FC tapes support */
nv->firmware_options_2 |= __constant_cpu_to_le32(BIT_12);
/* Disable Full Login after LIP */
nv->host_p &= __constant_cpu_to_le32(~BIT_10);
/* Enable target PRLI control */
nv->firmware_options_2 |= __constant_cpu_to_le32(BIT_14);
} else {
if (ha->tgt.saved_set) {
nv->exchange_count = ha->tgt.saved_exchange_count;
nv->firmware_options_1 =
ha->tgt.saved_firmware_options_1;
nv->firmware_options_2 =
ha->tgt.saved_firmware_options_2;
nv->firmware_options_3 =
ha->tgt.saved_firmware_options_3;
}
return;
}

/* out-of-order frames reassembly */
nv->firmware_options_3 |= BIT_6|BIT_9;

if (ha->tgt.enable_class_2) {
if (vha->flags.init_done)
fc_host_supported_classes(vha->host) =
FC_COS_CLASS2 | FC_COS_CLASS3;

nv->firmware_options_2 |= __constant_cpu_to_le32(BIT_8);
} else {
if (vha->flags.init_done)
fc_host_supported_classes(vha->host) = FC_COS_CLASS3;

nv->firmware_options_2 &= ~__constant_cpu_to_le32(BIT_8);
}
}

void
qlt_81xx_config_nvram_stage2(struct scsi_qla_host *vha,
struct init_cb_81xx *icb)
{
struct qla_hw_data *ha = vha->hw;

if (!QLA_TGT_MODE_ENABLED())
return;

if (ha->tgt.node_name_set) {
memcpy(icb->node_name, ha->tgt.tgt_node_name, WWN_SIZE);
icb->firmware_options_1 |= __constant_cpu_to_le32(BIT_14);
}
}

void
qlt_83xx_iospace_config(struct qla_hw_data *ha)
{
if (!QLA_TGT_MODE_ENABLED())
return;

ha->msix_count += 1; /* For ATIO Q */
}

int
qlt_24xx_process_response_error(struct scsi_qla_host *vha,
struct sts_entry_24xx *pkt)
Expand Down Expand Up @@ -4828,11 +4925,41 @@ qlt_probe_one_stage1(struct scsi_qla_host *base_vha, struct qla_hw_data *ha)
if (!QLA_TGT_MODE_ENABLED())
return;

if (ha->mqenable || IS_QLA83XX(ha)) {
ISP_ATIO_Q_IN(base_vha) = &ha->mqiobase->isp25mq.atio_q_in;
ISP_ATIO_Q_OUT(base_vha) = &ha->mqiobase->isp25mq.atio_q_out;
} else {
ISP_ATIO_Q_IN(base_vha) = &ha->iobase->isp24.atio_q_in;
ISP_ATIO_Q_OUT(base_vha) = &ha->iobase->isp24.atio_q_out;
}

mutex_init(&ha->tgt.tgt_mutex);
mutex_init(&ha->tgt.tgt_host_action_mutex);
qlt_clear_mode(base_vha);
}

irqreturn_t
qla83xx_msix_atio_q(int irq, void *dev_id)
{
struct rsp_que *rsp;
scsi_qla_host_t *vha;
struct qla_hw_data *ha;
unsigned long flags;

rsp = (struct rsp_que *) dev_id;
ha = rsp->hw;
vha = pci_get_drvdata(ha->pdev);

spin_lock_irqsave(&ha->hardware_lock, flags);

qlt_24xx_process_atio_queue(vha);
qla24xx_process_response_queue(vha, rsp);

spin_unlock_irqrestore(&ha->hardware_lock, flags);

return IRQ_HANDLED;
}

int
qlt_mem_alloc(struct qla_hw_data *ha)
{
Expand Down
Loading

0 comments on commit f1be57b

Please sign in to comment.