Index: arch/i386/pci/direct.c
===================================================================
RCS file: /var/cvs/linux-2.5/arch/i386/pci/direct.c,v
retrieving revision 1.6
diff -u -p -r1.6 direct.c
--- arch/i386/pci/direct.c 25 Feb 2003 12:39:09 -0000 1.6
+++ arch/i386/pci/direct.c 20 Jun 2003 14:30:26 -0000
@@ -200,6 +200,7 @@
static int __init pci_direct_init(void)
{
+ struct resource *region, *region2;
unsigned int tmp;
unsigned long flags;
@@ -237,43 +206,53 @@ static int __init pci_direct_init(void)
/*
* Check if configuration type 1 works.
*/
- if (pci_probe & PCI_PROBE_CONF1) {
- outb (0x01, 0xCFB);
- tmp = inl (0xCF8);
- outl (0x80000000, 0xCF8);
- if (inl (0xCF8) == 0x80000000 &&
- pci_sanity_check(&pci_direct_conf1)) {
- outl (tmp, 0xCF8);
- local_irq_restore(flags);
- printk(KERN_INFO "PCI: Using configuration type 1\n");
- if (!request_region(0xCF8, 8, "PCI conf1"))
- pci_root_ops = NULL;
- else
- pci_root_ops = &pci_direct_conf1;
- return 0;
- }
- outl (tmp, 0xCF8);
+ if (!pci_probe & PCI_PROBE_CONF1)
+ goto type2;
+ region = request_region(0xCF8, 8, "PCI conf1");
+ if (!region)
+ goto type2;
+
+ outb(0x01, 0xCFB);
+ tmp = inl(0xCF8);
+ outl(0x80000000, 0xCF8);
+ if (inl(0xCF8) == 0x80000000 &&
+ pci_sanity_check(&pci_direct_conf1)) {
+ outl(tmp, 0xCF8);
+ local_irq_restore(flags);
+ printk(KERN_INFO "PCI: Using configuration type 1\n");
+ raw_pci_ops = &pci_direct_conf1;
+ return 0;
}
+ outl(tmp, 0xCF8);
+ release_resource(region);
+ type2:
/*
* Check if configuration type 2 works.
*/
- if (pci_probe & PCI_PROBE_CONF2) {
- outb (0x00, 0xCFB);
- outb (0x00, 0xCF8);
- outb (0x00, 0xCFA);
- if (inb (0xCF8) == 0x00 && inb (0xCFA) == 0x00 &&
- pci_sanity_check(&pci_direct_conf2)) {
- local_irq_restore(flags);
- printk(KERN_INFO "PCI: Using configuration type 2\n");
- if (!request_region(0xCF8, 4, "PCI conf2"))
- pci_root_ops = NULL;
- else
- pci_root_ops = &pci_direct_conf2;
- return 0;
- }
- }
+ if (!pci_probe & PCI_PROBE_CONF2)
+ goto out;
+ region = request_region(0xCF8, 4, "PCI conf2");
+ if (!region)
+ goto out;
+ region2 = request_region(0xC000, 0xfff, "PCI conf2");
+ if (!region2)
+ goto fail2;
+ outb(0x00, 0xCFB);
+ outb(0x00, 0xCF8);
+ outb(0x00, 0xCFA);
+ if (inb(0xCF8) == 0x00 && inb(0xCFA) == 0x00 &&
+ pci_sanity_check(&pci_direct_conf2)) {
+ local_irq_restore(flags);
+ printk(KERN_INFO "PCI: Using configuration type 2\n");
+ raw_pci_ops = &pci_direct_conf2;
+ return 0;
+ }
+ release_resource(region2);
+ fail2:
+ release_resource(region);
+ out:
local_irq_restore(flags);
return 0;
}
-- "It's not Hollywood. War is real, war is primarily not about defeat or victory, it is about death. I've seen thousands and thousands of dead bodies. Do you think I want to have an academic debate on this subject?" -- Robert Fisk - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/