Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
adam.huang
Arm Trusted Firmware
Commits
fc73ee91
Commit
fc73ee91
authored
Feb 11, 2014
by
Jon Medhurst
Committed by
Sandrine Bailleux
Jun 04, 2014
Browse files
juno: Implement PM ops to power down CPUs
Signed-off-by:
Jon Medhurst
<
tixy@linaro.org
>
parent
b44e1f56
Changes
1
Hide whitespace changes
Inline
Side-by-side
plat/juno/plat_pm.c
View file @
fc73ee91
...
...
@@ -93,12 +93,62 @@ int pm_on_finish(unsigned long mpidr, unsigned int afflvl, unsigned int state)
return
PSCI_E_SUCCESS
;
}
/*******************************************************************************
* Handler called when an affinity instance is about to be turned off. The
* level and mpidr determine the affinity instance. The 'state' arg. allows the
* platform to decide whether the cluster is being turned off and take apt
* actions.
*
* CAUTION: This function is called with coherent stacks so that caches can be
* turned off, flushed and coherency disabled. There is no guarantee that caches
* will remain turned on across calls to this function as each affinity level is
* dealt with. So do not write & read global variables across calls. It will be
* wise to do flush a write to the global to prevent unpredictable results.
******************************************************************************/
int
pm_off
(
unsigned
long
mpidr
,
unsigned
int
afflvl
,
unsigned
int
state
)
{
/* We're only interested in power off states */
if
(
state
!=
PSCI_STATE_OFF
)
return
PSCI_E_SUCCESS
;
switch
(
afflvl
)
{
case
MPIDR_AFFLVL1
:
/* Cluster is to be turned off, so disable coherency */
cci_disable_coherency
(
mpidr
);
break
;
case
MPIDR_AFFLVL0
:
/* Turn off intra-cluster coherency */
write_cpuectlr
(
read_cpuectlr
()
&
~
CPUECTLR_SMP_BIT
);
/* Prevent interrupts from spuriously waking up this cpu */
gic_cpuif_deactivate
(
GICC_BASE
);
/*
* Ask SCP to power down CPU.
*
* Note, we also ask for cluster power down as well because we
* know the SCP will only actually do that if this is the last
* CPU going down, and also, that final power down won't happen
* until this CPU executes the WFI instruction after the PSCI
* framework has done it's thing.
*/
scpi_set_css_power_state
(
mpidr
,
scpi_power_off
,
scpi_power_off
,
scpi_power_retention
);
break
;
}
return
PSCI_E_SUCCESS
;
}
/*******************************************************************************
* Export the platform handlers to enable psci to invoke them
******************************************************************************/
static
plat_pm_ops
pm_ops
=
{
.
affinst_on
=
pm_on
,
.
affinst_on_finish
=
pm_on_finish
.
affinst_on_finish
=
pm_on_finish
,
.
affinst_off
=
pm_off
};
/*******************************************************************************
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment