Get mptable OEM/product ID from kconfig variables.
[coreboot.git] / src / mainboard / intel / mtarvon / mptable.c
1 /*
2  * This file is part of the coreboot project.
3  *
4  * Copyright (C) 2008 Arastra, Inc.
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License version 2 as
8  * published by the Free Software Foundation.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
18  */
19
20 /* This code is based on src/mainboard/intel/jarrell/mptable.c */
21
22 #include <console/console.h>
23 #include <arch/smp/mpspec.h>
24 #include <arch/ioapic.h>
25 #include <device/pci.h>
26 #include <string.h>
27 #include <stdint.h>
28
29 static void *smp_write_config_table(void *v)
30 {
31         struct mp_config_table *mc;
32         int bus_isa;
33         u8 bus_pci = 6;
34         u8 bus_pcie_a = 1;
35
36         mc = (void *)(((char *)v) + SMP_FLOATING_TABLE_LEN);
37
38         mptable_init(mc, LAPIC_ADDR);
39
40         smp_write_processors(mc);
41
42         mptable_write_buses(mc, NULL, &bus_isa);
43
44         /* IOAPIC handling */
45         smp_write_ioapic(mc, 0x01, 0x20, IO_APIC_ADDR);
46
47         mptable_add_isa_interrupts(mc, bus_isa, 0x1, 0);
48
49         /* Standard local interrupt assignments */
50         smp_write_lintsrc(mc, mp_ExtINT, MP_IRQ_TRIGGER_DEFAULT|MP_IRQ_POLARITY_DEFAULT,
51                 bus_isa, 0x00, MP_APIC_ALL, 0x00);
52         smp_write_lintsrc(mc, mp_NMI, MP_IRQ_TRIGGER_DEFAULT|MP_IRQ_POLARITY_DEFAULT,
53                 bus_isa, 0x00, MP_APIC_ALL, 0x01);
54
55         /* Internal PCI devices */
56         smp_write_intsrc(mc, mp_INT, MP_IRQ_TRIGGER_LEVEL|MP_IRQ_POLARITY_LOW,
57                          0, (0x01<<2)|0, 0x01, 0x10); /* DMA controller */
58         smp_write_intsrc(mc, mp_INT, MP_IRQ_TRIGGER_LEVEL|MP_IRQ_POLARITY_LOW,
59                          0, (0x02<<2)|0, 0x01, 0x10); /* PCIe port A */
60         smp_write_intsrc(mc, mp_INT, MP_IRQ_TRIGGER_LEVEL|MP_IRQ_POLARITY_LOW,
61                          0, (0x03<<2)|0, 0x01, 0x10); /* PCIe port A1 */
62         smp_write_intsrc(mc, mp_INT, MP_IRQ_TRIGGER_LEVEL|MP_IRQ_POLARITY_LOW,
63                          0, (0x1c<<2)|0, 0x01, 0x10); /* PCIe port B0 */
64         smp_write_intsrc(mc, mp_INT, MP_IRQ_TRIGGER_LEVEL|MP_IRQ_POLARITY_LOW,
65                          0, (0x1c<<2)|1, 0x01, 0x11); /* PCIe port B1 */
66         smp_write_intsrc(mc, mp_INT, MP_IRQ_TRIGGER_LEVEL|MP_IRQ_POLARITY_LOW,
67                          0, (0x1c<<2)|2, 0x01, 0x12); /* PCIe port B2 */
68         smp_write_intsrc(mc, mp_INT, MP_IRQ_TRIGGER_LEVEL|MP_IRQ_POLARITY_LOW,
69                          0, (0x1c<<2)|3, 0x01, 0x13); /* PCIe port B3 */
70         smp_write_intsrc(mc, mp_INT, MP_IRQ_TRIGGER_LEVEL|MP_IRQ_POLARITY_LOW,
71                          0, (0x1d<<2)|0, 0x01, 0x10); /* UHCI0/EHCI */
72         smp_write_intsrc(mc, mp_INT, MP_IRQ_TRIGGER_LEVEL|MP_IRQ_POLARITY_LOW,
73                          0, (0x1d<<2)|1, 0x01, 0x11); /* UHCI1 */
74         smp_write_intsrc(mc, mp_INT, MP_IRQ_TRIGGER_LEVEL|MP_IRQ_POLARITY_LOW,
75                          0, (0x1e<<2)|0, 0x01, 0x10); /* Audio */
76         smp_write_intsrc(mc, mp_INT, MP_IRQ_TRIGGER_LEVEL|MP_IRQ_POLARITY_LOW,
77                          0, (0x1e<<2)|1, 0x01, 0x11); /* Modem */
78         smp_write_intsrc(mc, mp_INT, MP_IRQ_TRIGGER_LEVEL|MP_IRQ_POLARITY_LOW,
79                          0, (0x1f<<2)|1, 0x01, 0x11); /* SATA/SMBus */
80         smp_write_intsrc(mc, mp_INT, MP_IRQ_TRIGGER_LEVEL|MP_IRQ_POLARITY_LOW,
81                          0, (0x1f<<2)|3, 0x01, 0x13); /* ? */
82
83         /* PCI slot */
84         smp_write_intsrc(mc, mp_INT, MP_IRQ_TRIGGER_LEVEL|MP_IRQ_POLARITY_LOW,
85                 bus_pci, 0x00, 0x01, 0x10);
86         smp_write_intsrc(mc, mp_INT, MP_IRQ_TRIGGER_LEVEL|MP_IRQ_POLARITY_LOW,
87                 bus_pci, 0x01, 0x01, 0x11);
88         smp_write_intsrc(mc, mp_INT, MP_IRQ_TRIGGER_LEVEL|MP_IRQ_POLARITY_LOW,
89                 bus_pci, 0x02, 0x01, 0x12);
90         smp_write_intsrc(mc, mp_INT, MP_IRQ_TRIGGER_LEVEL|MP_IRQ_POLARITY_LOW,
91                 bus_pci, 0x03, 0x01, 0x13);
92
93         /* PCIe port A slot */
94         smp_write_intsrc(mc, mp_INT, MP_IRQ_TRIGGER_LEVEL|MP_IRQ_POLARITY_LOW,
95                 bus_pcie_a, 0x00, 0x01, 0x10);
96         smp_write_intsrc(mc, mp_INT, MP_IRQ_TRIGGER_LEVEL|MP_IRQ_POLARITY_LOW,
97                 bus_pcie_a, 0x01, 0x01, 0x11);
98         smp_write_intsrc(mc, mp_INT, MP_IRQ_TRIGGER_LEVEL|MP_IRQ_POLARITY_LOW,
99                 bus_pcie_a, 0x02, 0x01, 0x12);
100         smp_write_intsrc(mc, mp_INT, MP_IRQ_TRIGGER_LEVEL|MP_IRQ_POLARITY_LOW,
101                 bus_pcie_a, 0x03, 0x01, 0x13);
102
103         /* There is no extension information... */
104
105         /* Compute the checksums */
106         mc->mpe_checksum = smp_compute_checksum(smp_next_mpc_entry(mc), mc->mpe_length);
107
108         mc->mpc_checksum = smp_compute_checksum(mc, mc->mpc_length);
109         printk(BIOS_DEBUG, "Wrote the mp table end at: %p - %p\n",
110                 mc, smp_next_mpe_entry(mc));
111         return smp_next_mpe_entry(mc);
112 }
113
114 unsigned long write_smp_table(unsigned long addr)
115 {
116         void *v;
117         v = smp_write_floating_table(addr);
118         return (unsigned long)smp_write_config_table(v);
119 }
120