aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/scsi/hpsa.c50
1 files changed, 30 insertions, 20 deletions
diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c
index 66c4fc306f2c..cb0cc0993b9c 100644
--- a/drivers/scsi/hpsa.c
+++ b/drivers/scsi/hpsa.c
@@ -3317,12 +3317,39 @@ static int __devinit hpsa_wait_for_board_ready(struct ctlr_info *h)
3317 return -ENODEV; 3317 return -ENODEV;
3318} 3318}
3319 3319
3320static int __devinit hpsa_pci_init(struct ctlr_info *h) 3320static int __devinit hpsa_find_cfgtables(struct ctlr_info *h)
3321{ 3321{
3322 u64 cfg_offset; 3322 u64 cfg_offset;
3323 u32 cfg_base_addr; 3323 u32 cfg_base_addr;
3324 u64 cfg_base_addr_index; 3324 u64 cfg_base_addr_index;
3325 u32 trans_offset; 3325 u32 trans_offset;
3326
3327 /* get the address index number */
3328 cfg_base_addr = readl(h->vaddr + SA5_CTCFG_OFFSET);
3329 cfg_base_addr &= (u32) 0x0000ffff;
3330 cfg_base_addr_index = find_PCI_BAR_index(h->pdev, cfg_base_addr);
3331 if (cfg_base_addr_index == -1) {
3332 dev_warn(&h->pdev->dev, "cannot find cfg_base_addr_index\n");
3333 return -ENODEV;
3334 }
3335 cfg_offset = readl(h->vaddr + SA5_CTMEM_OFFSET);
3336 h->cfgtable = remap_pci_mem(pci_resource_start(h->pdev,
3337 cfg_base_addr_index) + cfg_offset,
3338 sizeof(h->cfgtable));
3339 if (!h->cfgtable)
3340 return -ENOMEM;
3341 /* Find performant mode table. */
3342 trans_offset = readl(&(h->cfgtable->TransMethodOffset));
3343 h->transtable = remap_pci_mem(pci_resource_start(h->pdev,
3344 cfg_base_addr_index)+cfg_offset+trans_offset,
3345 sizeof(*h->transtable));
3346 if (!h->transtable)
3347 return -ENOMEM;
3348 return 0;
3349}
3350
3351static int __devinit hpsa_pci_init(struct ctlr_info *h)
3352{
3326 int i, prod_index, err; 3353 int i, prod_index, err;
3327 3354
3328 prod_index = hpsa_lookup_board_id(h->pdev, &h->board_id); 3355 prod_index = hpsa_lookup_board_id(h->pdev, &h->board_id);
@@ -3356,26 +3383,9 @@ static int __devinit hpsa_pci_init(struct ctlr_info *h)
3356 err = hpsa_wait_for_board_ready(h); 3383 err = hpsa_wait_for_board_ready(h);
3357 if (err) 3384 if (err)
3358 goto err_out_free_res; 3385 goto err_out_free_res;
3359 3386 err = hpsa_find_cfgtables(h);
3360 /* get the address index number */ 3387 if (err)
3361 cfg_base_addr = readl(h->vaddr + SA5_CTCFG_OFFSET);
3362 cfg_base_addr &= (u32) 0x0000ffff;
3363 cfg_base_addr_index = find_PCI_BAR_index(h->pdev, cfg_base_addr);
3364 if (cfg_base_addr_index == -1) {
3365 dev_warn(&h->pdev->dev, "cannot find cfg_base_addr_index\n");
3366 err = -ENODEV;
3367 goto err_out_free_res; 3388 goto err_out_free_res;
3368 }
3369
3370 cfg_offset = readl(h->vaddr + SA5_CTMEM_OFFSET);
3371 h->cfgtable = remap_pci_mem(pci_resource_start(h->pdev,
3372 cfg_base_addr_index) + cfg_offset,
3373 sizeof(h->cfgtable));
3374 /* Find performant mode table. */
3375 trans_offset = readl(&(h->cfgtable->TransMethodOffset));
3376 h->transtable = remap_pci_mem(pci_resource_start(h->pdev,
3377 cfg_base_addr_index)+cfg_offset+trans_offset,
3378 sizeof(*h->transtable));
3379 3389
3380 h->max_commands = readl(&(h->cfgtable->MaxPerformantModeCommands)); 3390 h->max_commands = readl(&(h->cfgtable->MaxPerformantModeCommands));
3381 h->maxsgentries = readl(&(h->cfgtable->MaxScatterGatherElements)); 3391 h->maxsgentries = readl(&(h->cfgtable->MaxScatterGatherElements));