linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: srikanth krishnakar <skrishnakar@gmail.com>
To: Linuxppc-dev@ozlabs.org
Cc: Linuxppc-embedded@ozlabs.org
Subject: Initialize DBCR0 for PPC440 targets
Date: Tue, 19 May 2009 18:38:53 +0530	[thread overview]
Message-ID: <6213bc560905190608j73f4191fxbd94158a2b1740c0@mail.gmail.com> (raw)

Hi,

kernel- 2.6.29
Debug technique: KGDB

The PowerPC kernel does not initialize the PPC440 DBCR0 register. This
prevents the use of software breakpoints in case of internal debug
mode. Looking into head_fsl_booke.S for initialization of DBCR0 is
used by boot-loaders.
It seems head_44x.S lacks this step of DBCR0 register initialization.
So fixing this with initializing the DBCR0 register as shown below :

Subject: [PATCH] powerpc: 44x: Initialize DBCR0 for targets not having
bootloader

The kernel does not initialize the PPC440 DBCR0 register.
This prevents (among other things) the use of software
breakpoints with GDB. The boot loaders probably do initialize
this but few targets run without a boot loader
---
 arch/powerpc/kernel/head_44x.S |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/arch/powerpc/kernel/head_44x.S b/arch/powerpc/kernel/head_44x.S
index a4a890a..b413bc4 100644
--- a/arch/powerpc/kernel/head_44x.S
+++ b/arch/powerpc/kernel/head_44x.S
@@ -240,6 +240,18 @@ skpinv:	addi	r4,r4,1				/* Increment */
 	lis	r4,interrupt_base@h	/* IVPR only uses the high 16-bits */
 	mtspr	SPRN_IVPR,r4

+#if !defined(CONFIG_BDI_SWITCH)
+        /*
+         * The Abatron BDI JTAG debugger does not tolerate others
+         * mucking with the debug registers.
+         */
+        lis     r2,DBCR0_IDM@h
+        mtspr   SPRN_DBCR0,r2
+        isync
+        /* clear any residual debug events */
+        li      r2,-1
+        mtspr   SPRN_DBSR,r2
+#endif
 	/*
 	 * This is where the main kernel code starts.
 	 */

Any suggestions or comments on this ?

Thanks,
-Srikant

             reply	other threads:[~2009-05-19 13:08 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-05-19 13:08 srikanth krishnakar [this message]
2009-05-19 23:53 ` Initialize DBCR0 for PPC440 targets David Gibson
2009-05-20  5:50   ` srikanth krishnakar
2009-05-20  6:00     ` David Gibson
2009-05-20  6:14       ` srikanth krishnakar
2009-05-25  7:04       ` Benjamin Herrenschmidt
2009-05-26  2:23         ` David Gibson
2009-05-25  6:30     ` srikanth krishnakar
2009-05-25  6:39       ` Grant Likely
2009-05-25  6:51         ` srikanth krishnakar
2009-05-26 15:11           ` John Linn

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6213bc560905190608j73f4191fxbd94158a2b1740c0@mail.gmail.com \
    --to=skrishnakar@gmail.com \
    --cc=Linuxppc-dev@ozlabs.org \
    --cc=Linuxppc-embedded@ozlabs.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).