From 4517e0da02487fa1137b3ae73d00fd0958f46d14 Mon Sep 17 00:00:00 2001 From: Vincent Hanquez Date: Wed, 17 Dec 2008 17:32:01 +0000 Subject: [PATCH] patch hvm_battery_management --- tools/examples/xmexample.hvm | 8 ++++++++ tools/firmware/hvmloader/acpi/Makefile | 22 ++++++++++++++++------ tools/python/xen/xend/XendConfig.py | 1 + tools/python/xen/xend/image.py | 8 ++++++++ 4 files changed, 33 insertions(+), 6 deletions(-) diff --git a/tools/examples/xmexample.hvm b/tools/examples/xmexample.hvm index aa014b5..8764e3c 100644 --- a/tools/examples/xmexample.hvm +++ b/tools/examples/xmexample.hvm @@ -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 diff --git a/tools/firmware/hvmloader/acpi/Makefile b/tools/firmware/hvmloader/acpi/Makefile index 47a7bea..6eea094 100644 --- a/tools/firmware/hvmloader/acpi/Makefile +++ b/tools/firmware/hvmloader/acpi/Makefile @@ -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 diff --git a/tools/python/xen/xend/XendConfig.py b/tools/python/xen/xend/XendConfig.py index a4fc927..86b15d5 100644 --- a/tools/python/xen/xend/XendConfig.py +++ b/tools/python/xen/xend/XendConfig.py @@ -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. diff --git a/tools/python/xen/xend/image.py b/tools/python/xen/xend/image.py index adadef0..15df0ce 100644 --- a/tools/python/xen/xend/image.py +++ b/tools/python/xen/xend/image.py @@ -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: -- 2.39.5