status = acpi_hw_enable_all_wakeup_gpes (ACPI_ISR); 
status = acpi_hw_enable_all_wakeup_gpes (); 
acpi_enter_sleep_state (	u8                              sleep_state){	u32                             PM1Acontrol;	u32                             PM1Bcontrol;	struct acpi_bit_register_info   *sleep_type_reg_info;	struct acpi_bit_register_info   *sleep_enable_reg_info;	u32                             in_value;	acpi_status                     status;	ACPI_FUNCTION_TRACE ("acpi_enter_sleep_state");	if ((acpi_gbl_sleep_type_a > ACPI_SLEEP_TYPE_MAX) ||		(acpi_gbl_sleep_type_b > ACPI_SLEEP_TYPE_MAX)) {		ACPI_REPORT_ERROR (("Sleep values out of range: A=%X B=%X\n",			acpi_gbl_sleep_type_a, acpi_gbl_sleep_type_b));		return_ACPI_STATUS (AE_AML_OPERAND_VALUE);	}	sleep_type_reg_info = acpi_hw_get_bit_register_info (ACPI_BITREG_SLEEP_TYPE_A);	sleep_enable_reg_info = acpi_hw_get_bit_register_info (ACPI_BITREG_SLEEP_ENABLE);	/* Clear wake status */	status = acpi_set_register (ACPI_BITREG_WAKE_STATUS, 1, ACPI_MTX_DO_NOT_LOCK);	if (ACPI_FAILURE (status)) {		return_ACPI_STATUS (status);	}	/* Clear all fixed and general purpose status bits */	status = acpi_hw_clear_acpi_status (ACPI_MTX_DO_NOT_LOCK);	if (ACPI_FAILURE (status)) {		return_ACPI_STATUS (status);	}	/*	 * 1) Disable/Clear all GPEs	 * 2) Enable all wakeup GPEs	 */	status = acpi_hw_disable_all_gpes (ACPI_ISR);	if (ACPI_FAILURE (status)) {		return_ACPI_STATUS (status);	}	acpi_gbl_system_awake_and_running = FALSE;	status = acpi_hw_enable_all_wakeup_gpes (ACPI_ISR);	if (ACPI_FAILURE (status)) {		return_ACPI_STATUS (status);	}	/* Get current value of PM1A control */	status = acpi_hw_register_read (ACPI_MTX_DO_NOT_LOCK,			 ACPI_REGISTER_PM1_CONTROL, &PM1Acontrol);	if (ACPI_FAILURE (status)) {		return_ACPI_STATUS (status);	}	ACPI_DEBUG_PRINT ((ACPI_DB_INIT,		"Entering sleep state [S%d]\n", sleep_state));	/* Clear SLP_EN and SLP_TYP fields */	PM1Acontrol &= ~(sleep_type_reg_info->access_bit_mask |			   sleep_enable_reg_info->access_bit_mask);	PM1Bcontrol = PM1Acontrol;	/* Insert SLP_TYP bits */	PM1Acontrol |= (acpi_gbl_sleep_type_a << sleep_type_reg_info->bit_position);	PM1Bcontrol |= (acpi_gbl_sleep_type_b << sleep_type_reg_info->bit_position);	/*	 * We split the writes of SLP_TYP and SLP_EN to workaround	 * poorly implemented hardware.	 */	/* Write #1: fill in SLP_TYP data */	status = acpi_hw_register_write (ACPI_MTX_DO_NOT_LOCK,			 ACPI_REGISTER_PM1A_CONTROL, PM1Acontrol);	if (ACPI_FAILURE (status)) {		return_ACPI_STATUS (status);	}	status = acpi_hw_register_write (ACPI_MTX_DO_NOT_LOCK,			 ACPI_REGISTER_PM1B_CONTROL, PM1Bcontrol);	if (ACPI_FAILURE (status)) {		return_ACPI_STATUS (status);	}	/* Insert SLP_ENABLE bit */	PM1Acontrol |= sleep_enable_reg_info->access_bit_mask;	PM1Bcontrol |= sleep_enable_reg_info->access_bit_mask;	/* Write #2: SLP_TYP + SLP_EN */	ACPI_FLUSH_CPU_CACHE ();	status = acpi_hw_register_write (ACPI_MTX_DO_NOT_LOCK,			 ACPI_REGISTER_PM1A_CONTROL, PM1Acontrol);	if (ACPI_FAILURE (status)) {		return_ACPI_STATUS (status);	}	status = acpi_hw_register_write (ACPI_MTX_DO_NOT_LOCK,			 ACPI_REGISTER_PM1B_CONTROL, PM1Bcontrol);	if (ACPI_FAILURE (status)) {		return_ACPI_STATUS (status);	}	if (sleep_state > ACPI_STATE_S3) {		/*		 * We wanted to sleep > S3, but it didn't happen (by virtue of the		 * fact that we are still executing!)		 *		 * Wait ten seconds, then try again. This is to get S4/S5 to work on		 * all machines.		 *		 * We wait so long to allow chipsets that poll this reg very slowly to		 * still read the right value. Ideally, this block would go		 * away entirely.		 */		acpi_os_stall (10000000);		status = acpi_hw_register_write (ACPI_MTX_DO_NOT_LOCK,				 ACPI_REGISTER_PM1_CONTROL,				 sleep_enable_reg_info->access_bit_mask);		if (ACPI_FAILURE (status)) {			return_ACPI_STATUS (status);		}	}	/* Wait until we enter sleep state */	do {		status = acpi_get_register (ACPI_BITREG_WAKE_STATUS, &in_value,			ACPI_MTX_DO_NOT_LOCK);		if (ACPI_FAILURE (status)) {			return_ACPI_STATUS (status);		}		/* Spin until we wake */	} while (!in_value);	return_ACPI_STATUS (AE_OK);}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/73459f73e5d1602c59ebec114fc45185521353c1/hwsleep.c/clean/drivers/acpi/hardware/hwsleep.c