aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/setup-pci.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/ide/setup-pci.c')
-rw-r--r--drivers/ide/setup-pci.c48
1 files changed, 1 insertions, 47 deletions
diff --git a/drivers/ide/setup-pci.c b/drivers/ide/setup-pci.c
index 8947597e6bec..699c72947967 100644
--- a/drivers/ide/setup-pci.c
+++ b/drivers/ide/setup-pci.c
@@ -20,51 +20,6 @@
20#include <asm/io.h> 20#include <asm/io.h>
21#include <asm/irq.h> 21#include <asm/irq.h>
22 22
23
24/**
25 * ide_match_hwif - find free ide_hwifs[] slot
26 * @bootable: bootable flag
27 *
28 * Return the new hwif. If we are out of free slots return NULL.
29 */
30
31static ide_hwif_t *ide_match_hwif(u8 bootable)
32{
33 ide_hwif_t *hwif;
34 int h;
35
36 /*
37 * Claim an unassigned slot.
38 *
39 * Give preference to claiming other slots before claiming ide0/ide1,
40 * just in case there's another interface yet-to-be-scanned
41 * which uses ports 1f0/170 (the ide0/ide1 defaults).
42 *
43 * Unless there is a bootable card that does not use the standard
44 * ports 1f0/170 (the ide0/ide1 defaults). The (bootable) flag.
45 */
46 if (bootable) {
47 for (h = 0; h < MAX_HWIFS; ++h) {
48 hwif = &ide_hwifs[h];
49 if (hwif->chipset == ide_unknown)
50 return hwif; /* pick an unused entry */
51 }
52 } else {
53 for (h = 2; h < MAX_HWIFS; ++h) {
54 hwif = ide_hwifs + h;
55 if (hwif->chipset == ide_unknown)
56 return hwif; /* pick an unused entry */
57 }
58 }
59 for (h = 0; h < 2 && h < MAX_HWIFS; ++h) {
60 hwif = ide_hwifs + h;
61 if (hwif->chipset == ide_unknown)
62 return hwif; /* pick an unused entry */
63 }
64
65 return NULL;
66}
67
68/** 23/**
69 * ide_setup_pci_baseregs - place a PCI IDE controller native 24 * ide_setup_pci_baseregs - place a PCI IDE controller native
70 * @dev: PCI device of interface to switch native 25 * @dev: PCI device of interface to switch native
@@ -320,7 +275,6 @@ static ide_hwif_t *ide_hwif_configure(struct pci_dev *dev,
320{ 275{
321 unsigned long ctl = 0, base = 0; 276 unsigned long ctl = 0, base = 0;
322 ide_hwif_t *hwif; 277 ide_hwif_t *hwif;
323 u8 bootable = (d->host_flags & IDE_HFLAG_NON_BOOTABLE) ? 0 : 1;
324 struct hw_regs_s hw; 278 struct hw_regs_s hw;
325 279
326 if ((d->host_flags & IDE_HFLAG_ISA_PORTS) == 0) { 280 if ((d->host_flags & IDE_HFLAG_ISA_PORTS) == 0) {
@@ -346,7 +300,7 @@ static ide_hwif_t *ide_hwif_configure(struct pci_dev *dev,
346 base = port ? 0x170 : 0x1f0; 300 base = port ? 0x170 : 0x1f0;
347 } 301 }
348 302
349 hwif = ide_match_hwif(bootable); 303 hwif = ide_find_port_slot(d);
350 if (hwif == NULL) { 304 if (hwif == NULL) {
351 printk(KERN_ERR "%s: too many IDE interfaces, no room in " 305 printk(KERN_ERR "%s: too many IDE interfaces, no room in "
352 "table\n", d->name); 306 "table\n", d->name);