Patrick Georgi | ac95903 | 2020-05-05 22:49:26 +0200 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-or-later */ |
Uwe Hermann | 1458228 | 2009-04-18 14:02:00 +0000 | [diff] [blame] | 2 | |
Uwe Hermann | 1458228 | 2009-04-18 14:02:00 +0000 | [diff] [blame] | 3 | #include <arch/smp/mpspec.h> |
Uwe Hermann | 74d1a6e | 2010-10-12 17:34:08 +0000 | [diff] [blame] | 4 | #include <arch/ioapic.h> |
Uwe Hermann | 1458228 | 2009-04-18 14:02:00 +0000 | [diff] [blame] | 5 | |
Myles Watson | 08e0fb8 | 2010-03-22 16:33:25 +0000 | [diff] [blame] | 6 | static void *smp_write_config_table(void *v) |
Uwe Hermann | 1458228 | 2009-04-18 14:02:00 +0000 | [diff] [blame] | 7 | { |
Kyösti Mälkki | 860cff9 | 2021-06-07 22:20:57 +0300 | [diff] [blame^] | 8 | int isa_bus; |
Uwe Hermann | 1458228 | 2009-04-18 14:02:00 +0000 | [diff] [blame] | 9 | struct mp_config_table *mc; |
| 10 | |
| 11 | mc = (void *)(((char *)v) + SMP_FLOATING_TABLE_LEN); |
Uwe Hermann | 1458228 | 2009-04-18 14:02:00 +0000 | [diff] [blame] | 12 | |
Kyösti Mälkki | dea42e0 | 2021-05-31 20:26:16 +0300 | [diff] [blame] | 13 | mptable_init(mc); |
Uwe Hermann | 1458228 | 2009-04-18 14:02:00 +0000 | [diff] [blame] | 14 | |
| 15 | smp_write_processors(mc); |
| 16 | |
Uwe Hermann | 7718054 | 2010-10-28 08:19:22 +0000 | [diff] [blame] | 17 | mptable_write_buses(mc, NULL, &isa_bus); |
Uwe Hermann | 1458228 | 2009-04-18 14:02:00 +0000 | [diff] [blame] | 18 | |
Kyösti Mälkki | 860cff9 | 2021-06-07 22:20:57 +0300 | [diff] [blame^] | 19 | /* External Intel 82093AA IOAPIC. */ |
| 20 | u8 ioapic_id = smp_write_ioapic_from_hw(mc, VIO_APIC_VADDR); |
Uwe Hermann | 7718054 | 2010-10-28 08:19:22 +0000 | [diff] [blame] | 21 | |
Uwe Hermann | 7718054 | 2010-10-28 08:19:22 +0000 | [diff] [blame] | 22 | /* Legacy Interrupts */ |
| 23 | mptable_add_isa_interrupts(mc, isa_bus, ioapic_id, 0); |
Patrick Georgi | c5b87c8 | 2010-05-20 15:28:19 +0000 | [diff] [blame] | 24 | |
Uwe Hermann | 7718054 | 2010-10-28 08:19:22 +0000 | [diff] [blame] | 25 | /* I/O Ints: Type Trigger Polarity Bus ID IRQ APIC ID PIN# */ |
Kyösti Mälkki | 860cff9 | 2021-06-07 22:20:57 +0300 | [diff] [blame^] | 26 | smp_write_intsrc(mc, mp_INT, MP_IRQ_TRIGGER_LEVEL | MP_IRQ_POLARITY_LOW, 0x0, 0x13, ioapic_id, 0x13); /* UHCI */ |
Uwe Hermann | 1458228 | 2009-04-18 14:02:00 +0000 | [diff] [blame] | 27 | |
Uwe Hermann | 7718054 | 2010-10-28 08:19:22 +0000 | [diff] [blame] | 28 | /* Local Ints: Type Trigger Polarity Bus ID IRQ APIC ID PIN# */ |
Patrick Georgi | 6eb7a53 | 2011-10-07 21:42:52 +0200 | [diff] [blame] | 29 | mptable_lintsrc(mc, isa_bus); |
Uwe Hermann | 1458228 | 2009-04-18 14:02:00 +0000 | [diff] [blame] | 30 | |
Uwe Hermann | 7718054 | 2010-10-28 08:19:22 +0000 | [diff] [blame] | 31 | /* Compute the checksums. */ |
Patrick Georgi | b0a9c5c | 2011-10-07 23:01:55 +0200 | [diff] [blame] | 32 | return mptable_finalize(mc); |
Uwe Hermann | 1458228 | 2009-04-18 14:02:00 +0000 | [diff] [blame] | 33 | } |
| 34 | |
| 35 | unsigned long write_smp_table(unsigned long addr) |
| 36 | { |
| 37 | void *v; |
Patrick Georgi | c75c79b | 2011-10-07 22:41:07 +0200 | [diff] [blame] | 38 | v = smp_write_floating_table(addr, 0); |
Uwe Hermann | 1458228 | 2009-04-18 14:02:00 +0000 | [diff] [blame] | 39 | return (unsigned long)smp_write_config_table(v); |
| 40 | } |