Loading drivers/scsi/arcmsr/arcmsr_hba.c +77 −50 Original line number Diff line number Diff line Loading @@ -576,27 +576,10 @@ static void arcmsr_flush_adapter_cache(struct AdapterControlBlock *acb) } } static bool arcmsr_alloc_io_queue(struct AdapterControlBlock *acb) static void arcmsr_hbaB_assign_regAddr(struct AdapterControlBlock *acb) { bool rtn = true; void *dma_coherent; dma_addr_t dma_coherent_handle; struct pci_dev *pdev = acb->pdev; struct MessageUnit_B *reg = acb->pmuB; switch (acb->adapter_type) { case ACB_ADAPTER_TYPE_B: { struct MessageUnit_B *reg; acb->ioqueue_size = roundup(sizeof(struct MessageUnit_B), 32); dma_coherent = dma_zalloc_coherent(&pdev->dev, acb->ioqueue_size, &dma_coherent_handle, GFP_KERNEL); if (!dma_coherent) { pr_notice("arcmsr%d: DMA allocation failed\n", acb->host->host_no); return false; } acb->dma_coherent_handle2 = dma_coherent_handle; acb->dma_coherent2 = dma_coherent; reg = (struct MessageUnit_B *)dma_coherent; acb->pmuB = reg; if (acb->pdev->device == PCI_DEVICE_ID_ARECA_1203) { reg->drv2iop_doorbell = MEM_BASE0(ARCMSR_DRV2IOP_DOORBELL_1203); reg->drv2iop_doorbell_mask = MEM_BASE0(ARCMSR_DRV2IOP_DOORBELL_MASK_1203); Loading @@ -612,21 +595,11 @@ static bool arcmsr_alloc_io_queue(struct AdapterControlBlock *acb) reg->message_rbuffer = MEM_BASE1(ARCMSR_MESSAGE_RBUFFER); reg->message_rwbuffer = MEM_BASE1(ARCMSR_MESSAGE_RWBUFFER); } break; case ACB_ADAPTER_TYPE_D: { struct MessageUnit_D *reg; acb->ioqueue_size = roundup(sizeof(struct MessageUnit_D), 32); dma_coherent = dma_zalloc_coherent(&pdev->dev, acb->ioqueue_size, &dma_coherent_handle, GFP_KERNEL); if (!dma_coherent) { pr_notice("arcmsr%d: DMA allocation failed\n", acb->host->host_no); return false; } acb->dma_coherent_handle2 = dma_coherent_handle; acb->dma_coherent2 = dma_coherent; reg = (struct MessageUnit_D *)dma_coherent; acb->pmuD = reg; static void arcmsr_hbaD_assign_regAddr(struct AdapterControlBlock *acb) { struct MessageUnit_D *reg = acb->pmuD; reg->chip_id = MEM_BASE0(ARCMSR_ARC1214_CHIP_ID); reg->cpu_mem_config = MEM_BASE0(ARCMSR_ARC1214_CPU_MEMORY_CONFIGURATION); reg->i2o_host_interrupt_mask = MEM_BASE0(ARCMSR_ARC1214_I2_HOST_INTERRUPT_MASK); Loading Loading @@ -654,6 +627,42 @@ static bool arcmsr_alloc_io_queue(struct AdapterControlBlock *acb) reg->message_rbuffer = MEM_BASE0(ARCMSR_ARC1214_MESSAGE_RBUFFER); reg->msgcode_rwbuffer = MEM_BASE0(ARCMSR_ARC1214_MESSAGE_RWBUFFER); } static bool arcmsr_alloc_io_queue(struct AdapterControlBlock *acb) { bool rtn = true; void *dma_coherent; dma_addr_t dma_coherent_handle; struct pci_dev *pdev = acb->pdev; switch (acb->adapter_type) { case ACB_ADAPTER_TYPE_B: { acb->ioqueue_size = roundup(sizeof(struct MessageUnit_B), 32); dma_coherent = dma_zalloc_coherent(&pdev->dev, acb->ioqueue_size, &dma_coherent_handle, GFP_KERNEL); if (!dma_coherent) { pr_notice("arcmsr%d: DMA allocation failed\n", acb->host->host_no); return false; } acb->dma_coherent_handle2 = dma_coherent_handle; acb->dma_coherent2 = dma_coherent; acb->pmuB = (struct MessageUnit_B *)dma_coherent; arcmsr_hbaB_assign_regAddr(acb); } break; case ACB_ADAPTER_TYPE_D: { acb->ioqueue_size = roundup(sizeof(struct MessageUnit_D), 32); dma_coherent = dma_zalloc_coherent(&pdev->dev, acb->ioqueue_size, &dma_coherent_handle, GFP_KERNEL); if (!dma_coherent) { pr_notice("arcmsr%d: DMA allocation failed\n", acb->host->host_no); return false; } acb->dma_coherent_handle2 = dma_coherent_handle; acb->dma_coherent2 = dma_coherent; acb->pmuD = (struct MessageUnit_D *)dma_coherent; arcmsr_hbaD_assign_regAddr(acb); } break; case ACB_ADAPTER_TYPE_E: { uint32_t completeQ_size; Loading Loading @@ -706,6 +715,7 @@ static int arcmsr_alloc_ccb_pool(struct AdapterControlBlock *acb) acb->host->sg_tablesize = max_sg_entrys; roundup_ccbsize = roundup(sizeof(struct CommandControlBlock) + (max_sg_entrys - 1) * sizeof(struct SG64ENTRY), 32); acb->uncache_size = roundup_ccbsize * acb->maxFreeCCB; acb->uncache_size += acb->ioqueue_size; dma_coherent = dma_alloc_coherent(&pdev->dev, acb->uncache_size, &dma_coherent_handle, GFP_KERNEL); if(!dma_coherent){ printk(KERN_NOTICE "arcmsr%d: dma_alloc_coherent got error\n", acb->host->host_no); Loading Loading @@ -738,6 +748,23 @@ static int arcmsr_alloc_ccb_pool(struct AdapterControlBlock *acb) ccb_tmp = (struct CommandControlBlock *)((unsigned long)ccb_tmp + roundup_ccbsize); dma_coherent_handle = dma_coherent_handle + roundup_ccbsize; } acb->dma_coherent_handle2 = dma_coherent_handle; acb->dma_coherent2 = ccb_tmp; switch (acb->adapter_type) { case ACB_ADAPTER_TYPE_B: acb->pmuB = (struct MessageUnit_B *)acb->dma_coherent2; arcmsr_hbaB_assign_regAddr(acb); break; case ACB_ADAPTER_TYPE_D: acb->pmuD = (struct MessageUnit_D *)acb->dma_coherent2; arcmsr_hbaD_assign_regAddr(acb); break; case ACB_ADAPTER_TYPE_E: acb->pCompletionQ = acb->dma_coherent2; acb->completionQ_entry = acb->ioqueue_size / sizeof(struct deliver_completeQ); acb->doneq_index = 0; break; } return 0; } Loading Loading @@ -959,9 +986,10 @@ static int arcmsr_probe(struct pci_dev *pdev, const struct pci_device_id *id) if(!error){ goto free_hbb_mu; } arcmsr_free_io_queue(acb); error = arcmsr_alloc_ccb_pool(acb); if(error){ goto free_hbb_mu; goto unmap_pci_region; } error = scsi_add_host(host, &pdev->dev); if(error){ Loading Loading @@ -989,6 +1017,7 @@ static int arcmsr_probe(struct pci_dev *pdev, const struct pci_device_id *id) scsi_remove_host(host); free_ccb_pool: arcmsr_free_ccb_pool(acb); goto unmap_pci_region; free_hbb_mu: arcmsr_free_io_queue(acb); unmap_pci_region: Loading Loading @@ -1500,7 +1529,6 @@ static void arcmsr_free_pcidev(struct AdapterControlBlock *acb) pdev = acb->pdev; arcmsr_free_irq(pdev, acb); arcmsr_free_ccb_pool(acb); arcmsr_free_io_queue(acb); arcmsr_unmap_pciregion(acb); pci_release_regions(pdev); scsi_host_put(host); Loading Loading @@ -1558,7 +1586,6 @@ static void arcmsr_remove(struct pci_dev *pdev) } arcmsr_free_irq(pdev, acb); arcmsr_free_ccb_pool(acb); arcmsr_free_io_queue(acb); arcmsr_unmap_pciregion(acb); pci_release_regions(pdev); scsi_host_put(host); Loading Loading
drivers/scsi/arcmsr/arcmsr_hba.c +77 −50 Original line number Diff line number Diff line Loading @@ -576,27 +576,10 @@ static void arcmsr_flush_adapter_cache(struct AdapterControlBlock *acb) } } static bool arcmsr_alloc_io_queue(struct AdapterControlBlock *acb) static void arcmsr_hbaB_assign_regAddr(struct AdapterControlBlock *acb) { bool rtn = true; void *dma_coherent; dma_addr_t dma_coherent_handle; struct pci_dev *pdev = acb->pdev; struct MessageUnit_B *reg = acb->pmuB; switch (acb->adapter_type) { case ACB_ADAPTER_TYPE_B: { struct MessageUnit_B *reg; acb->ioqueue_size = roundup(sizeof(struct MessageUnit_B), 32); dma_coherent = dma_zalloc_coherent(&pdev->dev, acb->ioqueue_size, &dma_coherent_handle, GFP_KERNEL); if (!dma_coherent) { pr_notice("arcmsr%d: DMA allocation failed\n", acb->host->host_no); return false; } acb->dma_coherent_handle2 = dma_coherent_handle; acb->dma_coherent2 = dma_coherent; reg = (struct MessageUnit_B *)dma_coherent; acb->pmuB = reg; if (acb->pdev->device == PCI_DEVICE_ID_ARECA_1203) { reg->drv2iop_doorbell = MEM_BASE0(ARCMSR_DRV2IOP_DOORBELL_1203); reg->drv2iop_doorbell_mask = MEM_BASE0(ARCMSR_DRV2IOP_DOORBELL_MASK_1203); Loading @@ -612,21 +595,11 @@ static bool arcmsr_alloc_io_queue(struct AdapterControlBlock *acb) reg->message_rbuffer = MEM_BASE1(ARCMSR_MESSAGE_RBUFFER); reg->message_rwbuffer = MEM_BASE1(ARCMSR_MESSAGE_RWBUFFER); } break; case ACB_ADAPTER_TYPE_D: { struct MessageUnit_D *reg; acb->ioqueue_size = roundup(sizeof(struct MessageUnit_D), 32); dma_coherent = dma_zalloc_coherent(&pdev->dev, acb->ioqueue_size, &dma_coherent_handle, GFP_KERNEL); if (!dma_coherent) { pr_notice("arcmsr%d: DMA allocation failed\n", acb->host->host_no); return false; } acb->dma_coherent_handle2 = dma_coherent_handle; acb->dma_coherent2 = dma_coherent; reg = (struct MessageUnit_D *)dma_coherent; acb->pmuD = reg; static void arcmsr_hbaD_assign_regAddr(struct AdapterControlBlock *acb) { struct MessageUnit_D *reg = acb->pmuD; reg->chip_id = MEM_BASE0(ARCMSR_ARC1214_CHIP_ID); reg->cpu_mem_config = MEM_BASE0(ARCMSR_ARC1214_CPU_MEMORY_CONFIGURATION); reg->i2o_host_interrupt_mask = MEM_BASE0(ARCMSR_ARC1214_I2_HOST_INTERRUPT_MASK); Loading Loading @@ -654,6 +627,42 @@ static bool arcmsr_alloc_io_queue(struct AdapterControlBlock *acb) reg->message_rbuffer = MEM_BASE0(ARCMSR_ARC1214_MESSAGE_RBUFFER); reg->msgcode_rwbuffer = MEM_BASE0(ARCMSR_ARC1214_MESSAGE_RWBUFFER); } static bool arcmsr_alloc_io_queue(struct AdapterControlBlock *acb) { bool rtn = true; void *dma_coherent; dma_addr_t dma_coherent_handle; struct pci_dev *pdev = acb->pdev; switch (acb->adapter_type) { case ACB_ADAPTER_TYPE_B: { acb->ioqueue_size = roundup(sizeof(struct MessageUnit_B), 32); dma_coherent = dma_zalloc_coherent(&pdev->dev, acb->ioqueue_size, &dma_coherent_handle, GFP_KERNEL); if (!dma_coherent) { pr_notice("arcmsr%d: DMA allocation failed\n", acb->host->host_no); return false; } acb->dma_coherent_handle2 = dma_coherent_handle; acb->dma_coherent2 = dma_coherent; acb->pmuB = (struct MessageUnit_B *)dma_coherent; arcmsr_hbaB_assign_regAddr(acb); } break; case ACB_ADAPTER_TYPE_D: { acb->ioqueue_size = roundup(sizeof(struct MessageUnit_D), 32); dma_coherent = dma_zalloc_coherent(&pdev->dev, acb->ioqueue_size, &dma_coherent_handle, GFP_KERNEL); if (!dma_coherent) { pr_notice("arcmsr%d: DMA allocation failed\n", acb->host->host_no); return false; } acb->dma_coherent_handle2 = dma_coherent_handle; acb->dma_coherent2 = dma_coherent; acb->pmuD = (struct MessageUnit_D *)dma_coherent; arcmsr_hbaD_assign_regAddr(acb); } break; case ACB_ADAPTER_TYPE_E: { uint32_t completeQ_size; Loading Loading @@ -706,6 +715,7 @@ static int arcmsr_alloc_ccb_pool(struct AdapterControlBlock *acb) acb->host->sg_tablesize = max_sg_entrys; roundup_ccbsize = roundup(sizeof(struct CommandControlBlock) + (max_sg_entrys - 1) * sizeof(struct SG64ENTRY), 32); acb->uncache_size = roundup_ccbsize * acb->maxFreeCCB; acb->uncache_size += acb->ioqueue_size; dma_coherent = dma_alloc_coherent(&pdev->dev, acb->uncache_size, &dma_coherent_handle, GFP_KERNEL); if(!dma_coherent){ printk(KERN_NOTICE "arcmsr%d: dma_alloc_coherent got error\n", acb->host->host_no); Loading Loading @@ -738,6 +748,23 @@ static int arcmsr_alloc_ccb_pool(struct AdapterControlBlock *acb) ccb_tmp = (struct CommandControlBlock *)((unsigned long)ccb_tmp + roundup_ccbsize); dma_coherent_handle = dma_coherent_handle + roundup_ccbsize; } acb->dma_coherent_handle2 = dma_coherent_handle; acb->dma_coherent2 = ccb_tmp; switch (acb->adapter_type) { case ACB_ADAPTER_TYPE_B: acb->pmuB = (struct MessageUnit_B *)acb->dma_coherent2; arcmsr_hbaB_assign_regAddr(acb); break; case ACB_ADAPTER_TYPE_D: acb->pmuD = (struct MessageUnit_D *)acb->dma_coherent2; arcmsr_hbaD_assign_regAddr(acb); break; case ACB_ADAPTER_TYPE_E: acb->pCompletionQ = acb->dma_coherent2; acb->completionQ_entry = acb->ioqueue_size / sizeof(struct deliver_completeQ); acb->doneq_index = 0; break; } return 0; } Loading Loading @@ -959,9 +986,10 @@ static int arcmsr_probe(struct pci_dev *pdev, const struct pci_device_id *id) if(!error){ goto free_hbb_mu; } arcmsr_free_io_queue(acb); error = arcmsr_alloc_ccb_pool(acb); if(error){ goto free_hbb_mu; goto unmap_pci_region; } error = scsi_add_host(host, &pdev->dev); if(error){ Loading Loading @@ -989,6 +1017,7 @@ static int arcmsr_probe(struct pci_dev *pdev, const struct pci_device_id *id) scsi_remove_host(host); free_ccb_pool: arcmsr_free_ccb_pool(acb); goto unmap_pci_region; free_hbb_mu: arcmsr_free_io_queue(acb); unmap_pci_region: Loading Loading @@ -1500,7 +1529,6 @@ static void arcmsr_free_pcidev(struct AdapterControlBlock *acb) pdev = acb->pdev; arcmsr_free_irq(pdev, acb); arcmsr_free_ccb_pool(acb); arcmsr_free_io_queue(acb); arcmsr_unmap_pciregion(acb); pci_release_regions(pdev); scsi_host_put(host); Loading Loading @@ -1558,7 +1586,6 @@ static void arcmsr_remove(struct pci_dev *pdev) } arcmsr_free_irq(pdev, acb); arcmsr_free_ccb_pool(acb); arcmsr_free_io_queue(acb); arcmsr_unmap_pciregion(acb); pci_release_regions(pdev); scsi_host_put(host); Loading