|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH v5 03/22] arm/acpi: Add __acpi_map_table function for ARM
On Fri, 26 Feb 2016, Shannon Zhao wrote:
> From: Shannon Zhao <shannon.zhao@xxxxxxxxxx>
>
> Implement __acpi_map_table function for ARM.
>
> Signed-off-by: Shannon Zhao <shannon.zhao@xxxxxxxxxx>
> ---
> V4: add __acpi_map_table function
> ---
> 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 ++
> 4 files changed, 56 insertions(+)
> 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..f817fe6
> --- /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@xxxxxxxxxx>
> + *
> + * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> + *
> + * 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);
> +}
> diff --git a/xen/include/asm-arm/config.h b/xen/include/asm-arm/config.h
> index a1b968d..41dd860 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 FIX_ACPI_BEGIN 7 /* Start mappings of ACPI tables */
> +#define FIX_ACPI_END 10 /* End mappings of ACPI tables */
>
> #define PAGE_SHIFT 12
Please rename FIX_ACPI_BEGIN and FIX_ACPI_END to FIXMAP_ACPI_BEGIN and
FIXMAP_ACPI_END.
Also please move the declaration of FIX_ACPI_PAGES from asm-x86/acpi.h
to a common header, and maybe rename it to NUM_ACPI_PAGES. Then you can
define FIXMAP_ACPI_END as (FIXMAP_ACPI_BEGIN + NUM_ACPI_PAGES - 1).
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |