From patchwork Tue Dec 3 16:39:07 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hanjun Guo X-Patchwork-Id: 21984 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ob0-f198.google.com (mail-ob0-f198.google.com [209.85.214.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 66707202AE for ; Tue, 3 Dec 2013 16:40:14 +0000 (UTC) Received: by mail-ob0-f198.google.com with SMTP id wo20sf46726465obc.9 for ; Tue, 03 Dec 2013 08:40:14 -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=EQFIW8sd83+0uqOT27LVT+jkIn4TETyBBsn81CDELDA=; b=ak9i0nvQM1t0GLxE3ivWq/oReS6BKTn6kh57/f5LO6rwRBTrS+UhsPBZux5KDbXLuF FiNMvCpjWyfUcJMV0Y/pNOVSCfAQRWRb4lG/bP758ueTcjm5IisOl2hx6bA43x2lWuul o3ZhUssPBBXUkq5nr+fk6UTaTYbAnJDo0xwTLH10miKyhhGtVkxt62rKqWPVJhYsablu pKOGjiedPZBQsWtzeqq3Z+A+6O1t9fADCsBgJvuKrLdUN9XoLlMfsE4EI3y+XctlY7sN D5SGMs/zslQli/+rKSRJhpti1QQp2wSlNoOu4pQKQRE1LwzL3Qm9cQiUW5VidNfZP8si kYWw== X-Gm-Message-State: ALoCoQkuUDMuVqTaeSViQaVPASOpBybLwLEib1Bkzy515YzxfqVKa6MdGyJCUEC5e/ZHlw6xKMBM X-Received: by 10.182.158.4 with SMTP id wq4mr24565105obb.18.1386088813807; Tue, 03 Dec 2013 08:40:13 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.41.66 with SMTP id d2ls1888749qel.10.gmail; Tue, 03 Dec 2013 08:40:13 -0800 (PST) X-Received: by 10.220.186.202 with SMTP id ct10mr57477608vcb.14.1386088813592; Tue, 03 Dec 2013 08:40:13 -0800 (PST) Received: from mail-ve0-f173.google.com (mail-ve0-f173.google.com [209.85.128.173]) by mx.google.com with ESMTPS id x1si3033721vdo.16.2013.12.03.08.40.13 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 03 Dec 2013 08:40:13 -0800 (PST) Received-SPF: neutral (google.com: 209.85.128.173 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.173; Received: by mail-ve0-f173.google.com with SMTP id oz11so10736889veb.32 for ; Tue, 03 Dec 2013 08:40:13 -0800 (PST) X-Received: by 10.58.180.227 with SMTP id dr3mr2019923vec.36.1386088813383; Tue, 03 Dec 2013 08:40:13 -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 u4csp222572vcz; Tue, 3 Dec 2013 08:40:12 -0800 (PST) X-Received: by 10.68.209.232 with SMTP id mp8mr39730516pbc.129.1386088812531; Tue, 03 Dec 2013 08:40:12 -0800 (PST) Received: from mail-pb0-f46.google.com (mail-pb0-f46.google.com [209.85.160.46]) by mx.google.com with ESMTPS id pk8si51844687pab.155.2013.12.03.08.40.12 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 03 Dec 2013 08:40:12 -0800 (PST) Received-SPF: neutral (google.com: 209.85.160.46 is neither permitted nor denied by best guess record for domain of hanjun.guo@linaro.org) client-ip=209.85.160.46; Received: by mail-pb0-f46.google.com with SMTP id md12so21216899pbc.5 for ; Tue, 03 Dec 2013 08:40:12 -0800 (PST) X-Received: by 10.69.18.234 with SMTP id gp10mr39281331pbd.105.1386088812107; Tue, 03 Dec 2013 08:40:12 -0800 (PST) Received: from localhost ([61.148.199.138]) by mx.google.com with ESMTPSA id gf5sm131128864pbc.22.2013.12.03.08.40.04 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Tue, 03 Dec 2013 08:40:11 -0800 (PST) From: Hanjun Guo To: "Rafael J. Wysocki" , Catalin Marinas , Will Deacon , Russell King - ARM Linux , Daniel Lezcano Cc: linux-acpi@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Grant Likely , Matthew Garrett , Olof Johansson , Linus Walleij , Bjorn Helgaas , Rob Herring , Mark Rutland , Jon Masters , patches@linaro.org, linux-kernel@vger.kernel.org, linaro-kernel@lists.linaro.org, linaro-acpi@lists.linaro.org, Hanjun Guo Subject: [RFC part2 PATCH 3/9] ARM64 / ACPI: Introduce map_gic_id() to get apic id from MADT or _MAT method Date: Wed, 4 Dec 2013 00:39:07 +0800 Message-Id: <1386088753-2850-4-git-send-email-hanjun.guo@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1386088753-2850-1-git-send-email-hanjun.guo@linaro.org> References: <1386088753-2850-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.173 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 9931435..a83b01c 100644 --- a/drivers/acpi/processor_core.c +++ b/drivers/acpi/processor_core.c @@ -89,6 +89,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; @@ -124,6 +145,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; } @@ -154,6 +178,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: