.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
---|
1 | 2 | /* |
---|
2 | 3 | * linux/kernel/reboot.c |
---|
3 | 4 | * |
---|
.. | .. |
---|
25 | 26 | struct pid *cad_pid; |
---|
26 | 27 | EXPORT_SYMBOL(cad_pid); |
---|
27 | 28 | |
---|
28 | | -#if defined(CONFIG_ARM) || defined(CONFIG_UNICORE32) |
---|
| 29 | +#if defined(CONFIG_ARM) |
---|
29 | 30 | #define DEFAULT_REBOOT_MODE = REBOOT_HARD |
---|
30 | 31 | #else |
---|
31 | 32 | #define DEFAULT_REBOOT_MODE |
---|
32 | 33 | #endif |
---|
33 | 34 | enum reboot_mode reboot_mode DEFAULT_REBOOT_MODE; |
---|
| 35 | +EXPORT_SYMBOL_GPL(reboot_mode); |
---|
34 | 36 | enum reboot_mode panic_reboot_mode = REBOOT_UNDEFINED; |
---|
| 37 | +EXPORT_SYMBOL_GPL(panic_reboot_mode); |
---|
35 | 38 | |
---|
36 | 39 | /* |
---|
37 | 40 | * This variable is used privately to keep track of whether or not |
---|
.. | .. |
---|
50 | 53 | */ |
---|
51 | 54 | |
---|
52 | 55 | void (*pm_power_off_prepare)(void); |
---|
| 56 | +EXPORT_SYMBOL_GPL(pm_power_off_prepare); |
---|
53 | 57 | |
---|
54 | 58 | /** |
---|
55 | 59 | * emergency_restart - reboot the system |
---|
.. | .. |
---|
213 | 217 | atomic_notifier_call_chain(&restart_handler_list, reboot_mode, cmd); |
---|
214 | 218 | } |
---|
215 | 219 | |
---|
| 220 | +#ifdef CONFIG_NO_GKI |
---|
216 | 221 | static ATOMIC_NOTIFIER_HEAD(pre_restart_handler_list); |
---|
217 | 222 | |
---|
218 | 223 | int register_pre_restart_handler(struct notifier_block *nb) |
---|
.. | .. |
---|
231 | 236 | { |
---|
232 | 237 | atomic_notifier_call_chain(&pre_restart_handler_list, reboot_mode, cmd); |
---|
233 | 238 | } |
---|
| 239 | +#endif |
---|
234 | 240 | |
---|
235 | 241 | void migrate_to_reboot_cpu(void) |
---|
236 | 242 | { |
---|
.. | .. |
---|
267 | 273 | pr_emerg("Restarting system\n"); |
---|
268 | 274 | else |
---|
269 | 275 | pr_emerg("Restarting system with command '%s'\n", cmd); |
---|
270 | | - kmsg_dump(KMSG_DUMP_RESTART); |
---|
| 276 | + kmsg_dump(KMSG_DUMP_SHUTDOWN); |
---|
271 | 277 | machine_restart(cmd); |
---|
272 | 278 | } |
---|
273 | 279 | EXPORT_SYMBOL_GPL(kernel_restart); |
---|
.. | .. |
---|
291 | 297 | migrate_to_reboot_cpu(); |
---|
292 | 298 | syscore_shutdown(); |
---|
293 | 299 | pr_emerg("System halted\n"); |
---|
294 | | - kmsg_dump(KMSG_DUMP_HALT); |
---|
| 300 | + kmsg_dump(KMSG_DUMP_SHUTDOWN); |
---|
295 | 301 | machine_halt(); |
---|
296 | 302 | } |
---|
297 | 303 | EXPORT_SYMBOL_GPL(kernel_halt); |
---|
.. | .. |
---|
301 | 307 | * |
---|
302 | 308 | * Shutdown everything and perform a clean system power_off. |
---|
303 | 309 | */ |
---|
| 310 | +extern void nkmcu_device_shutdown(void); |
---|
304 | 311 | void kernel_power_off(void) |
---|
305 | 312 | { |
---|
| 313 | + pr_emerg("nkmcu kernel_power_off... \n"); |
---|
| 314 | + nkmcu_device_shutdown(); |
---|
306 | 315 | kernel_shutdown_prepare(SYSTEM_POWER_OFF); |
---|
307 | 316 | if (pm_power_off_prepare) |
---|
308 | 317 | pm_power_off_prepare(); |
---|
309 | 318 | migrate_to_reboot_cpu(); |
---|
310 | 319 | syscore_shutdown(); |
---|
311 | 320 | pr_emerg("Power down\n"); |
---|
312 | | - kmsg_dump(KMSG_DUMP_POWEROFF); |
---|
| 321 | + kmsg_dump(KMSG_DUMP_SHUTDOWN); |
---|
313 | 322 | machine_power_off(); |
---|
314 | 323 | } |
---|
315 | 324 | EXPORT_SYMBOL_GPL(kernel_power_off); |
---|