xref: /rk3399_ARM-atf/lib/psci/psci_system_off.c (revision aa8d5f88e04ba6211e345ab7a3864e2d9fec682e)
1532ed618SSoby Mathew /*
20b32628eSAntonio Nino Diaz  * Copyright (c) 2014-2017, ARM Limited and Contributors. All rights reserved.
3532ed618SSoby Mathew  *
482cb2c1aSdp-arm  * SPDX-License-Identifier: BSD-3-Clause
5532ed618SSoby Mathew  */
6532ed618SSoby Mathew 
7532ed618SSoby Mathew #include <stddef.h>
8532ed618SSoby Mathew #include <arch_helpers.h>
9532ed618SSoby Mathew #include <assert.h>
100b32628eSAntonio Nino Diaz #include <console.h>
11532ed618SSoby Mathew #include <debug.h>
12532ed618SSoby Mathew #include <platform.h>
13532ed618SSoby Mathew #include "psci_private.h"
14532ed618SSoby Mathew 
15*aa8d5f88SEtienne Carriere void __dead2 psci_system_off(void)
16532ed618SSoby Mathew {
17532ed618SSoby Mathew 	psci_print_power_domain_map();
18532ed618SSoby Mathew 
19532ed618SSoby Mathew 	assert(psci_plat_pm_ops->system_off);
20532ed618SSoby Mathew 
21532ed618SSoby Mathew 	/* Notify the Secure Payload Dispatcher */
22532ed618SSoby Mathew 	if (psci_spd_pm && psci_spd_pm->svc_system_off) {
23532ed618SSoby Mathew 		psci_spd_pm->svc_system_off();
24532ed618SSoby Mathew 	}
25532ed618SSoby Mathew 
260b32628eSAntonio Nino Diaz 	console_flush();
270b32628eSAntonio Nino Diaz 
28532ed618SSoby Mathew 	/* Call the platform specific hook */
29532ed618SSoby Mathew 	psci_plat_pm_ops->system_off();
30532ed618SSoby Mathew 
31532ed618SSoby Mathew 	/* This function does not return. We should never get here */
32532ed618SSoby Mathew }
33532ed618SSoby Mathew 
34*aa8d5f88SEtienne Carriere void __dead2 psci_system_reset(void)
35532ed618SSoby Mathew {
36532ed618SSoby Mathew 	psci_print_power_domain_map();
37532ed618SSoby Mathew 
38532ed618SSoby Mathew 	assert(psci_plat_pm_ops->system_reset);
39532ed618SSoby Mathew 
40532ed618SSoby Mathew 	/* Notify the Secure Payload Dispatcher */
41532ed618SSoby Mathew 	if (psci_spd_pm && psci_spd_pm->svc_system_reset) {
42532ed618SSoby Mathew 		psci_spd_pm->svc_system_reset();
43532ed618SSoby Mathew 	}
44532ed618SSoby Mathew 
450b32628eSAntonio Nino Diaz 	console_flush();
460b32628eSAntonio Nino Diaz 
47532ed618SSoby Mathew 	/* Call the platform specific hook */
48532ed618SSoby Mathew 	psci_plat_pm_ops->system_reset();
49532ed618SSoby Mathew 
50532ed618SSoby Mathew 	/* This function does not return. We should never get here */
51532ed618SSoby Mathew }
52