xref: /openbmc/linux/arch/loongarch/include/asm/acpi.h (revision 4b7444ff)
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 #ifdef CONFIG_ACPI
12 extern int acpi_strict;
13 extern int acpi_disabled;
14 extern int acpi_pci_disabled;
15 extern int acpi_noirq;
16 
17 #define acpi_os_ioremap acpi_os_ioremap
18 void __init __iomem *acpi_os_ioremap(acpi_physical_address phys, acpi_size size);
19 
20 static inline void disable_acpi(void)
21 {
22 	acpi_disabled = 1;
23 	acpi_pci_disabled = 1;
24 	acpi_noirq = 1;
25 }
26 
27 static inline bool acpi_has_cpu_in_madt(void)
28 {
29 	return true;
30 }
31 
32 extern struct list_head acpi_wakeup_device_list;
33 
34 /*
35  * Temporary definitions until the core ACPICA code gets updated (see
36  * 1656837932-18257-1-git-send-email-lvjianmin@loongson.cn and its
37  * follow-ups for the "rationale").
38  *
39  * Once the "legal reasons" are cleared and that the code is merged,
40  * this can be dropped entierely.
41  */
42 #if (ACPI_CA_VERSION == 0x20220331 && !defined(LOONGARCH_ACPICA_EXT))
43 
44 #define LOONGARCH_ACPICA_EXT	1
45 
46 #define	ACPI_MADT_TYPE_CORE_PIC		17
47 #define	ACPI_MADT_TYPE_LIO_PIC		18
48 #define	ACPI_MADT_TYPE_HT_PIC		19
49 #define	ACPI_MADT_TYPE_EIO_PIC		20
50 #define	ACPI_MADT_TYPE_MSI_PIC		21
51 #define	ACPI_MADT_TYPE_BIO_PIC		22
52 #define	ACPI_MADT_TYPE_LPC_PIC		23
53 
54 /* Values for Version field above */
55 
56 enum acpi_madt_core_pic_version {
57 	ACPI_MADT_CORE_PIC_VERSION_NONE = 0,
58 	ACPI_MADT_CORE_PIC_VERSION_V1 = 1,
59 	ACPI_MADT_CORE_PIC_VERSION_RESERVED = 2	/* 2 and greater are reserved */
60 };
61 
62 enum acpi_madt_lio_pic_version {
63 	ACPI_MADT_LIO_PIC_VERSION_NONE = 0,
64 	ACPI_MADT_LIO_PIC_VERSION_V1 = 1,
65 	ACPI_MADT_LIO_PIC_VERSION_RESERVED = 2	/* 2 and greater are reserved */
66 };
67 
68 enum acpi_madt_eio_pic_version {
69 	ACPI_MADT_EIO_PIC_VERSION_NONE = 0,
70 	ACPI_MADT_EIO_PIC_VERSION_V1 = 1,
71 	ACPI_MADT_EIO_PIC_VERSION_RESERVED = 2	/* 2 and greater are reserved */
72 };
73 
74 enum acpi_madt_ht_pic_version {
75 	ACPI_MADT_HT_PIC_VERSION_NONE = 0,
76 	ACPI_MADT_HT_PIC_VERSION_V1 = 1,
77 	ACPI_MADT_HT_PIC_VERSION_RESERVED = 2	/* 2 and greater are reserved */
78 };
79 
80 enum acpi_madt_bio_pic_version {
81 	ACPI_MADT_BIO_PIC_VERSION_NONE = 0,
82 	ACPI_MADT_BIO_PIC_VERSION_V1 = 1,
83 	ACPI_MADT_BIO_PIC_VERSION_RESERVED = 2	/* 2 and greater are reserved */
84 };
85 
86 enum acpi_madt_msi_pic_version {
87 	ACPI_MADT_MSI_PIC_VERSION_NONE = 0,
88 	ACPI_MADT_MSI_PIC_VERSION_V1 = 1,
89 	ACPI_MADT_MSI_PIC_VERSION_RESERVED = 2	/* 2 and greater are reserved */
90 };
91 
92 enum acpi_madt_lpc_pic_version {
93 	ACPI_MADT_LPC_PIC_VERSION_NONE = 0,
94 	ACPI_MADT_LPC_PIC_VERSION_V1 = 1,
95 	ACPI_MADT_LPC_PIC_VERSION_RESERVED = 2	/* 2 and greater are reserved */
96 };
97 
98 #pragma pack(1)
99 
100 /* Core Interrupt Controller */
101 
102 struct acpi_madt_core_pic {
103 	struct acpi_subtable_header header;
104 	u8 version;
105 	u32 processor_id;
106 	u32 core_id;
107 	u32 flags;
108 };
109 
110 /* Legacy I/O Interrupt Controller */
111 
112 struct acpi_madt_lio_pic {
113 	struct acpi_subtable_header header;
114 	u8 version;
115 	u64 address;
116 	u16 size;
117 	u8 cascade[2];
118 	u32 cascade_map[2];
119 };
120 
121 /* Extend I/O Interrupt Controller */
122 
123 struct acpi_madt_eio_pic {
124 	struct acpi_subtable_header header;
125 	u8 version;
126 	u8 cascade;
127 	u8 node;
128 	u64 node_map;
129 };
130 
131 /* HT Interrupt Controller */
132 
133 struct acpi_madt_ht_pic {
134 	struct acpi_subtable_header header;
135 	u8 version;
136 	u64 address;
137 	u16 size;
138 	u8 cascade[8];
139 };
140 
141 /* Bridge I/O Interrupt Controller */
142 
143 struct acpi_madt_bio_pic {
144 	struct acpi_subtable_header header;
145 	u8 version;
146 	u64 address;
147 	u16 size;
148 	u16 id;
149 	u16 gsi_base;
150 };
151 
152 /* MSI Interrupt Controller */
153 
154 struct acpi_madt_msi_pic {
155 	struct acpi_subtable_header header;
156 	u8 version;
157 	u64 msg_address;
158 	u32 start;
159 	u32 count;
160 };
161 
162 /* LPC Interrupt Controller */
163 
164 struct acpi_madt_lpc_pic {
165 	struct acpi_subtable_header header;
166 	u8 version;
167 	u64 address;
168 	u16 size;
169 	u8 cascade;
170 };
171 
172 #pragma pack()
173 
174 #endif
175 
176 #endif /* !CONFIG_ACPI */
177 
178 #define ACPI_TABLE_UPGRADE_MAX_PHYS ARCH_LOW_ADDRESS_LIMIT
179 
180 #endif /* _ASM_LOONGARCH_ACPI_H */
181