Commit 22e002da authored by Dan Handley's avatar Dan Handley
Browse files

Merge pull request #112 from danh-arm:dh/refactor-plat-header-v4 into for-v0.4

parents f53d0fce 9865ac15
...@@ -30,7 +30,6 @@ ...@@ -30,7 +30,6 @@
#include <assert.h> #include <assert.h>
#include <console.h> #include <console.h>
#include <platform.h>
#include <pl011.h> #include <pl011.h>
static unsigned long uart_base; static unsigned long uart_base;
......
...@@ -29,6 +29,7 @@ ...@@ -29,6 +29,7 @@
*/ */
#include <assert.h> #include <assert.h>
#include <bl_common.h>
#include <debug.h> #include <debug.h>
#include <errno.h> #include <errno.h>
#include <firmware_image_package.h> #include <firmware_image_package.h>
...@@ -36,6 +37,7 @@ ...@@ -36,6 +37,7 @@
#include <io_fip.h> #include <io_fip.h>
#include <io_storage.h> #include <io_storage.h>
#include <platform.h> #include <platform.h>
#include <platform_def.h>
#include <stdint.h> #include <stdint.h>
#include <string.h> #include <string.h>
#include <uuid.h> #include <uuid.h>
......
...@@ -33,30 +33,14 @@ ...@@ -33,30 +33,14 @@
#include <stdint.h> #include <stdint.h>
/*******************************************************************************
* Data declarations
******************************************************************************/
extern unsigned long bl31_entrypoint;
/******************************************
* Forward declarations
*****************************************/
struct meminfo;
struct entry_point_info;
struct bl31_parms;
/******************************************************************************* /*******************************************************************************
* Function prototypes * Function prototypes
******************************************************************************/ ******************************************************************************/
extern void bl31_arch_setup(void); void bl31_arch_setup(void);
extern void bl31_next_el_arch_setup(uint32_t security_state); void bl31_next_el_arch_setup(uint32_t security_state);
extern void bl31_set_next_image_type(uint32_t type); void bl31_set_next_image_type(uint32_t type);
extern uint32_t bl31_get_next_image_type(void); uint32_t bl31_get_next_image_type(void);
extern void bl31_prepare_next_image_entry(); void bl31_prepare_next_image_entry();
extern struct entry_point_info *bl31_get_next_image_info(uint32_t type); void bl31_register_bl32_init(int32_t (*)(void));
extern void bl31_early_platform_setup(struct bl31_params *from_bl2,
void *plat_params_from_bl2);
extern void bl31_platform_setup(void);
extern void bl31_register_bl32_init(int32_t (*)(void));
#endif /* __BL31_H__ */ #endif /* __BL31_H__ */
...@@ -36,24 +36,24 @@ ...@@ -36,24 +36,24 @@
/******************************************************************************* /*******************************************************************************
* Function & variable prototypes * Function & variable prototypes
******************************************************************************/ ******************************************************************************/
extern void cm_init(void); void cm_init(void);
extern void *cm_get_context(uint64_t mpidr, uint32_t security_state); void *cm_get_context(uint64_t mpidr, uint32_t security_state);
extern void cm_set_context(uint64_t mpidr, void cm_set_context(uint64_t mpidr,
void *context, void *context,
uint32_t security_state); uint32_t security_state);
extern void cm_el3_sysregs_context_save(uint32_t security_state); void cm_el3_sysregs_context_save(uint32_t security_state);
extern void cm_el3_sysregs_context_restore(uint32_t security_state); void cm_el3_sysregs_context_restore(uint32_t security_state);
extern void cm_el1_sysregs_context_save(uint32_t security_state); void cm_el1_sysregs_context_save(uint32_t security_state);
extern void cm_el1_sysregs_context_restore(uint32_t security_state); void cm_el1_sysregs_context_restore(uint32_t security_state);
extern void cm_set_el3_eret_context(uint32_t security_state, uint64_t entrypoint, void cm_set_el3_eret_context(uint32_t security_state, uint64_t entrypoint,
uint32_t spsr, uint32_t scr); uint32_t spsr, uint32_t scr);
extern void cm_set_elr_el3(uint32_t security_state, uint64_t entrypoint); void cm_set_elr_el3(uint32_t security_state, uint64_t entrypoint);
extern void cm_write_scr_el3_bit(uint32_t security_state, void cm_write_scr_el3_bit(uint32_t security_state,
uint32_t bit_pos, uint32_t bit_pos,
uint32_t value); uint32_t value);
extern void cm_set_next_eret_context(uint32_t security_state); void cm_set_next_eret_context(uint32_t security_state);
extern void cm_init_pcpu_ptr_cache(); void cm_init_pcpu_ptr_cache();
extern void cm_set_pcpu_ptr_cache(const void *pcpu_ptr); void cm_set_pcpu_ptr_cache(const void *pcpu_ptr);
extern void *cm_get_pcpu_ptr_cache(void); void *cm_get_pcpu_ptr_cache(void);
extern uint32_t cm_get_scr_el3(uint32_t security_state); uint32_t cm_get_scr_el3(uint32_t security_state);
#endif /* __CM_H__ */ #endif /* __CM_H__ */
...@@ -117,12 +117,12 @@ typedef uint64_t (*interrupt_type_handler_t)(uint32_t id, ...@@ -117,12 +117,12 @@ typedef uint64_t (*interrupt_type_handler_t)(uint32_t id,
/******************************************************************************* /*******************************************************************************
* Function & variable prototypes * Function & variable prototypes
******************************************************************************/ ******************************************************************************/
extern uint32_t get_scr_el3_from_routing_model(uint32_t security_state); uint32_t get_scr_el3_from_routing_model(uint32_t security_state);
extern int32_t set_routing_model(uint32_t type, uint32_t flags); int32_t set_routing_model(uint32_t type, uint32_t flags);
extern int32_t register_interrupt_type_handler(uint32_t type, int32_t register_interrupt_type_handler(uint32_t type,
interrupt_type_handler_t handler, interrupt_type_handler_t handler,
uint32_t flags); uint32_t flags);
extern interrupt_type_handler_t get_interrupt_type_handler(uint32_t interrupt_type); interrupt_type_handler_t get_interrupt_type_handler(uint32_t interrupt_type);
#endif /*__ASSEMBLY__*/ #endif /*__ASSEMBLY__*/
#endif /* __INTERRUPT_MGMT_H__ */ #endif /* __INTERRUPT_MGMT_H__ */
...@@ -264,10 +264,10 @@ CASSERT(RT_SVC_DESC_HANDLE == __builtin_offsetof(rt_svc_desc_t, handle), \ ...@@ -264,10 +264,10 @@ CASSERT(RT_SVC_DESC_HANDLE == __builtin_offsetof(rt_svc_desc_t, handle), \
/******************************************************************************* /*******************************************************************************
* Function & variable prototypes * Function & variable prototypes
******************************************************************************/ ******************************************************************************/
extern void runtime_svc_init(); void runtime_svc_init();
extern uint64_t __RT_SVC_DESCS_START__; extern uint64_t __RT_SVC_DESCS_START__;
extern uint64_t __RT_SVC_DESCS_END__; extern uint64_t __RT_SVC_DESCS_END__;
extern uint64_t get_crash_stack(uint64_t mpidr); uint64_t get_crash_stack(uint64_t mpidr);
extern void runtime_exceptions(void); void runtime_exceptions(void);
#endif /*__ASSEMBLY__*/ #endif /*__ASSEMBLY__*/
#endif /* __RUNTIME_SVC_H__ */ #endif /* __RUNTIME_SVC_H__ */
...@@ -178,36 +178,36 @@ typedef struct spd_pm_ops { ...@@ -178,36 +178,36 @@ typedef struct spd_pm_ops {
/******************************************************************************* /*******************************************************************************
* Function & Data prototypes * Function & Data prototypes
******************************************************************************/ ******************************************************************************/
extern unsigned int psci_version(void); unsigned int psci_version(void);
extern int __psci_cpu_suspend(unsigned int, unsigned long, unsigned long); int __psci_cpu_suspend(unsigned int, unsigned long, unsigned long);
extern int __psci_cpu_off(void); int __psci_cpu_off(void);
extern int psci_affinity_info(unsigned long, unsigned int); int psci_affinity_info(unsigned long, unsigned int);
extern int psci_migrate(unsigned int); int psci_migrate(unsigned int);
extern unsigned int psci_migrate_info_type(void); unsigned int psci_migrate_info_type(void);
extern unsigned long psci_migrate_info_up_cpu(void); unsigned long psci_migrate_info_up_cpu(void);
extern void psci_system_off(void); void psci_system_off(void);
extern void psci_system_reset(void); void psci_system_reset(void);
extern int psci_cpu_on(unsigned long, int psci_cpu_on(unsigned long,
unsigned long, unsigned long,
unsigned long); unsigned long);
extern void __dead2 psci_power_down_wfi(void); void __dead2 psci_power_down_wfi(void);
extern void psci_aff_on_finish_entry(void); void psci_aff_on_finish_entry(void);
extern void psci_aff_suspend_finish_entry(void); void psci_aff_suspend_finish_entry(void);
extern void psci_register_spd_pm_hook(const spd_pm_ops_t *); void psci_register_spd_pm_hook(const spd_pm_ops_t *);
extern int psci_get_suspend_stateid(unsigned long mpidr); int psci_get_suspend_stateid(unsigned long mpidr);
extern int psci_get_suspend_afflvl(unsigned long mpidr); int psci_get_suspend_afflvl(unsigned long mpidr);
extern uint64_t psci_smc_handler(uint32_t smc_fid, uint64_t psci_smc_handler(uint32_t smc_fid,
uint64_t x1, uint64_t x1,
uint64_t x2, uint64_t x2,
uint64_t x3, uint64_t x3,
uint64_t x4, uint64_t x4,
void *cookie, void *cookie,
void *handle, void *handle,
uint64_t flags); uint64_t flags);
/* PSCI setup function */ /* PSCI setup function */
extern int32_t psci_setup(void); int32_t psci_setup(void);
#endif /*__ASSEMBLY__*/ #endif /*__ASSEMBLY__*/
......
/*
* Copyright (c) 2013-2014, 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:
*
* Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* Neither the name of ARM nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific
* prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef __BL32_H__
#define __BL32_H__
#include <stdint.h>
/******************************************
* Forward declarations
*****************************************/
struct meminfo;
/******************************************
* Function prototypes
*****************************************/
extern void bl32_platform_setup(void);
extern struct meminfo *bl32_plat_sec_mem_layout(void);
extern uint64_t bl32_main(void);
#endif /* __BL32_H__ */
...@@ -113,7 +113,7 @@ ...@@ -113,7 +113,7 @@
#ifndef __ASSEMBLY__ #ifndef __ASSEMBLY__
#include <cassert.h> #include <cassert.h>
#include <platform.h> /* For CACHE_WRITEBACK_GRANULE */ #include <platform_def.h> /* For CACHE_WRITEBACK_GRANULE */
#include <spinlock.h> #include <spinlock.h>
#include <stdint.h> #include <stdint.h>
...@@ -157,43 +157,43 @@ typedef struct tsp_args { ...@@ -157,43 +157,43 @@ typedef struct tsp_args {
*/ */
CASSERT(TSP_ARGS_SIZE == sizeof(tsp_args_t), assert_sp_args_size_mismatch); CASSERT(TSP_ARGS_SIZE == sizeof(tsp_args_t), assert_sp_args_size_mismatch);
extern void tsp_get_magic(uint64_t args[4]); void tsp_get_magic(uint64_t args[4]);
extern tsp_args_t *tsp_cpu_resume_main(uint64_t arg0, tsp_args_t *tsp_cpu_resume_main(uint64_t arg0,
uint64_t arg1, uint64_t arg1,
uint64_t arg2, uint64_t arg2,
uint64_t arg3, uint64_t arg3,
uint64_t arg4, uint64_t arg4,
uint64_t arg5, uint64_t arg5,
uint64_t arg6, uint64_t arg6,
uint64_t arg7); uint64_t arg7);
extern tsp_args_t *tsp_cpu_suspend_main(uint64_t arg0, tsp_args_t *tsp_cpu_suspend_main(uint64_t arg0,
uint64_t arg1, uint64_t arg1,
uint64_t arg2, uint64_t arg2,
uint64_t arg3, uint64_t arg3,
uint64_t arg4, uint64_t arg4,
uint64_t arg5, uint64_t arg5,
uint64_t arg6, uint64_t arg6,
uint64_t arg7); uint64_t arg7);
extern tsp_args_t *tsp_cpu_on_main(void); tsp_args_t *tsp_cpu_on_main(void);
extern tsp_args_t *tsp_cpu_off_main(uint64_t arg0, tsp_args_t *tsp_cpu_off_main(uint64_t arg0,
uint64_t arg1, uint64_t arg1,
uint64_t arg2, uint64_t arg2,
uint64_t arg3, uint64_t arg3,
uint64_t arg4, uint64_t arg4,
uint64_t arg5, uint64_t arg5,
uint64_t arg6, uint64_t arg6,
uint64_t arg7); uint64_t arg7);
/* Generic Timer functions */ /* Generic Timer functions */
extern void tsp_generic_timer_start(void); void tsp_generic_timer_start(void);
extern void tsp_generic_timer_handler(void); void tsp_generic_timer_handler(void);
extern void tsp_generic_timer_stop(void); void tsp_generic_timer_stop(void);
extern void tsp_generic_timer_save(void); void tsp_generic_timer_save(void);
extern void tsp_generic_timer_restore(void); void tsp_generic_timer_restore(void);
/* FIQ management functions */ /* FIQ management functions */
extern void tsp_update_sync_fiq_stats(uint32_t type, uint64_t elr_el3); void tsp_update_sync_fiq_stats(uint32_t type, uint64_t elr_el3);
/* Data structure to keep track of TSP statistics */ /* Data structure to keep track of TSP statistics */
extern spinlock_t console_lock; extern spinlock_t console_lock;
......
...@@ -194,23 +194,15 @@ CASSERT(sizeof(unsigned long) == ...@@ -194,23 +194,15 @@ CASSERT(sizeof(unsigned long) ==
/******************************************************************************* /*******************************************************************************
* Function & variable prototypes * Function & variable prototypes
******************************************************************************/ ******************************************************************************/
extern unsigned long page_align(unsigned long, unsigned); unsigned long page_align(unsigned long, unsigned);
extern void change_security_state(unsigned int); void change_security_state(unsigned int);
extern void init_bl2_mem_layout(meminfo_t *, unsigned long image_size(const char *);
meminfo_t *, int load_image(meminfo_t *,
unsigned int, const char *,
unsigned long) __attribute__((weak)); unsigned int,
extern void init_bl31_mem_layout(const meminfo_t *, unsigned long,
meminfo_t *, image_info_t *,
unsigned int) __attribute__((weak)); entry_point_info_t *);
extern unsigned long image_size(const char *);
extern int load_image(meminfo_t *,
const char *,
unsigned int,
unsigned long,
image_info_t *,
entry_point_info_t *);
extern unsigned long *get_el_change_mem_ptr(void);
extern const char build_message[]; extern const char build_message[];
#endif /*__ASSEMBLY__*/ #endif /*__ASSEMBLY__*/
......
...@@ -57,15 +57,15 @@ ...@@ -57,15 +57,15 @@
* spin. This can be expanded in the future to provide more information. * spin. This can be expanded in the future to provide more information.
*/ */
#if DEBUG #if DEBUG
extern void __dead2 do_panic(const char *file, int line); void __dead2 do_panic(const char *file, int line);
#define panic() do_panic(__FILE__, __LINE__) #define panic() do_panic(__FILE__, __LINE__)
#else #else
extern void __dead2 do_panic(void); void __dead2 do_panic(void);
#define panic() do_panic() #define panic() do_panic()
#endif #endif
extern void print_string_value(char *s, unsigned long *mem); void print_string_value(char *s, unsigned long *mem);
#endif /* __DEBUG_H__ */ #endif /* __DEBUG_H__ */
...@@ -66,7 +66,7 @@ ...@@ -66,7 +66,7 @@
#define CHANGE_PENDING_BIT (1 << 0) #define CHANGE_PENDING_BIT (1 << 0)
/* Function declarations */ /* Function declarations */
extern void cci_enable_coherency(unsigned long mpidr); void cci_enable_coherency(unsigned long mpidr);
extern void cci_disable_coherency(unsigned long mpidr); void cci_disable_coherency(unsigned long mpidr);
#endif /* __CCI_400_H__ */ #endif /* __CCI_400_H__ */
...@@ -143,41 +143,41 @@ ...@@ -143,41 +143,41 @@
* GIC Distributor function prototypes * GIC Distributor function prototypes
******************************************************************************/ ******************************************************************************/
extern unsigned int gicd_read_igroupr(unsigned int, unsigned int); unsigned int gicd_read_igroupr(unsigned int, unsigned int);
extern unsigned int gicd_read_isenabler(unsigned int, unsigned int); unsigned int gicd_read_isenabler(unsigned int, unsigned int);
extern unsigned int gicd_read_icenabler(unsigned int, unsigned int); unsigned int gicd_read_icenabler(unsigned int, unsigned int);
extern unsigned int gicd_read_ispendr(unsigned int, unsigned int); unsigned int gicd_read_ispendr(unsigned int, unsigned int);
extern unsigned int gicd_read_icpendr(unsigned int, unsigned int); unsigned int gicd_read_icpendr(unsigned int, unsigned int);
extern unsigned int gicd_read_isactiver(unsigned int, unsigned int); unsigned int gicd_read_isactiver(unsigned int, unsigned int);
extern unsigned int gicd_read_icactiver(unsigned int, unsigned int); unsigned int gicd_read_icactiver(unsigned int, unsigned int);
extern unsigned int gicd_read_ipriorityr(unsigned int, unsigned int); unsigned int gicd_read_ipriorityr(unsigned int, unsigned int);
extern unsigned int gicd_read_itargetsr(unsigned int, unsigned int); unsigned int gicd_read_itargetsr(unsigned int, unsigned int);
extern unsigned int gicd_read_icfgr(unsigned int, unsigned int); unsigned int gicd_read_icfgr(unsigned int, unsigned int);
extern unsigned int gicd_read_cpendsgir(unsigned int, unsigned int); unsigned int gicd_read_cpendsgir(unsigned int, unsigned int);
extern unsigned int gicd_read_spendsgir(unsigned int, unsigned int); unsigned int gicd_read_spendsgir(unsigned int, unsigned int);
extern void gicd_write_igroupr(unsigned int, unsigned int, unsigned int); void gicd_write_igroupr(unsigned int, unsigned int, unsigned int);
extern void gicd_write_isenabler(unsigned int, unsigned int, unsigned int); void gicd_write_isenabler(unsigned int, unsigned int, unsigned int);
extern void gicd_write_icenabler(unsigned int, unsigned int, unsigned int); void gicd_write_icenabler(unsigned int, unsigned int, unsigned int);
extern void gicd_write_ispendr(unsigned int, unsigned int, unsigned int); void gicd_write_ispendr(unsigned int, unsigned int, unsigned int);
extern void gicd_write_icpendr(unsigned int, unsigned int, unsigned int); void gicd_write_icpendr(unsigned int, unsigned int, unsigned int);
extern void gicd_write_isactiver(unsigned int, unsigned int, unsigned int); void gicd_write_isactiver(unsigned int, unsigned int, unsigned int);
extern void gicd_write_icactiver(unsigned int, unsigned int, unsigned int); void gicd_write_icactiver(unsigned int, unsigned int, unsigned int);
extern void gicd_write_ipriorityr(unsigned int, unsigned int, unsigned int); void gicd_write_ipriorityr(unsigned int, unsigned int, unsigned int);
extern void gicd_write_itargetsr(unsigned int, unsigned int, unsigned int); void gicd_write_itargetsr(unsigned int, unsigned int, unsigned int);
extern void gicd_write_icfgr(unsigned int, unsigned int, unsigned int); void gicd_write_icfgr(unsigned int, unsigned int, unsigned int);
extern void gicd_write_cpendsgir(unsigned int, unsigned int, unsigned int); void gicd_write_cpendsgir(unsigned int, unsigned int, unsigned int);
extern void gicd_write_spendsgir(unsigned int, unsigned int, unsigned int); void gicd_write_spendsgir(unsigned int, unsigned int, unsigned int);
extern unsigned int gicd_get_igroupr(unsigned int, unsigned int); unsigned int gicd_get_igroupr(unsigned int, unsigned int);
extern void gicd_set_igroupr(unsigned int, unsigned int); void gicd_set_igroupr(unsigned int, unsigned int);
extern void gicd_clr_igroupr(unsigned int, unsigned int); void gicd_clr_igroupr(unsigned int, unsigned int);
extern void gicd_set_isenabler(unsigned int, unsigned int); void gicd_set_isenabler(unsigned int, unsigned int);
extern void gicd_set_icenabler(unsigned int, unsigned int); void gicd_set_icenabler(unsigned int, unsigned int);
extern void gicd_set_ispendr(unsigned int, unsigned int); void gicd_set_ispendr(unsigned int, unsigned int);
extern void gicd_set_icpendr(unsigned int, unsigned int); void gicd_set_icpendr(unsigned int, unsigned int);
extern void gicd_set_isactiver(unsigned int, unsigned int); void gicd_set_isactiver(unsigned int, unsigned int);
extern void gicd_set_icactiver(unsigned int, unsigned int); void gicd_set_icactiver(unsigned int, unsigned int);
extern void gicd_set_ipriorityr(unsigned int, unsigned int, unsigned int); void gicd_set_ipriorityr(unsigned int, unsigned int, unsigned int);
extern void gicd_set_itargetsr(unsigned int, unsigned int, unsigned int); void gicd_set_itargetsr(unsigned int, unsigned int, unsigned int);
/******************************************************************************* /*******************************************************************************
......
...@@ -68,13 +68,13 @@ ...@@ -68,13 +68,13 @@
******************************************************************************/ ******************************************************************************/
uintptr_t gicv3_get_rdist(uintptr_t gicr_base, uint64_t mpidr); uintptr_t gicv3_get_rdist(uintptr_t gicr_base, uint64_t mpidr);
extern unsigned int read_icc_sre_el1(void); unsigned int read_icc_sre_el1(void);
extern unsigned int read_icc_sre_el2(void); unsigned int read_icc_sre_el2(void);
extern unsigned int read_icc_sre_el3(void); unsigned int read_icc_sre_el3(void);
extern void write_icc_sre_el1(unsigned int); void write_icc_sre_el1(unsigned int);
extern void write_icc_sre_el2(unsigned int); void write_icc_sre_el2(unsigned int);
extern void write_icc_sre_el3(unsigned int); void write_icc_sre_el3(unsigned int);
extern void write_icc_pmr_el1(unsigned int); void write_icc_pmr_el1(unsigned int);
/******************************************************************************* /*******************************************************************************
* GIC Redistributor interface accessors * GIC Redistributor interface accessors
......
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
#define __IO_DRIVER_H__ #define __IO_DRIVER_H__
#include <io_storage.h> #include <io_storage.h>
#include <platform.h> /* For MAX_IO_DEVICES */ #include <platform_def.h> /* For MAX_IO_DEVICES */
#include <stdint.h> #include <stdint.h>
......
...@@ -394,4 +394,19 @@ ...@@ -394,4 +394,19 @@
#define EC_BITS(x) (x >> ESR_EC_SHIFT) & ESR_EC_MASK #define EC_BITS(x) (x >> ESR_EC_SHIFT) & ESR_EC_MASK
/*******************************************************************************
* Definitions of register offsets and fields in the CNTCTLBase Frame of the
* system level implementation of the Generic Timer.
******************************************************************************/
#define CNTNSAR 0x4
#define CNTNSAR_NS_SHIFT(x) x
#define CNTACR_BASE(x) (0x40 + (x << 2))
#define CNTACR_RPCT_SHIFT 0x0
#define CNTACR_RVCT_SHIFT 0x1
#define CNTACR_RFRQ_SHIFT 0x2
#define CNTACR_RVOFF_SHIFT 0x3
#define CNTACR_RWVT_SHIFT 0x4
#define CNTACR_RWPT_SHIFT 0x5
#endif /* __ARCH_H__ */ #endif /* __ARCH_H__ */
...@@ -37,243 +37,243 @@ ...@@ -37,243 +37,243 @@
/******************************************************************************* /*******************************************************************************
* Aarch64 translation tables manipulation helper prototypes * Aarch64 translation tables manipulation helper prototypes
******************************************************************************/ ******************************************************************************/
extern unsigned long create_table_desc(unsigned long *next_table_ptr); unsigned long create_table_desc(unsigned long *next_table_ptr);
extern unsigned long create_block_desc(unsigned long desc, unsigned long create_block_desc(unsigned long desc,
unsigned long addr, unsigned long addr,
unsigned int level); unsigned int level);
extern unsigned long create_device_block(unsigned long output_addr, unsigned long create_device_block(unsigned long output_addr,
unsigned int level, unsigned int level,
unsigned int ns); unsigned int ns);
extern unsigned long create_romem_block(unsigned long output_addr, unsigned long create_romem_block(unsigned long output_addr,
unsigned int level, unsigned int level,
unsigned int ns); unsigned int ns);
extern unsigned long create_rwmem_block(unsigned long output_addr, unsigned long create_rwmem_block(unsigned long output_addr,
unsigned int level, unsigned int level,
unsigned int ns); unsigned int ns);
/******************************************************************************* /*******************************************************************************
* TLB maintenance accessor prototypes * TLB maintenance accessor prototypes
******************************************************************************/ ******************************************************************************/
extern void tlbialle1(void); void tlbialle1(void);
extern void tlbialle1is(void); void tlbialle1is(void);
extern void tlbialle2(void); void tlbialle2(void);
extern void tlbialle2is(void); void tlbialle2is(void);
extern void tlbialle3(void); void tlbialle3(void);
extern void tlbialle3is(void); void tlbialle3is(void);
extern void tlbivmalle1(void); void tlbivmalle1(void);
/******************************************************************************* /*******************************************************************************
* Cache maintenance accessor prototypes * Cache maintenance accessor prototypes
******************************************************************************/ ******************************************************************************/
extern void dcisw(unsigned long); void dcisw(unsigned long);
extern void dccisw(unsigned long); void dccisw(unsigned long);
extern void dccsw(unsigned long); void dccsw(unsigned long);
extern void dccvac(unsigned long); void dccvac(unsigned long);
extern void dcivac(unsigned long); void dcivac(unsigned long);
extern void dccivac(unsigned long); void dccivac(unsigned long);
extern void dccvau(unsigned long); void dccvau(unsigned long);
extern void dczva(unsigned long); void dczva(unsigned long);
extern void flush_dcache_range(unsigned long, unsigned long); void flush_dcache_range(unsigned long, unsigned long);
extern void inv_dcache_range(unsigned long, unsigned long); void inv_dcache_range(unsigned long, unsigned long);
extern void dcsw_op_louis(unsigned int); void dcsw_op_louis(unsigned int);
extern void dcsw_op_all(unsigned int); void dcsw_op_all(unsigned int);
extern void disable_mmu_el3(void); void disable_mmu_el3(void);
extern void disable_mmu_icache_el3(void); void disable_mmu_icache_el3(void);
/******************************************************************************* /*******************************************************************************
* Misc. accessor prototypes * Misc. accessor prototypes
******************************************************************************/ ******************************************************************************/
extern void enable_irq(void); void enable_irq(void);
extern void enable_fiq(void); void enable_fiq(void);
extern void enable_serror(void); void enable_serror(void);
extern void enable_debug_exceptions(void); void enable_debug_exceptions(void);
extern void disable_irq(void); void disable_irq(void);
extern void disable_fiq(void); void disable_fiq(void);
extern void disable_serror(void); void disable_serror(void);
extern void disable_debug_exceptions(void); void disable_debug_exceptions(void);
extern unsigned long read_id_pfr1_el1(void); unsigned long read_id_pfr1_el1(void);
extern unsigned long read_id_aa64pfr0_el1(void); unsigned long read_id_aa64pfr0_el1(void);
extern unsigned long read_current_el(void); unsigned long read_current_el(void);
extern unsigned long read_daif(void); unsigned long read_daif(void);
extern unsigned long read_spsr_el1(void); unsigned long read_spsr_el1(void);
extern unsigned long read_spsr_el2(void); unsigned long read_spsr_el2(void);
extern unsigned long read_spsr_el3(void); unsigned long read_spsr_el3(void);
extern unsigned long read_elr_el1(void); unsigned long read_elr_el1(void);
extern unsigned long read_elr_el2(void); unsigned long read_elr_el2(void);
extern unsigned long read_elr_el3(void); unsigned long read_elr_el3(void);
extern void write_daif(unsigned long); void write_daif(unsigned long);
extern void write_spsr_el1(unsigned long); void write_spsr_el1(unsigned long);
extern void write_spsr_el2(unsigned long); void write_spsr_el2(unsigned long);
extern void write_spsr_el3(unsigned long); void write_spsr_el3(unsigned long);
extern void write_elr_el1(unsigned long); void write_elr_el1(unsigned long);
extern void write_elr_el2(unsigned long); void write_elr_el2(unsigned long);
extern void write_elr_el3(unsigned long); void write_elr_el3(unsigned long);
extern void wfi(void); void wfi(void);
extern void wfe(void); void wfe(void);
extern void rfe(void); void rfe(void);
extern void sev(void); void sev(void);
extern void dsb(void); void dsb(void);
extern void isb(void); void isb(void);
extern unsigned int get_afflvl_shift(unsigned int); unsigned int get_afflvl_shift(unsigned int);
extern unsigned int mpidr_mask_lower_afflvls(unsigned long, unsigned int); unsigned int mpidr_mask_lower_afflvls(unsigned long, unsigned int);
extern void __dead2 eret(unsigned long, unsigned long, void __dead2 eret(unsigned long, unsigned long,
unsigned long, unsigned long, unsigned long, unsigned long,
unsigned long, unsigned long, unsigned long, unsigned long,
unsigned long, unsigned long); unsigned long, unsigned long);
extern void __dead2 smc(unsigned long, unsigned long, void __dead2 smc(unsigned long, unsigned long,
unsigned long, unsigned long, unsigned long, unsigned long,
unsigned long, unsigned long, unsigned long, unsigned long,
unsigned long, unsigned long); unsigned long, unsigned long);
/******************************************************************************* /*******************************************************************************
* System register accessor prototypes * System register accessor prototypes
******************************************************************************/ ******************************************************************************/
extern unsigned long read_midr(void); unsigned long read_midr(void);
extern unsigned long read_mpidr(void); unsigned long read_mpidr(void);
extern unsigned long read_scr(void); unsigned long read_scr(void);
extern unsigned long read_hcr(void); unsigned long read_hcr(void);
extern unsigned long read_vbar_el1(void); unsigned long read_vbar_el1(void);
extern unsigned long read_vbar_el2(void); unsigned long read_vbar_el2(void);
extern unsigned long read_vbar_el3(void); unsigned long read_vbar_el3(void);
extern unsigned long read_sctlr_el1(void); unsigned long read_sctlr_el1(void);
extern unsigned long read_sctlr_el2(void); unsigned long read_sctlr_el2(void);
extern unsigned long read_sctlr_el3(void); unsigned long read_sctlr_el3(void);
extern unsigned long read_actlr_el1(void); unsigned long read_actlr_el1(void);
extern unsigned long read_actlr_el2(void); unsigned long read_actlr_el2(void);
extern unsigned long read_actlr_el3(void); unsigned long read_actlr_el3(void);
extern unsigned long read_esr_el1(void); unsigned long read_esr_el1(void);
extern unsigned long read_esr_el2(void); unsigned long read_esr_el2(void);
extern unsigned long read_esr_el3(void); unsigned long read_esr_el3(void);
extern unsigned long read_afsr0_el1(void); unsigned long read_afsr0_el1(void);
extern unsigned long read_afsr0_el2(void); unsigned long read_afsr0_el2(void);
extern unsigned long read_afsr0_el3(void); unsigned long read_afsr0_el3(void);
extern unsigned long read_afsr1_el1(void); unsigned long read_afsr1_el1(void);
extern unsigned long read_afsr1_el2(void); unsigned long read_afsr1_el2(void);
extern unsigned long read_afsr1_el3(void); unsigned long read_afsr1_el3(void);
extern unsigned long read_far_el1(void); unsigned long read_far_el1(void);
extern unsigned long read_far_el2(void); unsigned long read_far_el2(void);
extern unsigned long read_far_el3(void); unsigned long read_far_el3(void);
extern unsigned long read_mair_el1(void); unsigned long read_mair_el1(void);
extern unsigned long read_mair_el2(void); unsigned long read_mair_el2(void);
extern unsigned long read_mair_el3(void); unsigned long read_mair_el3(void);
extern unsigned long read_amair_el1(void); unsigned long read_amair_el1(void);
extern unsigned long read_amair_el2(void); unsigned long read_amair_el2(void);
extern unsigned long read_amair_el3(void); unsigned long read_amair_el3(void);
extern unsigned long read_rvbar_el1(void); unsigned long read_rvbar_el1(void);
extern unsigned long read_rvbar_el2(void); unsigned long read_rvbar_el2(void);
extern unsigned long read_rvbar_el3(void); unsigned long read_rvbar_el3(void);
extern unsigned long read_rmr_el1(void); unsigned long read_rmr_el1(void);
extern unsigned long read_rmr_el2(void); unsigned long read_rmr_el2(void);
extern unsigned long read_rmr_el3(void); unsigned long read_rmr_el3(void);
extern unsigned long read_tcr_el1(void); unsigned long read_tcr_el1(void);
extern unsigned long read_tcr_el2(void); unsigned long read_tcr_el2(void);
extern unsigned long read_tcr_el3(void); unsigned long read_tcr_el3(void);
extern unsigned long read_ttbr0_el1(void); unsigned long read_ttbr0_el1(void);
extern unsigned long read_ttbr0_el2(void); unsigned long read_ttbr0_el2(void);
extern unsigned long read_ttbr0_el3(void); unsigned long read_ttbr0_el3(void);
extern unsigned long read_ttbr1_el1(void); unsigned long read_ttbr1_el1(void);
extern unsigned long read_cptr_el2(void); unsigned long read_cptr_el2(void);
extern unsigned long read_cptr_el3(void); unsigned long read_cptr_el3(void);
extern unsigned long read_cpacr(void); unsigned long read_cpacr(void);
extern unsigned long read_cpuectlr(void); unsigned long read_cpuectlr(void);
extern unsigned int read_cntfrq_el0(void); unsigned int read_cntfrq_el0(void);
extern unsigned int read_cntps_ctl_el1(void); unsigned int read_cntps_ctl_el1(void);
extern unsigned int read_cntps_tval_el1(void); unsigned int read_cntps_tval_el1(void);
extern unsigned long read_cntps_cval_el1(void); unsigned long read_cntps_cval_el1(void);
extern unsigned long read_cntpct_el0(void); unsigned long read_cntpct_el0(void);
extern unsigned long read_cnthctl_el2(void); unsigned long read_cnthctl_el2(void);
extern unsigned long read_tpidr_el3(void); unsigned long read_tpidr_el3(void);
extern void write_scr(unsigned long); void write_scr(unsigned long);
extern void write_hcr(unsigned long); void write_hcr(unsigned long);
extern void write_cpacr(unsigned long); void write_cpacr(unsigned long);
extern void write_cntfrq_el0(unsigned int); void write_cntfrq_el0(unsigned int);
extern void write_cntps_ctl_el1(unsigned int); void write_cntps_ctl_el1(unsigned int);
extern void write_cntps_tval_el1(unsigned int); void write_cntps_tval_el1(unsigned int);
extern void write_cntps_cval_el1(unsigned long); void write_cntps_cval_el1(unsigned long);
extern void write_cnthctl_el2(unsigned long); void write_cnthctl_el2(unsigned long);
extern void write_vbar_el1(unsigned long); void write_vbar_el1(unsigned long);
extern void write_vbar_el2(unsigned long); void write_vbar_el2(unsigned long);
extern void write_vbar_el3(unsigned long); void write_vbar_el3(unsigned long);
extern void write_sctlr_el1(unsigned long); void write_sctlr_el1(unsigned long);
extern void write_sctlr_el2(unsigned long); void write_sctlr_el2(unsigned long);
extern void write_sctlr_el3(unsigned long); void write_sctlr_el3(unsigned long);
extern void write_actlr_el1(unsigned long); void write_actlr_el1(unsigned long);
extern void write_actlr_el2(unsigned long); void write_actlr_el2(unsigned long);
extern void write_actlr_el3(unsigned long); void write_actlr_el3(unsigned long);
extern void write_esr_el1(unsigned long); void write_esr_el1(unsigned long);
extern void write_esr_el2(unsigned long); void write_esr_el2(unsigned long);
extern void write_esr_el3(unsigned long); void write_esr_el3(unsigned long);
extern void write_afsr0_el1(unsigned long); void write_afsr0_el1(unsigned long);
extern void write_afsr0_el2(unsigned long); void write_afsr0_el2(unsigned long);
extern void write_afsr0_el3(unsigned long); void write_afsr0_el3(unsigned long);
extern void write_afsr1_el1(unsigned long); void write_afsr1_el1(unsigned long);
extern void write_afsr1_el2(unsigned long); void write_afsr1_el2(unsigned long);
extern void write_afsr1_el3(unsigned long); void write_afsr1_el3(unsigned long);
extern void write_far_el1(unsigned long); void write_far_el1(unsigned long);
extern void write_far_el2(unsigned long); void write_far_el2(unsigned long);
extern void write_far_el3(unsigned long); void write_far_el3(unsigned long);
extern void write_mair_el1(unsigned long); void write_mair_el1(unsigned long);
extern void write_mair_el2(unsigned long); void write_mair_el2(unsigned long);
extern void write_mair_el3(unsigned long); void write_mair_el3(unsigned long);
extern void write_amair_el1(unsigned long); void write_amair_el1(unsigned long);
extern void write_amair_el2(unsigned long); void write_amair_el2(unsigned long);
extern void write_amair_el3(unsigned long); void write_amair_el3(unsigned long);
extern void write_rmr_el1(unsigned long); void write_rmr_el1(unsigned long);
extern void write_rmr_el2(unsigned long); void write_rmr_el2(unsigned long);
extern void write_rmr_el3(unsigned long); void write_rmr_el3(unsigned long);
extern void write_tcr_el1(unsigned long); void write_tcr_el1(unsigned long);
extern void write_tcr_el2(unsigned long); void write_tcr_el2(unsigned long);
extern void write_tcr_el3(unsigned long); void write_tcr_el3(unsigned long);
extern void write_ttbr0_el1(unsigned long); void write_ttbr0_el1(unsigned long);
extern void write_ttbr0_el2(unsigned long); void write_ttbr0_el2(unsigned long);
extern void write_ttbr0_el3(unsigned long); void write_ttbr0_el3(unsigned long);
extern void write_ttbr1_el1(unsigned long); void write_ttbr1_el1(unsigned long);
extern void write_cpuectlr(unsigned long); void write_cpuectlr(unsigned long);
extern void write_cptr_el2(unsigned long); void write_cptr_el2(unsigned long);
extern void write_cptr_el3(unsigned long); void write_cptr_el3(unsigned long);
extern void write_tpidr_el3(unsigned long); void write_tpidr_el3(unsigned long);
#define IS_IN_EL(x) \ #define IS_IN_EL(x) \
(GET_EL(read_current_el()) == MODE_EL##x) (GET_EL(read_current_el()) == MODE_EL##x)
......
...@@ -60,12 +60,13 @@ typedef struct mmap_region { ...@@ -60,12 +60,13 @@ typedef struct mmap_region {
mmap_attr_t attr; mmap_attr_t attr;
} mmap_region_t; } mmap_region_t;
extern void mmap_add_region(unsigned long base, unsigned long size, void mmap_add_region(unsigned long base, unsigned long size,
unsigned attr); unsigned attr);
extern void mmap_add(const mmap_region_t *mm); void mmap_add(const mmap_region_t *mm);
extern void init_xlat_tables(void); void init_xlat_tables(void);
extern uint64_t l1_xlation_table[]; void enable_mmu_el1(void);
void enable_mmu_el3(void);
#endif /* __XLAT_TABLES_H__ */ #endif /* __XLAT_TABLES_H__ */
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
#ifndef __BAKERY_LOCK_H__ #ifndef __BAKERY_LOCK_H__
#define __BAKERY_LOCK_H__ #define __BAKERY_LOCK_H__
#include <platform.h> #include <platform_def.h>
#define BAKERY_LOCK_MAX_CPUS PLATFORM_CORE_COUNT #define BAKERY_LOCK_MAX_CPUS PLATFORM_CORE_COUNT
......
...@@ -33,13 +33,13 @@ ...@@ -33,13 +33,13 @@
#include <stdint.h> #include <stdint.h>
extern void mmio_write_8(uintptr_t addr, uint8_t value); void mmio_write_8(uintptr_t addr, uint8_t value);
extern uint8_t mmio_read_8(uintptr_t addr); uint8_t mmio_read_8(uintptr_t addr);
extern void mmio_write_32(uintptr_t addr, uint32_t value); void mmio_write_32(uintptr_t addr, uint32_t value);
extern uint32_t mmio_read_32(uintptr_t addr); uint32_t mmio_read_32(uintptr_t addr);
extern void mmio_write_64(uintptr_t addr, uint64_t value); void mmio_write_64(uintptr_t addr, uint64_t value);
extern uint64_t mmio_read_64(uintptr_t addr); uint64_t mmio_read_64(uintptr_t addr);
#endif /* __MMIO_H__ */ #endif /* __MMIO_H__ */
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