From patchwork Tue Feb 18 13:54:58 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hanjun Guo X-Patchwork-Id: 24848 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-yh0-f71.google.com (mail-yh0-f71.google.com [209.85.213.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id F318A202B2 for ; Tue, 18 Feb 2014 13:56:21 +0000 (UTC) Received: by mail-yh0-f71.google.com with SMTP id z6sf35356551yhz.6 for ; Tue, 18 Feb 2014 05:56:20 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe; bh=5wXtgqGtdTjGlFT/+7lGAu5azawXiFWdJtp1jlfIfFY=; b=QftOnrAneq6TwvS5oUDdyyRRa1zdhlOC1Yt9XlpF7Aeb0mkZiEvVkOovvnqDsUXxk9 E28pjhMzQQiXOQ1MYlJDhdm9XWsuZnvd7NXSAyOWfRBjWjkHn3ax6+u6J5fYoSzTo/SP asHPwtMwlQoFjfnsMbBS3x5jzqsaVCTn8kv5nFAJCZBQXKW/XY+Owr9BgLdExTfT4BZY SCe6pt26Y07N+rM0GdYKdn9coG7V9C+pRGHcvQyhtcSYrDU/Cc8mvWCTSzv6QHBVMpKK emhbhzg5DiLgnOAdCM7YRDtfW7LxI9qAFikWts2ITED5u8+qDMBcWQCQTVpmSeIJ2tep hiIQ== X-Gm-Message-State: ALoCoQlwuaeCSw04YQe9QOtl8pCSgeoNbNuVI2w2DMiduHpuOtB5gZMxpK53VzhtLZIw9gs4cEjE X-Received: by 10.236.184.165 with SMTP id s25mr11413506yhm.0.1392731780894; Tue, 18 Feb 2014 05:56:20 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.93.71 with SMTP id c65ls1241668qge.4.gmail; Tue, 18 Feb 2014 05:56:20 -0800 (PST) X-Received: by 10.221.2.138 with SMTP id nu10mr305058vcb.52.1392731780826; Tue, 18 Feb 2014 05:56:20 -0800 (PST) Received: from mail-ve0-f174.google.com (mail-ve0-f174.google.com [209.85.128.174]) by mx.google.com with ESMTPS id we7si5527284vcb.7.2014.02.18.05.56.20 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 18 Feb 2014 05:56:20 -0800 (PST) Received-SPF: neutral (google.com: 209.85.128.174 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.128.174; Received: by mail-ve0-f174.google.com with SMTP id pa12so13213604veb.5 for ; Tue, 18 Feb 2014 05:56:20 -0800 (PST) X-Received: by 10.221.2.138 with SMTP id nu10mr305054vcb.52.1392731780727; Tue, 18 Feb 2014 05:56:20 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.220.174.196 with SMTP id u4csp218197vcz; Tue, 18 Feb 2014 05:56:20 -0800 (PST) X-Received: by 10.69.0.39 with SMTP id av7mr33144266pbd.4.1392731780005; Tue, 18 Feb 2014 05:56:20 -0800 (PST) Received: from mail-pd0-f176.google.com (mail-pd0-f176.google.com [209.85.192.176]) by mx.google.com with ESMTPS id ot3si18391554pac.340.2014.02.18.05.56.19 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 18 Feb 2014 05:56:19 -0800 (PST) Received-SPF: neutral (google.com: 209.85.192.176 is neither permitted nor denied by best guess record for domain of hanjun.guo@linaro.org) client-ip=209.85.192.176; Received: by mail-pd0-f176.google.com with SMTP id w10so16216782pde.7 for ; Tue, 18 Feb 2014 05:56:19 -0800 (PST) X-Received: by 10.68.237.228 with SMTP id vf4mr33295192pbc.131.1392731779479; Tue, 18 Feb 2014 05:56:19 -0800 (PST) Received: from localhost ([39.181.46.96]) by mx.google.com with ESMTPSA id cz3sm56233588pbc.9.2014.02.18.05.56.16 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Tue, 18 Feb 2014 05:56:19 -0800 (PST) From: Hanjun Guo To: "Rafael J. Wysocki" Cc: Lan Tianyu , linux-acpi@vger.kernel.org, linux-arm-kernel@lists.infradead.org, patches@linaro.org, linux-kernel@vger.kernel.org, linaro-acpi@lists.linaro.org, Hanjun Guo Subject: [PATCH v4 3/5] ACPI / processor: Introduce map_gic_id() to get apic id from MADT or _MAT method Date: Tue, 18 Feb 2014 21:54:58 +0800 Message-Id: <1392731700-10992-4-git-send-email-hanjun.guo@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1392731700-10992-1-git-send-email-hanjun.guo@linaro.org> References: <1392731700-10992-1-git-send-email-hanjun.guo@linaro.org> X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: hanjun.guo@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.128.174 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , 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 5bbc255..09fde83 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: