blob: 2c7ac6023ec560e6fcb7cc76cf113b533a62b682 [file] [log] [blame]
Patrick Georgi02363b52020-05-05 20:48:50 +02001/* This file is part of the coreboot project. */
Uwe Hermann14582282009-04-18 14:02:00 +00002/*
Uwe Hermann14582282009-04-18 14:02:00 +00003 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
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.
Uwe Hermann14582282009-04-18 14:02:00 +000013 */
14
Uwe Hermann14582282009-04-18 14:02:00 +000015#include <arch/smp/mpspec.h>
Uwe Hermann74d1a6e2010-10-12 17:34:08 +000016#include <arch/ioapic.h>
Uwe Hermann14582282009-04-18 14:02:00 +000017#include <stdint.h>
18
Myles Watson08e0fb82010-03-22 16:33:25 +000019static void *smp_write_config_table(void *v)
Uwe Hermann14582282009-04-18 14:02:00 +000020{
Uwe Hermann77180542010-10-28 08:19:22 +000021 int ioapic_id, ioapic_ver, isa_bus;
Uwe Hermann14582282009-04-18 14:02:00 +000022 struct mp_config_table *mc;
23
24 mc = (void *)(((char *)v) + SMP_FLOATING_TABLE_LEN);
Uwe Hermann14582282009-04-18 14:02:00 +000025
Patrick Georgic8feedd2012-02-16 18:43:25 +010026 mptable_init(mc, LOCAL_APIC_ADDR);
Uwe Hermann14582282009-04-18 14:02:00 +000027
28 smp_write_processors(mc);
29
Uwe Hermann77180542010-10-28 08:19:22 +000030 mptable_write_buses(mc, NULL, &isa_bus);
Uwe Hermann14582282009-04-18 14:02:00 +000031
Uwe Hermann77180542010-10-28 08:19:22 +000032 ioapic_id = 2;
33 ioapic_ver = 0x11; /* External Intel 82093AA IOAPIC. */
Kevin Paul Herbertbde6d302014-12-24 18:43:20 -080034 smp_write_ioapic(mc, ioapic_id, ioapic_ver, VIO_APIC_VADDR);
Uwe Hermann77180542010-10-28 08:19:22 +000035
Uwe Hermann77180542010-10-28 08:19:22 +000036 /* Legacy Interrupts */
37 mptable_add_isa_interrupts(mc, isa_bus, ioapic_id, 0);
Patrick Georgic5b87c82010-05-20 15:28:19 +000038
Uwe Hermann77180542010-10-28 08:19:22 +000039 /* I/O Ints: Type Trigger Polarity Bus ID IRQ APIC ID PIN# */
40 smp_write_intsrc(mc, mp_INT, MP_IRQ_TRIGGER_LEVEL | MP_IRQ_POLARITY_LOW, 0x0, 0x13, ioapic_id, 0x13); /* UHCI */
Uwe Hermann14582282009-04-18 14:02:00 +000041
Uwe Hermann77180542010-10-28 08:19:22 +000042 /* Local Ints: Type Trigger Polarity Bus ID IRQ APIC ID PIN# */
Patrick Georgi6eb7a532011-10-07 21:42:52 +020043 mptable_lintsrc(mc, isa_bus);
Uwe Hermann14582282009-04-18 14:02:00 +000044
Uwe Hermann77180542010-10-28 08:19:22 +000045 /* Compute the checksums. */
Patrick Georgib0a9c5c2011-10-07 23:01:55 +020046 return mptable_finalize(mc);
Uwe Hermann14582282009-04-18 14:02:00 +000047}
48
49unsigned long write_smp_table(unsigned long addr)
50{
51 void *v;
Patrick Georgic75c79b2011-10-07 22:41:07 +020052 v = smp_write_floating_table(addr, 0);
Uwe Hermann14582282009-04-18 14:02:00 +000053 return (unsigned long)smp_write_config_table(v);
54}