All of lore.kernel.org
 help / color / mirror / Atom feed
From: Shannon Zhao <zhaoshenglong@huawei.com>
To: xen-devel@lists.xen.org
Cc: ian.campbell@citrix.com, peter.huangpeng@huawei.com,
	stefano.stabellini@citrix.com, shannon.zhao@linaro.org,
	Jan Beulich <jbeulich@suse.com>,
	zhaoshenglong@huawei.com
Subject: [PATCH v6 03/22] arm/acpi: Add __acpi_map_table function for ARM
Date: Sat, 27 Feb 2016 14:29:25 +0800	[thread overview]
Message-ID: <1456554565-8168-1-git-send-email-zhaoshenglong@huawei.com> (raw)
In-Reply-To: <1456467780-8476-4-git-send-email-zhaoshenglong@huawei.com>

From: Shannon Zhao <shannon.zhao@linaro.org>

Implement __acpi_map_table function for ARM. Move FIX_ACPI_PAGES to
common place and rename it to NUM_FIXMAP_ACPI_PAGES.

Cc: Jan Beulich <jbeulich@suse.com>
Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org>
---
 xen/arch/arm/Makefile        |  1 +
 xen/arch/arm/acpi/Makefile   |  1 +
 xen/arch/arm/acpi/lib.c      | 52 ++++++++++++++++++++++++++++++++++++++++++++
 xen/include/asm-arm/config.h |  2 ++
 xen/include/asm-x86/acpi.h   |  3 ---
 xen/include/asm-x86/fixmap.h |  4 ++--
 xen/include/xen/acpi.h       |  5 +++++
 7 files changed, 63 insertions(+), 5 deletions(-)
 create mode 100644 xen/arch/arm/acpi/Makefile
 create mode 100644 xen/arch/arm/acpi/lib.c

diff --git a/xen/arch/arm/Makefile b/xen/arch/arm/Makefile
index 1783912..6d51094 100644
--- a/xen/arch/arm/Makefile
+++ b/xen/arch/arm/Makefile
@@ -2,6 +2,7 @@ subdir-$(CONFIG_ARM_32) += arm32
 subdir-$(CONFIG_ARM_64) += arm64
 subdir-y += platforms
 subdir-$(CONFIG_ARM_64) += efi
+subdir-$(CONFIG_HAS_ACPI) += acpi
 
 obj-$(EARLY_PRINTK) += early_printk.o
 obj-y += cpu.o
diff --git a/xen/arch/arm/acpi/Makefile b/xen/arch/arm/acpi/Makefile
new file mode 100644
index 0000000..b5be22d
--- /dev/null
+++ b/xen/arch/arm/acpi/Makefile
@@ -0,0 +1 @@
+obj-y += lib.o
diff --git a/xen/arch/arm/acpi/lib.c b/xen/arch/arm/acpi/lib.c
new file mode 100644
index 0000000..a08e45c
--- /dev/null
+++ b/xen/arch/arm/acpi/lib.c
@@ -0,0 +1,52 @@
+/*
+ *  lib.c - Architecture-Specific Low-Level ACPI Support
+ *
+ *  Copyright (C) 2015, Shannon Zhao <shannon.zhao@linaro.org>
+ *
+ * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ *
+ *  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
+ *
+ * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ */
+
+#include <xen/acpi.h>
+#include <xen/mm.h>
+#include <asm/config.h>
+
+char *__acpi_map_table(paddr_t phys, unsigned long size)
+{
+	unsigned long base, offset, mapped_size;
+	int idx;
+
+	offset = phys & (PAGE_SIZE - 1);
+	mapped_size = PAGE_SIZE - offset;
+	set_fixmap(FIXMAP_ACPI_BEGIN, phys >> PAGE_SHIFT, PAGE_HYPERVISOR);
+	base = FIXMAP_ADDR(FIXMAP_ACPI_BEGIN);
+
+	/*
+	 * Most cases can be covered by the below.
+	 */
+	idx = FIXMAP_ACPI_BEGIN;
+	while (mapped_size < size) {
+		if (++idx > FIXMAP_ACPI_END)
+			return NULL;	/* cannot handle this */
+		phys += PAGE_SIZE;
+		set_fixmap(idx, phys >> PAGE_SHIFT, PAGE_HYPERVISOR);
+		mapped_size += PAGE_SIZE;
+	}
+
+	return ((char *) base + offset);
+}
diff --git a/xen/include/asm-arm/config.h b/xen/include/asm-arm/config.h
index a1b968d..a26cb1a 100644
--- a/xen/include/asm-arm/config.h
+++ b/xen/include/asm-arm/config.h
@@ -180,6 +180,8 @@
 #define FIXMAP_GICC1    4  /* Interrupt controller: CPU registers (first page) */
 #define FIXMAP_GICC2    5  /* Interrupt controller: CPU registers (second page) */
 #define FIXMAP_GICH     6  /* Interrupt controller: virtual interface control registers */
