Add 32 bit version of plat_get_syscnt_freq

Added plat_get_syscnt_freq2, which is a 32 bit variant of the 64 bit
plat_get_syscnt_freq. The old one has been flagged as deprecated.
Common code has been updated to use this new version. Porting guide
has been updated.

Change-Id: I9e913544926c418970972bfe7d81ee88b4da837e
This commit is contained in:
Antonio Nino Diaz 2016-05-18 16:53:31 +01:00
parent d1d716531d
commit d44863910c
5 changed files with 22 additions and 6 deletions

View file

@ -44,7 +44,7 @@
void bl31_arch_setup(void) void bl31_arch_setup(void)
{ {
/* Program the counter frequency */ /* Program the counter frequency */
write_cntfrq_el0(plat_get_syscnt_freq()); write_cntfrq_el0(plat_get_syscnt_freq2());
/* Initialize the cpu_ops pointer. */ /* Initialize the cpu_ops pointer. */
init_cpu_ops(); init_cpu_ops();

View file

@ -1529,10 +1529,10 @@ state. This function must return a pointer to the `entry_point_info` structure
(that was copied during `bl31_early_platform_setup()`) if the image exists. It (that was copied during `bl31_early_platform_setup()`) if the image exists. It
should return NULL otherwise. should return NULL otherwise.
### Function : plat_get_syscnt_freq() [mandatory] ### Function : plat_get_syscnt_freq2() [mandatory]
Argument : void Argument : void
Return : uint64_t Return : unsigned int
This function is used by the architecture setup code to retrieve the counter This function is used by the architecture setup code to retrieve the counter
frequency for the CPU's generic timer. This value will be programmed into the frequency for the CPU's generic timer. This value will be programmed into the

View file

@ -56,7 +56,9 @@ struct image_desc;
/******************************************************************************* /*******************************************************************************
* Mandatory common functions * Mandatory common functions
******************************************************************************/ ******************************************************************************/
unsigned long long plat_get_syscnt_freq(void); unsigned long long plat_get_syscnt_freq(void) __deprecated;
unsigned int plat_get_syscnt_freq2(void);
int plat_get_image_source(unsigned int image_id, int plat_get_image_source(unsigned int image_id,
uintptr_t *dev_handle, uintptr_t *dev_handle,
uintptr_t *image_spec); uintptr_t *image_spec);

View file

@ -40,6 +40,9 @@
#pragma weak bl31_plat_enable_mmu #pragma weak bl31_plat_enable_mmu
#pragma weak bl32_plat_enable_mmu #pragma weak bl32_plat_enable_mmu
#pragma weak bl31_plat_runtime_setup #pragma weak bl31_plat_runtime_setup
#if !ERROR_DEPRECATED
#pragma weak plat_get_syscnt_freq2
#endif /* ERROR_DEPRECATED */
void bl31_plat_enable_mmu(uint32_t flags) void bl31_plat_enable_mmu(uint32_t flags)
{ {
@ -74,3 +77,14 @@ unsigned int platform_core_pos_helper(unsigned long mpidr)
} }
#endif #endif
#if !ERROR_DEPRECATED
unsigned int plat_get_syscnt_freq2(void)
{
unsigned long long freq = plat_get_syscnt_freq();
assert(freq >> 32 == 0);
return (unsigned int)freq;
}
#endif /* ERROR_DEPRECATED */

View file

@ -214,7 +214,7 @@ exit:
void psci_cpu_suspend_finish(unsigned int cpu_idx, void psci_cpu_suspend_finish(unsigned int cpu_idx,
psci_power_state_t *state_info) psci_power_state_t *state_info)
{ {
unsigned long long counter_freq; unsigned int counter_freq;
unsigned int max_off_lvl; unsigned int max_off_lvl;
/* Ensure we have been woken up from a suspended state */ /* Ensure we have been woken up from a suspended state */
@ -238,7 +238,7 @@ void psci_cpu_suspend_finish(unsigned int cpu_idx,
psci_do_pwrup_cache_maintenance(); psci_do_pwrup_cache_maintenance();
/* Re-init the cntfrq_el0 register */ /* Re-init the cntfrq_el0 register */
counter_freq = plat_get_syscnt_freq(); counter_freq = plat_get_syscnt_freq2();
write_cntfrq_el0(counter_freq); write_cntfrq_el0(counter_freq);
/* /*