⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 powerpc-lite.patch

📁 Linux-2.6.18内核调试工具补丁程序KGDB。
💻 PATCH
📖 第 1 页 / 共 5 页
字号:
This adds basic KGDB support for both arch/ppc and arch/powerpc.  On thearch/ppc side, most platforms work.  A number of people worked onvarious parts of this code (Scott Hall, Frank Rowand, Takeharu KATO,Geoff Levand, Vitaly Bordug) in addition to myself.  The arch/powerpccode doesn't work yet, but is the old ppc64 version from Frank Rowand.Signed-off-by: Vitaly Bordug <vbordug@ru.mvista.com>Signed-off-by: Tom Rini <trini@kernel.crashing.org> arch/powerpc/Kconfig.debug              |   50 - arch/powerpc/kernel/Makefile            |    1 arch/powerpc/kernel/kgdb.c              |  423 +++++++++++++++ arch/powerpc/kernel/setup_32.c          |   16 arch/powerpc/mm/fault.c                 |    8 arch/powerpc/platforms/powermac/setup.c |    4 arch/ppc/Kconfig.debug                  |   36 - arch/ppc/kernel/kgdb.c                  |  329 ++++++++++++ arch/ppc/kernel/ppc-stub.c              |  867 -------------------------------- arch/ppc/kernel/setup.c                 |   16 arch/ppc/mm/fault.c                     |    9 arch/ppc/platforms/4xx/bubinga.c        |   23 arch/ppc/platforms/4xx/ebony.c          |   27 arch/ppc/platforms/4xx/ocotea.c         |   26 arch/ppc/platforms/4xx/xilinx_ml300.c   |   18 arch/ppc/platforms/85xx/sbc8560.c       |   32 - arch/ppc/platforms/chestnut.c           |    5 arch/ppc/platforms/pplus.c              |    3 arch/ppc/platforms/sandpoint.c          |    3 arch/ppc/platforms/spruce.c             |   21 arch/ppc/syslib/Makefile                |    1 arch/ppc/syslib/gen550.h                |    1 arch/ppc/syslib/gen550_kgdb.c           |   86 --- arch/ppc/syslib/ibm44x_common.c         |    3 arch/ppc/syslib/mv64x60.c               |   55 +- arch/ppc/syslib/mv64x60_dbg.c           |   52 - arch/ppc/syslib/ppc85xx_setup.c         |   13 drivers/serial/Makefile                 |    1 drivers/serial/cpm_uart/Makefile        |    1 drivers/serial/cpm_uart/cpm_uart.h      |   51 + drivers/serial/cpm_uart/cpm_uart_core.c |  118 ++-- drivers/serial/cpm_uart/cpm_uart_cpm1.c |   28 + drivers/serial/cpm_uart/cpm_uart_cpm2.c |    4 drivers/serial/cpm_uart/cpm_uart_kgdb.c |  195 +++++++ drivers/serial/mpsc.h                   |    4 drivers/serial/mpsc_kgdb.c              |  299 +++++++++++ include/asm-powerpc/kgdb.h              |   73 ++ include/asm-ppc/kgdb.h                  |   59 -- include/asm-ppc/machdep.h               |    2 include/asm-ppc/mv64x60.h               |    2 include/asm-ppc/mv64x60_defs.h          |    3 lib/Kconfig.debug                       |   18 42 files changed, 1677 insertions(+), 1309 deletions(-)Index: linux-2.6.16/drivers/serial/cpm_uart/cpm_uart_core.c===================================================================--- linux-2.6.16.orig/drivers/serial/cpm_uart/cpm_uart_core.c	2006-03-20 11:23:29.000000000 +0530+++ linux-2.6.16/drivers/serial/cpm_uart/cpm_uart_core.c	2006-04-25 11:31:05.000000000 +0530@@ -71,20 +71,6 @@  /**************************************************************/ -static inline unsigned long cpu2cpm_addr(void *addr)-{-	if ((unsigned long)addr >= CPM_ADDR)-		return (unsigned long)addr;-	return virt_to_bus(addr);-}--static inline void *cpm2cpu_addr(unsigned long addr)-{-	if (addr >= CPM_ADDR)-		return (void *)addr;-	return bus_to_virt(addr);-}- /*  * Check, if transmit buffers are processed */@@ -988,22 +974,17 @@ 	}, }; -#ifdef CONFIG_SERIAL_CPM_CONSOLE-/*- *	Print a string to the serial port trying not to disturb- *	any possible real use of the port...- *- *	Note that this is called with interrupts already disabled- */-static void cpm_uart_console_write(struct console *co, const char *s,+void cpm_uart_early_write(int index, const char *s, 				   u_int count) {-	struct uart_cpm_port *pinfo =-	    &cpm_uart_ports[cpm_uart_port_map[co->index]];+	struct uart_cpm_port *pinfo; 	unsigned int i; 	volatile cbd_t *bdp, *bdbase; 	volatile unsigned char *cp; +	BUG_ON(index>UART_NR);+	pinfo = &cpm_uart_ports[index];+ 	/* Get the address of the host memory buffer. 	 */ 	bdp = pinfo->tx_cur;@@ -1067,36 +1048,16 @@ 	pinfo->tx_cur = (volatile cbd_t *) bdp; } -/*- * Setup console. Be careful is called early !- */-static int __init cpm_uart_console_setup(struct console *co, char *options)+int cpm_uart_early_setup(int index, int early) {+	int ret; 	struct uart_port *port; 	struct uart_cpm_port *pinfo;-	int baud = 38400;-	int bits = 8;-	int parity = 'n';-	int flow = 'n';-	int ret; +	BUG_ON(index>UART_NR); 	port =-	    (struct uart_port *)&cpm_uart_ports[cpm_uart_port_map[co->index]];+	    (struct uart_port *)&cpm_uart_ports[index]; 	pinfo = (struct uart_cpm_port *)port;--	pinfo->flags |= FLAG_CONSOLE;--	if (options) {-		uart_parse_options(options, &baud, &parity, &bits, &flow);-	} else {-		bd_t *bd = (bd_t *) __res;--		if (bd->bi_baudrate)-			baud = bd->bi_baudrate;-		else-			baud = 9600;-	}- 	/* 	 * Setup any port IO, connect any baud rate generators, 	 * etc.  This is expected to be handled by board@@ -1104,7 +1065,6 @@ 	 */ 	if (pinfo->set_lineif) 		pinfo->set_lineif(pinfo);- 	if (IS_SMC(pinfo)) { 		pinfo->smcp->smc_smcm &= ~(SMCM_RX | SMCM_TX); 		pinfo->smcp->smc_smcmr &= ~(SMCMR_REN | SMCMR_TEN);@@ -1112,8 +1072,7 @@ 		pinfo->sccp->scc_sccm &= ~(UART_SCCM_TX | UART_SCCM_RX); 		pinfo->sccp->scc_gsmrl &= ~(SCC_GSMRL_ENR | SCC_GSMRL_ENT); 	}--	ret = cpm_uart_allocbuf(pinfo, 1);+	ret = cpm_uart_allocbuf(pinfo, early);  	if (ret) 		return ret;@@ -1125,6 +1084,56 @@ 	else 		cpm_uart_init_scc(pinfo); +	return 0;+}++#ifdef CONFIG_SERIAL_CPM_CONSOLE+/*+ *	Print a string to the serial port trying not to disturb+ *	any possible real use of the port...+ *+ *	Note that this is called with interrupts already disabled+ */++static void cpm_uart_console_write(struct console *co, const char *s,+				   u_int count)+{+	cpm_uart_early_write(cpm_uart_port_map[co->index],s,count);+}++/*+ * Setup console. Be careful is called early !+ */+static int __init cpm_uart_console_setup(struct console *co, char *options)+{+	struct uart_port *port;+	struct uart_cpm_port *pinfo;+	int baud = 115200;+	int bits = 8;+	int parity = 'n';+	int flow = 'n';+	int ret;++	port =+	    (struct uart_port *)&cpm_uart_ports[cpm_uart_port_map[co->index]];+	pinfo = (struct uart_cpm_port *)port;++	pinfo->flags |= FLAG_CONSOLE;++	if (options) {+		uart_parse_options(options, &baud, &parity, &bits, &flow);+	} else {+		bd_t *bd = (bd_t *) __res;++		if (bd->bi_baudrate)+			baud = bd->bi_baudrate;+		else+			baud = 9600;+	}++	ret = cpm_uart_early_setup(cpm_uart_port_map[co->index], 1);+	if(ret)+		return ret; 	uart_set_options(port, co, baud, parity, bits, flow);  	return 0;@@ -1186,6 +1195,13 @@  	for (i = 0; i < cpm_uart_nr; i++) { 		int con = cpm_uart_port_map[i];++#ifdef CONFIG_KGDB_CPM_UART+		/* We are not interested in ports yet utilized by kgdb */+		if(con == KGDB_PINFO_INDEX)+			continue;+#endif+ 		cpm_uart_ports[con].port.line = i; 		cpm_uart_ports[con].port.flags = UPF_BOOT_AUTOCONF; 		uart_add_one_port(&cpm_reg, &cpm_uart_ports[con].port);Index: linux-2.6.16/drivers/serial/cpm_uart/cpm_uart_kgdb.c===================================================================--- linux-2.6.16.orig/drivers/serial/cpm_uart/cpm_uart_kgdb.c	2006-04-25 10:59:23.506518750 +0530+++ linux-2.6.16/drivers/serial/cpm_uart/cpm_uart_kgdb.c	2006-04-25 11:31:05.000000000 +0530@@ -0,0 +1,195 @@+/*+ * drivers/serial/cpm_uart/cpm_uart_kgdb.c+ *+ * CPM UART interface for kgdb.+ *+ * Author: Vitaly Bordug <vbordug@ru.mvista.com>+ *+ * Used some bits from drivers/serial/kgdb_8250.c as a template+ *+ * 2005 (c) MontaVista Software, Inc. This file is licensed under+ * the terms of the GNU General Public License version 2. This program+ * is licensed "as is" without any warranty of any kind, whether express+ * or implied.+ */++#include <linux/kgdb.h>+#include <linux/config.h>+#include <linux/kernel.h>+#include <linux/init.h>+#include <linux/interrupt.h>+#include <linux/tty.h>+#include <linux/serial.h>+#include <linux/serial_core.h>+#include <linux/serial_reg.h>++#include <asm/io.h>+#include <asm/serial.h>		/* For BASE_BAUD and SERIAL_PORT_DFNS */++#include "cpm_uart.h"++#define GDB_BUF_SIZE	512	/* power of 2, please */+++static char kgdb_buf[GDB_BUF_SIZE], *kgdbp;+static int kgdb_chars;++/* Forward declarations. */++/*+ * Receive character from the serial port.  This only works well+ * before the port is initialize for real use.+ */+static int kgdb_wait_key(char *obuf)+{+	struct uart_cpm_port *pinfo;++	u_char				c, *cp;+	volatile	cbd_t		*bdp;+	int				i;++	pinfo = &cpm_uart_ports[KGDB_PINFO_INDEX];++	/* Get the address of the host memory buffer.+	 */+	bdp = pinfo->rx_cur;+	while (bdp->cbd_sc & BD_SC_EMPTY);++	/* If the buffer address is in the CPM DPRAM, don't+	 * convert it.+	 */+	cp = cpm2cpu_addr(bdp->cbd_bufaddr);++	if (obuf) {+		i = c = bdp->cbd_datlen;+		while (i-- > 0)+		{+			*obuf++ = *cp++;+		}+	} else {+		c = *cp;+	}+	bdp->cbd_sc |= BD_SC_EMPTY;++	if (bdp->cbd_sc & BD_SC_WRAP) {+		bdp = pinfo->rx_bd_base;+	} else {+		bdp++;+	}+	pinfo->rx_cur = (cbd_t *)bdp;++	return((int)c);+}+++/*+ * Wait until the interface can accept a char, then write it.+ */+static void+kgdb_put_debug_char(int chr)+{+	static char ch[2];+	ch[0]=(char)chr;+	cpm_uart_early_write(KGDB_PINFO_INDEX, ch, 1);+}+++/*+ * Get a char if available, return -1 if nothing available.+ * Empty the receive buffer first, then look at the interface hardware.+ */+static int+kgdb_get_debug_char(void)+{+	if (kgdb_chars<=0) {+		kgdb_chars = kgdb_wait_key(kgdb_buf);+		kgdbp = kgdb_buf;+	}+	kgdb_chars--;++	return (*kgdbp++);+}++static void termios_set_options(int index,+		 int baud, int parity, int bits, int flow)+{+	struct termios termios;+	struct uart_port *port;+	struct uart_cpm_port *pinfo;++	BUG_ON(index>UART_NR);++	port =+	    (struct uart_port *)&cpm_uart_ports[index];+	pinfo = (struct uart_cpm_port *)port;++	/*+	 * Ensure that the serial console lock is initialised+	 * early.+	 */+	spin_lock_init(&port->lock);++	memset(&termios, 0, sizeof(struct termios));++	termios.c_cflag = CREAD | HUPCL | CLOCAL;++	termios.c_cflag |= baud;++	if (bits == 7)+		termios.c_cflag |= CS7;+	else+		termios.c_cflag |= CS8;++	switch (parity) {+	case 'o': case 'O':+		termios.c_cflag |= PARODD;+		/*fall through*/+	case 'e': case 'E':+		termios.c_cflag |= PARENB;+		break;+	}++	if (flow == 'r')+		termios.c_cflag |= CRTSCTS;++	port->ops->set_termios(port, &termios, NULL);+}++/*+ *  Returns:+ *	0 on success, 1 on failure.+ */+static int kgdb_init(void)+{+	struct uart_port *port;+	struct uart_cpm_port *pinfo;++	int use_bootmem = 0; /* use dma by default */++	if(!cpm_uart_nr)+	{+		use_bootmem = 1;+		cpm_uart_init_portdesc();+	}+	port = (struct uart_port *)&cpm_uart_ports[KGDB_PINFO_INDEX];+	pinfo = (struct uart_cpm_port *)port;++	if (cpm_uart_early_setup(KGDB_PINFO_INDEX, use_bootmem))+		return 1;++	termios_set_options(KGDB_PINFO_INDEX, KGDB_BAUD,'n',8,'n');+        if (IS_SMC(pinfo))+                pinfo->smcp->smc_smcm |= SMCM_TX;+        else+                pinfo->sccp->scc_sccm |= UART_SCCM_TX;++	return 0;+}+++struct kgdb_io kgdb_io_ops = {+	.read_char = kgdb_get_debug_char,+	.write_char = kgdb_put_debug_char,+	.init = kgdb_init,+};+Index: linux-2.6.16/drivers/serial/cpm_uart/Makefile===================================================================--- linux-2.6.16.orig/drivers/serial/cpm_uart/Makefile	2006-03-20 11:23:29.000000000 +0530+++ linux-2.6.16/drivers/serial/cpm_uart/Makefile	2006-04-25 11:31:05.000000000 +0530@@ -7,5 +7,6 @@ # Select the correct platform objects. cpm_uart-objs-$(CONFIG_CPM2)	+= cpm_uart_cpm2.o cpm_uart-objs-$(CONFIG_8xx)	+= cpm_uart_cpm1.o+cpm_uart-objs-$(CONFIG_KGDB_CPM_UART)	+= cpm_uart_kgdb.o  cpm_uart-objs	:= cpm_uart_core.o $(cpm_uart-objs-y)Index: linux-2.6.16/drivers/serial/cpm_uart/cpm_uart_cpm1.c===================================================================--- linux-2.6.16.orig/drivers/serial/cpm_uart/cpm_uart_cpm1.c	2006-03-20 11:23:29.000000000 +0530+++ linux-2.6.16/drivers/serial/cpm_uart/cpm_uart_cpm1.c	2006-04-25 11:31:05.000000000 +0530@@ -82,6 +82,7 @@ void smc1_lineif(struct uart_cpm_port *pinfo) { 	volatile cpm8xx_t *cp = cpmp;+	unsigned *bcsr_io;  	(void)cp;	/* fix warning */ #if defined (CONFIG_MPC885ADS)@@ -106,11 +107,23 @@ 	} #endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -