IEI NOVA-4899R: Fix incorrect irq_tables.c.
[coreboot.git] / src / mainboard / iei / nova4899r / irq_tables.c
1 /*
2  * This file is part of the LinuxBIOS project.
3  *
4  * Copyright (C) 2007 Luis Correia <luis.f.correia@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
23 /*
24  *    IRQ          5530       USB     Network   Network   Network    free
25  * controller  northbridge  device    device#0  device#1  device#2   slot
26  *                          00.13.0   00.0a.00  00.0b.00  00.0c.00  00.0f.00
27  * ------------------------------------------------------------------------
28  *    14          INTA#      INTA#      n.c.      n.c.     n.c.      INTA#
29  *    5           INTB#       n.c.      n.c.      n.c.    INTA#       n.c.
30  *    10          INTC#       n.c.      n.c.     INTA#     n.c.       n.c.
31  *    11          INTD#       n.c.     INTA#      n.c.     n.c.       n.c.
32  */
33
34 /*
35  * - the USB controller should be connected to IRQ14
36  * - the network controller #0 should be connected to IRQ11
37  * - the network controller #1 should be connected to IRQ10
38  * - the network controller #2 should be connected to IRQ5
39  * - the additional PCI slot must share the IRQ with the internal USB
40  */
41
42 #define IRQ_BITMAP_LINK0 0x0200 /* bit  9 means IRQ 9 available for this cs5530 INT input*/
43 #define IRQ_BITMAP_LINK1 0x0020 /* bit  5 means IRQ 5 available for this cs5530 INT input*/
44 #define IRQ_BITMAP_LINK2 0x0400 /* bit 10 means IRQ10 available for this cs5530 INT input*/
45 #define IRQ_BITMAP_LINK3 0x0800 /* bit 11 means IRQ11 available for this cs5530 INT input*/
46
47 const struct irq_routing_table intel_irq_routing_table = {
48         .signature = PIRQ_SIGNATURE,    /* u32 signature */
49         .version = PIRQ_VERSION,        /* u16 version   */
50         .size = 32+16*IRQ_SLOT_COUNT,   /* there can be total 4 devices on the bus */
51         .rtr_bus = 0x00,                /* Where the interrupt router lies (bus) */
52         .rtr_devfn = (0x12<<3)|0x0,     /* Where the interrupt router lies (dev) */
53         .exclusive_irqs = 0x4C20,       /* IRQs devoted exclusively to PCI usage */
54         .rtr_vendor = 0x1078,           /* Vendor */
55         .rtr_device = 0x0100,           /* Device */
56         .miniport_data = 0,             /* Crap (miniport) */
57         .checksum = 0xBF+16,            /* TODO! calculate correct sum ! */
58 /*
59  * Definition for "slot#0". There is no real slot,
60  * the network device is soldered...
61  */
62         .slots = {
63                 [0] = {
64                         .bus = 0x00,
65                         .devfn = (0x0a<<3)|0x0,
66                         .irq = {
67                                 [0] = {
68                                         .link = 0x03,   /* INT C */
69                                         .bitmap = IRQ_BITMAP_LINK2
70                                 },
71                                 [1] = {
72                                         .link = 0x02,   /* INT B */
73                                         .bitmap = IRQ_BITMAP_LINK1
74                                 },
75                                 [2] = { /* = device INTA output */
76                                         .link = 0x01,   /* INT A */
77                                         .bitmap = IRQ_BITMAP_LINK0
78                                 },
79                                 [3] = {
80                                         .link = 0x04,   /* = cs5530 INT D input */
81                                         .bitmap = IRQ_BITMAP_LINK3
82                                 }
83                         },
84                         .slot = 0x3,    /* soldered */
85                 },
86 /*
87  * Definition for "slot#1". There is no real slot,
88  * the network device is soldered...
89  *
90  * Configuration is ommited on purpose in the attempt of solving the
91  * issue with IRQ panics (this is device is actually eth1)
92
93                 [1] = {
94                         .bus = 0x00,
95                         .devfn = (0x0b<<3)|0x0,
96                         .irq = {
97                                 [0] = {
98                                         .link = 0x04,
99                                         .bitmap = IRQ_BITMAP_LINK3
100                                 },
101                                 [1] = {
102                                         .link = 0x03,
103                                         .bitmap = IRQ_BITMAP_LINK2
104                                 },
105                                 [2] = {
106                                         .link = 0x02,
107                                         .bitmap = IRQ_BITMAP_LINK1
108                                 },
109                                 [3] = {
110                                         .link = 0x01,
111                                         .bitmap = IRQ_BITMAP_LINK0
112                                 }
113                         },
114                         .slot = 0x2,
115                 },
116  */
117  
118 /*
119  * Definition for "slot#2". There is no real slot,
120  * the network device is soldered...
121  */
122                 [2] = {
123                         .bus = 0x00,
124                         .devfn = (0x0c<<3)|0x0,
125                         .irq = {
126                                 [0] = {
127                                         .link = 0x01,   /* INT A */
128                                         .bitmap = IRQ_BITMAP_LINK0
129                                 },
130                                 [1] = {
131                                         .link = 0x04,   /* INT D */
132                                         .bitmap = IRQ_BITMAP_LINK3
133                                 },
134                                 [2] = { /* = device INTA output */
135                                         .link = 0x03,   /* INT C */
136                                         .bitmap = IRQ_BITMAP_LINK2
137                                 },
138                                 [3] = {
139                                         .link = 0x02,   /* = cs5530 INT B input */
140                                         .bitmap = IRQ_BITMAP_LINK1
141                                 }
142                         },
143                         .slot = 0x1,    /* soldered */
144                 },
145 /*
146  * This is a free PCI slot
147  */
148                 [3] = {
149                         .bus = 0x00,
150                         .devfn = (0x0f<<3)|0x0,
151                         .irq = {
152                                 [0] = { /* = device INTA output */
153                                         .link = 0x04,   /* INT D */
154                                         .bitmap = IRQ_BITMAP_LINK3
155                                 },
156                                 [1] = {
157                                         .link = 0x03,   /* = cs5530 INT C input */
158                                         .bitmap = IRQ_BITMAP_LINK2
159                                 },
160                                 [2] = {
161                                         .link = 0x02,   /* INT B */
162                                         .bitmap = IRQ_BITMAP_LINK1
163                                 },
164                                 [3] = {
165                                         .link = 0x01,   /* INT A */
166                                         .bitmap = IRQ_BITMAP_LINK0
167                                 }
168                         },
169                         .slot = 0x6,    /* FIXME: should be not 0, as it defines a real slot */
170                 },
171 /*
172  * Definition for "slot#3". There is no real slot,
173  * the USB device is embedded...
174  */
175                 [4] = {
176                         .bus = 0x00,
177                         .devfn = (0x13<<3)|0x0,
178                         .irq = {
179                                 [0] = {
180                                         .link = 0x02,   /* INT B */
181                                         .bitmap = IRQ_BITMAP_LINK1
182                                 },
183                                 [1] = {
184                                         .link = 0x01,   /* INT A */
185                                         .bitmap = IRQ_BITMAP_LINK0
186                                 },
187                                 [2] = {
188                                         .link = 0x04,   /* INT D */
189                                         .bitmap = IRQ_BITMAP_LINK3
190                                 },
191                                 [3] = {
192                                         .link = 0x03,   /* INT C */
193                                         .bitmap = IRQ_BITMAP_LINK2
194                                 }
195                         },
196                         .slot = 0x5,    /* chip internal */
197                 }
198         }
199 };
200
201 /**
202  * Copy the IRQ routing table to memory.
203  *
204  * @param addr Destination address (between 0xF0000...0x100000).
205  * @return The end address of the pirq routing table in memory.
206  **/
207 unsigned long write_pirq_routing_table(unsigned long addr)
208 {
209         return copy_pirq_routing_table(addr);
210 }
211