Commit 0f22bef3 authored by Scott Branden's avatar Scott Branden Committed by GitHub
Browse files

Merge branch 'integration' into tf_issue_461

parents 53d9c9c8 dd454b40
/* /*
* Copyright (c) 2016, ARM Limited and Contributors. All rights reserved. * Copyright (c) 2016-2017, ARM Limited and Contributors. All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met: * modification, are permitted provided that the following conditions are met:
...@@ -28,6 +28,9 @@ ...@@ -28,6 +28,9 @@
* POSSIBILITY OF SUCH DAMAGE. * POSSIBILITY OF SUCH DAMAGE.
*/ */
#ifndef __TZC_COMMON_PRIVATE_H__
#define __TZC_COMMON_PRIVATE_H__
#include <arch.h> #include <arch.h>
#include <arch_helpers.h> #include <arch_helpers.h>
#include <mmio.h> #include <mmio.h>
...@@ -190,8 +193,9 @@ ...@@ -190,8 +193,9 @@
nsaid_permissions); \ nsaid_permissions); \
} }
#if DEBUG #if ENABLE_ASSERTIONS
static unsigned int _tzc_read_peripheral_id(uintptr_t base)
static inline unsigned int _tzc_read_peripheral_id(uintptr_t base)
{ {
unsigned int id; unsigned int id;
...@@ -203,7 +207,7 @@ static unsigned int _tzc_read_peripheral_id(uintptr_t base) ...@@ -203,7 +207,7 @@ static unsigned int _tzc_read_peripheral_id(uintptr_t base)
} }
#ifdef AARCH32 #ifdef AARCH32
static unsigned long long _tzc_get_max_top_addr(int addr_width) static inline unsigned long long _tzc_get_max_top_addr(int addr_width)
{ {
/* /*
* Assume at least 32 bit wide address and initialize the max. * Assume at least 32 bit wide address and initialize the max.
...@@ -232,4 +236,6 @@ static unsigned long long _tzc_get_max_top_addr(int addr_width) ...@@ -232,4 +236,6 @@ static unsigned long long _tzc_get_max_top_addr(int addr_width)
(UINT64_MAX >> (64 - (addr_width))) (UINT64_MAX >> (64 - (addr_width)))
#endif /* AARCH32 */ #endif /* AARCH32 */
#endif #endif /* ENABLE_ASSERTIONS */
#endif /* __TZC_COMMON_PRIVATE_H__ */
/* /*
* Copyright (c) 2016, ARM Limited and Contributors. All rights reserved. * Copyright (c) 2016-2017, ARM Limited and Contributors. All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met: * modification, are permitted provided that the following conditions are met:
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
#include <mmio.h> #include <mmio.h>
#include <tzc_dmc500.h> #include <tzc_dmc500.h>
#include "tzc_common.h" #include "tzc_common.h"
#include "tzc_common_private.c" #include "tzc_common_private.h"
/* /*
* Macros which will be used by common core functions. * Macros which will be used by common core functions.
...@@ -257,7 +257,7 @@ void tzc_dmc500_set_action(tzc_action_t action) ...@@ -257,7 +257,7 @@ void tzc_dmc500_set_action(tzc_action_t action)
static void validate_plat_driver_data( static void validate_plat_driver_data(
const tzc_dmc500_driver_data_t *plat_driver_data) const tzc_dmc500_driver_data_t *plat_driver_data)
{ {
#if DEBUG #if ENABLE_ASSERTIONS
int i; int i;
unsigned int dmc_id; unsigned int dmc_id;
uintptr_t dmc_base; uintptr_t dmc_base;
...@@ -273,7 +273,7 @@ static void validate_plat_driver_data( ...@@ -273,7 +273,7 @@ static void validate_plat_driver_data(
dmc_id = _tzc_read_peripheral_id(dmc_base); dmc_id = _tzc_read_peripheral_id(dmc_base);
assert(dmc_id == DMC500_PERIPHERAL_ID); assert(dmc_id == DMC500_PERIPHERAL_ID);
} }
#endif /* DEBUG */ #endif /* ENABLE_ASSERTIONS */
} }
......
/* /*
* Copyright (c) 2016, ARM Limited and Contributors. All rights reserved. * Copyright (c) 2016-2017, ARM Limited and Contributors. All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met: * modification, are permitted provided that the following conditions are met:
...@@ -34,6 +34,7 @@ ...@@ -34,6 +34,7 @@
.globl console_core_init .globl console_core_init
.globl console_core_putc .globl console_core_putc
.globl console_core_getc .globl console_core_getc
.globl console_core_flush
/* ----------------------------------------------- /* -----------------------------------------------
* int console_core_init(unsigned long base_addr, * int console_core_init(unsigned long base_addr,
...@@ -125,3 +126,18 @@ getc_error: ...@@ -125,3 +126,18 @@ getc_error:
mov w0, #-1 mov w0, #-1
ret ret
endfunc console_core_getc endfunc console_core_getc
/* ---------------------------------------------
* int console_core_flush(uintptr_t base_addr)
* Function to force a write of all buffered
* data that hasn't been output.
* In : x0 - console base address
* Out : return -1 on error else return 0.
* Clobber list : x0, x1
* ---------------------------------------------
*/
func console_core_flush
/* Placeholder */
mov w0, #0
ret
endfunc console_core_flush
/* /*
* Copyright (c) 2016, ARM Limited and Contributors. All rights reserved. * Copyright (c) 2016-2017, ARM Limited and Contributors. All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met: * modification, are permitted provided that the following conditions are met:
...@@ -33,6 +33,7 @@ ...@@ -33,6 +33,7 @@
.globl console_uninit .globl console_uninit
.globl console_putc .globl console_putc
.globl console_getc .globl console_getc
.globl console_flush
/* /*
* The console base is in the data section and not in .bss * The console base is in the data section and not in .bss
...@@ -112,3 +113,18 @@ func console_getc ...@@ -112,3 +113,18 @@ func console_getc
ldr r0, [r1] ldr r0, [r1]
b console_core_getc b console_core_getc
endfunc console_getc endfunc console_getc
/* ---------------------------------------------
* int console_flush(void)
* Function to force a write of all buffered
* data that hasn't been output. It returns 0
* upon successful completion, otherwise it
* returns -1.
* Clobber list : r0, r1
* ---------------------------------------------
*/
func console_flush
ldr r1, =console_base
ldr r0, [r1]
b console_core_flush
endfunc console_flush
/* /*
* Copyright (c) 2016, ARM Limited and Contributors. All rights reserved. * Copyright (c) 2016-2017, ARM Limited and Contributors. All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met: * modification, are permitted provided that the following conditions are met:
...@@ -38,6 +38,7 @@ ...@@ -38,6 +38,7 @@
.globl console_core_init .globl console_core_init
.globl console_core_putc .globl console_core_putc
.globl console_core_getc .globl console_core_getc
.globl console_core_flush
/* ----------------------------------------------- /* -----------------------------------------------
* int console_core_init(uintptr_t base_addr, * int console_core_init(uintptr_t base_addr,
...@@ -109,3 +110,23 @@ getc_error: ...@@ -109,3 +110,23 @@ getc_error:
mov r0, #-1 mov r0, #-1
bx lr bx lr
endfunc console_core_getc endfunc console_core_getc
/* ---------------------------------------------
* int console_core_flush(uintptr_t base_addr)
* Function to force a write of all buffered
* data that hasn't been output.
* In : r0 - console base address
* Out : return -1 on error else return 0.
* Clobber list : r0, r1
* ---------------------------------------------
*/
func console_core_flush
cmp r0, #0
beq flush_error
/* Insert implementation here */
mov r0, #0
bx lr
flush_error:
mov r0, #-1
bx lr
endfunc console_core_flush
/* /*
* Copyright (c) 2015-2016, ARM Limited and Contributors. All rights reserved. * Copyright (c) 2015-2017, ARM Limited and Contributors. All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met: * modification, are permitted provided that the following conditions are met:
...@@ -33,6 +33,7 @@ ...@@ -33,6 +33,7 @@
.globl console_uninit .globl console_uninit
.globl console_putc .globl console_putc
.globl console_getc .globl console_getc
.globl console_flush
/* /*
* The console base is in the data section and not in .bss * The console base is in the data section and not in .bss
...@@ -111,3 +112,18 @@ func console_getc ...@@ -111,3 +112,18 @@ func console_getc
ldr x0, [x1, :lo12:console_base] ldr x0, [x1, :lo12:console_base]
b console_core_getc b console_core_getc
endfunc console_getc endfunc console_getc
/* ---------------------------------------------
* int console_flush(void)
* Function to force a write of all buffered
* data that hasn't been output. It returns 0
* upon successful completion, otherwise it
* returns -1.
* Clobber list : x0, x1
* ---------------------------------------------
*/
func console_flush
adrp x1, console_base
ldr x0, [x1, :lo12:console_base]
b console_core_flush
endfunc console_flush
/* /*
* Copyright (c) 2015-2016, ARM Limited and Contributors. All rights reserved. * Copyright (c) 2015-2017, ARM Limited and Contributors. All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met: * modification, are permitted provided that the following conditions are met:
...@@ -38,6 +38,7 @@ ...@@ -38,6 +38,7 @@
.globl console_core_init .globl console_core_init
.globl console_core_putc .globl console_core_putc
.globl console_core_getc .globl console_core_getc
.globl console_core_flush
/* ----------------------------------------------- /* -----------------------------------------------
* int console_core_init(uintptr_t base_addr, * int console_core_init(uintptr_t base_addr,
...@@ -104,3 +105,22 @@ getc_error: ...@@ -104,3 +105,22 @@ getc_error:
mov w0, #-1 mov w0, #-1
ret ret
endfunc console_core_getc endfunc console_core_getc
/* ---------------------------------------------
* int console_core_flush(uintptr_t base_addr)
* Function to force a write of all buffered
* data that hasn't been output.
* In : x0 - console base address
* Out : return -1 on error else return 0.
* Clobber list : x0, x1
* ---------------------------------------------
*/
func console_core_flush
cbz x0, flush_error
/* Insert implementation here */
mov w0, #0
ret
flush_error:
mov w0, #-1
ret
endfunc console_core_flush
/* /*
* Copyright (c) 2014, ARM Limited and Contributors. All rights reserved. * Copyright (c) 2014-2017, ARM Limited and Contributors. All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met: * modification, are permitted provided that the following conditions are met:
...@@ -51,8 +51,8 @@ static const io_dev_info_t *devices[MAX_IO_DEVICES]; ...@@ -51,8 +51,8 @@ static const io_dev_info_t *devices[MAX_IO_DEVICES];
/* Number of currently registered devices */ /* Number of currently registered devices */
static unsigned int dev_count; static unsigned int dev_count;
/* Extra validation functions only used when asserts are enabled */
#if DEBUG /* Extra validation functions only used in debug builds */ #if ENABLE_ASSERTIONS
/* Return a boolean value indicating whether a device connector is valid */ /* Return a boolean value indicating whether a device connector is valid */
static int is_valid_dev_connector(const io_dev_connector_t *dev_con) static int is_valid_dev_connector(const io_dev_connector_t *dev_con)
...@@ -89,7 +89,8 @@ static int is_valid_seek_mode(io_seek_mode_t mode) ...@@ -89,7 +89,8 @@ static int is_valid_seek_mode(io_seek_mode_t mode)
return ((mode != IO_SEEK_INVALID) && (mode < IO_SEEK_MAX)); return ((mode != IO_SEEK_INVALID) && (mode < IO_SEEK_MAX));
} }
#endif /* End of debug-only validation functions */ #endif /* ENABLE_ASSERTIONS */
/* End of extra validation functions only used when asserts are enabled */
/* Open a connection to a specific device */ /* Open a connection to a specific device */
......
/* /*
* Copyright (c) 2015-2016, ARM Limited and Contributors. All rights reserved. * Copyright (c) 2015-2017, ARM Limited and Contributors. All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met: * modification, are permitted provided that the following conditions are met:
...@@ -35,6 +35,7 @@ ...@@ -35,6 +35,7 @@
.globl console_core_init .globl console_core_init
.globl console_core_putc .globl console_core_putc
.globl console_core_getc .globl console_core_getc
.globl console_core_flush
/* ----------------------------------------------- /* -----------------------------------------------
* int console_core_init(unsigned long base_addr, * int console_core_init(unsigned long base_addr,
...@@ -114,9 +115,6 @@ func console_core_putc ...@@ -114,9 +115,6 @@ func console_core_putc
b.ne 1b b.ne 1b
mov w2, #0xD /* '\r' */ mov w2, #0xD /* '\r' */
str w2, [x1, #UARTTX] str w2, [x1, #UARTTX]
ldr w2, [x1, #UARTFCR]
orr w2, w2, #UARTFCR_TXCLR
str w2, [x1, #UARTFCR]
/* Check if the transmit FIFO is full */ /* Check if the transmit FIFO is full */
2: ldr w2, [x1, #UARTLSR] 2: ldr w2, [x1, #UARTLSR]
...@@ -124,9 +122,6 @@ func console_core_putc ...@@ -124,9 +122,6 @@ func console_core_putc
cmp w2, #(UARTLSR_TEMT | UARTLSR_THRE) cmp w2, #(UARTLSR_TEMT | UARTLSR_THRE)
b.ne 2b b.ne 2b
str w0, [x1, #UARTTX] str w0, [x1, #UARTTX]
ldr w2, [x1, #UARTFCR]
orr w2, w2, #UARTFCR_TXCLR
str w2, [x1, #UARTFCR]
ret ret
putc_error: putc_error:
mov w0, #-1 mov w0, #-1
...@@ -153,3 +148,18 @@ getc_error: ...@@ -153,3 +148,18 @@ getc_error:
mov w0, #-1 mov w0, #-1
ret ret
endfunc console_core_getc endfunc console_core_getc
/* ---------------------------------------------
* int console_core_flush(uintptr_t base_addr)
* Function to force a write of all buffered
* data that hasn't been output.
* In : x0 - console base address
* Out : return -1 on error else return 0.
* Clobber list : x0, x1
* ---------------------------------------------
*/
func console_core_flush
/* Placeholder */
mov w0, #0
ret
endfunc console_core_flush
...@@ -134,4 +134,37 @@ ...@@ -134,4 +134,37 @@
.space SPINLOCK_ASM_SIZE .space SPINLOCK_ASM_SIZE
.endm .endm
/*
* Helper macro to OR the bottom 32 bits of `_val` into `_reg_l`
* and the top 32 bits of `_val` into `_reg_h`. If either the bottom
* or top word of `_val` is zero, the corresponding OR operation
* is skipped.
*/
.macro orr64_imm _reg_l, _reg_h, _val
.if (\_val >> 32)
orr \_reg_h, \_reg_h, #(\_val >> 32)
.endif
.if (\_val & 0xffffffff)
orr \_reg_l, \_reg_l, #(\_val & 0xffffffff)
.endif
.endm
/*
* Helper macro to bitwise-clear bits in `_reg_l` and
* `_reg_h` given a 64 bit immediate `_val`. The set bits
* in the bottom word of `_val` dictate which bits from
* `_reg_l` should be cleared. Similarly, the set bits in
* the top word of `_val` dictate which bits from `_reg_h`
* should be cleared. If either the bottom or top word of
* `_val` is zero, the corresponding BIC operation is skipped.
*/
.macro bic64_imm _reg_l, _reg_h, _val
.if (\_val >> 32)
bic \_reg_h, \_reg_h, #(\_val >> 32)
.endif
.if (\_val & 0xffffffff)
bic \_reg_l, \_reg_l, #(\_val & 0xffffffff)
.endif
.endm
#endif /* __ASM_MACROS_S__ */ #endif /* __ASM_MACROS_S__ */
...@@ -148,7 +148,7 @@ ...@@ -148,7 +148,7 @@
_init_memory, _init_c_runtime, _exception_vectors _init_memory, _init_c_runtime, _exception_vectors
/* Make sure we are in Secure Mode */ /* Make sure we are in Secure Mode */
#if ASM_ASSERTION #if ENABLE_ASSERTIONS
ldcopr r0, SCR ldcopr r0, SCR
tst r0, #SCR_NS_BIT tst r0, #SCR_NS_BIT
ASM_ASSERT(eq) ASM_ASSERT(eq)
......
/* /*
* Copyright (c) 2013-2014, ARM Limited and Contributors. All rights reserved. * Copyright (c) 2013-2017, ARM Limited and Contributors. All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met: * modification, are permitted provided that the following conditions are met:
...@@ -38,6 +38,7 @@ int console_init(uintptr_t base_addr, ...@@ -38,6 +38,7 @@ int console_init(uintptr_t base_addr,
void console_uninit(void); void console_uninit(void);
int console_putc(int c); int console_putc(int c);
int console_getc(void); int console_getc(void);
int console_flush(void);
#endif /* __CONSOLE_H__ */ #endif /* __CONSOLE_H__ */
...@@ -394,12 +394,14 @@ ...@@ -394,12 +394,14 @@
#define HCR p15, 4, c1, c1, 0 #define HCR p15, 4, c1, c1, 0
#define HCPTR p15, 4, c1, c1, 2 #define HCPTR p15, 4, c1, c1, 2
#define CNTHCTL p15, 4, c14, c1, 0 #define CNTHCTL p15, 4, c14, c1, 0
#define CNTKCTL p15, 0, c14, c1, 0
#define VPIDR p15, 4, c0, c0, 0 #define VPIDR p15, 4, c0, c0, 0
#define VMPIDR p15, 4, c0, c0, 5 #define VMPIDR p15, 4, c0, c0, 5
#define ISR p15, 0, c12, c1, 0 #define ISR p15, 0, c12, c1, 0
#define CLIDR p15, 1, c0, c0, 1 #define CLIDR p15, 1, c0, c0, 1
#define CSSELR p15, 2, c0, c0, 0 #define CSSELR p15, 2, c0, c0, 0
#define CCSIDR p15, 1, c0, c0, 0 #define CCSIDR p15, 1, c0, c0, 0
#define DBGOSDLR p14, 0, c1, c3, 4
/* Debug register defines. The format is: coproc, opt1, CRn, CRm, opt2 */ /* Debug register defines. The format is: coproc, opt1, CRn, CRm, opt2 */
#define HDCR p15, 4, c1, c1, 1 #define HDCR p15, 4, c1, c1, 1
......
...@@ -209,6 +209,8 @@ DEFINE_SYSOP_FUNC(wfe) ...@@ -209,6 +209,8 @@ DEFINE_SYSOP_FUNC(wfe)
DEFINE_SYSOP_FUNC(sev) DEFINE_SYSOP_FUNC(sev)
DEFINE_SYSOP_TYPE_FUNC(dsb, sy) DEFINE_SYSOP_TYPE_FUNC(dsb, sy)
DEFINE_SYSOP_TYPE_FUNC(dmb, sy) DEFINE_SYSOP_TYPE_FUNC(dmb, sy)
DEFINE_SYSOP_TYPE_FUNC(dmb, st)
DEFINE_SYSOP_TYPE_FUNC(dmb, ld)
DEFINE_SYSOP_TYPE_FUNC(dsb, ish) DEFINE_SYSOP_TYPE_FUNC(dsb, ish)
DEFINE_SYSOP_TYPE_FUNC(dsb, ishst) DEFINE_SYSOP_TYPE_FUNC(dsb, ishst)
DEFINE_SYSOP_TYPE_FUNC(dmb, ish) DEFINE_SYSOP_TYPE_FUNC(dmb, ish)
......
...@@ -261,6 +261,16 @@ ...@@ -261,6 +261,16 @@
#define DISABLE_ALL_EXCEPTIONS \ #define DISABLE_ALL_EXCEPTIONS \
(DAIF_FIQ_BIT | DAIF_IRQ_BIT | DAIF_ABT_BIT | DAIF_DBG_BIT) (DAIF_FIQ_BIT | DAIF_IRQ_BIT | DAIF_ABT_BIT | DAIF_DBG_BIT)
/*
* RMR_EL3 definitions
*/
#define RMR_EL3_RR_BIT (1 << 1)
#define RMR_EL3_AA64_BIT (1 << 0)
/*
* HI-VECTOR address for AArch32 state
*/
#define HI_VECTOR_BASE (0xFFFF0000)
/* /*
* TCR defintions * TCR defintions
...@@ -419,6 +429,10 @@ ...@@ -419,6 +429,10 @@
#define EC_BITS(x) (x >> ESR_EC_SHIFT) & ESR_EC_MASK #define EC_BITS(x) (x >> ESR_EC_SHIFT) & ESR_EC_MASK
/* Reset bit inside the Reset management register for EL3 (RMR_EL3) */
#define RMR_RESET_REQUEST_SHIFT 0x1u
#define RMR_WARM_RESET_CPU (1u << RMR_RESET_REQUEST_SHIFT)
/******************************************************************************* /*******************************************************************************
* Definitions of register offsets, fields and macros for CPU system * Definitions of register offsets, fields and macros for CPU system
* instructions. * instructions.
......
/*
* Copyright (c) 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:
*
* 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 __CORTEX_A53_H__
#define __CORTEX_A53_H__
/* Cortex-A53 midr for revision 0 */
#define CORTEX_A53_MIDR 0x410FD030
/* Retention timer tick definitions */
#define RETENTION_ENTRY_TICKS_2 0x1
#define RETENTION_ENTRY_TICKS_8 0x2
#define RETENTION_ENTRY_TICKS_32 0x3
#define RETENTION_ENTRY_TICKS_64 0x4
#define RETENTION_ENTRY_TICKS_128 0x5
#define RETENTION_ENTRY_TICKS_256 0x6
#define RETENTION_ENTRY_TICKS_512 0x7
/*******************************************************************************
* CPU Extended Control register specific definitions.
******************************************************************************/
#define CPUECTLR p15, 1, c15 /* Instruction def. */
#define CPUECTLR_SMP_BIT (1 << 6)
#define CPUECTLR_CPU_RET_CTRL_SHIFT 0
#define CPUECTLR_CPU_RET_CTRL_MASK (0x7 << CPUECTLR_CPU_RET_CTRL_SHIFT)
#define CPUECTLR_FPU_RET_CTRL_SHIFT 3
#define CPUECTLR_FPU_RET_CTRL_MASK (0x7 << CPUECTLR_FPU_RET_CTRL_SHIFT)
/*******************************************************************************
* CPU Memory Error Syndrome register specific definitions.
******************************************************************************/
#define CPUMERRSR p15, 2, c15 /* Instruction def. */
/*******************************************************************************
* CPU Auxiliary Control register specific definitions.
******************************************************************************/
#define CPUACTLR p15, 0, c15 /* Instruction def. */
#define CPUACTLR_DTAH (1 << 24)
/*******************************************************************************
* L2 Auxiliary Control register specific definitions.
******************************************************************************/
#define L2ACTLR p15, 1, c15, c0, 0 /* Instruction def. */
#define L2ACTLR_ENABLE_UNIQUECLEAN (1 << 14)
#define L2ACTLR_DISABLE_CLEAN_PUSH (1 << 3)
/*******************************************************************************
* L2 Extended Control register specific definitions.
******************************************************************************/
#define L2ECTLR p15, 1, c9, c0, 3 /* Instruction def. */
#define L2ECTLR_RET_CTRL_SHIFT 0
#define L2ECTLR_RET_CTRL_MASK (0x7 << L2ECTLR_RET_CTRL_SHIFT)
/*******************************************************************************
* L2 Memory Error Syndrome register specific definitions.
******************************************************************************/
#define L2MERRSR p15, 3, c15 /* Instruction def. */
#endif /* __CORTEX_A53_H__ */
/*
* Copyright (c) 2017, 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 __CORTEX_A57_H__
#define __CORTEX_A57_H__
/* Cortex-A57 midr for revision 0 */
#define CORTEX_A57_MIDR 0x410FD070
/* Retention timer tick definitions */
#define RETENTION_ENTRY_TICKS_2 0x1
#define RETENTION_ENTRY_TICKS_8 0x2
#define RETENTION_ENTRY_TICKS_32 0x3
#define RETENTION_ENTRY_TICKS_64 0x4
#define RETENTION_ENTRY_TICKS_128 0x5
#define RETENTION_ENTRY_TICKS_256 0x6
#define RETENTION_ENTRY_TICKS_512 0x7
/*******************************************************************************
* CPU Extended Control register specific definitions.
******************************************************************************/
#define CPUECTLR p15, 1, c15 /* Instruction def. */
#define CPUECTLR_SMP_BIT (1 << 6)
#define CPUECTLR_DIS_TWD_ACC_PFTCH_BIT (1 << 38)
#define CPUECTLR_L2_IPFTCH_DIST_MASK (0x3 << 35)
#define CPUECTLR_L2_DPFTCH_DIST_MASK (0x3 << 32)
#define CPUECTLR_CPU_RET_CTRL_SHIFT 0
#define CPUECTLR_CPU_RET_CTRL_MASK (0x7 << CPUECTLR_CPU_RET_CTRL_SHIFT)
/*******************************************************************************
* CPU Memory Error Syndrome register specific definitions.
******************************************************************************/
#define CPUMERRSR p15, 2, c15 /* Instruction def. */
/*******************************************************************************
* CPU Auxiliary Control register specific definitions.
******************************************************************************/
#define CPUACTLR p15, 0, c15 /* Instruction def. */
#define CPUACTLR_DIS_LOAD_PASS_DMB (1 << 59)
#define CPUACTLR_GRE_NGRE_AS_NGNRE (1 << 54)
#define CPUACTLR_DIS_OVERREAD (1 << 52)
#define CPUACTLR_NO_ALLOC_WBWA (1 << 49)
#define CPUACTLR_DCC_AS_DCCI (1 << 44)
#define CPUACTLR_FORCE_FPSCR_FLUSH (1 << 38)
#define CPUACTLR_DIS_STREAMING (3 << 27)
#define CPUACTLR_DIS_L1_STREAMING (3 << 25)
#define CPUACTLR_DIS_INDIRECT_PREDICTOR (1 << 4)
/*******************************************************************************
* L2 Control register specific definitions.
******************************************************************************/
#define L2CTLR p15, 1, c9, c0, 3 /* Instruction def. */
#define L2CTLR_DATA_RAM_LATENCY_SHIFT 0
#define L2CTLR_TAG_RAM_LATENCY_SHIFT 6
#define L2_DATA_RAM_LATENCY_3_CYCLES 0x2
#define L2_TAG_RAM_LATENCY_3_CYCLES 0x2
/*******************************************************************************
* L2 Extended Control register specific definitions.
******************************************************************************/
#define L2ECTLR p15, 1, c9, c0, 3 /* Instruction def. */
#define L2ECTLR_RET_CTRL_SHIFT 0
#define L2ECTLR_RET_CTRL_MASK (0x7 << L2ECTLR_RET_CTRL_SHIFT)
/*******************************************************************************
* L2 Memory Error Syndrome register specific definitions.
******************************************************************************/
#define L2MERRSR p15, 3, c15 /* Instruction def. */
#endif /* __CORTEX_A57_H__ */
/*
* Copyright (c) 2017, 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 __CORTEX_A72_H__
#define __CORTEX_A72_H__
/* Cortex-A72 midr for revision 0 */
#define CORTEX_A72_MIDR 0x410FD080
/*******************************************************************************
* CPU Extended Control register specific definitions.
******************************************************************************/
#define CPUECTLR p15, 1, c15 /* Instruction def. */
#define CPUECTLR_SMP_BIT (1 << 6)
#define CPUECTLR_DIS_TWD_ACC_PFTCH_BIT (1 << 38)
#define CPUECTLR_L2_IPFTCH_DIST_MASK (0x3 << 35)
#define CPUECTLR_L2_DPFTCH_DIST_MASK (0x3 << 32)
/*******************************************************************************
* CPU Memory Error Syndrome register specific definitions.
******************************************************************************/
#define CPUMERRSR p15, 2, c15 /* Instruction def. */
/*******************************************************************************
* CPU Auxiliary Control register specific definitions.
******************************************************************************/
#define CPUACTLR p15, 0, c15 /* Instruction def. */
#define CPUACTLR_DISABLE_L1_DCACHE_HW_PFTCH (1 << 56)
#define CPUACTLR_NO_ALLOC_WBWA (1 << 49)
#define CPUACTLR_DCC_AS_DCCI (1 << 44)
/*******************************************************************************
* L2 Control register specific definitions.
******************************************************************************/
#define L2CTLR p15, 1, c9, c0, 3 /* Instruction def. */
#define L2CTLR_DATA_RAM_LATENCY_SHIFT 0
#define L2CTLR_TAG_RAM_LATENCY_SHIFT 6
#define L2_DATA_RAM_LATENCY_3_CYCLES 0x2
#define L2_TAG_RAM_LATENCY_2_CYCLES 0x1
#define L2_TAG_RAM_LATENCY_3_CYCLES 0x2
/*******************************************************************************
* L2 Memory Error Syndrome register specific definitions.
******************************************************************************/
#define L2MERRSR p15, 3, c15 /* Instruction def. */
#endif /* __CORTEX_A72_H__ */
...@@ -87,7 +87,7 @@ void cm_set_context_by_mpidr(uint64_t mpidr, ...@@ -87,7 +87,7 @@ void cm_set_context_by_mpidr(uint64_t mpidr,
******************************************************************************/ ******************************************************************************/
static inline void cm_set_next_context(void *context) static inline void cm_set_next_context(void *context)
{ {
#if DEBUG #if ENABLE_ASSERTIONS
uint64_t sp_mode; uint64_t sp_mode;
/* /*
...@@ -98,7 +98,7 @@ static inline void cm_set_next_context(void *context) ...@@ -98,7 +98,7 @@ static inline void cm_set_next_context(void *context)
: "=r" (sp_mode)); : "=r" (sp_mode));
assert(sp_mode == MODE_SP_EL0); assert(sp_mode == MODE_SP_EL0);
#endif #endif /* ENABLE_ASSERTIONS */
__asm__ volatile("msr spsel, #1\n" __asm__ volatile("msr spsel, #1\n"
"mov sp, %0\n" "mov sp, %0\n"
......
...@@ -58,6 +58,7 @@ ...@@ -58,6 +58,7 @@
#define SMC_64 1 #define SMC_64 1
#define SMC_32 0 #define SMC_32 0
#define SMC_OK 0
#define SMC_UNK 0xffffffff #define SMC_UNK 0xffffffff
#define SMC_TYPE_FAST ULL(1) #define SMC_TYPE_FAST ULL(1)
#define SMC_TYPE_STD 0 #define SMC_TYPE_STD 0
......
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