ATA/ATAPI Power Management
ATA STANDBY mode
Spins down the drive, but leaves the controller board awake. The drive is supposed to accept the next command normally; but it will take lots of time to complete the command (and return to Active mode). The maximum time limit in the ATA spec is 30 seconds, but most drives spin up in a second or two. Use the STANDBY (0xE2) or STANDBY IMMEDIATE (0xE0) commands to put the drive in this mode.
ATA SLEEP mode
If you want to put the whole machine to sleep, you can also put the drives into SLEEP mode, with the SLEEP (0xE6) command. You will need to set bit 2 (SRST, value = 4) in the Control Register of each bus to get all the drives to spin up again, afterward.
ATAPI power management
Many ATAPI drives support the above STANDBY IMMEDIATE and SLEEP commands. There may also be supported power management commands in the ATAPI command set itself.
The BIOS is supposed to enable APM on any drive that supports it, if the system also supports it. APM runs independently of the OS, and invisibly, for the most part. If the BIOS fails to turn on the APM functionality of a device, a driver can do it with the SET FEATURES command (0xEF).