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
3dd9835f
Commit
3dd9835f
authored
Jul 25, 2016
by
danh-arm
Committed by
GitHub
Jul 25, 2016
Browse files
Merge pull request #667 from soby-mathew/sm/PSCI_lib
Introduce PSCI library
parents
bc469a84
738b1fd7
Changes
71
Hide whitespace changes
Inline
Side-by-side
plat/arm/css/common/aarch64/css_helpers.S
View file @
3dd9835f
...
...
@@ -70,7 +70,7 @@ poll_mailbox:
endfunc
plat_secondary_cold_boot_setup
/
*
---------------------------------------------------------------------
*
u
nsigned
long
plat_get_my_entrypoint
(
void
)
;
*
u
intptr_t
plat_get_my_entrypoint
(
void
)
;
*
*
Main
job
of
this
routine
is
to
distinguish
between
a
cold
and
a
warm
*
boot
.
On
CSS
platforms
,
this
distinction
is
based
on
the
contents
of
...
...
@@ -90,7 +90,7 @@ func plat_get_my_entrypoint
endfunc
plat_get_my_entrypoint
/
*
-----------------------------------------------------------
*
unsigned
int
css_calc_core_pos_swap_cluster
(
u
int64
_t
mpidr
)
*
unsigned
int
css_calc_core_pos_swap_cluster
(
u
_register
_t
mpidr
)
*
Utility
function
to
calculate
the
core
position
by
*
swapping
the
cluster
order
.
This
is
necessary
in
order
to
*
match
the
format
of
the
boot
information
passed
by
the
SCP
...
...
plat/common/aarch64/plat_psci_common.c
View file @
3dd9835f
/*
* Copyright (c) 2015, ARM Limited and Contributors. All rights reserved.
* Copyright (c) 2015
-2016
, ARM Limited and Contributors. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
...
...
@@ -28,36 +28,6 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <arch.h>
#include <assert.h>
#include <platform.h>
#include <psci.h>
/*
* The PSCI generic code uses this API to let the platform participate in state
* coordination during a power management operation. It compares the platform
* specific local power states requested by each cpu for a given power domain
* and returns the coordinated target power state that the domain should
* enter. A platform assigns a number to a local power state. This default
* implementation assumes that the platform assigns these numbers in order of
* increasing depth of the power state i.e. for two power states X & Y, if X < Y
* then X represents a shallower power state than Y. As a result, the
* coordinated target local power state for a power domain will be the minimum
* of the requested local power states.
*/
plat_local_state_t
plat_get_target_pwr_state
(
unsigned
int
lvl
,
const
plat_local_state_t
*
states
,
unsigned
int
ncpu
)
{
plat_local_state_t
target
=
PLAT_MAX_OFF_STATE
,
temp
;
assert
(
ncpu
);
do
{
temp
=
*
states
++
;
if
(
temp
<
target
)
target
=
temp
;
}
while
(
--
ncpu
);
return
target
;
}
#if !ERROR_DEPRECATED
#include "../plat_psci_common.c"
#endif
plat/common/aarch64/platform_mp_stack.S
View file @
3dd9835f
/*
*
Copyright
(
c
)
2014
,
ARM
Limited
and
Contributors
.
All
rights
reserved
.
*
Copyright
(
c
)
2014
-
2016
,
ARM
Limited
and
Contributors
.
All
rights
reserved
.
*
*
Redistribution
and
use
in
source
and
binary
forms
,
with
or
without
*
modification
,
are
permitted
provided
that
the
following
conditions
are
met
:
...
...
@@ -159,7 +159,7 @@ func_deprecated platform_set_stack
endfunc_deprecated
platform_set_stack
/
*
-----------------------------------------------------
*
u
nsigned
long
plat_get_my_stack
()
*
u
intptr_t
plat_get_my_stack
()
*
*
For
the
current
CPU
,
this
function
returns
the
stack
*
pointer
for
a
stack
allocated
in
device
memory
.
...
...
plat/common/aarch64/platform_up_stack.S
View file @
3dd9835f
/*
*
Copyright
(
c
)
2014
,
ARM
Limited
and
Contributors
.
All
rights
reserved
.
*
Copyright
(
c
)
2014
-
2016
,
ARM
Limited
and
Contributors
.
All
rights
reserved
.
*
*
Redistribution
and
use
in
source
and
binary
forms
,
with
or
without
*
modification
,
are
permitted
provided
that
the
following
conditions
are
met
:
...
...
@@ -40,7 +40,7 @@
.
globl
platform_get_stack
/
*
-----------------------------------------------------
*
u
nsigned
long
plat_get_my_stack
()
*
u
intptr_t
plat_get_my_stack
()
*
*
For
cold
-
boot
BL
images
,
only
the
primary
CPU
needs
a
*
stack
.
This
function
returns
the
stack
pointer
for
a
...
...
bl31/aarch64/bl31_arch_setup
.c
→
plat/common/plat_psci_common
.c
View file @
3dd9835f
/*
* Copyright (c) 201
3-2014
, ARM Limited and Contributors. All rights reserved.
* Copyright (c) 201
6
, ARM Limited and Contributors. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
...
...
@@ -29,23 +29,35 @@
*/
#include <arch.h>
#include <arch_helpers.h>
#include <assert.h>
#include <bl_common.h>
#include <bl31.h>
#include <cpu_data.h>
#include <platform.h>
#include <psci.h>
/*******************************************************************************
* This duplicates what the primary cpu did after a cold boot in BL1. The same
* needs to be done when a cpu is hotplugged in. This function could also over-
* ride any EL3 setup done by BL1 as this code resides in rw memory.
******************************************************************************/
void
bl31_arch_setup
(
void
)
/*
* The PSCI generic code uses this API to let the platform participate in state
* coordination during a power management operation. It compares the platform
* specific local power states requested by each cpu for a given power domain
* and returns the coordinated target power state that the domain should
* enter. A platform assigns a number to a local power state. This default
* implementation assumes that the platform assigns these numbers in order of
* increasing depth of the power state i.e. for two power states X & Y, if X < Y
* then X represents a shallower power state than Y. As a result, the
* coordinated target local power state for a power domain will be the minimum
* of the requested local power states.
*/
plat_local_state_t
plat_get_target_pwr_state
(
unsigned
int
lvl
,
const
plat_local_state_t
*
states
,
unsigned
int
ncpu
)
{
/* Program the counter frequency */
write_cntfrq_el0
(
plat_get_syscnt_freq2
());
plat_local_state_t
target
=
PLAT_MAX_OFF_STATE
,
temp
;
assert
(
ncpu
);
do
{
temp
=
*
states
++
;
if
(
temp
<
target
)
target
=
temp
;
}
while
(
--
ncpu
);
/* Initialize the cpu_ops pointer. */
init_cpu_ops
();
return
target
;
}
plat/compat/plat_compat.mk
View file @
3dd9835f
#
# Copyright (c) 2015, ARM Limited and Contributors. All rights reserved.
# Copyright (c) 2015
-2016
, ARM Limited and Contributors. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
...
...
@@ -36,6 +36,6 @@ endif
PLAT_BL_COMMON_SOURCES
+=
plat/compat/aarch64/plat_helpers_compat.S
BL31_SOURCES
+=
plat/common/
aarch64/
plat_psci_common.c
\
BL31_SOURCES
+=
plat/common/plat_psci_common.c
\
plat/compat/plat_pm_compat.c
\
plat/compat/plat_topology_compat.c
plat/nvidia/tegra/common/tegra_common.mk
View file @
3dd9835f
#
# Copyright (c) 2015, ARM Limited and Contributors. All rights reserved.
# Copyright (c) 2015
-2016
, ARM Limited and Contributors. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
...
...
@@ -52,7 +52,7 @@ BL31_SOURCES += drivers/arm/gic/gic_v2.c \
drivers/delay_timer/delay_timer.c
\
drivers/ti/uart/16550_console.S
\
plat/common/aarch64/platform_mp_stack.S
\
plat/common/
aarch64/
plat_psci_common.c
\
plat/common/plat_psci_common.c
\
${COMMON_DIR}
/aarch64/tegra_helpers.S
\
${COMMON_DIR}
/drivers/memctrl/memctrl.c
\
${COMMON_DIR}
/drivers/pmc/pmc.c
\
...
...
plat/rockchip/rk3368/platform.mk
View file @
3dd9835f
...
...
@@ -51,7 +51,7 @@ RK_GIC_SOURCES := drivers/arm/gic/common/gic_common.c \
PLAT_BL_COMMON_SOURCES
:=
lib/xlat_tables/xlat_tables_common.c
\
lib/xlat_tables/aarch64/xlat_tables.c
\
plat/common/aarch64/plat_common.c
\
plat/common/
aarch64/
plat_psci_common.c
plat/common/plat_psci_common.c
BL31_SOURCES
+=
${RK_GIC_SOURCES}
\
drivers/arm/cci/cci.c
\
...
...
plat/rockchip/rk3399/platform.mk
View file @
3dd9835f
...
...
@@ -50,7 +50,7 @@ RK_GIC_SOURCES := drivers/arm/gic/common/gic_common.c \
PLAT_BL_COMMON_SOURCES
:=
lib/xlat_tables/xlat_tables_common.c
\
lib/xlat_tables/aarch64/xlat_tables.c
\
plat/common/aarch64/plat_common.c
\
plat/common/
aarch64/
plat_psci_common.c
plat/common/plat_psci_common.c
BL31_SOURCES
+=
${RK_GIC_SOURCES}
\
drivers/arm/cci/cci.c
\
...
...
plat/xilinx/zynqmp/platform.mk
View file @
3dd9835f
...
...
@@ -69,9 +69,9 @@ PLAT_BL_COMMON_SOURCES := lib/xlat_tables/xlat_tables_common.c \
drivers/arm/gic/v2/gicv2_helpers.c
\
drivers/cadence/uart/cdns_console.S
\
drivers/console/console.S
\
plat/arm/common/aarch64/arm_common.c
\
plat/arm/common/aarch64/arm_helpers.S
\
plat/arm/common/arm_cci.c
\
plat/arm/common/arm_common.c
\
plat/arm/common/arm_gicv2.c
\
plat/common/plat_gicv2.c
\
plat/common/aarch64/plat_common.c
\
...
...
@@ -81,7 +81,7 @@ PLAT_BL_COMMON_SOURCES := lib/xlat_tables/xlat_tables_common.c \
BL31_SOURCES
+=
drivers/arm/cci/cci.c
\
lib/cpus/aarch64/aem_generic.S
\
lib/cpus/aarch64/cortex_a53.S
\
plat/common/
aarch64/
plat_psci_common.c
\
plat/common/plat_psci_common.c
\
plat/common/aarch64/platform_mp_stack.S
\
plat/xilinx/zynqmp/bl31_zynqmp_setup.c
\
plat/xilinx/zynqmp/plat_psci.c
\
...
...
services/std_svc/std_svc_setup.c
View file @
3dd9835f
/*
* Copyright (c) 2014, ARM Limited and Contributors. All rights reserved.
* Copyright (c) 2014
-2016
, ARM Limited and Contributors. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
...
...
@@ -31,6 +31,7 @@
#include <debug.h>
#include <psci.h>
#include <runtime_svc.h>
#include <smcc_helpers.h>
#include <std_svc.h>
#include <stdint.h>
#include <uuid.h>
...
...
@@ -40,36 +41,27 @@ DEFINE_SVC_UUID(arm_svc_uid,
0x108d905b
,
0xf863
,
0x47e8
,
0xae
,
0x2d
,
0xc0
,
0xfb
,
0x56
,
0x41
,
0xf6
,
0xe2
);
/* Setup Standard Services */
static
int32_t
std_svc_setup
(
void
)
{
/*
* PSCI is the only specification implemented as a Standard Service.
* Invoke PSCI setup from here
*/
return
psci_setup
();
}
/*
* Top-level Standard Service SMC handler. This handler will in turn dispatch
* calls to PSCI SMC handler
*/
uint
64
_t
std_svc_smc_handler
(
uint32_t
smc_fid
,
u
int64
_t
x1
,
u
int64
_t
x2
,
u
int64
_t
x3
,
u
int64
_t
x4
,
uint
ptr
_t
std_svc_smc_handler
(
uint32_t
smc_fid
,
u
_register
_t
x1
,
u
_register
_t
x2
,
u
_register
_t
x3
,
u
_register
_t
x4
,
void
*
cookie
,
void
*
handle
,
u
int64
_t
flags
)
u
_register
_t
flags
)
{
/*
* Dispatch PSCI calls to PSCI SMC handler and return its return
* value
*/
if
(
is_psci_fid
(
smc_fid
))
{
return
psci_smc_handler
(
smc_fid
,
x1
,
x2
,
x3
,
x4
,
cookie
,
handle
,
flags
);
SMC_RET1
(
handle
,
psci_smc_handler
(
smc_fid
,
x1
,
x2
,
x3
,
x4
,
cookie
,
handle
,
flags
));
}
switch
(
smc_fid
)
{
...
...
@@ -101,6 +93,6 @@ DECLARE_RT_SVC(
OEN_STD_START
,
OEN_STD_END
,
SMC_TYPE_FAST
,
std_svc_setup
,
NULL
,
std_svc_smc_handler
);
Prev
1
2
3
4
Next
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