#include <device/pci.h>
#include <string.h>
#include <stdint.h>
-
#include <cpu/amd/amdk8_sysconf.h>
-extern unsigned char bus_isa;
extern unsigned char bus_ck804[6];
extern unsigned apicid_ck804;
-extern unsigned bus_type[256];
-
-
-
static void *smp_write_config_table(void *v)
{
- static const char sig[4] = "PCMP";
- static const char oem[8] = "MSI ";
- static const char productid[12] = "MS7135 ";
struct mp_config_table *mc;
+ int bus_isa;
unsigned sbdn;
- int bus_num;
-
- 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;
-
- smp_write_processors(mc);
-
get_bus_conf();
sbdn = sysconf.sbdn;
-/* Bus: Bus ID Type*/
- /* define numbers for pci and isa bus */
- for (bus_num = 0; bus_num < 256; bus_num++) {
- if (bus_type[bus_num])
- smp_write_bus(mc, bus_num, "PCI ");
- }
- smp_write_bus(mc, bus_isa, "ISA ");
+ mc = (void *)(((char *)v) + SMP_FLOATING_TABLE_LEN);
+ mptable_init(mc, LAPIC_ADDR);
+
+ smp_write_processors(mc);
+ mptable_write_buses(mc, NULL, &bus_isa);
/* I/O APICs: APIC ID Version State Address*/
{
device_t dev;
struct resource *res;
- uint32_t dword;
+ u32 dword;
dev = dev_find_slot(bus_ck804[0], PCI_DEVFN(sbdn + 0x1, 0));
if (dev) {
/* copied from stock bios */
/*0x01800500,0x1800d509,0x00520d08*/
- /* if this register is what i think it is ... */
dword = 0x08d0d218;
pci_write_config32(dev, 0x7c, dword);
}
/* Now, assemble the table. */
-
- smp_write_intsrc(mc, mp_ExtINT,
- MP_IRQ_TRIGGER_EDGE | MP_IRQ_POLARITY_HIGH,
- bus_isa, 0x0, apicid_ck804, 0x0);
-
-#define ISA_INT(intr, pin) \
- smp_write_intsrc(mc, mp_INT, MP_IRQ_TRIGGER_EDGE|MP_IRQ_POLARITY_HIGH, \
- bus_isa, (intr), apicid_ck804, (pin))
-
- ISA_INT(1, 1);
- ISA_INT(0, 2);
- ISA_INT(3, 3);
- ISA_INT(4, 4);
-
- ISA_INT(6, 6);
- ISA_INT(7, 7);
- ISA_INT(8, 8);
- ISA_INT(9, 9);
-
- ISA_INT(0xc, 0xc);
- ISA_INT(0xd, 0xd);
- ISA_INT(0xe, 0xe);
- ISA_INT(0xf, 0xf);
+ mptable_add_isa_interrupts(mc, bus_isa, apicid_ck804, 0);
#define PCI_INT(bus, dev, fn, pin) \
smp_write_intsrc(mc, mp_INT, MP_IRQ_TRIGGER_LEVEL|MP_IRQ_POLARITY_LOW, \
PCI_INT(3, 0, 3, 17);
/*Local Ints: Type Polarity Trigger Bus ID IRQ APIC ID PIN#*/
- smp_write_lintsrc(mc, mp_ExtINT,
- MP_IRQ_TRIGGER_DEFAULT | MP_IRQ_POLARITY_DEFAULT,
- bus_ck804[0], 0x0, MP_APIC_ALL, 0x0);
- smp_write_lintsrc(mc, mp_NMI,
- MP_IRQ_TRIGGER_DEFAULT | MP_IRQ_POLARITY_DEFAULT,
- bus_ck804[0], 0x0, MP_APIC_ALL, 0x1);
+ mptable_lintsrc(mc, bus_ck804[0]);
/* There is no extension information... */
unsigned long write_smp_table(unsigned long addr)
{
void *v;
- v = smp_write_floating_table(addr);
+ v = smp_write_floating_table(addr, 0);
return (unsigned long)smp_write_config_table(v);
}