summaryrefslogtreecommitdiff
path: root/drivers/scsi/qla2xxx/qla_mbx.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi/qla2xxx/qla_mbx.c')
-rw-r--r--drivers/scsi/qla2xxx/qla_mbx.c107
1 files changed, 13 insertions, 94 deletions
diff --git a/drivers/scsi/qla2xxx/qla_mbx.c b/drivers/scsi/qla2xxx/qla_mbx.c
index 9746cd1e664b..3099b379de9d 100644
--- a/drivers/scsi/qla2xxx/qla_mbx.c
+++ b/drivers/scsi/qla2xxx/qla_mbx.c
@@ -196,7 +196,9 @@ qla2x00_mailbox_command(scsi_qla_host_t *ha, mbx_cmd_t *mcp)
/* Check for pending interrupts. */
qla2x00_poll(ha);
- udelay(10); /* v4.27 */
+ if (command != MBC_LOAD_RISC_RAM_EXTENDED &&
+ !ha->flags.mbox_int)
+ msleep(10);
} /* while */
}
@@ -325,113 +327,30 @@ qla2x00_mailbox_command(scsi_qla_host_t *ha, mbx_cmd_t *mcp)
return rval;
}
-/*
- * qla2x00_load_ram
- * Load adapter RAM using DMA.
- *
- * Input:
- * ha = adapter block pointer.
- *
- * Returns:
- * qla2x00 local function return status code.
- *
- * Context:
- * Kernel context.
- */
int
-qla2x00_load_ram(scsi_qla_host_t *ha, dma_addr_t req_dma, uint16_t risc_addr,
- uint16_t risc_code_size)
+qla2x00_load_ram(scsi_qla_host_t *ha, dma_addr_t req_dma, uint32_t risc_addr,
+ uint32_t risc_code_size)
{
int rval;
mbx_cmd_t mc;
mbx_cmd_t *mcp = &mc;
- uint32_t req_len;
- dma_addr_t nml_dma;
- uint32_t nml_len;
- uint32_t normalized;
-
- DEBUG11(printk("qla2x00_load_ram(%ld): entered.\n",
- ha->host_no);)
- req_len = risc_code_size;
- nml_dma = 0;
- nml_len = 0;
-
- normalized = qla2x00_normalize_dma_addr(&req_dma, &req_len, &nml_dma,
- &nml_len);
-
- /* Load first segment */
- mcp->mb[0] = MBC_LOAD_RISC_RAM;
- mcp->mb[1] = risc_addr;
- mcp->mb[2] = MSW(req_dma);
- mcp->mb[3] = LSW(req_dma);
- mcp->mb[4] = (uint16_t)req_len;
- mcp->mb[6] = MSW(MSD(req_dma));
- mcp->mb[7] = LSW(MSD(req_dma));
- mcp->out_mb = MBX_7|MBX_6|MBX_4|MBX_3|MBX_2|MBX_1|MBX_0;
- mcp->in_mb = MBX_0;
- mcp->tov = 30;
- mcp->flags = 0;
- rval = qla2x00_mailbox_command(ha, mcp);
-
- /* Load second segment - if necessary */
- if (normalized && (rval == QLA_SUCCESS)) {
- mcp->mb[0] = MBC_LOAD_RISC_RAM;
- mcp->mb[1] = risc_addr + (uint16_t)req_len;
- mcp->mb[2] = MSW(nml_dma);
- mcp->mb[3] = LSW(nml_dma);
- mcp->mb[4] = (uint16_t)nml_len;
- mcp->mb[6] = MSW(MSD(nml_dma));
- mcp->mb[7] = LSW(MSD(nml_dma));
- mcp->out_mb = MBX_7|MBX_6|MBX_4|MBX_3|MBX_2|MBX_1|MBX_0;
- mcp->in_mb = MBX_0;
- mcp->tov = 30;
- mcp->flags = 0;
- rval = qla2x00_mailbox_command(ha, mcp);
- }
+ DEBUG11(printk("%s(%ld): entered.\n", __func__, ha->host_no));
- if (rval == QLA_SUCCESS) {
- /* Empty */
- DEBUG11(printk("qla2x00_load_ram(%ld): done.\n", ha->host_no);)
+ if (MSW(risc_addr) || IS_QLA24XX(ha) || IS_QLA25XX(ha)) {
+ mcp->mb[0] = MBC_LOAD_RISC_RAM_EXTENDED;
+ mcp->mb[8] = MSW(risc_addr);
+ mcp->out_mb = MBX_8|MBX_0;
} else {
- /* Empty */
- DEBUG2_3_11(printk("qla2x00_load_ram(%ld): failed. rval=%x "
- "mb[0]=%x.\n", ha->host_no, rval, mcp->mb[0]);)
+ mcp->mb[0] = MBC_LOAD_RISC_RAM;
+ mcp->out_mb = MBX_0;
}
- return rval;
-}
-
-/*
- * qla2x00_load_ram_ext
- * Load adapter extended RAM using DMA.
- *
- * Input:
- * ha = adapter block pointer.
- *
- * Returns:
- * qla2x00 local function return status code.
- *
- * Context:
- * Kernel context.
- */
-int
-qla2x00_load_ram_ext(scsi_qla_host_t *ha, dma_addr_t req_dma,
- uint32_t risc_addr, uint32_t risc_code_size)
-{
- int rval;
- mbx_cmd_t mc;
- mbx_cmd_t *mcp = &mc;
-
- DEBUG11(printk("%s(%ld): entered.\n", __func__, ha->host_no));
-
- mcp->mb[0] = MBC_LOAD_RISC_RAM_EXTENDED;
mcp->mb[1] = LSW(risc_addr);
mcp->mb[2] = MSW(req_dma);
mcp->mb[3] = LSW(req_dma);
mcp->mb[6] = MSW(MSD(req_dma));
mcp->mb[7] = LSW(MSD(req_dma));
- mcp->mb[8] = MSW(risc_addr);
- mcp->out_mb = MBX_8|MBX_7|MBX_6|MBX_3|MBX_2|MBX_1|MBX_0;
+ mcp->out_mb |= MBX_7|MBX_6|MBX_3|MBX_2|MBX_1;
if (IS_QLA24XX(ha) || IS_QLA25XX(ha)) {
mcp->mb[4] = MSW(risc_code_size);
mcp->mb[5] = LSW(risc_code_size);