debuggers.hg

changeset 20981:27f5ff8c0aa0

hvmloader: Fix parallel build of ACPI tables.

Make build.c dependency on ssdt_{pm,tpm}.h explicit, else they can be
built in the wrong order.

Also, improve naming of target DSDT structures, and specify -p option
to iasl so that all generated files for a given target have
target-unique names, hence build can proceed safely in parallel.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
author Keir Fraser <keir.fraser@citrix.com>
date Fri Feb 12 09:16:10 2010 +0000 (2010-02-12)
parents 29797e6d5809
children a4ddf47a1e91
files tools/firmware/hvmloader/acpi/Makefile tools/firmware/hvmloader/acpi/build.c
line diff
     1.1 --- a/tools/firmware/hvmloader/acpi/Makefile	Fri Feb 12 09:14:16 2010 +0000
     1.2 +++ b/tools/firmware/hvmloader/acpi/Makefile	Fri Feb 12 09:16:10 2010 +0000
     1.3 @@ -18,7 +18,7 @@
     1.4  XEN_ROOT = ../../../..
     1.5  include $(XEN_ROOT)/tools/firmware/Rules.mk
     1.6  
     1.7 -C_SRC = build.c dsdt.c dsdt15.c static_tables.c
     1.8 +C_SRC = build.c dsdt_anycpu.c dsdt_15cpu.c static_tables.c
     1.9  OBJS  = $(patsubst %.c,%.o,$(C_SRC))
    1.10  
    1.11  CFLAGS += -I. -I.. $(CFLAGS_include)
    1.12 @@ -26,21 +26,19 @@ CFLAGS += -I. -I.. $(CFLAGS_include)
    1.13  vpath iasl $(PATH)
    1.14  all: acpi.a
    1.15  
    1.16 -ssdt_pm.h ssdt_tpm.h: %.h: %.asl
    1.17 -	$(MAKE) iasl
    1.18 -	iasl -tc $<
    1.19 +ssdt_pm.h ssdt_tpm.h: %.h: %.asl iasl
    1.20 +	iasl -p $* -tc $<
    1.21  	sed -e 's/AmlCode/$*/g' $*.hex >$@
    1.22 -	rm -f *.aml $*.hex
    1.23 +	rm -f $*.hex $*.aml
    1.24  
    1.25 -dsdt.c dsdt15.c: %.c: dsdt.asl mk_dsdt.c
    1.26 -	$(MAKE) iasl
    1.27 +dsdt_15cpu.c dsdt_anycpu.c: %.c: dsdt.asl mk_dsdt.c iasl
    1.28  	$(HOSTCC) $(HOSTCFLAGS) $(CFLAGS_include) -o mk_$* mk_dsdt.c
    1.29 -	head -n -1 $< >_$*.asl
    1.30 -	./mk_$* >>_$*.asl
    1.31 -	iasl -tc _$*.asl
    1.32 -	sed -e 's/AmlCode/_$*/g' _$*.hex >$@
    1.33 -	echo "int _$*_len=sizeof(_$*);" >>$@
    1.34 -	rm -f *.aml _dsdt* mk_$*
    1.35 +	head -n -1 $< >$*.asl
    1.36 +	./mk_$* >>$*.asl
    1.37 +	iasl -p $* -tc $*.asl
    1.38 +	sed -e 's/AmlCode/$*/g' $*.hex >$@
    1.39 +	echo "int $*_len=sizeof($*);" >>$@
    1.40 +	rm -f $*.hex $*.aml $*.asl mk_$*
    1.41  
    1.42  iasl:
    1.43  	@echo
    1.44 @@ -50,11 +48,14 @@ iasl:
    1.45  	@echo 
    1.46  	@exit 1
    1.47  
    1.48 +build.o: ssdt_pm.h ssdt_tpm.h
    1.49 +
    1.50  acpi.a: $(OBJS)
    1.51  	$(AR) rc $@ $(OBJS)
    1.52  
    1.53  clean:
    1.54  	rm -rf *.a *.o $(IASL_VER) $(IASL_VER).tar.gz $(DEPS)
    1.55 +	rm -rf ssdt_*.h dsdt*.c *~ *.aml *.hex mk_dsdt mk_dsdt15 dsdt_*cpu.asl
    1.56  
    1.57  install: all
    1.58  
     2.1 --- a/tools/firmware/hvmloader/acpi/build.c	Fri Feb 12 09:14:16 2010 +0000
     2.2 +++ b/tools/firmware/hvmloader/acpi/build.c	Fri Feb 12 09:16:10 2010 +0000
     2.3 @@ -42,8 +42,8 @@ extern struct acpi_20_facs Facs;
     2.4   * The latter is required for Windows 2000, which experiences a BSOD of
     2.5   * KMODE_EXCEPTION_NOT_HANDLED if it sees more than 15 processor objects.
     2.6   */
     2.7 -extern unsigned char _dsdt[], _dsdt15;
     2.8 -extern int _dsdt_len, _dsdt15_len;
     2.9 +extern unsigned char dsdt_anycpu[], dsdt_15cpu;
    2.10 +extern int dsdt_anycpu_len, dsdt_15cpu_len;
    2.11  
    2.12  /* Number of processor objects in the chosen DSDT. */
    2.13  static unsigned int nr_processor_objects;
    2.14 @@ -265,14 +265,14 @@ static void __acpi_build_tables(uint8_t 
    2.15      dsdt = (unsigned char *)&buf[offset];
    2.16      if ( hvm_info->nr_vcpus <= 15 )
    2.17      {
    2.18 -        memcpy(dsdt, &_dsdt15, _dsdt15_len);
    2.19 -        offset += align16(_dsdt15_len);
    2.20 +        memcpy(dsdt, &dsdt_15cpu, dsdt_15cpu_len);
    2.21 +        offset += align16(dsdt_15cpu_len);
    2.22          nr_processor_objects = 15;
    2.23      }
    2.24      else
    2.25      {
    2.26 -        memcpy(dsdt, &_dsdt, _dsdt_len);
    2.27 -        offset += align16(_dsdt_len);
    2.28 +        memcpy(dsdt, &dsdt_anycpu, dsdt_anycpu_len);
    2.29 +        offset += align16(dsdt_anycpu_len);
    2.30          nr_processor_objects = HVM_MAX_VCPUS;
    2.31      }
    2.32