Get mptable OEM/product ID from kconfig variables.
[coreboot.git] / src / mainboard / hp / dl145_g3 / mptable.c
index e9ce35f8882bd414adddbd6618738bb9686a45d1..f23121e634823221256002861698d598dbcb8b6d 100644 (file)
 #if CONFIG_LOGICAL_CPUS==1
 #include <cpu/amd/multicore.h>
 #endif
-
 #include <cpu/amd/amdk8_sysconf.h>
-
 #include "mb_sysconf.h"
 
-
-
 static void *smp_write_config_table(void *v)
 {
-       static const char sig[4] = "PCMP";
-       static const char oem[8] = "COREBOOT";
-       static const char productid[12] = "TREX        ";
        struct mp_config_table *mc;
-
        struct mb_sysconf_t *m;
+       int bus_isa;
 
        mc = (void *)(((char *)v) + SMP_FLOATING_TABLE_LEN);
-       memset(mc, 0, sizeof(*mc));
-
-       memcpy(mc->mpc_signature, sig, sizeof(sig));
-       mc->mpc_length = sizeof(*mc); /* initially just the header */
-       mc->mpc_spec = 0x04;
-       mc->mpc_checksum = 0; /* not yet computed */
-       memcpy(mc->mpc_oem, oem, sizeof(oem));
-       memcpy(mc->mpc_productid, productid, sizeof(productid));
-       mc->mpc_oemptr = 0;
-       mc->mpc_oemsize = 0;
-       mc->mpc_entry_count = 0; /* No entries yet... */
-       mc->mpc_lapic = LAPIC_ADDR;
-       mc->mpe_length = 0;
-       mc->mpe_checksum = 0;
-       mc->reserved = 0;
+
+       mptable_init(mc, LAPIC_ADDR);
 
        smp_write_processors(mc);
 
        get_bus_conf();
        m = sysconf.mb;
 
-       /*Bus:         Bus ID  Type*/
-       /* define bus and isa numbers */
-#if 0
-       unsigned char bus_num;
-       for(bus_num = 0; bus_num < m->bus_isa; bus_num++) {
-               smp_write_bus(mc, bus_num, "PCI   ");
-               printk(BIOS_DEBUG, "writing bus %d as PCI...\n",bus_num);
-       }
-#endif
-       smp_write_bus(mc, 0, "PCI   ");
-       smp_write_bus(mc, 1, "PCI   ");
-       smp_write_bus(mc, 7, "PCI   ");
-       smp_write_bus(mc, 8, "PCI   ");
-
-       smp_write_bus(mc,m->bus_isa, "ISA   ");
-       printk(BIOS_DEBUG, "writing %d as ISA...\n",m->bus_isa);
+       mptable_write_buses(mc, NULL, &bus_isa);
 
        /*I/O APICs:   APIC ID Version State           Address*/
        {
@@ -151,31 +116,17 @@ static void *smp_write_config_table(void *v)
                }
        }
 
-/*I/O Ints:    Type    Polarity    Trigger     Bus ID   IRQ    APIC ID PIN# */
-       smp_write_intsrc(mc, mp_ExtINT, MP_IRQ_TRIGGER_LEVEL|MP_IRQ_POLARITY_HIGH, m->bus_isa, 0x0, m->apicid_bcm5785[0], 0x0);
-       smp_write_intsrc(mc, mp_INT, MP_IRQ_TRIGGER_EDGE|MP_IRQ_POLARITY_HIGH,  m->bus_isa, 0x1, m->apicid_bcm5785[0], 0x1);
-       smp_write_intsrc(mc, mp_INT, MP_IRQ_TRIGGER_EDGE|MP_IRQ_POLARITY_HIGH,  m->bus_isa, 0x0, m->apicid_bcm5785[0], 0x2);
-       smp_write_intsrc(mc, mp_INT, MP_IRQ_TRIGGER_EDGE|MP_IRQ_POLARITY_HIGH,  m->bus_isa, 0x3, m->apicid_bcm5785[0], 0x3);
-       smp_write_intsrc(mc, mp_INT, MP_IRQ_TRIGGER_EDGE|MP_IRQ_POLARITY_HIGH,  m->bus_isa, 0x4, m->apicid_bcm5785[0], 0x4);
-       smp_write_intsrc(mc, mp_INT, MP_IRQ_TRIGGER_EDGE|MP_IRQ_POLARITY_HIGH,  m->bus_isa, 0x5, m->apicid_bcm5785[0], 0x5);
-       smp_write_intsrc(mc, mp_INT, MP_IRQ_TRIGGER_EDGE|MP_IRQ_POLARITY_HIGH,  m->bus_isa, 0x6, m->apicid_bcm5785[0], 0x6);
+       mptable_add_isa_interrupts(mc, bus_isa, m->apicid_bcm5785[0], 0);
+
        //SATA
 /*     printk(BIOS_DEBUG, "MPTABLE_SATA: bus_id:%d irq:%d apic_id:%d pin:%d\n",m->bus_bcm5785_1, (0x0e<<2)|0, m->apicid_bcm5785[0], 0x7); */
 /*     smp_write_intsrc(mc, mp_INT, MP_IRQ_TRIGGER_LEVEL|MP_IRQ_POLARITY_LOW, m->bus_bcm5785_1, (0x0e<<2)|0, m->apicid_bcm5785[0], 0x7); */
        printk(BIOS_DEBUG, "MPTABLE_SATA: bus_id:%d irq:%d apic_id:%d pin:%d\n",m->bus_bcm5785_1, (0x0e<<2)|0, m->apicid_bcm5785[0], 0xb);
        smp_write_intsrc(mc, mp_INT, MP_IRQ_TRIGGER_LEVEL|MP_IRQ_POLARITY_LOW, m->bus_bcm5785_1, (0x0e<<2)|0, m->apicid_bcm5785[0], 0xb);
-       smp_write_intsrc(mc, mp_INT, MP_IRQ_TRIGGER_EDGE|MP_IRQ_POLARITY_HIGH,  m->bus_isa, 0x8, m->apicid_bcm5785[0], 0x8);
-       smp_write_intsrc(mc, mp_INT, MP_IRQ_TRIGGER_EDGE|MP_IRQ_POLARITY_HIGH,  m->bus_isa, 0x9, m->apicid_bcm5785[0], 0x9);
        //USB
        printk(BIOS_DEBUG, "sysconf.sbdn: %d on bus: %x \n",sysconf.sbdn, m->bus_bcm5785_0);
        smp_write_intsrc(mc, mp_INT, MP_IRQ_TRIGGER_LEVEL|MP_IRQ_POLARITY_LOW, m->bus_bcm5785_0, (0x03<<2)|0, m->apicid_bcm5785[0], 0xa);
 
-       smp_write_intsrc(mc, mp_INT, MP_IRQ_TRIGGER_EDGE|MP_IRQ_POLARITY_HIGH,  m->bus_isa, 0xb, m->apicid_bcm5785[0], 0xb);
-       smp_write_intsrc(mc, mp_INT, MP_IRQ_TRIGGER_EDGE|MP_IRQ_POLARITY_HIGH,  m->bus_isa, 0xc, m->apicid_bcm5785[0], 0xc);
-       smp_write_intsrc(mc, mp_INT, MP_IRQ_TRIGGER_EDGE|MP_IRQ_POLARITY_HIGH,  m->bus_isa, 0xd, m->apicid_bcm5785[0], 0xd);
-       smp_write_intsrc(mc, mp_INT, MP_IRQ_TRIGGER_EDGE|MP_IRQ_POLARITY_HIGH,  m->bus_isa, 0xe, m->apicid_bcm5785[0], 0xe);
-       smp_write_intsrc(mc, mp_INT, MP_IRQ_TRIGGER_EDGE|MP_IRQ_POLARITY_HIGH,  m->bus_isa, 0xf, m->apicid_bcm5785[0], 0xf);
-
        //VGA
        smp_write_intsrc(mc, mp_INT, MP_IRQ_TRIGGER_LEVEL|MP_IRQ_POLARITY_LOW, m->bus_bcm5785_0, (0x4<<2)|0, m->apicid_bcm5785[1], 0x7);
 
@@ -212,9 +163,9 @@ static void *smp_write_config_table(void *v)
        }
 
 /*Local Ints:  Type    Polarity    Trigger     Bus ID   IRQ    APIC ID PIN#*/
-       printk(BIOS_DEBUG, "m->bus_isa is: %x\n",m->bus_isa);
-       smp_write_intsrc(mc, mp_ExtINT, MP_IRQ_TRIGGER_EDGE|MP_IRQ_POLARITY_HIGH, m->bus_isa, 0x0, MP_APIC_ALL, 0x0);
-       smp_write_intsrc(mc, mp_NMI, MP_IRQ_TRIGGER_EDGE|MP_IRQ_POLARITY_HIGH, m->bus_isa , 0x0, MP_APIC_ALL, 0x1);
+       printk(BIOS_DEBUG, "bus_isa is: %x\n", bus_isa);
+       smp_write_lintsrc(mc, mp_ExtINT, MP_IRQ_TRIGGER_EDGE|MP_IRQ_POLARITY_HIGH, bus_isa, 0x0, MP_APIC_ALL, 0x0);
+       smp_write_lintsrc(mc, mp_NMI, MP_IRQ_TRIGGER_EDGE|MP_IRQ_POLARITY_HIGH, bus_isa , 0x0, MP_APIC_ALL, 0x1);
 
        //extended table entries
        smp_write_address_space(mc,0 , ADDRESS_TYPE_IO, 0x0, 0x0, 0x0, 0x0001);