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.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20 /* This file was generated by getpir.c, do not modify!
21 (but if you do, please run checkpir on it to verify)
22 Contains the IRQ Routing Table dumped directly from your memory , wich BIOS sets up
24 Documentation at : http://www.microsoft.com/hwdev/busbios/PCIIRQ.HTM
27 #include <console/console.h>
28 #include <device/pci.h>
31 #include <arch/pirq_routing.h>
33 #include <cpu/amd/amdk8_sysconf.h>
42 #define M_PIRQA (1 << PIRQA) /* Bitmap of supported IRQs */
43 #define M_PIRQB (1 << PIRQB) /* Bitmap of supported IRQs */
44 #define M_PIRQC (1 << PIRQC) /* Bitmap of supported IRQs */
45 #define M_PIRQD (1 << PIRQD) /* Bitmap of supported IRQs */
48 #define L_PIRQA 1 /* Means Slot INTx# Connects To Chipset INTA# */
49 #define L_PIRQB 2 /* Means Slot INTx# Connects To Chipset INTB# */
50 #define L_PIRQC 3 /* Means Slot INTx# Connects To Chipset INTC# */
51 #define L_PIRQD 4 /* Means Slot INTx# Connects To Chipset INTD# */
53 static void write_pirq_info(struct irq_info *pirq_info, u8 bus, u8 devfn,
54 u8 link0, u16 bitmap0, u8 link1, u16 bitmap1,
55 u8 link2, u16 bitmap2, u8 link3, u16 bitmap3,
59 pirq_info->devfn = devfn;
60 pirq_info->irq[0].link = link0;
61 pirq_info->irq[0].bitmap = bitmap0;
62 pirq_info->irq[1].link = link1;
63 pirq_info->irq[1].bitmap = bitmap1;
64 pirq_info->irq[2].link = link2;
65 pirq_info->irq[2].bitmap = bitmap2;
66 pirq_info->irq[3].link = link3;
67 pirq_info->irq[3].bitmap = bitmap3;
68 pirq_info->slot = slot;
71 extern u8 bus_rs690[8];
72 extern u8 bus_sb600[2];
73 extern unsigned long sbdn_sb600;
75 unsigned long write_pirq_routing_table(unsigned long addr)
77 struct irq_routing_table *pirq;
78 struct irq_info *pirq_info;
85 get_bus_conf(); /* it will find out all bus num and apic that share with mptable.c and mptable.c and acpi_tables.c */
87 /* Align the table to be 16 byte aligned. */
91 /* This table must be betweeen 0xf0000 & 0x100000 */
92 printk(BIOS_INFO, "Writing IRQ routing tables to 0x%lx...", addr);
94 pirq = (void *)(addr);
97 pirq->signature = PIRQ_SIGNATURE;
98 pirq->version = PIRQ_VERSION;
100 pirq->rtr_bus = bus_sb600[0];
101 pirq->rtr_devfn = ((sbdn_sb600 + 0x14) << 3) | 4;
103 pirq->exclusive_irqs = 0;
105 pirq->rtr_vendor = 0x1002;
106 pirq->rtr_device = 0x4384;
108 pirq->miniport_data = 0;
110 memset(pirq->rfu, 0, sizeof(pirq->rfu));
112 pirq_info = (void *)(&pirq->checksum + 1);
116 write_pirq_info(pirq_info, bus_sb600[0], ((sbdn_sb600 + 0x14) << 3) | 4, 0x1, 0xdef8, 0x2, 0xdef8, 0x3, 0xdef8, 0x4, 0xdef8, 1, 0);
120 pirq->size = 32 + 16 * slot_num;
122 for (i = 0; i < pirq->size; i++)
125 sum = pirq->checksum - sum;
126 if (sum != pirq->checksum) {
127 pirq->checksum = sum;
130 printk(BIOS_INFO, "write_pirq_routing_table done.\n");
132 return (unsigned long)pirq_info;