Get mptable OEM/product ID from kconfig variables.
[coreboot.git] / src / arch / x86 / boot / mpspec.c
index 70bc5401fdda72ef7d4e4c04e399d03391455d1f..72a6d28de85e9388548e0cc272c295cdd374efa5 100644 (file)
@@ -8,20 +8,17 @@
 #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)
+void mptable_init(struct mp_config_table *mc, 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!");
+       int i;
 
        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... */
@@ -29,6 +26,18 @@ void mptable_init(struct mp_config_table *mc, const char *productid,
        mc->mpe_length = 0;
        mc->mpe_checksum = 0;
        mc->reserved = 0;
+
+       strncpy(mc->mpc_oem, CONFIG_MAINBOARD_VENDOR, 8);
+       strncpy(mc->mpc_productid, CONFIG_MAINBOARD_PART_NUMBER, 12);
+
+       /*
+        * The oem/productid fields are exactly 8/12 bytes long. If the resp.
+        * entry is shorter, the remaining bytes are filled with spaces.
+        */
+       for (i = MIN(strlen(CONFIG_MAINBOARD_VENDOR), 8); i < 8; i++)
+               mc->mpc_oem[i] = ' ';
+       for (i = MIN(strlen(CONFIG_MAINBOARD_PART_NUMBER), 12); i < 12; i++)
+               mc->mpc_productid[i] = ' ';
 }
 
 unsigned char smp_compute_checksum(void *v, int len)