2004-01-12 21:00:43 +01:00
|
|
|
#include <console/console.h>
|
|
|
|
#include <arch/smp/mpspec.h>
|
2010-10-12 19:34:08 +02:00
|
|
|
#include <arch/ioapic.h>
|
2004-01-12 21:00:43 +01:00
|
|
|
#include <device/pci.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <stdint.h>
|
2006-10-05 01:57:49 +02:00
|
|
|
#include <cpu/amd/amdk8_sysconf.h>
|
|
|
|
|
2005-12-07 00:34:09 +01:00
|
|
|
extern unsigned char bus_8131_0;
|
|
|
|
extern unsigned char bus_8131_1;
|
|
|
|
extern unsigned char bus_8131_2;
|
|
|
|
extern unsigned char bus_8111_0;
|
|
|
|
extern unsigned char bus_8111_1;
|
|
|
|
extern unsigned apicid_8111;
|
|
|
|
extern unsigned apicid_8131_1;
|
|
|
|
extern unsigned apicid_8131_2;
|
|
|
|
|
|
|
|
extern unsigned sbdn3;
|
|
|
|
|
2010-03-22 17:33:25 +01:00
|
|
|
static void *smp_write_config_table(void *v)
|
2004-01-12 21:00:43 +01:00
|
|
|
{
|
|
|
|
struct mp_config_table *mc;
|
2010-11-21 15:41:07 +01:00
|
|
|
int i, bus_isa;
|
2010-04-27 08:56:47 +02:00
|
|
|
|
2004-01-12 21:00:43 +01:00
|
|
|
mc = (void *)(((char *)v) + SMP_FLOATING_TABLE_LEN);
|
|
|
|
|
2012-02-16 18:43:25 +01:00
|
|
|
mptable_init(mc, LOCAL_APIC_ADDR);
|
2004-01-12 21:00:43 +01:00
|
|
|
|
2004-10-20 07:07:16 +02:00
|
|
|
smp_write_processors(mc);
|
2004-01-12 21:00:43 +01:00
|
|
|
|
2005-12-07 00:34:09 +01:00
|
|
|
get_bus_conf();
|
2010-04-27 08:56:47 +02:00
|
|
|
|
2010-11-21 15:41:07 +01:00
|
|
|
mptable_write_buses(mc, NULL, &bus_isa);
|
2010-04-27 08:56:47 +02:00
|
|
|
|
2005-12-07 00:34:09 +01:00
|
|
|
/*I/O APICs: APIC ID Version State Address*/
|
2010-10-12 19:34:08 +02:00
|
|
|
smp_write_ioapic(mc, apicid_8111, 0x11, IO_APIC_ADDR);
|
2004-01-12 21:00:43 +01:00
|
|
|
{
|
2004-10-20 07:07:16 +02:00
|
|
|
device_t dev;
|
|
|
|
struct resource *res;
|
2005-12-07 00:34:09 +01:00
|
|
|
dev = dev_find_slot(bus_8131_0, PCI_DEVFN(sbdn3,1));
|
2004-01-12 21:00:43 +01:00
|
|
|
if (dev) {
|
2004-10-20 07:07:16 +02:00
|
|
|
res = find_resource(dev, PCI_BASE_ADDRESS_0);
|
|
|
|
if (res) {
|
2005-07-06 19:15:30 +02:00
|
|
|
smp_write_ioapic(mc, apicid_8131_1, 0x11, res->base);
|
2004-10-20 07:07:16 +02:00
|
|
|
}
|
2004-01-12 21:00:43 +01:00
|
|
|
}
|
2005-12-07 00:34:09 +01:00
|
|
|
dev = dev_find_slot(bus_8131_0, PCI_DEVFN(sbdn3+1,1));
|
2004-01-12 21:00:43 +01:00
|
|
|
if (dev) {
|
2004-10-20 07:07:16 +02:00
|
|
|
res = find_resource(dev, PCI_BASE_ADDRESS_0);
|
|
|
|
if (res) {
|
2005-07-06 19:15:30 +02:00
|
|
|
smp_write_ioapic(mc, apicid_8131_2, 0x11, res->base);
|
2004-10-20 07:07:16 +02:00
|
|
|
}
|
2004-01-12 21:00:43 +01:00
|
|
|
}
|
2004-10-20 07:07:16 +02:00
|
|
|
|
2004-01-12 21:00:43 +01:00
|
|
|
}
|
2010-04-27 08:56:47 +02:00
|
|
|
|
2010-05-20 17:28:19 +02:00
|
|
|
mptable_add_isa_interrupts(mc, bus_isa, apicid_8111, 0);
|
2010-04-27 08:56:47 +02:00
|
|
|
|
2010-05-20 17:28:19 +02:00
|
|
|
/*I/O Ints: Type Polarity Trigger Bus ID IRQ APIC ID PIN# */
|
2005-12-07 00:34:09 +01:00
|
|
|
//8111 LPC ????
|
2006-10-05 01:57:49 +02:00
|
|
|
smp_write_intsrc(mc, mp_INT, MP_IRQ_TRIGGER_LEVEL|MP_IRQ_POLARITY_LOW, bus_8111_0, ((sysconf.sbdn+1)<<2)|0, apicid_8111, 0x13);
|
2005-12-07 00:34:09 +01:00
|
|
|
|
|
|
|
//On Board AMD USB ???
|
|
|
|
smp_write_intsrc(mc, mp_INT, MP_IRQ_TRIGGER_LEVEL|MP_IRQ_POLARITY_LOW, bus_8111_1, (0<<2)|3, apicid_8111, 0x13);
|
|
|
|
|
|
|
|
//On Board ATI Display Adapter
|
|
|
|
smp_write_intsrc(mc, mp_INT, MP_IRQ_TRIGGER_LEVEL|MP_IRQ_POLARITY_LOW, bus_8111_1, (6<<2)|0, apicid_8111, 0x12);
|
|
|
|
|
|
|
|
//On Board SI Serial ATA
|
|
|
|
smp_write_intsrc(mc, mp_INT, MP_IRQ_TRIGGER_LEVEL|MP_IRQ_POLARITY_LOW, bus_8111_1, (5<<2)|0, apicid_8111, 0x11);
|
|
|
|
|
|
|
|
//Slot 3 PCIX 100/66
|
|
|
|
for(i=0;i<4;i++) {
|
|
|
|
smp_write_intsrc(mc, mp_INT, MP_IRQ_TRIGGER_LEVEL|MP_IRQ_POLARITY_LOW, bus_8131_1, (8<<2)|i, apicid_8131_1, (3+i)%4); //27
|
|
|
|
}
|
|
|
|
|
|
|
|
//On Board NIC and adaptec scsi
|
|
|
|
for(i=0;i<2;i++) {
|
|
|
|
smp_write_intsrc(mc, mp_INT, MP_IRQ_TRIGGER_LEVEL|MP_IRQ_POLARITY_LOW, bus_8131_1, (9<<2)|i, apicid_8131_1, (0+i)%4); //24
|
|
|
|
smp_write_intsrc(mc, mp_INT, MP_IRQ_TRIGGER_LEVEL|MP_IRQ_POLARITY_LOW, bus_8131_1, (0xa<<2)|i, apicid_8131_1, (0+i)%4); //24
|
|
|
|
}
|
|
|
|
|
|
|
|
//Slot 1 PCI-X 133/100/66 or Side 1 on raiser card
|
|
|
|
for(i=0;i<4;i++) {
|
|
|
|
smp_write_intsrc(mc, mp_INT, MP_IRQ_TRIGGER_LEVEL|MP_IRQ_POLARITY_LOW, bus_8131_2, (3<<2)|i, apicid_8131_2, (0+i)%4); //28
|
|
|
|
}
|
|
|
|
|
|
|
|
//Slot 1 PCI-X 133/100/66, Side 2 on raiser card
|
|
|
|
//Fix ME, IRQ Pins?
|
|
|
|
for(i=0;i<4;i++) {
|
|
|
|
smp_write_intsrc(mc, mp_INT, MP_IRQ_TRIGGER_LEVEL|MP_IRQ_POLARITY_LOW, bus_8131_2, (4<<2)|i, apicid_8131_2, (1+i)%4); //28
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-01-12 21:00:43 +01:00
|
|
|
|
2005-12-07 00:34:09 +01:00
|
|
|
/*Local Ints: Type Polarity Trigger Bus ID IRQ APIC ID PIN#*/
|
mptable: Refactor lintsrc generation
We copied pretty much the same code for generating mptable entries for
local interrupts (with some notable exceptions).
This change moves these lines into a generic function "mptable_lintsrc"
and makes use of it in many places.
The remaining uses of smp_write_lintsrc should be reviewed and replaced
by mptable_lintsrc calls where possible, and smp_write_lintsrc made static.
This patch was generated using Coccinelle:
@@
expression mc;
expression isa_bus;
@@
-smp_write_lintsrc(mc, mp_ExtINT, MP_IRQ_TRIGGER_DEFAULT|MP_IRQ_POLARITY_DEFAULT, isa_bus, 0x0, MP_APIC_ALL, 0x0);
-smp_write_lintsrc(mc, mp_NMI, MP_IRQ_TRIGGER_DEFAULT|MP_IRQ_POLARITY_DEFAULT, isa_bus, 0x0, MP_APIC_ALL, 0x1);
+mptable_lintsrc(mc, isa_bus);
@@
expression mc;
expression isa_bus;
@@
-smp_write_lintsrc(mc, mp_ExtINT, MP_IRQ_TRIGGER_EDGE|MP_IRQ_POLARITY_HIGH, isa_bus, 0x0, MP_APIC_ALL, 0x0);
-smp_write_lintsrc(mc, mp_NMI, MP_IRQ_TRIGGER_EDGE|MP_IRQ_POLARITY_HIGH, isa_bus, 0x0, MP_APIC_ALL, 0x1);
+mptable_lintsrc(mc, isa_bus);
@m@
identifier mc;
expression BUS;
@@
-#define IO_LOCAL_INT(type, intr, apicid, pin) smp_write_lintsrc(mc, (type), MP_IRQ_TRIGGER_EDGE | MP_IRQ_POLARITY_HIGH, BUS, (intr), (apicid), (pin));
...
-IO_LOCAL_INT(mp_ExtINT, 0x0, MP_APIC_ALL, 0x0);
-IO_LOCAL_INT(mp_NMI, 0x0, MP_APIC_ALL, 0x1);
+mptable_lintsrc(mc, BUS);
Change-Id: I97421f820cd039f5fd753cb0da5c1cca68819bb4
Signed-off-by: Patrick Georgi <patrick@georgi-clan.de>
Reviewed-on: http://review.coreboot.org/244
Tested-by: build bot (Jenkins)
Reviewed-by: Marc Jones <marcj303@gmail.com>
2011-10-07 21:42:52 +02:00
|
|
|
mptable_lintsrc(mc, bus_isa);
|
2004-01-12 21:00:43 +01:00
|
|
|
/* There is no extension information... */
|
|
|
|
|
|
|
|
/* Compute the checksums */
|
2011-10-07 23:01:55 +02:00
|
|
|
return mptable_finalize(mc);
|
2004-01-12 21:00:43 +01:00
|
|
|
}
|
|
|
|
|
2004-10-20 07:07:16 +02:00
|
|
|
unsigned long write_smp_table(unsigned long addr)
|
2004-01-12 21:00:43 +01:00
|
|
|
{
|
|
|
|
void *v;
|
2011-10-07 22:41:07 +02:00
|
|
|
v = smp_write_floating_table(addr, 0);
|
2004-10-20 07:07:16 +02:00
|
|
|
return (unsigned long)smp_write_config_table(v);
|
2004-01-12 21:00:43 +01:00
|
|
|
}
|