kgdb for mainline kernel: 8250 [patch 3/3]
-Amit
drivers/serial/8250.c +39 -0
@@ -1198,12 +1198,17 @@spin_unlock_irqrestore (&up->port.lock, flags); } +static int released_irq =-1 ; +static int serial8250_startup (struct uart_port *port) {struct uart_8250_port *up = (struct uart_8250_port *)port;unsigned long flags;int retval; +if (up->port.irq == released_irq) +return -EBUSY ; + up->capabilities = uart_config[up->port.type].flags;if (up->port.type ==PORT_16C950 ) {
@@ -1869,6 +1874,10 @@for (i =0 ; i <UART_NR ; i++) {struct uart_8250_port *up = &serial8250_ports[i]; +if (up->port.irq == released_irq) { +continue ; + } + up->port.line = i; up->port.ops = &serial8250_pops;init_timer (&up->timer);
@@ -2138,6 +2147,36 @@uart_resume_port (&serial8250_reg, &serial8250_ports[line].port); } +/* +* Find all the ports using the given irq and shut them down. +* Result should be that the irq will be released. +* At most one irq can be released this way. +* Once an irq is released, any attempts to initialize a port with that irq +* will fail with EBUSY. +*/ + +int serial8250_release_irq (int irq) +{ +struct uart_8250_port *up; +int ttyS; + +if (released_irq !=-1 ) { +return -EBUSY ; + } + released_irq = irq; +for (ttyS =0 ; ttyS <UART_NR ; ttyS++){ + up = &serial8250_ports[ttyS]; +if (up->port.irq == irq && (irq_lists + irq)->head) { +#ifdef CONFIG_DEBUG_SPINLOCK /* ugly business... */ +if (up->port.lock.magic !=SPINLOCK_MAGIC ) +spin_lock_init (&up->port.lock); +#endif +serial8250_shutdown (&up->port); + } + } +return 0 ; +} +static int __init serial8250_init (void ) {int ret, i;
drivers/serial/Makefile +2 -0
@@ -32,3 +32,5 @@ obj-$(CONFIG_V850E_UART) += v850e_uart.o obj-$(CONFIG_SERIAL98) += serial98.o obj-$(CONFIG_SERIAL_PMACZILOG) += pmac_zilog.o + +obj-$(CONFIG_KGDB_8250) += kgdb_8250.o
drivers/serial/kgdb_8250.c +434 -0
434 lines not on this page · raw message
drivers/serial/serial_core.c +5 -1
@@ -917,7 +917,11 @@static void uart_break_ctl (struct tty_struct *tty,int break_state) {struct uart_state *state = tty->driver_data; -struct uart_port *port = state->port; +struct uart_port *port; + +if (!state) +return ; + port = state->port;BUG_ON (!kernel_locked ());
kernel/Kconfig.kgdb +101 -0
104 lines not on this page · raw message