This patch unifies the use of config options in v2 to all start with CONFIG_
[coreboot.git] / src / mainboard / axus / tc320 / irq_tables.c
1 /*
2  * This file is part of the coreboot project.
3  *
4  * Copyright (C) 2007 Juergen Beisert <juergen@kreuzholzen.de>
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 /**
22  * @file
23  * Interrupt routing description for the AXUS TC320 board.
24  * It was not possible to read back the PIRQ table. There was no BIOS to ask
25  * for it, only a bootloader for an embedded OS.
26  * But with the method described here:
27  *    http://coreboot.org/Creating_Valid_IRQ_Tables
28  * it was possible to detect the physical IRQ routing on this board.
29  *
30  * This is the physical routing on this board:
31  *
32  *    IRQ          5530       USB     Network
33  * controller  northbridge  device     device
34  *                          00.13.0   00.0e.00
35  * --------------------------------------------
36  *    11          INTA#      INTA#      n.c.
37  *    15          INTB#       n.c.     INTA#
38  *                INTC#       n.c.      n.c.
39  *                INTD#       n.c.      n.c.
40  */
41
42 #include <arch/pirq_routing.h>
43
44 #define INT_A 0x01
45 #define INT_B 0x02
46 #define INT_C 0x03
47 #define INT_D 0x04
48
49 /*
50  * The USB controller should be connected to IRQ11,
51  * the network controller should be connected to IRQ15.
52  */
53
54 #define IRQ_BITMAP_LINK0 0x0800
55 #define IRQ_BITMAP_LINK1 0x8000
56 #define IRQ_BITMAP_LINK2 0x0000
57 #define IRQ_BITMAP_LINK3 0x0000
58
59 /** Reserved interrupt channels for exclusive PCI usage. */
60 #define IRQ_DEVOTED_TO_PCI (IRQ_BITMAP_LINK0 | IRQ_BITMAP_LINK1)
61
62 /**
63  * Routing description.
64  * Documentation at: http://www.microsoft.com/whdc/archive/pciirq.mspx
65  */
66 const struct irq_routing_table intel_irq_routing_table = {
67         .signature = PIRQ_SIGNATURE,    /* PIRQ signature */
68         .version = PIRQ_VERSION,        /* PIRQ version */
69         .size = 32 + 16 * CONFIG_IRQ_SLOT_COUNT,/* Max. CONFIG_IRQ_SLOT_COUNT devices */
70         .rtr_bus = 0x00,                /* Interrupt router bus */
71         .rtr_devfn = (0x12 << 3) | 0x0, /* Interrupt router device */
72         .exclusive_irqs = IRQ_DEVOTED_TO_PCI,   /* IRQs devoted to PCI */
73         .rtr_vendor = 0x1078,           /* Vendor */
74         .rtr_device = 0x0100,           /* Device */
75         .miniport_data = 0,             /* Crap (miniport) */
76         .checksum = 0xe3,               /* Checksum */
77         .slots = {
78                 /*
79                  * Definition for "slot#1". There is no real slot,
80                  * the USB device is embedded...
81                  */
82                 [0] = {
83                         .bus = 0x00,
84                         .devfn = (0x13 << 3) | 0x0,
85                         .irq = {
86                                 /*      Link   Bitmap */
87                                 [0] = { INT_A, IRQ_BITMAP_LINK0 },
88                                 [1] = { INT_B, IRQ_BITMAP_LINK1 },
89                                 [2] = { INT_C, IRQ_BITMAP_LINK2 },
90                                 [3] = { INT_D, IRQ_BITMAP_LINK3 },
91                         },
92                         .slot = 0x0,
93                 },
94                 /*
95                  * Definition for "slot#2". There is no real slot,
96                  * the network device is soldered...
97                  */
98                 [1] = {
99                         .bus = 0x00,
100                         .devfn = (0x0e << 3) | 0x0,
101                         .irq = {
102                                 /*      Link   Bitmap */
103                                 [0] = { INT_B, IRQ_BITMAP_LINK1 },
104                                 [1] = { INT_C, IRQ_BITMAP_LINK2 },
105                                 [2] = { INT_D, IRQ_BITMAP_LINK3 },
106                                 [3] = { INT_A, IRQ_BITMAP_LINK0 },
107                         },
108                         .slot = 0x0,
109                 }
110         }
111 };
112
113 /**
114  * Copy the IRQ routing table to memory.
115  *
116  * @param[in] addr Destination address (between 0xF0000...0x100000).
117  * @return TODO.
118  */
119 unsigned long write_pirq_routing_table(unsigned long addr)
120 {
121         return copy_pirq_routing_table(addr);
122 }