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
c19a4e6b
Commit
c19a4e6b
authored
Sep 02, 2020
by
Alexei Fedorov
Committed by
TrustedFirmware Code Review
Sep 02, 2020
Browse files
Merge "plat/arm: Get the base address of nv-counters from device tree" into integration
parents
ee99356b
14d095c3
Changes
5
Hide whitespace changes
Inline
Side-by-side
include/plat/arm/common/fconf_nv_cntr_getter.h
0 → 100644
View file @
c19a4e6b
/*
* Copyright (c) 2020, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
#ifndef FCONF_NV_CNTR_GETTER_H
#define FCONF_NV_CNTR_GETTER_H
#include <common/nv_cntr_ids.h>
#include <lib/fconf/fconf.h>
#define cot__nv_cntr_addr_getter(id) nv_cntr_base_addr[id]
extern
uintptr_t
nv_cntr_base_addr
[
MAX_NV_CTR_IDS
];
#endif
/* FCONF_NV_CNTR_GETTER_H */
plat/arm/board/common/board_arm_trusted_boot.c
View file @
c19a4e6b
...
@@ -12,7 +12,9 @@
...
@@ -12,7 +12,9 @@
#include <drivers/arm/cryptocell/cc_rotpk.h>
#include <drivers/arm/cryptocell/cc_rotpk.h>
#include <drivers/delay_timer.h>
#include <drivers/delay_timer.h>
#include <lib/cassert.h>
#include <lib/cassert.h>
#include <lib/fconf/fconf.h>
#include <plat/arm/common/plat_arm.h>
#include <plat/arm/common/plat_arm.h>
#include <plat/arm/common/fconf_nv_cntr_getter.h>
#include <plat/common/common_def.h>
#include <plat/common/common_def.h>
#include <plat/common/platform.h>
#include <plat/common/platform.h>
#include <platform_def.h>
#include <platform_def.h>
...
@@ -29,6 +31,16 @@
...
@@ -29,6 +31,16 @@
#endif
#endif
#endif
#endif
#if COT_DESC_IN_DTB && defined(IMAGE_BL2)
uintptr_t
nv_cntr_base_addr
[
MAX_NV_CTR_IDS
];
#else
uintptr_t
nv_cntr_base_addr
[
MAX_NV_CTR_IDS
]
=
{
TFW_NVCTR_BASE
,
NTFW_CTR_BASE
};
#endif
/* Weak definition may be overridden in specific platform */
/* Weak definition may be overridden in specific platform */
#pragma weak plat_get_nv_ctr
#pragma weak plat_get_nv_ctr
#pragma weak plat_set_nv_ctr
#pragma weak plat_set_nv_ctr
...
@@ -183,9 +195,11 @@ int plat_get_nv_ctr(void *cookie, unsigned int *nv_ctr)
...
@@ -183,9 +195,11 @@ int plat_get_nv_ctr(void *cookie, unsigned int *nv_ctr)
oid
=
(
const
char
*
)
cookie
;
oid
=
(
const
char
*
)
cookie
;
if
(
strcmp
(
oid
,
TRUSTED_FW_NVCOUNTER_OID
)
==
0
)
{
if
(
strcmp
(
oid
,
TRUSTED_FW_NVCOUNTER_OID
)
==
0
)
{
nv_ctr_addr
=
(
uint32_t
*
)
TFW_NVCTR_BASE
;
nv_ctr_addr
=
(
uint32_t
*
)
FCONF_GET_PROPERTY
(
cot
,
nv_cntr_addr
,
TRUSTED_NV_CTR_ID
);
}
else
if
(
strcmp
(
oid
,
NON_TRUSTED_FW_NVCOUNTER_OID
)
==
0
)
{
}
else
if
(
strcmp
(
oid
,
NON_TRUSTED_FW_NVCOUNTER_OID
)
==
0
)
{
nv_ctr_addr
=
(
uint32_t
*
)
NTFW_CTR_BASE
;
nv_ctr_addr
=
(
uint32_t
*
)
FCONF_GET_PROPERTY
(
cot
,
nv_cntr_addr
,
NON_TRUSTED_NV_CTR_ID
);
}
else
{
}
else
{
return
1
;
return
1
;
}
}
...
...
plat/arm/board/fvp/fvp_trusted_boot.c
View file @
c19a4e6b
...
@@ -9,7 +9,9 @@
...
@@ -9,7 +9,9 @@
#include <string.h>
#include <string.h>
#include <lib/mmio.h>
#include <lib/mmio.h>
#include <lib/fconf/fconf.h>
#include <plat/arm/common/plat_arm.h>
#include <plat/arm/common/plat_arm.h>
#include <plat/arm/common/fconf_nv_cntr_getter.h>
#include <plat/common/platform.h>
#include <plat/common/platform.h>
#include <platform_def.h>
#include <platform_def.h>
#include <tools_share/tbbr_oid.h>
#include <tools_share/tbbr_oid.h>
...
@@ -50,9 +52,11 @@ int plat_set_nv_ctr(void *cookie, unsigned int nv_ctr)
...
@@ -50,9 +52,11 @@ int plat_set_nv_ctr(void *cookie, unsigned int nv_ctr)
oid
=
(
const
char
*
)
cookie
;
oid
=
(
const
char
*
)
cookie
;
if
(
strcmp
(
oid
,
TRUSTED_FW_NVCOUNTER_OID
)
==
0
)
{
if
(
strcmp
(
oid
,
TRUSTED_FW_NVCOUNTER_OID
)
==
0
)
{
nv_ctr_addr
=
TFW_NVCTR_BASE
;
nv_ctr_addr
=
FCONF_GET_PROPERTY
(
cot
,
nv_cntr_addr
,
TRUSTED_NV_CTR_ID
);
}
else
if
(
strcmp
(
oid
,
NON_TRUSTED_FW_NVCOUNTER_OID
)
==
0
)
{
}
else
if
(
strcmp
(
oid
,
NON_TRUSTED_FW_NVCOUNTER_OID
)
==
0
)
{
nv_ctr_addr
=
NTFW_CTR_BASE
;
nv_ctr_addr
=
FCONF_GET_PROPERTY
(
cot
,
nv_cntr_addr
,
NON_TRUSTED_NV_CTR_ID
);
}
else
{
}
else
{
return
1
;
return
1
;
}
}
...
...
plat/arm/board/fvp/platform.mk
View file @
c19a4e6b
...
@@ -168,6 +168,9 @@ BL2_SOURCES += drivers/arm/sp805/sp805.c \
...
@@ -168,6 +168,9 @@ BL2_SOURCES += drivers/arm/sp805/sp805.c \
${FVP_SECURITY_SOURCES}
${FVP_SECURITY_SOURCES}
ifeq
(${COT_DESC_IN_DTB},1)
BL2_SOURCES
+=
plat/arm/common/fconf/fconf_nv_cntr_getter.c
endif
ifeq
(${BL2_AT_EL3},1)
ifeq
(${BL2_AT_EL3},1)
BL2_SOURCES
+=
plat/arm/board/fvp/
${ARCH}
/fvp_helpers.S
\
BL2_SOURCES
+=
plat/arm/board/fvp/
${ARCH}
/fvp_helpers.S
\
...
...
plat/arm/common/fconf/fconf_nv_cntr_getter.c
0 → 100644
View file @
c19a4e6b
/*
* Copyright (c) 2020, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
#include <assert.h>
#include <common/debug.h>
#include <common/fdt_wrappers.h>
#include <libfdt.h>
#include <plat/arm/common/fconf_nv_cntr_getter.h>
/*******************************************************************************
* fconf_populate_cot_descs() - Populate available nv-counters and update global
* structure.
* @config[in]: Pointer to the device tree blob in memory
*
* Return 0 on success or an error value otherwise.
******************************************************************************/
static
int
fconf_populate_nv_cntrs
(
uintptr_t
config
)
{
int
rc
,
node
,
child
;
uint32_t
id
;
uintptr_t
reg
;
/* As libfdt uses void *, we can't avoid this cast */
const
void
*
dtb
=
(
void
*
)
config
;
const
char
*
compatible_str
=
"arm, non-volatile-counter"
;
node
=
fdt_node_offset_by_compatible
(
dtb
,
-
1
,
compatible_str
);
if
(
node
<
0
)
{
ERROR
(
"FCONF: Can't find %s compatible in node
\n
"
,
compatible_str
);
return
node
;
}
fdt_for_each_subnode
(
child
,
dtb
,
node
)
{
rc
=
fdt_read_uint32
(
dtb
,
child
,
"id"
,
&
id
);
if
(
rc
<
0
)
{
ERROR
(
"FCONF: Can't find %s property in node
\n
"
,
"id"
);
return
rc
;
}
assert
(
id
<
MAX_NV_CTR_IDS
);
rc
=
fdt_get_reg_props_by_index
(
dtb
,
child
,
0
,
&
reg
,
NULL
);
if
(
rc
<
0
)
{
ERROR
(
"FCONF: Can't find %s property in node
\n
"
,
"reg"
);
return
rc
;
}
nv_cntr_base_addr
[
id
]
=
reg
;
}
return
0
;
}
FCONF_REGISTER_POPULATOR
(
TB_FW
,
nv_cntrs
,
fconf_populate_nv_cntrs
);
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