From patchwork Sun Jun 15 00:42:31 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lv Zheng X-Patchwork-Id: 4353881 Return-Path: X-Original-To: patchwork-linux-acpi@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id EB7E7BEEAA for ; Sun, 15 Jun 2014 00:43:17 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 2C7572027D for ; Sun, 15 Jun 2014 00:43:17 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 4670B2025A for ; Sun, 15 Jun 2014 00:43:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752170AbaFOAmm (ORCPT ); Sat, 14 Jun 2014 20:42:42 -0400 Received: from mail-pb0-f47.google.com ([209.85.160.47]:39370 "EHLO mail-pb0-f47.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751844AbaFOAml (ORCPT ); Sat, 14 Jun 2014 20:42:41 -0400 Received: by mail-pb0-f47.google.com with SMTP id up15so274688pbc.34 for ; Sat, 14 Jun 2014 17:42:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=HPcOFsKpA5IeDAYa0SCsMqbtcdi2BxOWna/6VJW0Y88=; b=PSo1upVjk8vdeXiwDjQ7gcJVfjU/HT9SVAr6slMV0O5nTiCcohrvwkfw1XIRpC+tQF wh+J962OFactMVM571ymGMnzlTEjyTbFbs8pwj/c4uQLW3KO9QtSyPBEGkTQWDZlIzoZ OawAAe81k8p3eHJS9YjK5KOqDDKhc1zAZ1KAlWJEVQ16SJFcQIcczsvjEA3MLQcqV809 XRw1yfQ2S/kXLx3BVSqeBH3azjo33xMVjQlwCfjABzFycRQVdktnJ2mBoxIYTxU+JM28 Q5k8f6OZLDKlOGk0NHNUH5GBXVjw4L19yrcbE6vFhGwOHb4TnTW9YmFHU1gINy24X+yO zLNQ== X-Received: by 10.68.213.97 with SMTP id nr1mr13636307pbc.52.1402792961128; Sat, 14 Jun 2014 17:42:41 -0700 (PDT) Received: from localhost.localdomain ([180.169.136.70]) by mx.google.com with ESMTPSA id uv5sm12128pbc.52.2014.06.14.17.42.37 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 14 Jun 2014 17:42:40 -0700 (PDT) From: Lv Zheng To: "Rafael J. Wysocki" , Len Brown Cc: Lv Zheng , Lv Zheng , , linux-acpi@vger.kernel.org Subject: [PATCH v2 6/7] ACPICA: Events: Fix edge-triggered GPE by disabling before acknowledging it. Date: Sun, 15 Jun 2014 08:42:31 +0800 Message-Id: <64e7447735a1ddb0fa9d5f86e92f8bb049448da8.1402792240.git.lv.zheng@intel.com> X-Mailer: git-send-email 1.7.10 In-Reply-To: References: Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Lv Zheng Due to ACPI specificiation 5, chapter 5.6.4 General-Purpose Event Hnadling, OSPMs need to disable GPE before clearing the status bit for edge-triggered GPEs. Signed-off-by: Lv Zheng Tested-by: Gareth Williams Tested-by: Steffen Weber --- drivers/acpi/acpica/evgpe.c | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/drivers/acpi/acpica/evgpe.c b/drivers/acpi/acpica/evgpe.c index 48f7001..e4ba4de 100644 --- a/drivers/acpi/acpica/evgpe.c +++ b/drivers/acpi/acpica/evgpe.c @@ -698,21 +698,6 @@ acpi_ev_gpe_dispatch(struct acpi_namespace_node *gpe_device, } /* - * If edge-triggered, clear the GPE status bit now. Note that - * level-triggered events are cleared after the GPE is serviced. - */ - if ((gpe_event_info->flags & ACPI_GPE_XRUPT_TYPE_MASK) == - ACPI_GPE_EDGE_TRIGGERED) { - status = acpi_hw_clear_gpe(gpe_event_info); - if (ACPI_FAILURE(status)) { - ACPI_EXCEPTION((AE_INFO, status, - "Unable to clear GPE %02X", - gpe_number)); - return_UINT32(ACPI_INTERRUPT_NOT_HANDLED); - } - } - - /* * Always disable the GPE so that it does not keep firing before * any asynchronous activity completes (either from the execution * of a GPE method or an asynchronous GPE handler.) @@ -729,6 +714,23 @@ acpi_ev_gpe_dispatch(struct acpi_namespace_node *gpe_device, } /* + * If edge-triggered, clear the GPE status bit now. Note that + * level-triggered events are cleared after the GPE is serviced. + */ + if ((gpe_event_info->flags & ACPI_GPE_XRUPT_TYPE_MASK) == + ACPI_GPE_EDGE_TRIGGERED) { + status = acpi_hw_clear_gpe(gpe_event_info); + if (ACPI_FAILURE(status)) { + ACPI_EXCEPTION((AE_INFO, status, + "Unable to clear GPE %02X", + gpe_number)); + (void)acpi_hw_low_set_gpe(gpe_event_info, + ACPI_GPE_CONDITIONAL_ENABLE); + return_UINT32(ACPI_INTERRUPT_NOT_HANDLED); + } + } + + /* * Dispatch the GPE to either an installed handler or the control * method associated with this GPE (_Lxx or _Exx). If a handler * exists, we invoke it and do not attempt to run the method.