xref: /openbmc/linux/arch/loongarch/include/asm/acpi.h (revision 5de4a619)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3  * Author: Jianmin Lv <lvjianmin@loongson.cn>
4  *         Huacai Chen <chenhuacai@loongson.cn>
5  * Copyright (C) 2020-2022 Loongson Technology Corporation Limited
6  */
7 
8 #ifndef _ASM_LOONGARCH_ACPI_H
9 #define _ASM_LOONGARCH_ACPI_H
10 
11 #include <asm/suspend.h>
12 
13 #ifdef CONFIG_ACPI
14 extern int acpi_strict;
15 extern int acpi_disabled;
16 extern int acpi_pci_disabled;
17 extern int acpi_noirq;
18 extern int pptt_enabled;
19 
20 #define acpi_os_ioremap acpi_os_ioremap
21 void __iomem *acpi_os_ioremap(acpi_physical_address phys, acpi_size size);
22 
23 static inline void disable_acpi(void)
24 {
25 	acpi_disabled = 1;
26 	acpi_pci_disabled = 1;
27 	acpi_noirq = 1;
28 }
29 
30 static inline bool acpi_has_cpu_in_madt(void)
31 {
32 	return true;
33 }
34 
35 extern struct list_head acpi_wakeup_device_list;
36 extern struct acpi_madt_core_pic acpi_core_pic[NR_CPUS];
37 
38 extern int __init parse_acpi_topology(void);
39 
40 static inline u32 get_acpi_id_for_cpu(unsigned int cpu)
41 {
42 	return acpi_core_pic[cpu_logical_map(cpu)].processor_id;
43 }
44 
45 #endif /* !CONFIG_ACPI */
46 
47 #define ACPI_TABLE_UPGRADE_MAX_PHYS ARCH_LOW_ADDRESS_LIMIT
48 
49 extern int loongarch_acpi_suspend(void);
50 extern int (*acpi_suspend_lowlevel)(void);
51 
52 static inline unsigned long acpi_get_wakeup_address(void)
53 {
54 #ifdef CONFIG_SUSPEND
55 	return (unsigned long)loongarch_wakeup_start;
56 #endif
57 	return 0UL;
58 }
59 
60 #endif /* _ASM_LOONGARCH_ACPI_H */
61