common.c (ef407beefbd9928792ccc93857e408e0057bc17b) common.c (9ad62ec4f752c82b39aa5927f23d894b46ae10b9)
1#include <linux/pci.h>
2#include <linux/interrupt.h>
3#include <linux/timer.h>
4#include <linux/kernel.h>
5
1#include <linux/pci.h>
2#include <linux/interrupt.h>
3#include <linux/timer.h>
4#include <linux/kernel.h>
5
6static int __init
7early_read_config_word(struct pci_channel *hose,
8 int top_bus, int bus, int devfn, int offset, u16 *value)
6/*
7 * These functions are used early on before PCI scanning is done
8 * and all of the pci_dev and pci_bus structures have been created.
9 */
10static struct pci_dev *fake_pci_dev(struct pci_channel *hose,
11 int top_bus, int busnr, int devfn)
9{
12{
10 struct pci_dev fake_dev;
11 struct pci_bus fake_bus;
13 static struct pci_dev dev;
14 static struct pci_bus bus;
12
15
13 fake_dev.bus = &fake_bus;
14 fake_dev.sysdata = hose;
15 fake_dev.devfn = devfn;
16 fake_bus.number = bus;
17 fake_bus.sysdata = hose;
18 fake_bus.ops = hose->pci_ops;
16 dev.bus = &bus;
17 dev.sysdata = hose;
18 dev.devfn = devfn;
19 bus.number = busnr;
20 bus.sysdata = hose;
21 bus.ops = hose->pci_ops;
19
22
20 if (bus != top_bus)
23 if(busnr != top_bus)
21 /* Fake a parent bus structure. */
24 /* Fake a parent bus structure. */
22 fake_bus.parent = &fake_bus;
25 bus.parent = &bus;
23 else
26 else
24 fake_bus.parent = NULL;
27 bus.parent = NULL;
25
28
26 return pci_read_config_word(&fake_dev, offset, value);
29 return &dev;
27}
28
30}
31
32#define EARLY_PCI_OP(rw, size, type) \
33int __init early_##rw##_config_##size(struct pci_channel *hose, \
34 int top_bus, int bus, int devfn, int offset, type value) \
35{ \
36 return pci_##rw##_config_##size( \
37 fake_pci_dev(hose, top_bus, bus, devfn), \
38 offset, value); \
39}
40
41EARLY_PCI_OP(read, byte, u8 *)
42EARLY_PCI_OP(read, word, u16 *)
43EARLY_PCI_OP(read, dword, u32 *)
44EARLY_PCI_OP(write, byte, u8)
45EARLY_PCI_OP(write, word, u16)
46EARLY_PCI_OP(write, dword, u32)
47
29int __init pci_is_66mhz_capable(struct pci_channel *hose,
30 int top_bus, int current_bus)
31{
32 u32 pci_devfn;
33 unsigned short vid;
34 int cap66 = -1;
35 u16 stat;
36

--- 91 unchanged lines hidden (view full) ---

128 pcibios_report_status(PCI_STATUS_PARITY |
129 PCI_STATUS_DETECTED_PARITY, 1);
130 printk("\n");
131
132 cmd |= PCI_STATUS_PARITY | PCI_STATUS_DETECTED_PARITY;
133
134 /* Now back off of the IRQ for awhile */
135 if (hose->err_irq) {
48int __init pci_is_66mhz_capable(struct pci_channel *hose,
49 int top_bus, int current_bus)
50{
51 u32 pci_devfn;
52 unsigned short vid;
53 int cap66 = -1;
54 u16 stat;
55

--- 91 unchanged lines hidden (view full) ---

147 pcibios_report_status(PCI_STATUS_PARITY |
148 PCI_STATUS_DETECTED_PARITY, 1);
149 printk("\n");
150
151 cmd |= PCI_STATUS_PARITY | PCI_STATUS_DETECTED_PARITY;
152
153 /* Now back off of the IRQ for awhile */
154 if (hose->err_irq) {
136 disable_irq(hose->err_irq);
155 disable_irq_nosync(hose->err_irq);
137 hose->err_timer.expires = jiffies + HZ;
138 add_timer(&hose->err_timer);
139 }
140 }
141
142 return cmd;
143}
156 hose->err_timer.expires = jiffies + HZ;
157 add_timer(&hose->err_timer);
158 }
159 }
160
161 return cmd;
162}