yeahuh / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone
9ae3a8
From 4731e5c2fd12e1faf421d63b715c538d43c1dddb Mon Sep 17 00:00:00 2001
9ae3a8
Message-Id: <4731e5c2fd12e1faf421d63b715c538d43c1dddb.1387298827.git.minovotn@redhat.com>
9ae3a8
In-Reply-To: <3ed0fb61a3dc912ef036d7ef450bed192090709e.1387298827.git.minovotn@redhat.com>
9ae3a8
References: <3ed0fb61a3dc912ef036d7ef450bed192090709e.1387298827.git.minovotn@redhat.com>
9ae3a8
From: "Michael S. Tsirkin" <mst@redhat.com>
9ae3a8
Date: Tue, 17 Dec 2013 15:18:15 +0100
9ae3a8
Subject: [PATCH 33/56] acpi: add rules to compile ASL source
9ae3a8
9ae3a8
RH-Author: Michael S. Tsirkin <mst@redhat.com>
9ae3a8
Message-id: <1387293161-4085-34-git-send-email-mst@redhat.com>
9ae3a8
Patchwork-id: 56339
9ae3a8
O-Subject: [PATCH qemu-kvm RHEL7.0 v2 33/57] acpi: add rules to compile ASL source
9ae3a8
Bugzilla: 1034876
9ae3a8
RH-Acked-by: Igor Mammedov <imammedo@redhat.com>
9ae3a8
RH-Acked-by: Marcel Apfelbaum <marcel.a@redhat.com>
9ae3a8
RH-Acked-by: Laszlo Ersek <lersek@redhat.com>
9ae3a8
9ae3a8
Detect presence of IASL compiler and use it
9ae3a8
to process ASL source. If not there, use pre-compiled
9ae3a8
files in-tree. Add script to update the in-tree files.
9ae3a8
9ae3a8
Note: distros are known to silently update iasl
9ae3a8
so detect correct iasl flags for the installed version on each run as
9ae3a8
opposed to at configure time.
9ae3a8
9ae3a8
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
9ae3a8
Reviewed-by: Gerd Hoffmann <kraxel@redhat.com>
9ae3a8
Tested-by: Gerd Hoffmann <kraxel@redhat.com>
9ae3a8
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
9ae3a8
Tested-by: Igor Mammedov <imammedo@redhat.com>
9ae3a8
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9ae3a8
(cherry picked from commit a31a864273bb501851a4d52a366c645d06a53991)
9ae3a8
9ae3a8
Conflicts:
9ae3a8
	configure
9ae3a8
---
9ae3a8
 configure              |  9 ++++++++-
9ae3a8
 hw/i386/Makefile.objs  | 22 ++++++++++++++++++++++
9ae3a8
 scripts/update-acpi.sh |  4 ++++
9ae3a8
 3 files changed, 34 insertions(+), 1 deletion(-)
9ae3a8
 create mode 100644 scripts/update-acpi.sh
9ae3a8
9ae3a8
Signed-off-by: Michal Novotny <minovotn@redhat.com>
9ae3a8
---
9ae3a8
 configure              |  9 ++++++++-
9ae3a8
 hw/i386/Makefile.objs  | 22 ++++++++++++++++++++++
9ae3a8
 scripts/update-acpi.sh |  4 ++++
9ae3a8
 3 files changed, 34 insertions(+), 1 deletion(-)
9ae3a8
 create mode 100644 scripts/update-acpi.sh
9ae3a8
9ae3a8
diff --git a/configure b/configure
9ae3a8
index 1af1079..f86793d 100755
9ae3a8
--- a/configure
9ae3a8
+++ b/configure
9ae3a8
@@ -119,6 +119,7 @@ path_of() {
9ae3a8
 # default parameters
9ae3a8
 source_path=`dirname "$0"`
9ae3a8
 cpu=""
9ae3a8
+iasl="iasl"
9ae3a8
 interp_prefix="/usr/gnemul/qemu-%M"
9ae3a8
 static="no"
9ae3a8
 cross_prefix=""
9ae3a8
@@ -252,6 +253,8 @@ for opt do
9ae3a8
   ;;
9ae3a8
   --cc=*) CC="$optarg"
9ae3a8
   ;;
9ae3a8
+  --iasl=*) iasl="$optarg"
9ae3a8
+  ;;
9ae3a8
   --source-path=*) source_path="$optarg"
9ae3a8
   ;;
9ae3a8
   --cpu=*) cpu="$optarg"
9ae3a8
@@ -1074,6 +1077,7 @@ echo "Advanced options (experts only):"
9ae3a8
 echo "  --source-path=PATH       path of source code [$source_path]"
9ae3a8
 echo "  --cross-prefix=PREFIX    use PREFIX for compile tools [$cross_prefix]"
9ae3a8
 echo "  --cc=CC                  use C compiler CC [$cc]"
