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: 24401 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-yk0-f198.google.com (mail-yk0-f198.google.com [209.85.160.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 35A82202B2 for ; Mon, 10 Feb 2014 07:50:25 +0000 (UTC) Received: by mail-yk0-f198.google.com with SMTP id 131sf14462307ykp.1 for ; Sun, 09 Feb 2014 23:50:25 -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=QTFM5AtTnXRoX5Jv5Zs3uyvRn4keOQA9JK1pPTPIiLw=; b=X2rXoBSw4bx0jKncirKsUNO5w54XKxzBsQed5o8wMYsoW1tNpa+CRwVfgYI7xbha2e rkqxVrD2QgBrGD8dMJ/XmiCaco96QJEgQMdYDOCxUHdJKje6irtGIT9w5scLTD5gORTg P8QE85AH6zHp3OBMjE3GzNF0gLA8Ri3pgS0XO5n6xtbgiHDusRIBk72LxqdgrPoC1Zth vTb89oaewOmy51RxfYkgivWaa9nxXFWAhqZ443KrunO7A+KHIQ+MEATNTF4XKB+ejPg8 08fUW9q0twSeEE1NtvxtMTI/GB18ohkJYm5iua1992ZzLIPNCvDKFS9f5fLdHim6Rurf CDmg== X-Gm-Message-State: ALoCoQk/GmeQYkB6dAyjTM0QcS9ZKEa9d+eX9gKiG+1YgO/2iYyyWYmCBfFwu/ciDtcbwojqvtfA X-Received: by 10.236.92.202 with SMTP id j50mr10412528yhf.26.1392018625158; Sun, 09 Feb 2014 23:50:25 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.25.198 with SMTP id 64ls1950397qgt.31.gmail; Sun, 09 Feb 2014 23:50:25 -0800 (PST) X-Received: by 10.221.66.73 with SMTP id xp9mr29764vcb.27.1392018625091; Sun, 09 Feb 2014 23:50:25 -0800 (PST) Received: from mail-vb0-f41.google.com (mail-vb0-f41.google.com [209.85.212.41]) by mx.google.com with ESMTPS id y6si4561635veb.63.2014.02.09.23.50.25 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sun, 09 Feb 2014 23:50:25 -0800 (PST) Received-SPF: neutral (google.com: 209.85.212.41 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.212.41; Received: by mail-vb0-f41.google.com with SMTP id g10so4486590vbg.14 for ; Sun, 09 Feb 2014 23:50:25 -0800 (PST) X-Received: by 10.58.204.4 with SMTP id ku4mr25649vec.34.1392018625019; Sun, 09 Feb 2014 23:50:25 -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 u4csp148684vcz; Sun, 9 Feb 2014 23:50:24 -0800 (PST) X-Received: by 10.68.230.137 with SMTP id sy9mr35940476pbc.126.1392018624091; Sun, 09 Feb 2014 23:50:24 -0800 (PST) Received: from mail-pa0-f45.google.com (mail-pa0-f45.google.com [209.85.220.45]) by mx.google.com with ESMTPS id gj4si14367938pac.2.2014.02.09.23.50.23 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sun, 09 Feb 2014 23:50:24 -0800 (PST) Received-SPF: neutral (google.com: 209.85.220.45 is neither permitted nor denied by best guess record for domain of hanjun.guo@linaro.org) client-ip=209.85.220.45; Received: by mail-pa0-f45.google.com with SMTP id lf10so5858302pab.32 for ; Sun, 09 Feb 2014 23:50:23 -0800 (PST) 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" 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 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-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.212.41 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 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: