tree: drop last paragraph of GPL copyright header
[coreboot.git] / src / mainboard / siemens / sitemp_g1p1 / irq_tables.c
blob299a370d5065956bf86415f89d961f0ad28fad9c
1 /*
2 * This file is part of the coreboot project.
4 * Copyright (C) 2008 Advanced Micro Devices, Inc.
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; version 2 of the License.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
16 /* This file was generated by getpir.c, do not modify!
17 (but if you do, please run checkpir on it to verify)
18 Contains the IRQ Routing Table dumped directly from your memory , wich BIOS sets up
20 Documentation at : http://www.microsoft.com/hwdev/busbios/PCIIRQ.HTM
23 #include <console/console.h>
24 #include <device/pci.h>
25 #include <string.h>
26 #include <stdint.h>
27 #include <arch/pirq_routing.h>
29 #include <cpu/amd/amdk8_sysconf.h>
31 /* Platform IRQs */
32 #define PIRQA 10
33 #define PIRQB 11
34 #define PIRQC 5
35 #define PIRQD 15
37 /* Map */
38 #define M_PIRQA (1 << PIRQA) /* Bitmap of supported IRQs */
39 #define M_PIRQB (1 << PIRQB) /* Bitmap of supported IRQs */
40 #define M_PIRQC (1 << PIRQC) /* Bitmap of supported IRQs */
41 #define M_PIRQD (1 << PIRQD) /* Bitmap of supported IRQs */
43 /* Link */
44 #define L_PIRQA 1 /* Means Slot INTx# Connects To Chipset INTA# */
45 #define L_PIRQB 2 /* Means Slot INTx# Connects To Chipset INTB# */
46 #define L_PIRQC 3 /* Means Slot INTx# Connects To Chipset INTC# */
47 #define L_PIRQD 4 /* Means Slot INTx# Connects To Chipset INTD# */
49 static void write_pirq_info(struct irq_info *pirq_info, u8 bus, u8 devfn,
50 u8 link0, u16 bitmap0, u8 link1, u16 bitmap1,
51 u8 link2, u16 bitmap2, u8 link3, u16 bitmap3,
52 u8 slot, u8 rfu)
54 pirq_info->bus = bus;
55 pirq_info->devfn = devfn;
56 pirq_info->irq[0].link = link0;
57 pirq_info->irq[0].bitmap = bitmap0;
58 pirq_info->irq[1].link = link1;
59 pirq_info->irq[1].bitmap = bitmap1;
60 pirq_info->irq[2].link = link2;
61 pirq_info->irq[2].bitmap = bitmap2;
62 pirq_info->irq[3].link = link3;
63 pirq_info->irq[3].bitmap = bitmap3;
64 pirq_info->slot = slot;
65 pirq_info->rfu = rfu;
67 extern u8 bus_rs690[8];
68 extern u8 bus_sb600[2];
69 extern unsigned long sbdn_sb600;
71 unsigned long write_pirq_routing_table(unsigned long addr)
73 struct irq_routing_table *pirq;
74 struct irq_info *pirq_info;
75 u32 slot_num;
76 u8 *v;
78 u8 sum = 0;
79 int i;
81 get_bus_conf(); /* it will find out all bus num and apic that share with mptable.c and mptable.c and acpi_tables.c */
83 /* Align the table to be 16 byte aligned. */
84 addr += 15;
85 addr &= ~15;
87 /* This table must be between 0xf0000 & 0x100000 */
88 printk(BIOS_INFO, "Writing IRQ routing tables to 0x%lx...", addr);
90 pirq = (void *)(addr);
91 v = (u8 *) (addr);
93 pirq->signature = PIRQ_SIGNATURE;
94 pirq->version = PIRQ_VERSION;
96 pirq->rtr_bus = bus_sb600[0];
97 pirq->rtr_devfn = ((sbdn_sb600 + 0x14) << 3) | 4;
99 pirq->exclusive_irqs = 0;
101 pirq->rtr_vendor = 0x1002;
102 pirq->rtr_device = 0x4384;
104 pirq->miniport_data = 0;
106 memset(pirq->rfu, 0, sizeof(pirq->rfu));
108 pirq_info = (void *)(&pirq->checksum + 1);
109 slot_num = 0;
111 /* pci bridge */
112 write_pirq_info(pirq_info, bus_sb600[0], ((sbdn_sb600 + 0x14) << 3) | 4, 0x1, 0xdef8, 0x2, 0xdef8, 0x3, 0xdef8, 0x4, 0xdef8, 1, 0);
113 pirq_info++;
114 slot_num++;
116 /* ide */
117 write_pirq_info(pirq_info, bus_sb600[0], ((sbdn_sb600 + 0x14) << 3) | 1, 0x1, 0xdef8, 0x2, 0xdef8, 0x3, 0xdef8, 0x4, 0xdef8, 1, 0);
118 pirq_info++;
119 slot_num++;
121 pirq->size = 32 + 16 * slot_num;
123 for (i = 0; i < pirq->size; i++)
124 sum += v[i];
126 sum = pirq->checksum - sum;
127 if (sum != pirq->checksum) {
128 pirq->checksum = sum;
131 printk(BIOS_INFO, "write_pirq_routing_table done.\n");
133 return (unsigned long)pirq_info;