blob: 9b92b002cfd16a17dff116699e5c6073b62bd967 [file] [log] [blame]
Jonathan A. Kollasch48994e12008-12-20 04:08:40 +00001/*
2 * This file is part of the coreboot project.
3 *
4 * Copyright (C) 2007 AMD
5 * (Written by Yinghai Lu <yinghailu@amd.com> for AMD)
6 * Copyright (C) 2007 Philipp Degler <pdegler@rumms.uni-mannheim.de>
7 * (Thanks to LSRA University of Mannheim for their support)
8 * Copyright (C) 2008 Jonathan A. Kollasch <jakllsch@kollasch.net>
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
Jonathan A. Kollasch48994e12008-12-20 04:08:40 +000019 */
20
21#include <console/console.h>
22#include <arch/smp/mpspec.h>
Uwe Hermann74d1a6e2010-10-12 17:34:08 +000023#include <arch/ioapic.h>
Jonathan A. Kollasch48994e12008-12-20 04:08:40 +000024#include <device/pci.h>
25#include <string.h>
26#include <stdint.h>
Uwe Hermann5df41682010-09-25 16:17:20 +000027#include "southbridge/via/vt8237r/vt8237r.h"
Jonathan A. Kollasch48994e12008-12-20 04:08:40 +000028
Myles Watson08e0fb82010-03-22 16:33:25 +000029static void *smp_write_config_table(void *v)
Jonathan A. Kollasch48994e12008-12-20 04:08:40 +000030{
Jonathan A. Kollasch48994e12008-12-20 04:08:40 +000031 struct mp_config_table *mc;
Patrick Georgi20979582010-09-24 18:42:56 +000032 int isa_bus;
Jonathan A. Kollasch48994e12008-12-20 04:08:40 +000033
34 mc = (void *)(((char *)v) + SMP_FLOATING_TABLE_LEN);
Jonathan A. Kollasch48994e12008-12-20 04:08:40 +000035
Patrick Georgic8feedd2012-02-16 18:43:25 +010036 mptable_init(mc, LOCAL_APIC_ADDR);
Jonathan A. Kollasch48994e12008-12-20 04:08:40 +000037
38 smp_write_processors(mc);
Patrick Georgi20979582010-09-24 18:42:56 +000039 mptable_write_buses(mc, NULL, &isa_bus);
Jonathan A. Kollasch48994e12008-12-20 04:08:40 +000040
41/* I/O APICs: APIC ID Version State Address*/
Kevin Paul Herbertbde6d302014-12-24 18:43:20 -080042 smp_write_ioapic(mc, VT8237R_APIC_ID, 0x20, VIO_APIC_VADDR);
Jonathan A. Kollasch48994e12008-12-20 04:08:40 +000043
44 /* Now, assemble the table. */
Patrick Georgi20979582010-09-24 18:42:56 +000045 mptable_add_isa_interrupts(mc, isa_bus, VT8237R_APIC_ID, 0);
Jonathan A. Kollasch48994e12008-12-20 04:08:40 +000046
47#define PCI_INT(bus, dev, fn, pin) \
48 smp_write_intsrc(mc, mp_INT, MP_IRQ_TRIGGER_LEVEL|MP_IRQ_POLARITY_LOW, \
49 bus, (((dev)<<2)|(fn)), VT8237R_APIC_ID, (pin))
50
51 // PCI slot 1
52 PCI_INT(0, 8, 0, 16);
53 PCI_INT(0, 8, 1, 17);
54 PCI_INT(0, 8, 2, 18);
55 PCI_INT(0, 8, 3, 19);
56
57 // PCI slot 2
58 PCI_INT(0, 9, 0, 17);
59 PCI_INT(0, 9, 1, 18);
60 PCI_INT(0, 9, 2, 19);
61 PCI_INT(0, 9, 3, 16);
62
63 // SATA
64 PCI_INT(0, 15, 1, 20);
65
66 // USB
67 PCI_INT(0, 16, 0, 21);
68 PCI_INT(0, 16, 1, 21);
69 PCI_INT(0, 16, 2, 21);
70 PCI_INT(0, 16, 3, 21);
71
72 // Audio
73 PCI_INT(0, 17, 2, 22);
74
75 // Ethernet
76 PCI_INT(0, 18, 0, 23);
77
78 /* Onboard VGA */
79 PCI_INT(1, 0, 0, 16);
80
81/*Local Ints: Type Polarity Trigger Bus ID IRQ APIC ID PIN#*/
Patrick Georgi6eb7a532011-10-07 21:42:52 +020082 mptable_lintsrc(mc, 0);
Jonathan A. Kollasch48994e12008-12-20 04:08:40 +000083
84 /* There is no extension information... */
85
86 /* Compute the checksums */
Patrick Georgib0a9c5c2011-10-07 23:01:55 +020087 return mptable_finalize(mc);
Jonathan A. Kollasch48994e12008-12-20 04:08:40 +000088}
89
90unsigned long write_smp_table(unsigned long addr)
91{
92 void *v;
Patrick Georgic75c79b2011-10-07 22:41:07 +020093 v = smp_write_floating_table(addr, 0);
Jonathan A. Kollasch48994e12008-12-20 04:08:40 +000094 return (unsigned long)smp_write_config_table(v);
95}