blob: 48d40d0fd9e5d97f942f2569bce3f5bdc2f5df59 [file] [log] [blame]
Achin Gupta4f6ad662013-10-25 09:08:21 +01001/*
2 * Copyright (c) 2013, ARM Limited. All rights reserved.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are met:
6 *
7 * Redistributions of source code must retain the above copyright notice, this
8 * list of conditions and the following disclaimer.
9 *
10 * Redistributions in binary form must reproduce the above copyright notice,
11 * this list of conditions and the following disclaimer in the documentation
12 * and/or other materials provided with the distribution.
13 *
14 * Neither the name of ARM nor the names of its contributors may be used
15 * to endorse or promote products derived from this software without specific
16 * prior written permission.
17 *
18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
22 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28 * POSSIBILITY OF SUCH DAMAGE.
29 */
30
31#ifndef __PSCI_PRIVATE_H__
32#define __PSCI_PRIVATE_H__
33
34#include <bakery_lock.h>
35
36#ifndef __ASSEMBLY__
37/*******************************************************************************
38 * The following two data structures hold the generic information to bringup
39 * a suspended/hotplugged out cpu
40 ******************************************************************************/
41typedef struct {
42 unsigned long entrypoint;
43 unsigned long spsr;
44} eret_params;
45
46typedef struct {
47 eret_params eret_info;
48 unsigned long context_id;
49 unsigned int scr;
50 unsigned int sctlr;
51} ns_entry_info;
52
53/*******************************************************************************
54 *
55 *
56 ******************************************************************************/
57typedef struct {
58 unsigned long sctlr;
59 unsigned long scr;
60 unsigned long cptr;
61 unsigned long cpacr;
62 unsigned long cntfrq;
63 unsigned long mair;
64 unsigned long tcr;
65 unsigned long ttbr;
66 unsigned long vbar;
67} secure_context;
68
69/*******************************************************************************
70 * The following two data structures hold the topology tree which in turn tracks
71 * the state of the all the affinity instances supported by the platform.
72 ******************************************************************************/
73typedef struct {
74 unsigned long mpidr;
75 unsigned char state;
76 char level;
77 unsigned int data;
78 bakery_lock lock;
79} aff_map_node;
80
81typedef struct {
82 int min;
83 int max;
84} aff_limits_node;
85
86typedef unsigned int (*afflvl_power_on_finisher)(unsigned long,
87 aff_map_node *,
88 unsigned int);
89
90/*******************************************************************************
91 * Data prototypes
92 ******************************************************************************/
93extern secure_context psci_secure_context[PSCI_NUM_AFFS];
94extern ns_entry_info psci_ns_entry_info[PSCI_NUM_AFFS];
95extern unsigned int psci_ns_einfo_idx;
96extern aff_limits_node psci_aff_limits[MPIDR_MAX_AFFLVL + 1];
97extern plat_pm_ops *psci_plat_pm_ops;
98extern aff_map_node psci_aff_map[PSCI_NUM_AFFS];
99extern afflvl_power_on_finisher psci_afflvl_off_finish_handlers[];
100extern afflvl_power_on_finisher psci_afflvl_sus_finish_handlers[];
101
102/*******************************************************************************
103 * Function prototypes
104 ******************************************************************************/
105/* Private exported functions from psci_common.c */
106extern int get_max_afflvl(void);
107extern unsigned int psci_get_phys_state(unsigned int);
108extern unsigned int psci_get_aff_phys_state(aff_map_node *);
109extern unsigned int psci_calculate_affinity_state(aff_map_node *);
110extern unsigned int psci_get_ns_entry_info(unsigned int index);
111extern unsigned long mpidr_set_aff_inst(unsigned long,unsigned char, int);
112extern int psci_change_state(unsigned long, int, int, unsigned int);
113extern int psci_validate_mpidr(unsigned long, int);
114extern unsigned int psci_afflvl_power_on_finish(unsigned long,
115 int,
116 int,
117 afflvl_power_on_finisher *);
118extern int psci_set_ns_entry_info(unsigned int index,
119 unsigned long entrypoint,
120 unsigned long context_id);
121extern int psci_get_first_present_afflvl(unsigned long,
122 int, int,
123 aff_map_node **);
124/* Private exported functions from psci_setup.c */
125extern aff_map_node *psci_get_aff_map_node(unsigned long, int);
126
127/* Private exported functions from psci_affinity_on.c */
128extern int psci_afflvl_on(unsigned long,
129 unsigned long,
130 unsigned long,
131 int,
132 int);
133
134/* Private exported functions from psci_affinity_off.c */
135extern int psci_afflvl_off(unsigned long, int, int);
136
137/* Private exported functions from psci_affinity_suspend.c */
138extern int psci_afflvl_suspend(unsigned long,
139 unsigned long,
140 unsigned long,
141 unsigned int,
142 int,
143 int);
144extern unsigned int psci_afflvl_suspend_finish(unsigned long, int, int);
145#endif /*__ASSEMBLY__*/
146
147#endif /* __PSCI_PRIVATE_H__ */