1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3  * Copyright (C) 2020 Loongson Technology Corporation Limited
4  * Author: Jianmin Lv <lvjianmin@loongson.cn>
5  *         Huacai Chen <chenhuacai@loongson.cn>
6  *
7  * This program is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License version 2 as
9  * published by the Free Software Foundation.
10  */
11 
12 #ifndef _ASM_LOONGARCH_ACPI_H
13 #define _ASM_LOONGARCH_ACPI_H
14 
15 #ifdef CONFIG_ACPI
16 extern int acpi_strict;
17 extern int acpi_disabled;
18 extern int acpi_pci_disabled;
19 extern int acpi_noirq;
20 extern int pptt_enabled;
21 
22 #define acpi_os_ioremap acpi_os_ioremap
23 void __iomem *acpi_os_ioremap(acpi_physical_address phys, acpi_size size);
24 
disable_acpi(void)25 static inline void disable_acpi(void)
26 {
27 	acpi_disabled = 1;
28 	acpi_pci_disabled = 1;
29 	acpi_noirq = 1;
30 }
31 
acpi_has_cpu_in_madt(void)32 static inline bool acpi_has_cpu_in_madt(void)
33 {
34 	return true;
35 }
36 
37 #define MAX_CORE_PIC 256
38 
39 extern struct list_head acpi_wakeup_device_list;
40 extern struct acpi_madt_core_pic acpi_core_pic[MAX_CORE_PIC];
41 
42 extern int __init parse_acpi_topology(void);
43 
get_acpi_id_for_cpu(unsigned int cpu)44 static inline u32 get_acpi_id_for_cpu(unsigned int cpu)
45 {
46 	return acpi_core_pic[cpu_logical_map(cpu)].processor_id;
47 }
48 
49 #endif /* !CONFIG_ACPI */
50 
51 #define ACPI_TABLE_UPGRADE_MAX_PHYS ARCH_LOW_ADDRESS_LIMIT
52 
53 extern int loongarch_acpi_suspend(void);
54 extern int (*acpi_suspend_lowlevel)(void);
55 extern void loongarch_suspend_enter(void);
56 
acpi_get_wakeup_address(void)57 static inline unsigned long acpi_get_wakeup_address(void)
58 {
59 #ifdef CONFIG_SUSPEND
60 	extern void loongarch_wakeup_start(void);
61 	return (unsigned long)loongarch_wakeup_start;
62 #endif
63 	return 0UL;
64 }
65 
66 #endif /* _ASM_LOONGARCH_ACPI_H */
67