2 * This file is part of the coreboot project.
4 * Copyright (C) 2007 AMD
5 * Written by Yinghai Lu <yinghailu@amd.com> for AMD.
6 * Copyright (C) 2009 Harald Gutmann <harald.gutmann@gmx.net>
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
23 #include <console/console.h>
24 #include <arch/smp/mpspec.h>
25 #include <device/pci.h>
28 #include <cpu/amd/amdk8_sysconf.h>
30 extern unsigned char bus_mcp55[8]; //1
32 extern unsigned apicid_mcp55;
34 static void *smp_write_config_table(void *v)
36 struct mp_config_table *mc;
40 mc = (void *)(((char *)v) + SMP_FLOATING_TABLE_LEN);
42 mptable_init(mc, LAPIC_ADDR);
44 smp_write_processors(mc);
49 mptable_write_buses(mc, NULL, &bus_isa);
51 /*I/O APICs: APIC ID Version State Address*/
56 dev = dev_find_slot(bus_mcp55[0], PCI_DEVFN(sbdn+ 0x1,0));
58 res = find_resource(dev, PCI_BASE_ADDRESS_1);
60 smp_write_ioapic(mc, apicid_mcp55, 0x11, res->base);
62 /* set up the interrupt registers of mcp55 */
63 pci_write_config32(dev, 0x7c, 0xc643c643);
64 pci_write_config32(dev, 0x80, 0x8da01009);
65 pci_write_config32(dev, 0x84, 0x200018d2);
69 mptable_add_isa_interrupts(mc, bus_isa, apicid_mcp55, 0);
71 /* PCI interrupts are level triggered, and are
72 * associated with a specific bus/device/function tuple.
74 #define PCI_INT(bus, dev, fn, pin) \
75 smp_write_intsrc(mc, mp_INT, MP_IRQ_TRIGGER_LEVEL|MP_IRQ_POLARITY_LOW,\
76 bus_mcp55[bus], (((dev)<<2)|(fn)), apicid_mcp55, (pin))
78 PCI_INT(0,sbdn+1,1, 10); /* SMBus */
79 PCI_INT(0,sbdn+2,0, 22); /* USB */
80 PCI_INT(0,sbdn+2,1, 23); /* USB */
81 PCI_INT(0,sbdn+4,0, 21); /* IDE */
82 PCI_INT(0,sbdn+5,0, 20); /* SATA */
83 PCI_INT(0,sbdn+5,1, 21); /* SATA */
84 PCI_INT(0,sbdn+5,2, 22); /* SATA */
85 PCI_INT(0,sbdn+6,1, 23); /* HD Audio */
86 PCI_INT(0,sbdn+8,0, 20); /* GBit Ethernet */
88 /* The PCIe slots, each on its own bus */
99 /* On bus 1: the PCI bus slots...
100 physical PCI slots are j = 7,8
107 PCI_INT(1,j,i, 16+k);
112 /*Local Ints: Type Polarity Trigger Bus ID IRQ APIC ID PIN#*/
113 mptable_lintsrc(mc, bus_isa);
114 /* There is no extension information... */
116 /* Compute the checksums */
117 return mptable_finalize(mc);
120 unsigned long write_smp_table(unsigned long addr)
123 v = smp_write_floating_table(addr, 0);
124 return (unsigned long)smp_write_config_table(v);