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: 23281 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-qa0-f72.google.com (mail-qa0-f72.google.com [209.85.216.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id AF00E20555 for ; Fri, 17 Jan 2014 02:07:35 +0000 (UTC) Received: by mail-qa0-f72.google.com with SMTP id f11sf5062932qae.11 for ; Thu, 16 Jan 2014 18:07:34 -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=RGqbLtgwos0R8ENKRqG3WjEP9igwU2nPCZBY3iybCcQ=; b=S3+W+eZWf9JN8wHr9+g4gmXbUgaXTMxUJ1hV4LhgCwH6hbLWEr8jjtPkq0GdLRIxcN SuF6a7GTgxqs7cmulIampJMUSKutvI4mxLVFOCHaFn8J1q3Ijj/bzMFGQJM/dd/ZD9T0 KaR8DX77qOJ0CpwuT1+mXrv61MjDczgryefw5lld3PrKYkCElyvF4OrW6A4Fh8fPF9O8 /AQAaKcDlEJKyCbgoeNZt8fHg7Q3Fpj96XhZg7RT67RwB1AsAoBBwzZ6fs71BN7ZJV/v jDfDtTptBFooV9eSKaDgHb+gBjs1d3qW/avsemLjHgH2/xSDtDOVtKZfDuWI6TU/advH 07Mw== X-Gm-Message-State: ALoCoQmRaJWbmkfCM6A9UKJcqbDsiqrv4SfNBNYsHZW2cRO4EC7yf2zARc8GWAIiM91NA6M82rfe X-Received: by 10.236.123.136 with SMTP id v8mr4361225yhh.56.1389924454899; Thu, 16 Jan 2014 18:07:34 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.119.231 with SMTP id kx7ls191744qeb.29.gmail; Thu, 16 Jan 2014 18:07:34 -0800 (PST) X-Received: by 10.52.181.98 with SMTP id dv2mr1930771vdc.30.1389924454792; Thu, 16 Jan 2014 18:07:34 -0800 (PST) Received: from mail-ve0-f170.google.com (mail-ve0-f170.google.com [209.85.128.170]) by mx.google.com with ESMTPS id ls10si4128905vec.133.2014.01.16.18.07.34 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 16 Jan 2014 18:07:34 -0800 (PST) Received-SPF: neutral (google.com: 209.85.128.170 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.170; Received: by mail-ve0-f170.google.com with SMTP id cz12so1368138veb.1 for ; Thu, 16 Jan 2014 18:07:34 -0800 (PST) X-Received: by 10.52.28.70 with SMTP id z6mr19803vdg.57.1389924454528; Thu, 16 Jan 2014 18:07:34 -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.59.13.131 with SMTP id ey3csp390673ved; Thu, 16 Jan 2014 18:07:34 -0800 (PST) X-Received: by 10.68.143.231 with SMTP id sh7mr13911702pbb.7.1389924453567; Thu, 16 Jan 2014 18:07:33 -0800 (PST) Received: from mail-pa0-f52.google.com (mail-pa0-f52.google.com [209.85.220.52]) by mx.google.com with ESMTPS id zk9si5404549pac.260.2014.01.16.18.07.33 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 16 Jan 2014 18:07:33 -0800 (PST) Received-SPF: neutral (google.com: 209.85.220.52 is neither permitted nor denied by best guess record for domain of hanjun.guo@linaro.org) client-ip=209.85.220.52; Received: by mail-pa0-f52.google.com with SMTP id bj1so1980179pad.11 for ; Thu, 16 Jan 2014 18:07:33 -0800 (PST) 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 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: [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-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.170 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 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: