mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-12-13 14:04:05 +08:00
c5a1330573
The 32-bit ARM port doesn't have ACPI headers, and conditionally including them is going to look horrendous. In preparation for sharing the PSCI invocation code with 32-bit, move the acpi_psci_* function declarations and definitions such that the PSCI client code need not include ACPI headers. While it would seem like we could simply hide the ACPI includes in psci.h, the ACPI headers have hilarious circular dependencies which make this infeasible without reorganising most of ACPICA. So rather than doing that, move the acpi_psci_* prototypes into psci.h. The psci_acpi_init function is made dependent on CONFIG_ACPI (with a stub implementation in asm/psci.h) such that it need not be built for 32-bit ARM or kernels without ACPI support. The currently missing __init annotations are added to the prototypes in the header. Signed-off-by: Mark Rutland <mark.rutland@arm.com> Acked-by: Catalin Marinas <catalin.marinas@arm.com> Acked-by: Hanjun Guo <hanjun.guo@linaro.org> Reviewed-by: Al Stone <al.stone@linaro.org> Reviewed-by: Ashwin Chaugule <ashwin.chaugule@linaro.org> Tested-by: Hanjun Guo <hanjun.guo@linaro.org> Cc: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com> Cc: Will Deacon <will.deacon@arm.com>
88 lines
2.2 KiB
C
88 lines
2.2 KiB
C
/*
|
|
* Copyright (C) 2013-2014, Linaro Ltd.
|
|
* Author: Al Stone <al.stone@linaro.org>
|
|
* Author: Graeme Gregory <graeme.gregory@linaro.org>
|
|
* Author: Hanjun Guo <hanjun.guo@linaro.org>
|
|
*
|
|
* This program is free software; you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License version 2 as
|
|
* published by the Free Software Foundation;
|
|
*/
|
|
|
|
#ifndef _ASM_ACPI_H
|
|
#define _ASM_ACPI_H
|
|
|
|
#include <linux/mm.h>
|
|
#include <linux/irqchip/arm-gic-acpi.h>
|
|
|
|
#include <asm/cputype.h>
|
|
#include <asm/psci.h>
|
|
#include <asm/smp_plat.h>
|
|
|
|
/* Basic configuration for ACPI */
|
|
#ifdef CONFIG_ACPI
|
|
/* ACPI table mapping after acpi_gbl_permanent_mmap is set */
|
|
static inline void __iomem *acpi_os_ioremap(acpi_physical_address phys,
|
|
acpi_size size)
|
|
{
|
|
if (!page_is_ram(phys >> PAGE_SHIFT))
|
|
return ioremap(phys, size);
|
|
|
|
return ioremap_cache(phys, size);
|
|
}
|
|
#define acpi_os_ioremap acpi_os_ioremap
|
|
|
|
typedef u64 phys_cpuid_t;
|
|
#define PHYS_CPUID_INVALID INVALID_HWID
|
|
|
|
#define acpi_strict 1 /* No out-of-spec workarounds on ARM64 */
|
|
extern int acpi_disabled;
|
|
extern int acpi_noirq;
|
|
extern int acpi_pci_disabled;
|
|
|
|
static inline void disable_acpi(void)
|
|
{
|
|
acpi_disabled = 1;
|
|
acpi_pci_disabled = 1;
|
|
acpi_noirq = 1;
|
|
}
|
|
|
|
static inline void enable_acpi(void)
|
|
{
|
|
acpi_disabled = 0;
|
|
acpi_pci_disabled = 0;
|
|
acpi_noirq = 0;
|
|
}
|
|
|
|
/*
|
|
* The ACPI processor driver for ACPI core code needs this macro
|
|
* to find out this cpu was already mapped (mapping from CPU hardware
|
|
* ID to CPU logical ID) or not.
|
|
*/
|
|
#define cpu_physical_id(cpu) cpu_logical_map(cpu)
|
|
|
|
/*
|
|
* It's used from ACPI core in kdump to boot UP system with SMP kernel,
|
|
* with this check the ACPI core will not override the CPU index
|
|
* obtained from GICC with 0 and not print some error message as well.
|
|
* Since MADT must provide at least one GICC structure for GIC
|
|
* initialization, CPU will be always available in MADT on ARM64.
|
|
*/
|
|
static inline bool acpi_has_cpu_in_madt(void)
|
|
{
|
|
return true;
|
|
}
|
|
|
|
static inline void arch_fix_phys_package_id(int num, u32 slot) { }
|
|
void __init acpi_init_cpus(void);
|
|
|
|
#else
|
|
static inline void acpi_init_cpus(void) { }
|
|
#endif /* CONFIG_ACPI */
|
|
|
|
static inline const char *acpi_get_enable_method(int cpu)
|
|
{
|
|
return acpi_psci_present() ? "psci" : NULL;
|
|
}
|
|
#endif /*_ASM_ACPI_H*/
|