From patchwork Fri Jul 26 10:45:18 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shameerali Kolothum Thodi X-Patchwork-Id: 169802 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp12864256ilk; Fri, 26 Jul 2019 03:48:23 -0700 (PDT) X-Google-Smtp-Source: APXvYqwfR+4hbDXE2DB2BLPJ1/nxBWPIQVLUsgb3/iqxLOAIx1c+cCV0kaErR/snLbu/x4dw07+7 X-Received: by 2002:a50:ec0e:: with SMTP id g14mr42776492edr.210.1564138103351; Fri, 26 Jul 2019 03:48:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564138103; cv=none; d=google.com; s=arc-20160816; b=AbseadrKBuxgTOwZ4cP7M+/i7BZvUKUhs7Dz/ZY/kXA71OrcM0hp5d1CRzEa9jjNtb LCMy/ry4juBU8ApADCUnIJK38VLMDJVPnvs6Vsuw3DToDkPGXBtaIsrbg/uQ6dzzZlN6 VRS5FHvjgUNZl/Lk7u/t73BlmsF2R5WlNIPYLivqKdEMJ1J4pSdHga83mtYK8DSXe+TE qgiU6TuCQoSwJOmqqZMA7zATb2cZj5NLpUCUnBw5b3wK8xo/cVsCx5lq8IrxDGNBglyO 0UeVBsYD7i90w7I8EB9WMBDalBWWynWtNu5hi26tJnJnwM9B6URW+Nr8+9nMNPJl4Y/q H0BQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:mime-version:references :in-reply-to:message-id:date:to:from; bh=KYKHig3bT+0ct+qSXmJq7X0oyoeXzuw4p8rB5lfTPu4=; b=vXOhWWJ5w3OBzKPVTQrgAmjXxToaaaeHcPwrDcVIcmHfRc3BHJ3gN2vf75Cgolscrr Rwby9pjVck611sJnA5NcF6qF8M8hoUdpIw4nhDAKN8nL/vumCAP7P9NZOb5qvbLDrSks nq5/wJuzLu5xJ+MRNl9ooptqzOnXRrWy8b1iCmlLCjb6KL0cESIRtVfCed5uLPLh9RKv l+iLWI9qeaxBm8V5nSUAlbQrcCKL/hKHo8g4fhSk59zVIFxJYF24sI+4w2j6+HkRn8g2 niBveMSXOssOECRVMA5bxREJMVl9z35ji0x2d1dI8X2swmzjnbGkVSHNgEKPJmow9no8 M2KQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id sd23si10925924ejb.182.2019.07.26.03.48.23 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 26 Jul 2019 03:48:23 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Received: from localhost ([::1]:38298 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hqxlr-0002wu-0Z for patch@linaro.org; Fri, 26 Jul 2019 06:48:19 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43463) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hqxkm-0008U6-SH for qemu-devel@nongnu.org; Fri, 26 Jul 2019 06:47:14 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hqxkk-00078n-Lf for qemu-devel@nongnu.org; Fri, 26 Jul 2019 06:47:12 -0400 Received: from szxga07-in.huawei.com ([45.249.212.35]:37100 helo=huawei.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hqxkO-0006b4-Uc; Fri, 26 Jul 2019 06:46:53 -0400 Received: from DGGEMS406-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id 3F6F065647E06F766090; Fri, 26 Jul 2019 18:46:41 +0800 (CST) Received: from S00345302A-PC.china.huawei.com (10.202.227.237) by DGGEMS406-HUB.china.huawei.com (10.3.19.206) with Microsoft SMTP Server id 14.3.439.0; Fri, 26 Jul 2019 18:46:33 +0800 From: Shameer Kolothum To: , , , Date: Fri, 26 Jul 2019 11:45:18 +0100 Message-ID: <20190726104519.23812-9-shameerali.kolothum.thodi@huawei.com> X-Mailer: git-send-email 2.12.0.windows.1 In-Reply-To: <20190726104519.23812-1-shameerali.kolothum.thodi@huawei.com> References: <20190726104519.23812-1-shameerali.kolothum.thodi@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.202.227.237] X-CFilter-Loop: Reflected X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 45.249.212.35 Subject: [Qemu-devel] [PATCH-for-4.2 v8 8/9] hw/acpi: Add system power down support to GED X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, sameo@linux.intel.com, ard.biesheuvel@linaro.org, linuxarm@huawei.com, xuwei5@hisilicon.com, shannon.zhaosl@gmail.com, sebastien.boeuf@intel.com, lersek@redhat.com Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" This adds support to use GED for system power down event. Signed-off-by: Shameer Kolothum Reviewed-by: Eric Auger --- hw/acpi/generic_event_device.c | 6 ++++++ include/hw/acpi/generic_event_device.h | 3 +++ 2 files changed, 9 insertions(+) -- 2.17.1 diff --git a/hw/acpi/generic_event_device.c b/hw/acpi/generic_event_device.c index 7902e9d706..0b3214eff4 100644 --- a/hw/acpi/generic_event_device.c +++ b/hw/acpi/generic_event_device.c @@ -19,6 +19,7 @@ static const uint32_t ged_supported_events[] = { ACPI_GED_MEM_HOTPLUG_EVT, + ACPI_GED_PWR_DOWN_EVT, }; /* @@ -103,6 +104,11 @@ void build_ged_aml(Aml *table, const char *name, HotplugHandler *hotplug_dev, aml_append(if_ctx, aml_call0(MEMORY_DEVICES_CONTAINER "." MEMORY_SLOT_SCAN_METHOD)); break; + case ACPI_GED_PWR_DOWN_EVT: + aml_append(if_ctx, + aml_notify(aml_name(ACPI_POWER_BUTTON_DEVICE), + aml_int(0x80))); + break; default: /* * Please make sure all the events in ged_supported_events[] diff --git a/include/hw/acpi/generic_event_device.h b/include/hw/acpi/generic_event_device.h index f0152b0018..63104f1344 100644 --- a/include/hw/acpi/generic_event_device.h +++ b/include/hw/acpi/generic_event_device.h @@ -61,6 +61,8 @@ #include "hw/acpi/memory_hotplug.h" +#define ACPI_POWER_BUTTON_DEVICE "PWRB" + #define TYPE_ACPI_GED "acpi-ged" #define ACPI_GED(obj) \ OBJECT_CHECK(AcpiGedState, (obj), TYPE_ACPI_GED) @@ -78,6 +80,7 @@ * through GED. */ #define ACPI_GED_MEM_HOTPLUG_EVT 0x1 +#define ACPI_GED_PWR_DOWN_EVT 0x2 typedef struct GEDState { MemoryRegion io;