1#include <linux/init.h>
2#include <linux/pci.h>
3
4
5#define PCIA 1
6#define PCIB 2
7#define PCIC 3
8#define PCID 4
9
10
11static char pci_irq[5] __initdata;
12
13static char irq_tab[][5] __initdata = {
14
15 {0, 0, 0, 0, 0 },
16 {0, 0, 0, 0, 0 },
17 {0, 0, 0, 0, 0 },
18 {0, 0, 0, 0, 0 },
19 {0, 0, 0, 0, 0 },
20 {0, 0, 0, 0, 0 },
21 {0, 0, 0, 0, 0 },
22 {0, 0, 0, 0, 0 },
23 {0, 0, 0, 0, 0 },
24 {0, 0, 0, 0, 0 },
25 {0, 0, 0, 0, PCID },
26 {0, PCIB, 0, 0, 0 },
27 {0, PCIC, 0, 0, 0 },
28 {0, 0, 0, 0, 0 },
29 {0, 0, 0, 0, 0 },
30 {0, 0, 0, 0, 0 },
31 {0, 0, 0, 0, 0 },
32 {0, 0, 0, 0, 0 },
33 {0, PCIA, PCIB, PCIC, PCID },
34 {0, PCIB, PCIC, PCID, PCIA },
35 {0, PCIC, PCID, PCIA, PCIB },
36 {0, PCID, PCIA, PCIB, PCIC }
37};
38
39int __init pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
40{
41 int virq;
42 virq = irq_tab[slot][pin];
43 return pci_irq[virq];
44}
45
46
47int pcibios_plat_dev_init(struct pci_dev *dev)
48{
49 return 0;
50}
51
52static void __init malta_piix_func0_fixup(struct pci_dev *pdev)
53{
54 unsigned char reg_val;
55 static int piixirqmap[16] __initdata = {
56 0, 0, 0, 3,
57 4, 5, 6, 7,
58 0, 9, 10, 11,
59 12, 0, 14, 15
60 };
61 int i;
62
63
64 for (i = 0; i <= 3; i++) {
65 pci_read_config_byte(pdev, 0x60+i, ®_val);
66 if (reg_val & 0x80)
67 pci_irq[PCIA+i] = 0;
68 else
69 pci_irq[PCIA+i] = piixirqmap[reg_val & 15];
70 }
71
72
73 if (PCI_SLOT(pdev->devfn) == 10) {
74
75
76
77
78 pci_read_config_byte(pdev, 0x69, ®_val);
79 pci_write_config_byte(pdev, 0x69, reg_val | 0xf0);
80 }
81}
82
83DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82371AB_0,
84 malta_piix_func0_fixup);
85
86static void __init malta_piix_func1_fixup(struct pci_dev *pdev)
87{
88 unsigned char reg_val;
89
90
91 if (PCI_SLOT(pdev->devfn) == 10) {
92
93
94
95 pci_read_config_byte(pdev, 0x41, ®_val);
96 pci_write_config_byte(pdev, 0x41, reg_val|0x80);
97 pci_read_config_byte(pdev, 0x43, ®_val);
98 pci_write_config_byte(pdev, 0x43, reg_val|0x80);
99 }
100}
101
102DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82371AB,
103 malta_piix_func1_fixup);
104