Commit 3967f4c3 authored by Doug Ledford's avatar Doug Ledford

aic7xxx_old: improve usage of pci_request_regions due to device contention

parent 11b9cebf
...@@ -6736,12 +6736,12 @@ aic7xxx_device_queue_depth(struct aic7xxx_host *p, Scsi_Device *device) ...@@ -6736,12 +6736,12 @@ aic7xxx_device_queue_depth(struct aic7xxx_host *p, Scsi_Device *device)
* prepare for this device to go away * prepare for this device to go away
*-F*************************************************************************/ *-F*************************************************************************/
static void static void
aic7xxx_slave_destroy(Scsi_Device *sdpnt) aic7xxx_slave_destroy(Scsi_Device *SDptr)
{ {
struct aic_dev_data *aic_dev = sdpnt->hostdata; struct aic_dev_data *aic_dev = SDptr->hostdata;
list_del(&aic_dev->list); list_del(&aic_dev->list);
sdpnt->hostdata = NULL; SDptr->hostdata = NULL;
kfree(aic_dev); kfree(aic_dev);
return; return;
} }
...@@ -6756,16 +6756,16 @@ aic7xxx_slave_destroy(Scsi_Device *sdpnt) ...@@ -6756,16 +6756,16 @@ aic7xxx_slave_destroy(Scsi_Device *sdpnt)
* depths, allocate command structs, etc. * depths, allocate command structs, etc.
*-F*************************************************************************/ *-F*************************************************************************/
static int static int
aic7xxx_slave_configure(Scsi_Device *sdpnt) aic7xxx_slave_configure(Scsi_Device *SDptr)
{ {
struct aic7xxx_host *p = (struct aic7xxx_host *) sdpnt->host->hostdata; struct aic7xxx_host *p = (struct aic7xxx_host *) SDptr->host->hostdata;
struct aic_dev_data *aic_dev; struct aic_dev_data *aic_dev;
int scbnum; int scbnum;
aic_dev = (struct aic_dev_data *)sdpnt->hostdata; aic_dev = (struct aic_dev_data *)SDptr->hostdata;
aic7xxx_init_transinfo(p, aic_dev); aic7xxx_init_transinfo(p, aic_dev);
aic7xxx_device_queue_depth(p, sdpnt); aic7xxx_device_queue_depth(p, SDptr);
if(list_empty(&aic_dev->list)) if(list_empty(&aic_dev->list))
list_add_tail(&aic_dev->list, &p->aic_devs); list_add_tail(&aic_dev->list, &p->aic_devs);
...@@ -9024,7 +9024,6 @@ aic7xxx_detect(Scsi_Host_Template *template) ...@@ -9024,7 +9024,6 @@ aic7xxx_detect(Scsi_Host_Template *template)
template->proc_name = "aic7xxx"; template->proc_name = "aic7xxx";
template->sg_tablesize = AIC7XXX_MAX_SG; template->sg_tablesize = AIC7XXX_MAX_SG;
template->max_sectors = 2048;
#ifdef CONFIG_PCI #ifdef CONFIG_PCI
...@@ -9246,12 +9245,22 @@ aic7xxx_detect(Scsi_Host_Template *template) ...@@ -9246,12 +9245,22 @@ aic7xxx_detect(Scsi_Host_Template *template)
{ {
/* duplicate PCI entry, skip it */ /* duplicate PCI entry, skip it */
kfree(temp_p); kfree(temp_p);
temp_p = NULL; continue;
} }
current_p = current_p->next; current_p = current_p->next;
} }
if ( temp_p == NULL ) if(pci_request_regions(temp_p->pdev, "aic7xxx"))
{
printk("aic7xxx: <%s> at PCI %d/%d/%d\n",
board_names[aic_pdevs[i].board_name_index],
temp_p->pci_bus,
PCI_SLOT(temp_p->pci_device_fn),
PCI_FUNC(temp_p->pci_device_fn));
printk("aic7xxx: I/O ports already in use, ignoring.\n");
kfree(temp_p);
continue; continue;
}
if (aic7xxx_verbose & VERBOSE_PROBE2) if (aic7xxx_verbose & VERBOSE_PROBE2)
printk("aic7xxx: <%s> at PCI %d/%d\n", printk("aic7xxx: <%s> at PCI %d/%d\n",
board_names[aic_pdevs[i].board_name_index], board_names[aic_pdevs[i].board_name_index],
...@@ -9283,20 +9292,6 @@ aic7xxx_detect(Scsi_Host_Template *template) ...@@ -9283,20 +9292,6 @@ aic7xxx_detect(Scsi_Host_Template *template)
pci_write_config_dword(pdev, DEVCONFIG, devconfig); pci_write_config_dword(pdev, DEVCONFIG, devconfig);
#endif /* AIC7XXX_STRICT_PCI_SETUP */ #endif /* AIC7XXX_STRICT_PCI_SETUP */
if(temp_p->base && !request_region(temp_p->base, MAXREG - MINREG,
"aic7xxx"))
{
printk("aic7xxx: <%s> at PCI %d/%d/%d\n",
board_names[aic_pdevs[i].board_name_index],
temp_p->pci_bus,
PCI_SLOT(temp_p->pci_device_fn),
PCI_FUNC(temp_p->pci_device_fn));
printk("aic7xxx: I/O ports already in use, ignoring.\n");
kfree(temp_p);
temp_p = NULL;
continue;
}
temp_p->unpause = INTEN; temp_p->unpause = INTEN;
temp_p->pause = temp_p->unpause | PAUSE; temp_p->pause = temp_p->unpause | PAUSE;
if ( ((temp_p->base == 0) && if ( ((temp_p->base == 0) &&
...@@ -9309,9 +9304,7 @@ aic7xxx_detect(Scsi_Host_Template *template) ...@@ -9309,9 +9304,7 @@ aic7xxx_detect(Scsi_Host_Template *template)
PCI_SLOT(temp_p->pci_device_fn), PCI_SLOT(temp_p->pci_device_fn),
PCI_FUNC(temp_p->pci_device_fn)); PCI_FUNC(temp_p->pci_device_fn));
printk("aic7xxx: Controller disabled by BIOS, ignoring.\n"); printk("aic7xxx: Controller disabled by BIOS, ignoring.\n");
kfree(temp_p); goto skip_pci_controller;
temp_p = NULL;
continue;
} }
#ifdef MMAPIO #ifdef MMAPIO
...@@ -9353,9 +9346,7 @@ aic7xxx_detect(Scsi_Host_Template *template) ...@@ -9353,9 +9346,7 @@ aic7xxx_detect(Scsi_Host_Template *template)
PCI_SLOT(temp_p->pci_device_fn), PCI_SLOT(temp_p->pci_device_fn),
PCI_FUNC(temp_p->pci_device_fn)); PCI_FUNC(temp_p->pci_device_fn));
printk("aic7xxx: Controller disabled by BIOS, ignoring.\n"); printk("aic7xxx: Controller disabled by BIOS, ignoring.\n");
kfree(temp_p); goto skip_pci_controller;
temp_p = NULL;
continue;
} }
} }
} }
...@@ -9398,10 +9389,7 @@ aic7xxx_detect(Scsi_Host_Template *template) ...@@ -9398,10 +9389,7 @@ aic7xxx_detect(Scsi_Host_Template *template)
if (aic7xxx_chip_reset(temp_p) == -1) if (aic7xxx_chip_reset(temp_p) == -1)
{ {
release_region(temp_p->base, MAXREG - MINREG); goto skip_pci_controller;
kfree(temp_p);
temp_p = NULL;
continue;
} }
/* /*
* Very quickly put the term setting back into the register since * Very quickly put the term setting back into the register since
...@@ -9687,6 +9675,10 @@ aic7xxx_detect(Scsi_Host_Template *template) ...@@ -9687,6 +9675,10 @@ aic7xxx_detect(Scsi_Host_Template *template)
} }
temp_p->next = NULL; temp_p->next = NULL;
found++; found++;
continue;
skip_pci_controller:
pci_release_regions(temp_p->pdev);
kfree(temp_p);
} /* Found an Adaptec PCI device. */ } /* Found an Adaptec PCI device. */
else /* Well, we found one, but we couldn't get any memory */ else /* Well, we found one, but we couldn't get any memory */
{ {
...@@ -10969,14 +10961,16 @@ aic7xxx_release(struct Scsi_Host *host) ...@@ -10969,14 +10961,16 @@ aic7xxx_release(struct Scsi_Host *host)
if(p->irq) if(p->irq)
free_irq(p->irq, p); free_irq(p->irq, p);
if(p->base)
release_region(p->base, MAXREG - MINREG);
#ifdef MMAPIO #ifdef MMAPIO
if(p->maddr) if(p->maddr)
{ {
iounmap((void *) (((unsigned long) p->maddr) & PAGE_MASK)); iounmap((void *) (((unsigned long) p->maddr) & PAGE_MASK));
} }
#endif /* MMAPIO */ #endif /* MMAPIO */
if(!p->pdev)
release_region(p->base, MAXREG - MINREG);
else
pci_release_regions(p->pdev);
prev = NULL; prev = NULL;
next = first_aic7xxx; next = first_aic7xxx;
while(next != NULL) while(next != NULL)
......
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