diff options
author | adam radford <aradford@gmail.com> | 2010-12-14 18:56:07 -0800 |
---|---|---|
committer | James Bottomley <James.Bottomley@suse.de> | 2010-12-22 23:26:52 -0600 |
commit | b6d5d8808b4c563a56414a4c4c6d652b5f87c088 (patch) | |
tree | 4e4580fd9cc216fffea4f03e7b71b5a9972f869b /drivers/scsi | |
parent | 80d9da98b4034edd31f6bacdb96c7489c4460173 (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')
-rw-r--r-- | drivers/scsi/megaraid/megaraid_sas.h | 1 | ||||
-rw-r--r-- | drivers/scsi/megaraid/megaraid_sas_base.c | 29 |
2 files changed, 11 insertions, 19 deletions
diff --git a/drivers/scsi/megaraid/megaraid_sas.h b/drivers/scsi/megaraid/megaraid_sas.h index ff9845c72a6..0e09a0ff479 100644 --- a/drivers/scsi/megaraid/megaraid_sas.h +++ b/drivers/scsi/megaraid/megaraid_sas.h @@ -1338,6 +1338,7 @@ struct megasas_instance { u8 msi_flag; struct msix_entry msixentry; + unsigned long bar; }; enum { diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c b/drivers/scsi/megaraid/megaraid_sas_base.c index 2318183f9a6..6e7bb7ca986 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) u32 tmp_sectors; struct megasas_register_set __iomem *reg_set; struct megasas_ctrl_info *ctrl_info; - /* - * Map the message registers - */ - if ((instance->pdev->device == PCI_DEVICE_ID_LSI_SAS1078GEN2) || - (instance->pdev->device == PCI_DEVICE_ID_LSI_SAS0071SKINNY) || - (instance->pdev->device == PCI_DEVICE_ID_LSI_SAS0073SKINNY) || - (instance->pdev->device == PCI_DEVICE_ID_LSI_SAS0079GEN2)) { - instance->base_addr = pci_resource_start(instance->pdev, 1); - } else { - instance->base_addr = pci_resource_start(instance->pdev, 0); - } - - if (pci_request_selected_regions(instance->pdev, - pci_select_bars(instance->pdev, IORESOURCE_MEM), - "megasas: LSI")) { + unsigned long bar_list; + + /* Find first memory bar */ + bar_list = pci_select_bars(instance->pdev, IORESOURCE_MEM); + instance->bar = find_first_bit(&bar_list, sizeof(unsigned long)); + instance->base_addr = pci_resource_start(instance->pdev, instance->bar); + if (pci_request_selected_regions(instance->pdev, instance->bar, + "megasas: LSI")) { printk(KERN_DEBUG "megasas: IO memory region busy!\n"); return -EBUSY; } @@ -3411,8 +3404,7 @@ static int megasas_init_mfi(struct megasas_instance *instance) iounmap(instance->reg_set); fail_ioremap: - pci_release_selected_regions(instance->pdev, - pci_select_bars(instance->pdev, IORESOURCE_MEM)); + pci_release_selected_regions(instance->pdev, instance->bar); return -EINVAL; } @@ -3432,8 +3424,7 @@ static void megasas_release_mfi(struct megasas_instance *instance) iounmap(instance->reg_set); - pci_release_selected_regions(instance->pdev, - pci_select_bars(instance->pdev, IORESOURCE_MEM)); + pci_release_selected_regions(instance->pdev, instance->bar); } /** |