/* This function executes the _PS0/_PS3 ACPI method to set the power state. ACPI spec requires _PS0 when IDE power on and _PS3 when power off  */
void ata_acpi_set_state(struct ata_port *ap, pm_message_t state)
/* This function executes the _PS0/_PS3 ACPI method to set the power state. ACPI spec requires _PS0 when IDE power on and _PS3 when power off  */
void ata_acpi_set_state(struct ata_port *ap, pm_message_t state)
{
	struct ata_device *dev;
	if (!ap->acpi_handle || (ap->flags & ATA_FLAG_ACPI_SATA))
		return;
	if (state.event == PM_EVENT_ON)
		acpi_bus_set_power(ap->acpi_handle, ACPI_STATE_D0);
	ata_for_each_dev(dev, &ap->link, ENABLED) {
		if (dev->acpi_handle)
			acpi_bus_set_power(dev->acpi_handle,
				state.event == PM_EVENT_ON ?
					ACPI_STATE_D0 : ACPI_STATE_D3);
	}
	if (state.event != PM_EVENT_ON)
		acpi_bus_set_power(ap->acpi_handle, ACPI_STATE_D3);
}