forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-01-31 f70575805708cabdedea7498aaa3f710fde4d920
kernel/drivers/acpi/acpica/hwxfsleep.c
....@@ -3,7 +3,7 @@
33 *
44 * Name: hwxfsleep.c - ACPI Hardware Sleep/Wake External Interfaces
55 *
6
- * Copyright (C) 2000 - 2018, Intel Corp.
6
+ * Copyright (C) 2000 - 2020, Intel Corp.
77 *
88 *****************************************************************************/
99
....@@ -22,33 +22,6 @@
2222 acpi_physical_address physical_address,
2323 acpi_physical_address physical_address64);
2424 #endif
25
-
26
-static acpi_status acpi_hw_sleep_dispatch(u8 sleep_state, u32 function_id);
27
-
28
-/*
29
- * Dispatch table used to efficiently branch to the various sleep
30
- * functions.
31
- */
32
-#define ACPI_SLEEP_FUNCTION_ID 0
33
-#define ACPI_WAKE_PREP_FUNCTION_ID 1
34
-#define ACPI_WAKE_FUNCTION_ID 2
35
-
36
-/* Legacy functions are optional, based upon ACPI_REDUCED_HARDWARE */
37
-
38
-static struct acpi_sleep_functions acpi_sleep_dispatch[] = {
39
- {ACPI_STRUCT_INIT(legacy_function,
40
- ACPI_HW_OPTIONAL_FUNCTION(acpi_hw_legacy_sleep)),
41
- ACPI_STRUCT_INIT(extended_function,
42
- acpi_hw_extended_sleep)},
43
- {ACPI_STRUCT_INIT(legacy_function,
44
- ACPI_HW_OPTIONAL_FUNCTION(acpi_hw_legacy_wake_prep)),
45
- ACPI_STRUCT_INIT(extended_function,
46
- acpi_hw_extended_wake_prep)},
47
- {ACPI_STRUCT_INIT(legacy_function,
48
- ACPI_HW_OPTIONAL_FUNCTION(acpi_hw_legacy_wake)),
49
- ACPI_STRUCT_INIT(extended_function,
50
- acpi_hw_extended_wake)}
51
-};
5225
5326 /*
5427 * These functions are removed for the ACPI_REDUCED_HARDWARE case:
....@@ -191,6 +164,9 @@
191164
192165 status = acpi_hw_write_port(acpi_gbl_FADT.smi_command,
193166 (u32)acpi_gbl_FADT.s4_bios_request, 8);
167
+ if (ACPI_FAILURE(status)) {
168
+ return_ACPI_STATUS(status);
169
+ }
194170
195171 do {
196172 acpi_os_stall(ACPI_USEC_PER_MSEC);
....@@ -207,53 +183,6 @@
207183
208184 ACPI_EXPORT_SYMBOL(acpi_enter_sleep_state_s4bios)
209185 #endif /* !ACPI_REDUCED_HARDWARE */
210
-/*******************************************************************************
211
- *
212
- * FUNCTION: acpi_hw_sleep_dispatch
213
- *
214
- * PARAMETERS: sleep_state - Which sleep state to enter/exit
215
- * function_id - Sleep, wake_prep, or Wake
216
- *
217
- * RETURN: Status from the invoked sleep handling function.
218
- *
219
- * DESCRIPTION: Dispatch a sleep/wake request to the appropriate handling
220
- * function.
221
- *
222
- ******************************************************************************/
223
-static acpi_status acpi_hw_sleep_dispatch(u8 sleep_state, u32 function_id)
224
-{
225
- acpi_status status;
226
- struct acpi_sleep_functions *sleep_functions =
227
- &acpi_sleep_dispatch[function_id];
228
-
229
-#if (!ACPI_REDUCED_HARDWARE)
230
- /*
231
- * If the Hardware Reduced flag is set (from the FADT), we must
232
- * use the extended sleep registers (FADT). Note: As per the ACPI
233
- * specification, these extended registers are to be used for HW-reduced
234
- * platforms only. They are not general-purpose replacements for the
235
- * legacy PM register sleep support.
236
- */
237
- if (acpi_gbl_reduced_hardware) {
238
- status = sleep_functions->extended_function(sleep_state);
239
- } else {
240
- /* Legacy sleep */
241
-
242
- status = sleep_functions->legacy_function(sleep_state);
243
- }
244
-
245
- return (status);
246
-
247
-#else
248
- /*
249
- * For the case where reduced-hardware-only code is being generated,
250
- * we know that only the extended sleep registers are available
251
- */
252
- status = sleep_functions->extended_function(sleep_state);
253
- return (status);
254
-
255
-#endif /* !ACPI_REDUCED_HARDWARE */
256
-}
257186
258187 /*******************************************************************************
259188 *
....@@ -367,7 +296,12 @@
367296 return_ACPI_STATUS(AE_AML_OPERAND_VALUE);
368297 }
369298
370
- status = acpi_hw_sleep_dispatch(sleep_state, ACPI_SLEEP_FUNCTION_ID);
299
+#if !ACPI_REDUCED_HARDWARE
300
+ if (!acpi_gbl_reduced_hardware)
301
+ status = acpi_hw_legacy_sleep(sleep_state);
302
+ else
303
+#endif
304
+ status = acpi_hw_extended_sleep(sleep_state);
371305 return_ACPI_STATUS(status);
372306 }
373307
....@@ -393,8 +327,12 @@
393327
394328 ACPI_FUNCTION_TRACE(acpi_leave_sleep_state_prep);
395329
396
- status =
397
- acpi_hw_sleep_dispatch(sleep_state, ACPI_WAKE_PREP_FUNCTION_ID);
330
+#if !ACPI_REDUCED_HARDWARE
331
+ if (!acpi_gbl_reduced_hardware)
332
+ status = acpi_hw_legacy_wake_prep(sleep_state);
333
+ else
334
+#endif
335
+ status = acpi_hw_extended_wake_prep(sleep_state);
398336 return_ACPI_STATUS(status);
399337 }
400338
....@@ -418,7 +356,12 @@
418356
419357 ACPI_FUNCTION_TRACE(acpi_leave_sleep_state);
420358
421
- status = acpi_hw_sleep_dispatch(sleep_state, ACPI_WAKE_FUNCTION_ID);
359
+#if !ACPI_REDUCED_HARDWARE
360
+ if (!acpi_gbl_reduced_hardware)
361
+ status = acpi_hw_legacy_wake(sleep_state);
362
+ else
363
+#endif
364
+ status = acpi_hw_extended_wake(sleep_state);
422365 return_ACPI_STATUS(status);
423366 }
424367