9ae3a8
+echo "  --iasl=IASL              use ACPI compiler IASL [$iasl]"
9ae3a8
 echo "  --host-cc=CC             use C compiler CC [$host_cc] for code run at"
9ae3a8
 echo "                           build time"
9ae3a8
 echo "  --objcc=OBJCC            use Objective-C compiler OBJCC [$objcc]"
9ae3a8
@@ -4056,6 +4060,9 @@ else
9ae3a8
 fi
9ae3a8
 echo "PYTHON=$python" >> $config_host_mak
9ae3a8
 echo "CC=$cc" >> $config_host_mak
9ae3a8
+if $iasl -h > /dev/null 2>&1; then
9ae3a8
+  echo "IASL=$iasl" >> $config_host_mak
9ae3a8
+fi
9ae3a8
 echo "CC_I386=$cc_i386" >> $config_host_mak
9ae3a8
 echo "HOST_CC=$host_cc" >> $config_host_mak
9ae3a8
 echo "OBJCC=$objcc" >> $config_host_mak
9ae3a8
@@ -4544,7 +4551,7 @@ for rom in seabios vgabios ; do
9ae3a8
     echo "BCC=bcc" >> $config_mak
9ae3a8
     echo "CPP=$cpp" >> $config_mak
9ae3a8
     echo "OBJCOPY=objcopy" >> $config_mak
9ae3a8
-    echo "IASL=iasl" >> $config_mak
9ae3a8
+    echo "IASL=$iasl" >> $config_mak
9ae3a8
     echo "LD=$ld" >> $config_mak
9ae3a8
 done
9ae3a8
 
9ae3a8
diff --git a/hw/i386/Makefile.objs b/hw/i386/Makefile.objs
9ae3a8
index 205d22e..013d250 100644
9ae3a8
--- a/hw/i386/Makefile.objs
9ae3a8
+++ b/hw/i386/Makefile.objs
9ae3a8
@@ -4,3 +4,25 @@ obj-y += pc.o pc_piix.o pc_q35.o
9ae3a8
 obj-$(CONFIG_XEN) += xen_domainbuild.o xen_machine_pv.o
9ae3a8
 
9ae3a8
 obj-y += kvmvapic.o
9ae3a8
+
9ae3a8
+iasl-option=$(shell if test -z "`$(1) $(2) 2>&1 > /dev/null`" \
9ae3a8
+    ; then echo "$(2)"; else echo "$(3)"; fi ;)
9ae3a8
+
9ae3a8
+ifdef IASL
9ae3a8
+#IASL Present. Generate hex files from .dsl
9ae3a8
+hw/i386/%.hex: $(SRC_PATH)/hw/i386/%.dsl $(SRC_PATH)/scripts/acpi_extract_preprocess.py $(SRC_PATH)/scripts/acpi_extract.py
9ae3a8
+	$(call quiet-command, cpp -P $< -o $*.dsl.i.orig, "  CPP $(TARGET_DIR)$*.dsl.i.orig")
9ae3a8
+	$(call quiet-command, $(PYTHON) $(SRC_PATH)/scripts/acpi_extract_preprocess.py $*.dsl.i.orig > $*.dsl.i, "  ACPI_PREPROCESS $(TARGET_DIR)$*.dsl.i")
9ae3a8
+	$(call quiet-command, $(IASL) $(call iasl-option,$(IASL),-Pn,) -vs -l -tc -p $* $*.dsl.i $(if $(V), , > /dev/null) 2>&1 ,"  IASL $(TARGET_DIR)$*.dsl.i")
9ae3a8
+	$(call quiet-command, $(SRC_PATH)/scripts/acpi_extract.py $*.lst > $*.off, "  ACPI_EXTRACT $(TARGET_DIR)$*.off")
9ae3a8
+	$(call quiet-command, cat $*.off > $@, "  CAT $(TARGET_DIR)$@")
9ae3a8
+else
9ae3a8
+#IASL Not present. Restore pre-generated hex files.
9ae3a8
+hw/i386/%.hex: $(SRC_PATH)/hw/i386/%.hex.generated
9ae3a8
+	$(call quiet-command, cp -f $< $@, "  CP $(TARGET_DIR)$@")
9ae3a8
+endif
9ae3a8
+
9ae3a8
+.PHONY: cleanhex
9ae3a8
+cleanhex:
9ae3a8
+	rm -f hw/i386/*hex
9ae3a8
+clean: cleanhex
9ae3a8
diff --git a/scripts/update-acpi.sh b/scripts/update-acpi.sh
9ae3a8
new file mode 100644
9ae3a8
index 0000000..b5f05ff
9ae3a8
--- /dev/null
9ae3a8
+++ b/scripts/update-acpi.sh
9ae3a8
@@ -0,0 +1,4 @@
9ae3a8
+cd x86_64-softmmu
9ae3a8
+for file in hw/i386/*.hex; do
9ae3a8
+    cp -f $file ../$file.generated
9ae3a8
+done
9ae3a8
-- 
9ae3a8
1.7.11.7
9ae3a8