+#define FIXMAP_ACPI_BEGIN  7  /* Start mappings of ACPI tables */
+#define FIXMAP_ACPI_END    (FIXMAP_ACPI_BEGIN + NUM_FIXMAP_ACPI_PAGES - 1)  /* End mappings of ACPI tables */
 
 #define PAGE_SHIFT              12
 
diff --git a/xen/include/asm-x86/acpi.h b/xen/include/asm-x86/acpi.h
index d532e3d..49f7e1e 100644
--- a/xen/include/asm-x86/acpi.h
+++ b/xen/include/asm-x86/acpi.h
@@ -90,9 +90,6 @@ static inline void disable_acpi(void)
 	acpi_noirq = 1;
 }
 
-/* Fixmap pages to reserve for ACPI boot-time tables (see fixmap.h) */
-#define FIX_ACPI_PAGES 4
-
 static inline void acpi_noirq_set(void) { acpi_noirq = 1; }
 
 /* routines for saving/restoring kernel state */
diff --git a/xen/include/asm-x86/fixmap.h b/xen/include/asm-x86/fixmap.h
index 1e24b11..dc0856f 100644
--- a/xen/include/asm-x86/fixmap.h
+++ b/xen/include/asm-x86/fixmap.h
@@ -19,11 +19,11 @@
 
 #ifndef __ASSEMBLY__
 
+#include <xen/acpi.h>
 #include <xen/pfn.h>
 #include <xen/kexec.h>
 #include <xen/iommu.h>
 #include <asm/apicdef.h>
-#include <asm/acpi.h>
 #include <asm/amd-iommu.h>
 #include <asm/msi.h>
 #include <acpi/apei.h>
