summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAchin Gupta <achin.gupta@arm.com>2012-04-19 15:24:46 +0100
committerDietmar Eggemann <dietmar.eggemann@arm.com>2012-05-23 12:44:35 +0100
commit7b4560d290263a34c72792867922306e353bc992 (patch)
treeb3fe2b740b74b568a340205cc2af9c8b979c7dd5
parente829a12fee5ee36267e1c98cb6f82f3a918ad2aa (diff)
downloadswitcher-7b4560d290263a34c72792867922306e353bc992.tar.gz
Debug S&R cp14: BUGFIX: Set DBGOSDLR.DLK=0 manually. FastModel does not
do this. The OS double lock register needs to be unset to be able to S&R debug context. The FastModels do not do this after a KFSCB reset. So this is checked before restoring the debug context on the inbound cluster.
-rw-r--r--acsr/debug_helpers.h1
-rw-r--r--acsr/debug_helpers.s5
-rw-r--r--acsr/v7_c.c32
3 files changed, 26 insertions, 12 deletions
diff --git a/acsr/debug_helpers.h b/acsr/debug_helpers.h
index b796ccb..146c042 100644
--- a/acsr/debug_helpers.h
+++ b/acsr/debug_helpers.h
@@ -23,6 +23,7 @@
/*
* Functions used for v7.1 Debug context S&R
*/
+extern unsigned read_dbg_osdlr(void);
extern unsigned read_dbg_drar(void);
extern unsigned read_dbg_dsar(void);
extern unsigned read_dbg_devid(void);
diff --git a/acsr/debug_helpers.s b/acsr/debug_helpers.s
index f2700ab..3b63f68 100644
--- a/acsr/debug_helpers.s
+++ b/acsr/debug_helpers.s
@@ -20,6 +20,7 @@
; permission.
;
+ EXPORT read_dbg_osdlr
EXPORT read_dbg_drar
EXPORT read_dbg_dsar
EXPORT read_dbg_devid
@@ -204,6 +205,10 @@
;----------
; Read ops
;----------
+read_dbg_osdlr FUNCTION
+ mrc p14, 0, r0, c1, c3, 4 ; Read OS Double Lock Register
+ bx lr
+ ENDFUNC
read_dbg_devid FUNCTION
mrc p14, 0, r0, c7, c2, 7
diff --git a/acsr/v7_c.c b/acsr/v7_c.c
index 115b851..e45f400 100644
--- a/acsr/v7_c.c
+++ b/acsr/v7_c.c
@@ -1,23 +1,23 @@
/*
* Copyright (c) 2012, ARM Limited. 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
+ * 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
+ * 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.
+ * permission.
*/
/*
@@ -323,7 +323,7 @@ static void sr_bp_context(debug_registers_t *dbg, unsigned bp_type, unsigned op)
return;
}
-static void save_v7_debug_cp14(unsigned * context)
+static void save_v71_debug_cp14(unsigned * context)
{
debug_registers_t *dbg = (void *) context;
unsigned virtext_present = (read_dbg_devid() >> 16) & 0xf;
@@ -353,10 +353,18 @@ static void save_v7_debug_cp14(unsigned * context)
return;
}
-static void restore_v7_debug_cp14(unsigned * context)
+static void restore_v71_debug_cp14(unsigned * context)
{
debug_registers_t *dbg = (void *) context;
- unsigned virtext_present = (read_dbg_devid() >> 16) & 0xf;
+ unsigned virtext_present;
+
+ /*
+ * Unlock the Double lock.
+ */
+ if (read_dbg_osdlr() == 0x1)
+ write_dbg_osdlr(OSDLR_UNLOCKED);
+
+ virtext_present = (read_dbg_devid() >> 16) & 0xf;
/*
* Prevent updates to the debug registers during a S&R operation
@@ -541,7 +549,7 @@ void save_v7_debug(unsigned * context)
* cp14 interface has not been implemented as yet.
*/
if(v71)
- save_v7_debug_cp14(context);
+ save_v71_debug_cp14(context);
else
save_v7_debug_mmapped(context);
@@ -560,7 +568,7 @@ void restore_v7_debug(unsigned * context)
* cp14 interface has not been implemented as yet.
*/
if(v71)
- restore_v7_debug_cp14(context);
+ restore_v71_debug_cp14(context);
else
restore_v7_debug_mmapped(context);