[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen-unstable] hvmloader: Build a compatibility DSDT with only 15 processor objects.
# HG changeset patch # User Keir Fraser <keir.fraser@xxxxxxxxxx> # Date 1265928138 0 # Node ID a259e779467c2c207175d20a76162b07937be553 # Parent 363bbf5115736d885b5574bf38af3efdbfaa3170 hvmloader: Build a compatibility DSDT with only 15 processor objects. Deploy this smaller DSDT where possible: this is required to boot Windows 2000, which only supports up to 15 processors and will blue screen if it sees more processor objects than that (even inactive ones). Signed-off-by: Keir Fraser <keir.fraser@xxxxxxxxxx> --- .hgignore | 2 +- tools/firmware/hvmloader/acpi/Makefile | 18 +++++++++--------- tools/firmware/hvmloader/acpi/build.c | 32 +++++++++++++++++++++++++++----- tools/firmware/hvmloader/acpi/mk_dsdt.c | 15 +++++++++------ 4 files changed, 46 insertions(+), 21 deletions(-) diff -r 363bbf511573 -r a259e779467c .hgignore --- a/.hgignore Thu Feb 11 21:49:47 2010 +0000 +++ b/.hgignore Thu Feb 11 22:42:18 2010 +0000 @@ -137,7 +137,7 @@ ^tools/firmware/etherboot/gpxe/.*$ ^tools/firmware/extboot/extboot.img$ ^tools/firmware/extboot/signrom$ -^tools/firmware/hvmloader/acpi/dsdt\.c$ +^tools/firmware/hvmloader/acpi/dsdt.*\.c$ ^tools/firmware/hvmloader/acpi/ssdt_.*\.h$ ^tools/firmware/hvmloader/hvmloader$ ^tools/firmware/hvmloader/roms\.h$ diff -r 363bbf511573 -r a259e779467c tools/firmware/hvmloader/acpi/Makefile --- a/tools/firmware/hvmloader/acpi/Makefile Thu Feb 11 21:49:47 2010 +0000 +++ b/tools/firmware/hvmloader/acpi/Makefile Thu Feb 11 22:42:18 2010 +0000 @@ -18,7 +18,7 @@ XEN_ROOT = ../../../.. XEN_ROOT = ../../../.. include $(XEN_ROOT)/tools/firmware/Rules.mk -C_SRC = build.c dsdt.c static_tables.c +C_SRC = build.c dsdt.c dsdt15.c static_tables.c OBJS = $(patsubst %.c,%.o,$(C_SRC)) CFLAGS += -I. -I.. $(CFLAGS_include) @@ -32,15 +32,15 @@ ssdt_pm.h ssdt_tpm.h: %.h: %.asl sed -e 's/AmlCode/$*/g' $*.hex >$@ rm -f *.aml $*.hex -dsdt.c: dsdt.asl mk_dsdt.c +dsdt.c dsdt15.c: %.c: dsdt.asl mk_dsdt.c $(MAKE) iasl - $(HOSTCC) $(HOSTCFLAGS) $(CFLAGS_include) -o mk_dsdt mk_dsdt.c - head -n -1 $< >_dsdt.asl - ./mk_dsdt >>_dsdt.asl - iasl -tc _dsdt.asl - sed -e 's/AmlCode/Dsdt/g' _dsdt.hex >dsdt.c - echo "int DsdtLen=sizeof(Dsdt);" >> dsdt.c - rm -f *.aml _dsdt.asl mk_dsdt _dsdt.hex + $(HOSTCC) $(HOSTCFLAGS) $(CFLAGS_include) -o mk_$* mk_dsdt.c + head -n -1 $< >_$*.asl + ./mk_$* >>_$*.asl + iasl -tc _$*.asl + sed -e 's/AmlCode/_$*/g' _$*.hex >$@ + echo "int _$*_len=sizeof(_$*);" >>$@ + rm -f *.aml _dsdt* mk_$* iasl: @echo diff -r 363bbf511573 -r a259e779467c tools/firmware/hvmloader/acpi/build.c --- a/tools/firmware/hvmloader/acpi/build.c Thu Feb 11 21:49:47 2010 +0000 +++ b/tools/firmware/hvmloader/acpi/build.c Thu Feb 11 22:42:18 2010 +0000 @@ -33,8 +33,20 @@ extern struct acpi_20_xsdt Xsdt; extern struct acpi_20_xsdt Xsdt; extern struct acpi_20_fadt Fadt; extern struct acpi_20_facs Facs; -extern unsigned char Dsdt[]; -extern int DsdtLen; + +/* + * Alternative DSDTs we get linked against. A cover-all DSDT for up to the + * implementation-defined maximum number of VCPUs, and an alternative for use + * when a guest can only have up to 15 VCPUs. + * + * The latter is required for Windows 2000, which experiences a BSOD of + * KMODE_EXCEPTION_NOT_HANDLED if it sees more than 15 processor objects. + */ +extern unsigned char _dsdt[], _dsdt15; +extern int _dsdt_len, _dsdt15_len; + +/* Number of processor objects in the chosen DSDT. */ +static unsigned int nr_processor_objects; static void set_checksum( void *table, uint32_t checksum_offset, uint32_t length) @@ -115,7 +127,7 @@ static int construct_madt(struct acpi_20 lapic = (struct acpi_20_madt_lapic *)(io_apic + 1); madt_lapic0_addr = (uint32_t)lapic; - for ( i = 0; i < HVM_MAX_VCPUS; i++ ) + for ( i = 0; i < nr_processor_objects; i++ ) { memset(lapic, 0, sizeof(*lapic)); lapic->type = ACPI_PROCESSOR_LOCAL_APIC; @@ -251,8 +263,18 @@ static void __acpi_build_tables(uint8_t offset += align16(sizeof(struct acpi_20_facs)); dsdt = (unsigned char *)&buf[offset]; - memcpy(dsdt, &Dsdt, DsdtLen); - offset += align16(DsdtLen); + if ( hvm_info->nr_vcpus <= 15 ) + { + memcpy(dsdt, &_dsdt15, _dsdt15_len); + offset += align16(_dsdt15_len); + nr_processor_objects = 15; + } + else + { + memcpy(dsdt, &_dsdt, _dsdt_len); + offset += align16(_dsdt_len); + nr_processor_objects = HVM_MAX_VCPUS; + } /* * N.B. ACPI 1.0 operating systems may not handle FADT with revision 2 diff -r 363bbf511573 -r a259e779467c tools/firmware/hvmloader/acpi/mk_dsdt.c --- a/tools/firmware/hvmloader/acpi/mk_dsdt.c Thu Feb 11 21:49:47 2010 +0000 +++ b/tools/firmware/hvmloader/acpi/mk_dsdt.c Thu Feb 11 22:42:18 2010 +0000 @@ -71,9 +71,12 @@ static void decision_tree( pop_block(); } -int main(void) -{ - unsigned int slot, dev, intx, link, cpu; +int main(int argc, char **argv) +{ + unsigned int slot, dev, intx, link, cpu, max_cpus = HVM_MAX_VCPUS; + + /* Extract optional maximum-cpu specification from invocation name. */ + sscanf(argv[0], "%*[^0-9]%u", &max_cpus); /* e.g., ./mk_dsdt15 */ /**** DSDT DefinitionBlock start ****/ /* (we append to existing DSDT definition block) */ @@ -89,7 +92,7 @@ int main(void) pop_block(); /* Define processor objects and control methods. */ - for ( cpu = 0; cpu < HVM_MAX_VCPUS; cpu++) + for ( cpu = 0; cpu < max_cpus; cpu++) { push_block("Processor", "PR%02X, %d, 0x0000b010, 0x06", cpu, cpu); @@ -131,13 +134,13 @@ int main(void) /* Operation Region 'PRST': bitmask of online CPUs. */ stmt("OperationRegion", "PRST, SystemIO, 0xaf00, 32"); push_block("Field", "PRST, ByteAcc, NoLock, Preserve"); - indent(); printf("PRS, %u\n", HVM_MAX_VCPUS); + indent(); printf("PRS, %u\n", max_cpus); pop_block(); /* Control method 'PRSC': CPU hotplug GPE handler. */ push_block("Method", "PRSC, 0"); stmt("Store", "PRS, Local0"); - for ( cpu = 0; cpu < HVM_MAX_VCPUS; cpu++ ) + for ( cpu = 0; cpu < max_cpus; cpu++ ) { /* Read a byte at a time from the PRST online-CPU bitmask. */ if ( (cpu & 7) == 0 ) _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |