]> xenbits.xen.org Git - xenclient/xen.git/commitdiff
patch hvm_battery_management
authorVincent Hanquez <vincent@snarc.org>
Wed, 17 Dec 2008 17:32:01 +0000 (17:32 +0000)
committerVincent Hanquez <vincent@snarc.org>
Wed, 17 Dec 2008 17:32:01 +0000 (17:32 +0000)
tools/examples/xmexample.hvm
tools/firmware/hvmloader/acpi/Makefile
tools/python/xen/xend/XendConfig.py
tools/python/xen/xend/image.py

index aa014b529b935aa65b90c9ccd12edb2383082063..8764e3c068d8431572ca01693d25598d9ab8b95e 100644 (file)
@@ -61,6 +61,14 @@ name = "ExampleHVMDomain"
 #    but comparitively less efficient than pass-through mode)
 # xen_extended_power_mgmt=0
 
+# Enable/disable extended power management support within HVM guest, i.e., beyond
+# S3, S4, S5 within guest like exposing battery meter.
+# 0 (default option, extended power management support disabled)
+# 1 (pass-through mode; uses pass-through as needed; efficient but limited in scope)
+# 2 (non pass-through mode; extended scope, likely to work on all applicable environment
+#    but comparitively less efficient than pass-through mode)
+# xen_extended_power_mgmt=0
+
 # List of which CPUS this domain is allowed to use, default Xen picks
 #cpus = ""         # leave to Xen to pick
 #cpus = "0"        # all vcpus run on CPU0
index 47a7bea66cd1fcbb98e9b2acf7245182056f2fad..6eea094dddbb8a395ee3e2f6437b59d3cbfd02bd 100644 (file)
@@ -19,9 +19,11 @@ XEN_ROOT = ../../../..
 include $(XEN_ROOT)/tools/firmware/Rules.mk
 
 C_SRC = build.c dsdt.c static_tables.c
-H_SRC = $(wildcard *.h)
+H_SRC = $(wildcard *.h) ssdt_pm.h ssdt_tpm.h
 OBJS  = $(patsubst %.c,%.o,$(C_SRC))
 
+build.o: $(H_SRC) build.c
+
 IASL_VER = acpica-unix-20080729
 IASL_URL = http://acpica.org/download/$(IASL_VER).tar.gz
 
@@ -30,9 +32,17 @@ CFLAGS += -I. -I.. $(CFLAGS_include)
 vpath iasl $(PATH)
 all: acpi.a
 
-ssdt_pm.h ssdt_tpm.h: %.h: %.asl
+ssdt_pm.h: ssdt_pm.asl
+       $(MAKE) iasl
+       iasl -tc $<
+       sed -i'' -re 's/AmlCode/AmlCode_PM/g' $*.hex
+       mv $*.hex $@
+       rm -f *.aml
+
+ssdt_tpm.h: ssdt_tpm.asl
        $(MAKE) iasl
        iasl -tc $<
+       sed -i'' -re 's/AmlCode/AmlCode_TPM/g' $*.hex
        mv $*.hex $@
        rm -f *.aml
 
@@ -55,13 +65,13 @@ iasl:
        make -C $(IASL_VER)/compiler
        $(INSTALL_PROG) $(IASL_VER)/compiler/iasl $(DESTDIR)$(BINDIR)/iasl
 
+%.o: %.c
+       $(CC) $(CPPFLAGS) $(CFLAGS) -c -o $@ $<
+
 acpi.a: $(OBJS)
        $(AR) rc $@ $(OBJS)
 
-%.o: %.c $(H_SRC)
-       $(CC) $(CPPFLAGS) $(CFLAGS) -c -o $@ $<
-
 clean:
-       rm -rf *.a *.o $(IASL_VER) $(IASL_VER).tar.gz
+       rm -rf *.a *.o dsdt.c ssdt_pm.h ssdt_tpm.h $(IASL_VER) $(IASL_VER).tar.gz
 
 install: all
index a4fc927177e9f2c25cf438632d12041f8437bcee..86b15d5573d230b9003b8706284b79f1fb723af5 100644 (file)
@@ -169,6 +169,7 @@ XENAPI_PLATFORM_CFG_TYPES = {
     'xen_extended_power_mgmt': int,
     'vga_passthrough' : int,
     'dom0_input' : str,
+    'xen_extended_power_mgmt': int,
 }
 
 # Xen API console 'other_config' keys.
index adadef0a4df3d4b49616d0168760e7051e31e58f..15df0cefafd5b72e2db405afa101318d7cdc08b2 100644 (file)
@@ -250,6 +250,14 @@ class ImageHandler:
     def parseDeviceModelArgs(self, vmConfig):
         ret = ["-domain-name", str(self.vm.info['name_label'])]
 
+        xen_extended_power_mgmt = int(vmConfig['platform'].get(
+            'xen_extended_power_mgmt', 0))
+        if xen_extended_power_mgmt != 0:
+             xstransact.Store("/local/domain/0/device-model/%i"
+                              % self.vm.getDomid(),
+                              ('xen_extended_power_mgmt',
+                               xen_extended_power_mgmt))
+
         xen_extended_power_mgmt = int(vmConfig['platform'].get(
             'xen_extended_power_mgmt', 0))
         if xen_extended_power_mgmt != 0: