From b426107d1db17b606a90be83ddd3bf8a1c0d8751 Mon Sep 17 00:00:00 2001 From: Kyösti Mälkki Date: Tue, 22 Jul 2014 10:24:20 +0300 Subject: AGESA f14 f15tn 16kb: Move IOAPIC ID setup out of get_bus_conf() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I7fd14c17242cd3deb7a784fc918ad6fe1191bd13 Signed-off-by: Kyösti Mälkki Reviewed-on: http://review.coreboot.org/6359 Tested-by: build bot (Jenkins) Reviewed-by: Paul Menzel Reviewed-by: Edward O'Callaghan --- src/mainboard/amd/olivehill/get_bus_conf.c | 7 ------- src/mainboard/amd/olivehill/mptable.c | 31 +++++++++++++----------------- 2 files changed, 13 insertions(+), 25 deletions(-) (limited to 'src/mainboard/amd/olivehill') diff --git a/src/mainboard/amd/olivehill/get_bus_conf.c b/src/mainboard/amd/olivehill/get_bus_conf.c index 2765ed7c3f..582d7ed8c5 100644 --- a/src/mainboard/amd/olivehill/get_bus_conf.c +++ b/src/mainboard/amd/olivehill/get_bus_conf.c @@ -33,13 +33,10 @@ * and acpi_tables busnum is default. */ u8 bus_yangtze[6]; -u32 apicid_yangtze; void get_bus_conf(void) { - u32 apicid_base; - device_t dev; int i; memset(bus_yangtze, 0, sizeof(bus_yangtze)); @@ -59,8 +56,4 @@ void get_bus_conf(void) bus_yangtze[2 + i] = pci_read_config8(dev, PCI_SECONDARY_BUS); } } - - /* I/O APICs: APIC ID Version State Address */ - apicid_base = CONFIG_MAX_CPUS; - apicid_yangtze = apicid_base; } diff --git a/src/mainboard/amd/olivehill/mptable.c b/src/mainboard/amd/olivehill/mptable.c index c06863b1a7..db4a3ffa8e 100644 --- a/src/mainboard/amd/olivehill/mptable.c +++ b/src/mainboard/amd/olivehill/mptable.c @@ -21,6 +21,7 @@ #include #include #include +#include #include #include #include @@ -28,9 +29,6 @@ #include #include "southbridge/amd/agesa/hudson/hudson.h" /* pm_ioread() */ -#define IO_APIC_ID CONFIG_MAX_CPUS -extern u32 apicid_yangtze; - u8 picr_data[0x54] = { 0x03,0x04,0x05,0x07,0x0B,0x0A,0x1F,0x1F,0xFA,0xF1,0x00,0x00,0x1F,0x1F,0x1F,0x1F, 0x1F,0x1F,0x1F,0x03,0x1F,0x1F,0x1F,0x1F,0x1F,0x00,0x00,0x00,0x00,0x00,0x00,0x00, @@ -70,9 +68,16 @@ static void *smp_write_config_table(void *v) { struct mp_config_table *mc; int bus_isa; - u32 dword; u8 byte; + /* + * By the time this function gets called, the IOAPIC registers + * have been written so they can be read to get the correct + * APIC ID and Version + */ + u8 ioapic_id = (io_apic_read(IO_APIC_ADDR, 0x00) >> 24); + u8 ioapic_ver = (io_apic_read(IO_APIC_ADDR, 0x01) & 0xFF); + mc = (void *)(((char *)v) + SMP_FLOATING_TABLE_LEN); mptable_init(mc, LOCAL_APIC_ADDR); @@ -87,19 +92,9 @@ static void *smp_write_config_table(void *v) my_smp_write_bus(mc, bus_isa, "ISA "); /* I/O APICs: APIC ID Version State Address */ + smp_write_ioapic(mc, ioapic_id, ioapic_ver, IO_APIC_ADDR); - dword = 0; - dword = pm_read8(0x34) & 0xF0; - dword |= (pm_read8(0x35) & 0xFF) << 8; - dword |= (pm_read8(0x36) & 0xFF) << 16; - dword |= (pm_read8(0x37) & 0xFF) << 24; - /* Set IO APIC ID onto IO_APIC_ID */ - write32 (dword, 0x00); - write32 (dword + 0x10, IO_APIC_ID << 24); - apicid_yangtze = IO_APIC_ID; - smp_write_ioapic(mc, apicid_yangtze, 0x21, dword); - - smp_write_ioapic(mc, apicid_yangtze+1, 0x21, 0xFEC20000); + smp_write_ioapic(mc, ioapic_id+1, 0x21, 0xFEC20000); /* PIC IRQ routine */ for (byte = 0x0; byte < sizeof(picr_data); byte ++) { outb(byte, 0xC00); @@ -153,13 +148,13 @@ static void *smp_write_config_table(void *v) /* I/O Ints: Type Polarity Trigger Bus ID IRQ APIC ID PIN# */ #define IO_LOCAL_INT(type, intr, apicid, pin) \ smp_write_lintsrc(mc, (type), MP_IRQ_TRIGGER_EDGE | MP_IRQ_POLARITY_HIGH, bus_isa, (intr), (apicid), (pin)); - mptable_add_isa_interrupts(mc, bus_isa, apicid_yangtze, 0); + mptable_add_isa_interrupts(mc, bus_isa, ioapic_id, 0); /* PCI interrupts are level triggered, and are * associated with a specific bus/device/function tuple. */ #define PCI_INT(bus, dev, int_sign, pin) \ - smp_write_intsrc(mc, mp_INT, MP_IRQ_TRIGGER_LEVEL|MP_IRQ_POLARITY_LOW, (bus), (((dev)<<2)|(int_sign)), apicid_yangtze, (pin)) + smp_write_intsrc(mc, mp_INT, MP_IRQ_TRIGGER_LEVEL|MP_IRQ_POLARITY_LOW, (bus), (((dev)<<2)|(int_sign)), ioapic_id, (pin)) /* Internal VGA */ PCI_INT(0x0, 0x01, 0x0, intr_data[0x02]); -- cgit v1.2.3