Skip to contentSkip to conversation

kgdb cleanup and Blackfin kgdb port

PATCH New Mike Frysinger 5 participants 18 messages Dec 21, 2009 – Jan 22, 2010 Generic include/asm header files

lore
Share & tools
lore
#0 lore raw

cover kgdb cleanup and Blackfin kgdb port

I can take care of merging the Blackfin-specific KGDB piece through my tree since it depends on some other Blackfin patches. But all the KGDB common changes can be merged now.

Mike Frysinger (1):
kgdb: drop duplicate debugger_exception_handler

Robin Getz (4):
kgdb: add default generic stubs
kgdb: update mem2hex/hex2mem funcs
asm-generic/signal.h: import from linux
Blackfin: add support for kgdb

 common/Makefile                              |    2 +-
 common/kgdb.c                                |   43 ++-
 common/kgdb_stubs.c                          |   64 ++++
 cpu/74xx_7xx/traps.c                         |    4 -
 cpu/blackfin/interrupt.S                     |  105 +++++++
 cpu/blackfin/traps.c                         |   57 ++++-
 cpu/mpc5xx/traps.c                           |    4 -
 cpu/mpc5xxx/traps.c                          |    4 -
 cpu/mpc8220/traps.c                          |    4 -
 cpu/mpc8260/traps.c                          |    4 -
 cpu/mpc85xx/traps.c                          |    4 -
 cpu/mpc86xx/traps.c                          |    4 -
 cpu/mpc8xx/traps.c                           |    4 -
 cpu/ppc4xx/traps.c                           |    4 -
 include/asm-blackfin/config.h                |    7 +
 include/asm-blackfin/deferred.h              |   20 ++
 include/asm-blackfin/entry.h                 |   10 +
 include/asm-blackfin/mach-common/bits/core.h |    3 +
 include/asm-blackfin/signal.h                |    1 +
 include/asm-generic/signal.h                 |  101 ++++++
 include/configs/bfin_adi_common.h            |    1 +
 lib_blackfin/Makefile                        |    2 +
 lib_blackfin/__kgdb.S                        |  155 ++++++++++
 lib_blackfin/board.c                         |    6 +
 lib_blackfin/kgdb.c                          |  423 ++++++++++++++++++++++++++
 lib_blackfin/kgdb.h                          |  160 ++++++++++
 lib_blackfin/string.c                        |   44 +++-
 27 files changed, 1180 insertions(+), 60 deletions(-)
 create mode 100644 common/kgdb_stubs.c
 create mode 100644 include/asm-blackfin/deferred.h
 create mode 100644 include/asm-blackfin/signal.h
 create mode 100644 include/asm-generic/signal.h
 create mode 100644 lib_blackfin/__kgdb.S
 create mode 100644 lib_blackfin/kgdb.c
 create mode 100644 lib_blackfin/kgdb.h
#1 lore raw

PATCH 1/5 kgdb: add default generic stubs

From: Robin Getz <[email protected]>

The default kgdb functions can be implemented with common U-Boot functions, so rather than force everyone to copy & paste these things, create a set of weak stubs.

---
 common/Makefile     |    2 +-
 common/kgdb_stubs.c |   64 +++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 65 insertions(+), 1 deletions(-)
 create mode 100644 common/kgdb_stubs.c
common/Makefile +1 -1
index 44fe687..d054cbe 100644
@@ -149,7 +149,7 @@ COBJS-$(CONFIG_DDR_SPD) += ddr_spd.o
 COBJS-$(CONFIG_HWCONFIG) += hwconfig.o
 COBJS-$(CONFIG_CONSOLE_MUX) += iomux.o
 COBJS-y += flash.o
-COBJS-$(CONFIG_CMD_KGDB) += kgdb.o
+COBJS-$(CONFIG_CMD_KGDB) += kgdb.o kgdb_stubs.o
 COBJS-$(CONFIG_KALLSYMS) += kallsyms.o
 COBJS-$(CONFIG_LCD) += lcd.o
 COBJS-$(CONFIG_LYNXKDI) += lynxkdi.o
common/kgdb_stubs.c new file +64 -0

64 lines not on this page · raw message

Signature · 1 line
1.6.5.4
#2 lore raw

PATCH 1/5 kgdb: add default generic stubs

Dear Mike Frysinger,

Quoted 6 lines · In message <[email protected]> you wrote:

From: Robin Getz <[email protected]>

The default kgdb functions can be implemented with common U-Boot functions, so rather than force everyone to copy & paste these things, create a set of weak stubs.

Quoted 7 lines
---
 common/Makefile     |    2 +-
 common/kgdb_stubs.c |   64 +++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 65 insertions(+), 1 deletions(-)
 create mode 100644 common/kgdb_stubs.c

Applied, thanks.

Best regards,

Wolfgang Denk

Signature · 5 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
A stone was placed at a ford in a river with the inscription:
"When this stone is covered it is dangerous to ford here."
#3 lore raw

PATCH 2/5 kgdb: drop duplicate debugger_exception_handler

In reply to Mike Frysinger

The debugger_exception_handler definition is the same for everyone, so use the common one now.

