* [PATCH] Add Freescale CodeWarrior debug support for kernel
@ 2010-10-28 8:50 Roy Zang
2010-11-11 11:51 ` Kumar Gala
0 siblings, 1 reply; 3+ messages in thread
From: Roy Zang @ 2010-10-28 8:50 UTC (permalink / raw)
To: linuxppc-dev; +Cc: adrian.bogdan
CodeWarrior is popular embedded tools to support debugging Powerpc.
This patch adds Freescale CodeWarrior debug support for Linux kernel on
85xx/QorIQ platform.
Signed-off-by: Bogdan Adrin <drian.bogdan@freescale.com>
Signed-off-by: Roy Zang <tie-fei.zang@freescale.com>
---
arch/powerpc/Kconfig.debug | 8 ++++++++
arch/powerpc/Makefile | 5 +++++
arch/powerpc/include/asm/reg_booke.h | 4 ++++
arch/powerpc/kernel/fsl_booke_entry_mapping.S | 3 +++
arch/powerpc/kernel/head_fsl_booke.S | 11 +++++++++--
arch/powerpc/kernel/idle.c | 5 ++++-
6 files changed, 33 insertions(+), 3 deletions(-)
diff --git a/arch/powerpc/Kconfig.debug b/arch/powerpc/Kconfig.debug
index 2d38a50..eedd2ac 100644
--- a/arch/powerpc/Kconfig.debug
+++ b/arch/powerpc/Kconfig.debug
@@ -153,6 +153,14 @@ config BDI_SWITCH
Unless you are intending to debug the kernel with one of these
machines, say N here.
+config DEBUG_CODEWARRIOR
+ bool "Include CodeWarrior kernel debugging"
+ depends on DEBUG_KERNEL && PPC32
+ help
+ Say Y here to include CodeWarrior kernel debugging option
+ Unless you are intending to debug the kernel with one of these
+ machines, say N here.
+
config BOOTX_TEXT
bool "Support for early boot text console (BootX or OpenFirmware only)"
depends on PPC_OF && PPC_BOOK3S
diff --git a/arch/powerpc/Makefile b/arch/powerpc/Makefile
index b7212b6..d3050e6 100644
--- a/arch/powerpc/Makefile
+++ b/arch/powerpc/Makefile
@@ -121,6 +121,11 @@ KBUILD_CFLAGS += $(call cc-option,-fno-dwarf2-cfi-asm)
# often slow when they are implemented at all
KBUILD_CFLAGS += -mno-string
+ifeq ($(CONFIG_DEBUG_CODEWARRIOR),y)
+CFLAGS += -g2 -gdwarf-2
+AFLAGS_KERNEL += -Wa,-gdwarf2
+endif
+
ifeq ($(CONFIG_6xx),y)
KBUILD_CFLAGS += -mcpu=powerpc
endif
diff --git a/arch/powerpc/include/asm/reg_booke.h b/arch/powerpc/include/asm/reg_booke.h
index 667a498..ac65fcd 100644
--- a/arch/powerpc/include/asm/reg_booke.h
+++ b/arch/powerpc/include/asm/reg_booke.h
@@ -35,7 +35,11 @@
#define MSR_KERNEL (MSR_ME|MSR_RI|MSR_IR|MSR_DR|MSR_CE)
#define MSR_USER (MSR_KERNEL|MSR_PR|MSR_EE)
#else
+#if defined(CONFIG_DEBUG_CODEWARRIOR)
+#define MSR_KERNEL (MSR_ME|MSR_RI|MSR_CE|MSR_DE)
+#else
#define MSR_KERNEL (MSR_ME|MSR_RI|MSR_CE)
+#endif
#define MSR_USER (MSR_KERNEL|MSR_PR|MSR_EE)
#endif
diff --git a/arch/powerpc/kernel/fsl_booke_entry_mapping.S b/arch/powerpc/kernel/fsl_booke_entry_mapping.S
index a92c79b..9102aa7 100644
--- a/arch/powerpc/kernel/fsl_booke_entry_mapping.S
+++ b/arch/powerpc/kernel/fsl_booke_entry_mapping.S
@@ -116,6 +116,9 @@ skpinv: addi r6,r6,1 /* Increment */
xori r6,r4,1
slwi r6,r6,5 /* setup new context with other address space */
+#if defined(CONFIG_DEBUG_CODEWARRIOR)
+ ori r6, r6, 0x200 /* enable DE bit for MSR */
+#endif
bl 1f /* Find our address */
1: mflr r9
rlwimi r7,r9,0,20,31
diff --git a/arch/powerpc/kernel/head_fsl_booke.S b/arch/powerpc/kernel/head_fsl_booke.S
index 529b817..9962d09 100644
--- a/arch/powerpc/kernel/head_fsl_booke.S
+++ b/arch/powerpc/kernel/head_fsl_booke.S
@@ -21,7 +21,7 @@
* debbie_chu@mvista.com
* Copyright 2002-2004 MontaVista Software, Inc.
* PowerPC 44x support, Matt Porter <mporter@kernel.crashing.org>
- * Copyright 2004 Freescale Semiconductor, Inc
+ * Copyright 2004,2010 Freescale Semiconductor, Inc
* PowerPC e500 modifications, Kumar Gala <galak@kernel.crashing.org>
*
* This program is free software; you can redistribute it and/or modify it
@@ -135,7 +135,7 @@ _ENTRY(__early_start)
mtspr SPRN_HID0, r2
#endif
-#if !defined(CONFIG_BDI_SWITCH)
+#if !defined(CONFIG_BDI_SWITCH) && !defined(CONFIG_DEBUG_CODEWARRIOR)
/*
* The Abatron BDI JTAG debugger does not tolerate others
* mucking with the debug registers.
@@ -197,6 +197,13 @@ _ENTRY(__early_start)
/*
* Decide what sort of machine this is and initialize the MMU.
*/
+#if defined(CONFIG_DEBUG_CODEWARRIOR)
+ lis r10, 0x1008 /* clear the V bit from the L2MMU_CAM8 register */
+ mtspr SPRN_MAS0, r10
+ lis r10, 0x0
+ mtspr SPRN_MAS1, r10
+ tlbwe
+#endif
mr r3,r31
mr r4,r30
mr r5,r29
diff --git a/arch/powerpc/kernel/idle.c b/arch/powerpc/kernel/idle.c
index 39a2baa..83fb019 100644
--- a/arch/powerpc/kernel/idle.c
+++ b/arch/powerpc/kernel/idle.c
@@ -73,8 +73,11 @@ void cpu_idle(void)
stop_critical_timings();
/* check again after disabling irqs */
- if (!need_resched() && !cpu_should_die())
+ if (!need_resched() && !cpu_should_die()) {
+#if !defined(CONFIG_DEBUG_CODEWARRIOR)
ppc_md.power_save();
+#endif
+ }
start_critical_timings();
--
1.5.6.5
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] Add Freescale CodeWarrior debug support for kernel
2010-10-28 8:50 [PATCH] Add Freescale CodeWarrior debug support for kernel Roy Zang
@ 2010-11-11 11:51 ` Kumar Gala
2010-11-12 11:31 ` Bogdan Adrian-Catalin-B15061
0 siblings, 1 reply; 3+ messages in thread
From: Kumar Gala @ 2010-11-11 11:51 UTC (permalink / raw)
To: Roy Zang; +Cc: linuxppc-dev, adrian.bogdan
On Oct 28, 2010, at 3:50 AM, Roy Zang wrote:
> CodeWarrior is popular embedded tools to support debugging Powerpc.
> This patch adds Freescale CodeWarrior debug support for Linux kernel =
on
> 85xx/QorIQ platform.
>=20
> Signed-off-by: Bogdan Adrin <drian.bogdan@freescale.com>
> Signed-off-by: Roy Zang <tie-fei.zang@freescale.com>
> ---
> arch/powerpc/Kconfig.debug | 8 ++++++++
> arch/powerpc/Makefile | 5 +++++
> arch/powerpc/include/asm/reg_booke.h | 4 ++++
> arch/powerpc/kernel/fsl_booke_entry_mapping.S | 3 +++
> arch/powerpc/kernel/head_fsl_booke.S | 11 +++++++++--
> arch/powerpc/kernel/idle.c | 5 ++++-
> 6 files changed, 33 insertions(+), 3 deletions(-)
>=20
> diff --git a/arch/powerpc/Kconfig.debug b/arch/powerpc/Kconfig.debug
> index 2d38a50..eedd2ac 100644
> --- a/arch/powerpc/Kconfig.debug
> +++ b/arch/powerpc/Kconfig.debug
> @@ -153,6 +153,14 @@ config BDI_SWITCH
> Unless you are intending to debug the kernel with one of these
> machines, say N here.
>=20
> +config DEBUG_CODEWARRIOR
> + bool "Include CodeWarrior kernel debugging"
> + depends on DEBUG_KERNEL && PPC32
> + help
> + Say Y here to include CodeWarrior kernel debugging option
> + Unless you are intending to debug the kernel with one of these
> + machines, say N here.
> +
> config BOOTX_TEXT
> bool "Support for early boot text console (BootX or OpenFirmware =
only)"
> depends on PPC_OF && PPC_BOOK3S
> diff --git a/arch/powerpc/Makefile b/arch/powerpc/Makefile
> index b7212b6..d3050e6 100644
> --- a/arch/powerpc/Makefile
> +++ b/arch/powerpc/Makefile
> @@ -121,6 +121,11 @@ KBUILD_CFLAGS +=3D $(call =
cc-option,-fno-dwarf2-cfi-asm)
> # often slow when they are implemented at all
> KBUILD_CFLAGS +=3D -mno-string
>=20
> +ifeq ($(CONFIG_DEBUG_CODEWARRIOR),y)
> +CFLAGS +=3D -g2 -gdwarf-2
> +AFLAGS_KERNEL +=3D -Wa,-gdwarf2
> +endif
> +
> ifeq ($(CONFIG_6xx),y)
> KBUILD_CFLAGS +=3D -mcpu=3Dpowerpc
> endif
> diff --git a/arch/powerpc/include/asm/reg_booke.h =
b/arch/powerpc/include/asm/reg_booke.h
> index 667a498..ac65fcd 100644
> --- a/arch/powerpc/include/asm/reg_booke.h
> +++ b/arch/powerpc/include/asm/reg_booke.h
> @@ -35,7 +35,11 @@
> #define MSR_KERNEL (MSR_ME|MSR_RI|MSR_IR|MSR_DR|MSR_CE)
> #define MSR_USER (MSR_KERNEL|MSR_PR|MSR_EE)
> #else
> +#if defined(CONFIG_DEBUG_CODEWARRIOR)
> +#define MSR_KERNEL (MSR_ME|MSR_RI|MSR_CE|MSR_DE)
> +#else
> #define MSR_KERNEL (MSR_ME|MSR_RI|MSR_CE)
> +#endif
> #define MSR_USER (MSR_KERNEL|MSR_PR|MSR_EE)
> #endif
>=20
> diff --git a/arch/powerpc/kernel/fsl_booke_entry_mapping.S =
b/arch/powerpc/kernel/fsl_booke_entry_mapping.S
> index a92c79b..9102aa7 100644
> --- a/arch/powerpc/kernel/fsl_booke_entry_mapping.S
> +++ b/arch/powerpc/kernel/fsl_booke_entry_mapping.S
> @@ -116,6 +116,9 @@ skpinv: addi r6,r6,1 =
/* Increment */
>=20
> xori r6,r4,1
> slwi r6,r6,5 /* setup new context with other address =
space */
> +#if defined(CONFIG_DEBUG_CODEWARRIOR)
> + ori r6, r6, 0x200 /* enable DE bit for MSR */
Can we use MSR_DE@l instead of 0x200
> +#endif
> bl 1f /* Find our address */
> 1: mflr r9
> rlwimi r7,r9,0,20,31
> diff --git a/arch/powerpc/kernel/head_fsl_booke.S =
b/arch/powerpc/kernel/head_fsl_booke.S
> index 529b817..9962d09 100644
> --- a/arch/powerpc/kernel/head_fsl_booke.S
> +++ b/arch/powerpc/kernel/head_fsl_booke.S
> @@ -21,7 +21,7 @@
> * debbie_chu@mvista.com
> * Copyright 2002-2004 MontaVista Software, Inc.
> * PowerPC 44x support, Matt Porter <mporter@kernel.crashing.org>
> - * Copyright 2004 Freescale Semiconductor, Inc
> + * Copyright 2004,2010 Freescale Semiconductor, Inc
> * PowerPC e500 modifications, Kumar Gala =
<galak@kernel.crashing.org>
> *
> * This program is free software; you can redistribute it and/or =
modify it
> @@ -135,7 +135,7 @@ _ENTRY(__early_start)
> mtspr SPRN_HID0, r2
> #endif
>=20
> -#if !defined(CONFIG_BDI_SWITCH)
> +#if !defined(CONFIG_BDI_SWITCH) && !defined(CONFIG_DEBUG_CODEWARRIOR)
> /*
> * The Abatron BDI JTAG debugger does not tolerate others
> * mucking with the debug registers.
> @@ -197,6 +197,13 @@ _ENTRY(__early_start)
> /*
> * Decide what sort of machine this is and initialize the MMU.
> */
> +#if defined(CONFIG_DEBUG_CODEWARRIOR)
> + lis r10, 0x1008 /* clear the V bit from the L2MMU_CAM8 =
register */
why do we need this code? It seems pretty fragile if its assuming =
something about TLB entry #8
> + mtspr SPRN_MAS0, r10
> + lis r10, 0x0
> + mtspr SPRN_MAS1, r10
> + tlbwe
> +#endif
> mr r3,r31
> mr r4,r30
> mr r5,r29
> diff --git a/arch/powerpc/kernel/idle.c b/arch/powerpc/kernel/idle.c
> index 39a2baa..83fb019 100644
> --- a/arch/powerpc/kernel/idle.c
> +++ b/arch/powerpc/kernel/idle.c
> @@ -73,8 +73,11 @@ void cpu_idle(void)
> stop_critical_timings();
>=20
> /* check again after disabling irqs */
> - if (!need_resched() && =
!cpu_should_die())
> + if (!need_resched() && =
!cpu_should_die()) {
> +#if !defined(CONFIG_DEBUG_CODEWARRIOR)
> ppc_md.power_save();
> +#endif
> + }
>=20
> start_critical_timings();
>=20
> --=20
> 1.5.6.5
>=20
^ permalink raw reply [flat|nested] 3+ messages in thread
* RE: [PATCH] Add Freescale CodeWarrior debug support for kernel
2010-11-11 11:51 ` Kumar Gala
@ 2010-11-12 11:31 ` Bogdan Adrian-Catalin-B15061
0 siblings, 0 replies; 3+ messages in thread
From: Bogdan Adrian-Catalin-B15061 @ 2010-11-12 11:31 UTC (permalink / raw)
To: Kumar Gala, Zang Roy-R61911; +Cc: linuxppc-dev
[-- Attachment #1: Type: text/plain, Size: 6394 bytes --]
Hello Kumar,
These changes were added so that the CW debugger would be able to debug
all code in head_fsl_booke.S . I'm not sure why there was an assumption
about TLB entry #8, I guess there was some TLB mapping remaining in
entry 8 (not sure who set up this mapping though) and some code was
added to mark it invalid so that the debugger would not try to take it
into consideration for converting virtual addresses.
Adrian
From: Kumar Gala [mailto:galak@kernel.crashing.org]
Sent: Thursday, November 11, 2010 1:51 PM
To: Zang Roy-R61911
Cc: linuxppc-dev@ozlabs.org; Bogdan Adrian-Catalin-B15061
Subject: Re: [PATCH] Add Freescale CodeWarrior debug support for kernel
On Oct 28, 2010, at 3:50 AM, Roy Zang wrote:
> CodeWarrior is popular embedded tools to support debugging Powerpc.
> This patch adds Freescale CodeWarrior debug support for Linux kernel
on
> 85xx/QorIQ platform.
>
> Signed-off-by: Bogdan Adrin <drian.bogdan@freescale.com>
> Signed-off-by: Roy Zang <tie-fei.zang@freescale.com>
> ---
> arch/powerpc/Kconfig.debug | 8 ++++++++
> arch/powerpc/Makefile | 5 +++++
> arch/powerpc/include/asm/reg_booke.h | 4 ++++
> arch/powerpc/kernel/fsl_booke_entry_mapping.S | 3 +++
> arch/powerpc/kernel/head_fsl_booke.S | 11 +++++++++--
> arch/powerpc/kernel/idle.c | 5 ++++-
> 6 files changed, 33 insertions(+), 3 deletions(-)
>
> diff --git a/arch/powerpc/Kconfig.debug b/arch/powerpc/Kconfig.debug
> index 2d38a50..eedd2ac 100644
> --- a/arch/powerpc/Kconfig.debug
> +++ b/arch/powerpc/Kconfig.debug
> @@ -153,6 +153,14 @@ config BDI_SWITCH
> Unless you are intending to debug the kernel with one of these
> machines, say N here.
>
> +config DEBUG_CODEWARRIOR
> + bool "Include CodeWarrior kernel debugging"
> + depends on DEBUG_KERNEL && PPC32
> + help
> + Say Y here to include CodeWarrior kernel debugging option
> + Unless you are intending to debug the kernel with one of these
> + machines, say N here.
> +
> config BOOTX_TEXT
> bool "Support for early boot text console (BootX or OpenFirmware
only)"
> depends on PPC_OF && PPC_BOOK3S
> diff --git a/arch/powerpc/Makefile b/arch/powerpc/Makefile
> index b7212b6..d3050e6 100644
> --- a/arch/powerpc/Makefile
> +++ b/arch/powerpc/Makefile
> @@ -121,6 +121,11 @@ KBUILD_CFLAGS += $(call
cc-option,-fno-dwarf2-cfi-asm)
> # often slow when they are implemented at all
> KBUILD_CFLAGS += -mno-string
>
> +ifeq ($(CONFIG_DEBUG_CODEWARRIOR),y)
> +CFLAGS += -g2 -gdwarf-2
> +AFLAGS_KERNEL += -Wa,-gdwarf2
> +endif
> +
> ifeq ($(CONFIG_6xx),y)
> KBUILD_CFLAGS += -mcpu=powerpc
> endif
> diff --git a/arch/powerpc/include/asm/reg_booke.h
b/arch/powerpc/include/asm/reg_booke.h
> index 667a498..ac65fcd 100644
> --- a/arch/powerpc/include/asm/reg_booke.h
> +++ b/arch/powerpc/include/asm/reg_booke.h
> @@ -35,7 +35,11 @@
> #define MSR_KERNEL (MSR_ME|MSR_RI|MSR_IR|MSR_DR|MSR_CE)
> #define MSR_USER (MSR_KERNEL|MSR_PR|MSR_EE)
> #else
> +#if defined(CONFIG_DEBUG_CODEWARRIOR)
> +#define MSR_KERNEL (MSR_ME|MSR_RI|MSR_CE|MSR_DE)
> +#else
> #define MSR_KERNEL (MSR_ME|MSR_RI|MSR_CE)
> +#endif
> #define MSR_USER (MSR_KERNEL|MSR_PR|MSR_EE)
> #endif
>
> diff --git a/arch/powerpc/kernel/fsl_booke_entry_mapping.S
b/arch/powerpc/kernel/fsl_booke_entry_mapping.S
> index a92c79b..9102aa7 100644
> --- a/arch/powerpc/kernel/fsl_booke_entry_mapping.S
> +++ b/arch/powerpc/kernel/fsl_booke_entry_mapping.S
> @@ -116,6 +116,9 @@ skpinv: addi r6,r6,1
/* Increment */
>
> xori r6,r4,1
> slwi r6,r6,5 /* setup new context with other address
space */
> +#if defined(CONFIG_DEBUG_CODEWARRIOR)
> + ori r6, r6, 0x200 /* enable DE bit for MSR */
Can we use MSR_DE@l instead of 0x200
> +#endif
> bl 1f /* Find our address */
> 1: mflr r9
> rlwimi r7,r9,0,20,31
> diff --git a/arch/powerpc/kernel/head_fsl_booke.S
b/arch/powerpc/kernel/head_fsl_booke.S
> index 529b817..9962d09 100644
> --- a/arch/powerpc/kernel/head_fsl_booke.S
> +++ b/arch/powerpc/kernel/head_fsl_booke.S
> @@ -21,7 +21,7 @@
> * debbie_chu@mvista.com
> * Copyright 2002-2004 MontaVista Software, Inc.
> * PowerPC 44x support, Matt Porter <mporter@kernel.crashing.org>
> - * Copyright 2004 Freescale Semiconductor, Inc
> + * Copyright 2004,2010 Freescale Semiconductor, Inc
> * PowerPC e500 modifications, Kumar Gala
<galak@kernel.crashing.org>
> *
> * This program is free software; you can redistribute it and/or
modify it
> @@ -135,7 +135,7 @@ _ENTRY(__early_start)
> mtspr SPRN_HID0, r2
> #endif
>
> -#if !defined(CONFIG_BDI_SWITCH)
> +#if !defined(CONFIG_BDI_SWITCH) && !defined(CONFIG_DEBUG_CODEWARRIOR)
> /*
> * The Abatron BDI JTAG debugger does not tolerate others
> * mucking with the debug registers.
> @@ -197,6 +197,13 @@ _ENTRY(__early_start)
> /*
> * Decide what sort of machine this is and initialize the MMU.
> */
> +#if defined(CONFIG_DEBUG_CODEWARRIOR)
> + lis r10, 0x1008 /* clear the V bit from the L2MMU_CAM8
register */
why do we need this code? It seems pretty fragile if its assuming
something about TLB entry #8
> + mtspr SPRN_MAS0, r10
> + lis r10, 0x0
> + mtspr SPRN_MAS1, r10
> + tlbwe
> +#endif
> mr r3,r31
> mr r4,r30
> mr r5,r29
> diff --git a/arch/powerpc/kernel/idle.c b/arch/powerpc/kernel/idle.c
> index 39a2baa..83fb019 100644
> --- a/arch/powerpc/kernel/idle.c
> +++ b/arch/powerpc/kernel/idle.c
> @@ -73,8 +73,11 @@ void cpu_idle(void)
> stop_critical_timings();
>
> /* check again after disabling irqs */
> - if (!need_resched() &&
!cpu_should_die())
> + if (!need_resched() &&
!cpu_should_die()) {
> +#if !defined(CONFIG_DEBUG_CODEWARRIOR)
> ppc_md.power_save();
> +#endif
> + }
>
> start_critical_timings();
>
> --
> 1.5.6.5
>
[-- Attachment #2: Type: text/html, Size: 13575 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2010-11-12 11:46 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-10-28 8:50 [PATCH] Add Freescale CodeWarrior debug support for kernel Roy Zang
2010-11-11 11:51 ` Kumar Gala
2010-11-12 11:31 ` Bogdan Adrian-Catalin-B15061
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).