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
3dd9835f
Commit
3dd9835f
authored
8 years ago
by
danh-arm
Committed by
GitHub
8 years ago
Browse files
Options
Download
Plain Diff
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
Showing
20 changed files
lib/psci/psci_common.c
+8
-8
lib/psci/psci_common.c
lib/psci/psci_lib.mk
+54
-0
lib/psci/psci_lib.mk
lib/psci/psci_main.c
+33
-34
lib/psci/psci_main.c
lib/psci/psci_off.c
+1
-1
lib/psci/psci_off.c
lib/psci/psci_on.c
+2
-4
lib/psci/psci_on.c
lib/psci/psci_private.h
+2
-3
lib/psci/psci_private.h
lib/psci/psci_setup.c
+30
-11
lib/psci/psci_setup.c
lib/psci/psci_stat.c
+0
-0
lib/psci/psci_stat.c
lib/psci/psci_suspend.c
+1
-2
lib/psci/psci_suspend.c
lib/psci/psci_system_off.c
+1
-1
lib/psci/psci_system_off.c
lib/xlat_tables/aarch64/xlat_tables.c
+0
-1
lib/xlat_tables/aarch64/xlat_tables.c
lib/xlat_tables/xlat_tables_common.c
+6
-5
lib/xlat_tables/xlat_tables_common.c
plat/arm/board/fvp/aarch64/fvp_helpers.S
+1
-1
plat/arm/board/fvp/aarch64/fvp_helpers.S
plat/arm/board/fvp/drivers/pwrc/fvp_pwrc.c
+8
-8
plat/arm/board/fvp/drivers/pwrc/fvp_pwrc.c
plat/arm/board/fvp/drivers/pwrc/fvp_pwrc.h
+8
-8
plat/arm/board/fvp/drivers/pwrc/fvp_pwrc.h
plat/arm/board/juno/aarch64/juno_helpers.S
+1
-1
plat/arm/board/juno/aarch64/juno_helpers.S
plat/arm/common/aarch64/arm_helpers.S
+2
-2
plat/arm/common/aarch64/arm_helpers.S
plat/arm/common/arm_bl31_setup.c
+4
-7
plat/arm/common/arm_bl31_setup.c
plat/arm/common/arm_common.c
+12
-16
plat/arm/common/arm_common.c
plat/arm/common/arm_common.mk
+2
-2
plat/arm/common/arm_common.mk
with
176 additions
and
115 deletions
+176
-115
services/std_svc
/psci/psci_common.c
→
lib
/psci/psci_common.c
View file @
3dd9835f
/*
* Copyright (c) 2013-201
5
, ARM Limited and Contributors. All rights reserved.
* Copyright (c) 2013-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:
...
...
@@ -596,10 +596,10 @@ static int psci_get_ns_ep_info(entry_point_info_t *ep,
uintptr_t
entrypoint
,
u_register_t
context_id
)
{
u
nsigned
long
ep_attr
,
sctlr
;
u
_register_t
ep_attr
,
sctlr
;
unsigned
int
daif
,
ee
,
mode
;
u
nsigned
long
ns_scr_el3
=
read_scr_el3
();
u
nsigned
long
ns_sctlr_el1
=
read_sctlr_el1
();
u
_register_t
ns_scr_el3
=
read_scr_el3
();
u
_register_t
ns_sctlr_el1
=
read_sctlr_el1
();
sctlr
=
ns_scr_el3
&
SCR_HCE_BIT
?
read_sctlr_el2
()
:
ns_sctlr_el1
;
ee
=
0
;
...
...
@@ -683,7 +683,7 @@ int psci_validate_entry_point(entry_point_info_t *ep,
* code to enable the gic cpu interface and for a cluster it will enable
* coherency at the interconnect level in addition to gic cpu interface.
******************************************************************************/
void
psci_
power_up_finish
(
void
)
void
psci_
warmboot_entrypoint
(
void
)
{
unsigned
int
end_pwrlvl
,
cpu_idx
=
plat_my_core_pos
();
psci_power_state_t
state_info
=
{
{
PSCI_LOCAL_STATE_RUN
}
};
...
...
@@ -817,7 +817,7 @@ void psci_print_power_domain_map(void)
plat_local_state_type_t
state_type
;
/* This array maps to the PSCI_STATE_X definitions in psci.h */
static
const
char
*
psci_state_type_str
[]
=
{
static
const
char
*
const
psci_state_type_str
[]
=
{
"ON"
,
"RETENTION"
,
"OFF"
,
...
...
@@ -839,9 +839,9 @@ void psci_print_power_domain_map(void)
for
(
idx
=
0
;
idx
<
PLATFORM_CORE_COUNT
;
idx
++
)
{
state
=
psci_get_cpu_local_state_by_idx
(
idx
);
state_type
=
find_local_state_type
(
state
);
INFO
(
" CPU Node : MPID 0x%lx, parent_node %d,"
INFO
(
" CPU Node : MPID 0x%
l
lx, parent_node %d,"
" State %s (0x%x)
\n
"
,
psci_cpu_pd_nodes
[
idx
].
mpidr
,
(
unsigned
long
long
)
psci_cpu_pd_nodes
[
idx
].
mpidr
,
psci_cpu_pd_nodes
[
idx
].
parent_node
,
psci_state_type_str
[
state_type
],
psci_get_cpu_local_state_by_idx
(
idx
));
...
...
This diff is collapsed.
Click to expand it.
lib/psci/psci_lib.mk
0 → 100644
View file @
3dd9835f
#
# Copyright (c) 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:
#
# Redistributions of source code must retain the above copyright notice, this
# list of conditions and the following disclaimer.
#
# Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions and the following disclaimer in the documentation
# and/or other materials provided with the distribution.
#
# Neither the name of ARM nor the names of its contributors may be used
# to endorse or promote products derived from this software without specific
# prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
PSCI_LIB_SOURCES
:=
lib/el3_runtime/cpu_data_array.c
\
lib/el3_runtime/aarch64/context.S
\
lib/el3_runtime/aarch64/cpu_data.S
\
lib/el3_runtime/aarch64/context_mgmt.c
\
lib/cpus/aarch64/cpu_helpers.S
\
lib/locks/exclusive/spinlock.S
\
lib/psci/psci_off.c
\
lib/psci/psci_on.c
\
lib/psci/psci_suspend.c
\
lib/psci/psci_common.c
\
lib/psci/psci_main.c
\
lib/psci/psci_setup.c
\
lib/psci/psci_system_off.c
\
lib/psci/aarch64/psci_helpers.S
ifeq
(${USE_COHERENT_MEM}, 1)
PSCI_LIB_SOURCES
+=
lib/locks/bakery/bakery_lock_coherent.c
else
PSCI_LIB_SOURCES
+=
lib/locks/bakery/bakery_lock_normal.c
endif
ifeq
(${ENABLE_PSCI_STAT}, 1)
PSCI_LIB_SOURCES
+=
lib/psci/psci_stat.c
endif
This diff is collapsed.
Click to expand it.
services/std_svc
/psci/psci_main.c
→
lib
/psci/psci_main.c
View file @
3dd9835f
/*
* Copyright (c) 2013-201
5
, ARM Limited and Contributors. All rights reserved.
* Copyright (c) 2013-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:
...
...
@@ -33,8 +33,7 @@
#include <assert.h>
#include <debug.h>
#include <platform.h>
#include <runtime_svc.h>
#include <std_svc.h>
#include <smcc.h>
#include <string.h>
#include "psci_private.h"
...
...
@@ -94,7 +93,7 @@ int psci_cpu_suspend(unsigned int power_state,
is_power_down_state
=
psci_get_pstate_type
(
power_state
);
/* Sanity check the requested suspend levels */
assert
(
psci_validate_suspend_req
(
&
state_info
,
is_power_down_state
)
assert
(
psci_validate_suspend_req
(
&
state_info
,
is_power_down_state
)
==
PSCI_E_SUCCESS
);
target_pwrlvl
=
psci_find_target_suspend_lvl
(
&
state_info
);
...
...
@@ -217,7 +216,7 @@ int psci_cpu_off(void)
* The only error cpu_off can return is E_DENIED. So check if that's
* indeed the case.
*/
assert
(
rc
==
PSCI_E_DENIED
);
assert
(
rc
==
PSCI_E_DENIED
);
return
rc
;
}
...
...
@@ -327,21 +326,21 @@ int psci_features(unsigned int psci_fid)
/*******************************************************************************
* PSCI top level handler for servicing SMCs.
******************************************************************************/
u
int64
_t
psci_smc_handler
(
uint32_t
smc_fid
,
u
int64
_t
x1
,
u
int64
_t
x2
,
u
int64
_t
x3
,
u
int64
_t
x4
,
u
_register
_t
psci_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
)
{
if
(
is_caller_secure
(
flags
))
SMC_RET1
(
handle
,
SMC_UNK
)
;
return
SMC_UNK
;
/* Check the fid against the capabilities */
if
(
!
(
psci_caps
&
define_psci_cap
(
smc_fid
)))
SMC_RET1
(
handle
,
SMC_UNK
)
;
return
SMC_UNK
;
if
(((
smc_fid
>>
FUNCID_CC_SHIFT
)
&
FUNCID_CC_MASK
)
==
SMC_32
)
{
/* 32-bit PSCI function, clear top parameter bits */
...
...
@@ -352,31 +351,31 @@ uint64_t psci_smc_handler(uint32_t smc_fid,
switch
(
smc_fid
)
{
case
PSCI_VERSION
:
SMC_RET1
(
handle
,
psci_version
()
)
;
return
psci_version
();
case
PSCI_CPU_OFF
:
SMC_RET1
(
handle
,
psci_cpu_off
()
)
;
return
psci_cpu_off
();
case
PSCI_CPU_SUSPEND_AARCH32
:
SMC_RET1
(
handle
,
psci_cpu_suspend
(
x1
,
x2
,
x3
)
)
;
return
psci_cpu_suspend
(
x1
,
x2
,
x3
);
case
PSCI_CPU_ON_AARCH32
:
SMC_RET1
(
handle
,
psci_cpu_on
(
x1
,
x2
,
x3
)
)
;
return
psci_cpu_on
(
x1
,
x2
,
x3
);
case
PSCI_AFFINITY_INFO_AARCH32
:
SMC_RET1
(
handle
,
psci_affinity_info
(
x1
,
x2
)
)
;
return
psci_affinity_info
(
x1
,
x2
);
case
PSCI_MIG_AARCH32
:
SMC_RET1
(
handle
,
psci_migrate
(
x1
)
)
;
return
psci_migrate
(
x1
);
case
PSCI_MIG_INFO_TYPE
:
SMC_RET1
(
handle
,
psci_migrate_info_type
()
)
;
return
psci_migrate_info_type
();
case
PSCI_MIG_INFO_UP_CPU_AARCH32
:
SMC_RET1
(
handle
,
psci_migrate_info_up_cpu
()
)
;
return
psci_migrate_info_up_cpu
();
case
PSCI_SYSTEM_SUSPEND_AARCH32
:
SMC_RET1
(
handle
,
psci_system_suspend
(
x1
,
x2
)
)
;
return
psci_system_suspend
(
x1
,
x2
);
case
PSCI_SYSTEM_OFF
:
psci_system_off
();
...
...
@@ -387,14 +386,14 @@ uint64_t psci_smc_handler(uint32_t smc_fid,
/* We should never return from psci_system_reset() */
case
PSCI_FEATURES
:
SMC_RET1
(
handle
,
psci_features
(
x1
)
)
;
return
psci_features
(
x1
);
#if ENABLE_PSCI_STAT
case
PSCI_STAT_RESIDENCY_AARCH32
:
SMC_RET1
(
handle
,
psci_stat_residency
(
x1
,
x2
)
)
;
return
psci_stat_residency
(
x1
,
x2
);
case
PSCI_STAT_COUNT_AARCH32
:
SMC_RET1
(
handle
,
psci_stat_count
(
x1
,
x2
)
)
;
return
psci_stat_count
(
x1
,
x2
);
#endif
default:
...
...
@@ -405,29 +404,29 @@ uint64_t psci_smc_handler(uint32_t smc_fid,
switch
(
smc_fid
)
{
case
PSCI_CPU_SUSPEND_AARCH64
:
SMC_RET1
(
handle
,
psci_cpu_suspend
(
x1
,
x2
,
x3
)
)
;
return
psci_cpu_suspend
(
x1
,
x2
,
x3
);
case
PSCI_CPU_ON_AARCH64
:
SMC_RET1
(
handle
,
psci_cpu_on
(
x1
,
x2
,
x3
)
)
;
return
psci_cpu_on
(
x1
,
x2
,
x3
);
case
PSCI_AFFINITY_INFO_AARCH64
:
SMC_RET1
(
handle
,
psci_affinity_info
(
x1
,
x2
)
)
;
return
psci_affinity_info
(
x1
,
x2
);
case
PSCI_MIG_AARCH64
:
SMC_RET1
(
handle
,
psci_migrate
(
x1
)
)
;
return
psci_migrate
(
x1
);
case
PSCI_MIG_INFO_UP_CPU_AARCH64
:
SMC_RET1
(
handle
,
psci_migrate_info_up_cpu
()
)
;
return
psci_migrate_info_up_cpu
();
case
PSCI_SYSTEM_SUSPEND_AARCH64
:
SMC_RET1
(
handle
,
psci_system_suspend
(
x1
,
x2
)
)
;
return
psci_system_suspend
(
x1
,
x2
);
#if ENABLE_PSCI_STAT
case
PSCI_STAT_RESIDENCY_AARCH64
:
SMC_RET1
(
handle
,
psci_stat_residency
(
x1
,
x2
)
)
;
return
psci_stat_residency
(
x1
,
x2
);
case
PSCI_STAT_COUNT_AARCH64
:
SMC_RET1
(
handle
,
psci_stat_count
(
x1
,
x2
)
)
;
return
psci_stat_count
(
x1
,
x2
);
#endif
default:
...
...
@@ -436,5 +435,5 @@ uint64_t psci_smc_handler(uint32_t smc_fid,
}
WARN
(
"Unimplemented PSCI Call: 0x%x
\n
"
,
smc_fid
);
SMC_RET1
(
handle
,
SMC_UNK
)
;
return
SMC_UNK
;
}
This diff is collapsed.
Click to expand it.
services/std_svc
/psci/psci_off.c
→
lib
/psci/psci_off.c
View file @
3dd9835f
/*
* Copyright (c) 2013-201
5
, ARM Limited and Contributors. All rights reserved.
* Copyright (c) 2013-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:
...
...
This diff is collapsed.
Click to expand it.
services/std_svc
/psci/psci_on.c
→
lib
/psci/psci_on.c
View file @
3dd9835f
/*
* Copyright (c) 2013-201
5
, ARM Limited and Contributors. All rights reserved.
* Copyright (c) 2013-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:
...
...
@@ -32,11 +32,9 @@
#include <arch_helpers.h>
#include <assert.h>
#include <bl_common.h>
#include <bl31.h>
#include <debug.h>
#include <context_mgmt.h>
#include <platform.h>
#include <runtime_svc.h>
#include <stddef.h>
#include "psci_private.h"
...
...
@@ -177,7 +175,7 @@ void psci_cpu_on_finish(unsigned int cpu_idx,
* on have completed. Perform enough arch.initialization
* to run in the non-secure address space.
*/
bl31
_arch_setup
();
psci
_arch_setup
();
/*
* Lock the CPU spin lock to make sure that the context initialization
...
...
This diff is collapsed.
Click to expand it.
services/std_svc
/psci/psci_private.h
→
lib
/psci/psci_private.h
View file @
3dd9835f
/*
* Copyright (c) 2013-201
5
, ARM Limited and Contributors. All rights reserved.
* Copyright (c) 2013-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:
...
...
@@ -192,7 +192,6 @@ int psci_validate_power_state(unsigned int power_state,
void
psci_query_sys_suspend_pwrstate
(
psci_power_state_t
*
state_info
);
int
psci_validate_mpidr
(
u_register_t
mpidr
);
void
psci_init_req_local_pwr_states
(
void
);
void
psci_power_up_finish
(
void
);
int
psci_validate_entry_point
(
entry_point_info_t
*
ep
,
uintptr_t
entrypoint
,
u_register_t
context_id
);
void
psci_get_parent_pwr_domain_nodes
(
unsigned
int
cpu_idx
,
...
...
@@ -214,7 +213,7 @@ unsigned int psci_is_last_on_cpu(void);
int
psci_spd_migrate_info
(
u_register_t
*
mpidr
);
/* Private exported functions from psci_on.c */
int
psci_cpu_on_start
(
u
nsigned
long
target_cpu
,
int
psci_cpu_on_start
(
u
_register_t
target_cpu
,
entry_point_info_t
*
ep
);
void
psci_cpu_on_finish
(
unsigned
int
cpu_idx
,
...
...
This diff is collapsed.
Click to expand it.
services/std_svc
/psci/psci_setup.c
→
lib
/psci/psci_setup.c
View file @
3dd9835f
/*
* Copyright (c) 2013-201
5
, ARM Limited and Contributors. All rights reserved.
* Copyright (c) 2013-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:
...
...
@@ -184,15 +184,17 @@ static void populate_power_domain_tree(const unsigned char *topology)
}
/*******************************************************************************
* This function initializes the power domain topology tree by querying the
* platform. The power domain nodes higher than the CPU are populated in the
* array psci_non_cpu_pd_nodes[] and the CPU power domains are populated in
* psci_cpu_pd_nodes[]. The platform exports its static topology map through the
* This function does the architectural setup and takes the warm boot
* entry-point `mailbox_ep` as an argument. The function also initializes the
* power domain topology tree by querying the platform. The power domain nodes
* higher than the CPU are populated in the array psci_non_cpu_pd_nodes[] and
* the CPU power domains are populated in psci_cpu_pd_nodes[]. The platform
* exports its static topology map through the
* populate_power_domain_topology_tree() API. The algorithm populates the
* psci_non_cpu_pd_nodes and psci_cpu_pd_nodes iteratively by using this
* topology map. On a platform that implements two clusters of 2 cpus each,
and
* supporting 3 domain levels, the populated psci_non_cpu_pd_nodes would
look
* like this:
* topology map. On a platform that implements two clusters of 2 cpus each,
*
and
supporting 3 domain levels, the populated psci_non_cpu_pd_nodes would
*
look
like this:
*
* ---------------------------------------------------
* | system node | cluster 0 node | cluster 1 node |
...
...
@@ -204,10 +206,13 @@ static void populate_power_domain_tree(const unsigned char *topology)
* | CPU 0 | CPU 1 | CPU 2 | CPU 3 |
* ------------------------------------------------
******************************************************************************/
int
psci_setup
(
void
)
int
psci_setup
(
uintptr_t
mailbox_ep
)
{
const
unsigned
char
*
topology_tree
;
/* Do the Architectural initialization */
psci_arch_setup
();
/* Query the topology map from the platform */
topology_tree
=
plat_get_power_domain_tree_desc
();
...
...
@@ -229,8 +234,8 @@ int psci_setup(void)
*/
psci_set_pwr_domains_to_run
(
PLAT_MAX_PWR_LVL
);
plat_setup_psci_ops
((
uintptr_t
)
psci_entrypoint
,
&
psci_plat_pm_ops
);
assert
(
mailbox_ep
);
plat_setup_psci_ops
(
mailbox_ep
,
&
psci_plat_pm_ops
);
assert
(
psci_plat_pm_ops
);
/* Initialize the psci capability */
...
...
@@ -259,3 +264,17 @@ int psci_setup(void)
return
0
;
}
/*******************************************************************************
* 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
psci_arch_setup
(
void
)
{
/* Program the counter frequency */
write_cntfrq_el0
(
plat_get_syscnt_freq2
());
/* Initialize the cpu_ops pointer. */
init_cpu_ops
();
}
This diff is collapsed.
Click to expand it.
services/std_svc
/psci/psci_stat.c
→
lib
/psci/psci_stat.c
View file @
3dd9835f
File moved
This diff is collapsed.
Click to expand it.
services/std_svc
/psci/psci_suspend.c
→
lib
/psci/psci_suspend.c
View file @
3dd9835f
/*
* Copyright (c) 2013-201
5
, ARM Limited and Contributors. All rights reserved.
* Copyright (c) 2013-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:
...
...
@@ -37,7 +37,6 @@
#include <cpu_data.h>
#include <debug.h>
#include <platform.h>
#include <runtime_svc.h>
#include <stddef.h>
#include "psci_private.h"
...
...
This diff is collapsed.
Click to expand it.
services/std_svc
/psci/psci_system_off.c
→
lib
/psci/psci_system_off.c
View file @
3dd9835f
/*
* Copyright (c) 2014-201
5
, ARM Limited and Contributors. All rights reserved.
* Copyright (c) 2014-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:
...
...
This diff is collapsed.
Click to expand it.
lib/xlat_tables/aarch64/xlat_tables.c
View file @
3dd9835f
...
...
@@ -47,7 +47,6 @@
CASSERT
(
ADDR_SPACE_SIZE
>=
(
1ull
<<
31
)
&&
ADDR_SPACE_SIZE
<=
(
1ull
<<
39
)
&&
IS_POWER_OF_TWO
(
ADDR_SPACE_SIZE
),
assert_valid_addr_space_size
);
#define UNSET_DESC ~0ul
#define NUM_L1_ENTRIES (ADDR_SPACE_SIZE >> L1_XLAT_ADDRESS_SHIFT)
static
uint64_t
l1_xlation_table
[
NUM_L1_ENTRIES
]
...
...
This diff is collapsed.
Click to expand it.
lib/xlat_tables/xlat_tables_common.c
View file @
3dd9835f
...
...
@@ -35,6 +35,7 @@
#include <debug.h>
#include <platform_def.h>
#include <string.h>
#include <types.h>
#include <utils.h>
#include <xlat_tables.h>
...
...
@@ -52,7 +53,7 @@
#define debug_print(...) ((void)0)
#endif
#define UNSET_DESC ~0ul
#define UNSET_DESC ~0ul
l
static
uint64_t
xlat_tables
[
MAX_XLAT_TABLES
][
XLAT_TABLE_ENTRIES
]
__aligned
(
XLAT_TABLE_SIZE
)
__section
(
"xlat_table"
);
...
...
@@ -313,9 +314,9 @@ static mmap_region_t *init_xlation_table_inner(mmap_region_t *mm,
unsigned
level_size_shift
=
L1_XLAT_ADDRESS_SHIFT
-
(
level
-
1
)
*
XLAT_TABLE_ENTRIES_SHIFT
;
unsigned
level_size
=
1
<<
level_size_shift
;
u
nsigned
long
long
level_index_mask
=
(
(
unsigned
long
long
)
XLAT_TABLE_ENTRIES_MASK
)
<<
level_size_shift
;
u
_register_t
level_index_mask
=
(
u_register_t
)(((
u_register_t
)
XLAT_TABLE_ENTRIES_MASK
)
<<
level_size_shift
)
;
assert
(
level
>
0
&&
level
<=
3
);
...
...
@@ -357,7 +358,7 @@ static mmap_region_t *init_xlation_table_inner(mmap_region_t *mm,
/* Area not covered by a region so need finer table */
uint64_t
*
new_table
=
xlat_tables
[
next_xlat
++
];
assert
(
next_xlat
<=
MAX_XLAT_TABLES
);
desc
=
TABLE_DESC
|
(
uint
64
_t
)
new_table
;
desc
=
TABLE_DESC
|
(
uint
ptr
_t
)
new_table
;
/* Recurse to fill in new table */
mm
=
init_xlation_table_inner
(
mm
,
base_va
,
...
...
This diff is collapsed.
Click to expand it.
plat/arm/board/fvp/aarch64/fvp_helpers.S
View file @
3dd9835f
...
...
@@ -127,7 +127,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
warm
*
boot
.
On
FVP
,
this
information
can
be
queried
from
the
power
...
...
This diff is collapsed.
Click to expand it.
plat/arm/board/fvp/drivers/pwrc/fvp_pwrc.c
View file @
3dd9835f
/*
* Copyright (c) 2013-201
5
, ARM Limited and Contributors. All rights reserved.
* Copyright (c) 2013-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:
...
...
@@ -41,12 +41,12 @@
*/
ARM_INSTANTIATE_LOCK
unsigned
int
fvp_pwrc_get_cpu_wkr
(
u
nsigned
long
mpidr
)
unsigned
int
fvp_pwrc_get_cpu_wkr
(
u
_register_t
mpidr
)
{
return
PSYSR_WK
(
fvp_pwrc_read_psysr
(
mpidr
));
}
unsigned
int
fvp_pwrc_read_psysr
(
u
nsigned
long
mpidr
)
unsigned
int
fvp_pwrc_read_psysr
(
u
_register_t
mpidr
)
{
unsigned
int
rc
;
arm_lock_get
();
...
...
@@ -56,21 +56,21 @@ unsigned int fvp_pwrc_read_psysr(unsigned long mpidr)
return
rc
;
}
void
fvp_pwrc_write_pponr
(
u
nsigned
long
mpidr
)
void
fvp_pwrc_write_pponr
(
u
_register_t
mpidr
)
{
arm_lock_get
();
mmio_write_32
(
PWRC_BASE
+
PPONR_OFF
,
(
unsigned
int
)
mpidr
);
arm_lock_release
();
}
void
fvp_pwrc_write_ppoffr
(
u
nsigned
long
mpidr
)
void
fvp_pwrc_write_ppoffr
(
u
_register_t
mpidr
)
{
arm_lock_get
();
mmio_write_32
(
PWRC_BASE
+
PPOFFR_OFF
,
(
unsigned
int
)
mpidr
);
arm_lock_release
();
}
void
fvp_pwrc_set_wen
(
u
nsigned
long
mpidr
)
void
fvp_pwrc_set_wen
(
u
_register_t
mpidr
)
{
arm_lock_get
();
mmio_write_32
(
PWRC_BASE
+
PWKUPR_OFF
,
...
...
@@ -78,7 +78,7 @@ void fvp_pwrc_set_wen(unsigned long mpidr)
arm_lock_release
();
}
void
fvp_pwrc_clr_wen
(
u
nsigned
long
mpidr
)
void
fvp_pwrc_clr_wen
(
u
_register_t
mpidr
)
{
arm_lock_get
();
mmio_write_32
(
PWRC_BASE
+
PWKUPR_OFF
,
...
...
@@ -86,7 +86,7 @@ void fvp_pwrc_clr_wen(unsigned long mpidr)
arm_lock_release
();
}
void
fvp_pwrc_write_pcoffr
(
u
nsigned
long
mpidr
)
void
fvp_pwrc_write_pcoffr
(
u
_register_t
mpidr
)
{
arm_lock_get
();
mmio_write_32
(
PWRC_BASE
+
PCOFFR_OFF
,
(
unsigned
int
)
mpidr
);
...
...
This diff is collapsed.
Click to expand it.
plat/arm/board/fvp/drivers/pwrc/fvp_pwrc.h
View file @
3dd9835f
/*
* Copyright (c) 2013-201
5
, ARM Limited and Contributors. All rights reserved.
* Copyright (c) 2013-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:
...
...
@@ -64,13 +64,13 @@
/*******************************************************************************
* Function & variable prototypes
******************************************************************************/
void
fvp_pwrc_write_pcoffr
(
u
nsigned
long
);
void
fvp_pwrc_write_ppoffr
(
u
nsigned
long
);
void
fvp_pwrc_write_pponr
(
u
nsigned
long
);
void
fvp_pwrc_set_wen
(
u
nsigned
long
);
void
fvp_pwrc_clr_wen
(
u
nsigned
long
);
unsigned
int
fvp_pwrc_read_psysr
(
u
nsigned
long
);
unsigned
int
fvp_pwrc_get_cpu_wkr
(
u
nsigned
long
);
void
fvp_pwrc_write_pcoffr
(
u
_register_t
);
void
fvp_pwrc_write_ppoffr
(
u
_register_t
);
void
fvp_pwrc_write_pponr
(
u
_register_t
);
void
fvp_pwrc_set_wen
(
u
_register_t
);
void
fvp_pwrc_clr_wen
(
u
_register_t
);
unsigned
int
fvp_pwrc_read_psysr
(
u
_register_t
);
unsigned
int
fvp_pwrc_get_cpu_wkr
(
u
_register_t
);
#endif
/*__ASSEMBLY__*/
...
...
This diff is collapsed.
Click to expand it.
plat/arm/board/juno/aarch64/juno_helpers.S
View file @
3dd9835f
...
...
@@ -206,7 +206,7 @@ func plat_reset_handler
endfunc
plat_reset_handler
/
*
-----------------------------------------------------
*
unsigned
int
plat_arm_calc_core_pos
(
u
int64
_t
mpidr
)
*
unsigned
int
plat_arm_calc_core_pos
(
u
_register
_t
mpidr
)
*
Helper
function
to
calculate
the
core
position
.
*
-----------------------------------------------------
*/
...
...
This diff is collapsed.
Click to expand it.
plat/arm/common/aarch64/arm_helpers.S
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
:
...
...
@@ -49,7 +49,7 @@ func plat_my_core_pos
endfunc
plat_my_core_pos
/
*
-----------------------------------------------------
*
unsigned
int
plat_arm_calc_core_pos
(
u
int64
_t
mpidr
)
*
unsigned
int
plat_arm_calc_core_pos
(
u
_register
_t
mpidr
)
*
Helper
function
to
calculate
the
core
position
.
*
With
this
function
:
CorePos
=
(
ClusterId
*
4
)
+
*
CoreId
...
...
This diff is collapsed.
Click to expand it.
plat/arm/common/arm_bl31_setup.c
View file @
3dd9835f
...
...
@@ -38,7 +38,7 @@
#include <plat_arm.h>
#include <platform.h>
#define BL31_END (u
nsigned long
)(&__BL31_END__)
#define BL31_END (u
intptr_t
)(&__BL31_END__)
#if USE_COHERENT_MEM
/*
...
...
@@ -48,8 +48,8 @@
* __COHERENT_RAM_START__ and __COHERENT_RAM_END__ linker symbols
* refer to page-aligned addresses.
*/
#define BL31_COHERENT_RAM_BASE (u
nsigned long
)(&__COHERENT_RAM_START__)
#define BL31_COHERENT_RAM_LIMIT (u
nsigned long
)(&__COHERENT_RAM_END__)
#define BL31_COHERENT_RAM_BASE (u
intptr_t
)(&__COHERENT_RAM_START__)
#define BL31_COHERENT_RAM_LIMIT (u
intptr_t
)(&__COHERENT_RAM_END__)
#endif
/*
...
...
@@ -130,11 +130,8 @@ void arm_bl31_early_platform_setup(bl31_params_t *from_bl2,
* Tell BL31 where the non-trusted software image
* is located and the entry state information
*/
#ifdef PRELOADED_BL33_BASE
bl33_image_ep_info
.
pc
=
PRELOADED_BL33_BASE
;
#else
bl33_image_ep_info
.
pc
=
plat_get_ns_image_entrypoint
();
#endif
/* PRELOADED_BL33_BASE */
bl33_image_ep_info
.
spsr
=
arm_get_spsr_for_bl33_entry
();
SET_SECURITY_STATE
(
bl33_image_ep_info
.
h
.
attr
,
NON_SECURE
);
...
...
This diff is collapsed.
Click to expand it.
plat/arm/common/
aarch64/
arm_common.c
→
plat/arm/common/arm_common.c
View file @
3dd9835f
...
...
@@ -46,8 +46,6 @@ extern const mmap_region_t plat_arm_mmap[];
* conflicts with the definition in plat/common. */
#if ERROR_DEPRECATED
#pragma weak plat_get_syscnt_freq2
#else
#pragma weak plat_get_syscnt_freq
#endif
/*
...
...
@@ -59,16 +57,16 @@ extern const mmap_region_t plat_arm_mmap[];
* - Read-only data section;
* - Coherent memory region, if applicable.
*/
void
arm_setup_page_tables
(
u
nsigned
long
total_base
,
unsigned
long
total_size
,
u
nsigned
long
code_start
,
u
nsigned
long
code_limit
,
u
nsigned
long
rodata_start
,
u
nsigned
long
rodata_limit
void
arm_setup_page_tables
(
u
intptr_t
total_base
,
size_t
total_size
,
u
intptr_t
code_start
,
u
intptr_t
code_limit
,
u
intptr_t
rodata_start
,
u
intptr_t
rodata_limit
#if USE_COHERENT_MEM
,
u
nsigned
long
coh_start
,
u
nsigned
long
coh_limit
u
intptr_t
coh_start
,
u
intptr_t
coh_limit
#endif
)
{
...
...
@@ -114,7 +112,11 @@ void arm_setup_page_tables(unsigned long total_base,
uintptr_t
plat_get_ns_image_entrypoint
(
void
)
{
#ifdef PRELOADED_BL33_BASE
return
PRELOADED_BL33_BASE
;
#else
return
PLAT_ARM_NS_IMAGE_OFFSET
;
#endif
}
/*******************************************************************************
...
...
@@ -183,15 +185,9 @@ const mmap_region_t *plat_arm_get_mmap(void)
#ifdef ARM_SYS_CNTCTL_BASE
#if ERROR_DEPRECATED
unsigned
int
plat_get_syscnt_freq2
(
void
)
{
unsigned
int
counter_base_frequency
;
#else
unsigned
long
long
plat_get_syscnt_freq
(
void
)
{
unsigned
long
long
counter_base_frequency
;
#endif
/* ERROR_DEPRECATED */
/* Read the frequency from Frequency modes table */
counter_base_frequency
=
mmio_read_32
(
ARM_SYS_CNTCTL_BASE
+
CNTFID_OFF
);
...
...
This diff is collapsed.
Click to expand it.
plat/arm/common/arm_common.mk
View file @
3dd9835f
...
...
@@ -97,8 +97,8 @@ PLAT_INCLUDES += -Iinclude/common/tbbr \
PLAT_BL_COMMON_SOURCES
+=
lib/xlat_tables/xlat_tables_common.c
\
lib/xlat_tables/aarch64/xlat_tables.c
\
plat/arm/common/aarch64/arm_common.c
\
plat/arm/common/aarch64/arm_helpers.S
\
plat/arm/common/arm_common.c
\
plat/common/aarch64/plat_common.c
BL1_SOURCES
+=
drivers/arm/sp805/sp805.c
\
...
...
@@ -128,7 +128,7 @@ BL31_SOURCES += plat/arm/common/arm_bl31_setup.c \
plat/arm/common/arm_pm.c
\
plat/arm/common/arm_topology.c
\
plat/common/aarch64/platform_mp_stack.S
\
plat/common/
aarch64/
plat_psci_common.c
plat/common/plat_psci_common.c
ifneq
(${TRUSTED_BOARD_BOOT},0)
...
...
This diff is collapsed.
Click to expand it.
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
Menu
Projects
Groups
Snippets
Help