Commit 5aeeb78a authored by Sreekanth Reddy's avatar Sreekanth Reddy Committed by James Bottomley

mpt2sas, mpt3sas: Abort initialization if no memory I/O resources detected

Driver crashes if the BIOS do not set up at least one
memory I/O resource. This failure can happen if the device is too
slow to respond during POST and is missed by the BIOS, but Linux
then detects the device later in the boot process.

Based on a patch from Timothy Pearson <tpearson@raptorengineeringinc.com>
Signed-off-by: default avatarSreekanth Reddy <Sreekanth.Reddy@avagotech.com>
Reviewed-by: default avatarHannes Reinecke <hare@suse.com>
Signed-off-by: default avatarJames Bottomley <JBottomley@Odin.com>
parent 8d16366b
...@@ -1557,7 +1557,8 @@ mpt2sas_base_map_resources(struct MPT2SAS_ADAPTER *ioc) ...@@ -1557,7 +1557,8 @@ mpt2sas_base_map_resources(struct MPT2SAS_ADAPTER *ioc)
goto out_fail; goto out_fail;
} }
for (i = 0, memap_sz = 0, pio_sz = 0 ; i < DEVICE_COUNT_RESOURCE; i++) { for (i = 0, memap_sz = 0, pio_sz = 0; (i < DEVICE_COUNT_RESOURCE) &&
(!memap_sz || !pio_sz); i++) {
if (pci_resource_flags(pdev, i) & IORESOURCE_IO) { if (pci_resource_flags(pdev, i) & IORESOURCE_IO) {
if (pio_sz) if (pio_sz)
continue; continue;
...@@ -1572,16 +1573,17 @@ mpt2sas_base_map_resources(struct MPT2SAS_ADAPTER *ioc) ...@@ -1572,16 +1573,17 @@ mpt2sas_base_map_resources(struct MPT2SAS_ADAPTER *ioc)
chip_phys = (u64)ioc->chip_phys; chip_phys = (u64)ioc->chip_phys;
memap_sz = pci_resource_len(pdev, i); memap_sz = pci_resource_len(pdev, i);
ioc->chip = ioremap(ioc->chip_phys, memap_sz); ioc->chip = ioremap(ioc->chip_phys, memap_sz);
if (ioc->chip == NULL) {
printk(MPT2SAS_ERR_FMT "unable to map "
"adapter memory!\n", ioc->name);
r = -EINVAL;
goto out_fail;
}
} }
} }
} }
if (ioc->chip == NULL) {
printk(MPT2SAS_ERR_FMT "unable to map adapter memory! "
"or resource not found\n", ioc->name);
r = -EINVAL;
goto out_fail;
}
_base_mask_interrupts(ioc); _base_mask_interrupts(ioc);
r = _base_get_ioc_facts(ioc, CAN_SLEEP); r = _base_get_ioc_facts(ioc, CAN_SLEEP);
......
...@@ -1843,7 +1843,8 @@ mpt3sas_base_map_resources(struct MPT3SAS_ADAPTER *ioc) ...@@ -1843,7 +1843,8 @@ mpt3sas_base_map_resources(struct MPT3SAS_ADAPTER *ioc)
goto out_fail; goto out_fail;
} }
for (i = 0, memap_sz = 0, pio_sz = 0 ; i < DEVICE_COUNT_RESOURCE; i++) { for (i = 0, memap_sz = 0, pio_sz = 0; (i < DEVICE_COUNT_RESOURCE) &&
(!memap_sz || !pio_sz); i++) {
if (pci_resource_flags(pdev, i) & IORESOURCE_IO) { if (pci_resource_flags(pdev, i) & IORESOURCE_IO) {
if (pio_sz) if (pio_sz)
continue; continue;
...@@ -1856,15 +1857,16 @@ mpt3sas_base_map_resources(struct MPT3SAS_ADAPTER *ioc) ...@@ -1856,15 +1857,16 @@ mpt3sas_base_map_resources(struct MPT3SAS_ADAPTER *ioc)
chip_phys = (u64)ioc->chip_phys; chip_phys = (u64)ioc->chip_phys;
memap_sz = pci_resource_len(pdev, i); memap_sz = pci_resource_len(pdev, i);
ioc->chip = ioremap(ioc->chip_phys, memap_sz); ioc->chip = ioremap(ioc->chip_phys, memap_sz);
if (ioc->chip == NULL) {
pr_err(MPT3SAS_FMT "unable to map adapter memory!\n",
ioc->name);
r = -EINVAL;
goto out_fail;
}
} }
} }
if (ioc->chip == NULL) {
pr_err(MPT3SAS_FMT "unable to map adapter memory! "
" or resource not found\n", ioc->name);
r = -EINVAL;
goto out_fail;
}
_base_mask_interrupts(ioc); _base_mask_interrupts(ioc);
r = _base_get_ioc_facts(ioc, CAN_SLEEP); r = _base_get_ioc_facts(ioc, CAN_SLEEP);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment