blob: 11ed16d003ef1bd560824c7f73aa4a671891a707 [file] [log] [blame]
Soby Mathew49473e42015-06-10 13:49:59 +01001/*
Antonio Nino Diaz6f3ccc52018-07-20 09:17:26 +01002 * Copyright (c) 2015-2018, ARM Limited and Contributors. All rights reserved.
Soby Mathew49473e42015-06-10 13:49:59 +01003 *
dp-armfa3cf0b2017-05-03 09:38:09 +01004 * SPDX-License-Identifier: BSD-3-Clause
Soby Mathew49473e42015-06-10 13:49:59 +01005 */
6
Antonio Nino Diaz6f3ccc52018-07-20 09:17:26 +01007#ifndef PSCI_COMPAT_H
8#define PSCI_COMPAT_H
Soby Mathew49473e42015-06-10 13:49:59 +01009
10#include <arch.h>
11#include <platform_def.h>
Antonio Nino Diaz6f3ccc52018-07-20 09:17:26 +010012#include <utils_def.h>
Soby Mathew49473e42015-06-10 13:49:59 +010013
14#ifndef __ASSEMBLY__
15/*
16 * The below declarations are to enable compatibility for the platform ports
17 * using the old platform interface and psci helpers.
18 */
19#define PLAT_MAX_PWR_LVL PLATFORM_MAX_AFFLVL
20#define PLAT_NUM_PWR_DOMAINS PLATFORM_NUM_AFFS
21
22/*******************************************************************************
23 * PSCI affinity related constants. An affinity instance could
24 * be present or absent physically to cater for asymmetric topologies.
25 ******************************************************************************/
26#define PSCI_AFF_ABSENT 0x0
27#define PSCI_AFF_PRESENT 0x1
28
Antonio Nino Diaz6f3ccc52018-07-20 09:17:26 +010029#define PSCI_STATE_ON U(0x0)
30#define PSCI_STATE_OFF U(0x1)
31#define PSCI_STATE_ON_PENDING U(0x2)
32#define PSCI_STATE_SUSPEND U(0x3)
Soby Mathew49473e42015-06-10 13:49:59 +010033
34/*
35 * Using the compatibility platform interfaces means that the local states
36 * used in psci_power_state_t need to only convey whether its power down
37 * or standby state. The onus is on the platform port to do the right thing
38 * including the state coordination in case multiple power down states are
39 * involved. Hence if we assume 3 generic states viz, run, standby and
40 * power down, we can assign 1 and 2 to standby and power down respectively.
41 */
Antonio Nino Diaz6f3ccc52018-07-20 09:17:26 +010042#define PLAT_MAX_RET_STATE U(1)
43#define PLAT_MAX_OFF_STATE U(2)
Soby Mathew49473e42015-06-10 13:49:59 +010044
Soby Mathew011ca182015-07-29 17:05:03 +010045/*
46 * Macro to represent invalid affinity level within PSCI.
47 */
48#define PSCI_INVALID_DATA -1
Soby Mathew49473e42015-06-10 13:49:59 +010049
50#define psci_get_pstate_afflvl(pstate) psci_get_pstate_pwrlvl(pstate)
51
52/*
53 * This array stores the 'power_state' requests of each CPU during
54 * CPU_SUSPEND and SYSTEM_SUSPEND which will be populated by the
55 * compatibility layer when appropriate platform hooks are invoked.
56 */
57extern unsigned int psci_power_state_compat[PLATFORM_CORE_COUNT];
58
59/*******************************************************************************
60 * Structure populated by platform specific code to export routines which
61 * perform common low level pm functions
62 ******************************************************************************/
63typedef struct plat_pm_ops {
64 void (*affinst_standby)(unsigned int power_state);
65 int (*affinst_on)(unsigned long mpidr,
66 unsigned long sec_entrypoint,
67 unsigned int afflvl,
68 unsigned int state);
69 void (*affinst_off)(unsigned int afflvl, unsigned int state);
70 void (*affinst_suspend)(unsigned long sec_entrypoint,
71 unsigned int afflvl,
72 unsigned int state);
73 void (*affinst_on_finish)(unsigned int afflvl, unsigned int state);
74 void (*affinst_suspend_finish)(unsigned int afflvl,
75 unsigned int state);
76 void (*system_off)(void) __dead2;
77 void (*system_reset)(void) __dead2;
78 int (*validate_power_state)(unsigned int power_state);
79 int (*validate_ns_entrypoint)(unsigned long ns_entrypoint);
80 unsigned int (*get_sys_suspend_power_state)(void);
81} plat_pm_ops_t;
82
83/*******************************************************************************
84 * Function & Data prototypes to enable compatibility for older platform ports
85 ******************************************************************************/
86int psci_get_suspend_stateid_by_mpidr(unsigned long);
87int psci_get_suspend_stateid(void);
88int psci_get_suspend_powerstate(void);
89unsigned int psci_get_max_phys_off_afflvl(void);
90int psci_get_suspend_afflvl(void);
91
92#endif /* ____ASSEMBLY__ */
Antonio Nino Diaz6f3ccc52018-07-20 09:17:26 +010093#endif /* PSCI_COMPAT_H */