@@ -202,21 +202,44 @@ static void acpi_state_timer_broadcast(struct acpi_processor *pr,
202202 * Suspend / resume control
203203 */
204204static int acpi_idle_suspend ;
205+ static u32 saved_bm_rld ;
206+
207+ static void acpi_idle_bm_rld_save (void )
208+ {
209+ acpi_read_bit_register (ACPI_BITREG_BUS_MASTER_RLD , & saved_bm_rld );
210+ }
211+ static void acpi_idle_bm_rld_restore (void )
212+ {
213+ u32 resumed_bm_rld ;
214+
215+ acpi_read_bit_register (ACPI_BITREG_BUS_MASTER_RLD , & resumed_bm_rld );
216+
217+ if (resumed_bm_rld != saved_bm_rld )
218+ acpi_write_bit_register (ACPI_BITREG_BUS_MASTER_RLD , saved_bm_rld );
219+ }
205220
206221int acpi_processor_suspend (struct acpi_device * device , pm_message_t state )
207222{
223+ if (acpi_idle_suspend == 1 )
224+ return 0 ;
225+
226+ acpi_idle_bm_rld_save ();
208227 acpi_idle_suspend = 1 ;
209228 return 0 ;
210229}
211230
212231int acpi_processor_resume (struct acpi_device * device )
213232{
233+ if (acpi_idle_suspend == 0 )
234+ return 0 ;
235+
236+ acpi_idle_bm_rld_restore ();
214237 acpi_idle_suspend = 0 ;
215238 return 0 ;
216239}
217240
218241#if defined (CONFIG_GENERIC_TIME ) && defined (CONFIG_X86 )
219- static int tsc_halts_in_c (int state )
242+ static void tsc_check_state (int state )
220243{
221244 switch (boot_cpu_data .x86_vendor ) {
222245 case X86_VENDOR_AMD :
@@ -226,13 +249,17 @@ static int tsc_halts_in_c(int state)
226249 * C/P/S0/S1 states when this bit is set.
227250 */
228251 if (boot_cpu_has (X86_FEATURE_NONSTOP_TSC ))
229- return 0 ;
252+ return ;
230253
231254 /*FALL THROUGH*/
232255 default :
233- return state > ACPI_STATE_C1 ;
256+ /* TSC could halt in idle, so notify users */
257+ if (state > ACPI_STATE_C1 )
258+ mark_tsc_unstable ("TSC halts in idle" );
234259 }
235260}
261+ #else
262+ static void tsc_check_state (int state ) { return ; }
236263#endif
237264
238265static int acpi_processor_get_power_info_fadt (struct acpi_processor * pr )
@@ -578,14 +605,9 @@ static int acpi_processor_power_verify(struct acpi_processor *pr)
578605
579606 pr -> power .timer_broadcast_on_state = INT_MAX ;
580607
581- for (i = 1 ; i < ACPI_PROCESSOR_MAX_POWER ; i ++ ) {
608+ for (i = 1 ; i < ACPI_PROCESSOR_MAX_POWER && i <= max_cstate ; i ++ ) {
582609 struct acpi_processor_cx * cx = & pr -> power .states [i ];
583610
584- #if defined (CONFIG_GENERIC_TIME ) && defined (CONFIG_X86 )
585- /* TSC could halt in idle, so notify users */
586- if (tsc_halts_in_c (cx -> type ))
587- mark_tsc_unstable ("TSC halts in idle" );;
588- #endif
589611 switch (cx -> type ) {
590612 case ACPI_STATE_C1 :
591613 cx -> valid = 1 ;
@@ -603,6 +625,8 @@ static int acpi_processor_power_verify(struct acpi_processor *pr)
603625 acpi_timer_check_state (i , pr , cx );
604626 break ;
605627 }
628+ if (cx -> valid )
629+ tsc_check_state (cx -> type );
606630
607631 if (cx -> valid )
608632 working ++ ;
0 commit comments