--- sys.c.ORIG Thu May 24 00:56:50 2001 +++ sys.c Thu May 24 01:40:31 2001 @@ -15,6 +15,11 @@ #include #include +#ifdef CONFIG_BLK_DEV_IDE +#include "../drivers/block/ide.h" +#endif + + /* * this indicates whether you can reboot with ctrl-alt-del: the default is yes */ @@ -146,6 +151,45 @@ /* + * Puts IDE disks in sleep mode + */ +void disks_sleep(void) { +#ifdef CONFIG_BLK_DEV_IDE +#define WIN_SLEEPNOW1 0xE6 +#define WIN_SLEEPNOW2 0x99 + int i, d, ret; + unsigned char args[4]; + ide_drive_t *drv; + + for ( i=0 ; iname); + else + printk(KERN_NOTICE "Putting %s to sleep at second attempt.\n", drv->name); + } else + printk(KERN_NOTICE "Putting %s to sleep.\n", drv->name); + } + } +#endif +} + + +/* * Reboot system call: for obvious reasons only root may call it, * and even root needs to set up some magic numbers in the registers * so that some mistake won't make this reboot the whole machine. @@ -186,6 +230,7 @@ case LINUX_REBOOT_CMD_HALT: notifier_call_chain(&reboot_notifier_list, SYS_HALT, NULL); printk(KERN_EMERG "System halted.\n"); + disks_sleep(); machine_halt(); do_exit(0); break; @@ -193,6 +238,7 @@ case LINUX_REBOOT_CMD_POWER_OFF: notifier_call_chain(&reboot_notifier_list, SYS_POWER_OFF, NULL); printk(KERN_EMERG "Power down.\n"); + disks_sleep(); machine_power_off(); do_exit(0); break;