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