From patchwork Fri Jan 17 02:03:27 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hanjun Guo X-Patchwork-Id: 3501641 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 552DA9F169 for ; Fri, 17 Jan 2014 02:08:05 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 838D120142 for ; Fri, 17 Jan 2014 02:08:04 +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 951C520122 for ; Fri, 17 Jan 2014 02:08:03 +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 1W3yqm-00067s-54; Fri, 17 Jan 2014 02:08:00 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1W3yqj-0004zn-Jj; Fri, 17 Jan 2014 02:07:57 +0000 Received: from mail-pb0-f43.google.com ([209.85.160.43]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1W3yqg-0004yw-Kb for linux-arm-kernel@lists.infradead.org; Fri, 17 Jan 2014 02:07:55 +0000 Received: by mail-pb0-f43.google.com with SMTP id md12so3468345pbc.30 for ; Thu, 16 Jan 2014 18:07:33 -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=RGqbLtgwos0R8ENKRqG3WjEP9igwU2nPCZBY3iybCcQ=; b=DezdTnl9sOCPGNeFdRuk6TS6QzzAR00rekOwBxZNxgiFPTwGZD2EiLPg8At5fJM0FO oW96QZljCcWSjEBurFFI2dXuSZd+DDBWkqdR1fgvIzM5jwjgtR2+Lwn+VEBQYvTV7+ZB 7TiVqfHM+wUwcoA5HjQ0qfzexFJkbt0rVCjWoSj1u61cPFacj8GQEZ7uWp8AKyTVB9o9 D58YL3b8H8mpyCAGg3wRybZNoXlUd7MAoeR8988DI4spTeMAGAuYgEf8vljL5iT8bKaO HRUu4breCPtspA+Q3j9Qd8odnuCoXvNjoP69IFsNPlJpbu4Ui9vLXj1GU+bYlI8uJ9G7 FCtA== X-Gm-Message-State: ALoCoQlePlo2JxWGQLd8jbBgWR9305v3aB0H2ql0FK2B9hgKF38UKuarHLPsWkpiA0GktOtz6MNN X-Received: by 10.68.130.169 with SMTP id of9mr13741103pbb.79.1389924453182; Thu, 16 Jan 2014 18:07:33 -0800 (PST) Received: from localhost ([218.17.215.175]) by mx.google.com with ESMTPSA id vg1sm18333768pbc.44.2014.01.16.18.07.06 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Thu, 16 Jan 2014 18:07:32 -0800 (PST) From: Hanjun Guo To: "Rafael J. Wysocki" , Catalin Marinas , Will Deacon , Russell King - ARM Linux , Daniel Lezcano Subject: [PATCH 3/3] ACPI: Introduce map_gic_id() to get apic id from MADT or _MAT method Date: Fri, 17 Jan 2014 10:03:27 +0800 Message-Id: <1389924207-7360-4-git-send-email-hanjun.guo@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1389924207-7360-1-git-send-email-hanjun.guo@linaro.org> References: <1389924207-7360-1-git-send-email-hanjun.guo@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140116_210754_742752_AF1A4C44 X-CRM114-Status: GOOD ( 16.15 ) X-Spam-Score: -1.8 (-) Cc: Mark Rutland , Matthew Garrett , linaro-kernel@lists.linaro.org, patches@linaro.org, Linus Walleij , Olof Johansson , linux-kernel@vger.kernel.org, Rob Herring , linaro-acpi@lists.linaro.org, linux-acpi@vger.kernel.org, Jon Masters , Grant Likely , Bjorn Helgaas , linux-arm-kernel@lists.infradead.org, Hanjun Guo 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=-3.8 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 cd7b5fe..165eac7 100644 --- a/drivers/acpi/processor_core.c +++ b/drivers/acpi/processor_core.c @@ -90,6 +90,27 @@ static int map_lsapic_id(struct acpi_subtable_header *entry, return 1; } +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 0; + + /* 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 1; + } + + return 0; +} + static int map_madt_entry(int type, u32 acpi_id) { unsigned long madt_end, entry; @@ -125,6 +146,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; } @@ -155,6 +179,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: