This patch unifies the use of config options in v2 to all start with CONFIG_
[coreboot.git] / src / mainboard / iei / pcisa-lx-800-r10 / irq_tables.c
1 /*
2  * This file is part of the coreboot project.
3  *
4  * Copyright (C) 2007 Nikolay Petukhov <nikolay.petukhov@gmail.com>
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
19  */
20
21 #include <arch/pirq_routing.h>
22 // #include <console/console.h>
23 #include <arch/io.h>
24
25 /* Platform IRQs */
26 #define PIRQA 11
27 #define PIRQB 10
28 #define PIRQC 11
29 #define PIRQD 5
30
31 /* Link */
32 #define LINK_PIRQA 1
33 #define LINK_PIRQB 2
34 #define LINK_PIRQC 3
35 #define LINK_PIRQD 4
36 #define LINK_NONE 0
37
38 /* Map */
39 #define IRQ_BITMAP_LINKA (1 << PIRQA)
40 #define IRQ_BITMAP_LINKB (1 << PIRQB)
41 #define IRQ_BITMAP_LINKC (1 << PIRQC)
42 #define IRQ_BITMAP_LINKD (1 << PIRQD)
43 #define IRQ_BITMAP_NOLINK 0x0
44
45 #define EXCLUSIVE_PCI_IRQS (IRQ_BITMAP_LINKA | IRQ_BITMAP_LINKB | IRQ_BITMAP_LINKC | IRQ_BITMAP_LINKD)
46
47 const struct irq_routing_table intel_irq_routing_table = {
48         PIRQ_SIGNATURE,         /* u32 signature */
49         PIRQ_VERSION,           /* u16 version   */
50         32 + 16 * CONFIG_IRQ_SLOT_COUNT,/* there can be total 6 devices on the bus */
51         0x00,                   /* Where the interrupt router lies (bus) */
52         (0x0F << 3) | 0x0,      /* Where the interrupt router lies (dev) */
53         EXCLUSIVE_PCI_IRQS,     /* IRQs devoted exclusively to PCI usage */
54         0x1078,                 /* Vendor */
55         0x0002,                 /* Device */
56         0,                      /* Crap (miniport) */
57         {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},      /* u8 rfu[11] */
58         0x62,                   /* u8 checksum , this has to set to some value that would give 0 after the sum of all bytes for this structure (including checksum) */
59
60         .slots = {
61                 [0] = {
62                         .slot = 0x0,    /* means also "on board" */
63                         .bus = 0x00,
64                         .devfn = (0x01<<3)|0x0, /* 0x01 is CS5536 */
65                         .irq = {
66                                 [0] = { /* <-- 0 means this is INTA# output from the device or slot */
67                                         .link = LINK_PIRQA,
68                                         .bitmap = IRQ_BITMAP_LINKA
69                                 },
70                                 [1] = { /* <-- 1 means this is INTB# output from the device or slot */
71                                         .link = LINK_NONE,
72                                         .bitmap = IRQ_BITMAP_NOLINK
73                                 },
74                                 [2] = { /* <-- 2 means this is INTC# output from the device or slot */
75                                         .link = LINK_NONE,
76                                         .bitmap = IRQ_BITMAP_NOLINK
77                                 },
78                                 [3] = { /* <-- 3 means this is INTD# output from the device or slot */
79                                         .link = LINK_NONE,
80                                         .bitmap = IRQ_BITMAP_NOLINK
81                                 }
82                         }
83                 },
84
85                 [1] = {
86                         .slot = 0x0,    /* means also "on board" */
87                         .bus = 0x00,
88                         .devfn = (0x0f<<3)|0x0, /* 0x0f is CS5536 (USB, AUDIO) */
89                         .irq = {
90                                 [0] = { /* <-- 0 means this is INTA# output from the device or slot */
91                                         .link = LINK_NONE,
92                                         .bitmap = IRQ_BITMAP_NOLINK
93                                 },
94                                 [1] = { /* <-- 1 means this is INTB# output from the device or slot */
95                                         .link = LINK_PIRQB, /* Audio */
96                                         .bitmap = IRQ_BITMAP_LINKB
97                                 },
98                                 [2] = { /* <-- 2 means this is INTC# output from the device or slot */
99                                         .link = LINK_NONE,
100                                         .bitmap = IRQ_BITMAP_NOLINK
101                                 },
102                                 [3] = { /* <-- 3 means this is INTD# output from the device or slot */
103                                         .link = LINK_PIRQD, /* USB */
104                                         .bitmap = IRQ_BITMAP_LINKD
105                                 }
106                         }
107                 },
108
109                 [2] = {
110                         .slot = 0x0,    /* means also "on board" */
111                         .bus = 0x00,
112                         .devfn = (0x0e<<3)|0x0, /* 0x0e is eth0 */
113                         .irq = {
114                                 [0] = { /* <-- 0 means this is INTA# output from the device or slot */
115                                         .link = LINK_PIRQD,
116                                         .bitmap = IRQ_BITMAP_LINKD
117                                 },
118                                 [1] = { /* <-- 1 means this is INTB# output from the device or slot */
119                                         .link = LINK_NONE,
120                                         .bitmap = IRQ_BITMAP_NOLINK
121                                 },
122                                 [2] = { /* <-- 2 means this is INTC# output from the device or slot */
123                                         .link = LINK_NONE,
124                                         .bitmap = IRQ_BITMAP_NOLINK
125                                 },
126                                 [3] = { /* <-- 3 means this is INTD# output from the device or slot */
127                                         .link = LINK_NONE,
128                                         .bitmap = IRQ_BITMAP_NOLINK
129                                 }
130                         }
131                 },
132
133                 [3] = {
134                         .slot = 0x0,    /* means also "on board" */
135                         .bus = 0x00,
136                         .devfn = (0x10<<3)|0x0, /* 0x10 is eth1 */
137                         .irq = {
138                                 [0] = { /* <-- 0 means this is INTA# output from the device or slot */
139                                         .link = LINK_PIRQB,
140                                         .bitmap = IRQ_BITMAP_LINKB
141                                 },
142                                 [1] = { /* <-- 1 means this is INTB# output from the device or slot */
143                                         .link = LINK_NONE,
144                                         .bitmap = IRQ_BITMAP_NOLINK
145                                 },
146                                 [2] = { /* <-- 2 means this is INTC# output from the device or slot */
147                                         .link = LINK_NONE,
148                                         .bitmap = IRQ_BITMAP_NOLINK
149                                 },
150                                 [3] = { /* <-- 3 means this is INTD# output from the device or slot */
151                                         .link = LINK_NONE,
152                                         .bitmap = IRQ_BITMAP_NOLINK
153                                 }
154                         }
155                 },
156
157                 [4] = {
158                         .slot = 0x0,    /* means also "on board" */
159                         .bus = 0x00,
160                         .devfn = (0x11<<3)|0x0, /* 0x11 is SATA */
161                         .irq = {
162                                 [0] = { /* <-- 0 means this is INTA# output from the device or slot */
163                                         .link = LINK_PIRQA,
164                                         .bitmap = IRQ_BITMAP_LINKA
165                                 },
166                                 [1] = { /* <-- 1 means this is INTB# output from the device or slot */
167                                         .link = LINK_NONE,
168                                         .bitmap = IRQ_BITMAP_NOLINK
169                                 },
170                                 [2] = { /* <-- 2 means this is INTC# output from the device or slot */
171                                         .link = LINK_NONE,
172                                         .bitmap = IRQ_BITMAP_NOLINK
173                                 },
174                                 [3] = { /* <-- 3 means this is INTD# output from the device or slot */
175                                         .link = LINK_NONE,
176                                         .bitmap = IRQ_BITMAP_NOLINK
177                                 }
178                         }
179                 },
180
181 /*
182  * ################### backplane ###################
183  */
184
185 /*
186  * PCI1
187  */
188                 [5] = {
189                         .slot = 0x1,    /* This is real PCI slot. */
190                         .bus = 0x00,
191                         .devfn = (0x09<<3)|0x0, /* 0x09 is PCI1 */
192                         .irq = {
193                                 [0] = { /* <-- 0 means this is INTA# output from the device or slot */
194                                         .link = LINK_PIRQA,
195                                         .bitmap = IRQ_BITMAP_LINKA
196                                 },
197                                 [1] = { /* <-- 1 means this is INTB# output from the device or slot */
198                                         .link = LINK_PIRQB,
199                                         .bitmap = IRQ_BITMAP_LINKB
200                                 },
201                                 [2] = { /* <-- 2 means this is INTC# output from the device or slot */
202                                         .link = LINK_PIRQC,
203                                         .bitmap = IRQ_BITMAP_LINKC
204                                 },
205                                 [3] = { /* <-- 3 means this is INTD# output from the device or slot */
206                                         .link = LINK_PIRQD,
207                                         .bitmap = IRQ_BITMAP_LINKD
208                                 }
209                         }
210                 },
211 /*
212  * PCI2
213  */
214                 [6] = {
215                         .slot = 0x2,    /* This is real PCI slot. */
216                         .bus = 0x00,
217                         .devfn = (0x0a<<3)|0x0, /* 0x0a is PCI2 */
218                         .irq = {
219                                 [0] = { /* <-- 0 means this is INTA# output from the device or slot */
220                                         .link = LINK_PIRQD,
221                                         .bitmap = IRQ_BITMAP_LINKD
222                                 },
223                                 [1] = { /* <-- 1 means this is INTB# output from the device or slot */
224                                         .link = LINK_PIRQA,
225                                         .bitmap = IRQ_BITMAP_LINKA
226                                 },
227                                 [2] = { /* <-- 2 means this is INTC# output from the device or slot */
228                                         .link = LINK_PIRQB,
229                                         .bitmap = IRQ_BITMAP_LINKB
230                                 },
231                                 [3] = { /* <-- 3 means this is INTD# output from the device or slot */
232                                         .link = LINK_PIRQC,
233                                         .bitmap = IRQ_BITMAP_LINKC
234                                 }
235                         }
236                 },
237 /*
238  * PCI3
239  */
240                 [7] = {
241                         .slot = 0x3,    /* This is real PCI slot. */
242                         .bus = 0x00,
243                         .devfn = (0x0b<<3)|0x0, /* 0x0b is PCI3 */
244                         .irq = {
245                                 [0] = { /* <-- 0 means this is INTA# output from the device or slot */
246                                         .link = LINK_PIRQC,
247                                         .bitmap = IRQ_BITMAP_LINKC
248                                 },
249                                 [1] = { /* <-- 1 means this is INTB# output from the device or slot */
250                                         .link = LINK_PIRQD,
251                                         .bitmap = IRQ_BITMAP_LINKD
252                                 },
253                                 [2] = { /* <-- 2 means this is INTC# output from the device or slot */
254                                         .link = LINK_PIRQA,
255                                         .bitmap = IRQ_BITMAP_LINKA
256                                 },
257                                 [3] = { /* <-- 3 means this is INTD# output from the device or slot */
258                                         .link = LINK_PIRQB,
259                                         .bitmap = IRQ_BITMAP_LINKB
260                                 }
261                         }
262                 },
263 /*
264  * PCI4
265  */
266                 [8] = {
267                         .slot = 0x4,    /* This is real PCI slot. */
268                         .bus = 0x00,
269                         .devfn = (0x0c<<3)|0x0, /* 0x0c is PCI4 */
270                         .irq = {
271                                 [0] = { /* <-- 0 means this is INTA# output from the device or slot */
272                                         .link = LINK_PIRQB,
273                                         .bitmap = IRQ_BITMAP_LINKB
274                                 },
275                                 [1] = { /* <-- 1 means this is INTB# output from the device or slot */
276                                         .link = LINK_PIRQC,
277                                         .bitmap = IRQ_BITMAP_LINKC
278                                 },
279                                 [2] = { /* <-- 2 means this is INTC# output from the device or slot */
280                                         .link = LINK_PIRQD,
281                                         .bitmap = IRQ_BITMAP_LINKD
282                                 },
283                                 [3] = { /* <-- 3 means this is INTD# output from the device or slot */
284                                         .link = LINK_PIRQA,
285                                         .bitmap = IRQ_BITMAP_LINKA
286                                 }
287                         }
288                 },
289         }
290 };
291
292 unsigned long write_pirq_routing_table(unsigned long addr)
293 {
294         /* Put the PIR table in memory and checksum. */
295         return  copy_pirq_routing_table(addr);
296 }