@@ -51,7 +51,7 @@ enum fixed_addresses {
     FIX_IO_APIC_BASE_0,
     FIX_IO_APIC_BASE_END = FIX_IO_APIC_BASE_0 + MAX_IO_APICS-1,
     FIX_ACPI_BEGIN,
-    FIX_ACPI_END = FIX_ACPI_BEGIN + FIX_ACPI_PAGES - 1,
+    FIX_ACPI_END = FIX_ACPI_BEGIN + NUM_FIXMAP_ACPI_PAGES - 1,
     FIX_HPET_BASE,
     FIX_TBOOT_SHARED_BASE,
     FIX_MSIX_IO_RESERV_BASE,
diff --git a/xen/include/xen/acpi.h b/xen/include/xen/acpi.h
index 65e53a6..723a6ca 100644
--- a/xen/include/xen/acpi.h
+++ b/xen/include/xen/acpi.h
@@ -39,6 +39,11 @@
 #define ACPI_MADT_GET_POLARITY(inti)	ACPI_MADT_GET_(POLARITY, inti)
 #define ACPI_MADT_GET_TRIGGER(inti)	ACPI_MADT_GET_(TRIGGER, inti)
 
+/* Fixmap pages to reserve for ACPI boot-time tables (see asm-x86/fixmap.h or
+ * asm-arm/config.h)
+ */
+#define NUM_FIXMAP_ACPI_PAGES  4
+
 #ifdef CONFIG_ACPI_BOOT
 
 enum acpi_interrupt_id {
-- 
2.0.4



_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

  parent reply	other threads:[~2016-02-27  6:29 UTC|newest]

Thread overview: 53+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-26  6:22 [PATCH v5 00/22] Add ACPI support for Xen itself on ARM64 Shannon Zhao
2016-02-26  6:22 ` [PATCH v5 01/22] arm/acpi: Emulate io ports for arm Shannon Zhao
2016-02-26 12:00   ` Stefano Stabellini
2016-02-26  6:22 ` [PATCH v5 02/22] arm/acpi: Add arm specific acpi header file Shannon Zhao
2016-02-26  6:22 ` [PATCH v5 03/22] arm/acpi: Add __acpi_map_table function for ARM Shannon Zhao
2016-02-26 14:12   ` Stefano Stabellini
2016-02-26 16:29     ` Jan Beulich
2016-02-26 16:30       ` Stefano Stabellini
2016-02-27  6:29   ` Shannon Zhao [this message]
2016-02-29 10:54     ` [PATCH v6 " Stefano Stabellini
2016-02-29 11:38       ` Jan Beulich
2016-02-29 11:43         ` Stefano Stabellini
2016-02-29 11:53           ` Jan Beulich
2016-02-29 11:56             ` Stefano Stabellini
2016-02-29 12:05               ` Jan Beulich
2016-02-29 20:29     ` [PATCH v7 " Shannon Zhao
2016-03-01 10:08       ` Jan Beulich
2016-02-26  6:22 ` [PATCH v5 04/22] arm/acpi: Add basic ACPI initialization Shannon Zhao
2016-02-26 13:39   ` Stefano Stabellini
2016-02-26  6:22 ` [PATCH v5 05/22] arm/acpi: Move end_boot_allocator after acpi_boot_table_init Shannon Zhao
2016-02-26 12:08   ` Stefano Stabellini
2016-02-26  6:22 ` [PATCH v5 06/22] arm/acpi: Parse FADT table and get PSCI flags Shannon Zhao
2016-02-26 12:10   ` Stefano Stabellini
2016-02-26  6:22 ` [PATCH v5 07/22] ACPI / table: Print GIC information when MADT is parsed Shannon Zhao
2016-02-26  9:39   ` Jan Beulich
2016-02-26  6:22 ` [PATCH v5 08/22] arm/acpi: Parse MADT to map logical cpu to MPIDR and get cpu_possible_map Shannon Zhao
2016-02-26  9:49   ` Jan Beulich
2016-02-26 10:18     ` Shannon Zhao
2016-02-26 12:18   ` Stefano Stabellini
2016-02-27  6:33   ` [PATCH v6 " Shannon Zhao
2016-02-29 12:38     ` Jan Beulich
2016-02-26  6:22 ` [PATCH v5 09/22] arm/acpi: Add ACPI support for SMP initialization Shannon Zhao
2016-02-26  6:22 ` [PATCH v5 10/22] acpi/table: Introduce acpi_table_get_entry_madt to get specified entry Shannon Zhao
2016-02-26  9:59   ` Jan Beulich
2016-02-27  6:37   ` [PATCH v6 " Shannon Zhao
2016-02-29 12:39     ` Jan Beulich
2016-02-26  6:22 ` [PATCH v5 11/22] arm: Introduce a generic way to use a device from acpi Shannon Zhao
2016-02-26  6:22 ` [PATCH v5 12/22] arm/irq: Drop the DT prefix of the irq line type Shannon Zhao
2016-02-26  6:22 ` [PATCH v5 13/22] arm/gic-v2: Add ACPI boot support for GICv2 Shannon Zhao
2016-02-26  6:22 ` [PATCH v5 14/22] arm/gic-v3: Add ACPI boot support for GICv3 Shannon Zhao
2016-02-26  6:22 ` [PATCH v5 15/22] arm/gic: Add ACPI support for GIC preinit Shannon Zhao
2016-02-26  6:22 ` [PATCH v5 16/22] arm/irq: Add helper function for setting interrupt type Shannon Zhao
2016-02-26  6:22 ` [PATCH v5 17/22] arm/acpi: Parse GTDT to initialize timer Shannon Zhao
2016-02-26  6:22 ` [PATCH v5 18/22] arm/acpi: Add a new ACPI initialized function for UART Shannon Zhao
2016-02-26 13:46   ` Stefano Stabellini
2016-02-26  6:22 ` [PATCH v5 19/22] ACPICA: Headers: Add support for CSRT and DBG2 ACPI tables Shannon Zhao
2016-02-26  6:22 ` [PATCH v5 20/22] arm/acpi: Initialize serial port from ACPI SPCR table Shannon Zhao
2016-02-26 10:04   ` Jan Beulich
2016-02-26 10:20     ` Shannon Zhao
2016-02-26 11:10       ` Shannon Zhao
2016-02-26 12:32         ` Jan Beulich
2016-02-26  6:22 ` [PATCH v5 21/22] arm/fdt: Export device_tree_for_each_node Shannon Zhao
2016-02-26  6:23 ` [PATCH v5 22/22] arm/acpi: Add acpi parameter to enable/disable acpi Shannon Zhao

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1456554565-8168-1-git-send-email-zhaoshenglong@huawei.com \
    --to=zhaoshenglong@huawei.com \
    --cc=ian.campbell@citrix.com \
    --cc=jbeulich@suse.com \
    --cc=peter.huangpeng@huawei.com \
    --cc=shannon.zhao@linaro.org \
    --cc=stefano.stabellini@citrix.com \
    --cc=xen-devel@lists.xen.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.