]> xenbits.xensource.com Git - people/liuw/xen.git/commitdiff
arm/acpi: Add __acpi_map_table function for ARM
authorShannon Zhao <zhaoshenglong@huawei.com>
Wed, 2 Mar 2016 07:35:00 +0000 (08:35 +0100)
committerWei Liu <wei.liu2@citrix.com>
Tue, 15 Mar 2016 16:32:33 +0000 (16:32 +0000)
Implement __acpi_map_table function for ARM. Move FIX_ACPI_PAGES to
common place and rename it to NUM_FIXMAP_ACPI_PAGES.

Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org>
Reviewed-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
xen/arch/arm/Makefile
xen/arch/arm/acpi/Makefile [new file with mode: 0644]
xen/arch/arm/acpi/lib.c [new file with mode: 0644]
xen/include/asm-arm/config.h
xen/include/asm-x86/acpi.h
xen/include/asm-x86/fixmap.h
xen/include/xen/acpi.h

index 178391207f397451cd01137c195c938b4ceda80d..0328b5068d6099ca9233cb801680bc8d31ac4670 100644 (file)
@@ -2,6 +2,7 @@ subdir-$(CONFIG_ARM_32) += arm32
 subdir-$(CONFIG_ARM_64) += arm64
 subdir-y += platforms
 subdir-$(CONFIG_ARM_64) += efi
+subdir-$(CONFIG_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 (file)
index 0000000..b5be22d
--- /dev/null
@@ -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 (file)
index 0000000..7996e9a
--- /dev/null
@@ -0,0 +1,50 @@
+/*
+ *  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, see <http://www.gnu.org/licenses/>.
+ *
+ * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ */
+
+#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);
+}
index b5d155ebb12df9e1a4215d498586652df880d440..7ceb5c5a0f95d315fa5ed0e7e58717f28f3a1770 100644 (file)
 #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
 
index d532e3d68717f3e4c7a0ed948a2296cbb40109bd..49f7e1efd4f1f4f106cfa2eb3160d87c4cd52880 100644 (file)
@@ -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 */
index 1e24b1170169dd1142b4ff0760865580518f8312..dc0856faf9b6bc81955a0f99dbc057008cac9224 100644 (file)
 
 #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,
index 65e53a6ed1a57f23c80a34c2789d6591c1853806..663341467a39f293b1f7193b49d2925a84ce95ef 100644 (file)
 #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 {