Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
at v6.12 99 lines 2.6 kB view raw
1/* SPDX-License-Identifier: GPL-2.0-only */ 2/* 3 * Copyright (C) 2013-2014, Linaro Ltd. 4 * Author: Al Stone <al.stone@linaro.org> 5 * Author: Graeme Gregory <graeme.gregory@linaro.org> 6 * Author: Hanjun Guo <hanjun.guo@linaro.org> 7 * 8 * Copyright (C) 2021-2023, Ventana Micro Systems Inc. 9 * Author: Sunil V L <sunilvl@ventanamicro.com> 10 */ 11 12#ifndef _ASM_ACPI_H 13#define _ASM_ACPI_H 14 15/* Basic configuration for ACPI */ 16#ifdef CONFIG_ACPI 17 18typedef u64 phys_cpuid_t; 19#define PHYS_CPUID_INVALID INVALID_HARTID 20 21/* ACPI table mapping after acpi_permanent_mmap is set */ 22void __iomem *acpi_os_ioremap(acpi_physical_address phys, acpi_size size); 23#define acpi_os_ioremap acpi_os_ioremap 24 25#define acpi_strict 1 /* No out-of-spec workarounds on RISC-V */ 26extern int acpi_disabled; 27extern int acpi_noirq; 28extern int acpi_pci_disabled; 29 30static inline void disable_acpi(void) 31{ 32 acpi_disabled = 1; 33 acpi_pci_disabled = 1; 34 acpi_noirq = 1; 35} 36 37static inline void enable_acpi(void) 38{ 39 acpi_disabled = 0; 40 acpi_pci_disabled = 0; 41 acpi_noirq = 0; 42} 43 44/* 45 * The ACPI processor driver for ACPI core code needs this macro 46 * to find out whether this cpu was already mapped (mapping from CPU hardware 47 * ID to CPU logical ID) or not. 48 */ 49#define cpu_physical_id(cpu) cpuid_to_hartid_map(cpu) 50 51/* 52 * Since MADT must provide at least one RINTC structure, the 53 * CPU will be always available in MADT on RISC-V. 54 */ 55static inline bool acpi_has_cpu_in_madt(void) 56{ 57 return true; 58} 59 60static inline void arch_fix_phys_package_id(int num, u32 slot) { } 61 62void acpi_init_rintc_map(void); 63struct acpi_madt_rintc *acpi_cpu_get_madt_rintc(int cpu); 64static inline u32 get_acpi_id_for_cpu(int cpu) 65{ 66 return acpi_cpu_get_madt_rintc(cpu)->uid; 67} 68 69int acpi_get_riscv_isa(struct acpi_table_header *table, 70 unsigned int cpu, const char **isa); 71 72void acpi_get_cbo_block_size(struct acpi_table_header *table, u32 *cbom_size, 73 u32 *cboz_size, u32 *cbop_size); 74#else 75static inline void acpi_init_rintc_map(void) { } 76static inline struct acpi_madt_rintc *acpi_cpu_get_madt_rintc(int cpu) 77{ 78 return NULL; 79} 80 81static inline int acpi_get_riscv_isa(struct acpi_table_header *table, 82 unsigned int cpu, const char **isa) 83{ 84 return -EINVAL; 85} 86 87static inline void acpi_get_cbo_block_size(struct acpi_table_header *table, 88 u32 *cbom_size, u32 *cboz_size, 89 u32 *cbop_size) { } 90 91#endif /* CONFIG_ACPI */ 92 93#ifdef CONFIG_ACPI_NUMA 94void acpi_map_cpus_to_nodes(void); 95#else 96static inline void acpi_map_cpus_to_nodes(void) { } 97#endif /* CONFIG_ACPI_NUMA */ 98 99#endif /*_ASM_ACPI_H*/