From c787c2d62fe0c482f5fb3e5b869cd262fe69b244 Mon Sep 17 00:00:00 2001 From: James Hogan Date: Thu, 31 Jan 2013 13:27:35 +0000 Subject: [PATCH] metag: make TXPRIVEXT bits explicit Define PRIV_BITS using explicit constants from rather than with a hard coded value. This also adds a couple of missing definitions for the TXPRIVEXT priv bits for protecting writes to TXTIMER and the trace registers. Signed-off-by: James Hogan --- arch/metag/include/asm/metag_regs.h | 4 ++++ arch/metag/kernel/setup.c | 34 +++++++++++++++++++++++------ 2 files changed, 31 insertions(+), 7 deletions(-) diff --git a/arch/metag/include/asm/metag_regs.h b/arch/metag/include/asm/metag_regs.h index 022fcad768f7..acf4b8e6e9d1 100644 --- a/arch/metag/include/asm/metag_regs.h +++ b/arch/metag/include/asm/metag_regs.h @@ -414,6 +414,10 @@ #define TXPRIVEXT_REGNUM 29 #define TXPRIVEXT_COPRO_BITS 0xFF000000 /* Co-processor 0-7 */ #define TXPRIVEXT_COPRO_S 24 +#ifndef METAC_1_2 +#define TXPRIVEXT_TXTIMER_BIT 0x00080000 /* TXTIMER priv */ +#define TXPRIVEXT_TRACE_BIT 0x00040000 /* TTEXEC|TTCTRL|GTEXEC */ +#endif #define TXPRIVEXT_TXTRIGGER_BIT 0x00020000 /* TXSTAT|TXMASK|TXPOLL */ #define TXPRIVEXT_TXGBLCREG_BIT 0x00010000 /* Global common regs */ #define TXPRIVEXT_CBPRIV_BIT 0x00008000 /* Mem i/f dump priv */ diff --git a/arch/metag/kernel/setup.c b/arch/metag/kernel/setup.c index aaebc56270ec..dcb1d6d51ce4 100644 --- a/arch/metag/kernel/setup.c +++ b/arch/metag/kernel/setup.c @@ -35,6 +35,7 @@ #include #include #include +#include #include #include #include @@ -43,18 +44,37 @@ #include #include -/* PRIV protect as many registers as possible. */ -#define DEFAULT_PRIV 0xff0f7f00 - -/* Enable unaligned access checking. */ -#define UNALIGNED_PRIV 0x00000010 +/* Priv protect as many registers as possible. */ +#define DEFAULT_PRIV (TXPRIVEXT_COPRO_BITS | \ + TXPRIVEXT_TXTRIGGER_BIT | \ + TXPRIVEXT_TXGBLCREG_BIT | \ + TXPRIVEXT_ILOCK_BIT | \ + TXPRIVEXT_TXITACCYC_BIT | \ + TXPRIVEXT_TXDIVTIME_BIT | \ + TXPRIVEXT_TXAMAREGX_BIT | \ + TXPRIVEXT_TXTIMERI_BIT | \ + TXPRIVEXT_TXSTATUS_BIT | \ + TXPRIVEXT_TXDISABLE_BIT) + +/* Meta2 specific bits. */ +#ifdef CONFIG_METAG_META12 +#define META2_PRIV 0 +#else +#define META2_PRIV (TXPRIVEXT_TXTIMER_BIT | \ + TXPRIVEXT_TRACE_BIT) +#endif +/* Unaligned access checking bits. */ #ifdef CONFIG_METAG_UNALIGNED -#define PRIV_BITS (DEFAULT_PRIV | UNALIGNED_PRIV) +#define UNALIGNED_PRIV TXPRIVEXT_ALIGNREW_BIT #else -#define PRIV_BITS DEFAULT_PRIV +#define UNALIGNED_PRIV 0 #endif +#define PRIV_BITS (DEFAULT_PRIV | \ + META2_PRIV | \ + UNALIGNED_PRIV) + extern char _heap_start[]; #ifdef CONFIG_METAG_BUILTIN_DTB -- 2.20.1