git://git.onelab.eu
/
linux-2.6.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fedora kernel-2.6.17-1.2142_FC4 patched with stable patch-2.6.17.4-vs2.0.2-rc26.diff
[linux-2.6.git]
/
arch
/
i386
/
pci
/
direct.c
diff --git
a/arch/i386/pci/direct.c
b/arch/i386/pci/direct.c
index
30b7e9b
..
5d81fb5
100644
(file)
--- a/
arch/i386/pci/direct.c
+++ b/
arch/i386/pci/direct.c
@@
-4,6
+4,7
@@
#include <linux/pci.h>
#include <linux/init.h>
#include <linux/pci.h>
#include <linux/init.h>
+#include <linux/dmi.h>
#include "pci.h"
/*
#include "pci.h"
/*
@@
-13,13
+14,15
@@
#define PCI_CONF1_ADDRESS(bus, devfn, reg) \
(0x80000000 | (bus << 16) | (devfn << 8) | (reg & ~3))
#define PCI_CONF1_ADDRESS(bus, devfn, reg) \
(0x80000000 | (bus << 16) | (devfn << 8) | (reg & ~3))
-
static
int pci_conf1_read(unsigned int seg, unsigned int bus,
+int pci_conf1_read(unsigned int seg, unsigned int bus,
unsigned int devfn, int reg, int len, u32 *value)
{
unsigned long flags;
unsigned int devfn, int reg, int len, u32 *value)
{
unsigned long flags;
- if (!value || (bus > 255) || (devfn > 255) || (reg > 255))
+ if ((bus > 255) || (devfn > 255) || (reg > 255)) {
+ *value = -1;
return -EINVAL;
return -EINVAL;
+ }
spin_lock_irqsave(&pci_config_lock, flags);
spin_lock_irqsave(&pci_config_lock, flags);
@@
-42,7
+45,7
@@
static int pci_conf1_read(unsigned int seg, unsigned int bus,
return 0;
}
return 0;
}
-
static
int pci_conf1_write(unsigned int seg, unsigned int bus,
+int pci_conf1_write(unsigned int seg, unsigned int bus,
unsigned int devfn, int reg, int len, u32 value)
{
unsigned long flags;
unsigned int devfn, int reg, int len, u32 value)
{
unsigned long flags;
@@
-91,8
+94,10
@@
static int pci_conf2_read(unsigned int seg, unsigned int bus,
unsigned long flags;
int dev, fn;
unsigned long flags;
int dev, fn;
- if (!value || (bus > 255) || (devfn > 255) || (reg > 255))
+ if ((bus > 255) || (devfn > 255) || (reg > 255)) {
+ *value = -1;
return -EINVAL;
return -EINVAL;
+ }
dev = PCI_SLOT(devfn);
fn = PCI_FUNC(devfn);
dev = PCI_SLOT(devfn);
fn = PCI_FUNC(devfn);
@@
-188,6
+193,10
@@
static int __init pci_sanity_check(struct pci_raw_ops *o)
if (pci_probe & PCI_NO_CHECKS)
return 1;
if (pci_probe & PCI_NO_CHECKS)
return 1;
+ /* Assume Type 1 works for newer systems.
+ This handles machines that don't have anything on PCI Bus 0. */
+ if (dmi_get_year(DMI_BIOS_DATE) >= 2001)
+ return 1;
for (devfn = 0; devfn < 0x100; devfn++) {
if (o->read(0, 0, devfn, PCI_CLASS_DEVICE, 2, &x))
for (devfn = 0; devfn < 0x100; devfn++) {
if (o->read(0, 0, devfn, PCI_CLASS_DEVICE, 2, &x))
@@
-201,7
+210,7
@@
static int __init pci_sanity_check(struct pci_raw_ops *o)
return 1;
}
return 1;
}
- DBG("PCI: Sanity check failed\n");
+ DBG(
KERN_WARNING
"PCI: Sanity check failed\n");
return 0;
}
return 0;
}
@@
-245,7
+254,7
@@
static int __init pci_check_type2(void)
return works;
}
return works;
}
-
static int
__init pci_direct_init(void)
+
void
__init pci_direct_init(void)
{
struct resource *region, *region2;
{
struct resource *region, *region2;
@@
-258,16
+267,16
@@
static int __init pci_direct_init(void)
if (pci_check_type1()) {
printk(KERN_INFO "PCI: Using configuration type 1\n");
raw_pci_ops = &pci_direct_conf1;
if (pci_check_type1()) {
printk(KERN_INFO "PCI: Using configuration type 1\n");
raw_pci_ops = &pci_direct_conf1;
- return
0
;
+ return;
}
release_resource(region);
type2:
if ((pci_probe & PCI_PROBE_CONF2) == 0)
}
release_resource(region);
type2:
if ((pci_probe & PCI_PROBE_CONF2) == 0)
-
goto out
;
+
return
;
region = request_region(0xCF8, 4, "PCI conf2");
if (!region)
region = request_region(0xCF8, 4, "PCI conf2");
if (!region)
-
goto out
;
+
return
;
region2 = request_region(0xC000, 0x1000, "PCI conf2");
if (!region2)
goto fail2;
region2 = request_region(0xC000, 0x1000, "PCI conf2");
if (!region2)
goto fail2;
@@
-275,15
+284,10
@@
static int __init pci_direct_init(void)
if (pci_check_type2()) {
printk(KERN_INFO "PCI: Using configuration type 2\n");
raw_pci_ops = &pci_direct_conf2;
if (pci_check_type2()) {
printk(KERN_INFO "PCI: Using configuration type 2\n");
raw_pci_ops = &pci_direct_conf2;
- return
0
;
+ return;
}
release_resource(region2);
fail2:
release_resource(region);
}
release_resource(region2);
fail2:
release_resource(region);
-
- out:
- return 0;
}
}
-
-arch_initcall(pci_direct_init);