Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

scsi: pm8001: Simplify pm8001_mpi_build_cmd() interface

There is no need to pass a pointer to a struct inbound_queue_table to
pm8001_mpi_build_cmd(). Passing the start index in the inbound queue table
of the adapter is enough. This change allows avoiding the declaration of a
struct inbound_queue_table pointer (circularQ variables) in many functions,
simplifying the code.

While at it, blank lines are added i(e.g. after local variable
declarations) to make the code more readable.

Link: https://lore.kernel.org/r/20220220031810.738362-28-damien.lemoal@opensource.wdc.com
Reviewed-by: Jack Wang <jinpu.wang@ionos.com>
Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>

authored by

Damien Le Moal and committed by
Martin K. Petersen
f91767a3 99df0edb

+89 -166
+56 -98
drivers/scsi/pm8001/pm8001_hwi.c
··· 1309 1309 * pm8001_mpi_build_cmd- build the message queue for transfer, update the PI to 1310 1310 * FW to tell the fw to get this message from IOMB. 1311 1311 * @pm8001_ha: our hba card information 1312 - * @circularQ: the inbound queue we want to transfer to HBA. 1312 + * @q_index: the index in the inbound queue we want to transfer to HBA. 1313 1313 * @opCode: the operation code represents commands which LLDD and fw recognized. 1314 1314 * @payload: the command payload of each operation command. 1315 1315 * @nb: size in bytes of the command payload 1316 1316 * @responseQueue: queue to interrupt on w/ command response (if any) 1317 1317 */ 1318 1318 int pm8001_mpi_build_cmd(struct pm8001_hba_info *pm8001_ha, 1319 - struct inbound_queue_table *circularQ, 1320 - u32 opCode, void *payload, size_t nb, 1319 + u32 q_index, u32 opCode, void *payload, size_t nb, 1321 1320 u32 responseQueue) 1322 1321 { 1323 1322 u32 Header = 0, hpriority = 0, bc = 1, category = 0x02; 1324 1323 void *pMessage; 1325 1324 unsigned long flags; 1326 - int q_index = circularQ - pm8001_ha->inbnd_q_tbl; 1325 + struct inbound_queue_table *circularQ = &pm8001_ha->inbnd_q_tbl[q_index]; 1327 1326 int rv; 1328 1327 u32 htag = le32_to_cpu(*(__le32 *)payload); 1329 1328 ··· 1751 1752 struct pm8001_ccb_info *ccb; 1752 1753 struct sas_task *task = NULL; 1753 1754 struct task_abort_req task_abort; 1754 - struct inbound_queue_table *circularQ; 1755 1755 u32 opc = OPC_INB_SATA_ABORT; 1756 1756 int ret; 1757 1757 ··· 1773 1775 return; 1774 1776 } 1775 1777 1776 - circularQ = &pm8001_ha->inbnd_q_tbl[0]; 1777 - 1778 1778 memset(&task_abort, 0, sizeof(task_abort)); 1779 1779 task_abort.abort_all = cpu_to_le32(1); 1780 1780 task_abort.device_id = cpu_to_le32(pm8001_ha_dev->device_id); 1781 1781 task_abort.tag = cpu_to_le32(ccb->ccb_tag); 1782 1782 1783 - ret = pm8001_mpi_build_cmd(pm8001_ha, circularQ, opc, &task_abort, 1784 - sizeof(task_abort), 0); 1783 + ret = pm8001_mpi_build_cmd(pm8001_ha, 0, opc, &task_abort, 1784 + sizeof(task_abort), 0); 1785 1785 if (ret) { 1786 1786 sas_free_task(task); 1787 1787 pm8001_ccb_free(pm8001_ha, ccb); ··· 1795 1799 struct sas_task *task = NULL; 1796 1800 struct host_to_dev_fis fis; 1797 1801 struct domain_device *dev; 1798 - struct inbound_queue_table *circularQ; 1799 1802 u32 opc = OPC_INB_SATA_HOST_OPSTART; 1800 1803 1801 1804 task = sas_alloc_slow_task(GFP_ATOMIC); 1802 - 1803 1805 if (!task) { 1804 1806 pm8001_dbg(pm8001_ha, FAIL, "cannot allocate task !!!\n"); 1805 1807 return; ··· 1828 1834 pm8001_ha_dev->id |= NCQ_READ_LOG_FLAG; 1829 1835 pm8001_ha_dev->id |= NCQ_2ND_RLE_FLAG; 1830 1836 1831 - memset(&sata_cmd, 0, sizeof(sata_cmd)); 1832 - circularQ = &pm8001_ha->inbnd_q_tbl[0]; 1833 - 1834 1837 /* construct read log FIS */ 1835 1838 memset(&fis, 0, sizeof(struct host_to_dev_fis)); 1836 1839 fis.fis_type = 0x27; ··· 1836 1845 fis.lbal = 0x10; 1837 1846 fis.sector_count = 0x1; 1838 1847 1848 + memset(&sata_cmd, 0, sizeof(sata_cmd)); 1839 1849 sata_cmd.tag = cpu_to_le32(ccb->ccb_tag); 1840 1850 sata_cmd.device_id = cpu_to_le32(pm8001_ha_dev->device_id); 1841 1851 sata_cmd.ncqtag_atap_dir_m = cpu_to_le32((0x1 << 7) | (0x5 << 9)); 1842 1852 memcpy(&sata_cmd.sata_fis, &fis, sizeof(struct host_to_dev_fis)); 1843 1853 1844 - res = pm8001_mpi_build_cmd(pm8001_ha, circularQ, opc, &sata_cmd, 1845 - sizeof(sata_cmd), 0); 1854 + res = pm8001_mpi_build_cmd(pm8001_ha, 0, opc, &sata_cmd, 1855 + sizeof(sata_cmd), 0); 1846 1856 if (res) { 1847 1857 sas_free_task(task); 1848 1858 pm8001_ccb_free(pm8001_ha, ccb); ··· 3253 3261 struct hw_event_ack_req payload; 3254 3262 u32 opc = OPC_INB_SAS_HW_EVENT_ACK; 3255 3263 3256 - struct inbound_queue_table *circularQ; 3257 - 3258 3264 memset((u8 *)&payload, 0, sizeof(payload)); 3259 - circularQ = &pm8001_ha->inbnd_q_tbl[Qnum]; 3260 3265 payload.tag = cpu_to_le32(1); 3261 3266 payload.sea_phyid_portid = cpu_to_le32(((SEA & 0xFFFF) << 8) | 3262 3267 ((phyId & 0x0F) << 4) | (port_id & 0x0F)); 3263 3268 payload.param0 = cpu_to_le32(param0); 3264 3269 payload.param1 = cpu_to_le32(param1); 3265 - pm8001_mpi_build_cmd(pm8001_ha, circularQ, opc, &payload, 3266 - sizeof(payload), 0); 3270 + 3271 + pm8001_mpi_build_cmd(pm8001_ha, Qnum, opc, &payload, sizeof(payload), 0); 3267 3272 } 3268 3273 3269 3274 static int pm8001_chip_phy_ctl_req(struct pm8001_hba_info *pm8001_ha, ··· 4092 4103 u32 req_len, resp_len; 4093 4104 struct smp_req smp_cmd; 4094 4105 u32 opc; 4095 - struct inbound_queue_table *circularQ; 4096 4106 4097 4107 memset(&smp_cmd, 0, sizeof(smp_cmd)); 4098 4108 /* ··· 4117 4129 } 4118 4130 4119 4131 opc = OPC_INB_SMP_REQUEST; 4120 - circularQ = &pm8001_ha->inbnd_q_tbl[0]; 4121 4132 smp_cmd.tag = cpu_to_le32(ccb->ccb_tag); 4122 4133 smp_cmd.long_smp_req.long_req_addr = 4123 4134 cpu_to_le64((u64)sg_dma_address(&task->smp_task.smp_req)); ··· 4127 4140 smp_cmd.long_smp_req.long_resp_size = 4128 4141 cpu_to_le32((u32)sg_dma_len(&task->smp_task.smp_resp)-4); 4129 4142 build_smp_cmd(pm8001_dev->device_id, smp_cmd.tag, &smp_cmd); 4130 - rc = pm8001_mpi_build_cmd(pm8001_ha, circularQ, opc, 4131 - &smp_cmd, sizeof(smp_cmd), 0); 4143 + rc = pm8001_mpi_build_cmd(pm8001_ha, 0, opc, 4144 + &smp_cmd, sizeof(smp_cmd), 0); 4132 4145 if (rc) 4133 4146 goto err_out_2; 4134 4147 ··· 4156 4169 struct pm8001_device *pm8001_dev = dev->lldd_dev; 4157 4170 struct ssp_ini_io_start_req ssp_cmd; 4158 4171 u32 tag = ccb->ccb_tag; 4159 - int ret; 4160 4172 u64 phys_addr; 4161 - struct inbound_queue_table *circularQ; 4162 4173 u32 opc = OPC_INB_SSPINIIOSTART; 4163 4174 memset(&ssp_cmd, 0, sizeof(ssp_cmd)); 4164 4175 memcpy(ssp_cmd.ssp_iu.lun, task->ssp_task.LUN, 8); ··· 4172 4187 ssp_cmd.ssp_iu.efb_prio_attr |= (task->ssp_task.task_attr & 7); 4173 4188 memcpy(ssp_cmd.ssp_iu.cdb, task->ssp_task.cmd->cmnd, 4174 4189 task->ssp_task.cmd->cmd_len); 4175 - circularQ = &pm8001_ha->inbnd_q_tbl[0]; 4176 4190 4177 4191 /* fill in PRD (scatter/gather) table, if any */ 4178 4192 if (task->num_scatter > 1) { ··· 4192 4208 ssp_cmd.len = cpu_to_le32(task->total_xfer_len); 4193 4209 ssp_cmd.esgl = 0; 4194 4210 } 4195 - ret = pm8001_mpi_build_cmd(pm8001_ha, circularQ, opc, &ssp_cmd, 4196 - sizeof(ssp_cmd), 0); 4197 - return ret; 4211 + 4212 + return pm8001_mpi_build_cmd(pm8001_ha, 0, opc, &ssp_cmd, 4213 + sizeof(ssp_cmd), 0); 4198 4214 } 4199 4215 4200 4216 static int pm8001_chip_sata_req(struct pm8001_hba_info *pm8001_ha, ··· 4204 4220 struct domain_device *dev = task->dev; 4205 4221 struct pm8001_device *pm8001_ha_dev = dev->lldd_dev; 4206 4222 u32 tag = ccb->ccb_tag; 4207 - int ret; 4208 4223 struct sata_start_req sata_cmd; 4209 4224 u32 hdr_tag, ncg_tag = 0; 4210 4225 u64 phys_addr; 4211 4226 u32 ATAP = 0x0; 4212 4227 u32 dir; 4213 - struct inbound_queue_table *circularQ; 4214 4228 unsigned long flags; 4215 4229 u32 opc = OPC_INB_SATA_HOST_OPSTART; 4230 + 4216 4231 memset(&sata_cmd, 0, sizeof(sata_cmd)); 4217 - circularQ = &pm8001_ha->inbnd_q_tbl[0]; 4218 4232 4219 4233 if (task->data_dir == DMA_NONE && !task->ata_task.use_ncq) { 4220 4234 ATAP = 0x04; /* no data*/ ··· 4298 4316 } 4299 4317 } 4300 4318 4301 - ret = pm8001_mpi_build_cmd(pm8001_ha, circularQ, opc, &sata_cmd, 4302 - sizeof(sata_cmd), 0); 4303 - return ret; 4319 + return pm8001_mpi_build_cmd(pm8001_ha, 0, opc, &sata_cmd, 4320 + sizeof(sata_cmd), 0); 4304 4321 } 4305 4322 4306 4323 /** ··· 4311 4330 pm8001_chip_phy_start_req(struct pm8001_hba_info *pm8001_ha, u8 phy_id) 4312 4331 { 4313 4332 struct phy_start_req payload; 4314 - struct inbound_queue_table *circularQ; 4315 - int ret; 4316 4333 u32 tag = 0x01; 4317 4334 u32 opcode = OPC_INB_PHYSTART; 4318 - circularQ = &pm8001_ha->inbnd_q_tbl[0]; 4335 + 4319 4336 memset(&payload, 0, sizeof(payload)); 4320 4337 payload.tag = cpu_to_le32(tag); 4321 4338 /* ··· 4330 4351 memcpy(payload.sas_identify.sas_addr, 4331 4352 pm8001_ha->sas_addr, SAS_ADDR_SIZE); 4332 4353 payload.sas_identify.phy_id = phy_id; 4333 - ret = pm8001_mpi_build_cmd(pm8001_ha, circularQ, opcode, &payload, 4334 - sizeof(payload), 0); 4335 - return ret; 4354 + 4355 + return pm8001_mpi_build_cmd(pm8001_ha, 0, opcode, &payload, 4356 + sizeof(payload), 0); 4336 4357 } 4337 4358 4338 4359 /** ··· 4344 4365 u8 phy_id) 4345 4366 { 4346 4367 struct phy_stop_req payload; 4347 - struct inbound_queue_table *circularQ; 4348 - int ret; 4349 4368 u32 tag = 0x01; 4350 4369 u32 opcode = OPC_INB_PHYSTOP; 4351 - circularQ = &pm8001_ha->inbnd_q_tbl[0]; 4370 + 4352 4371 memset(&payload, 0, sizeof(payload)); 4353 4372 payload.tag = cpu_to_le32(tag); 4354 4373 payload.phy_id = cpu_to_le32(phy_id); 4355 - ret = pm8001_mpi_build_cmd(pm8001_ha, circularQ, opcode, &payload, 4356 - sizeof(payload), 0); 4357 - return ret; 4374 + 4375 + return pm8001_mpi_build_cmd(pm8001_ha, 0, opcode, &payload, 4376 + sizeof(payload), 0); 4358 4377 } 4359 4378 4360 4379 /* ··· 4364 4387 struct reg_dev_req payload; 4365 4388 u32 opc; 4366 4389 u32 stp_sspsmp_sata = 0x4; 4367 - struct inbound_queue_table *circularQ; 4368 4390 u32 linkrate, phy_id; 4369 4391 int rc; 4370 4392 struct pm8001_ccb_info *ccb; ··· 4373 4397 struct domain_device *dev = pm8001_dev->sas_device; 4374 4398 struct domain_device *parent_dev = dev->parent; 4375 4399 struct pm8001_port *port = dev->port->lldd_port; 4376 - circularQ = &pm8001_ha->inbnd_q_tbl[0]; 4377 4400 4378 4401 memset(&payload, 0, sizeof(payload)); 4379 4402 ccb = pm8001_ccb_alloc(pm8001_ha, pm8001_dev, NULL); ··· 4406 4431 cpu_to_le32(ITNT | (firstBurstSize * 0x10000)); 4407 4432 memcpy(payload.sas_addr, pm8001_dev->sas_device->sas_addr, 4408 4433 SAS_ADDR_SIZE); 4409 - rc = pm8001_mpi_build_cmd(pm8001_ha, circularQ, opc, &payload, 4410 - sizeof(payload), 0); 4434 + 4435 + rc = pm8001_mpi_build_cmd(pm8001_ha, 0, opc, &payload, 4436 + sizeof(payload), 0); 4411 4437 if (rc) 4412 4438 pm8001_ccb_free(pm8001_ha, ccb); 4413 4439 ··· 4423 4447 { 4424 4448 struct dereg_dev_req payload; 4425 4449 u32 opc = OPC_INB_DEREG_DEV_HANDLE; 4426 - int ret; 4427 - struct inbound_queue_table *circularQ; 4428 4450 4429 - circularQ = &pm8001_ha->inbnd_q_tbl[0]; 4430 4451 memset(&payload, 0, sizeof(payload)); 4431 4452 payload.tag = cpu_to_le32(1); 4432 4453 payload.device_id = cpu_to_le32(device_id); 4433 4454 pm8001_dbg(pm8001_ha, MSG, "unregister device device_id = %d\n", 4434 4455 device_id); 4435 - ret = pm8001_mpi_build_cmd(pm8001_ha, circularQ, opc, &payload, 4436 - sizeof(payload), 0); 4437 - return ret; 4456 + 4457 + return pm8001_mpi_build_cmd(pm8001_ha, 0, opc, &payload, 4458 + sizeof(payload), 0); 4438 4459 } 4439 4460 4440 4461 /** ··· 4444 4471 u32 phyId, u32 phy_op) 4445 4472 { 4446 4473 struct local_phy_ctl_req payload; 4447 - struct inbound_queue_table *circularQ; 4448 - int ret; 4449 4474 u32 opc = OPC_INB_LOCAL_PHY_CONTROL; 4475 + 4450 4476 memset(&payload, 0, sizeof(payload)); 4451 - circularQ = &pm8001_ha->inbnd_q_tbl[0]; 4452 4477 payload.tag = cpu_to_le32(1); 4453 4478 payload.phyop_phyid = 4454 4479 cpu_to_le32(((phy_op & 0xff) << 8) | (phyId & 0x0F)); 4455 - ret = pm8001_mpi_build_cmd(pm8001_ha, circularQ, opc, &payload, 4456 - sizeof(payload), 0); 4457 - return ret; 4480 + 4481 + return pm8001_mpi_build_cmd(pm8001_ha, 0, opc, &payload, 4482 + sizeof(payload), 0); 4458 4483 } 4459 4484 4460 4485 static u32 pm8001_chip_is_our_interrupt(struct pm8001_hba_info *pm8001_ha) ··· 4490 4519 u32 dev_id, u8 flag, u32 task_tag, u32 cmd_tag) 4491 4520 { 4492 4521 struct task_abort_req task_abort; 4493 - struct inbound_queue_table *circularQ; 4494 - int ret; 4495 - circularQ = &pm8001_ha->inbnd_q_tbl[0]; 4522 + 4496 4523 memset(&task_abort, 0, sizeof(task_abort)); 4497 4524 if (ABORT_SINGLE == (flag & ABORT_MASK)) { 4498 4525 task_abort.abort_all = 0; ··· 4502 4533 task_abort.device_id = cpu_to_le32(dev_id); 4503 4534 task_abort.tag = cpu_to_le32(cmd_tag); 4504 4535 } 4505 - ret = pm8001_mpi_build_cmd(pm8001_ha, circularQ, opc, &task_abort, 4506 - sizeof(task_abort), 0); 4507 - return ret; 4536 + 4537 + return pm8001_mpi_build_cmd(pm8001_ha, 0, opc, &task_abort, 4538 + sizeof(task_abort), 0); 4508 4539 } 4509 4540 4510 4541 /* ··· 4544 4575 struct domain_device *dev = task->dev; 4545 4576 struct pm8001_device *pm8001_dev = dev->lldd_dev; 4546 4577 u32 opc = OPC_INB_SSPINITMSTART; 4547 - struct inbound_queue_table *circularQ; 4548 4578 struct ssp_ini_tm_start_req sspTMCmd; 4549 - int ret; 4550 4579 4551 4580 memset(&sspTMCmd, 0, sizeof(sspTMCmd)); 4552 4581 sspTMCmd.device_id = cpu_to_le32(pm8001_dev->device_id); ··· 4554 4587 sspTMCmd.tag = cpu_to_le32(ccb->ccb_tag); 4555 4588 if (pm8001_ha->chip_id != chip_8001) 4556 4589 sspTMCmd.ds_ads_m = cpu_to_le32(0x08); 4557 - circularQ = &pm8001_ha->inbnd_q_tbl[0]; 4558 - ret = pm8001_mpi_build_cmd(pm8001_ha, circularQ, opc, &sspTMCmd, 4559 - sizeof(sspTMCmd), 0); 4560 - return ret; 4590 + 4591 + return pm8001_mpi_build_cmd(pm8001_ha, 0, opc, &sspTMCmd, 4592 + sizeof(sspTMCmd), 0); 4561 4593 } 4562 4594 4563 4595 int pm8001_chip_get_nvmd_req(struct pm8001_hba_info *pm8001_ha, ··· 4566 4600 u32 nvmd_type; 4567 4601 int rc; 4568 4602 struct pm8001_ccb_info *ccb; 4569 - struct inbound_queue_table *circularQ; 4570 4603 struct get_nvm_data_req nvmd_req; 4571 4604 struct fw_control_ex *fw_control_context; 4572 4605 struct pm8001_ioctl_payload *ioctl_payload = payload; ··· 4576 4611 return -ENOMEM; 4577 4612 fw_control_context->usrAddr = (u8 *)ioctl_payload->func_specific; 4578 4613 fw_control_context->len = ioctl_payload->rd_length; 4579 - circularQ = &pm8001_ha->inbnd_q_tbl[0]; 4580 4614 memset(&nvmd_req, 0, sizeof(nvmd_req)); 4581 4615 4582 4616 ccb = pm8001_ccb_alloc(pm8001_ha, NULL, NULL); ··· 4642 4678 default: 4643 4679 break; 4644 4680 } 4645 - rc = pm8001_mpi_build_cmd(pm8001_ha, circularQ, opc, &nvmd_req, 4646 - sizeof(nvmd_req), 0); 4681 + 4682 + rc = pm8001_mpi_build_cmd(pm8001_ha, 0, opc, &nvmd_req, 4683 + sizeof(nvmd_req), 0); 4647 4684 if (rc) { 4648 4685 kfree(fw_control_context); 4649 4686 pm8001_ccb_free(pm8001_ha, ccb); ··· 4659 4694 u32 nvmd_type; 4660 4695 int rc; 4661 4696 struct pm8001_ccb_info *ccb; 4662 - struct inbound_queue_table *circularQ; 4663 4697 struct set_nvm_data_req nvmd_req; 4664 4698 struct fw_control_ex *fw_control_context; 4665 4699 struct pm8001_ioctl_payload *ioctl_payload = payload; ··· 4667 4703 fw_control_context = kzalloc(sizeof(struct fw_control_ex), GFP_KERNEL); 4668 4704 if (!fw_control_context) 4669 4705 return -ENOMEM; 4670 - circularQ = &pm8001_ha->inbnd_q_tbl[0]; 4706 + 4671 4707 memcpy(pm8001_ha->memoryMap.region[NVMD].virt_ptr, 4672 4708 &ioctl_payload->func_specific, 4673 4709 ioctl_payload->wr_length); ··· 4726 4762 default: 4727 4763 break; 4728 4764 } 4729 - rc = pm8001_mpi_build_cmd(pm8001_ha, circularQ, opc, &nvmd_req, 4765 + 4766 + rc = pm8001_mpi_build_cmd(pm8001_ha, 0, opc, &nvmd_req, 4730 4767 sizeof(nvmd_req), 0); 4731 4768 if (rc) { 4732 4769 kfree(fw_control_context); ··· 4748 4783 { 4749 4784 struct fw_flash_Update_req payload; 4750 4785 struct fw_flash_updata_info *info; 4751 - struct inbound_queue_table *circularQ; 4752 - int ret; 4753 4786 u32 opc = OPC_INB_FW_FLASH_UPDATE; 4754 4787 4755 4788 memset(&payload, 0, sizeof(struct fw_flash_Update_req)); 4756 - circularQ = &pm8001_ha->inbnd_q_tbl[0]; 4757 4789 info = fw_flash_updata_info; 4758 4790 payload.tag = cpu_to_le32(tag); 4759 4791 payload.cur_image_len = cpu_to_le32(info->cur_image_len); ··· 4761 4799 cpu_to_le32(lower_32_bits(le64_to_cpu(info->sgl.addr))); 4762 4800 payload.sgl_addr_hi = 4763 4801 cpu_to_le32(upper_32_bits(le64_to_cpu(info->sgl.addr))); 4764 - ret = pm8001_mpi_build_cmd(pm8001_ha, circularQ, opc, &payload, 4765 - sizeof(payload), 0); 4766 - return ret; 4802 + 4803 + return pm8001_mpi_build_cmd(pm8001_ha, 0, opc, &payload, 4804 + sizeof(payload), 0); 4767 4805 } 4768 4806 4769 4807 int ··· 4898 4936 struct pm8001_device *pm8001_dev, u32 state) 4899 4937 { 4900 4938 struct set_dev_state_req payload; 4901 - struct inbound_queue_table *circularQ; 4902 4939 struct pm8001_ccb_info *ccb; 4903 4940 int rc; 4904 4941 u32 opc = OPC_INB_SET_DEVICE_STATE; ··· 4908 4947 if (!ccb) 4909 4948 return -SAS_QUEUE_FULL; 4910 4949 4911 - circularQ = &pm8001_ha->inbnd_q_tbl[0]; 4912 4950 payload.tag = cpu_to_le32(ccb->ccb_tag); 4913 4951 payload.device_id = cpu_to_le32(pm8001_dev->device_id); 4914 4952 payload.nds = cpu_to_le32(state); 4915 4953 4916 - rc = pm8001_mpi_build_cmd(pm8001_ha, circularQ, opc, &payload, 4917 - sizeof(payload), 0); 4954 + rc = pm8001_mpi_build_cmd(pm8001_ha, 0, opc, &payload, 4955 + sizeof(payload), 0); 4918 4956 if (rc) 4919 4957 pm8001_ccb_free(pm8001_ha, ccb); 4920 4958 ··· 4924 4964 pm8001_chip_sas_re_initialization(struct pm8001_hba_info *pm8001_ha) 4925 4965 { 4926 4966 struct sas_re_initialization_req payload; 4927 - struct inbound_queue_table *circularQ; 4928 4967 struct pm8001_ccb_info *ccb; 4929 4968 int rc; 4930 4969 u32 opc = OPC_INB_SAS_RE_INITIALIZE; ··· 4934 4975 if (!ccb) 4935 4976 return -SAS_QUEUE_FULL; 4936 4977 4937 - circularQ = &pm8001_ha->inbnd_q_tbl[0]; 4938 4978 payload.tag = cpu_to_le32(ccb->ccb_tag); 4939 4979 payload.SSAHOLT = cpu_to_le32(0xd << 25); 4940 4980 payload.sata_hol_tmo = cpu_to_le32(80); 4941 4981 payload.open_reject_cmdretries_data_retries = cpu_to_le32(0xff00ff); 4942 4982 4943 - rc = pm8001_mpi_build_cmd(pm8001_ha, circularQ, opc, &payload, 4944 - sizeof(payload), 0); 4983 + rc = pm8001_mpi_build_cmd(pm8001_ha, 0, opc, &payload, 4984 + sizeof(payload), 0); 4945 4985 if (rc) 4946 4986 pm8001_ccb_free(pm8001_ha, ccb); 4947 4987
+1 -2
drivers/scsi/pm8001/pm8001_sas.h
··· 662 662 663 663 void pm8001_chip_iounmap(struct pm8001_hba_info *pm8001_ha); 664 664 int pm8001_mpi_build_cmd(struct pm8001_hba_info *pm8001_ha, 665 - struct inbound_queue_table *circularQ, 666 - u32 opCode, void *payload, size_t nb, 665 + u32 q_index, u32 opCode, void *payload, size_t nb, 667 666 u32 responseQueue); 668 667 int pm8001_mpi_msg_free_get(struct inbound_queue_table *circularQ, 669 668 u16 messageSize, void **messagePtr);
+32 -66
drivers/scsi/pm8001/pm80xx_hwi.c
··· 1182 1182 pm80xx_set_thermal_config(struct pm8001_hba_info *pm8001_ha) 1183 1183 { 1184 1184 struct set_ctrl_cfg_req payload; 1185 - struct inbound_queue_table *circularQ; 1186 1185 int rc; 1187 1186 u32 tag; 1188 1187 u32 opc = OPC_INB_SET_CONTROLLER_CONFIG; ··· 1192 1193 if (rc) 1193 1194 return rc; 1194 1195 1195 - circularQ = &pm8001_ha->inbnd_q_tbl[0]; 1196 1196 payload.tag = cpu_to_le32(tag); 1197 1197 1198 1198 if (IS_SPCV_12G(pm8001_ha->pdev)) ··· 1209 1211 "Setting up thermal config. cfg_pg 0 0x%x cfg_pg 1 0x%x\n", 1210 1212 payload.cfg_pg[0], payload.cfg_pg[1]); 1211 1213 1212 - rc = pm8001_mpi_build_cmd(pm8001_ha, circularQ, opc, &payload, 1214 + rc = pm8001_mpi_build_cmd(pm8001_ha, 0, opc, &payload, 1213 1215 sizeof(payload), 0); 1214 1216 if (rc) 1215 1217 pm8001_tag_free(pm8001_ha, tag); ··· 1226 1228 pm80xx_set_sas_protocol_timer_config(struct pm8001_hba_info *pm8001_ha) 1227 1229 { 1228 1230 struct set_ctrl_cfg_req payload; 1229 - struct inbound_queue_table *circularQ; 1230 1231 SASProtocolTimerConfig_t SASConfigPage; 1231 1232 int rc; 1232 1233 u32 tag; ··· 1235 1238 memset(&SASConfigPage, 0, sizeof(SASProtocolTimerConfig_t)); 1236 1239 1237 1240 rc = pm8001_tag_alloc(pm8001_ha, &tag); 1238 - 1239 1241 if (rc) 1240 1242 return rc; 1241 1243 1242 - circularQ = &pm8001_ha->inbnd_q_tbl[0]; 1243 1244 payload.tag = cpu_to_le32(tag); 1244 1245 1245 1246 SASConfigPage.pageCode = cpu_to_le32(SAS_PROTOCOL_TIMER_CONFIG_PAGE); ··· 1279 1284 memcpy(&payload.cfg_pg, &SASConfigPage, 1280 1285 sizeof(SASProtocolTimerConfig_t)); 1281 1286 1282 - rc = pm8001_mpi_build_cmd(pm8001_ha, circularQ, opc, &payload, 1287 + rc = pm8001_mpi_build_cmd(pm8001_ha, 0, opc, &payload, 1283 1288 sizeof(payload), 0); 1284 1289 if (rc) 1285 1290 pm8001_tag_free(pm8001_ha, tag); ··· 1385 1390 static int pm80xx_encrypt_update(struct pm8001_hba_info *pm8001_ha) 1386 1391 { 1387 1392 struct kek_mgmt_req payload; 1388 - struct inbound_queue_table *circularQ; 1389 1393 int rc; 1390 1394 u32 tag; 1391 1395 u32 opc = OPC_INB_KEK_MANAGEMENT; ··· 1394 1400 if (rc) 1395 1401 return rc; 1396 1402 1397 - circularQ = &pm8001_ha->inbnd_q_tbl[0]; 1398 1403 payload.tag = cpu_to_le32(tag); 1399 1404 /* Currently only one key is used. New KEK index is 1. 1400 1405 * Current KEK index is 1. Store KEK to NVRAM is 1. ··· 1406 1413 "Saving Encryption info to flash. payload 0x%x\n", 1407 1414 le32_to_cpu(payload.new_curidx_ksop)); 1408 1415 1409 - rc = pm8001_mpi_build_cmd(pm8001_ha, circularQ, opc, &payload, 1416 + rc = pm8001_mpi_build_cmd(pm8001_ha, 0, opc, &payload, 1410 1417 sizeof(payload), 0); 1411 1418 if (rc) 1412 1419 pm8001_tag_free(pm8001_ha, tag); ··· 1763 1770 struct pm8001_ccb_info *ccb; 1764 1771 struct sas_task *task = NULL; 1765 1772 struct task_abort_req task_abort; 1766 - struct inbound_queue_table *circularQ; 1767 1773 u32 opc = OPC_INB_SATA_ABORT; 1768 1774 int ret; 1769 1775 ··· 1786 1794 return; 1787 1795 } 1788 1796 1789 - circularQ = &pm8001_ha->inbnd_q_tbl[0]; 1790 - 1791 1797 memset(&task_abort, 0, sizeof(task_abort)); 1792 1798 task_abort.abort_all = cpu_to_le32(1); 1793 1799 task_abort.device_id = cpu_to_le32(pm8001_ha_dev->device_id); 1794 1800 task_abort.tag = cpu_to_le32(ccb->ccb_tag); 1795 1801 1796 - ret = pm8001_mpi_build_cmd(pm8001_ha, circularQ, opc, &task_abort, 1797 - sizeof(task_abort), 0); 1802 + ret = pm8001_mpi_build_cmd(pm8001_ha, 0, opc, &task_abort, 1803 + sizeof(task_abort), 0); 1798 1804 pm8001_dbg(pm8001_ha, FAIL, "Executing abort task end\n"); 1799 1805 if (ret) { 1800 1806 sas_free_task(task); ··· 1809 1819 struct sas_task *task = NULL; 1810 1820 struct host_to_dev_fis fis; 1811 1821 struct domain_device *dev; 1812 - struct inbound_queue_table *circularQ; 1813 1822 u32 opc = OPC_INB_SATA_HOST_OPSTART; 1814 1823 1815 1824 task = sas_alloc_slow_task(GFP_ATOMIC); 1816 - 1817 1825 if (!task) { 1818 1826 pm8001_dbg(pm8001_ha, FAIL, "cannot allocate task !!!\n"); 1819 1827 return; ··· 1844 1856 pm8001_ha_dev->id |= NCQ_2ND_RLE_FLAG; 1845 1857 1846 1858 memset(&sata_cmd, 0, sizeof(sata_cmd)); 1847 - circularQ = &pm8001_ha->inbnd_q_tbl[0]; 1848 1859 1849 1860 /* construct read log FIS */ 1850 1861 memset(&fis, 0, sizeof(struct host_to_dev_fis)); ··· 1858 1871 sata_cmd.ncqtag_atap_dir_m_dad = cpu_to_le32(((0x1 << 7) | (0x5 << 9))); 1859 1872 memcpy(&sata_cmd.sata_fis, &fis, sizeof(struct host_to_dev_fis)); 1860 1873 1861 - res = pm8001_mpi_build_cmd(pm8001_ha, circularQ, opc, &sata_cmd, 1862 - sizeof(sata_cmd), 0); 1874 + res = pm8001_mpi_build_cmd(pm8001_ha, 0, opc, &sata_cmd, 1875 + sizeof(sata_cmd), 0); 1863 1876 pm8001_dbg(pm8001_ha, FAIL, "Executing read log end\n"); 1864 1877 if (res) { 1865 1878 sas_free_task(task); ··· 3196 3209 struct hw_event_ack_req payload; 3197 3210 u32 opc = OPC_INB_SAS_HW_EVENT_ACK; 3198 3211 3199 - struct inbound_queue_table *circularQ; 3200 - 3201 3212 memset((u8 *)&payload, 0, sizeof(payload)); 3202 - circularQ = &pm8001_ha->inbnd_q_tbl[Qnum]; 3203 3213 payload.tag = cpu_to_le32(1); 3204 3214 payload.phyid_sea_portid = cpu_to_le32(((SEA & 0xFFFF) << 8) | 3205 3215 ((phyId & 0xFF) << 24) | (port_id & 0xFF)); 3206 3216 payload.param0 = cpu_to_le32(param0); 3207 3217 payload.param1 = cpu_to_le32(param1); 3208 - pm8001_mpi_build_cmd(pm8001_ha, circularQ, opc, &payload, 3209 - sizeof(payload), 0); 3218 + 3219 + pm8001_mpi_build_cmd(pm8001_ha, Qnum, opc, &payload, 3220 + sizeof(payload), 0); 3210 3221 } 3211 3222 3212 3223 static int pm80xx_chip_phy_ctl_req(struct pm8001_hba_info *pm8001_ha, ··· 4183 4198 u32 req_len, resp_len; 4184 4199 struct smp_req smp_cmd; 4185 4200 u32 opc; 4186 - struct inbound_queue_table *circularQ; 4187 4201 u32 i, length; 4188 4202 u8 *payload; 4189 4203 u8 *to; ··· 4211 4227 } 4212 4228 4213 4229 opc = OPC_INB_SMP_REQUEST; 4214 - circularQ = &pm8001_ha->inbnd_q_tbl[0]; 4215 4230 smp_cmd.tag = cpu_to_le32(ccb->ccb_tag); 4216 4231 4217 4232 length = sg_req->length; ··· 4278 4295 kunmap_atomic(to); 4279 4296 build_smp_cmd(pm8001_dev->device_id, smp_cmd.tag, 4280 4297 &smp_cmd, pm8001_ha->smp_exp_mode, length); 4281 - rc = pm8001_mpi_build_cmd(pm8001_ha, circularQ, opc, &smp_cmd, 4282 - sizeof(smp_cmd), 0); 4298 + rc = pm8001_mpi_build_cmd(pm8001_ha, 0, opc, &smp_cmd, 4299 + sizeof(smp_cmd), 0); 4283 4300 if (rc) 4284 4301 goto err_out_2; 4285 4302 return 0; ··· 4339 4356 struct pm8001_device *pm8001_dev = dev->lldd_dev; 4340 4357 struct ssp_ini_io_start_req ssp_cmd; 4341 4358 u32 tag = ccb->ccb_tag; 4342 - int ret; 4343 4359 u64 phys_addr, end_addr; 4344 4360 u32 end_addr_high, end_addr_low; 4345 - struct inbound_queue_table *circularQ; 4346 4361 u32 q_index, cpu_id; 4347 4362 u32 opc = OPC_INB_SSPINIIOSTART; 4348 4363 ··· 4364 4383 task->ssp_task.cmd->cmd_len); 4365 4384 cpu_id = smp_processor_id(); 4366 4385 q_index = (u32) (cpu_id) % (pm8001_ha->max_q_num); 4367 - circularQ = &pm8001_ha->inbnd_q_tbl[q_index]; 4368 4386 4369 4387 /* Check if encryption is set */ 4370 4388 if (pm8001_ha->chip->encrypt && ··· 4480 4500 ssp_cmd.esgl = 0; 4481 4501 } 4482 4502 } 4483 - ret = pm8001_mpi_build_cmd(pm8001_ha, circularQ, opc, 4484 - &ssp_cmd, sizeof(ssp_cmd), q_index); 4485 - return ret; 4503 + 4504 + return pm8001_mpi_build_cmd(pm8001_ha, q_index, opc, &ssp_cmd, 4505 + sizeof(ssp_cmd), q_index); 4486 4506 } 4487 4507 4488 4508 static int pm80xx_chip_sata_req(struct pm8001_hba_info *pm8001_ha, ··· 4493 4513 struct pm8001_device *pm8001_ha_dev = dev->lldd_dev; 4494 4514 struct ata_queued_cmd *qc = task->uldd_task; 4495 4515 u32 tag = ccb->ccb_tag; 4496 - int ret; 4497 4516 u32 q_index, cpu_id; 4498 4517 struct sata_start_req sata_cmd; 4499 4518 u32 hdr_tag, ncg_tag = 0; ··· 4500 4521 u32 end_addr_high, end_addr_low; 4501 4522 u32 ATAP = 0x0; 4502 4523 u32 dir; 4503 - struct inbound_queue_table *circularQ; 4504 4524 unsigned long flags; 4505 4525 u32 opc = OPC_INB_SATA_HOST_OPSTART; 4506 4526 memset(&sata_cmd, 0, sizeof(sata_cmd)); 4507 4527 cpu_id = smp_processor_id(); 4508 4528 q_index = (u32) (cpu_id) % (pm8001_ha->max_q_num); 4509 - circularQ = &pm8001_ha->inbnd_q_tbl[q_index]; 4510 4529 4511 4530 if (task->data_dir == DMA_NONE && !task->ata_task.use_ncq) { 4512 4531 ATAP = 0x04; /* no data*/ ··· 4719 4742 ccb->ccb_tag, opc, 4720 4743 qc ? qc->tf.command : 0, // ata opcode 4721 4744 ccb->device ? atomic_read(&ccb->device->running_req) : 0); 4722 - ret = pm8001_mpi_build_cmd(pm8001_ha, circularQ, opc, 4723 - &sata_cmd, sizeof(sata_cmd), q_index); 4724 - return ret; 4745 + return pm8001_mpi_build_cmd(pm8001_ha, q_index, opc, &sata_cmd, 4746 + sizeof(sata_cmd), q_index); 4725 4747 } 4726 4748 4727 4749 /** ··· 4732 4756 pm80xx_chip_phy_start_req(struct pm8001_hba_info *pm8001_ha, u8 phy_id) 4733 4757 { 4734 4758 struct phy_start_req payload; 4735 - struct inbound_queue_table *circularQ; 4736 - int ret; 4737 4759 u32 tag = 0x01; 4738 4760 u32 opcode = OPC_INB_PHYSTART; 4739 - circularQ = &pm8001_ha->inbnd_q_tbl[0]; 4761 + 4740 4762 memset(&payload, 0, sizeof(payload)); 4741 4763 payload.tag = cpu_to_le32(tag); 4742 4764 ··· 4756 4782 memcpy(payload.sas_identify.sas_addr, 4757 4783 &pm8001_ha->sas_addr, SAS_ADDR_SIZE); 4758 4784 payload.sas_identify.phy_id = phy_id; 4759 - ret = pm8001_mpi_build_cmd(pm8001_ha, circularQ, opcode, &payload, 4760 - sizeof(payload), 0); 4761 - return ret; 4785 + 4786 + return pm8001_mpi_build_cmd(pm8001_ha, 0, opcode, &payload, 4787 + sizeof(payload), 0); 4762 4788 } 4763 4789 4764 4790 /** ··· 4770 4796 u8 phy_id) 4771 4797 { 4772 4798 struct phy_stop_req payload; 4773 - struct inbound_queue_table *circularQ; 4774 - int ret; 4775 4799 u32 tag = 0x01; 4776 4800 u32 opcode = OPC_INB_PHYSTOP; 4777 - circularQ = &pm8001_ha->inbnd_q_tbl[0]; 4801 + 4778 4802 memset(&payload, 0, sizeof(payload)); 4779 4803 payload.tag = cpu_to_le32(tag); 4780 4804 payload.phy_id = cpu_to_le32(phy_id); 4781 - ret = pm8001_mpi_build_cmd(pm8001_ha, circularQ, opcode, &payload, 4782 - sizeof(payload), 0); 4783 - return ret; 4805 + 4806 + return pm8001_mpi_build_cmd(pm8001_ha, 0, opcode, &payload, 4807 + sizeof(payload), 0); 4784 4808 } 4785 4809 4786 4810 /* ··· 4790 4818 struct reg_dev_req payload; 4791 4819 u32 opc; 4792 4820 u32 stp_sspsmp_sata = 0x4; 4793 - struct inbound_queue_table *circularQ; 4794 4821 u32 linkrate, phy_id; 4795 4822 int rc; 4796 4823 struct pm8001_ccb_info *ccb; ··· 4799 4828 struct domain_device *dev = pm8001_dev->sas_device; 4800 4829 struct domain_device *parent_dev = dev->parent; 4801 4830 struct pm8001_port *port = dev->port->lldd_port; 4802 - circularQ = &pm8001_ha->inbnd_q_tbl[0]; 4803 4831 4804 4832 memset(&payload, 0, sizeof(payload)); 4805 4833 ccb = pm8001_ccb_alloc(pm8001_ha, pm8001_dev, NULL); ··· 4839 4869 memcpy(payload.sas_addr, pm8001_dev->sas_device->sas_addr, 4840 4870 SAS_ADDR_SIZE); 4841 4871 4842 - rc = pm8001_mpi_build_cmd(pm8001_ha, circularQ, opc, &payload, 4872 + rc = pm8001_mpi_build_cmd(pm8001_ha, 0, opc, &payload, 4843 4873 sizeof(payload), 0); 4844 4874 if (rc) 4845 4875 pm8001_ccb_free(pm8001_ha, ccb); ··· 4859 4889 u32 tag; 4860 4890 int rc; 4861 4891 struct local_phy_ctl_req payload; 4862 - struct inbound_queue_table *circularQ; 4863 4892 u32 opc = OPC_INB_LOCAL_PHY_CONTROL; 4893 + 4864 4894 memset(&payload, 0, sizeof(payload)); 4865 4895 rc = pm8001_tag_alloc(pm8001_ha, &tag); 4866 4896 if (rc) 4867 4897 return rc; 4868 - circularQ = &pm8001_ha->inbnd_q_tbl[0]; 4898 + 4869 4899 payload.tag = cpu_to_le32(tag); 4870 4900 payload.phyop_phyid = 4871 4901 cpu_to_le32(((phy_op & 0xFF) << 8) | (phyId & 0xFF)); 4872 4902 4873 - rc = pm8001_mpi_build_cmd(pm8001_ha, circularQ, opc, &payload, 4903 + rc = pm8001_mpi_build_cmd(pm8001_ha, 0, opc, &payload, 4874 4904 sizeof(payload), 0); 4875 4905 if (rc) 4876 4906 pm8001_tag_free(pm8001_ha, tag); ··· 4916 4946 u32 tag, i, j = 0; 4917 4947 int rc; 4918 4948 struct set_phy_profile_req payload; 4919 - struct inbound_queue_table *circularQ; 4920 4949 u32 opc = OPC_INB_SET_PHY_PROFILE; 4921 4950 4922 4951 memset(&payload, 0, sizeof(payload)); ··· 4925 4956 return; 4926 4957 } 4927 4958 4928 - circularQ = &pm8001_ha->inbnd_q_tbl[0]; 4929 4959 payload.tag = cpu_to_le32(tag); 4930 4960 payload.ppc_phyid = 4931 4961 cpu_to_le32(((operation & 0xF) << 8) | (phyid & 0xFF)); ··· 4935 4967 payload.reserved[j] = cpu_to_le32(*((u32 *)buf + i)); 4936 4968 j++; 4937 4969 } 4938 - rc = pm8001_mpi_build_cmd(pm8001_ha, circularQ, opc, &payload, 4939 - sizeof(payload), 0); 4970 + rc = pm8001_mpi_build_cmd(pm8001_ha, 0, opc, &payload, 4971 + sizeof(payload), 0); 4940 4972 if (rc) 4941 4973 pm8001_tag_free(pm8001_ha, tag); 4942 4974 } ··· 4960 4992 u32 tag, opc; 4961 4993 int rc, i; 4962 4994 struct set_phy_profile_req payload; 4963 - struct inbound_queue_table *circularQ; 4964 4995 4965 4996 memset(&payload, 0, sizeof(payload)); 4966 4997 ··· 4969 5002 return; 4970 5003 } 4971 5004 4972 - circularQ = &pm8001_ha->inbnd_q_tbl[0]; 4973 5005 opc = OPC_INB_SET_PHY_PROFILE; 4974 5006 4975 5007 payload.tag = cpu_to_le32(tag); ··· 4979 5013 for (i = 0; i < length; i++) 4980 5014 payload.reserved[i] = cpu_to_le32(*(buf + i)); 4981 5015 4982 - rc = pm8001_mpi_build_cmd(pm8001_ha, circularQ, opc, &payload, 5016 + rc = pm8001_mpi_build_cmd(pm8001_ha, 0, opc, &payload, 4983 5017 sizeof(payload), 0); 4984 5018 if (rc) 4985 5019 pm8001_tag_free(pm8001_ha, tag);