Skip to content

Commit

Permalink
[Review]Added Marvell platform with initial support for ARMADA A7K & A8K
Browse files Browse the repository at this point in the history
util.h
1. use UINTPTR_C() instead of "UL"
2. try not overwrite assemble definitions of ROUNDUP/DOWN

Signed-off-by: Kevin Peng <kevinp@marvell.com>
  • Loading branch information
Kevin Peng committed Sep 25, 2017
1 parent 017ef5b commit 78e30aa
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
4 changes: 3 additions & 1 deletion core/arch/arm/plat-marvell/platform_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
#ifndef PLATFORM_CONFIG_H
#define PLATFORM_CONFIG_H

#include <util.h>

/* Make stacks aligned to data cache line length */
#define STACK_ALIGNMENT 64

Expand Down Expand Up @@ -91,7 +93,7 @@
#error "Unknown platform flavor"
#endif

#define CFG_TEE_RAM_VA_SIZE (4 * 1024 * 1024)
#define CFG_TEE_RAM_VA_SIZE SIZE_4M

#ifndef CFG_TEE_LOAD_ADDR
#define CFG_TEE_LOAD_ADDR CFG_TEE_RAM_START
Expand Down
14 changes: 8 additions & 6 deletions lib/libutils/ext/include/util.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@
#include <compiler.h>
#include <stdint.h>

#define SIZE_4K 0x1000UL
#define SIZE_1M 0x100000UL
#define SIZE_2M 0x200000UL
#define SIZE_4M 0x400000UL
#define SIZE_8M 0x800000UL
#define SIZE_2G 0x80000000UL
#define SIZE_4K UINTPTR_C(0x1000)
#define SIZE_1M UINTPTR_C(0x100000)
#define SIZE_2M UINTPTR_C(0x200000)
#define SIZE_4M UINTPTR_C(0x400000)
#define SIZE_8M UINTPTR_C(0x800000)
#define SIZE_2G UINTPTR_C(0x80000000)

#ifndef MAX
#define MAX(a, b) \
Expand All @@ -51,12 +51,14 @@

#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))

#ifndef ASM
/* Round up the even multiple of size, size has to be a multiple of 2 */
#define ROUNDUP(v, size) (((v) + ((__typeof__(v))(size) - 1)) & \
~((__typeof__(v))(size) - 1))

/* Round down the even multiple of size, size has to be a multiple of 2 */
#define ROUNDDOWN(v, size) ((v) & ~((__typeof__(v))(size) - 1))
#endif

/* x has to be of an unsigned type */
#define IS_POWER_OF_TWO(x) (((x) != 0) && (((x) & (~(x) + 1)) == (x)))
Expand Down

0 comments on commit 78e30aa

Please sign in to comment.