Add support for the BCOM WinNET100 (used in the IGEL-316 thin client).
[coreboot.git] / src / mainboard / bcom / winnet100 / irq_tables.c
1 /*
2  * This file is part of the LinuxBIOS 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 BCOM's Winnet100 board.
24  * It was not possible to read back the pirq-Table. In the 0xF segment was
25  * no string like $PIRQ...
26  * But the already running 2.4.21 kernel provides eth0 IRQ15 and USB IRQ 11.
27  * The Realtek was device 0.f.0, the USB 0.13.0.
28  *
29  * This is the physical routing on this board:
30  *
31  *    5530       USB      Network
32  * northbridge  device     device
33  *              00.13.0   00.0f.00
34  * ------------------------------------
35  *   INTA#      INTA#      n.c.
36  *   INTB#       n.c.      n.c.
37  *   INTC#       n.c.     INTA#
38  *   INTD#       n.c.      n.c.
39  */
40
41 #include <arch/pirq_routing.h>
42
43 /*
44  * The USB controller should be connected to IRQ11,
45  * the network controller should be connected to IRQ15.
46  */
47 #define IRQ_BITMAP_LINK0 0x0800
48 #define IRQ_BITMAP_LINK1 0x0400
49 #define IRQ_BITMAP_LINK2 0x8000
50 #define IRQ_BITMAP_LINK3 0x0200
51
52 /** Reserved interrupt channels for PCI. */
53 #define IRQ_DEVOTED_TO_PCI (IRQ_BITMAP_LINK0 | IRQ_BITMAP_LINK2)
54
55 /**
56  * Routing description.
57  * Documentation at: http://www.microsoft.com/whdc/archive/pciirq.mspx
58  */
59 const struct irq_routing_table intel_irq_routing_table = {
60         .signature = PIRQ_SIGNATURE,    /* u32 signature */
61         .version = PIRQ_VERSION,        /* u16 version */
62         .size = 32+16*IRQ_SLOT_COUNT,   /* There can be total IRQ_SLOT_COUNT devices on the bus */
63         .rtr_bus = 0x00,                /* Where the interrupt router lies (bus) */
64         .rtr_devfn = (0x12<<3)|0x0,     /* Where the interrupt router lies (dev) */
65         .exclusive_irqs = IRQ_DEVOTED_TO_PCI,   /* IRQs devoted exclusively to PCI usage */
66         .rtr_vendor = 0x1078,           /* Vendor */
67         .rtr_device = 0x0100,           /* Device */
68         .miniport_data = 0,             /* Crap (miniport) */
69         .checksum = 0xBF+16,
70         .slots = {
71                 /*
72                  * Definition for "slot#1". There is no real slot,
73                  * the USB device is embedded...
74                  */
75                 [0] = {
76                         .bus = 0x00,
77                         .devfn = (0x13 << 3) | 0x0,
78                         .irq = {
79                                 [0] = {
80                                         .link = 0x01,   /* INT A */
81                                         .bitmap = IRQ_BITMAP_LINK0,
82                                 },
83                                 [1] = {
84                                         .link = 0x02,   /* INT B */
85                                         .bitmap = IRQ_BITMAP_LINK1,
86                                 },
87                                 [2] = {
88                                         .link = 0x03,   /* INT C */
89                                         .bitmap = IRQ_BITMAP_LINK2,
90                                 },
91                                 [3] = {
92                                         .link = 0x04,   /* INT D */
93                                         .bitmap = IRQ_BITMAP_LINK3,
94                                 }
95                         },
96                         .slot = 0x0,
97                 },
98
99                 /*
100                  * Definition for "slot#3". There is no real slot,
101                  * the network device is soldered...
102                  */
103                 [1] = {
104                         .bus = 0x00,
105                         .devfn = (0x0f << 3) | 0x0,
106                         .irq = {
107                                 [0] = {
108                                         .link = 0x03,
109                                         .bitmap = IRQ_BITMAP_LINK2,
110                                 },
111                                 [1] = {
112                                         .link = 0x04,
113                                         .bitmap = IRQ_BITMAP_LINK3,
114                                 },
115                                 [2] = {
116                                         .link = 0x01,
117                                         .bitmap = IRQ_BITMAP_LINK0,
118                                 },
119                                 [3] = {
120                                         .link = 0x02,
121                                         .bitmap = IRQ_BITMAP_LINK1,
122                                 }
123                         },
124                         .slot = 0x0,
125                 }
126         }
127 };
128
129 /**
130  * Copy the IRQ routing table to memory.
131  *
132  * @param[in] addr Destination address (between 0xF0000...0x100000).
133  * @return TODO.
134  */
135 unsigned long write_pirq_routing_table(unsigned long addr)
136 {
137         return copy_pirq_routing_table(addr);
138 }