Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
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
86f75c24
Commit
86f75c24
authored
4 years ago
by
Manish Pandey
Committed by
TrustedFirmware Code Review
4 years ago
Browse files
Options
Download
Plain Diff
Merge "psci: utility api to invoke stop for other cores" into integration
parents
cd62b834
22744909
master
v2.5
v2.5-rc1
v2.5-rc0
v2.4
v2.4-rc2
v2.4-rc1
v2.4-rc0
arm_cca_v0.2
arm_cca_v0.1
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
include/lib/psci/psci_lib.h
+2
-0
include/lib/psci/psci_lib.h
lib/psci/psci_common.c
+47
-0
lib/psci/psci_common.c
with
49 additions
and
0 deletions
+49
-0
include/lib/psci/psci_lib.h
View file @
86f75c24
...
...
@@ -89,6 +89,8 @@ void psci_warmboot_entrypoint(void);
void
psci_register_spd_pm_hook
(
const
spd_pm_ops_t
*
pm
);
void
psci_prepare_next_non_secure_ctx
(
entry_point_info_t
*
next_image_info
);
int
psci_stop_other_cores
(
unsigned
int
wait_ms
,
void
(
*
stop_func
)(
u_register_t
mpidr
));
#endif
/* __ASSEMBLER__ */
#endif
/* PSCI_LIB_H */
This diff is collapsed.
Click to expand it.
lib/psci/psci_common.c
View file @
86f75c24
...
...
@@ -12,6 +12,7 @@
#include <common/bl_common.h>
#include <common/debug.h>
#include <context.h>
#include <drivers/delay_timer.h>
#include <lib/el3_runtime/context_mgmt.h>
#include <lib/utils.h>
#include <plat/common/platform.h>
...
...
@@ -973,3 +974,49 @@ void psci_do_pwrdown_sequence(unsigned int power_level)
psci_do_pwrdown_cache_maintenance
(
power_level
);
#endif
}
/*******************************************************************************
* This function invokes the callback 'stop_func()' with the 'mpidr' of each
* online PE. Caller can pass suitable method to stop a remote core.
*
* 'wait_ms' is the timeout value in milliseconds for the other cores to
* transition to power down state. Passing '0' makes it non-blocking.
*
* The function returns 'PSCI_E_DENIED' if some cores failed to stop within the
* given timeout.
******************************************************************************/
int
psci_stop_other_cores
(
unsigned
int
wait_ms
,
void
(
*
stop_func
)(
u_register_t
mpidr
))
{
unsigned
int
idx
,
this_cpu_idx
;
this_cpu_idx
=
plat_my_core_pos
();
/* Invoke stop_func for each core */
for
(
idx
=
0U
;
idx
<
psci_plat_core_count
;
idx
++
)
{
/* skip current CPU */
if
(
idx
==
this_cpu_idx
)
{
continue
;
}
/* Check if the CPU is ON */
if
(
psci_get_aff_info_state_by_idx
(
idx
)
==
AFF_STATE_ON
)
{
(
*
stop_func
)(
psci_cpu_pd_nodes
[
idx
].
mpidr
);
}
}
/* Need to wait for other cores to shutdown */
if
(
wait_ms
!=
0U
)
{
while
((
wait_ms
--
!=
0U
)
&&
(
psci_is_last_on_cpu
()
!=
0U
))
{
mdelay
(
1U
);
}
if
(
psci_is_last_on_cpu
()
!=
0U
)
{
WARN
(
"Failed to stop all cores!
\n
"
);
psci_print_power_domain_map
();
return
PSCI_E_DENIED
;
}
}
return
PSCI_E_SUCCESS
;
}
This diff is collapsed.
Click to expand it.
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
Menu
Projects
Groups
Snippets
Help