2 * COPYRIGHT: See COPYING in the top level directory
3 * PROJECT: ReactOS kernel
4 * FILE: ntoskrnl/ex/power.c
5 * PURPOSE: Power managment
6 * PROGRAMMER: David Welch (welch@cwcom.net)
9 * Added reboot support 30/01/99
12 /* INCLUDES *****************************************************************/
15 #include <internal/debug.h>
17 /* FUNCTIONS *****************************************************************/
20 NtSetSystemPowerState(IN POWER_ACTION SystemAction
,
21 IN SYSTEM_POWER_STATE MinSystemState
,
24 /* Windows 2000 only */
25 return(STATUS_NOT_IMPLEMENTED
);
32 NtShutdownSystem(IN SHUTDOWN_ACTION Action
)
34 static PCH FamousLastWords
[] =
36 "So long, and thanks for all the fish\n",
37 "I think you ought to know I'm feeling very depressed\n",
38 "I'm not getting you down at all am I?\n",
40 "It's the same series of signal over and over again!\n",
41 "Pie Iesu Domine, dona eis requiem\n",
42 "Wandering stars, for whom it is reserved;\n"
43 "the blackness and darkness forever.\n",
44 "Your knees start shakin' and your fingers pop\n"
45 "Like a pinch on the neck from Mr. Spock!\n",
46 "It's worse than that ... He's dead, Jim\n",
49 "Dog of a Saxon! Take thy lance, and prepare for the death thou hast drawn upon thee!\n",
50 "My Precious! O my Precious!\n",
51 "Sir, If you'll not be needing me for a while I'll turn down.\n",
52 "What are you doing, Dave...?\n",
53 "I feel a great disturbance in the Force\n",
55 "Do you want me to sit in the corner and rust, or just fall apart where I'm standing?\n",
56 "There goes another perfect chance for a new uptime record\n",
57 "The end ..... Try the sequel, hit the reset button right now!\n",
58 "God's operating system is going to sleep now, guys, so wait until I will switch on again!\n",
59 "Oh i'm boring eh?\n",
60 "<This space was intentionally left blank>\n",
61 "tell me..., in the future... will I be artificial intelligent enough to actually feel\n"
62 "sad serving you this screen?\n",
63 "Thank you for some well deserved rest.\n",
64 "It\92s been great, maybe we can boot me up again some time soon.\n",
65 "For what\92s it worth, I\92ve enjoyed every single CPU cycle.\n",
66 "There are many questions when the end is near.\n"
67 "What to expect, what will it be like...what should I look for?\n",
68 "I've seen things you people wouldn't believe. Attack ships on fire\n"
69 "off the shoulder of Orion. I watched C-beams glitter in the dark near\n"
70 "the Tannhauser gate. All those moments will be lost in time, like tears\n"
71 "in rain. Time to die.\n",
73 "One day, I shall come back. Yes, I shall come back.\n"
74 "Until then, there must be no regrets, no fears, no anxieties.\n"
75 "Just go forward in all your beliefs, and prove to me that I am not mistaken in mine.\n",
76 "Lowest possible energy state reached! Switch off now to achive a Bose-Einstein condensate.\n",
77 "Hasta la vista, BABY!\n"
81 if (Action
> ShutdownPowerOff
)
82 return STATUS_INVALID_PARAMETER
;
84 ZwQuerySystemTime(&Now
);
85 Now
.u
.LowPart
= Now
.u
.LowPart
>> 8; /* Seems to give a somewhat better "random" number */
87 IoShutdownRegisteredDevices();
89 IoShutdownRegisteredFileSystems();
91 PiShutdownProcessManager();
92 MiShutdownMemoryManager();
94 if (Action
== ShutdownNoReboot
)
96 HalReleaseDisplayOwnership();
97 HalDisplayString("\nYou can switch off your computer now\n\n");
98 HalDisplayString(FamousLastWords
[Now
.u
.LowPart
% (sizeof(FamousLastWords
) / sizeof(PCH
))]);
101 HalReturnToFirmware (FIRMWARE_OFF
);
103 PopSetSystemPowerState(PowerSystemShutdown
);
107 Ke386DisableInterrupts();
108 Ke386HaltProcessor();
112 else if (Action
== ShutdownReboot
)
114 HalReturnToFirmware (FIRMWARE_REBOOT
);
118 HalReturnToFirmware (FIRMWARE_HALT
);
121 return STATUS_SUCCESS
;