From 539a9cf20831c96588c0db62b871f7438067b509 Mon Sep 17 00:00:00 2001
From: Evan Hunter <ehunter@broadcom.com>
Date: Fri, 2 Nov 2012 17:59:03 +1100
Subject: [PATCH] cortex_a: Fix target entry state route.

If target is disabled at init, then is examined using 'arp_examine', it
can get to cortex_a8_poll with the target state being unknown.

Change-Id: Ifffb345bf971d275d2eb1912648b29f0a75f6ccc
Signed-off-by: Evan Hunter <ehunter@broadcom.com>
Reviewed-on: http://openocd.zylin.com/954
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
---
 src/target/cortex_a.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/target/cortex_a.c b/src/target/cortex_a.c
index e1c4c9c3f..ee1559dd0 100644
--- a/src/target/cortex_a.c
+++ b/src/target/cortex_a.c
@@ -812,6 +812,7 @@ static int cortex_a8_poll(struct target *target)
 			LOG_DEBUG("Target halted");
 			target->state = TARGET_HALTED;
 			if ((prev_target_state == TARGET_RUNNING)
+				|| (prev_target_state == TARGET_UNKNOWN)
 				|| (prev_target_state == TARGET_RESET)) {
 				retval = cortex_a8_debug_entry(target);
 				if (retval != ERROR_OK)