PCI legacy I/O port free driver - Making MegaRAID SAS driver
Subsystems (2)
PATCH 1/1 PCI legacy I/O port free driver - Making MegaRAID SAS driver
Hi,
On the large servers, I/O port resource may not be assigned to all the PCI devices since it is limited (to 64KB on Intel Architecture[1]) and it may also be fragmented (I/O base register of PCI-to-PCI bridge will usually be aligned to a 4KB boundary[2]).
If no I/O port resource is assigned to devices, those devices do not work.
[1] Some machines support 64KB I/O port space per PCI segment.
[2] Some P2P bridges support optional 1KB aligned I/O base.
Therefore, I made a patch for MegaRAID SAS driver to make PCI legacy I/O port free.
I have also tested the patch and it had no problem.
The way to make PCI legacy I/O port free is the same as Fusion-MPT driver's and it has been merged into 2.6.30.4.
This has already been fixed in e1000 and lpfc.
As a result of the above, the driver can handle its device even when there are a huge number of PCI devices being used on the system and no I/O port region assigned to the device.
Thanks,
Noriyuki Fujii
drivers/scsi/megaraid/megaraid_sas.c | 14 +++++++++----- 1 files changed, 9 insertions(+), 5 deletions(-)
(quoted diff) +0 -0
b/drivers/scsi/megaraid/megaraid_sas.c
index a39addc..8a58927 100644
drivers/scsi/megaraid/megaraid_sas.c +0 -0
@@ -2087,7 +2087,9 @@ static int megasas_init_mfi(struct
megasas_instance *instance)
instance->base_addr = pci_resource_start(instance->pdev, 0);
}
- if (pci_request_regions(instance->pdev, "megasas: LSI")) {
+ 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"); return -EBUSY;
}
@@ -2220,7 +2222,8 @@ static int megasas_init_mfi(struct megasas_instance *instance)
iounmap(instance->reg_set);
fail_ioremap:
- pci_release_regions(instance->pdev);
+ pci_release_selected_regions(instance->pdev,
+ pci_select_bars(instance->pdev, IORESOURCE_MEM));
return -EINVAL;
}
@@ -2240,7 +2243,8 @@ static void megasas_release_mfi(struct megasas_instance *instance)
iounmap(instance->reg_set);
- pci_release_regions(instance->pdev);
+ pci_release_selected_regions(instance->pdev,
+ pci_select_bars(instance->pdev, IORESOURCE_MEM));
}
/**
@@ -2537,7 +2541,7 @@ megasas_probe_one(struct pci_dev *pdev, const struct pci_device_id *id)
/*
* PCI prepping: enable device set bus mastering and dma mask */
- rval = pci_enable_device(pdev);
+ rval = pci_enable_device_mem(pdev);
if (rval) {
return rval;
@@ -2818,7 +2822,7 @@ megasas_resume(struct pci_dev *pdev)
/*
* PCI prepping: enable device set bus mastering and dma mask */
- rval = pci_enable_device(pdev);
+ rval = pci_enable_device_mem(pdev);
if (rval) {
printk(KERN_ERR "megasas: Enable device failed\n");
2009/11/19 Noriyuki Fujii <[email protected]>:
Quoted 20 lines
Hi,
On the large servers, I/O port resource may not be assigned to all the PCI devices since it is limited (to 64KB on Intel Architecture[1]) and it may also be fragmented (I/O base register of PCI-to-PCI bridge will usually be aligned to a 4KB boundary[2]).
If no I/O port resource is assigned to devices, those devices do not work.
[1] Some machines support 64KB I/O port space per PCI segment.
[2] Some P2P bridges support optional 1KB aligned I/O base.Therefore, I made a patch for MegaRAID SAS driver to make PCI legacy I/O port free.
I have also tested the patch and it had no problem.The way to make PCI legacy I/O port free is the same as Fusion-MPT driver's and it has been merged into 2.6.30.4.
This has already been fixed in e1000 and lpfc.
Quoted 8 lines
As a result of the above, the driver can handle its device even when there are a huge number of PCI devices being used on the system and no I/O port region assigned to the device.
Thanks,
Noriyuki FujiiSigned-off-by Noriyuki Fujii [email protected]
YH