| 1 |
|
| 2 |
|
| 3 |
#include <device/device.h> |
| 4 |
#include <arch/smp/mpspec.h> |
| 5 |
#include <arch/ioapic.h> |
| 6 |
|
| 7 |
static void *smp_write_config_table(void *v) |
| 8 |
{ |
| 9 |
struct mp_config_table *mc; |
| 10 |
int isa_bus; |
| 11 |
|
| 12 |
mc = (void *)(((char *)v) + SMP_FLOATING_TABLE_LEN); |
| 13 |
|
| 14 |
mptable_init(mc); |
| 15 |
|
| 16 |
smp_write_processors(mc); |
| 17 |
|
| 18 |
mptable_write_buses(mc, nullptr, &isa_bus); |
| 19 |
|
| 20 |
|
| 21 |
u8 ioapic_id = smp_write_ioapic_from_hw(mc, IO_APIC_ADDR); |
| 22 |
|
| 23 |
|
| 24 |
mptable_add_isa_interrupts(mc, isa_bus, ioapic_id, 0); |
| 25 |
|
| 26 |
smp_write_intsrc(mc, mp_ExtINT, MP_IRQ_TRIGGER_LEVEL|MP_IRQ_POLARITY_LOW, isa_bus, 0x00, MP_APIC_ALL, 0x00); |
| 27 |
smp_write_intsrc(mc, mp_NMI, MP_IRQ_TRIGGER_DEFAULT|MP_IRQ_POLARITY_DEFAULT, isa_bus, 0x00, MP_APIC_ALL, 0x01); |
| 28 |
smp_write_pci_intsrc(mc, mp_INT, 0x00, 0x01, 0x00, ioapic_id, 0x10); |
| 29 |
smp_write_pci_intsrc(mc, mp_INT, 0x00, 0x02, 0x00, ioapic_id, 0x10); |
| 30 |
smp_write_pci_intsrc(mc, mp_INT, 0x00, 0x1b, 0x00, ioapic_id, 0x16); |
| 31 |
smp_write_pci_intsrc(mc, mp_INT, 0x00, 0x1c, 0x00, ioapic_id, 0x11); |
| 32 |
smp_write_pci_intsrc(mc, mp_INT, 0x00, 0x1c, 0x01, ioapic_id, 0x10); |
| 33 |
smp_write_pci_intsrc(mc, mp_INT, 0x00, 0x1c, 0x02, ioapic_id, 0x12); |
| 34 |
smp_write_pci_intsrc(mc, mp_INT, 0x00, 0x1c, 0x03, ioapic_id, 0x13); |
| 35 |
smp_write_pci_intsrc(mc, mp_INT, 0x00, 0x1d, 0x00, ioapic_id, 0x15); |
| 36 |
smp_write_pci_intsrc(mc, mp_INT, 0x00, 0x1d, 0x01, ioapic_id, 0x13); |
| 37 |
smp_write_pci_intsrc(mc, mp_INT, 0x00, 0x1d, 0x02, ioapic_id, 0x12); |
| 38 |
smp_write_pci_intsrc(mc, mp_INT, 0x00, 0x1d, 0x03, ioapic_id, 0x10); |
| 39 |
smp_write_pci_intsrc(mc, mp_INT, 0x00, 0x1f, 0x00, ioapic_id, 0x12); |
| 40 |
smp_write_pci_intsrc(mc, mp_INT, 0x00, 0x1f, 0x01, ioapic_id, 0x13); |
| 41 |
smp_write_pci_intsrc(mc, mp_INT, 0x00, 0x1f, 0x03, ioapic_id, 0x10); |
| 42 |
smp_write_pci_intsrc(mc, mp_INT, 0x03, 0x03, 0x00, ioapic_id, 0x13); |
| 43 |
|
| 44 |
mptable_lintsrc(mc, isa_bus); |
| 45 |
return mptable_finalize(mc); |
| 46 |
} |
| 47 |
|
| 48 |
unsigned long write_smp_table(unsigned long addr) |
| 49 |
{ |
| 50 |
void *v; |
| 51 |
v = smp_write_floating_table(addr, 0); |
| 52 |
return (unsigned long)smp_write_config_table(v); |
| 53 |
} |