#define pr_fmt(fmt) …
#include <linux/kernel.h>
#include <linux/ctype.h>
#include <linux/kgdb.h>
#include <linux/kdb.h>
#include <linux/tty.h>
#include <linux/console.h>
#include <linux/vt_kern.h>
#include <linux/input.h>
#include <linux/irq_work.h>
#include <linux/module.h>
#include <linux/platform_device.h>
#include <linux/serial_core.h>
#define MAX_CONFIG_LEN …
static struct kgdb_io kgdboc_io_ops;
static int configured = …;
static DEFINE_MUTEX(config_mutex);
static char config[MAX_CONFIG_LEN];
static struct kparam_string kps = …;
static int kgdboc_use_kms;
static struct tty_driver *kgdb_tty_driver;
static int kgdb_tty_line;
static struct platform_device *kgdboc_pdev;
#if IS_BUILTIN(CONFIG_KGDB_SERIAL_CONSOLE)
static struct kgdb_io kgdboc_earlycon_io_ops;
static int (*earlycon_orig_exit)(struct console *con);
#endif
#ifdef CONFIG_KDB_KEYBOARD
static int kgdboc_reset_connect(struct input_handler *handler,
struct input_dev *dev,
const struct input_device_id *id)
{ … }
static void kgdboc_reset_disconnect(struct input_handle *handle)
{ … }
static const struct input_device_id kgdboc_reset_ids[] = …;
static struct input_handler kgdboc_reset_handler = …;
static DEFINE_MUTEX(kgdboc_reset_mutex);
static void kgdboc_restore_input_helper(struct work_struct *dummy)
{ … }
static DECLARE_WORK(kgdboc_restore_input_work, kgdboc_restore_input_helper);
static void kgdboc_queue_restore_input_helper(struct irq_work *unused)
{ … }
static DEFINE_IRQ_WORK(kgdboc_restore_input_irq_work, kgdboc_queue_restore_input_helper);
static void kgdboc_restore_input(void)
{ … }
static int kgdboc_register_kbd(char **cptr)
{ … }
static void kgdboc_unregister_kbd(void)
{ … }
#else
#define kgdboc_register_kbd …
#define kgdboc_unregister_kbd …
#define kgdboc_restore_input …
#endif
#if IS_BUILTIN(CONFIG_KGDB_SERIAL_CONSOLE)
static void cleanup_earlycon(void)
{ … }
#else
static inline void cleanup_earlycon(void) { }
#endif
static void cleanup_kgdboc(void)
{ … }
static int configure_kgdboc(void)
{ … }
static int kgdboc_probe(struct platform_device *pdev)
{ … }
static struct platform_driver kgdboc_platform_driver = …;
static int __init init_kgdboc(void)
{ … }
static void exit_kgdboc(void)
{ … }
static int kgdboc_get_char(void)
{ … }
static void kgdboc_put_char(u8 chr)
{ … }
static int param_set_kgdboc_var(const char *kmessage,
const struct kernel_param *kp)
{ … }
static int dbg_restore_graphics;
static void kgdboc_pre_exp_handler(void)
{ … }
static void kgdboc_post_exp_handler(void)
{ … }
static struct kgdb_io kgdboc_io_ops = …;
#if IS_BUILTIN(CONFIG_KGDB_SERIAL_CONSOLE)
static int kgdboc_option_setup(char *opt)
{ … }
__setup(…);
static int __init kgdboc_early_init(char *opt)
{ … }
early_param(…);
static int kgdboc_earlycon_get_char(void)
{ … }
static void kgdboc_earlycon_put_char(u8 chr)
{ … }
static void kgdboc_earlycon_pre_exp_handler(void)
{ … }
static int kgdboc_earlycon_deferred_exit(struct console *con)
{ … }
static void kgdboc_earlycon_deinit(void)
{ … }
static struct kgdb_io kgdboc_earlycon_io_ops = …;
#define MAX_CONSOLE_NAME_LEN …
static char kgdboc_earlycon_param[MAX_CONSOLE_NAME_LEN] __initdata;
static bool kgdboc_earlycon_late_enable __initdata;
static int __init kgdboc_earlycon_init(char *opt)
{ … }
early_param(…);
static int __init kgdboc_earlycon_late_init(void)
{ … }
console_initcall(kgdboc_earlycon_late_init);
#endif
module_init(…) …;
module_exit(exit_kgdboc);
module_param_call(…);
MODULE_PARM_DESC(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_LICENSE(…) …;