提交 590f98e5 编写于 作者: A andrew.vasquez@qlogic.com 提交者: James Bottomley

[SCSI] qla2xxx: Collapse load RISC RAM implementations.

Simplify essentially duplicate load RISC RAM implementation
in qla2x00_load_ram_ext() and qla2x00_load_ram().
Signed-off-by: NAndrew Vasquez <andrew.vasquez@qlogic.com>
Signed-off-by: NJames Bottomley <James.Bottomley@SteelEye.com>
上级 f94097ed
......@@ -96,10 +96,7 @@ int __qla2x00_marker(scsi_qla_host_t *, uint16_t, uint16_t, uint8_t);
* Global Function Prototypes in qla_mbx.c source file.
*/
extern int
qla2x00_load_ram(scsi_qla_host_t *, dma_addr_t, uint16_t, uint16_t);
extern int
qla2x00_load_ram_ext(scsi_qla_host_t *, dma_addr_t, uint32_t, uint32_t);
qla2x00_load_ram(scsi_qla_host_t *, dma_addr_t, uint32_t, uint32_t);
extern int
qla2x00_execute_fw(scsi_qla_host_t *, uint32_t);
......
......@@ -3672,8 +3672,8 @@ qla24xx_load_risc_flash(scsi_qla_host_t *ha, uint32_t *srisc_addr)
for (i = 0; i < dlen; i++)
dcode[i] = swab32(dcode[i]);
rval = qla2x00_load_ram_ext(ha, ha->request_dma,
risc_addr, dlen);
rval = qla2x00_load_ram(ha, ha->request_dma, risc_addr,
dlen);
if (rval) {
DEBUG(printk("scsi(%ld):[ERROR] Failed to load "
"segment %d of firmware\n", ha->host_no,
......@@ -3873,8 +3873,8 @@ qla24xx_load_risc(scsi_qla_host_t *ha, uint32_t *srisc_addr)
for (i = 0; i < dlen; i++)
dcode[i] = swab32(fwcode[i]);
rval = qla2x00_load_ram_ext(ha, ha->request_dma,
risc_addr, dlen);
rval = qla2x00_load_ram(ha, ha->request_dma, risc_addr,
dlen);
if (rval) {
DEBUG(printk("scsi(%ld):[ERROR] Failed to load "
"segment %d of firmware\n", ha->host_no,
......
......@@ -327,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);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册