blob: e6b54595dae4c5d79b7b44021f90b2dff28e7e72 [file] [log] [blame]
Patrick Georgiac959032020-05-05 22:49:26 +02001/* SPDX-License-Identifier: GPL-2.0-or-later */
Uwe Hermann14582282009-04-18 14:02:00 +00002
Uwe Hermann14582282009-04-18 14:02:00 +00003#include <arch/smp/mpspec.h>
Uwe Hermann74d1a6e2010-10-12 17:34:08 +00004#include <arch/ioapic.h>
Uwe Hermann14582282009-04-18 14:02:00 +00005
Myles Watson08e0fb82010-03-22 16:33:25 +00006static void *smp_write_config_table(void *v)
Uwe Hermann14582282009-04-18 14:02:00 +00007{
Kyösti Mälkki860cff92021-06-07 22:20:57 +03008 int isa_bus;
Uwe Hermann14582282009-04-18 14:02:00 +00009 struct mp_config_table *mc;
10
11 mc = (void *)(((char *)v) + SMP_FLOATING_TABLE_LEN);
Uwe Hermann14582282009-04-18 14:02:00 +000012
Kyösti Mälkkidea42e02021-05-31 20:26:16 +030013 mptable_init(mc);
Uwe Hermann14582282009-04-18 14:02:00 +000014
15 smp_write_processors(mc);
16
Uwe Hermann77180542010-10-28 08:19:22 +000017 mptable_write_buses(mc, NULL, &isa_bus);
Uwe Hermann14582282009-04-18 14:02:00 +000018
Kyösti Mälkki860cff92021-06-07 22:20:57 +030019 /* External Intel 82093AA IOAPIC. */
Felix Held0d192892024-02-06 16:55:29 +010020 u8 ioapic_id = smp_write_ioapic_from_hw(mc, IO_APIC_ADDR);
Uwe Hermann77180542010-10-28 08:19:22 +000021
Uwe Hermann77180542010-10-28 08:19:22 +000022 /* Legacy Interrupts */
23 mptable_add_isa_interrupts(mc, isa_bus, ioapic_id, 0);
Patrick Georgic5b87c82010-05-20 15:28:19 +000024
Uwe Hermann77180542010-10-28 08:19:22 +000025 /* I/O Ints: Type Trigger Polarity Bus ID IRQ APIC ID PIN# */
Kyösti Mälkki7742aed2021-06-07 22:18:35 +030026 smp_write_pci_intsrc(mc, mp_INT, 0x0, 0x04, 3, ioapic_id, 0x13); /* UHCI */
Uwe Hermann14582282009-04-18 14:02:00 +000027
Uwe Hermann77180542010-10-28 08:19:22 +000028 /* Local Ints: Type Trigger Polarity Bus ID IRQ APIC ID PIN# */
Patrick Georgi6eb7a532011-10-07 21:42:52 +020029 mptable_lintsrc(mc, isa_bus);
Uwe Hermann14582282009-04-18 14:02:00 +000030
Uwe Hermann77180542010-10-28 08:19:22 +000031 /* Compute the checksums. */
Patrick Georgib0a9c5c2011-10-07 23:01:55 +020032 return mptable_finalize(mc);
Uwe Hermann14582282009-04-18 14:02:00 +000033}
34
35unsigned long write_smp_table(unsigned long addr)
36{
37 void *v;
Patrick Georgic75c79b2011-10-07 22:41:07 +020038 v = smp_write_floating_table(addr, 0);
Uwe Hermann14582282009-04-18 14:02:00 +000039 return (unsigned long)smp_write_config_table(v);
40}