---
 cpu/74xx_7xx/traps.c |    4 ----
 cpu/mpc5xx/traps.c   |    4 ----
 cpu/mpc5xxx/traps.c  |    4 ----
 cpu/mpc8220/traps.c  |    4 ----
 cpu/mpc8260/traps.c  |    4 ----
 cpu/mpc85xx/traps.c  |    4 ----
 cpu/mpc86xx/traps.c  |    4 ----
 cpu/mpc8xx/traps.c   |    4 ----
 cpu/ppc4xx/traps.c   |    4 ----
 9 files changed, 0 insertions(+), 36 deletions(-)
cpu/74xx_7xx/traps.c +0 -4
index b066227..24e28e2 100644
@@ -40,10 +40,6 @@
 DECLARE_GLOBAL_DATA_PTR;
 #endif
 
-#if defined(CONFIG_CMD_KGDB)
-int (*debugger_exception_handler)(struct pt_regs *) = 0;
-#endif
-
 /* Returns 0 if exception not found and fixup otherwise.  */
 extern unsigned long search_exception_table(unsigned long);
 
cpu/mpc5xx/traps.c +0 -4
index 78c820a..cc8e091 100644
@@ -36,10 +36,6 @@
 #include <command.h>
 #include <asm/processor.h>
 
-#if defined(CONFIG_CMD_KGDB)
-int (*debugger_exception_handler)(struct pt_regs *) = 0;
-#endif
-
 #if defined(CONFIG_CMD_BEDBUG)
 extern void do_bedbug_breakpoint(struct pt_regs *);
 #endif
cpu/mpc5xxx/traps.c +0 -4
index daa1ec6..2a09153 100644
@@ -37,10 +37,6 @@
 #include <command.h>
 #include <asm/processor.h>
 
-#if defined(CONFIG_CMD_KGDB)
-int (*debugger_exception_handler)(struct pt_regs *) = 0;
-#endif
-
 /* Returns 0 if exception not found and fixup otherwise.  */
 extern unsigned long search_exception_table(unsigned long);
 
cpu/mpc8220/traps.c +0 -4
index 89cca1d..f98d40f 100644
@@ -37,10 +37,6 @@
 #include <command.h>
 #include <asm/processor.h>
 
-#if defined(CONFIG_CMD_KGDB)
-int (*debugger_exception_handler) (struct pt_regs *) = 0;
-#endif
-
 /* Returns 0 if exception not found and fixup otherwise.  */
 extern unsigned long search_exception_table (unsigned long);
 
cpu/mpc8260/traps.c +0 -4
index 6624544..f9f4dea 100644
@@ -37,10 +37,6 @@
 #include <asm/processor.h>
 #include <asm/m8260_pci.h>
 
-#if defined(CONFIG_CMD_KGDB)
-int (*debugger_exception_handler)(struct pt_regs *) = 0;
-#endif
-
 /* Returns 0 if exception not found and fixup otherwise.  */
 extern unsigned long search_exception_table(unsigned long);
 
cpu/mpc85xx/traps.c +0 -4
index 9d16b9b..241ebd5 100644
@@ -42,10 +42,6 @@
 
 DECLARE_GLOBAL_DATA_PTR;
 
-#if defined(CONFIG_CMD_KGDB)
-int (*debugger_exception_handler)(struct pt_regs *) = 0;
-#endif
-
 /* Returns 0 if exception not found and fixup otherwise.  */
 extern unsigned long search_exception_table(unsigned long);
 
cpu/mpc86xx/traps.c +0 -4
index 13f386d..ad005c3 100644
@@ -36,10 +36,6 @@
 
 DECLARE_GLOBAL_DATA_PTR;
 
-#if defined(CONFIG_CMD_KGDB)
-int (*debugger_exception_handler)(struct pt_regs *) = 0;
-#endif
-
 /* Returns 0 if exception not found and fixup otherwise.  */
 extern unsigned long search_exception_table(unsigned long);
 
cpu/mpc8xx/traps.c +0 -4
index e1ec889..f357c8d 100644
@@ -36,10 +36,6 @@
 #include <command.h>
 #include <asm/processor.h>
 
-#if defined(CONFIG_CMD_KGDB)
-int (*debugger_exception_handler)(struct pt_regs *) = 0;
-#endif
-
 #if defined(CONFIG_CMD_BEDBUG)
 extern void do_bedbug_breakpoint(struct pt_regs *);
 #endif
cpu/ppc4xx/traps.c +0 -4
index 55154b6..cb35faf 100644
@@ -38,10 +38,6 @@
 
 DECLARE_GLOBAL_DATA_PTR;
 
-#if defined(CONFIG_CMD_KGDB)
-int (*debugger_exception_handler)(struct pt_regs *) = 0;
-#endif
-
 /* Returns 0 if exception not found and fixup otherwise.  */
 extern unsigned long search_exception_table(unsigned long);
 
Signature · 1 line
1.6.5.4
#4 lore raw

PATCH 2/5 kgdb: drop duplicate debugger_exception_handler

Dear Mike Frysinger,

Quoted 4 lines · In message <[email protected]> you wrote:

The debugger_exception_handler definition is the same for everyone, so use the common one now.

Quoted 11 lines
---
 cpu/74xx_7xx/traps.c |    4 ----
 cpu/mpc5xx/traps.c   |    4 ----
 cpu/mpc5xxx/traps.c  |    4 ----
 cpu/mpc8220/traps.c  |    4 ----
 cpu/mpc8260/traps.c  |    4 ----
 cpu/mpc85xx/traps.c  |    4 ----
 cpu/mpc86xx/traps.c  |    4 ----
 cpu/mpc8xx/traps.c   |    4 ----
 cpu/ppc4xx/traps.c   |    4 ----
 9 files changed, 0 insertions(+), 36 deletions(-)

