From patchwork Mon Feb 10 07:49:02 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hanjun Guo X-Patchwork-Id: 3616161 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id B90A99F2F6 for ; Mon, 10 Feb 2014 07:52:25 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 0040420176 for ; Mon, 10 Feb 2014 07:52:25 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id D886620138 for ; Mon, 10 Feb 2014 07:52:23 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1WCle5-0002nA-7G; Mon, 10 Feb 2014 07:51:13 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1WCldf-0001xf-DV; Mon, 10 Feb 2014 07:50:47 +0000 Received: from mail-pb0-f44.google.com ([209.85.160.44]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1WCldd-0001wB-2x for linux-arm-kernel@lists.infradead.org; Mon, 10 Feb 2014 07:50:45 +0000 Received: by mail-pb0-f44.google.com with SMTP id rq2so5906851pbb.17 for ; Sun, 09 Feb 2014 23:50:23 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=QTFM5AtTnXRoX5Jv5Zs3uyvRn4keOQA9JK1pPTPIiLw=; b=IfD/SHcUGQ4TtU8G7MFlFTfdFH1H7vOAbPhFa5bfgbfCtcSZSLvw123ijxnlg23PCm PXQqiIj9P4h+Thzy0afdv6c6qmQK9VbGjrUAF7YDV/3/M8Xk42HEcngQ0uMcQ0rrAfeX HyZWvURfYz8ur9iNvmBYQ3iRIcjvJCwomOXf+A1it3CQZHymG2DCZeTpCq0+atJHbYWu 6nKsgLdvpX7viR5w3LKGTT9adB3+mm6/F1SskCDMfbFw6SQA2Zdx7EWeEWfQgLMbvudc ljphYvZQ1ID7vcVelelFU6KhBTvqQyusLCTQiEAYGD0kM8ju/gnjWCEHFaa3TYgC3oWY zzmA== X-Gm-Message-State: ALoCoQn9Ww2kxxFbzksf+h/fZC4RlpiovzTx9E/2eW1XIFFkuiWodpGRHieviqa5vYBUulr/LIg6 X-Received: by 10.68.190.228 with SMTP id gt4mr36464734pbc.94.1392018623707; Sun, 09 Feb 2014 23:50:23 -0800 (PST) Received: from localhost ([218.17.215.175]) by mx.google.com with ESMTPSA id ac7sm15722382pad.12.2014.02.09.23.50.18 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Sun, 09 Feb 2014 23:50:23 -0800 (PST) From: Hanjun Guo To: "Rafael J. Wysocki" Subject: [PATCH v3 3/3] ACPI / processor: Introduce map_gic_id() to get apic id from MADT or _MAT method Date: Mon, 10 Feb 2014 15:49:02 +0800 Message-Id: <1392018542-10949-4-git-send-email-hanjun.guo@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1392018542-10949-1-git-send-email-hanjun.guo@linaro.org> References: <1392018542-10949-1-git-send-email-hanjun.guo@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140210_025045_209643_711774E7 X-CRM114-Status: GOOD ( 14.04 ) X-Spam-Score: -1.8 (-) Cc: Lan Tianyu , linaro-acpi@lists.linaro.org, patches@linaro.org, linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org, Hanjun Guo , linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.0 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RCVD_IN_SORBS_WEB, RP_MATCHES_RCVD, 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 Get apic id from MADT or _MAT method is not implemented on arm/arm64, and ACPI 5.0 introduces GIC Structure for it, so this patch introduces map_gic_id() to get apic id followed the ACPI 5.0 spec. Signed-off-by: Hanjun Guo --- drivers/acpi/processor_core.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/drivers/acpi/processor_core.c b/drivers/acpi/processor_core.c index 575c500..eaaeebc 100644 --- a/drivers/acpi/processor_core.c +++ b/drivers/acpi/processor_core.c @@ -71,6 +71,27 @@ static int map_lsapic_id(struct acpi_subtable_header *entry, return 0; } +static int map_gic_id(struct acpi_subtable_header *entry, + int device_declaration, u32 acpi_id, int *apic_id) +{ + struct acpi_madt_generic_interrupt *gic = + (struct acpi_madt_generic_interrupt *)entry; + + if (!(gic->flags & ACPI_MADT_ENABLED)) + return -ENODEV; + + /* In the GIC interrupt model, logical processors are + * required to have a Processor Device object in the DSDT, + * so we should check device_declaration here + */ + if (device_declaration && (gic->uid == acpi_id)) { + *apic_id = gic->gic_id; + return 0; + } + + return -EINVAL; +} + static int map_madt_entry(int type, u32 acpi_id) { unsigned long madt_end, entry; @@ -106,6 +127,9 @@ static int map_madt_entry(int type, u32 acpi_id) } else if (header->type == ACPI_MADT_TYPE_LOCAL_SAPIC) { if (!map_lsapic_id(header, type, acpi_id, &apic_id)) break; + } else if (header->type == ACPI_MADT_TYPE_GENERIC_INTERRUPT) { + if (!map_gic_id(header, type, acpi_id, &apic_id)) + break; } entry += header->length; } @@ -136,6 +160,8 @@ static int map_mat_entry(acpi_handle handle, int type, u32 acpi_id) map_lapic_id(header, acpi_id, &apic_id); } else if (header->type == ACPI_MADT_TYPE_LOCAL_SAPIC) { map_lsapic_id(header, type, acpi_id, &apic_id); + } else if (header->type == ACPI_MADT_TYPE_GENERIC_INTERRUPT) { + map_gic_id(header, type, acpi_id, &apic_id); } exit: