aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/megaraid
diff options
context:
space:
mode:
authoradam radford <aradford@gmail.com>2010-12-14 21:56:07 -0500
committerJames Bottomley <James.Bottomley@suse.de>2010-12-23 00:26:52 -0500
commitb6d5d8808b4c563a56414a4c4c6d652b5f87c088 (patch)
tree4e4580fd9cc216fffea4f03e7b71b5a9972f869b /drivers/scsi/megaraid
parent80d9da98b4034edd31f6bacdb96c7489c4460173 (diff)
[SCSI] megaraid_sas: Use lowest memory bar for SR-IOV VF support
The following patch modifies the megaraid_sas driver to select the lowest memory bar available so the driver will work in SR-IOV VF environments where the memory bar mapping changes. Signed-off-by: Adam Radford <aradford@gmail.com> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
Diffstat (limited to 'drivers/scsi/megaraid')
-rw-r--r--drivers/scsi/megaraid/megaraid_sas.h1
-rw-r--r--drivers/scsi/megaraid/megaraid_sas_base.c29
2 files changed, 11 insertions, 19 deletions
diff --git a/drivers/scsi/megaraid/megaraid_sas.h b/drivers/scsi/megaraid/megaraid_sas.h
index ff9845c72a67..0e09a0ff479d 100644
--- a/drivers/scsi/megaraid/megaraid_sas.h
+++ b/drivers/scsi/megaraid/megaraid_sas.h
@@ -1338,6 +1338,7 @@ struct megasas_instance {
1338 1338
1339 u8 msi_flag; 1339 u8 msi_flag;
1340 struct msix_entry msixentry; 1340 struct msix_entry msixentry;
1341 unsigned long bar;
1341}; 1342};
1342 1343
1343enum { 1344enum {
diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c b/drivers/scsi/megaraid/megaraid_sas_base.c
index 2318183f9a67..6e7bb7ca9869 100644
--- a/drivers/scsi/megaraid/megaraid_sas_base.c
+++ b/drivers/scsi/megaraid/megaraid_sas_base.c
@@ -3236,21 +3236,14 @@ static int megasas_init_mfi(struct megasas_instance *instance)
3236 u32 tmp_sectors; 3236 u32 tmp_sectors;
3237 struct megasas_register_set __iomem *reg_set; 3237 struct megasas_register_set __iomem *reg_set;
3238 struct megasas_ctrl_info *ctrl_info; 3238 struct megasas_ctrl_info *ctrl_info;
3239 /* 3239 unsigned long bar_list;
3240 * Map the message registers 3240
3241 */ 3241 /* Find first memory bar */
3242 if ((instance->pdev->device == PCI_DEVICE_ID_LSI_SAS1078GEN2) || 3242 bar_list = pci_select_bars(instance->pdev, IORESOURCE_MEM);
3243 (instance->pdev->device == PCI_DEVICE_ID_LSI_SAS0071SKINNY) || 3243 instance->bar = find_first_bit(&bar_list, sizeof(unsigned long));
3244 (instance->pdev->device == PCI_DEVICE_ID_LSI_SAS0073SKINNY) || 3244 instance->base_addr = pci_resource_start(instance->pdev, instance->bar);
3245 (instance->pdev->device == PCI_DEVICE_ID_LSI_SAS0079GEN2)) { 3245 if (pci_request_selected_regions(instance->pdev, instance->bar,
3246 instance->base_addr = pci_resource_start(instance->pdev, 1); 3246 "megasas: LSI")) {
3247 } else {
3248 instance->base_addr = pci_resource_start(instance->pdev, 0);
3249 }
3250
3251 if (pci_request_selected_regions(instance->pdev,
3252 pci_select_bars(instance->pdev, IORESOURCE_MEM),
3253 "megasas: LSI")) {
3254 printk(KERN_DEBUG "megasas: IO memory region busy!\n"); 3247 printk(KERN_DEBUG "megasas: IO memory region busy!\n");
3255 return -EBUSY; 3248 return -EBUSY;
3256 } 3249 }
@@ -3411,8 +3404,7 @@ static int megasas_init_mfi(struct megasas_instance *instance)
3411 iounmap(instance->reg_set); 3404 iounmap(instance->reg_set);
3412 3405
3413 fail_ioremap: 3406 fail_ioremap:
3414 pci_release_selected_regions(instance->pdev, 3407 pci_release_selected_regions(instance->pdev, instance->bar);
3415 pci_select_bars(instance->pdev, IORESOURCE_MEM));
3416 3408
3417 return -EINVAL; 3409 return -EINVAL;
3418} 3410}
@@ -3432,8 +3424,7 @@ static void megasas_release_mfi(struct megasas_instance *instance)
3432 3424
3433 iounmap(instance->reg_set); 3425 iounmap(instance->reg_set);
3434 3426
3435 pci_release_selected_regions(instance->pdev, 3427 pci_release_selected_regions(instance->pdev, instance->bar);
3436 pci_select_bars(instance->pdev, IORESOURCE_MEM));
3437} 3428}
3438 3429
3439/** 3430/**