linux/drivers/tty/serial/kgdb_nmi.c

// SPDX-License-Identifier: GPL-2.0
/*
 * KGDB NMI serial console
 *
 * Copyright 2010 Google, Inc.
 *		  Arve Hjønnevåg <[email protected]>
 *		  Colin Cross <[email protected]>
 * Copyright 2012 Linaro Ltd.
 *		  Anton Vorontsov <[email protected]>
 */

#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/compiler.h>
#include <linux/slab.h>
#include <linux/errno.h>
#include <linux/atomic.h>
#include <linux/console.h>
#include <linux/tty.h>
#include <linux/tty_driver.h>
#include <linux/tty_flip.h>
#include <linux/serial_core.h>
#include <linux/interrupt.h>
#include <linux/hrtimer.h>
#include <linux/tick.h>
#include <linux/kfifo.h>
#include <linux/kgdb.h>
#include <linux/kdb.h>

static int kgdb_nmi_knock =;
module_param_named(knock, kgdb_nmi_knock, int, 0600);
MODULE_PARM_DESC();

static char *kgdb_nmi_magic =;
module_param_named(magic, kgdb_nmi_magic, charp, 0600);
MODULE_PARM_DESC();

static atomic_t kgdb_nmi_num_readers =;

static int kgdb_nmi_console_setup(struct console *co, char *options)
{}

static void kgdb_nmi_console_write(struct console *co, const char *s, uint c)
{}

static struct tty_driver *kgdb_nmi_tty_driver;

static struct tty_driver *kgdb_nmi_console_device(struct console *co, int *idx)
{}

static struct console kgdb_nmi_console =;

/*
 * This is usually the maximum rate on debug ports. We make fifo large enough
 * to make copy-pasting to the terminal usable.
 */
#define KGDB_NMI_BAUD
#define KGDB_NMI_FIFO_SIZE

struct kgdb_nmi_tty_priv {};

static struct tty_port *kgdb_nmi_port;

static void kgdb_tty_recv(int ch)
{}

static int kgdb_nmi_poll_one_knock(void)
{}

/**
 * kgdb_nmi_poll_knock - Check if it is time to enter the debugger
 *
 * "Serial ports are often noisy, especially when muxed over another port (we
 * often use serial over the headset connector). Noise on the async command
 * line just causes characters that are ignored, on a command line that blocked
 * execution noise would be catastrophic." -- Colin Cross
 *
 * So, this function implements KGDB/KDB knocking on the serial line: we won't
 * enter the debugger until we receive a known magic phrase (which is actually
 * "$3#33", known as "escape to KDB" command. There is also a relaxed variant
 * of knocking, i.e. just pressing the return key is enough to enter the
 * debugger. And if knocking is disabled, the function always returns 1.
 */
bool kgdb_nmi_poll_knock(void)
{}

/*
 * The tasklet is cheap, it does not cause wakeups when reschedules itself,
 * instead it waits for the next tick.
 */
static void kgdb_nmi_tty_receiver(struct timer_list *t)
{}

static int kgdb_nmi_tty_activate(struct tty_port *port, struct tty_struct *tty)
{}

static void kgdb_nmi_tty_shutdown(struct tty_port *port)
{}

static const struct tty_port_operations kgdb_nmi_tty_port_ops =;

static int kgdb_nmi_tty_install(struct tty_driver *drv, struct tty_struct *tty)
{}

static void kgdb_nmi_tty_cleanup(struct tty_struct *tty)
{}

static int kgdb_nmi_tty_open(struct tty_struct *tty, struct file *file)
{}

static void kgdb_nmi_tty_close(struct tty_struct *tty, struct file *file)
{}

static void kgdb_nmi_tty_hangup(struct tty_struct *tty)
{}

static unsigned int kgdb_nmi_tty_write_room(struct tty_struct *tty)
{}

static ssize_t kgdb_nmi_tty_write(struct tty_struct *tty, const u8 *buf,
				  size_t c)
{}

static const struct tty_operations kgdb_nmi_tty_ops =;

int kgdb_register_nmi_console(void)
{}
EXPORT_SYMBOL_GPL();

int kgdb_unregister_nmi_console(void)
{}
EXPORT_SYMBOL_GPL();