From patchwork Sat Feb 8 13:10:18 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hanjun Guo X-Patchwork-Id: 24347 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-oa0-f69.google.com (mail-oa0-f69.google.com [209.85.219.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 6B5BA20967 for ; Sat, 8 Feb 2014 13:11:26 +0000 (UTC) Received: by mail-oa0-f69.google.com with SMTP id h16sf20170432oag.8 for ; Sat, 08 Feb 2014 05:11: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=JDZH7HO2VpMoRn6GoLJmXduPOq+w6FMXqBCirUCaVws=; b=lEiu8NpnPlmdzYRl6nYvaF7xQQfBm1a+Egl7RfnvL59tZRZehRsHiXd+iZUR8+ZgaV oRHxNjw+8QtQkGCd6+ijuDn5rzVEH/2YnLtEoREjLsVlMbCRGeakCFXWrX5Ur26vPf+j AAXTMYP8jTsAvVI6RnOt7h7/d1K3GjmFT+Bmr7na7vtaQQ2XCSUVXeTmesUrU2kUx8ka DQy+qjaaWH406kHbGIKkRR7hAESLLflDaKbE6aYouEq1uoXIxchLb0SQ5SWZDPEvmuTa SmKnrheAaAoL6fTY57gyIOQSehlkGNBYIQX9AGFF5JC7rgtujYImJEuELk/8mfdmIoX4 o07Q== X-Gm-Message-State: ALoCoQnjWOdtG3aR7EH8hrXNlf6bKvcMiSmP9fC/58SpEJq6gV1kWsC8woHsZEsKMaxWb/k9JnWM X-Received: by 10.182.134.200 with SMTP id pm8mr7965782obb.19.1391865085465; Sat, 08 Feb 2014 05:11:25 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.86.212 with SMTP id p78ls1425692qgd.10.gmail; Sat, 08 Feb 2014 05:11:25 -0800 (PST) X-Received: by 10.220.250.203 with SMTP id mp11mr3720861vcb.2.1391865085378; Sat, 08 Feb 2014 05:11:25 -0800 (PST) Received: from mail-vc0-f177.google.com (mail-vc0-f177.google.com [209.85.220.177]) by mx.google.com with ESMTPS id uw4si2465847vdc.118.2014.02.08.05.11.25 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sat, 08 Feb 2014 05:11:25 -0800 (PST) Received-SPF: neutral (google.com: 209.85.220.177 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.220.177; Received: by mail-vc0-f177.google.com with SMTP id if11so3464407vcb.36 for ; Sat, 08 Feb 2014 05:11:25 -0800 (PST) X-Received: by 10.58.227.38 with SMTP id rx6mr15277933vec.10.1391865085293; Sat, 08 Feb 2014 05:11: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 u4csp32371vcz; Sat, 8 Feb 2014 05:11:24 -0800 (PST) X-Received: by 10.68.197.99 with SMTP id it3mr25752584pbc.37.1391865084035; Sat, 08 Feb 2014 05:11:24 -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 fb4si8628623pbb.82.2014.02.08.05.11.22 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sat, 08 Feb 2014 05:11:24 -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 w10so4265307pde.7 for ; Sat, 08 Feb 2014 05:11:22 -0800 (PST) X-Received: by 10.66.145.166 with SMTP id sv6mr14350742pab.31.1391865082514; Sat, 08 Feb 2014 05:11:22 -0800 (PST) Received: from localhost ([39.182.20.40]) by mx.google.com with ESMTPSA id xn12sm59402995pac.12.2014.02.08.05.11.19 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Sat, 08 Feb 2014 05:11:21 -0800 (PST) From: Hanjun Guo To: "Rafael J. Wysocki" Cc: linux-acpi@vger.kernel.org, patches@linaro.org, linux-kernel@vger.kernel.org, linaro-acpi@lists.linaro.org, Hanjun Guo Subject: [PATCH v2 3/3] ACPI: Introduce map_gic_id() to get apic id from MADT or _MAT method Date: Sat, 8 Feb 2014 21:10:18 +0800 Message-Id: <1391865018-3446-4-git-send-email-hanjun.guo@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1391865018-3446-1-git-send-email-hanjun.guo@linaro.org> References: <1391865018-3446-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.220.177 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 31a4281..5a50f03 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: