diff options
Diffstat (limited to 'src/arch')
-rw-r--r-- | src/arch/i386/boot/mpspec.c | 24 | ||||
-rw-r--r-- | src/arch/i386/include/arch/smp/mpspec.h | 3 |
2 files changed, 27 insertions, 0 deletions
diff --git a/src/arch/i386/boot/mpspec.c b/src/arch/i386/boot/mpspec.c index 031f326b64..c6946c2a98 100644 --- a/src/arch/i386/boot/mpspec.c +++ b/src/arch/i386/boot/mpspec.c @@ -7,6 +7,30 @@ #include <arch/cpu.h> #include <cpu/x86/lapic.h> +/* Initialize the specified "mc" struct with initial values. */ +void mptable_init(struct mp_config_table *mc, const char *productid, + u32 lapic_addr) +{ + /* Error out if 'product_id' length doesn't match exactly. */ + if (strlen(productid) != 12) + die("ERROR: 'productid' must be 12 bytes long!"); + + memset(mc, 0, sizeof(*mc)); + memcpy(mc->mpc_signature, MPC_SIGNATURE, 4); + mc->mpc_length = sizeof(*mc); /* Initially just the header size. */ + mc->mpc_spec = 0x04; /* MultiProcessor specification 1.4 */ + mc->mpc_checksum = 0; /* Not yet computed. */ + memcpy(mc->mpc_oem, "COREBOOT", 8); + memcpy(mc->mpc_productid, productid, 12); + 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; +} + unsigned char smp_compute_checksum(void *v, int len) { unsigned char *bytes; diff --git a/src/arch/i386/include/arch/smp/mpspec.h b/src/arch/i386/include/arch/smp/mpspec.h index 9b4a6281b7..5dc164748e 100644 --- a/src/arch/i386/include/arch/smp/mpspec.h +++ b/src/arch/i386/include/arch/smp/mpspec.h @@ -232,6 +232,9 @@ struct mp_exten_compatibility_address_space { /* Default local apic addr */ #define LAPIC_ADDR 0xFEE00000 +void mptable_init(struct mp_config_table *mc, const char *productid, + u32 lapic_addr); + void *smp_next_mpc_entry(struct mp_config_table *mc); void *smp_next_mpe_entry(struct mp_config_table *mc); |