提交 b6d5d880 编写于 作者: A adam radford 提交者: James Bottomley

[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: NAdam Radford <aradford@gmail.com>
Signed-off-by: NJames Bottomley <James.Bottomley@suse.de>
上级 80d9da98
...@@ -1338,6 +1338,7 @@ struct megasas_instance { ...@@ -1338,6 +1338,7 @@ struct megasas_instance {
u8 msi_flag; u8 msi_flag;
struct msix_entry msixentry; struct msix_entry msixentry;
unsigned long bar;
}; };
enum { enum {
......
...@@ -3236,21 +3236,14 @@ static int megasas_init_mfi(struct megasas_instance *instance) ...@@ -3236,21 +3236,14 @@ static int megasas_init_mfi(struct megasas_instance *instance)
u32 tmp_sectors; u32 tmp_sectors;
struct megasas_register_set __iomem *reg_set; struct megasas_register_set __iomem *reg_set;
struct megasas_ctrl_info *ctrl_info; struct megasas_ctrl_info *ctrl_info;
/* unsigned long bar_list;
* Map the message registers
*/ /* Find first memory bar */
if ((instance->pdev->device == PCI_DEVICE_ID_LSI_SAS1078GEN2) || bar_list = pci_select_bars(instance->pdev, IORESOURCE_MEM);
(instance->pdev->device == PCI_DEVICE_ID_LSI_SAS0071SKINNY) || instance->bar = find_first_bit(&bar_list, sizeof(unsigned long));
(instance->pdev->device == PCI_DEVICE_ID_LSI_SAS0073SKINNY) || instance->base_addr = pci_resource_start(instance->pdev, instance->bar);
(instance->pdev->device == PCI_DEVICE_ID_LSI_SAS0079GEN2)) { if (pci_request_selected_regions(instance->pdev, instance->bar,
instance->base_addr = pci_resource_start(instance->pdev, 1); "megasas: LSI")) {
} 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")) {
printk(KERN_DEBUG "megasas: IO memory region busy!\n"); printk(KERN_DEBUG "megasas: IO memory region busy!\n");
return -EBUSY; return -EBUSY;
} }
...@@ -3411,8 +3404,7 @@ static int megasas_init_mfi(struct megasas_instance *instance) ...@@ -3411,8 +3404,7 @@ static int megasas_init_mfi(struct megasas_instance *instance)
iounmap(instance->reg_set); iounmap(instance->reg_set);
fail_ioremap: fail_ioremap:
pci_release_selected_regions(instance->pdev, pci_release_selected_regions(instance->pdev, instance->bar);
pci_select_bars(instance->pdev, IORESOURCE_MEM));
return -EINVAL; return -EINVAL;
} }
...@@ -3432,8 +3424,7 @@ static void megasas_release_mfi(struct megasas_instance *instance) ...@@ -3432,8 +3424,7 @@ static void megasas_release_mfi(struct megasas_instance *instance)
iounmap(instance->reg_set); iounmap(instance->reg_set);
pci_release_selected_regions(instance->pdev, pci_release_selected_regions(instance->pdev, instance->bar);
pci_select_bars(instance->pdev, IORESOURCE_MEM));
} }
/** /**
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册