* [PATCH] [kgdb] Start kgdboc uart port to answer gdb break signal Ctrl+C without openning ttys.
@ 2008-09-17 8:28 sonic zhang
[not found] ` <4e5ebad50809190251p53b9e586x7f78dbc8f1c1b867@mail.gmail.com>
0 siblings, 1 reply; 2+ messages in thread
From: sonic zhang @ 2008-09-17 8:28 UTC (permalink / raw)
To: Jason Wessel; +Cc: Alan Cox, Linux Kernel, kgdb mailing list
Current kgdboc only configures the uart port in poll mode, which block
any gdb break signal Ctrl+C from taking effect till a tty on the port is
opened by an application. This patch introduces 2 hook functions in
struct tty_operations and uart_operations. The kgdboc port can be start
up without openning ttys after gdb is connected.
Signed-off-by: Sonic Zhang <sonic.adi@gmail.com>
---
drivers/serial/kgdboc.c | 8 +++++++-
drivers/serial/serial_core.c | 38 ++++++++++++++++++++++++++++++++++++++
include/linux/serial_core.h | 9 +++++++++
include/linux/tty_driver.h | 5 +++++
4 files changed, 59 insertions(+), 1 deletions(-)
diff --git a/drivers/serial/kgdboc.c b/drivers/serial/kgdboc.c
index eadc1ab..5d91f3d 100644
--- a/drivers/serial/kgdboc.c
+++ b/drivers/serial/kgdboc.c
@@ -70,6 +70,9 @@ static int configure_kgdboc(void)
configured = 1;
+ kgdb_tty_driver->ops->kgdboc_port_startup(kgdb_tty_driver,
+ kgdb_tty_line);
+
return 0;
noconfig:
@@ -90,8 +93,11 @@ static int __init init_kgdboc(void)
static void cleanup_kgdboc(void)
{
- if (configured == 1)
+ if (configured == 1) {
+ kgdb_tty_driver->ops->kgdboc_port_shutdown(kgdb_tty_driver,
+ kgdb_tty_line);
kgdb_unregister_io_module(&kgdboc_io_ops);
+ }
}
static int kgdboc_get_char(void)
diff --git a/drivers/serial/serial_core.c b/drivers/serial/serial_core.c
index 73e9b8f..07f1b04 100644
--- a/drivers/serial/serial_core.c
+++ b/drivers/serial/serial_core.c
@@ -2244,6 +2244,39 @@ uart_configure_port(struct uart_driver *drv, struct uart_state *state,
}
}
+#if defined(CONFIG_KGDB_SERIAL_CONSOLE) || \
+ defined(CONFIG_KGDB_SERIAL_CONSOLE_MODULE)
+static int uart_kgdboc_port_startup(struct tty_driver *driver, int line)
+{
+ struct uart_driver *drv = driver->driver_state;
+ struct uart_state *state = drv->state + line;
+ struct uart_port *port;
+
+ if (!state || !state->port)
+ return -1;
+
+ port = state->port;
+ if (port->ops->kgdboc_port_startup)
+ return port->ops->kgdboc_port_startup(port);
+ else
+ return -1;
+}
+
+static void uart_kgdboc_port_shutdown(struct tty_driver *driver, int line)
+{
+ struct uart_driver *drv = driver->driver_state;
+ struct uart_state *state = drv->state + line;
+ struct uart_port *port;
+
+ if (!state || !state->port)
+ return;
+
+ port = state->port;
+ if (port->ops->kgdboc_port_shutdown)
+ port->ops->kgdboc_port_shutdown(port);
+}
+#endif
+
#ifdef CONFIG_CONSOLE_POLL
static int uart_poll_init(struct tty_driver *driver, int line, char *options)
@@ -2323,6 +2356,11 @@ static const struct tty_operations uart_ops = {
#endif
.tiocmget = uart_tiocmget,
.tiocmset = uart_tiocmset,
+#if defined(CONFIG_KGDB_SERIAL_CONSOLE) || \
+ defined(CONFIG_KGDB_SERIAL_CONSOLE_MODULE)
+ .kgdboc_port_startup = uart_kgdboc_port_startup,
+ .kgdboc_port_shutdown = uart_kgdboc_port_shutdown,
+#endif
#ifdef CONFIG_CONSOLE_POLL
.poll_init = uart_poll_init,
.poll_get_char = uart_poll_get_char,
diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h
index 3b2f6c0..4a15311 100644
--- a/include/linux/serial_core.h
+++ b/include/linux/serial_core.h
@@ -214,6 +214,15 @@ struct uart_ops {
void (*config_port)(struct uart_port *, int);
int (*verify_port)(struct uart_port *, struct serial_struct *);
int (*ioctl)(struct uart_port *, unsigned int, unsigned long);
+#if defined(CONFIG_KGDB_SERIAL_CONSOLE) || \
+ defined(CONFIG_KGDB_SERIAL_CONSOLE_MODULE)
+ /*
+ * Start up serial port earlier in kgdboc to support gdb break
+ * signal Ctrl+C.
+ */
+ int (*kgdboc_port_startup)(struct uart_port *);
+ void (*kgdboc_port_shutdown)(struct uart_port *);
+#endif
#ifdef CONFIG_CONSOLE_POLL
void (*poll_put_char)(struct uart_port *, unsigned char);
int (*poll_get_char)(struct uart_port *);
diff --git a/include/linux/tty_driver.h b/include/linux/tty_driver.h
index 16d2794..efd26cf 100644
--- a/include/linux/tty_driver.h
+++ b/include/linux/tty_driver.h
@@ -220,6 +220,11 @@ struct tty_operations {
unsigned int set, unsigned int clear);
int (*resize)(struct tty_struct *tty, struct tty_struct *real_tty,
struct winsize *ws);
+#if defined(CONFIG_KGDB_SERIAL_CONSOLE) || \
+ defined(CONFIG_KGDB_SERIAL_CONSOLE_MODULE)
+ int (*kgdboc_port_startup)(struct tty_driver *driver, int line);
+ int (*kgdboc_port_shutdown)(struct tty_driver *driver, int line);
+#endif
#ifdef CONFIG_CONSOLE_POLL
int (*poll_init)(struct tty_driver *driver, int line, char *options);
int (*poll_get_char)(struct tty_driver *driver, int line);
--
1.6.0
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] [kgdb] Start kgdboc uart port to answer gdb break signal Ctrl+C without openning ttys.
[not found] ` <48D38C63.4010608@windriver.com>
@ 2008-09-22 3:39 ` Sonic Zhang
0 siblings, 0 replies; 2+ messages in thread
From: Sonic Zhang @ 2008-09-22 3:39 UTC (permalink / raw)
To: Jason Wessel; +Cc: Alan Cox, Linux Kernel, kgdb mailing list
Yes, I am doing the same thing to deal with Ctrl+C as you expected. If
you have already got a solution, that's great. Please send out your
patch and I can implement UART specific code in bf5xx_serial driver
accordingly.
Sonic
On Fri, Sep 19, 2008 at 7:26 PM, Jason Wessel
<jason.wessel@windriver.com> wrote:
> I had been out for part of this week, and I started to look at your
> patches yesterday and will complete it some time today :-)
>
> The "control-c" without opening a tty is one I have a direct conflict
> with in that I have a completely different implementation of this that
> does the same thing. In this other implementation (which I'll probably
> post publicly in response to this patch) there is a rx_poll hook for
> kgdboc to allow it to intercept and correctly process the control-c.
>
> How were you dealing with the control-c? I assume it had to be in a
> similar sort of manner, because there two issues.
>
> 1) hook up the irq with the low level uart start
> 2) Issue a break on the control-c
>
> Certainly I would like to consolidate the implementations, which is why
> the review of the patch was not trivial.
>
> Thanks,
> Jason.
>
> Sonic Zhang wrote:
>> Hi Jason,
>>
>> Any comments?
>>
>> Sonic Zhang
>>
>>
>> On Wed, Sep 17, 2008 at 4:28 PM, sonic zhang <sonic.adi@gmail.com> wrote:
>>
>>> Current kgdboc only configures the uart port in poll mode, which block
>>> any gdb break signal Ctrl+C from taking effect till a tty on the port is
>>> opened by an application. This patch introduces 2 hook functions in
>>> struct tty_operations and uart_operations. The kgdboc port can be start
>>> up without openning ttys after gdb is connected.
>>>
>>> Signed-off-by: Sonic Zhang <sonic.adi@gmail.com>
>>> ---
>>> drivers/serial/kgdboc.c | 8 +++++++-
>>> drivers/serial/serial_core.c | 38 ++++++++++++++++++++++++++++++++++++++
>>> include/linux/serial_core.h | 9 +++++++++
>>> include/linux/tty_driver.h | 5 +++++
>>> 4 files changed, 59 insertions(+), 1 deletions(-)
>>>
>>> diff --git a/drivers/serial/kgdboc.c b/drivers/serial/kgdboc.c
>>> index eadc1ab..5d91f3d 100644
>>> --- a/drivers/serial/kgdboc.c
>>> +++ b/drivers/serial/kgdboc.c
>>> @@ -70,6 +70,9 @@ static int configure_kgdboc(void)
>>>
>>> configured = 1;
>>>
>>> + kgdb_tty_driver->ops->kgdboc_port_startup(kgdb_tty_driver,
>>> + kgdb_tty_line);
>>> +
>>> return 0;
>>>
>>> noconfig:
>>> @@ -90,8 +93,11 @@ static int __init init_kgdboc(void)
>>>
>>> static void cleanup_kgdboc(void)
>>> {
>>> - if (configured == 1)
>>> + if (configured == 1) {
>>> + kgdb_tty_driver->ops->kgdboc_port_shutdown(kgdb_tty_driver,
>>> + kgdb_tty_line);
>>> kgdb_unregister_io_module(&kgdboc_io_ops);
>>> + }
>>> }
>>>
>>> static int kgdboc_get_char(void)
>>> diff --git a/drivers/serial/serial_core.c b/drivers/serial/serial_core.c
>>> index 73e9b8f..07f1b04 100644
>>> --- a/drivers/serial/serial_core.c
>>> +++ b/drivers/serial/serial_core.c
>>> @@ -2244,6 +2244,39 @@ uart_configure_port(struct uart_driver *drv, struct uart_state *state,
>>> }
>>> }
>>>
>>> +#if defined(CONFIG_KGDB_SERIAL_CONSOLE) || \
>>> + defined(CONFIG_KGDB_SERIAL_CONSOLE_MODULE)
>>> +static int uart_kgdboc_port_startup(struct tty_driver *driver, int line)
>>> +{
>>> + struct uart_driver *drv = driver->driver_state;
>>> + struct uart_state *state = drv->state + line;
>>> + struct uart_port *port;
>>> +
>>> + if (!state || !state->port)
>>> + return -1;
>>> +
>>> + port = state->port;
>>> + if (port->ops->kgdboc_port_startup)
>>> + return port->ops->kgdboc_port_startup(port);
>>> + else
>>> + return -1;
>>> +}
>>> +
>>> +static void uart_kgdboc_port_shutdown(struct tty_driver *driver, int line)
>>> +{
>>> + struct uart_driver *drv = driver->driver_state;
>>> + struct uart_state *state = drv->state + line;
>>> + struct uart_port *port;
>>> +
>>> + if (!state || !state->port)
>>> + return;
>>> +
>>> + port = state->port;
>>> + if (port->ops->kgdboc_port_shutdown)
>>> + port->ops->kgdboc_port_shutdown(port);
>>> +}
>>> +#endif
>>> +
>>> #ifdef CONFIG_CONSOLE_POLL
>>>
>>> static int uart_poll_init(struct tty_driver *driver, int line, char *options)
>>> @@ -2323,6 +2356,11 @@ static const struct tty_operations uart_ops = {
>>> #endif
>>> .tiocmget = uart_tiocmget,
>>> .tiocmset = uart_tiocmset,
>>> +#if defined(CONFIG_KGDB_SERIAL_CONSOLE) || \
>>> + defined(CONFIG_KGDB_SERIAL_CONSOLE_MODULE)
>>> + .kgdboc_port_startup = uart_kgdboc_port_startup,
>>> + .kgdboc_port_shutdown = uart_kgdboc_port_shutdown,
>>> +#endif
>>> #ifdef CONFIG_CONSOLE_POLL
>>> .poll_init = uart_poll_init,
>>> .poll_get_char = uart_poll_get_char,
>>> diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h
>>> index 3b2f6c0..4a15311 100644
>>> --- a/include/linux/serial_core.h
>>> +++ b/include/linux/serial_core.h
>>> @@ -214,6 +214,15 @@ struct uart_ops {
>>> void (*config_port)(struct uart_port *, int);
>>> int (*verify_port)(struct uart_port *, struct serial_struct *);
>>> int (*ioctl)(struct uart_port *, unsigned int, unsigned long);
>>> +#if defined(CONFIG_KGDB_SERIAL_CONSOLE) || \
>>> + defined(CONFIG_KGDB_SERIAL_CONSOLE_MODULE)
>>> + /*
>>> + * Start up serial port earlier in kgdboc to support gdb break
>>> + * signal Ctrl+C.
>>> + */
>>> + int (*kgdboc_port_startup)(struct uart_port *);
>>> + void (*kgdboc_port_shutdown)(struct uart_port *);
>>> +#endif
>>> #ifdef CONFIG_CONSOLE_POLL
>>> void (*poll_put_char)(struct uart_port *, unsigned char);
>>> int (*poll_get_char)(struct uart_port *);
>>> diff --git a/include/linux/tty_driver.h b/include/linux/tty_driver.h
>>> index 16d2794..efd26cf 100644
>>> --- a/include/linux/tty_driver.h
>>> +++ b/include/linux/tty_driver.h
>>> @@ -220,6 +220,11 @@ struct tty_operations {
>>> unsigned int set, unsigned int clear);
>>> int (*resize)(struct tty_struct *tty, struct tty_struct *real_tty,
>>> struct winsize *ws);
>>> +#if defined(CONFIG_KGDB_SERIAL_CONSOLE) || \
>>> + defined(CONFIG_KGDB_SERIAL_CONSOLE_MODULE)
>>> + int (*kgdboc_port_startup)(struct tty_driver *driver, int line);
>>> + int (*kgdboc_port_shutdown)(struct tty_driver *driver, int line);
>>> +#endif
>>> #ifdef CONFIG_CONSOLE_POLL
>>> int (*poll_init)(struct tty_driver *driver, int line, char *options);
>>> int (*poll_get_char)(struct tty_driver *driver, int line);
>>> --
>>> 1.6.0
>>>
>>>
>>> --
>>> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
>>> the body of a message to majordomo@vger.kernel.org
>>> More majordomo info at http://vger.kernel.org/majordomo-info.html
>>> Please read the FAQ at http://www.tux.org/lkml/
>>>
>>>
>
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2008-09-22 3:39 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-09-17 8:28 [PATCH] [kgdb] Start kgdboc uart port to answer gdb break signal Ctrl+C without openning ttys sonic zhang
[not found] ` <4e5ebad50809190251p53b9e586x7f78dbc8f1c1b867@mail.gmail.com>
[not found] ` <48D38C63.4010608@windriver.com>
2008-09-22 3:39 ` Sonic Zhang
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®