@@ -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
new file mode 100644
@@ -0,0 +1 @@
+obj-y += lib.o
new file mode 100644
@@ -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(FIX_ACPI_BEGIN, phys >> PAGE_SHIFT, PAGE_HYPERVISOR);
+ base = FIXMAP_ADDR(FIX_ACPI_BEGIN);
+
+ /*
+ * Most cases can be covered by the below.
+ */
+ idx = FIX_ACPI_BEGIN;
+ while (mapped_size < size) {
+ if (++idx > FIX_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);
+}
@@ -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 FIX_ACPI_BEGIN 7 /* Start mappings of ACPI tables */
+#define FIX_ACPI_END 10 /* End mappings of ACPI tables */
#define PAGE_SHIFT 12