Fix types of arch.h definitions
Define the values as unsigned int or unsigned long long based on the
actual size of the register. This prevents subtle issues caused by
having a type that is too small. For example:

    #define OPTION_ENABLE 0x3
    #define OPTION_SHIFT  32

    uint64_t mask = OPTION_ENABLE << OPTION_SHIFT;

Because OPTION_ENABLE fits in an int, the value is considered an int.
This means that, after shifting it 32 places to the left, the final
result is 0. The correct way to define the values is:

    #define OPTION_ENABLE ULL(0x3)
    #define OPTION_SHIFT  U(32)

In this case, the compiler is forced to use a 64 bit value from the
start, so shifting it 32 places to the left results in the expected
value.

Change-Id: Ieaf2ffc2d8caa48c622db011f2aef549e713e019
Signed-off-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
1 parent 0107aa4 commit 30399885f5ab98b48c3053bf052642bc2cb1c243
@Antonio Nino Diaz Antonio Nino Diaz authored on 12 Jul 2018
Showing 4 changed files
View
include/lib/aarch32/arch.h
View
include/lib/aarch64/arch.h
View
plat/mediatek/mt6795/power_tracer.c
View
plat/mediatek/mt8173/power_tracer.c