From patchwork Tue Dec 22 16:54:52 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 560220 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 9792814032B for ; Wed, 23 Dec 2015 04:20:33 +1100 (AEDT) Received: from localhost ([::1]:51976 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aBQbv-0002EN-Ff for incoming@patchwork.ozlabs.org; Tue, 22 Dec 2015 12:20:31 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34167) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aBQDA-0000UL-TN for qemu-devel@nongnu.org; Tue, 22 Dec 2015 11:54:57 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aBQDA-00017q-0t for qemu-devel@nongnu.org; Tue, 22 Dec 2015 11:54:56 -0500 Received: from mx1.redhat.com ([209.132.183.28]:52346) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aBQD9-00017c-P7 for qemu-devel@nongnu.org; Tue, 22 Dec 2015 11:54:55 -0500 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) by mx1.redhat.com (Postfix) with ESMTPS id 5BAEC219D; Tue, 22 Dec 2015 16:54:55 +0000 (UTC) Received: from redhat.com (vpn1-5-205.ams2.redhat.com [10.36.5.205]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with SMTP id tBMGsrcV030046; Tue, 22 Dec 2015 11:54:53 -0500 Date: Tue, 22 Dec 2015 18:54:52 +0200 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Message-ID: <1450803119-4223-48-git-send-email-mst@redhat.com> References: <1450803119-4223-1-git-send-email-mst@redhat.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <1450803119-4223-1-git-send-email-mst@redhat.com> X-Mutt-Fcc: =sent X-Scanned-By: MIMEDefang 2.68 on 10.5.11.26 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: Marcel Apfelbaum , Peter Maydell , Igor Mammedov Subject: [Qemu-devel] [PULL 47/55] acpi: add aml_sleep() X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Igor Mammedov Signed-off-by: Igor Mammedov Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin Reviewed-by: Marcel Apfelbaum --- include/hw/acpi/aml-build.h | 1 + hw/acpi/aml-build.c | 10 ++++++++++ 2 files changed, 11 insertions(+) diff --git a/include/hw/acpi/aml-build.h b/include/hw/acpi/aml-build.h index d9ec6d6..3525fe9 100644 --- a/include/hw/acpi/aml-build.h +++ b/include/hw/acpi/aml-build.h @@ -296,6 +296,7 @@ Aml *aml_qword_memory(AmlDecode dec, AmlMinFixed min_fixed, uint64_t addr_gran, uint64_t addr_min, uint64_t addr_max, uint64_t addr_trans, uint64_t len); +Aml *aml_sleep(uint64_t msec); /* Block AML object primitives */ Aml *aml_scope(const char *name_format, ...) GCC_FMT_ATTR(1, 2); diff --git a/hw/acpi/aml-build.c b/hw/acpi/aml-build.c index 210588a..1d49c19 100644 --- a/hw/acpi/aml-build.c +++ b/hw/acpi/aml-build.c @@ -1228,6 +1228,16 @@ Aml *aml_qword_memory(AmlDecode dec, AmlMinFixed min_fixed, addr_trans, len, flags); } +/* ACPI 1.0b: 16.2.5.3 Type 1 Opcodes Encoding: DefSleep */ +Aml *aml_sleep(uint64_t msec) +{ + Aml *var = aml_alloc(); + build_append_byte(var->buf, 0x5B); /* ExtOpPrefix */ + build_append_byte(var->buf, 0x22); /* SleepOp */ + aml_append(var, aml_int(msec)); + return var; +} + static uint8_t Hex2Byte(const char *src) { int hi, lo;