Commit 9fbdb802 authored by Yatharth Kochar's avatar Yatharth Kochar
Browse files

Use unsigned long long instead of uintptr_t in TZC400/DMC500 drivers

Currently the `tzc400_configure_region` and `tzc_dmc500_configure_region`
functions uses uintptr_t as the data type for `region_top` and `region_base`
variables, which will be converted to 32/64 bits for AArch32/AArch64
respectively. But the expectation is to keep these addresses at least 64 bit.

This patch modifies the data types to make it at least 64 bit by using
unsigned long long instead of uintptr_t for the `region_top` and
`region_base` variables. It also modifies the associated macros
`_tzc##fn_name##_write_region_xxx` accordingly.

Change-Id: I4e3c6a8a39ad04205cf0f3bda336c3970b15a28b
parent 70fafab3
...@@ -191,8 +191,8 @@ void tzc400_configure_region0(tzc_region_attributes_t sec_attr, ...@@ -191,8 +191,8 @@ void tzc400_configure_region0(tzc_region_attributes_t sec_attr,
*/ */
void tzc400_configure_region(unsigned int filters, void tzc400_configure_region(unsigned int filters,
int region, int region,
uintptr_t region_base, unsigned long long region_base,
uintptr_t region_top, unsigned long long region_top,
tzc_region_attributes_t sec_attr, tzc_region_attributes_t sec_attr,
unsigned int nsaid_permissions) unsigned int nsaid_permissions)
{ {
......
...@@ -42,42 +42,42 @@ ...@@ -42,42 +42,42 @@
#define DEFINE_TZC_COMMON_WRITE_REGION_BASE(fn_name, macro_name) \ #define DEFINE_TZC_COMMON_WRITE_REGION_BASE(fn_name, macro_name) \
static inline void _tzc##fn_name##_write_region_base( \ static inline void _tzc##fn_name##_write_region_base( \
uintptr_t base, \ uintptr_t base, \
int region_no, \ int region_no, \
uintptr_t region_base) \ unsigned long long region_base) \
{ \ { \
mmio_write_32(base + \ mmio_write_32(base + \
TZC_REGION_OFFSET( \ TZC_REGION_OFFSET( \
TZC_##macro_name##_REGION_SIZE, \ TZC_##macro_name##_REGION_SIZE, \
region_no) + \ region_no) + \
TZC_##macro_name##_REGION_BASE_LOW_0_OFFSET, \ TZC_##macro_name##_REGION_BASE_LOW_0_OFFSET, \
(unsigned int)region_base); \ (uint32_t)region_base); \
mmio_write_32(base + \ mmio_write_32(base + \
TZC_REGION_OFFSET( \ TZC_REGION_OFFSET( \
TZC_##macro_name##_REGION_SIZE, \ TZC_##macro_name##_REGION_SIZE, \
region_no) + \ region_no) + \
TZC_##macro_name##_REGION_BASE_HIGH_0_OFFSET, \ TZC_##macro_name##_REGION_BASE_HIGH_0_OFFSET, \
(unsigned int)(region_base >> 32)); \ (uint32_t)(region_base >> 32)); \
} }
#define DEFINE_TZC_COMMON_WRITE_REGION_TOP(fn_name, macro_name) \ #define DEFINE_TZC_COMMON_WRITE_REGION_TOP(fn_name, macro_name) \
static inline void _tzc##fn_name##_write_region_top( \ static inline void _tzc##fn_name##_write_region_top( \
uintptr_t base, \ uintptr_t base, \
int region_no, \ int region_no, \
uintptr_t region_top) \ unsigned long long region_top) \
{ \ { \
mmio_write_32(base + \ mmio_write_32(base + \
TZC_REGION_OFFSET \ TZC_REGION_OFFSET \
(TZC_##macro_name##_REGION_SIZE, \ (TZC_##macro_name##_REGION_SIZE, \
region_no) + \ region_no) + \
TZC_##macro_name##_REGION_TOP_LOW_0_OFFSET, \ TZC_##macro_name##_REGION_TOP_LOW_0_OFFSET, \
(unsigned int)region_top); \ (uint32_t)region_top); \
mmio_write_32(base + \ mmio_write_32(base + \
TZC_REGION_OFFSET( \ TZC_REGION_OFFSET( \
TZC_##macro_name##_REGION_SIZE, \ TZC_##macro_name##_REGION_SIZE, \
region_no) + \ region_no) + \
TZC_##macro_name##_REGION_TOP_HIGH_0_OFFSET, \ TZC_##macro_name##_REGION_TOP_HIGH_0_OFFSET, \
(unsigned int)(region_top >> 32)); \ (uint32_t)(region_top >> 32)); \
} }
#define DEFINE_TZC_COMMON_WRITE_REGION_ATTRIBUTES(fn_name, macro_name) \ #define DEFINE_TZC_COMMON_WRITE_REGION_ATTRIBUTES(fn_name, macro_name) \
...@@ -146,8 +146,8 @@ ...@@ -146,8 +146,8 @@
void _tzc##fn_name##_configure_region(uintptr_t base, \ void _tzc##fn_name##_configure_region(uintptr_t base, \
unsigned int filters, \ unsigned int filters, \
int region_no, \ int region_no, \
uintptr_t region_base, \ unsigned long long region_base, \
uintptr_t region_top, \ unsigned long long region_top, \
tzc_region_attributes_t sec_attr, \ tzc_region_attributes_t sec_attr, \
unsigned int nsaid_permissions) \ unsigned int nsaid_permissions) \
{ \ { \
...@@ -155,8 +155,8 @@ ...@@ -155,8 +155,8 @@
VERBOSE("TrustZone : Configuring region " \ VERBOSE("TrustZone : Configuring region " \
"(TZC Interface Base: %p, region_no = %d)" \ "(TZC Interface Base: %p, region_no = %d)" \
"...\n", (void *)base, region_no); \ "...\n", (void *)base, region_no); \
VERBOSE("TrustZone : ... base = %p, top = %p," \ VERBOSE("TrustZone : ... base = %llx, top = %llx," \
"\n", (void *)region_base, (void *)region_top);\ "\n", region_base, region_top);\
VERBOSE("TrustZone : ... sec_attr = 0x%x," \ VERBOSE("TrustZone : ... sec_attr = 0x%x," \
" ns_devs = 0x%x)\n", \ " ns_devs = 0x%x)\n", \
sec_attr, nsaid_permissions); \ sec_attr, nsaid_permissions); \
......
...@@ -196,8 +196,8 @@ void tzc_dmc500_configure_region0(tzc_region_attributes_t sec_attr, ...@@ -196,8 +196,8 @@ void tzc_dmc500_configure_region0(tzc_region_attributes_t sec_attr,
* for this region (see comment for that function). * for this region (see comment for that function).
*/ */
void tzc_dmc500_configure_region(int region_no, void tzc_dmc500_configure_region(int region_no,
uintptr_t region_base, unsigned long long region_base,
uintptr_t region_top, unsigned long long region_top,
tzc_region_attributes_t sec_attr, tzc_region_attributes_t sec_attr,
unsigned int nsaid_permissions) unsigned int nsaid_permissions)
{ {
......
...@@ -139,8 +139,8 @@ void tzc400_configure_region0(tzc_region_attributes_t sec_attr, ...@@ -139,8 +139,8 @@ void tzc400_configure_region0(tzc_region_attributes_t sec_attr,
unsigned int ns_device_access); unsigned int ns_device_access);
void tzc400_configure_region(unsigned int filters, void tzc400_configure_region(unsigned int filters,
int region, int region,
uintptr_t region_base, unsigned long long region_base,
uintptr_t region_top, unsigned long long region_top,
tzc_region_attributes_t sec_attr, tzc_region_attributes_t sec_attr,
unsigned int ns_device_access); unsigned int ns_device_access);
void tzc400_set_action(tzc_action_t action); void tzc400_set_action(tzc_action_t action);
...@@ -157,8 +157,8 @@ static inline void tzc_configure_region0( ...@@ -157,8 +157,8 @@ static inline void tzc_configure_region0(
static inline void tzc_configure_region( static inline void tzc_configure_region(
unsigned int filters, unsigned int filters,
int region, int region,
uintptr_t region_base, unsigned long long region_base,
uintptr_t region_top, unsigned long long region_top,
tzc_region_attributes_t sec_attr, tzc_region_attributes_t sec_attr,
unsigned int ns_device_access) __deprecated; unsigned int ns_device_access) __deprecated;
static inline void tzc_set_action(tzc_action_t action) __deprecated; static inline void tzc_set_action(tzc_action_t action) __deprecated;
...@@ -180,8 +180,8 @@ static inline void tzc_configure_region0( ...@@ -180,8 +180,8 @@ static inline void tzc_configure_region0(
static inline void tzc_configure_region( static inline void tzc_configure_region(
unsigned int filters, unsigned int filters,
int region, int region,
uintptr_t region_base, unsigned long long region_base,
uintptr_t region_top, unsigned long long region_top,
tzc_region_attributes_t sec_attr, tzc_region_attributes_t sec_attr,
unsigned int ns_device_access) unsigned int ns_device_access)
{ {
......
...@@ -160,8 +160,8 @@ void tzc_dmc500_driver_init(const tzc_dmc500_driver_data_t *plat_driver_data); ...@@ -160,8 +160,8 @@ void tzc_dmc500_driver_init(const tzc_dmc500_driver_data_t *plat_driver_data);
void tzc_dmc500_configure_region0(tzc_region_attributes_t sec_attr, void tzc_dmc500_configure_region0(tzc_region_attributes_t sec_attr,
unsigned int nsaid_permissions); unsigned int nsaid_permissions);
void tzc_dmc500_configure_region(int region_no, void tzc_dmc500_configure_region(int region_no,
uintptr_t region_base, unsigned long long region_base,
uintptr_t region_top, unsigned long long region_top,
tzc_region_attributes_t sec_attr, tzc_region_attributes_t sec_attr,
unsigned int nsaid_permissions); unsigned int nsaid_permissions);
void tzc_dmc500_set_action(tzc_action_t action); void tzc_dmc500_set_action(tzc_action_t action);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment