From patchwork Wed Feb 4 14:01:47 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Parth Dixit X-Patchwork-Id: 44344 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f199.google.com (mail-lb0-f199.google.com [209.85.217.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 45F022029F for ; Wed, 4 Feb 2015 14:05:08 +0000 (UTC) Received: by mail-lb0-f199.google.com with SMTP id f15sf1482043lbj.2 for ; Wed, 04 Feb 2015 06:05:07 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:date:message-id:in-reply-to :references:cc:subject:precedence:list-id:list-unsubscribe:list-post :list-help:list-subscribe:mime-version:content-type :content-transfer-encoding:sender:errors-to:x-original-sender :x-original-authentication-results:mailing-list:list-archive; bh=LMSGPQjedkX3g8kunll6LXkdfStrb4qJgF2t6MBiHYI=; b=l2CcidgplwYXrUL6gV/aLswllRZp4LYJ85Sj2iFx6RVPga1Ud2fVY8g7J7qYfOQCbM 4WO0+fYhZhNsChB0VC9rhYosssXppGpXpnKb9fHXbFgVobCZU+Po+h3YgKU4xBHcKGCW GZIS+CYjxlm0RRgx1Hpipge4q6APvRYV2N2iRyFscq9dTTNkvoZksvr9c0LrKgzGApZt 0cVaXhBiE60ILPmYEF/1g2QbRJFwcsplBYNzG1ouQkhlctJ++yJb5K1FjEu1CAT5Nb/7 +o0pcuFdCQK7ZEc+mAJEVd26fnErvuHk9kb9BdcTasiMpyywslbR3dma47Z/joBZ6tyJ YISg== X-Gm-Message-State: ALoCoQn1XnyX2cJjtVJS/kbjQd0ZmnIqQiua1Hwh3fES5eTZaTq2tIcrX5/mMklqtFtJvQVNSnBv X-Received: by 10.180.92.133 with SMTP id cm5mr374033wib.4.1423058707188; Wed, 04 Feb 2015 06:05:07 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.153.6.42 with SMTP id cr10ls38177lad.91.gmail; Wed, 04 Feb 2015 06:05:07 -0800 (PST) X-Received: by 10.152.5.101 with SMTP id r5mr30529914lar.33.1423058707013; Wed, 04 Feb 2015 06:05:07 -0800 (PST) Received: from mail-la0-f49.google.com (mail-la0-f49.google.com. [209.85.215.49]) by mx.google.com with ESMTPS id ml8si1411198lbc.77.2015.02.04.06.05.06 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 04 Feb 2015 06:05:07 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.49 as permitted sender) client-ip=209.85.215.49; Received: by mail-la0-f49.google.com with SMTP id gf13so1694269lab.8 for ; Wed, 04 Feb 2015 06:05:06 -0800 (PST) X-Received: by 10.112.243.12 with SMTP id wu12mr31106668lbc.91.1423058706401; Wed, 04 Feb 2015 06:05:06 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.35.133 with SMTP id h5csp506735lbj; Wed, 4 Feb 2015 06:05:05 -0800 (PST) X-Received: by 10.220.244.194 with SMTP id lr2mr19464600vcb.70.1423058701588; Wed, 04 Feb 2015 06:05:01 -0800 (PST) Received: from lists.xen.org (lists.xen.org. [50.57.142.19]) by mx.google.com with ESMTPS id ep5si703913vdb.85.2015.02.04.06.05.00 (version=TLSv1 cipher=RC4-SHA bits=128/128); Wed, 04 Feb 2015 06:05:01 -0800 (PST) Received-SPF: none (google.com: xen-devel-bounces@lists.xen.org does not designate permitted sender hosts) client-ip=50.57.142.19; Received: from localhost ([127.0.0.1] helo=lists.xen.org) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1YJ0Y5-0006Rn-N8; Wed, 04 Feb 2015 14:03:21 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1YJ0Y4-0006RE-9N for xen-devel@lists.xen.org; Wed, 04 Feb 2015 14:03:20 +0000 Received: from [85.158.139.211] by server-4.bemta-5.messagelabs.com id 73/64-03164-7A622D45; Wed, 04 Feb 2015 14:03:19 +0000 X-Env-Sender: parth.dixit@linaro.org X-Msg-Ref: server-16.tower-206.messagelabs.com!1423058597!8242823!1 X-Originating-IP: [209.85.192.171] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 6.13.4; banners=-,-,- X-VirusChecked: Checked Received: (qmail 10895 invoked from network); 4 Feb 2015 14:03:18 -0000 Received: from mail-pd0-f171.google.com (HELO mail-pd0-f171.google.com) (209.85.192.171) by server-16.tower-206.messagelabs.com with RC4-SHA encrypted SMTP; 4 Feb 2015 14:03:18 -0000 Received: by pdbfp1 with SMTP id fp1so869777pdb.4 for ; Wed, 04 Feb 2015 06:03:17 -0800 (PST) X-Received: by 10.70.100.73 with SMTP id ew9mr46537911pdb.95.1423058595901; Wed, 04 Feb 2015 06:03:15 -0800 (PST) Received: from parthd-ubunutu.qualcomm.com ([202.46.23.62]) by mx.google.com with ESMTPSA id kg12sm2161881pbb.44.2015.02.04.06.03.11 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 04 Feb 2015 06:03:14 -0800 (PST) From: parth.dixit@linaro.org To: xen-devel@lists.xen.org Date: Wed, 4 Feb 2015 19:31:47 +0530 Message-Id: <1423058539-26403-4-git-send-email-parth.dixit@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1423058539-26403-1-git-send-email-parth.dixit@linaro.org> References: <1423058539-26403-1-git-send-email-parth.dixit@linaro.org> Cc: ian.campbell@citrix.com, Naresh Bhat , julien.grall@linaro.org, tim@xen.org, stefano.stabellini@citrix.com, jbeulich@suse.com, christoffer.dall@linaro.org Subject: [Xen-devel] [PATCH RFC 03/35] xen: arm64: ACPI: Add basic ACPI initialization X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Post: , List-Help: , List-Subscribe: , MIME-Version: 1.0 Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: parth.dixit@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.49 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Archive: From: Naresh Bhat This patch introduce arm-core.c and its related header file - asm/acpi.h for arch specific variables and functions needed by ACPI driver core; - arm-core.c for ARM64 related ACPI implementation for ACPI driver core; acpi_boot_table_init() will be called in setup_arch() to get the RSDP and all the table pointers. with this patch, we can get ACPI boot-time tables from firmware on ARM64. Signed-off-by: Naresh Bhat --- xen/arch/arm/arm64/Makefile | 1 + xen/arch/arm/arm64/acpi/Makefile | 1 + xen/arch/arm/arm64/acpi/arm-core.c | 97 ++++++++++++++++++++++++++++++++++++++ xen/arch/arm/setup.c | 14 +++++- xen/include/xen/acpi.h | 11 +++++ 5 files changed, 123 insertions(+), 1 deletion(-) create mode 100644 xen/arch/arm/arm64/acpi/Makefile create mode 100644 xen/arch/arm/arm64/acpi/arm-core.c diff --git a/xen/arch/arm/arm64/Makefile b/xen/arch/arm/arm64/Makefile index c7243f5..49d135f 100644 --- a/xen/arch/arm/arm64/Makefile +++ b/xen/arch/arm/arm64/Makefile @@ -1,4 +1,5 @@ subdir-y += lib +subdir-y += acpi obj-y += entry.o diff --git a/xen/arch/arm/arm64/acpi/Makefile b/xen/arch/arm/arm64/acpi/Makefile new file mode 100644 index 0000000..07e3c44 --- /dev/null +++ b/xen/arch/arm/arm64/acpi/Makefile @@ -0,0 +1 @@ +obj-y += arm-core.o diff --git a/xen/arch/arm/arm64/acpi/arm-core.c b/xen/arch/arm/arm64/acpi/arm-core.c new file mode 100644 index 0000000..50a83d6 --- /dev/null +++ b/xen/arch/arm/arm64/acpi/arm-core.c @@ -0,0 +1,97 @@ +/* + * ARM64 Specific Low-Level ACPI Boot Support + * + * Copyright (C) 2014, Naresh Bhat + * + * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + */ + +#if defined(CONFIG_ARM_64) && defined(CONFIG_ACPI) +#include +#include + +#include + +/* + * We never plan to use RSDT on arm/arm64 as its deprecated in spec but this + * variable is still required by the ACPI core + */ +u32 acpi_rsdt_forced; + +int acpi_noirq; /* skip ACPI IRQ initialization */ +int acpi_strict; +int acpi_disabled; +EXPORT_SYMBOL(acpi_disabled); + +int acpi_pci_disabled; /* skip ACPI PCI scan and IRQ initialization */ +EXPORT_SYMBOL(acpi_pci_disabled); + +enum acpi_irq_model_id acpi_irq_model = ACPI_IRQ_MODEL_PLATFORM; + +struct acpi_arm_root acpi_arm_rsdp_info; /* info about RSDP from FDT */ + +int acpi_gsi_to_irq(u32 gsi, unsigned int *irq) +{ + *irq = -1; + return 0; +} +EXPORT_SYMBOL_GPL(acpi_gsi_to_irq); + +/* + * success: return IRQ number (>0) + * failure: return =< 0 + */ +//int acpi_register_gsi(struct device *dev, u32 gsi, int trigger, int polarity) +unsigned int acpi_register_gsi (u32 gsi, int edge_level, int active_high_low) +{ + return -1; +} +EXPORT_SYMBOL_GPL(acpi_register_gsi); + +void acpi_unregister_gsi(u32 gsi) +{ +} +EXPORT_SYMBOL_GPL(acpi_unregister_gsi); + +/* + * acpi_boot_table_init() called from setup_arch(), always. + * 1. find RSDP and get its address, and then find XSDT + * 2. extract all tables and checksums them all + * + * We can parse ACPI boot-time tables such as FADT, MADT after + * this function is called. + */ +int __init acpi_boot_table_init(void) +{ + int error; + /* If acpi_disabled, bail out */ + if (acpi_disabled) + return 1; + + /* Initialize the ACPI boot-time table parser. */ + error = acpi_table_init(); + if (error) + { + disable_acpi(); + return error; + } + + return 0; +} +#endif diff --git a/xen/arch/arm/setup.c b/xen/arch/arm/setup.c index 3991d64..7ae126b 100644 --- a/xen/arch/arm/setup.c +++ b/xen/arch/arm/setup.c @@ -45,6 +45,8 @@ #include #include #include +#include +#include struct bootinfo __initdata bootinfo; @@ -737,7 +739,18 @@ void __init start_xen(unsigned long boot_phys_offset, setup_mm(fdt_paddr, fdt_size); + system_state = SYS_STATE_boot; + vm_init(); + +/* + * Parse the ACPI tables for possible boot-time configuration + */ + +#if defined(CONFIG_ACPI) && defined(CONFIG_ARM_64) + acpi_boot_table_init(); +#endif + dt_unflatten_host_device_tree(); dt_irq_xlate = gic_irq_xlate; @@ -802,7 +815,6 @@ void __init start_xen(unsigned long boot_phys_offset, printk("Failed to bring up CPU %u (error %d)\n", i, ret); } } - printk("Brought up %ld CPUs\n", (long)num_online_cpus()); /* TODO: smp_cpus_done(); */ diff --git a/xen/include/xen/acpi.h b/xen/include/xen/acpi.h index 3aeba4a..ff96336 100644 --- a/xen/include/xen/acpi.h +++ b/xen/include/xen/acpi.h @@ -42,6 +42,17 @@ #ifdef CONFIG_ACPI_BOOT +enum acpi_irq_model_id { + ACPI_IRQ_MODEL_PIC = 0, + ACPI_IRQ_MODEL_IOAPIC, + ACPI_IRQ_MODEL_IOSAPIC, + ACPI_IRQ_MODEL_PLATFORM, + ACPI_IRQ_MODEL_GIC, + ACPI_IRQ_MODEL_COUNT +}; + +extern enum acpi_irq_model_id acpi_irq_model; + enum acpi_interrupt_id { ACPI_INTERRUPT_PMI = 1, ACPI_INTERRUPT_INIT,