📄 powerpc-lite.patch
字号:
Index: linux-2.6.16/arch/ppc/syslib/mv64x60_dbg.c===================================================================--- linux-2.6.16.orig/arch/ppc/syslib/mv64x60_dbg.c 2006-03-20 11:23:29.000000000 +0530+++ linux-2.6.16/arch/ppc/syslib/mv64x60_dbg.c 2006-04-25 11:31:05.000000000 +0530@@ -37,7 +37,7 @@ void mv64x60_progress_init(u32 base) {- mv64x60_dbg_bh.v_base = base;+ mv64x60_dbg_bh.v_base = (void*)base; return; } @@ -72,53 +72,3 @@ return; } #endif /* CONFIG_SERIAL_TEXT_DEBUG */---#if defined(CONFIG_KGDB)--#if defined(CONFIG_KGDB_TTYS0)-#define KGDB_PORT 0-#elif defined(CONFIG_KGDB_TTYS1)-#define KGDB_PORT 1-#else-#error "Invalid kgdb_tty port"-#endif--void-putDebugChar(unsigned char c)-{- mv64x60_polled_putc(KGDB_PORT, (char)c);-}--int-getDebugChar(void)-{- unsigned char c;-- while (!mv64x60_polled_getc(KGDB_PORT, &c));- return (int)c;-}--void-putDebugString(char* str)-{- while (*str != '\0') {- putDebugChar(*str);- str++;- }- putDebugChar('\r');- return;-}--void-kgdb_interruptible(int enable)-{-}--void-kgdb_map_scc(void)-{- if (ppc_md.early_serial_map)- ppc_md.early_serial_map();-}-#endif /* CONFIG_KGDB */Index: linux-2.6.16/arch/ppc/syslib/ppc85xx_setup.c===================================================================--- linux-2.6.16.orig/arch/ppc/syslib/ppc85xx_setup.c 2006-03-20 11:23:29.000000000 +0530+++ linux-2.6.16/arch/ppc/syslib/ppc85xx_setup.c 2006-04-25 11:31:05.000000000 +0530@@ -72,7 +72,6 @@ mtspr(SPRN_TCR, TCR_DIE); } -#ifdef CONFIG_SERIAL_8250 void __init mpc85xx_early_serial_map(void) {@@ -88,7 +87,7 @@ pdata[0].mapbase += binfo->bi_immr_base; pdata[0].membase = ioremap(pdata[0].mapbase, MPC85xx_UART0_SIZE); -#if defined(CONFIG_SERIAL_TEXT_DEBUG) || defined(CONFIG_KGDB)+#if defined(CONFIG_SERIAL_TEXT_DEBUG) || defined(CONFIG_KGDB_8250) memset(&serial_req, 0, sizeof (serial_req)); serial_req.iotype = UPIO_MEM; serial_req.mapbase = pdata[0].mapbase;@@ -96,18 +95,24 @@ serial_req.regshift = 0; gen550_init(0, &serial_req);+#ifdef CONFIG_KGDB_8250+ kgdb8250_add_port(0, &serial_req);+#endif #endif pdata[1].uartclk = binfo->bi_busfreq; pdata[1].mapbase += binfo->bi_immr_base; pdata[1].membase = ioremap(pdata[1].mapbase, MPC85xx_UART0_SIZE); -#if defined(CONFIG_SERIAL_TEXT_DEBUG) || defined(CONFIG_KGDB)+#if defined(CONFIG_SERIAL_TEXT_DEBUG) || defined(CONFIG_KGDB_8250) /* Assume gen550_init() doesn't modify serial_req */ serial_req.mapbase = pdata[1].mapbase; serial_req.membase = pdata[1].membase; gen550_init(1, &serial_req);+#ifdef CONFIG_KGDB_8250+ kgdb8250_add_port(1, &serial_req);+#endif #endif } #endif@@ -366,5 +371,3 @@ return; } #endif /* CONFIG_PCI */--Index: linux-2.6.16/arch/ppc/syslib/mv64x60.c===================================================================--- linux-2.6.16.orig/arch/ppc/syslib/mv64x60.c 2006-03-20 11:23:29.000000000 +0530+++ linux-2.6.16/arch/ppc/syslib/mv64x60.c 2006-04-25 11:31:05.000000000 +0530@@ -243,6 +243,12 @@ .end = MV64x60_IRQ_SDMA_0, .flags = IORESOURCE_IRQ, },+ [4] = {+ .name = "mpsc 0 irq",+ .start = MV64x60_IRQ_MPSC_0,+ .end = MV64x60_IRQ_MPSC_0,+ .flags = IORESOURCE_IRQ,+ }, }; static struct platform_device mpsc0_device = {@@ -300,6 +306,12 @@ .end = MV64360_IRQ_SDMA_1, .flags = IORESOURCE_IRQ, },+ [4] = {+ .name = "mpsc 1 irq",+ .start = MV64360_IRQ_MPSC_1,+ .end = MV64360_IRQ_MPSC_1,+ .flags = IORESOURCE_IRQ,+ }, }; static struct platform_device mpsc1_device = {@@ -1428,12 +1440,46 @@ static int __init mv64x60_add_pds(void) {- return platform_add_devices(mv64x60_pd_devs,- ARRAY_SIZE(mv64x60_pd_devs));+ int i, ret = 0;++ for (i = 0; i < ARRAY_SIZE(mv64x60_pd_devs); i++) {+ if (mv64x60_pd_devs[i]) {+ ret = platform_device_register(mv64x60_pd_devs[i]);+ }+ if (ret) {+ while (--i >= 0)+ platform_device_unregister(mv64x60_pd_devs[i]);+ break;+ }+ }+ return ret; } arch_initcall(mv64x60_add_pds); /*+ * mv64x60_early_get_pdev_data()+ *+ * Get the data associated with a platform device by name and number.+ */+struct platform_device * __init+mv64x60_early_get_pdev_data(const char *name, int id, int remove)+{+ int i;+ struct platform_device *pdev;++ for (i = 0; i <ARRAY_SIZE(mv64x60_pd_devs); i++) {+ if ((pdev = mv64x60_pd_devs[i]) &&+ pdev->id == id &&+ !strcmp(pdev->name, name)) {+ if (remove)+ mv64x60_pd_devs[i] = NULL;+ return pdev;+ }+ }+ return NULL;+}++/* ***************************************************************************** * * GT64260-Specific Routines@@ -1766,6 +1812,11 @@ r->start = MV64x60_IRQ_SDMA_0; r->end = MV64x60_IRQ_SDMA_0; }+ if ((r = platform_get_resource(&mpsc1_device, IORESOURCE_IRQ, 1))+ != NULL) {+ r->start = GT64260_IRQ_MPSC_1;+ r->end = GT64260_IRQ_MPSC_1;+ } #endif } Index: linux-2.6.16/arch/ppc/syslib/gen550_kgdb.c===================================================================--- linux-2.6.16.orig/arch/ppc/syslib/gen550_kgdb.c 2006-03-20 11:23:29.000000000 +0530+++ linux-2.6.16/arch/ppc/syslib/gen550_kgdb.c 2006-04-25 10:59:23.506518750 +0530@@ -1,86 +0,0 @@-/*- * arch/ppc/syslib/gen550_kgdb.c- *- * Generic 16550 kgdb support intended to be useful on a variety- * of platforms. To enable this support, it is necessary to set- * the CONFIG_GEN550 option. Any virtual mapping of the serial- * port(s) to be used can be accomplished by setting- * ppc_md.early_serial_map to a platform-specific mapping function.- *- * Adapted from ppc4xx_kgdb.c.- *- * Author: Matt Porter <mporter@kernel.crashing.org>- *- * 2002-2004 (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/config.h>-#include <linux/types.h>-#include <linux/kernel.h>--#include <asm/machdep.h>--extern unsigned long serial_init(int, void *);-extern unsigned long serial_getc(unsigned long);-extern unsigned long serial_putc(unsigned long, unsigned char);--#if defined(CONFIG_KGDB_TTYS0)-#define KGDB_PORT 0-#elif defined(CONFIG_KGDB_TTYS1)-#define KGDB_PORT 1-#elif defined(CONFIG_KGDB_TTYS2)-#define KGDB_PORT 2-#elif defined(CONFIG_KGDB_TTYS3)-#define KGDB_PORT 3-#else-#error "invalid kgdb_tty port"-#endif--static volatile unsigned int kgdb_debugport;--void putDebugChar(unsigned char c)-{- if (kgdb_debugport == 0)- kgdb_debugport = serial_init(KGDB_PORT, NULL);-- serial_putc(kgdb_debugport, c);-}--int getDebugChar(void)-{- if (kgdb_debugport == 0)- kgdb_debugport = serial_init(KGDB_PORT, NULL);-- return(serial_getc(kgdb_debugport));-}--void kgdb_interruptible(int enable)-{- return;-}--void putDebugString(char* str)-{- while (*str != '\0') {- putDebugChar(*str);- str++;- }- putDebugChar('\r');- return;-}--/*- * Note: gen550_init() must be called already on the port we are going- * to use.- */-void-gen550_kgdb_map_scc(void)-{- printk(KERN_DEBUG "kgdb init\n");- if (ppc_md.early_serial_map)- ppc_md.early_serial_map();- kgdb_debugport = serial_init(KGDB_PORT, NULL);-}Index: linux-2.6.16/arch/ppc/syslib/Makefile===================================================================--- linux-2.6.16.orig/arch/ppc/syslib/Makefile 2006-03-20 11:23:29.000000000 +0530+++ linux-2.6.16/arch/ppc/syslib/Makefile 2006-04-25 11:31:05.000000000 +0530@@ -78,7 +78,6 @@ obj-$(CONFIG_8260_PCI9) += m8260_pci_erratum9.o obj-$(CONFIG_CPM2) += cpm2_common.o cpm2_pic.o ifeq ($(CONFIG_PPC_GEN550),y)-obj-$(CONFIG_KGDB) += gen550_kgdb.o gen550_dbg.o obj-$(CONFIG_SERIAL_TEXT_DEBUG) += gen550_dbg.o endif ifeq ($(CONFIG_SERIAL_MPSC_CONSOLE),y)Index: linux-2.6.16/arch/ppc/syslib/gen550.h===================================================================--- linux-2.6.16.orig/arch/ppc/syslib/gen550.h 2006-03-20 11:23:29.000000000 +0530+++ linux-2.6.16/arch/ppc/syslib/gen550.h 2006-04-25 11:31:05.000000000 +0530@@ -13,4 +13,3 @@ extern void gen550_progress(char *, unsigned short); extern void gen550_init(int, struct uart_port *);-extern void gen550_kgdb_map_scc(void);Index: linux-2.6.16/arch/ppc/syslib/ibm44x_common.c===================================================================--- linux-2.6.16.orig/arch/ppc/syslib/ibm44x_common.c 2006-03-20 11:23:29.000000000 +0530+++ linux-2.6.16/arch/ppc/syslib/ibm44x_common.c 2006-04-25 11:31:05.000000000 +0530@@ -195,9 +195,6 @@ #ifdef CONFIG_SERIAL_TEXT_DEBUG ppc_md.progress = gen550_progress; #endif /* CONFIG_SERIAL_TEXT_DEBUG */-#ifdef CONFIG_KGDB- ppc_md.kgdb_map_scc = gen550_kgdb_map_scc;-#endif /* * The Abatron BDI JTAG debugger does not tolerate othersIndex: linux-2.6.16/arch/ppc/mm/fault.c===================================================================--- linux-2.6.16.orig/arch/ppc/mm/fault.c 2006-03-20 11:23:29.000000000 +0530+++ linux-2.6.16/arch/ppc/mm/fault.c 2006-04-25 11:31:05.000000000 +0530@@ -28,6 +28,7 @@ #include <linux/interrupt.h> #include <linux/highmem.h> #include <linux/module.h>+#include <linux/kgdb.h> #include <asm/page.h> #include <asm/pgtable.h>@@ -328,6 +329,14 @@ return; } +#ifdef CONFIG_KGDB+ if (atomic_read(&debugger_active) && kgdb_may_fault) {+ /* Restore our previous state. */+ kgdb_fault_longjmp(kgdb_fault_jmp_regs);+ /* Not reached. */+ }+#endif+ /* kernel has accessed a bad area */ #if defined(CONFIG_XMON) || defined(CONFIG_KGDB) if (debugger_kernel_faults)Index: linux-2.6.16/arch/ppc/kernel/kgdb.c===================================================================--- linux-2.6.16.orig/arch/ppc/kernel/kgdb.c 2006-04-25 10:59:23.506518750 +0530+++ linux-2.6.16/arch/ppc/kernel/kgdb.c 2006-04-25 11:31:05.000000000 +0530@@ -0,0 +1,329 @@+/*+ * arch/ppc/kernel/kgdb.c+ *+ * PowerPC backend to the KGDB stub.+ *+ * Maintainer: Tom Rini <trini@kernel.crashing.org>+ *+ * 1998 (c) Michael AK Tesch (tesch@cs.wisc.edu)+ * Copyright (C) 2003 Timesys Corporation.+ * 2004 (c) MontaVista Software, Inc.+ *+ * This file is licensed under the terms of the GNU General Public License+ * version 2. This program as licensed "as is" without any warranty of any+ * kind, whether express or implied.+ */++#include <linux/config.h>+#include <linux/kernel.h>+#include <linux/init.h>+#include <linux/kgdb.h>+#include <linux/smp.h>+#include <linux/signal.h>+#include <linux/ptrace.h>+#include <asm/current.h>+#include <asm/ptrace.h>+#include <asm/processor.h>+#include <asm/machdep.h>++/*+ * This table contains the mapping between PowerPC hardware trap types, and+ * signals, which are primarily what GDB understands. GDB and the kernel+ * don't always agree on values, so we use constants taken from gdb-6.2.+ */+static struct hard_trap_info+{+ unsigned int tt; /* Trap type code for powerpc */+ unsigned char signo; /* Signal that we map this trap into */+} hard_trap_info[] = {+#if defined(CONFIG_40x) || defined(CONFIG_BOOKE)+ { 0x0100, 0x02 /* SIGINT */ }, /* critical input interrupt */+ { 0x0200, 0x0b /* SIGSEGV */ }, /* machine check */+ { 0x0300, 0x0b /* SIGSEGV */ }, /* data storage */+ { 0x0400, 0x0a /* SIGBUS */ }, /* instruction storage */+ { 0x0500, 0x02 /* SIGINT */ }, /* interrupt */+ { 0x0600, 0x0a /* SIGBUS */ }, /* alignment */+ { 0x0700, 0x04 /* SIGILL */ }, /* program */+ { 0x0800, 0x04 /* SIGILL */ }, /* reserved */+ { 0x0900, 0x04 /* SIGILL */ }, /* reserved */+ { 0x0a00, 0x04 /* SIGILL */ }, /* reserved */+ { 0x0b00, 0x04 /* SIGILL */ }, /* reserved */+ { 0x0c00, 0x14 /* SIGCHLD */ }, /* syscall */+ { 0x0d00, 0x04 /* SIGILL */ }, /* reserved */+ { 0x0e00, 0x04 /* SIGILL */ }, /* reserved */+ { 0x0f00, 0x04 /* SIGILL */ }, /* reserved */+ { 0x2002, 0x05 /* SIGTRAP */}, /* debug */+#else+ { 0x0200, 0x0b /* SIGSEGV */ }, /* machine check */+ { 0x0300, 0x0b /* SIGSEGV */ }, /* address error (store) */+ { 0x0400, 0x0a /* SIGBUS */ }, /* instruction bus error */+ { 0x0500, 0x02 /* SIGINT */ }, /* interrupt */+ { 0x0600, 0x0a /* SIGBUS */ }, /* alingment */+ { 0x0700, 0x05 /* SIGTRAP */ }, /* breakpoint trap */+ { 0x0800, 0x08 /* SIGFPE */}, /* fpu unavail */+ { 0x0900, 0x0e /* SIGALRM */ }, /* decrementer */+ { 0x0a00, 0x04 /* SIGILL */ }, /* reserved */+ { 0x0b00, 0x04 /* SIGILL */ }, /* reserved */+ { 0x0c00, 0x14 /* SIGCHLD */ }, /* syscall */+ { 0x0d00, 0x05 /* SIGTRAP */ }, /* single-step/watch */+ { 0x0e00, 0x08 /* SIGFPE */ }, /* fp assist */+#endif+ { 0x0000, 0x000 } /* Must be last */+};++extern atomic_t cpu_doing_single_step;++static int computeSignal(unsigned int tt)+{+ struct hard_trap_info *ht;++ for (ht = hard_trap_info; ht->tt && ht->signo; ht++)+ if (ht->tt == tt)+ return ht->signo;++ return SIGHUP; /* default for things we don't know about */+}++/* KGDB functions to use existing PowerPC hooks. */+static void kgdb_debugger(struct pt_regs *regs)+{+ kgdb_handle_exception(0, computeSignal(TRAP(regs)), 0, regs);+}++static int kgdb_breakpoint(struct pt_regs *regs)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -