[Kgdb-bugreport] 8250 Update
Status: Beta
Brought to you by:
jwessel
From: Tom R. <tr...@ke...> - 2005-01-20 23:02:31
|
There is a problem, which is hit when we set mapbase and wish to connect early. In this case, we end up trying to kmalloc() prior to the mm subsystem being ready, and crash. This has only been tested on platforms where it's not normally hit. Can someone please test this on ARM or PPC 85xx ? Thanks. --- linux-2.6.10-rc3/drivers/serial/kgdb_8250.c +++ linux-2.6.10/drivers/serial/kgdb_8250.c @@ -51,6 +51,9 @@ static int kgdb8250_ttyS = 0; /* Start with this if not given */ #endif +/* Flag for if we need to call request_mem_region */ +static int kgdb8250_needs_request_mem_region; + static char kgdb8250_buf[GDB_BUF_SIZE]; static atomic_t kgdb8250_buf_in_cnt; static int kgdb8250_buf_out_inx; @@ -96,8 +99,6 @@ static int kgdb8250_init(void); extern int serial8250_release_irq(int irq); -extern atomic_t debugger_active; - static unsigned long direct_inb(unsigned long addr) { @@ -362,12 +363,8 @@ switch (CURRENTPORT.iotype) { case UPIO_MEM: - if (CURRENTPORT.mapbase) { - if (!request_mem_region(CURRENTPORT.mapbase, - 8 << KGDB8250_REG_SHIFT, - "kgdb")) - return 1; /* Failed. */ - } + if (CURRENTPORT.mapbase) + kgdb8250_needs_request_mem_region = 1; if (CURRENTPORT.flags & UPF_IOREMAP) { CURRENTPORT.membase = ioremap(CURRENTPORT.mapbase, 8 << KGDB8250_REG_SHIFT); @@ -411,6 +408,10 @@ */ static void __init kgdb8250_hookup_irq(void) { + /* We may need to call request_mem_region() first. */ + if (kgdb8250_needs_request_mem_region) + request_mem_region(CURRENTPORT.mapbase, + 8 << KGDB8250_REG_SHIFT, "kgdb"); request_irq(KGDB8250_IRQ, kgdb8250_interrupt, SA_SHIRQ, "GDB-stub", &CURRENTPORT); } -- Tom Rini http://gate.crashing.org/~trini/ |