Applied, thanks.

Best regards,

Wolfgang Denk

Signature · 5 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
        Ordnung ist die Lust der Vernunft,
        aber Unordnung die Wonne der Phantasie         - Paul Claudel
#5 lore raw

PATCH 3/5 kgdb: update mem2hex/hex2mem funcs

In reply to Mike Frysinger

From: Robin Getz <[email protected]>

Convert the funcs to do the conversion inline so that we can do the copy all at once with memcpy. This let's us push out an weird arch-specific issues with accessing different regions of memory to the memcpy function like the MMRs on Blackfin systems, and it should be a bit faster.

---
 common/kgdb.c |   43 ++++++++++++++++++++++++++++++++-----------
 1 files changed, 32 insertions(+), 11 deletions(-)
common/kgdb.c +32 -11
index 862f368..0531452 100644
@@ -132,11 +132,20 @@ hex(unsigned char ch)
 static unsigned char *
 mem2hex(char *mem, char *buf, int count)
 {
+	char *tmp;
 	unsigned char ch;
 
+	/*
+	 * We use the upper half of buf as an intermediate buffer for the
+	 * raw memory copy.  Hex conversion will work against this one.
+	 */
+	tmp = buf + count;
 	longjmp_on_fault = 1;
+
+	memcpy(tmp, mem, count);
+
 	while (count-- > 0) {
-		ch = *mem++;
+		ch = *tmp++;
 		*buf++ = hexchars[ch >> 4];
 		*buf++ = hexchars[ch & 0xf];
 	}
@@ -151,21 +160,33 @@ mem2hex(char *mem, char *buf, int count)
 static char *
 hex2mem(char *buf, char *mem, int count)
 {
-	int i, hexValue;
-	unsigned char ch;
-	char *mem_start = mem;
+	int hexValue;
+	char *tmp_raw, *tmp_hex;
+
+	/*
+	 * We use the upper half of buf as an intermediate buffer for the
+	 * raw memory that is converted from hex.
+	 */
+	tmp_raw = buf + count * 2;
+	tmp_hex = tmp_raw - 1;
 
 	longjmp_on_fault = 1;
-	for (i=0; i<count; i++) {
-		if ((hexValue = hex(*buf++)) < 0)
+	while (tmp_hex >= buf) {
+		tmp_raw--;
+		hexValue = hex(*tmp_hex--);
+		if (hexValue < 0)
 			kgdb_error(KGDBERR_NOTHEXDIG);
-		ch = hexValue << 4;
-		if ((hexValue = hex(*buf++)) < 0)
+		*tmp_raw = hexValue;
+		hexValue = hex(*tmp_hex--);
+		if (hexValue < 0)
 			kgdb_error(KGDBERR_NOTHEXDIG);
-		ch |= hexValue;
-		*mem++ = ch;
+		*tmp_raw |= hexValue << 4;
+
 	}
-	kgdb_flush_cache_range((void *)mem_start, (void *)(mem - 1));
+
+	memcpy(mem, tmp_raw, count);
+
+	kgdb_flush_cache_range((void *)mem, (void *)(mem+count));
 	longjmp_on_fault = 0;
 
 	return buf;
Signature · 1 line
1.6.5.4
#6 lore raw

PATCH 3/5 kgdb: update mem2hex/hex2mem funcs

Dear Mike Frysinger,

Quoted 7 lines · In message <[email protected]> you wrote:

From: Robin Getz <[email protected]>

Convert the funcs to do the conversion inline so that we can do the copy all at once with memcpy. This let's us push out an weird arch-specific issues with accessing different regions of memory to the memcpy function like the MMRs on Blackfin systems, and it should be a bit faster.

Quoted 5 lines
---
 common/kgdb.c |   43 ++++++++++++++++++++++++++++++++-----------
 1 files changed, 32 insertions(+), 11 deletions(-)

Applied, thanks.

Best regards,

Wolfgang Denk

Signature · 4 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Be kind to unkind people - they need it the most.
#7 lore raw

[U-Boot] U-Boot for LENO3 processor board

Dear All,

Greetings!

I am having the following boot requirements:

Boot software will be flashed in to PROM, which should start from PROM and copy the application software which is flahsed in other flash device in different address space. The processor is LEON3FT.

is current release of U-Boot supports LEON3FT architecture, please provide with details and link to get start

Regards,
Balaji

#8 lore raw

[U-Boot] U-Boot for LENO3 processor board

Hi Balaji,

Quoted 8 lines

I am having the following boot requirements:

Boot software will be flashed in to PROM, which should start from PROM and copy the application software which is flahsed in other flash device in different address space. The processor is LEON3FT.

is current release of U-Boot supports LEON3FT architecture, please provide with details and link to get start

Actually I don't know much about the Leon line of CPUs, but I see that we have three configurations using a Leon CPU: gr_cpci_ax2000, gr_ep2s60, grsim and gr_xc3s_1500. I put the maintainer of these boards on CC, so maybe he can answer that.

Cheers
Detlev

Signature · 7 lines
Indeed, the author firmly believes that the best serious work is also
good fun.   We needn't apologize if we enjoy doing research.
                                        -- Donald Knuth
--
DENX Software Engineering GmbH,      MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich,  Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-40 Fax: (+49)-8142-66989-80 Email: dzu at denx.de
#9 lore raw

[U-Boot] U-Boot for LENO3 processor board

Hi,

Quoted 15 lines · Detlev Zundel

Hi Balaji,

Quoted 10 lines

I am having the following boot requirements:

Boot software will be flashed in to PROM, which should start from PROM and copy the application software which is flahsed in other flash device in different address space. The processor is LEON3FT.

is current release of U-Boot supports LEON3FT architecture, please provide with details and link to get start

Quoted 9 lines

Actually I don't know much about the Leon line of CPUs, but I see that we have three configurations using a Leon CPU: gr_cpci_ax2000, gr_ep2s60, grsim and gr_xc3s_1500. I put the maintainer of these boards on CC, so maybe he can answer that.

Cheers
Detlev

As Detlev points out there are three BSPs available. Since the LEON3 is a SOC it is hard to support all different configurations on a board, so the boards supported are though to support the template design of GRLIB.

The LEON3FT is not supported in the current u-boot available in the sparc git repository at denx.de. Some extra steps must be taken when running the fault-tolerant LEON3, one must clear memory and registered for example so that the CRCs of the registers are correct.

I have a version that supports LEON3FT available at ftp://ftp.gaisler.com/u-boot/u-boot-sparc-vxworks-1.0.0.tar.gz, currently I'm working with generating patches for the LEON3 CPU/boards, I have reworked some parts of the current LEON port. I suggest you wait one day or so until I push the patches onto the SPARC-u-boot git repo, after that I will also add the LEON3FT patches. In the meanwhile you can try the FTP link.

Regards,
Daniel

#10 lore raw

[U-Boot] U-Boot for LENO3 processor board

Thanks Daniel,

it will be veryhelpful for me to start exploring. pleas do let me know once you have updated for LEON3FT.

have nice weekend.

Regards,
Balaji KUPPUSAMY, PMP?

----- Original Message ----
From: Daniel Hellstrom <[email protected]>
To: K Balaji <[email protected]>
Cc: u-boot at lists.denx.de
Sent: Thu, January 21, 2010 3:02:22 PM
Subject: Re: [U-Boot] U-Boot for LENO3 processor board

Hi,

Quoted 13 lines · Detlev Zundel

Hi Balaji,

Quoted 9 lines

I am having the following boot requirements:

Boot software will be flashed in to PROM, which should start from PROM and copy the application software which is flahsed in other flash device in different address space. The processor is LEON3FT.

is current release of U-Boot supports LEON3FT architecture, please provide with details and link to get start

Quoted 8 lines

Actually I don't know much about the Leon line of CPUs, but I see that we have three configurations using a Leon CPU: gr_cpci_ax2000, gr_ep2s60, grsim and gr_xc3s_1500. I put the maintainer of these boards on CC, so maybe he can answer that.

Cheers
Detlev

As Detlev points out there are three BSPs available. Since the LEON3 is a SOC it is hard to support all different configurations on a board, so the boards supported are though to support the template design of GRLIB.

The LEON3FT is not supported in the current u-boot available in the sparc git repository at denx.de. Some extra steps must be taken when running the fault-tolerant LEON3, one must clear memory and registered for example so that the CRCs of the registers are correct.

I have a version that supports LEON3FT available at ftp://ftp.gaisler.com/u-boot/u-boot-sparc-vxworks-1.0.0.tar.gz, currently I'm working with generating patches for the LEON3 CPU/boards, I have reworked some parts of the current LEON port. I suggest you wait one day or so until I push the patches onto the SPARC-u-boot git repo, after that I will also add the LEON3FT patches. In the meanwhile you can try the FTP link.

Regards,
Daniel

#11 lore raw

[U-Boot] U-Boot for LENO3 processor board

In reply to Detlev Zundel

Hi,

Quoted 15 lines · Detlev Zundel

Hi Balaji,

Quoted 10 lines

I am having the following boot requirements:

Boot software will be flashed in to PROM, which should start from PROM and copy the application software which is flahsed in other flash device in different address space. The processor is LEON3FT.

is current release of U-Boot supports LEON3FT architecture, please provide with details and link to get start

Quoted 9 lines

Actually I don't know much about the Leon line of CPUs, but I see that we have three configurations using a Leon CPU: gr_cpci_ax2000, gr_ep2s60, grsim and gr_xc3s_1500. I put the maintainer of these boards on CC, so maybe he can answer that.

Cheers
Detlev

Thank you for CC:ing me Detlev.

As Detlev points out there are three BSPs available. Since the LEON3 is a SOC it is hard to support all different configurations on a board, so the BSPs intention is to support the template design of GRLIB.

The LEON3FT is not supported in the current u-boot available in the sparc git repository at denx.de. Some extra steps must be taken when running the fault-tolerant LEON3, one must clear memory and registered for example so that the CRCs of the registers are correct.

I have a version that supports LEON3FT available at ftp://ftp.gaisler.com/u-boot/u-boot-sparc-vxworks-1.0.0.tar.gz, currently I'm working with generating patches for the LEON3 CPU/boards, I have reworked some parts of the current LEON port. I suggest you wait one day or so until I push the patches onto the SPARC-u-boot git repo, after that I will also add the LEON3FT patches. In the meanwhile you can try the FTP link.

Regards,
Daniel

#12 lore raw

[U-Boot] U-Boot for LENO3 processor board

In reply to Detlev Zundel

Hallo Detlev,

thanks for prompt reply and the input.

Regards,
Balaji KUPPUSAMY, PMP?

----- Original Message ----
From: Detlev Zundel <[email protected]>
To: K Balaji <[email protected]>
Cc: u-boot at lists.denx.de; Daniel Hellstrom <[email protected]>
Sent: Thu, January 21, 2010 2:14:52 PM
Subject: Re: [U-Boot] U-Boot for LENO3 processor board

Hi Balaji,

Quoted 8 lines

I am having the following boot requirements:

Boot software will be flashed in to PROM, which should start from PROM and copy the application software which is flahsed in other flash device in different address space. The processor is LEON3FT.

is current release of U-Boot supports LEON3FT architecture, please provide with details and link to get start

Actually I don't know much about the Leon line of CPUs, but I see that we have three configurations using a Leon CPU: gr_cpci_ax2000, gr_ep2s60, grsim and gr_xc3s_1500. I put the maintainer of these boards on CC, so maybe he can answer that.

Cheers
Detlev

Signature · 7 lines
Indeed, the author firmly believes that the best serious work is also
good fun.   We needn't apologize if we enjoy doing research.
                                        -- Donald Knuth
--
DENX Software Engineering GmbH,      MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich,  Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-40 Fax: (+49)-8142-66989-80 Email: dzu at denx.de
#13 lore raw

PATCH 4/5 asm-generic/signal.h: import from linux

In reply to Mike Frysinger

From: Robin Getz <[email protected]>

We need signal.h for Blackfin/KGDB, so import the asm-generic/signal.h for people to leverage.

---
 include/asm-generic/signal.h |  101 ++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 101 insertions(+), 0 deletions(-)
 create mode 100644 include/asm-generic/signal.h
include/asm-generic/signal.h new file +101 -0
new file mode 100644
index 0000000..af93947
@@ -0,0 +1,101 @@
+#ifndef __ASM_GENERIC_SIGNAL_H
+#define __ASM_GENERIC_SIGNAL_H
+
+#include <linux/types.h>
+
+#define _NSIG		64
+#define _NSIG_BPW	BITS_PER_LONG
+#define _NSIG_WORDS	(_NSIG / _NSIG_BPW)
+
+#define SIGHUP		 1
+#define SIGINT		 2
+#define SIGQUIT		 3
+#define SIGILL		 4
+#define SIGTRAP		 5
+#define SIGABRT		 6
+#define SIGIOT		 6
+#define SIGBUS		 7
+#define SIGFPE		 8
+#define SIGKILL		 9
+#define SIGUSR1		10
+#define SIGSEGV		11
+#define SIGUSR2		12
+#define SIGPIPE		13
+#define SIGALRM		14
+#define SIGTERM		15
+#define SIGSTKFLT	16
+#define SIGCHLD		17
+#define SIGCONT		18
+#define SIGSTOP		19
+#define SIGTSTP		20
+#define SIGTTIN		21
+#define SIGTTOU		22
+#define SIGURG		23
+#define SIGXCPU		24
+#define SIGXFSZ		25
+#define SIGVTALRM	26
+#define SIGPROF		27
+#define SIGWINCH	28
+#define SIGIO		29
+#define SIGPOLL		SIGIO
+/*
+#define SIGLOST		29
+*/
+#define SIGPWR		30
+#define SIGSYS		31
+#define	SIGUNUSED	31
+
+/* These should not be considered constants from userland.  */
+#define SIGRTMIN	32
+#ifndef SIGRTMAX
+#define SIGRTMAX	_NSIG
+#endif
+
+/*
+ * SA_FLAGS values:
+ *
+ * SA_ONSTACK indicates that a registered stack_t will be used.
+ * SA_RESTART flag to get restarting signals (which were the default long ago)
+ * SA_NOCLDSTOP flag to turn off SIGCHLD when children stop.
+ * SA_RESETHAND clears the handler when the signal is delivered.
+ * SA_NOCLDWAIT flag on SIGCHLD to inhibit zombies.
+ * SA_NODEFER prevents the current signal from being masked in the handler.
+ *
+ * SA_ONESHOT and SA_NOMASK are the historical Linux names for the Single
+ * Unix names RESETHAND and NODEFER respectively.
+ */
+#define SA_NOCLDSTOP	0x00000001
+#define SA_NOCLDWAIT	0x00000002
+#define SA_SIGINFO	0x00000004
+#define SA_ONSTACK	0x08000000
+#define SA_RESTART	0x10000000
+#define SA_NODEFER	0x40000000
+#define SA_RESETHAND	0x80000000
+
+#define SA_NOMASK	SA_NODEFER
+#define SA_ONESHOT	SA_RESETHAND
+
+/*
+ * New architectures should not define the obsolete
+ *	SA_RESTORER	0x04000000
+ */
+
+/*
+ * sigaltstack controls
+ */
+#define SS_ONSTACK	1
+#define SS_DISABLE	2
+
+#define MINSIGSTKSZ	2048
+#define SIGSTKSZ	8192
+
+#ifndef __ASSEMBLY__
+typedef struct {
+	unsigned long sig[_NSIG_WORDS];
+} sigset_t;
+
+/* not actually used, but required for linux/syscalls.h */
+
+#endif /* __ASSEMBLY__ */
+
+#endif /* _ASM_GENERIC_SIGNAL_H */
Signature · 1 line
1.6.5.4
#14 lore raw

PATCH 5/5 Blackfin: add support for kgdb

In reply to Mike Frysinger

From: Robin Getz <[email protected]>

---
 cpu/blackfin/interrupt.S                     |  105 +++++++
 cpu/blackfin/traps.c                         |   57 ++++-
 include/asm-blackfin/config.h                |    7 +
 include/asm-blackfin/deferred.h              |   20 ++
 include/asm-blackfin/entry.h                 |   10 +
 include/asm-blackfin/mach-common/bits/core.h |    3 +
 include/asm-blackfin/signal.h                |    1 +
 include/configs/bfin_adi_common.h            |    1 +
 lib_blackfin/Makefile                        |    2 +
 lib_blackfin/__kgdb.S                        |  155 ++++++++++
 lib_blackfin/board.c                         |    6 +
 lib_blackfin/kgdb.c                          |  423 ++++++++++++++++++++++++++
 lib_blackfin/kgdb.h                          |  160 ++++++++++
 lib_blackfin/string.c                        |   44 +++-
 14 files changed, 982 insertions(+), 12 deletions(-)
 create mode 100644 include/asm-blackfin/deferred.h
 create mode 100644 include/asm-blackfin/signal.h
 create mode 100644 lib_blackfin/__kgdb.S
 create mode 100644 lib_blackfin/kgdb.c
 create mode 100644 lib_blackfin/kgdb.h
cpu/blackfin/interrupt.S +105 -0
index 8c7a262..69bba3f 100644
@@ -8,6 +8,9 @@
 #include <config.h>
 #include <asm/blackfin.h>
 #include <asm/entry.h>
+#include <asm/ptrace.h>
+#include <asm/deferred.h>
+#include <asm/mach-common/bits/core.h>
 
 .text
 
@@ -19,10 +22,75 @@ ENTRY(_trap)
 	SAVE_ALL_SYS
 
 	r0 = sp;	/* stack frame pt_regs pointer argument ==> r0 */
+	r1 = 3;		/* EVT3 space */
 	sp += -12;
 	call _trap_c;
 	sp += 12;
 
+#ifdef CONFIG_EXCEPTION_DEFER
+	CC = R0 == 0;
+	IF CC JUMP .Lexit_trap;
+
+	/* To avoid double faults, lower our priority to IRQ5 */
+	p4.l = lo(COREMMR_BASE);
+	p4.h = hi(COREMMR_BASE);
+
+	r7.h = _exception_to_level5;
+	r7.l = _exception_to_level5;
+	[p4 + (EVT5 - COREMMR_BASE)] = r7;
+
+	/*
+	 * Save these registers, as they are only valid in exception context
+	 *  (where we are now - as soon as we defer to IRQ5, they can change)
+	 */
+	p5.l = _deferred_regs;
+	p5.h = _deferred_regs;
+	r6 = [p4 + (DCPLB_FAULT_ADDR - COREMMR_BASE)];
+	[p5 + (deferred_regs_DCPLB_FAULT_ADDR * 4)] = r6;
+
+	r6 = [p4 + (ICPLB_FAULT_ADDR - COREMMR_BASE)];
+	[p5 + (deferred_regs_ICPLB_FAULT_ADDR * 4)] = r6;
+
+	/* Save the state of single stepping */
+	r6 = SYSCFG;
+	[p5 + (deferred_regs_SYSCFG * 4)] = r6;
+	/* Clear it while we handle the exception in IRQ5 mode
+	 * RESTORE_ALL_SYS will load it, so all we need to do is store it
+	 * in the right place
+	 */
+	BITCLR(r6, SYSCFG_SSSTEP_P);
+	[SP + PT_SYSCFG] = r6;
+
+	/* Since we are going to clobber RETX, we need to save it */
+	r6 = retx;
+	[p5 + (deferred_regs_retx * 4)] = r6;
+
+	/* Save the current IMASK, since we change in order to jump to level 5 */
+	cli r6;
+	[p5 + (deferred_regs_IMASK * 4)] = r6;
+
+	/* Disable all interrupts, but make sure level 5 is enabled so
+	 * we can switch to that level.
+	 */
+	r6 = 0x3f;
+	sti r6;
+
+	/* Clobber RETX so we don't end up back at a faulting instruction */
+	[sp + PT_RETX] = r7;
+
+	/* In case interrupts are disabled IPEND[4] (global interrupt disable bit)
+	 * clear it (re-enabling interrupts again) by the special sequence of pushing
+	 * RETI onto the stack.  This way we can lower ourselves to IVG5 even if the
+	 * exception was taken after the interrupt handler was called but before it
+	 * got a chance to enable global interrupts itself.
+	 */
+	[--sp] = reti;
+	sp += 4;
+
+	RAISE 5;
+.Lexit_trap:
+#endif
+
 #if ANOMALY_05000257
 	R7  = LC0;
 	LC0 = R7;
@@ -35,6 +103,43 @@ ENTRY(_trap)
 	rtx;
 ENDPROC(_trap)
 
+#ifdef CONFIG_EXCEPTION_DEFER
+/* Deferred (IRQ5) exceptions */
+ENTRY(_exception_to_level5)
+	SAVE_ALL_SYS
+
+	/* Now we have to fix things up */
+	p4.l = lo(EVT5);
+	p4.h = hi(EVT5);
+	r0.l = _evt_default;
+	r0.h = _evt_default;
+	[p4] = r0;
+	csync;
+
+	p4.l = _deferred_regs;
+	p4.h = _deferred_regs;
+	r0 = [p4 + (deferred_regs_retx * 4)];
+	[sp + PT_PC] = r0;
+
+	r0 = [p4 + (deferred_regs_SYSCFG * 4)];
+	[sp + PT_SYSCFG] = r0;
+
+	r0 = sp;	/* stack frame pt_regs pointer argument ==> r0 */
+	r1 = 5;	/* EVT5 space */
+	sp += -12;
+	call _trap_c;
+	sp += 12;
+
+	/* Restore IMASK */
+	r0 = [p4 + (deferred_regs_IMASK * 4)];
+	sti r0;
+
+	RESTORE_ALL_SYS
+
+	rti;
+ENDPROC(_exception_to_level5)
+#endif
+
 /* default entry point for interrupts */
 ENTRY(_evt_default)
 	SAVE_ALL_SYS
cpu/blackfin/traps.c +52 -5

104 lines not on this page · raw message

include/asm-blackfin/config.h +7 -0
index 0ae838a..7455685 100644
@@ -66,6 +66,11 @@
 # error CONFIG_PLL_BYPASS: Invalid value: must be 0 or 1
 #endif
 
+/* If we are using KGDB, make sure we defer exceptions */
+#ifdef CONFIG_CMD_KGDB
+# define CONFIG_EXCEPTION_DEFER	1
+#endif
+
 /* Using L1 scratch pad makes sense for everyone by default. */
 #ifndef CONFIG_LINUX_CMDLINE_ADDR
 # define CONFIG_LINUX_CMDLINE_ADDR L1_SRAM_SCRATCH
@@ -138,6 +143,8 @@
 #endif
 #ifndef CONFIG_SYS_CBSIZE
 # define CONFIG_SYS_CBSIZE 1024
+#elif defined(CONFIG_CMD_KGDB) && CONFIG_SYS_CBSIZE < 1024
+# error "kgdb needs cbsize to be >= 1024"
 #endif
 #ifndef CONFIG_SYS_BARGSIZE
 # define CONFIG_SYS_BARGSIZE CONFIG_SYS_CBSIZE
include/asm-blackfin/deferred.h new file +20 -0
new file mode 100644
index 0000000..82ceda3
@@ -0,0 +1,20 @@
+/*
+ * U-boot - deferred register layout
+ *
+ * Copyright 2004-2009 Analog Devices Inc.
+ *
+ * Licensed under the GPL-2 or later.
+ */
+
+#ifndef _BLACKFIN_DEFER_H
+#define _BLACKFIN_DEFER_H
+
+#define deferred_regs_DCPLB_FAULT_ADDR	0
+#define deferred_regs_ICPLB_FAULT_ADDR	1
+#define deferred_regs_retx		2
+#define deferred_regs_SEQSTAT		3
+#define deferred_regs_SYSCFG		4
+#define deferred_regs_IMASK		5
+#define deferred_regs_last		6
+
+#endif /* _BLACKFIN_DEFER_H */
include/asm-blackfin/entry.h +10 -0
index ef74d68..404144f 100644
@@ -86,6 +86,11 @@
 	[--sp] = RETE;
 	[--sp] = SEQSTAT;
 	[--sp] = SYSCFG;
+#ifdef CONFIG_CMD_KGDB
+	p0.l = lo(IPEND)
+	p0.h = hi(IPEND)
+	r0 = [p0];
+#endif
 	[--sp] = r0;	/* Skip IPEND as well. */
 .endm
 
@@ -137,6 +142,11 @@
 	[--sp] = RETE;
 	[--sp] = SEQSTAT;
 	[--sp] = SYSCFG;
+#ifdef CONFIG_CMD_KGDB
+	p0.l = lo(IPEND)
+	p0.h = hi(IPEND)
+	r0 = [p0];
+#endif
 	[--sp] = r0;	/* Skip IPEND as well. */
 .endm
 
include/asm-blackfin/mach-common/bits/core.h +3 -0
index d8cee10..6db4f81 100644
@@ -105,5 +105,8 @@
 #define SSSTEP			0x00000001	/* Supervisor Single Step */
 #define CCEN			0x00000002	/* Cycle Counter Enable */
 #define SNEN			0x00000004	/* Self-Nesting Interrupt Enable */
+#define SYSCFG_SSSTEP_P	0
+#define SYSCFG_CCEN_P	1
+#define SYSCFG_SCEN_P	2
 
 #endif
include/asm-blackfin/signal.h new file +1 -0
new file mode 100644
index 0000000..7b1573c
@@ -0,0 +1 @@
+#include <asm-generic/signal.h>
include/configs/bfin_adi_common.h +1 -0
index 0da7940..91c5666 100644
@@ -80,6 +80,7 @@
 # define CONFIG_CMD_CPLBINFO
 # define CONFIG_CMD_ELF
 # define CONFIG_ELF_SIMPLE_LOAD
+# define CONFIG_CMD_KGDB
 # define CONFIG_CMD_REGINFO
 # define CONFIG_CMD_STRINGS
 # if defined(__ADSPBF51x__) || defined(__ADSPBF52x__) || defined(__ADSPBF54x__)
lib_blackfin/Makefile +2 -0
index eebb131..3bdba75 100644
@@ -37,12 +37,14 @@ SOBJS-y	+= memcpy.o
 SOBJS-y	+= memmove.o
 SOBJS-y	+= memset.o
 SOBJS-y	+= outs.o
+SOBJS-$(CONFIG_CMD_KGDB) += __kgdb.o
 
 COBJS-y	+= board.o
 COBJS-y	+= boot.o
 COBJS-y	+= cache.o
 COBJS-y	+= clocks.o
 COBJS-$(CONFIG_CMD_CACHE_DUMP) += cmd_cache_dump.o
+COBJS-$(CONFIG_CMD_KGDB) += kgdb.o
 COBJS-y	+= muldi3.o
 COBJS-$(CONFIG_POST) += post.o tests.o
 COBJS-y	+= string.o
lib_blackfin/__kgdb.S new file +155 -0

155 lines not on this page · raw message

lib_blackfin/board.c +6 -0
index 90da2b4..21fff33 100644
@@ -22,6 +22,7 @@
 
 #include <asm/cplb.h>
 #include <asm/mach-common/bits/mpu.h>
+#include <kgdb.h>
 
 #ifdef CONFIG_CMD_NAND
 #include <nand.h>	/* cannot even include nand.h if it isnt configured */
@@ -356,6 +357,11 @@ void board_init_r(gd_t * id, ulong dest_addr)
 	/* Initialize the console (after the relocation and devices init) */
 	console_init_r();
 
+#ifdef CONFIG_CMD_KGDB
+	puts("KGDB:  ");
+	kgdb_init();
+#endif
+
 #ifdef CONFIG_STATUS_LED
 	status_led_set(STATUS_LED_BOOT, STATUS_LED_BLINKING);
 	status_led_set(STATUS_LED_CRASH, STATUS_LED_OFF);
lib_blackfin/kgdb.c new file +423 -0

423 lines not on this page · raw message

lib_blackfin/kgdb.h new file +160 -0

160 lines not on this page · raw message

lib_blackfin/string.c +37 -7

52 lines not on this page · raw message

Signature · 1 line
1.6.5.4
#15 lore raw

cover kgdb cleanup and Blackfin kgdb port

In reply to Mike Frysinger

Dear Mike Frysinger,

Quoted 4 lines · In message <[email protected]> you wrote:

I can take care of merging the Blackfin-specific KGDB piece through my tree since it depends on some other Blackfin patches. But all the KGDB common changes can be merged now.

Quoted 8 lines

Mike Frysinger (1):
kgdb: drop duplicate debugger_exception_handler

Robin Getz (4):
kgdb: add default generic stubs
kgdb: update mem2hex/hex2mem funcs
asm-generic/signal.h: import from linux
Blackfin: add support for kgdb

I applied patches 1 through 3; can you please run 4 and 5 through the BF tree?

Best regards,

Wolfgang Denk

Signature · 5 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Wenn das dann in die Hose geht, nehme ich es auf meine Kappe.
                                         -- Rudi V?ller, 15. Nov 2003
#16 lore raw

[U-Boot] Pull request u-boot-blackfin.git

The following changes since commit 88ffb2665cd066b6b20cfaade13929d4e8428dde:
Heiko Schocher (1):
CRAMFS: support cramfs in RAM

are available in the git repository at:

git://www.denx.de/git/u-boot-blackfin.git master

Robin Getz (2):
asm-generic/signal.h: import from linux
Blackfin: add support for kgdb

 cpu/blackfin/interrupt.S                     |  105 +++++++
 cpu/blackfin/traps.c                         |   57 ++++-
 include/asm-blackfin/config.h                |    7 +
 include/asm-blackfin/deferred.h              |   20 ++
 include/asm-blackfin/entry.h                 |   10 +
 include/asm-blackfin/mach-common/bits/core.h |    3 +
 include/asm-blackfin/signal.h                |    1 +
 include/asm-generic/signal.h                 |  101 ++++++
 include/configs/bfin_adi_common.h            |    1 +
 lib_blackfin/Makefile                        |    2 +
 lib_blackfin/__kgdb.S                        |  155 ++++++++++
 lib_blackfin/board.c                         |    6 +
 lib_blackfin/kgdb.c                          |  423 ++++++++++++++++++++++++++
 lib_blackfin/kgdb.h                          |  160 ++++++++++
 lib_blackfin/string.c                        |   44 +++-
 15 files changed, 1083 insertions(+), 12 deletions(-)
 create mode 100644 include/asm-blackfin/deferred.h
 create mode 100644 include/asm-blackfin/signal.h
 create mode 100644 include/asm-generic/signal.h
 create mode 100644 lib_blackfin/__kgdb.S
 create mode 100644 lib_blackfin/kgdb.c
 create mode 100644 lib_blackfin/kgdb.h
#17 lore raw

[U-Boot] Pull request u-boot-blackfin.git

Dear Mike Frysinger,

Quoted 11 lines · In message <[email protected]> you wrote:

The following changes since commit 88ffb2665cd066b6b20cfaade13929d4e8428dde:
Heiko Schocher (1):
CRAMFS: support cramfs in RAM

are available in the git repository at:

git://www.denx.de/git/u-boot-blackfin.git master

Robin Getz (2):
asm-generic/signal.h: import from linux
Blackfin: add support for kgdb

Applied, thanks.

Best regards,

Wolfgang Denk

Signature · 4 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
 The software required `Windows 95 or better', so I installed Linux.