diff options
author | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2008-04-26 16:25:19 -0400 |
---|---|---|
committer | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2008-04-26 16:25:19 -0400 |
commit | 0d1bad216c43bcee84cc24d1ed003c19134d2645 (patch) | |
tree | 3cdcf7592c4e1a8899cde78beb512bffa21abf77 /drivers/ide/setup-pci.c | |
parent | 7ebe5936c214c656a1625abf9ec3b09e3d1bf34a (diff) |
ide: manage resources for PCI devices in ide_pci_enable() (take 3)
* Reserve PCI BARs 0-3 (0-1 for single port controllers) in
ide_pci_enable() and remove ide_hwif_request_regions() call
from ide_device_add_all() (also cleanup resource management
in scc_pata host driver).
* Fix handling of PCI BAR 4 in ide_pci_enable(), then cleanup
ide_iomio_dma() (+ init_hwif_trm290() in trm290 host driver)
and remove ide_release[_iomio]_dma().
v2:
* Fixup trm290 host driver.
v3:
* Because of scc_pata host driver changes we need to call
pci_request_selected_regions() also in setup_mmio_scc().
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers/ide/setup-pci.c')
-rw-r--r-- | drivers/ide/setup-pci.c | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/drivers/ide/setup-pci.c b/drivers/ide/setup-pci.c index 6302010fd8e2..8812eaa7f169 100644 --- a/drivers/ide/setup-pci.c +++ b/drivers/ide/setup-pci.c | |||
@@ -158,7 +158,7 @@ EXPORT_SYMBOL_GPL(ide_setup_pci_noise); | |||
158 | 158 | ||
159 | static int ide_pci_enable(struct pci_dev *dev, const struct ide_port_info *d) | 159 | static int ide_pci_enable(struct pci_dev *dev, const struct ide_port_info *d) |
160 | { | 160 | { |
161 | int ret; | 161 | int ret, bars; |
162 | 162 | ||
163 | if (pci_enable_device(dev)) { | 163 | if (pci_enable_device(dev)) { |
164 | ret = pci_enable_device_io(dev); | 164 | ret = pci_enable_device_io(dev); |
@@ -181,13 +181,21 @@ static int ide_pci_enable(struct pci_dev *dev, const struct ide_port_info *d) | |||
181 | goto out; | 181 | goto out; |
182 | } | 182 | } |
183 | 183 | ||
184 | /* FIXME: Temporary - until we put in the hotplug interface logic | 184 | if (d->host_flags & IDE_HFLAG_SINGLE) |
185 | Check that the bits we want are not in use by someone else. */ | 185 | bars = (1 << 2) - 1; |
186 | ret = pci_request_region(dev, 4, "ide_tmp"); | 186 | else |
187 | if (ret < 0) | 187 | bars = (1 << 4) - 1; |
188 | goto out; | ||
189 | 188 | ||
190 | pci_release_region(dev, 4); | 189 | if ((d->host_flags & IDE_HFLAG_NO_DMA) == 0) { |
190 | if (d->host_flags & IDE_HFLAG_CS5520) | ||
191 | bars |= (1 << 2); | ||
192 | else | ||
193 | bars |= (1 << 4); | ||
194 | } | ||
195 | |||
196 | ret = pci_request_selected_regions(dev, bars, d->name); | ||
197 | if (ret < 0) | ||
198 | printk(KERN_ERR "%s: can't reserve resources\n", d->name); | ||
191 | out: | 199 | out: |
192 | return ret; | 200 | return ret; |
193 | } | 201 | } |