hvmloader: allow create_mp_tables() to allocate the table
authorIan Campbell <ian.campbell@citrix.com>
Wed, 1 Jun 2011 15:47:50 +0000 (16:47 +0100)
committerIan Campbell <ian.campbell@citrix.com>
Wed, 1 Jun 2011 15:47:50 +0000 (16:47 +0100)
Will be used by SeaBIOS.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
tools/firmware/hvmloader/mp_tables.c

index b4e16ee3e4fb4a9857d688723d895a6e15bd7209..a1365f53ec0b7aeca5f7df2ae1f4eab3ecb08512 100644 (file)
@@ -266,12 +266,27 @@ unsigned long create_mp_tables(void *_mpfps)
     int vcpu_nr, i, length;
     void *base;
     struct mp_io_intr_entry *mpiie;
-    struct mp_floating_pointer_struct *mpfps = _mpfps;
+    struct mp_floating_pointer_struct *mpfps;
 
     vcpu_nr = hvm_info->nr_vcpus;
 
     printf("Creating MP tables ...\n");
 
+    if (!_mpfps) {
+        int sz;
+
+        sz  = sizeof(struct mp_floating_pointer_struct);
+        sz += sizeof(struct mp_config_table);
+        sz += sizeof(struct mp_proc_entry) * vcpu_nr;
+        sz += sizeof(struct mp_bus_entry);
+        sz += sizeof(struct mp_ioapic_entry);
+        sz += sizeof(struct mp_io_intr_entry) * 16;
+
+        base = mem_alloc(sz, 0);
+    }
+
+    mpfps = _mpfps;
+
     base = &mpfps[1];
 
     p = base + sizeof(struct mp_config_table);