blob: 62d014733f37f1a04ddbbb5980e7b78c8187d540 [file] [log] [blame]
Stefan Reinauer1a08f582009-10-28 16:52:48 +00001/*
2 * This file is part of the coreboot project.
3 *
Stefan Reinauer1a08f582009-10-28 16:52:48 +00004 *
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License as
Uwe Hermann2d2f0c12009-10-28 17:36:11 +00007 * published by the Free Software Foundation; version 2 of the License.
Stefan Reinauer1a08f582009-10-28 16:52:48 +00008 *
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.
Stefan Reinauer1a08f582009-10-28 16:52:48 +000013 */
14
Stefan Reinauer1a08f582009-10-28 16:52:48 +000015#include <device/device.h>
Stefan Reinauer1a08f582009-10-28 16:52:48 +000016#include <arch/smp/mpspec.h>
Uwe Hermann74d1a6e2010-10-12 17:34:08 +000017#include <arch/ioapic.h>
Stefan Reinauer1a08f582009-10-28 16:52:48 +000018#include <stdint.h>
19
Stefan Reinauer53b0ea42010-03-22 11:50:52 +000020static void *smp_write_config_table(void *v)
Stefan Reinauer1a08f582009-10-28 16:52:48 +000021{
Elyes HAOUAS8da96e52016-09-22 21:20:54 +020022 struct mp_config_table *mc;
Patrick Georgi5244e1b2010-11-21 14:41:07 +000023 int isa_bus;
Stefan Reinauer1a08f582009-10-28 16:52:48 +000024
Elyes HAOUAS8da96e52016-09-22 21:20:54 +020025 mc = (void *)(((char *)v) + SMP_FLOATING_TABLE_LEN);
Stefan Reinauer1a08f582009-10-28 16:52:48 +000026
Patrick Georgic8feedd2012-02-16 18:43:25 +010027 mptable_init(mc, LOCAL_APIC_ADDR);
Stefan Reinauer1a08f582009-10-28 16:52:48 +000028
Elyes HAOUAS8da96e52016-09-22 21:20:54 +020029 smp_write_processors(mc);
Stefan Reinauer1a08f582009-10-28 16:52:48 +000030
Patrick Georgi5244e1b2010-11-21 14:41:07 +000031 mptable_write_buses(mc, NULL, &isa_bus);
Stefan Reinauer1a08f582009-10-28 16:52:48 +000032
33 /* I/O APICs: APIC ID Version State Address */
Kevin Paul Herbertbde6d302014-12-24 18:43:20 -080034 smp_write_ioapic(mc, 2, 0x20, VIO_APIC_VADDR);
Stefan Reinauer1a08f582009-10-28 16:52:48 +000035
36 /* Legacy Interrupts */
37
Patrick Georgic5b87c82010-05-20 15:28:19 +000038 mptable_add_isa_interrupts(mc, isa_bus, 0x2, 0);
Stefan Reinauer1a08f582009-10-28 16:52:48 +000039
40 /* Builtin devices on Bus 0 */
41 smp_write_intsrc(mc, mp_INT, MP_IRQ_TRIGGER_LEVEL|MP_IRQ_POLARITY_LOW, 0x0, 0x8, 0x2, 0x10);
42 smp_write_intsrc(mc, mp_INT, MP_IRQ_TRIGGER_LEVEL|MP_IRQ_POLARITY_LOW, 0x0, 0x7d, 0x2, 0x13);
43 smp_write_intsrc(mc, mp_INT, MP_IRQ_TRIGGER_LEVEL|MP_IRQ_POLARITY_LOW, 0x0, 0x74, 0x2, 0x17);
44 smp_write_intsrc(mc, mp_INT, MP_IRQ_TRIGGER_LEVEL|MP_IRQ_POLARITY_LOW, 0x0, 0x75, 0x2, 0x13);
45 smp_write_intsrc(mc, mp_INT, MP_IRQ_TRIGGER_LEVEL|MP_IRQ_POLARITY_LOW, 0x0, 0x76, 0x2, 0x12);
46 smp_write_intsrc(mc, mp_INT, MP_IRQ_TRIGGER_LEVEL|MP_IRQ_POLARITY_LOW, 0x0, 0x77, 0x2, 0x10);
47 smp_write_intsrc(mc, mp_INT, MP_IRQ_TRIGGER_LEVEL|MP_IRQ_POLARITY_LOW, 0x0, 0x6c, 0x2, 0x10);
48 smp_write_intsrc(mc, mp_INT, MP_IRQ_TRIGGER_LEVEL|MP_IRQ_POLARITY_LOW, 0x0, 0x70, 0x2, 0x10);
49 smp_write_intsrc(mc, mp_INT, MP_IRQ_TRIGGER_LEVEL|MP_IRQ_POLARITY_LOW, 0x0, 0x71, 0x2, 0x11);
50
51 /* Firewire 4:0.0 */
52 smp_write_intsrc(mc, mp_INT, MP_IRQ_TRIGGER_LEVEL|MP_IRQ_POLARITY_LOW, 0x4, 0x0, 0x2, 0x10);
53
54 /* Old riser card */
55 // riser slot top 5:8.0
56 smp_write_intsrc(mc, mp_INT, MP_IRQ_TRIGGER_LEVEL|MP_IRQ_POLARITY_LOW, 0x5, 0x20, 0x2, 0x14);
57 // riser slot middle 5:9.0
58 smp_write_intsrc(mc, mp_INT, MP_IRQ_TRIGGER_LEVEL|MP_IRQ_POLARITY_LOW, 0x5, 0x24, 0x2, 0x15);
59 // riser slot bottom 5:a.0
60 smp_write_intsrc(mc, mp_INT, MP_IRQ_TRIGGER_LEVEL|MP_IRQ_POLARITY_LOW, 0x5, 0x28, 0x2, 0x16);
61
62 /* New Riser Card */
63 smp_write_intsrc(mc, mp_INT, MP_IRQ_TRIGGER_LEVEL|MP_IRQ_POLARITY_LOW, 0x5, 0x30, 0x2, 0x14);
64 smp_write_intsrc(mc, mp_INT, MP_IRQ_TRIGGER_LEVEL|MP_IRQ_POLARITY_LOW, 0x5, 0x34, 0x2, 0x15);
65 smp_write_intsrc(mc, mp_INT, MP_IRQ_TRIGGER_LEVEL|MP_IRQ_POLARITY_LOW, 0x5, 0x38, 0x2, 0x16);
66
67 /* Onboard Ethernet */
68 smp_write_intsrc(mc, mp_INT, MP_IRQ_TRIGGER_LEVEL|MP_IRQ_POLARITY_LOW, 0x1, 0x0, 0x2, 0x10);
69
70 /* Local Ints: Type Polarity Trigger Bus ID IRQ APIC ID PIN# */
Patrick Georgi6eb7a532011-10-07 21:42:52 +020071 mptable_lintsrc(mc, isa_bus);
Stefan Reinauer1a08f582009-10-28 16:52:48 +000072
73 /* Compute the checksums */
Patrick Georgib0a9c5c2011-10-07 23:01:55 +020074 return mptable_finalize(mc);
Stefan Reinauer1a08f582009-10-28 16:52:48 +000075}
76
77unsigned long write_smp_table(unsigned long addr)
78{
79 void *v;
Patrick Georgic75c79b2011-10-07 22:41:07 +020080 v = smp_write_floating_table(addr, 0);
Stefan Reinauer1a08f582009-10-28 16:52:48 +000081 return (unsigned long)smp_write_config_table(v);
82}