| .. | .. |
|---|
| 3 | 3 | * |
|---|
| 4 | 4 | * Name: hwxfsleep.c - ACPI Hardware Sleep/Wake External Interfaces |
|---|
| 5 | 5 | * |
|---|
| 6 | | - * Copyright (C) 2000 - 2018, Intel Corp. |
|---|
| 6 | + * Copyright (C) 2000 - 2020, Intel Corp. |
|---|
| 7 | 7 | * |
|---|
| 8 | 8 | *****************************************************************************/ |
|---|
| 9 | 9 | |
|---|
| .. | .. |
|---|
| 22 | 22 | acpi_physical_address physical_address, |
|---|
| 23 | 23 | acpi_physical_address physical_address64); |
|---|
| 24 | 24 | #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 | | -}; |
|---|
| 52 | 25 | |
|---|
| 53 | 26 | /* |
|---|
| 54 | 27 | * These functions are removed for the ACPI_REDUCED_HARDWARE case: |
|---|
| .. | .. |
|---|
| 191 | 164 | |
|---|
| 192 | 165 | status = acpi_hw_write_port(acpi_gbl_FADT.smi_command, |
|---|
| 193 | 166 | (u32)acpi_gbl_FADT.s4_bios_request, 8); |
|---|
| 167 | + if (ACPI_FAILURE(status)) { |
|---|
| 168 | + return_ACPI_STATUS(status); |
|---|
| 169 | + } |
|---|
| 194 | 170 | |
|---|
| 195 | 171 | do { |
|---|
| 196 | 172 | acpi_os_stall(ACPI_USEC_PER_MSEC); |
|---|
| .. | .. |
|---|
| 207 | 183 | |
|---|
| 208 | 184 | ACPI_EXPORT_SYMBOL(acpi_enter_sleep_state_s4bios) |
|---|
| 209 | 185 | #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 | | -} |
|---|
| 257 | 186 | |
|---|
| 258 | 187 | /******************************************************************************* |
|---|
| 259 | 188 | * |
|---|
| .. | .. |
|---|
| 367 | 296 | return_ACPI_STATUS(AE_AML_OPERAND_VALUE); |
|---|
| 368 | 297 | } |
|---|
| 369 | 298 | |
|---|
| 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); |
|---|
| 371 | 305 | return_ACPI_STATUS(status); |
|---|
| 372 | 306 | } |
|---|
| 373 | 307 | |
|---|
| .. | .. |
|---|
| 393 | 327 | |
|---|
| 394 | 328 | ACPI_FUNCTION_TRACE(acpi_leave_sleep_state_prep); |
|---|
| 395 | 329 | |
|---|
| 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); |
|---|
| 398 | 336 | return_ACPI_STATUS(status); |
|---|
| 399 | 337 | } |
|---|
| 400 | 338 | |
|---|
| .. | .. |
|---|
| 418 | 356 | |
|---|
| 419 | 357 | ACPI_FUNCTION_TRACE(acpi_leave_sleep_state); |
|---|
| 420 | 358 | |
|---|
| 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); |
|---|
| 422 | 365 | return_ACPI_STATUS(status); |
|---|
| 423 | 366 | } |
|---|
| 424 | 367 | |
|---|