mainboard/[g-p]*: Remove copyright notices
[coreboot.git] / src / mainboard / gizmosphere / gizmo / irq_tables.c
blobf9623145468fe94adce4f5c9371a099f3fbe6735
1 /*
2 * This file is part of the coreboot project.
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; version 2 of the License.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
15 #include <console/console.h>
16 #include <device/pci_def.h>
17 #include <string.h>
18 #include <stdint.h>
19 #include <arch/pirq_routing.h>
21 static void write_pirq_info(struct irq_info *pirq_info, u8 bus, u8 devfn,
22 u8 link0, u16 bitmap0, u8 link1, u16 bitmap1,
23 u8 link2, u16 bitmap2, u8 link3, u16 bitmap3,
24 u8 slot, u8 rfu)
26 pirq_info->bus = bus;
27 pirq_info->devfn = devfn;
28 pirq_info->irq[0].link = link0;
29 pirq_info->irq[0].bitmap = bitmap0;
30 pirq_info->irq[1].link = link1;
31 pirq_info->irq[1].bitmap = bitmap1;
32 pirq_info->irq[2].link = link2;
33 pirq_info->irq[2].bitmap = bitmap2;
34 pirq_info->irq[3].link = link3;
35 pirq_info->irq[3].bitmap = bitmap3;
36 pirq_info->slot = slot;
37 pirq_info->rfu = rfu;
40 unsigned long write_pirq_routing_table(unsigned long addr)
43 struct irq_routing_table *pirq;
44 struct irq_info *pirq_info;
45 u32 slot_num;
46 u8 *v;
48 u8 sum = 0;
49 int i;
51 /* Align the table to be 16 byte aligned. */
52 addr += 15;
53 addr &= ~15;
55 /* This table must be between 0xf0000 & 0x100000 */
56 printk(BIOS_INFO, "Writing IRQ routing tables to 0x%lx...", addr);
58 pirq = (void *)(addr);
59 v = (u8 *) (addr);
61 pirq->signature = PIRQ_SIGNATURE;
62 pirq->version = PIRQ_VERSION;
64 pirq->rtr_bus = 0;
65 pirq->rtr_devfn = PCI_DEVFN(0x14, 4);
67 pirq->exclusive_irqs = 0;
69 pirq->rtr_vendor = 0x1002;
70 pirq->rtr_device = 0x4384;
72 pirq->miniport_data = 0;
74 memset(pirq->rfu, 0, sizeof(pirq->rfu));
76 pirq_info = (void *)(&pirq->checksum + 1);
77 slot_num = 0;
79 /* pci bridge */
80 write_pirq_info(pirq_info, 0, PCI_DEVFN(0x14, 4),
81 0x1, 0xdef8, 0x2, 0xdef8, 0x3, 0xdef8, 0x4, 0xdef8, 0,
82 0);
83 pirq_info++;
85 slot_num++;
87 pirq->size = 32 + 16 * slot_num;
89 for (i = 0; i < pirq->size; i++)
90 sum += v[i];
92 sum = pirq->checksum - sum;
94 if (sum != pirq->checksum) {
95 pirq->checksum = sum;
98 printk(BIOS_INFO, "%s done.\n", __func__);
100 return (unsigned long)pirq_info;