forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-05-10 23fa18eaa71266feff7ba8d83022d9e1cc83c65a
kernel/drivers/acpi/acpica/evgpeinit.c
....@@ -3,7 +3,7 @@
33 *
44 * Module Name: evgpeinit - System GPE initialization and update
55 *
6
- * Copyright (C) 2000 - 2018, Intel Corp.
6
+ * Copyright (C) 2000 - 2020, Intel Corp.
77 *
88 *****************************************************************************/
99
....@@ -32,6 +32,16 @@
3232 * kernel boot time as well.
3333 */
3434
35
+#ifdef ACPI_GPE_USE_LOGICAL_ADDRESSES
36
+#define ACPI_FADT_GPE_BLOCK_ADDRESS(N) \
37
+ acpi_gbl_FADT.xgpe##N##_block.space_id == \
38
+ ACPI_ADR_SPACE_SYSTEM_MEMORY ? \
39
+ (u64)acpi_gbl_xgpe##N##_block_logical_address : \
40
+ acpi_gbl_FADT.xgpe##N##_block.address
41
+#else
42
+#define ACPI_FADT_GPE_BLOCK_ADDRESS(N) acpi_gbl_FADT.xgpe##N##_block.address
43
+#endif /* ACPI_GPE_USE_LOGICAL_ADDRESSES */
44
+
3545 /*******************************************************************************
3646 *
3747 * FUNCTION: acpi_ev_gpe_initialize
....@@ -49,6 +59,7 @@
4959 u32 register_count1 = 0;
5060 u32 gpe_number_max = 0;
5161 acpi_status status;
62
+ u64 address;
5263
5364 ACPI_FUNCTION_TRACE(ev_gpe_initialize);
5465
....@@ -85,8 +96,9 @@
8596 * If EITHER the register length OR the block address are zero, then that
8697 * particular block is not supported.
8798 */
88
- if (acpi_gbl_FADT.gpe0_block_length &&
89
- acpi_gbl_FADT.xgpe0_block.address) {
99
+ address = ACPI_FADT_GPE_BLOCK_ADDRESS(0);
100
+
101
+ if (acpi_gbl_FADT.gpe0_block_length && address) {
90102
91103 /* GPE block 0 exists (has both length and address > 0) */
92104
....@@ -97,7 +109,6 @@
97109 /* Install GPE Block 0 */
98110
99111 status = acpi_ev_create_gpe_block(acpi_gbl_fadt_gpe_device,
100
- acpi_gbl_FADT.xgpe0_block.
101112 address,
102113 acpi_gbl_FADT.xgpe0_block.
103114 space_id, register_count0, 0,
....@@ -110,8 +121,9 @@
110121 }
111122 }
112123
113
- if (acpi_gbl_FADT.gpe1_block_length &&
114
- acpi_gbl_FADT.xgpe1_block.address) {
124
+ address = ACPI_FADT_GPE_BLOCK_ADDRESS(1);
125
+
126
+ if (acpi_gbl_FADT.gpe1_block_length && address) {
115127
116128 /* GPE block 1 exists (has both length and address > 0) */
117129
....@@ -137,7 +149,6 @@
137149
138150 status =
139151 acpi_ev_create_gpe_block(acpi_gbl_fadt_gpe_device,
140
- acpi_gbl_FADT.xgpe1_block.
141152 address,
142153 acpi_gbl_FADT.xgpe1_block.
143154 space_id, register_count1,
....@@ -156,8 +167,6 @@
156167 * GPE0 and GPE1 do not have to be contiguous in the GPE number
157168 * space. However, GPE0 always starts at GPE number zero.
158169 */
159
- gpe_number_max = acpi_gbl_FADT.gpe1_base +
160
- ((register_count1 * ACPI_GPE_REGISTER_WIDTH) - 1);
161170 }
162171 }
163172
....@@ -169,7 +178,6 @@
169178
170179 ACPI_DEBUG_PRINT((ACPI_DB_INIT,
171180 "There are no GPE blocks defined in the FADT\n"));
172
- status = AE_OK;
173181 goto cleanup;
174182 }
175183
....@@ -292,7 +300,7 @@
292300 acpi_status status;
293301 u32 gpe_number;
294302 u8 temp_gpe_number;
295
- char name[ACPI_NAME_SIZE + 1];
303
+ char name[ACPI_NAMESEG_SIZE + 1];
296304 u8 type;
297305
298306 ACPI_FUNCTION_TRACE(ev_match_gpe_method);
....@@ -310,7 +318,7 @@
310318 * 1) Extract the method name and null terminate it
311319 */
312320 ACPI_MOVE_32_TO_32(name, &method_node->name.integer);
313
- name[ACPI_NAME_SIZE] = 0;
321
+ name[ACPI_NAMESEG_SIZE] = 0;
314322
315323 /* 2) Name must begin with an underscore */
316324