1
2
3
4
5
6
7
8
9
10#include <linux/kernel.h>
11#include <linux/init.h>
12#include <linux/pci.h>
13
14#include <asm/mipsregs.h>
15#include <asm/sni.h>
16
17#include <irq.h>
18
19
20
21
22#define SCSI PCIMT_IRQ_SCSI
23#define ETH PCIMT_IRQ_ETHERNET
24#define INTA PCIMT_IRQ_INTA
25#define INTB PCIMT_IRQ_INTB
26#define INTC PCIMT_IRQ_INTC
27#define INTD PCIMT_IRQ_INTD
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43static char irq_tab_rm200[8][5] = {
44
45 { 0, 0, 0, 0, 0 },
46 { SCSI, SCSI, SCSI, SCSI, SCSI },
47 { ETH, ETH, ETH, ETH, ETH },
48 { INTB, INTB, INTB, INTB, INTB },
49 { 0, 0, 0, 0, 0 },
50 { 0, INTB, INTC, INTD, INTA },
51 { 0, INTC, INTD, INTA, INTB },
52 { 0, INTD, INTA, INTB, INTC },
53};
54
55
56
57
58
59
60static char irq_tab_rm300d[8][5] = {
61
62 { 0, 0, 0, 0, 0 },
63 { SCSI, SCSI, SCSI, SCSI, SCSI },
64 { 0, INTC, INTD, INTA, INTB },
65 { INTB, INTB, INTB, INTB, INTB },
66 { 0, 0, 0, 0, 0 },
67 { 0, INTB, INTC, INTD, INTA },
68 { 0, INTC, INTD, INTA, INTB },
69 { 0, INTD, INTA, INTB, INTC },
70};
71
72static char irq_tab_rm300e[5][5] = {
73
74 { 0, 0, 0, 0, 0 },
75 { SCSI, SCSI, SCSI, SCSI, SCSI },
76 { 0, INTC, INTD, INTA, INTB },
77 { 0, INTD, INTA, INTB, INTC },
78 { 0, INTA, INTB, INTC, INTD },
79};
80#undef SCSI
81#undef ETH
82#undef INTA
83#undef INTB
84#undef INTC
85#undef INTD
86
87
88
89
90
91#define SCSI0 PCIT_IRQ_SCSI0
92#define SCSI1 PCIT_IRQ_SCSI1
93#define ETH PCIT_IRQ_ETHERNET
94#define INTA PCIT_IRQ_INTA
95#define INTB PCIT_IRQ_INTB
96#define INTC PCIT_IRQ_INTC
97#define INTD PCIT_IRQ_INTD
98
99static char irq_tab_pcit[13][5] = {
100
101 { 0, 0, 0, 0, 0 },
102 { SCSI0, SCSI0, SCSI0, SCSI0, SCSI0 },
103 { SCSI1, SCSI1, SCSI1, SCSI1, SCSI1 },
104 { ETH, ETH, ETH, ETH, ETH },
105 { 0, INTA, INTB, INTC, INTD },
106 { 0, 0, 0, 0, 0 },
107 { 0, 0, 0, 0, 0 },
108 { 0, 0, 0, 0, 0 },
109 { 0, INTA, INTB, INTC, INTD },
110 { 0, INTB, INTC, INTD, INTA },
111 { 0, INTC, INTD, INTA, INTB },
112 { 0, INTD, INTA, INTB, INTC },
113 { 0, INTA, INTB, INTC, INTD },
114};
115
116static char irq_tab_pcit_cplus[13][5] = {
117
118 { 0, 0, 0, 0, 0 },
119 { 0, INTB, INTC, INTD, INTA },
120 { 0, 0, 0, 0, 0 },
121 { 0, 0, 0, 0, 0 },
122 { 0, INTA, INTB, INTC, INTD },
123 { 0, INTB, INTC, INTD, INTA },
124};
125
126static inline int is_rm300_revd(void)
127{
128 unsigned char csmsr = *(volatile unsigned char *)PCIMT_CSMSR;
129
130 return (csmsr & 0xa0) == 0x20;
131}
132
133int pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
134{
135 switch (sni_brd_type) {
136 case SNI_BRD_PCI_TOWER_CPLUS:
137 if (slot == 4) {
138
139
140
141
142 while (dev && dev->bus->number != 1)
143 dev = dev->bus->self;
144 if (dev && dev->devfn >= PCI_DEVFN(4, 0))
145 slot = 5;
146 }
147 return irq_tab_pcit_cplus[slot][pin];
148 case SNI_BRD_PCI_TOWER:
149 return irq_tab_pcit[slot][pin];
150
151 case SNI_BRD_PCI_MTOWER:
152 if (is_rm300_revd())
153 return irq_tab_rm300d[slot][pin];
154
155
156 case SNI_BRD_PCI_DESKTOP:
157 return irq_tab_rm200[slot][pin];
158
159 case SNI_BRD_PCI_MTOWER_CPLUS:
160 return irq_tab_rm300e[slot][pin];
161 }
162
163 return 0;
164}
165
166
167int pcibios_plat_dev_init(struct pci_dev *dev)
168{
169 return 0;
170}
171