diff options
Diffstat (limited to 'include/lib')
-rw-r--r-- | include/lib/aarch64/arch.h | 10 | ||||
-rw-r--r-- | include/lib/aarch64/arch_helpers.h | 1 | ||||
-rw-r--r-- | include/lib/cpus/aarch32/cpu_macros.S | 92 | ||||
-rw-r--r-- | include/lib/cpus/aarch64/cpu_macros.S | 97 | ||||
-rw-r--r-- | include/lib/runtime_instr.h | 4 | ||||
-rw-r--r-- | include/lib/xlat_tables.h | 5 |
6 files changed, 176 insertions, 33 deletions
diff --git a/include/lib/aarch64/arch.h b/include/lib/aarch64/arch.h index a034ae20..989667a7 100644 --- a/include/lib/aarch64/arch.h +++ b/include/lib/aarch64/arch.h @@ -134,6 +134,16 @@ #define ID_AA64PFR0_GIC_WIDTH 4 #define ID_AA64PFR0_GIC_MASK ((1 << ID_AA64PFR0_GIC_WIDTH) - 1) +/* ID_AA64MMFR0_EL1 definitions */ +#define ID_AA64MMFR0_EL1_PARANGE_MASK 0xf + +#define PARANGE_0000 32 +#define PARANGE_0001 36 +#define PARANGE_0010 40 +#define PARANGE_0011 42 +#define PARANGE_0100 44 +#define PARANGE_0101 48 + /* ID_PFR1_EL1 definitions */ #define ID_PFR1_VIRTEXT_SHIFT 12 #define ID_PFR1_VIRTEXT_MASK 0xf diff --git a/include/lib/aarch64/arch_helpers.h b/include/lib/aarch64/arch_helpers.h index a013809b..aa262031 100644 --- a/include/lib/aarch64/arch_helpers.h +++ b/include/lib/aarch64/arch_helpers.h @@ -196,6 +196,7 @@ void __dead2 smc(uint64_t x0, uint64_t x1, uint64_t x2, uint64_t x3, ******************************************************************************/ DEFINE_SYSREG_READ_FUNC(midr_el1) DEFINE_SYSREG_READ_FUNC(mpidr_el1) +DEFINE_SYSREG_READ_FUNC(id_aa64mmfr0_el1) DEFINE_SYSREG_RW_FUNCS(scr_el3) DEFINE_SYSREG_RW_FUNCS(hcr_el2) diff --git a/include/lib/cpus/aarch32/cpu_macros.S b/include/lib/cpus/aarch32/cpu_macros.S index 2b9947e3..17dd2582 100644 --- a/include/lib/cpus/aarch32/cpu_macros.S +++ b/include/lib/cpus/aarch32/cpu_macros.S @@ -35,6 +35,15 @@ #define CPU_IMPL_PN_MASK (MIDR_IMPL_MASK << MIDR_IMPL_SHIFT) | \ (MIDR_PN_MASK << MIDR_PN_SHIFT) +/* The number of CPU operations allowed */ +#define CPU_MAX_PWR_DWN_OPS 2 + +/* Special constant to specify that CPU has no reset function */ +#define CPU_NO_RESET_FUNC 0 + +/* Word size for 32-bit CPUs */ +#define CPU_WORD_SIZE 4 + /* * Define the offsets to the fields in cpu_ops structure. */ @@ -47,33 +56,86 @@ CPU_RESET_FUNC: /* cpu_ops reset_func */ .space 4 #endif #if IMAGE_BL32 /* The power down core and cluster is needed only in BL32 */ -CPU_PWR_DWN_CORE: /* cpu_ops core_pwr_dwn */ - .space 4 -CPU_PWR_DWN_CLUSTER: /* cpu_ops cluster_pwr_dwn */ - .space 4 +CPU_PWR_DWN_OPS: /* cpu_ops power down functions */ + .space (4 * CPU_MAX_PWR_DWN_OPS) #endif CPU_OPS_SIZE = . /* - * Convenience macro to declare cpu_ops structure. - * Make sure the structure fields are as per the offsets - * defined above. + * Write given expressions as words + * + * _count: + * Write at least _count words. If the given number of expressions + * is less than _count, repeat the last expression to fill _count + * words in total + * _rest: + * Optional list of expressions. _this is for parameter extraction + * only, and has no significance to the caller + * + * Invoked as: + * fill_constants 2, foo, bar, blah, ... + */ + .macro fill_constants _count:req, _this, _rest:vararg + .ifgt \_count + /* Write the current expression */ + .ifb \_this + .error "Nothing to fill" + .endif + .word \_this + + /* Invoke recursively for remaining expressions */ + .ifnb \_rest + fill_constants \_count-1, \_rest + .else + fill_constants \_count-1, \_this + .endif + .endif + .endm + + /* + * Declare CPU operations + * + * _name: + * Name of the CPU for which operations are being specified + * _midr: + * Numeric value expected to read from CPU's MIDR + * _resetfunc: + * Reset function for the CPU. If there's no CPU reset function, + * specify CPU_NO_RESET_FUNC + * _power_down_ops: + * Comma-separated list of functions to perform power-down + * operatios on the CPU. At least one, and up to + * CPU_MAX_PWR_DWN_OPS number of functions may be specified. + * Starting at power level 0, these functions shall handle power + * down at subsequent power levels. If there aren't exactly + * CPU_MAX_PWR_DWN_OPS functions, the last specified one will be + * used to handle power down at subsequent levels */ - .macro declare_cpu_ops _name:req, _midr:req, _noresetfunc = 0 + .macro declare_cpu_ops _name:req, _midr:req, _resetfunc:req, \ + _power_down_ops:vararg .section cpu_ops, "a" .align 2 .type cpu_ops_\_name, %object .word \_midr #if IMAGE_BL1 || IMAGE_BL32 - .if \_noresetfunc - .word 0 - .else - .word \_name\()_reset_func - .endif + .word \_resetfunc #endif #if IMAGE_BL32 - .word \_name\()_core_pwr_dwn - .word \_name\()_cluster_pwr_dwn +1: + /* Insert list of functions */ + fill_constants CPU_MAX_PWR_DWN_OPS, \_power_down_ops +2: + /* + * Error if no or more than CPU_MAX_PWR_DWN_OPS were specified in the + * list + */ + .ifeq 2b - 1b + .error "At least one power down function must be specified" + .else + .iflt 2b - 1b - (CPU_MAX_PWR_DWN_OPS * CPU_WORD_SIZE) + .error "More than CPU_MAX_PWR_DWN_OPS functions specified" + .endif + .endif #endif .endm diff --git a/include/lib/cpus/aarch64/cpu_macros.S b/include/lib/cpus/aarch64/cpu_macros.S index f34f0783..570ef884 100644 --- a/include/lib/cpus/aarch64/cpu_macros.S +++ b/include/lib/cpus/aarch64/cpu_macros.S @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2015, ARM Limited and Contributors. All rights reserved. + * Copyright (c) 2014-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: @@ -35,6 +35,15 @@ #define CPU_IMPL_PN_MASK (MIDR_IMPL_MASK << MIDR_IMPL_SHIFT) | \ (MIDR_PN_MASK << MIDR_PN_SHIFT) +/* The number of CPU operations allowed */ +#define CPU_MAX_PWR_DWN_OPS 2 + +/* Special constant to specify that CPU has no reset function */ +#define CPU_NO_RESET_FUNC 0 + +/* Word size for 64-bit CPUs */ +#define CPU_WORD_SIZE 8 + /* * Define the offsets to the fields in cpu_ops structure. */ @@ -47,10 +56,8 @@ CPU_RESET_FUNC: /* cpu_ops reset_func */ .space 8 #endif #if IMAGE_BL31 /* The power down core and cluster is needed only in BL31 */ -CPU_PWR_DWN_CORE: /* cpu_ops core_pwr_dwn */ - .space 8 -CPU_PWR_DWN_CLUSTER: /* cpu_ops cluster_pwr_dwn */ - .space 8 +CPU_PWR_DWN_OPS: /* cpu_ops power down functions */ + .space (8 * CPU_MAX_PWR_DWN_OPS) #endif #if (IMAGE_BL31 && CRASH_REPORTING) CPU_REG_DUMP: /* cpu specific register dump for crash reporting */ @@ -59,24 +66,80 @@ CPU_REG_DUMP: /* cpu specific register dump for crash reporting */ CPU_OPS_SIZE = . /* - * Convenience macro to declare cpu_ops structure. - * Make sure the structure fields are as per the offsets - * defined above. + * Write given expressions as quad words + * + * _count: + * Write at least _count quad words. If the given number of + * expressions is less than _count, repeat the last expression to + * fill _count quad words in total + * _rest: + * Optional list of expressions. _this is for parameter extraction + * only, and has no significance to the caller + * + * Invoked as: + * fill_constants 2, foo, bar, blah, ... + */ + .macro fill_constants _count:req, _this, _rest:vararg + .ifgt \_count + /* Write the current expression */ + .ifb \_this + .error "Nothing to fill" + .endif + .quad \_this + + /* Invoke recursively for remaining expressions */ + .ifnb \_rest + fill_constants \_count-1, \_rest + .else + fill_constants \_count-1, \_this + .endif + .endif + .endm + + /* + * Declare CPU operations + * + * _name: + * Name of the CPU for which operations are being specified + * _midr: + * Numeric value expected to read from CPU's MIDR + * _resetfunc: + * Reset function for the CPU. If there's no CPU reset function, + * specify CPU_NO_RESET_FUNC + * _power_down_ops: + * Comma-separated list of functions to perform power-down + * operatios on the CPU. At least one, and up to + * CPU_MAX_PWR_DWN_OPS number of functions may be specified. + * Starting at power level 0, these functions shall handle power + * down at subsequent power levels. If there aren't exactly + * CPU_MAX_PWR_DWN_OPS functions, the last specified one will be + * used to handle power down at subsequent levels */ - .macro declare_cpu_ops _name:req, _midr:req, _noresetfunc = 0 - .section cpu_ops, "a"; .align 3 + .macro declare_cpu_ops _name:req, _midr:req, _resetfunc:req, \ + _power_down_ops:vararg + .section cpu_ops, "a" + .align 3 .type cpu_ops_\_name, %object .quad \_midr #if IMAGE_BL1 || IMAGE_BL31 - .if \_noresetfunc - .quad 0 - .else - .quad \_name\()_reset_func - .endif + .quad \_resetfunc #endif #if IMAGE_BL31 - .quad \_name\()_core_pwr_dwn - .quad \_name\()_cluster_pwr_dwn +1: + /* Insert list of functions */ + fill_constants CPU_MAX_PWR_DWN_OPS, \_power_down_ops +2: + /* + * Error if no or more than CPU_MAX_PWR_DWN_OPS were specified in the + * list + */ + .ifeq 2b - 1b + .error "At least one power down function must be specified" + .else + .iflt 2b - 1b - (CPU_MAX_PWR_DWN_OPS * CPU_WORD_SIZE) + .error "More than CPU_MAX_PWR_DWN_OPS functions specified" + .endif + .endif #endif #if (IMAGE_BL31 && CRASH_REPORTING) .quad \_name\()_cpu_reg_dump diff --git a/include/lib/runtime_instr.h b/include/lib/runtime_instr.h index d4090027..4d05ba4b 100644 --- a/include/lib/runtime_instr.h +++ b/include/lib/runtime_instr.h @@ -31,11 +31,13 @@ #ifndef __RUNTIME_INSTR_H__ #define __RUNTIME_INSTR_H__ -#define RT_INSTR_TOTAL_IDS 4 #define RT_INSTR_ENTER_PSCI 0 #define RT_INSTR_EXIT_PSCI 1 #define RT_INSTR_ENTER_HW_LOW_PWR 2 #define RT_INSTR_EXIT_HW_LOW_PWR 3 +#define RT_INSTR_ENTER_CFLUSH 4 +#define RT_INSTR_EXIT_CFLUSH 5 +#define RT_INSTR_TOTAL_IDS 6 #ifndef __ASSEMBLY__ PMF_DECLARE_CAPTURE_TIMESTAMP(rt_instr_svc) diff --git a/include/lib/xlat_tables.h b/include/lib/xlat_tables.h index 0e9800ab..f4476183 100644 --- a/include/lib/xlat_tables.h +++ b/include/lib/xlat_tables.h @@ -93,6 +93,11 @@ #define L2_XLAT_ADDRESS_SHIFT (L3_XLAT_ADDRESS_SHIFT + XLAT_TABLE_ENTRIES_SHIFT) #define L1_XLAT_ADDRESS_SHIFT (L2_XLAT_ADDRESS_SHIFT + XLAT_TABLE_ENTRIES_SHIFT) #define L0_XLAT_ADDRESS_SHIFT (L1_XLAT_ADDRESS_SHIFT + XLAT_TABLE_ENTRIES_SHIFT) +#define XLAT_ADDR_SHIFT(level) (PAGE_SIZE_SHIFT + \ + ((XLAT_TABLE_LEVEL_MAX - (level)) * XLAT_TABLE_ENTRIES_SHIFT)) + +#define XLAT_BLOCK_SIZE(level) ((u_register_t)1 << XLAT_ADDR_SHIFT(level)) +#define XLAT_BLOCK_MASK(level) (XLAT_BLOCK_SIZE(level) - 1) /* * AP[1] bit is ignored by hardware and is |