direct-io.hg

changeset 10520:ae245d35457b

[HVM][Firmware] Make the creation of MP tables more dynamic

Currently the ROMBIOS includes static MP tables for only four
configurations: 1-way, 2-way, 4-way, and 8-way.

This patch makes the creation of MP tables more dynamic by creating them
from within HVMLOADER based upon the VCPU number provided by the HVM
information table.

Note: Some of the information included used to create the MP tables is
still hard coded and based upon values used in the original ROMBIOS MP
tables. Data such as the CPU family/model/stepping information should
probably be made to match the information provided to the guest when
executing a CPUID.

Signed-off-by: Travis Betak <travis.betak@amd.com>
author kaf24@firebug.cl.cam.ac.uk
date Wed Jun 28 13:59:29 2006 +0100 (2006-06-28)
parents 25cd5216b30c
children 25c6ea6d4024
files tools/firmware/hvmloader/Makefile tools/firmware/hvmloader/acpi_madt.c tools/firmware/hvmloader/hvmloader.c tools/firmware/hvmloader/mp_tables.c tools/firmware/rombios/Makefile tools/firmware/rombios/rombios.c
line diff
     1.1 --- a/tools/firmware/hvmloader/Makefile	Wed Jun 28 13:35:22 2006 +0100
     1.2 +++ b/tools/firmware/hvmloader/Makefile	Wed Jun 28 13:59:29 2006 +0100
     1.3 @@ -45,9 +45,9 @@ LDFLAGS  = -m32 -nostdlib -Wl,-N -Wl,-Tt
     1.4  .PHONY: all
     1.5  all: hvmloader
     1.6  
     1.7 -hvmloader: roms.h hvmloader.c acpi_madt.c
     1.8 -	$(CC) $(CFLAGS) -c hvmloader.c acpi_madt.c
     1.9 -	$(CC) $(LDFLAGS) -o hvmloader.tmp hvmloader.o acpi_madt.o
    1.10 +hvmloader: roms.h hvmloader.c acpi_madt.c mp_tables.c
    1.11 +	$(CC) $(CFLAGS) -c hvmloader.c acpi_madt.c mp_tables.c
    1.12 +	$(CC) $(LDFLAGS) -o hvmloader.tmp hvmloader.o acpi_madt.o mp_tables.o
    1.13  	$(OBJCOPY) hvmloader.tmp hvmloader
    1.14  	rm -f hvmloader.tmp
    1.15  
     2.1 --- a/tools/firmware/hvmloader/acpi_madt.c	Wed Jun 28 13:35:22 2006 +0100
     2.2 +++ b/tools/firmware/hvmloader/acpi_madt.c	Wed Jun 28 13:59:29 2006 +0100
     2.3 @@ -51,7 +51,7 @@ static int validate_hvm_info(struct hvm_
     2.4  }
     2.5  
     2.6  /* xc_vmx_builder wrote hvm info at 0x9F800. Return it. */
     2.7 -static struct hvm_info_table *
     2.8 +struct hvm_info_table *
     2.9  get_hvm_info_table(void)
    2.10  {
    2.11  	struct hvm_info_table *t;
     3.1 --- a/tools/firmware/hvmloader/hvmloader.c	Wed Jun 28 13:35:22 2006 +0100
     3.2 +++ b/tools/firmware/hvmloader/hvmloader.c	Wed Jun 28 13:59:29 2006 +0100
     3.3 @@ -23,6 +23,7 @@
     3.4   */
     3.5  #include "roms.h"
     3.6  #include "../acpi/acpi2_0.h"  /* for ACPI_PHYSICAL_ADDRESS */
     3.7 +#include <xen/hvm/hvm_info_table.h>
     3.8  
     3.9  /* memory map */
    3.10  #define VGABIOS_PHYSICAL_ADDRESS	0x000C0000
    3.11 @@ -71,6 +72,8 @@ asm(
    3.12  
    3.13  extern int get_acpi_enabled(void);
    3.14  extern int acpi_madt_update(unsigned char* acpi_start);
    3.15 +extern void create_mp_tables(void);
    3.16 +struct hvm_info_table *get_hvm_info_table(void);
    3.17  
    3.18  static inline void
    3.19  outw(unsigned short addr, unsigned short val)
    3.20 @@ -162,10 +165,15 @@ check_amd(void)
    3.21  int
    3.22  main(void)
    3.23  {
    3.24 +	struct hvm_info_table *t = get_hvm_info_table();
    3.25 +
    3.26  	puts("HVM Loader\n");
    3.27  
    3.28  	puts("Loading ROMBIOS ...\n");
    3.29  	memcpy((void *)ROMBIOS_PHYSICAL_ADDRESS, rombios, sizeof(rombios));
    3.30 +	if (t->apic_enabled)
    3.31 +		create_mp_tables();
    3.32 +	
    3.33  	if (cirrus_check()) {
    3.34  		puts("Loading Cirrus VGABIOS ...\n");
    3.35  		memcpy((void *)VGABIOS_PHYSICAL_ADDRESS,
     4.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.2 +++ b/tools/firmware/hvmloader/mp_tables.c	Wed Jun 28 13:59:29 2006 +0100
     4.3 @@ -0,0 +1,426 @@
     4.4 +/*
     4.5 + * mp_tables.c: Dynamically writes MP table info into the ROMBIOS.
     4.6 + *
     4.7 + * In order to work with various VCPU counts, this code reads the VCPU count
     4.8 + * for the HVM partition and creates the correct MP tables for the VCPU count
     4.9 + * and places the information into a predetermined location set aside in the
    4.10 + * ROMBIOS during build time.
    4.11 + *
    4.12 + * Please note that many of the values, such as the CPU's
    4.13 + * family/model/stepping, are hard-coded based upon the values that were used
    4.14 + * in the ROMBIOS and may need to be modified or calculated dynamically to
    4.15 + * correspond with what an HVM guest's CPUID returns.
    4.16 + *
    4.17 + * Travis Betak, travis.betak@amd.com
    4.18 + * Copyright (c) 2006, AMD.
    4.19 + *
    4.20 + * This program is free software; you can redistribute it and/or modify it
    4.21 + * under the terms and conditions of the GNU General Public License,
    4.22 + * version 2, as published by the Free Software Foundation.
    4.23 + *
    4.24 + * This program is distributed in the hope it will be useful, but WITHOUT
    4.25 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    4.26 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
    4.27 + * more details.
    4.28 + *
    4.29 + * You should have received a copy of the GNU General Public License along with
    4.30 + * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
    4.31 + * Place - Suite 330, Boston, MA 02111-1307 USA.
    4.32 + */
    4.33 +
    4.34 +
    4.35 +/* FIXME find a header that already has types defined!!! */
    4.36 +typedef unsigned char  uint8_t;
    4.37 +typedef   signed char  int8_t;
    4.38 +typedef unsigned short uint16_t;
    4.39 +typedef   signed short int16_t;
    4.40 +typedef unsigned int   uint32_t;
    4.41 +typedef   signed int   int32_t;
    4.42 +#ifdef __i386__
    4.43 +typedef unsigned long long uint64_t;
    4.44 +typedef   signed long long int64_t;
    4.45 +#else
    4.46 +typedef unsigned long uint64_t;
    4.47 +typedef   signed long int64_t;
    4.48 +#endif
    4.49 +
    4.50 +#define ROMBIOS_SEG              0xF000
    4.51 +#define ROMBIOS_BEGIN            0x000F0000
    4.52 +#define ROMBIOS_SIZE             0x00010000 
    4.53 +#define ROMBIOS_MAXOFFSET        0x0000FFFF
    4.54 +#define ROMBIOS_END             (ROMBIOS_BEGIN + ROMBIOS_SIZE)
    4.55 +
    4.56 +/* number of non-processor MP table entries */
    4.57 +#define NR_NONPROC_ENTRIES     18
    4.58 +
    4.59 +#define ENTRY_TYPE_PROCESSOR   0
    4.60 +#define ENTRY_TYPE_BUS         1
    4.61 +#define ENTRY_TYPE_IOAPIC      2
    4.62 +#define ENTRY_TYPE_IO_INTR     3
    4.63 +#define ENTRY_TYPE_LOCAL_INTR  4
    4.64 +
    4.65 +#define CPU_FLAG_ENABLED       0x01
    4.66 +#define CPU_FLAG_BSP           0x02
    4.67 +
    4.68 +/* TODO change this to correspond with what the guest's see's from CPUID */
    4.69 +#define CPU_SIG_FAMILY         0x06
    4.70 +#define CPU_SIG_MODEL          0x00
    4.71 +#define CPU_SIG_STEPPING       0x00
    4.72 +#define CPU_SIGNATURE        ((CPU_SIG_FAMILY << 8)  \
    4.73 +                             | (CPU_SIG_MODEL << 4)  \
    4.74 +                             | (CPU_SIG_STEPPING))
    4.75 +#define CPU_FEATURE_FPU       (1U << 0)
    4.76 +#define CPU_FEATURE_MCE       (1U << 7)
    4.77 +#define CPU_FEATURE_CX8       (1U << 8)
    4.78 +#define CPU_FEATURE_APIC      (1U << 9)
    4.79 +#define CPU_FEATURES          (CPU_FEATURE_FPU | CPU_FEATURE_APIC)
    4.80 +
    4.81 +#define BUS_TYPE_LENGTH        6
    4.82 +#define BUS_TYPE_STR_ISA       "ISA   "
    4.83 +
    4.84 +#define LAPIC_BASE_ADDR        0xFEE00000
    4.85 +
    4.86 +#define IOAPIC_VERSION         0x11
    4.87 +#define IOAPIC_BASE_ADDR       0xFEC00000
    4.88 +#define IOAPIC_FLAG_ENABLED   (1U << 0)
    4.89 +
    4.90 +#define INTR_TYPE_INT          0
    4.91 +#define INTR_TYPE_NMI          1
    4.92 +#define INTR_TYPE_SMI          2
    4.93 +#define INTR_TYPE_EXTINT       3
    4.94 +
    4.95 +#define INTR_FLAGS             0
    4.96 +
    4.97 +#define INTR_MAX_NR            16
    4.98 +
    4.99 +extern int puts(const char *); /* for printing */
   4.100 +extern int get_vcpu_nr(void);  /* for the guest's VCPU count */
   4.101 +
   4.102 +/*
   4.103 + * The following structures are defined in the MuliProcessor Specifiation v1.4
   4.104 + */
   4.105 +
   4.106 +/* MP Floating Pointer Structure */
   4.107 +struct mp_floating_pointer_struct {
   4.108 +	uint8_t signature[4];
   4.109 +	uint32_t mp_table;
   4.110 +	uint8_t length;
   4.111 +	uint8_t revision;
   4.112 +	uint8_t checksum;
   4.113 +	uint8_t feature[5];
   4.114 +};
   4.115 +
   4.116 +/* MP Configuration Table */
   4.117 +struct mp_config_table {
   4.118 +	uint8_t signature[4];
   4.119 +	uint16_t length;
   4.120 +	uint8_t revision;
   4.121 +	uint8_t checksum;
   4.122 +	uint8_t oem_id[8];
   4.123 +	uint8_t vendor_id[12];
   4.124 +	uint32_t oem_table;
   4.125 +	uint16_t oem_table_sz;
   4.126 +	uint16_t nr_entries;
   4.127 +	uint32_t lapic;
   4.128 +	uint16_t extended_length;
   4.129 +	uint8_t extended_checksum;
   4.130 +	uint8_t reserved;
   4.131 +};
   4.132 +
   4.133 +/* MP Processor Entry */
   4.134 +struct mp_proc_entry {
   4.135 +	uint8_t type;
   4.136 +	uint8_t lapic_id;
   4.137 +	uint8_t lapic_version;
   4.138 +	uint8_t cpu_flags;
   4.139 +	uint32_t cpu_signature;
   4.140 +	uint32_t feature_flags;
   4.141 +	uint8_t reserved[8];
   4.142 +};
   4.143 +
   4.144 +/* MP Bus Entry */
   4.145 +struct mp_bus_entry {
   4.146 +	uint8_t type;
   4.147 +	uint8_t bus_id;
   4.148 +	uint8_t bus_type_str[6];
   4.149 +};
   4.150 +
   4.151 +/* MP IOAPIC Entry */
   4.152 +struct mp_ioapic_entry {
   4.153 +	uint8_t type;
   4.154 +	uint8_t ioapic_id;
   4.155 +	uint8_t ioapic_version;
   4.156 +	uint8_t ioapic_flags;
   4.157 +	uint32_t ioapic_addr;
   4.158 +};
   4.159 +
   4.160 +/* MP IO Interrupt Entry */
   4.161 +struct mp_io_intr_entry {
   4.162 +	uint8_t type;
   4.163 +	uint8_t intr_type;
   4.164 +	uint16_t io_intr_flags;
   4.165 +	uint8_t src_bus_id;
   4.166 +	uint8_t src_bus_irq;
   4.167 +	uint8_t dst_ioapic_id;
   4.168 +	uint8_t dst_ioapic_intin;
   4.169 +};
   4.170 +
   4.171 +/* MP Local Interrupt Entry */
   4.172 +struct mp_local_intr_entry {
   4.173 +	uint8_t type;
   4.174 +	uint8_t intr_type;
   4.175 +	uint16_t local_intr_flags;
   4.176 +	uint8_t src_bus_id;
   4.177 +	uint8_t src_bus_irq;
   4.178 +	uint8_t dst_lapic_id;
   4.179 +	uint8_t dst_lapic_lintin;
   4.180 +};
   4.181 +
   4.182 +
   4.183 +/* 
   4.184 + * fill_mp_config_table - fills in the information for the MP config table
   4.185 + *    
   4.186 + * When calculating the length and nr_entries fields, keep in mind that there
   4.187 + * are always 18 non-processor entries and N processor entries
   4.188 + * 
   4.189 + *    N vcpu entries
   4.190 + *    1 bus entry 
   4.191 + *    1 IOAPIC entry 
   4.192 + * + 16 IO intr. entries
   4.193 + * ----------------------
   4.194 + * 18 + N total entries
   4.195 + */
   4.196 +void fill_mp_config_table(struct mp_config_table *mpct)
   4.197 +{
   4.198 +	int vcpu_nr;
   4.199 +
   4.200 +	vcpu_nr = get_vcpu_nr();
   4.201 +
   4.202 +	/* fill in the MP configuration table signature, "PCMP" */
   4.203 +	mpct->signature[0] = 'P';
   4.204 +	mpct->signature[1] = 'C';
   4.205 +	mpct->signature[2] = 'M';
   4.206 +	mpct->signature[3] = 'P';
   4.207 +
   4.208 +	mpct->length =    sizeof(struct mp_config_table)
   4.209 +			+ vcpu_nr * sizeof(struct mp_proc_entry)
   4.210 +			+ sizeof(struct mp_ioapic_entry)
   4.211 +			+ sizeof(struct mp_bus_entry)
   4.212 +			+ 16 * sizeof(struct mp_local_intr_entry);
   4.213 +
   4.214 +	mpct->revision = 4;
   4.215 +
   4.216 +	/* 
   4.217 +	 * We'll fill in the checksum later after all of the 
   4.218 +	 * entries have been created
   4.219 +	 */
   4.220 +	mpct->checksum = 0;
   4.221 +
   4.222 +	/* fill in the OEM ID string, "_HVMCPU_" */
   4.223 +	mpct->oem_id[0] = '_'; mpct->oem_id[3] = 'M'; mpct->oem_id[6] = 'U';
   4.224 +	mpct->oem_id[1] = 'H'; mpct->oem_id[4] = 'C'; mpct->oem_id[7] = '_';
   4.225 +	mpct->oem_id[2] = 'V'; mpct->oem_id[5] = 'P';
   4.226 +
   4.227 +	/* fill in the Vendor ID string, "XEN         " */
   4.228 +	mpct->vendor_id[0] = 'X'; mpct->vendor_id[6] =  ' ';
   4.229 +	mpct->vendor_id[1] = 'E'; mpct->vendor_id[7] =  ' ';
   4.230 +	mpct->vendor_id[2] = 'N'; mpct->vendor_id[8] =  ' ';
   4.231 +	mpct->vendor_id[3] = ' '; mpct->vendor_id[9] =  ' ';
   4.232 +	mpct->vendor_id[4] = ' '; mpct->vendor_id[10] = ' ';
   4.233 +	mpct->vendor_id[5] = ' '; mpct->vendor_id[11] = ' ';
   4.234 +
   4.235 +	mpct->oem_table = 0;
   4.236 +	mpct->oem_table_sz = 0;
   4.237 +
   4.238 +	mpct->nr_entries = vcpu_nr + NR_NONPROC_ENTRIES;
   4.239 +
   4.240 +	mpct->lapic = LAPIC_BASE_ADDR;
   4.241 +	mpct->extended_length = 0;
   4.242 +	mpct->extended_checksum = 0;
   4.243 +}
   4.244 +
   4.245 +
   4.246 +/* calculates the checksum for the MP configuration table */
   4.247 +void fill_mp_config_table_checksum(struct mp_config_table *mpct)
   4.248 +{
   4.249 +	int i;
   4.250 +	uint8_t checksum;
   4.251 +
   4.252 +	checksum = 0;
   4.253 +	for (i = 0; i < mpct->length; ++i)
   4.254 +		checksum += ((uint8_t *)(mpct))[i];
   4.255 +	mpct->checksum = -checksum;
   4.256 +}
   4.257 +
   4.258 +
   4.259 +/* fills in an MP processor entry for VCPU 'vcpu_id' */
   4.260 +void fill_mp_proc_entry(struct mp_proc_entry *mppe, int vcpu_id)
   4.261 +{
   4.262 +	mppe->type = ENTRY_TYPE_PROCESSOR;
   4.263 +	mppe->lapic_id = vcpu_id;
   4.264 +	mppe->lapic_version = 0x11;
   4.265 +	mppe->cpu_flags = CPU_FLAG_ENABLED;
   4.266 +	if (vcpu_id == 0)
   4.267 +		mppe->cpu_flags |= CPU_FLAG_BSP;
   4.268 +	mppe->cpu_signature = CPU_SIGNATURE;
   4.269 +	mppe->feature_flags = CPU_FEATURES;
   4.270 +}
   4.271 +
   4.272 +
   4.273 +/* fills in an MP bus entry of type 'type' and bus ID 'bus_id' */
   4.274 +void fill_mp_bus_entry(struct mp_bus_entry *mpbe, int bus_id, const char *type)
   4.275 +{
   4.276 +	int i;
   4.277 +
   4.278 +	mpbe->type = ENTRY_TYPE_BUS;
   4.279 +	mpbe->bus_id = bus_id;
   4.280 +	for (i = 0; i < BUS_TYPE_LENGTH; ++i)
   4.281 +		mpbe->bus_type_str[i] = type[i]; /* FIXME length check? */
   4.282 +}
   4.283 +
   4.284 +
   4.285 +/* fills in an MP IOAPIC entry for IOAPIC 'ioapic_id' */
   4.286 +void fill_mp_ioapic_entry(struct mp_ioapic_entry *mpie, int ioapic_id)
   4.287 +{
   4.288 +	mpie->type = ENTRY_TYPE_IOAPIC;
   4.289 +	mpie->ioapic_id = ioapic_id;
   4.290 +	mpie->ioapic_version = IOAPIC_VERSION;
   4.291 +	mpie->ioapic_flags = IOAPIC_FLAG_ENABLED;
   4.292 +	mpie->ioapic_addr = IOAPIC_BASE_ADDR;
   4.293 +}
   4.294 +
   4.295 +
   4.296 +/* fills in an IO interrupt entry for IOAPIC 'ioapic_id' */
   4.297 +void fill_mp_io_intr_entry(struct mp_io_intr_entry *mpiie,
   4.298 +		int src_bus_irq, int ioapic_id, int dst_ioapic_intin)
   4.299 +{
   4.300 +	mpiie->type = ENTRY_TYPE_IO_INTR;
   4.301 +	mpiie->intr_type = INTR_TYPE_INT;
   4.302 +	mpiie->io_intr_flags = INTR_FLAGS;
   4.303 +	mpiie->src_bus_id = 0;
   4.304 +	mpiie->src_bus_irq = src_bus_irq;
   4.305 +	mpiie->dst_ioapic_id = ioapic_id;
   4.306 +	mpiie->dst_ioapic_intin = dst_ioapic_intin;
   4.307 +}
   4.308 +
   4.309 +
   4.310 +/* fill in the mp floating processor structure */
   4.311 +void fill_mpfps(struct mp_floating_pointer_struct *mpfps, uint32_t mpct)
   4.312 +{
   4.313 +	int i;
   4.314 +	uint8_t checksum;
   4.315 +
   4.316 +
   4.317 +	mpfps->signature[0] = '_';
   4.318 +	mpfps->signature[1] = 'M';
   4.319 +	mpfps->signature[2] = 'P';
   4.320 +	mpfps->signature[3] = '_';
   4.321 +
   4.322 +	mpfps->mp_table = mpct; 
   4.323 +	mpfps->length = 1;
   4.324 +	mpfps->revision = 4;
   4.325 +	mpfps->checksum = 0;
   4.326 +	for (i = 0; i < 5; ++i)
   4.327 +		mpfps->feature[i] = 0;
   4.328 +
   4.329 +	/* compute the checksum for our new table */
   4.330 +	checksum = 0;
   4.331 +	for (i = 0; i < sizeof(struct mp_floating_pointer_struct); ++i)
   4.332 +		checksum += ((uint8_t *)(mpfps))[i];
   4.333 +	mpfps->checksum = -checksum;
   4.334 +}
   4.335 +
   4.336 +
   4.337 +/*
   4.338 + * find_mp_table_start - searchs through BIOS memory for '___HVMMP' signature
   4.339 + *
   4.340 + * The '___HVMMP' signature is created by the ROMBIOS and designates a chunk
   4.341 + * of space inside the ROMBIOS that is safe for us to write our MP table info
   4.342 + */
   4.343 +void* get_mp_table_start(void)
   4.344 +{
   4.345 +	char *bios_mem;
   4.346 +	for (bios_mem = (char *)ROMBIOS_BEGIN; 
   4.347 +	     bios_mem != (char *)ROMBIOS_END; 
   4.348 +	     ++bios_mem)
   4.349 +		if (bios_mem[0] == '_' && bios_mem[1] == '_' &&
   4.350 +		    bios_mem[2] == '_' && bios_mem[3] == 'H' &&
   4.351 +		    bios_mem[4] == 'V' && bios_mem[5] == 'M' &&
   4.352 +		    bios_mem[6] == 'M' && bios_mem[7] == 'P')
   4.353 +			return bios_mem;
   4.354 +
   4.355 +	return (void *)-1;
   4.356 +}
   4.357 +
   4.358 +
   4.359 +/* recalculate the new ROMBIOS checksum after adding MP tables */
   4.360 +void reset_bios_checksum(void)
   4.361 +{
   4.362 +	uint32_t i;
   4.363 +	uint8_t checksum;
   4.364 +
   4.365 +	checksum = 0;
   4.366 +	for (i = 0; i < ROMBIOS_MAXOFFSET; ++i)
   4.367 +		checksum += ((uint8_t *)(ROMBIOS_BEGIN))[i];
   4.368 +	
   4.369 +	*((uint8_t *)(ROMBIOS_BEGIN + ROMBIOS_MAXOFFSET)) = -checksum;
   4.370 +}
   4.371 +
   4.372 +
   4.373 +/* create_mp_tables - creates MP tables for the guest based upon config data */
   4.374 +void create_mp_tables(void)
   4.375 +{
   4.376 +	void *mp_table_base;
   4.377 +	char *p;
   4.378 +	struct mp_config_table *mp_config_table;
   4.379 +	int vcpu_nr;
   4.380 +	int i;
   4.381 +
   4.382 +	vcpu_nr = get_vcpu_nr();
   4.383 +	
   4.384 +	puts("Creating MP tables ...\n");
   4.385 +
   4.386 +	/* find the 'safe' place in ROMBIOS for the MP tables */
   4.387 +	mp_table_base = get_mp_table_start();
   4.388 +	if (mp_table_base == (void *)-1) {
   4.389 +		puts("Couldn't find start point for MP tables\n");
   4.390 +		return;
   4.391 +	}
   4.392 +	p = mp_table_base;
   4.393 +
   4.394 +	fill_mp_config_table((struct mp_config_table *)p);
   4.395 +
   4.396 + 	/* save the location of the MP config table for a little later*/
   4.397 +	mp_config_table = (struct mp_config_table *)p;
   4.398 +	p += sizeof(struct mp_config_table);
   4.399 +
   4.400 +	for (i = 0; i < vcpu_nr; ++i) {
   4.401 +		fill_mp_proc_entry((struct mp_proc_entry *)p, i);
   4.402 +		p += sizeof(struct mp_proc_entry);
   4.403 +	}
   4.404 +
   4.405 +	fill_mp_bus_entry((struct mp_bus_entry *)p, 0, BUS_TYPE_STR_ISA);
   4.406 +	p += sizeof(struct mp_bus_entry);
   4.407 +
   4.408 +	fill_mp_ioapic_entry((struct mp_ioapic_entry *)p, vcpu_nr);
   4.409 +	p += sizeof(struct mp_ioapic_entry);
   4.410 +
   4.411 +	for (i = 0; i < INTR_MAX_NR; ++i) {
   4.412 +		fill_mp_io_intr_entry((struct mp_io_intr_entry *)p, 
   4.413 +				i, vcpu_nr, i);
   4.414 +		p += sizeof(struct mp_io_intr_entry);
   4.415 +	}
   4.416 +
   4.417 +	/* find the next 16-byte boundary to place the mp floating pointer */
   4.418 +	while ((unsigned long)p & 0xF)
   4.419 +		++p;
   4.420 +	
   4.421 +	fill_mpfps((struct mp_floating_pointer_struct *)p, 
   4.422 +			(uint32_t)mp_table_base);
   4.423 +
   4.424 +	/* calculate the MP configuration table's checksum */
   4.425 +	fill_mp_config_table_checksum(mp_config_table);
   4.426 +
   4.427 +	/* finally, recalculate the ROMBIOS checksum */
   4.428 +	reset_bios_checksum();
   4.429 +}
     5.1 --- a/tools/firmware/rombios/Makefile	Wed Jun 28 13:35:22 2006 +0100
     5.2 +++ b/tools/firmware/rombios/Makefile	Wed Jun 28 13:59:29 2006 +0100
     5.3 @@ -1,13 +1,9 @@
     5.4 -BIOS_BUILDS = BIOS-bochs-latest
     5.5 -#BIOS_BUILDS += BIOS-bochs-2-processors
     5.6 -#BIOS_BUILDS += BIOS-bochs-4-processors
     5.7 -#BIOS_BUILDS += BIOS-bochs-8-processors
     5.8  
     5.9  .PHONY: all
    5.10  all: bios
    5.11  
    5.12  .PHONY: bios
    5.13 -bios: biossums ${BIOS_BUILDS}
    5.14 +bios: biossums BIOS-bochs-latest
    5.15  
    5.16  .PHONY: clean
    5.17  clean:
    5.18 @@ -26,36 +22,6 @@ BIOS-bochs-latest: rombios.c biossums
    5.19  	./biossums BIOS-bochs-latest
    5.20  	rm -f _rombios_.s
    5.21  
    5.22 -BIOS-bochs-2-processors: rombios.c biossums
    5.23 -	gcc -DBX_SMP_PROCESSORS=2 -E -P $< > _rombios2_.c
    5.24 -	bcc -o rombios2.s -C-c -D__i86__ -0 -S _rombios2_.c
    5.25 -	sed -e 's/^\.text//' -e 's/^\.data//' rombios2.s > _rombios2_.s
    5.26 -	as86 _rombios2_.s -b tmp2.bin -u- -w- -g -0 -j -O -l rombios2.txt
    5.27 -	-perl makesym.perl < rombios2.txt > rombios2.sym
    5.28 -	mv tmp2.bin BIOS-bochs-2-processors
    5.29 -	./biossums BIOS-bochs-2-processors
    5.30 -	rm -f _rombios2_.s
    5.31 -
    5.32 -BIOS-bochs-4-processors: rombios.c biossums
    5.33 -	gcc -DBX_SMP_PROCESSORS=4 -E -P $< > _rombios4_.c
    5.34 -	bcc -o rombios4.s -C-c -D__i86__ -0 -S _rombios4_.c
    5.35 -	sed -e 's/^\.text//' -e 's/^\.data//' rombios4.s > _rombios4_.s
    5.36 -	as86 _rombios4_.s -b tmp4.bin -u- -w- -g -0 -j -O -l rombios4.txt
    5.37 -	-perl makesym.perl < rombios4.txt > rombios4.sym
    5.38 -	mv tmp4.bin BIOS-bochs-4-processors
    5.39 -	./biossums BIOS-bochs-4-processors
    5.40 -	rm -f _rombios4_.s
    5.41 -
    5.42 -BIOS-bochs-8-processors: rombios.c biossums
    5.43 -	gcc -DBX_SMP_PROCESSORS=8 -E -P $< > _rombios8_.c
    5.44 -	bcc -o rombios8.s -C-c -D__i86__ -0 -S _rombios8_.c
    5.45 -	sed -e 's/^\.text//' -e 's/^\.data//' rombios8.s > _rombios8_.s
    5.46 -	as86 _rombios8_.s -b tmp8.bin -u- -w- -g -0 -j -O -l rombios8.txt
    5.47 -	-perl makesym.perl < rombios8.txt > rombios8.sym
    5.48 -	mv tmp8.bin BIOS-bochs-8-processors
    5.49 -	./biossums BIOS-bochs-8-processors
    5.50 -	rm -f _rombios8_.s
    5.51 -
    5.52  biossums: biossums.c
    5.53  	gcc -o biossums biossums.c
    5.54  
     6.1 --- a/tools/firmware/rombios/rombios.c	Wed Jun 28 13:35:22 2006 +0100
     6.2 +++ b/tools/firmware/rombios/rombios.c	Wed Jun 28 13:59:29 2006 +0100
     6.3 @@ -10514,6 +10514,34 @@ static Bit8u vgafont8[128*8]=
     6.4   0x00, 0x10, 0x38, 0x6c, 0xc6, 0xc6, 0xfe, 0x00,
     6.5  };
     6.6  
     6.7 +#ifdef HVMASSIST
     6.8 +//
     6.9 +// MP Tables
    6.10 +// just carve out some blank space for HVMLOADER to write the MP tables to
    6.11 +//
    6.12 +// NOTE: There should be enough space for a 32 processor entry MP table
    6.13 +//
    6.14 +ASM_START
    6.15 +.org 0xcc00
    6.16 +db 0x5F, 0x5F, 0x5F, 0x48, 0x56, 0x4D, 0x4D, 0x50 ;; ___HVMMP
    6.17 +dw 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ;;  64 bytes
    6.18 +dw 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ;; 128 bytes
    6.19 +dw 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ;; 192 bytes
    6.20 +dw 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ;; 256 bytes
    6.21 +dw 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ;; 320 bytes
    6.22 +dw 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ;; 384 bytes
    6.23 +dw 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ;; 448 bytes
    6.24 +dw 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ;; 512 bytes
    6.25 +dw 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ;; 576 bytes
    6.26 +dw 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ;; 640 bytes
    6.27 +dw 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ;; 704 bytes
    6.28 +dw 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ;; 768 bytes
    6.29 +dw 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ;; 832 bytes
    6.30 +dw 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ;; 896 bytes
    6.31 +ASM_END
    6.32 +
    6.33 +#else // !HVMASSIST
    6.34 +
    6.35  ASM_START
    6.36  .org 0xcc00
    6.37  // bcc-generated data will be placed here
    6.38 @@ -10835,3 +10863,5 @@ db 0,0,0,0     ;; MP feature bytes 2-5.
    6.39  #endif
    6.40  
    6.41  ASM_END
    6.42 +
    6.43 +#endif // HVMASSIST