From b4b79f44ff15502fa09542e10f50873df71079d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonathan=20Neusch=C3=A4fer?= Date: Sun, 27 Nov 2022 14:04:40 +0100 Subject: [PATCH] IT WORKS! buildroot login: root login[66]: root login on 'console' system type : Montage LZ SoC machine : HS1168-8001-02B processor : 0 cpu model : MIPS 24KEc V5.5 BogoMIPS : 395.26 wait instruction : yes microsecond timers : yes tlb_entries : 64 extra interrupt vector : yes hardware watchpoint : yes, count: 4, address/irw mask: [0x0ffc, 0x0ffc, 0x0ffb, 0x0ffb] isa : mips1 mips2 mips32r1 mips32r2 ASEs implemented : mips16 dsp Options implemented : tlb 4kex 4k_cache 32fpr prefetch mcheck ejtag llsc userlocal vint perf_cntr_intr_bit nan_legacy nan_2008 perf mm_full shadow register sets : 1 kscratch registers : 0 package : 0 core : 0 VCED exceptions : not available VCEI exceptions : not available Linux buildroot 6.1.0-rc6-00011-gb439a09415a7-dirty #149 Sun Nov 27 22:17:41 CET 2022 mips GNU/Linux --- .../mips/boot/dts/montage/hs1168-8001-02b.dts | 4 - arch/mips/boot/dts/montage/m88cs8001b.dtsi | 2 + arch/mips/montage/irq.c | 41 ++++-- drivers/of/base.c | 1 + drivers/tty/serial/montage-uart.c | 130 +++++++++++++++--- drivers/tty/serial/serial_core.c | 24 +++- include/linux/serial_core.h | 2 +- include/uapi/linux/serial_core.h | 3 + kernel/irq/chip.c | 2 + kernel/irq/manage.c | 26 +++- kernel/printk/printk.c | 19 ++- 11 files changed, 214 insertions(+), 40 deletions(-) diff --git a/arch/mips/boot/dts/montage/hs1168-8001-02b.dts b/arch/mips/boot/dts/montage/hs1168-8001-02b.dts index d22ce250fd1bda..f4babe9dda3d49 100644 --- a/arch/mips/boot/dts/montage/hs1168-8001-02b.dts +++ b/arch/mips/boot/dts/montage/hs1168-8001-02b.dts @@ -10,10 +10,6 @@ stdout-path = "serial0"; }; - aliases { - serial0 = <&serial0>; - }; - memory@0 { device_type = "memory"; reg = <0 0x04000000>; diff --git a/arch/mips/boot/dts/montage/m88cs8001b.dtsi b/arch/mips/boot/dts/montage/m88cs8001b.dtsi index d046f92d31765e..deeeacb0a95756 100644 --- a/arch/mips/boot/dts/montage/m88cs8001b.dtsi +++ b/arch/mips/boot/dts/montage/m88cs8001b.dtsi @@ -89,12 +89,14 @@ serial0: serial@1f540000 { compatible = "montage,m88cs8001b-uart"; reg = <0x1f540000 0x1000>; + interrupts = <26>; status = "disabled"; }; serial1: serial@1f550000 { compatible = "montage,m88cs8001b-uart"; reg = <0x1f550000 0x1000>; + interrupts = <27>; status = "disabled"; }; }; diff --git a/arch/mips/montage/irq.c b/arch/mips/montage/irq.c index e38233d67d8289..caccb9b98970d8 100644 --- a/arch/mips/montage/irq.c +++ b/arch/mips/montage/irq.c @@ -22,6 +22,10 @@ static struct montage_intc *intc; static void montage_intc_init_hw(void) { + // Clear modes + for (int i = 0; i < 6; i++) + writel(0x77777777, intc->regs + MONTAGE_MODE(i)); + // Mask all interrupts writel(0xffffffff, intc->regs + MONTAGE_MASK(0)); writel(0xffffffff, intc->regs + MONTAGE_MASK(1)); @@ -46,10 +50,9 @@ static void montage_intc_irq_unmask(struct irq_data *d) int shift = hwirq % 32; u32 val; - pr_info("%s: hwirq=%lu\n", __func__, irqd_to_hwirq(d)); + pr_info("%s: hwirq=%d\n", __func__, hwirq); - pr_info("%s: skip!\n", __func__); - return; + //pr_info("%s: skip!\n", __func__); return; montage_intc_set_mode(hwirq, 3); @@ -65,7 +68,7 @@ static void montage_intc_irq_mask(struct irq_data *d) int shift = hwirq % 32; u32 val; - pr_info("%s: hwirq=%lu\n", __func__, irqd_to_hwirq(d)); + pr_info("%s: hwirq=%d\n", __func__, hwirq); val = readl(intc->regs + MONTAGE_MASK(index)); val |= BIT(shift); @@ -79,24 +82,44 @@ static void montage_intc_ack(void) cpu_relax(); } +#if 0 static void montage_intc_irq_ack(struct irq_data *d) { pr_info("%s: hwirq=%lu\n", __func__, irqd_to_hwirq(d)); montage_intc_ack(); } +#endif + +static void montage_intc_irq_eoi(struct irq_data *d) +{ + //pr_info("%s: hwirq=%lu\n", __func__, irqd_to_hwirq(d)); + //montage_intc_ack(); +} + +static int montage_intc_set_type(struct irq_data *d, unsigned int flow_type) +{ + if ((flow_type & IRQ_TYPE_SENSE_MASK) != IRQ_TYPE_LEVEL_HIGH) + return -EINVAL; + + return 0; +} static struct irq_chip montage_intc_irq_chip = { .name = "montage intc", + .irq_set_type = montage_intc_set_type, .irq_unmask = montage_intc_irq_unmask, .irq_mask = montage_intc_irq_mask, - .irq_ack = montage_intc_irq_ack, +// .irq_ack = montage_intc_irq_ack, + .irq_eoi = montage_intc_irq_eoi, }; static int montage_intc_map(struct irq_domain *d, unsigned int irq, irq_hw_number_t hw) { - pr_info("%s %d!\n", __func__, d->hwirq); - irq_set_chip_and_handler(irq, &montage_intc_irq_chip, handle_level_irq); + pr_info("%s %u/%lu!\n", __func__, irq, hw); + irq_set_chip_and_handler(irq, &montage_intc_irq_chip, handle_fasteoi_irq); + irq_set_chip_data(irq, intc); + irq_set_probe(irq); return 0; } @@ -112,10 +135,12 @@ static void montage_intc_irq_handler(struct irq_desc *desc) u32 cause; cause = readl(intc->regs + MONTAGE_CAUSE); - pr_info("%s: cause=%d\n", __func__, cause); + //pr_info("%s: cause=%d\n", __func__, cause); hwirq = cause; generic_handle_domain_irq(intc->domain, hwirq); + + montage_intc_ack(); } static int __init montage_intc_of_init(struct device_node *np, diff --git a/drivers/of/base.c b/drivers/of/base.c index d5a5c35eba72ac..5690d2e5ff9e59 100644 --- a/drivers/of/base.c +++ b/drivers/of/base.c @@ -1918,6 +1918,7 @@ void of_alias_scan(void * (*dt_alloc)(u64 size, u64 align)) &name); if (IS_ENABLED(CONFIG_PPC) && !name) of_property_read_string(of_aliases, "stdout", &name); + pr_info("%s: stdout path is %s\n", __func__, name); if (name) of_stdout = of_find_node_opts_by_path(name, &of_stdout_options); if (of_stdout) diff --git a/drivers/tty/serial/montage-uart.c b/drivers/tty/serial/montage-uart.c index a2ea350f3c79be..0b715e2eb3a4fb 100644 --- a/drivers/tty/serial/montage-uart.c +++ b/drivers/tty/serial/montage-uart.c @@ -3,6 +3,7 @@ #include #include #include +#include #include #define REG_TXLVL 0x0010 /* transmit FIFO level (max. 64) */ @@ -17,14 +18,14 @@ #define NUM_PORTS 8 -struct montage_port { +struct montage_uart { struct uart_port port; struct timer_list timer; }; -static struct montage_port *montage_uarts[NUM_PORTS]; +static struct montage_uart *montage_uarts[NUM_PORTS]; -#define to_montage_port(port) container_of(port, struct montage_port, port) +#define to_montage_uart(port) container_of(port, struct montage_uart, port) #ifdef CONFIG_SERIAL_MONTAGE_CONSOLE static struct console montage_console; @@ -65,9 +66,10 @@ static int montage_rx(struct uart_port *port) return ioread16(port->membase + REG_RX) & 0xff; } +#if 0 static void montage_timer(struct timer_list *t) { - struct montage_port *uart = from_timer(uart, t, timer); + struct montage_uart *uart = from_timer(uart, t, timer); struct uart_port *port = &uart->port; unsigned int flg = TTY_NORMAL; int ch; @@ -86,6 +88,7 @@ static void montage_timer(struct timer_list *t) mod_timer(&uart->timer, jiffies + uart_poll_timeout(port)); } +#endif static unsigned int montage_tx_empty(struct uart_port *port) { @@ -100,10 +103,33 @@ static const char *montage_type(struct uart_port *port) return "montage-uart"; } +static irqreturn_t montage_irq_handler(int irq, void *priv) +{ + struct uart_port *port = priv; + unsigned int flg = TTY_NORMAL; + unsigned long status; + int ch; + + while (montage_can_rx(port)) { + ch = montage_rx(port); + port->icount.rx++; + + if (uart_handle_sysrq_char(port, ch)) + continue; + + uart_insert_char(port, status, 0, ch, flg); + } + tty_flip_buffer_push(&port->state->port); + + return IRQ_HANDLED; +} + static int montage_startup(struct uart_port *port) { - pr_info("%s!\n", __func__); - return 0; + pr_info("%s: [0x08] = %08x, [0x24] = %08x\n", __func__, + readl(port->membase + 0x08), readl(port->membase + 0x24)); + + return request_irq(port->irq, montage_irq_handler, IRQF_TRIGGER_HIGH, "montage-uart", port); } static void montage_shutdown(struct uart_port *port) @@ -111,34 +137,95 @@ static void montage_shutdown(struct uart_port *port) pr_info("%s!\n", __func__); } +static void montage_config_port(struct uart_port *port, int type) +{ + pr_info("%s lol\n", __func__); + port->type = PORT_MONTAGE; +} + +static void montage_set_mctrl(struct uart_port *port, unsigned int mctrl) +{ + pr_info("%s lol\n", __func__); +} + +static void montage_set_termios(struct uart_port *port, struct ktermios *new, + const struct ktermios *old) +{ + pr_info("%s lol\n", __func__); +} + +static void montage_start_tx(struct uart_port *port) +{ + struct circ_buf *xmit = &port->state->xmit; + unsigned char ch; + + // TODO: deal with backpressure a little better + + if (unlikely(port->x_char)) { + montage_putchar(port, port->x_char); + port->icount.tx++; + port->x_char = 0; + } else if (!uart_circ_empty(xmit)) { + while (xmit->head != xmit->tail) { + ch = xmit->buf[xmit->tail]; + xmit->tail = (xmit->tail + 1) & (UART_XMIT_SIZE - 1); + port->icount.tx++; + montage_putchar(port, ch); + } + } + + if (uart_circ_chars_pending(xmit) < WAKEUP_CHARS) + uart_write_wakeup(port); +} + +static void montage_stop_tx(struct uart_port *port) +{ + pr_info("%s lol\n", __func__); +} + static const struct uart_ops montage_ops = { .tx_empty = montage_tx_empty, .startup = montage_startup, .shutdown = montage_shutdown, .type = montage_type, + .config_port = montage_config_port, + .set_mctrl = montage_set_mctrl, + .set_termios = montage_set_termios, + .start_tx = montage_start_tx, + .stop_tx = montage_stop_tx, }; static int montage_probe(struct platform_device *pdev) { - struct montage_port *uart; + struct montage_uart *uart; struct uart_port *port; + struct resource *res_mem; int dev_id; + int irq; dev_id = of_alias_get_id(pdev->dev.of_node, "serial"); - pr_info("montage_probe: dev_id=%d\n", dev_id); - uart = devm_kzalloc(&pdev->dev, sizeof(struct montage_port), GFP_KERNEL); + uart = devm_kzalloc(&pdev->dev, sizeof(struct montage_uart), GFP_KERNEL); if (!uart) return -ENOMEM; port = &uart->port; - port->membase = devm_platform_get_and_ioremap_resource(pdev, 0, NULL); - if (IS_ERR(port->membase)) - return PTR_ERR(port->membase); + res_mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); + if (!res_mem) + return -ENODEV; + + irq = of_irq_get(pdev->dev.of_node, 0); + if (irq < 0) + return irq; + + port->irq = irq; port->dev = &pdev->dev; port->iotype = UPIO_MEM; + port->mapbase = res_mem->start; + port->mapsize = resource_size(res_mem); + port->membase = devm_ioremap(&pdev->dev, port->mapbase, port->mapsize); port->flags = UPF_BOOT_AUTOCONF; port->ops = &montage_ops; port->regshift = 2; @@ -146,10 +233,13 @@ static int montage_probe(struct platform_device *pdev) port->iobase = 1; port->type = PORT_UNKNOWN; port->line = dev_id; + port->fifosize = TXLVL_MAX; spin_lock_init(&port->lock); platform_set_drvdata(pdev, port); + montage_uarts[dev_id] = uart; + pr_info("%s: montage_driver=%px, port=%px\n", __func__, &montage_driver, &uart->port); return uart_add_one_port(&montage_driver, &uart->port); } @@ -180,12 +270,10 @@ static struct platform_driver montage_platform_driver = { static void montage_console_write(struct console *co, const char *s, unsigned int count) { - struct montage_port *uart = montage_uarts[co->index]; - struct uart_port *port; + struct montage_uart *uart = montage_uarts[co->index]; + struct uart_port *port = &uart->port; unsigned long flags; - port = &uart->port; - spin_lock_irqsave(&port->lock, flags); uart_console_write(port, s, count, montage_putchar); spin_unlock_irqrestore(&port->lock, flags); @@ -193,13 +281,14 @@ static void montage_console_write(struct console *co, const char *s, static int montage_console_setup(struct console *co, char *options) { - struct montage_port *uart = montage_uarts[co->index]; - struct uart_port *port; + struct montage_uart *uart = montage_uarts[co->index]; + struct uart_port *port = &uart->port; int baud = 115200; int bits = 8; int parity = 'n'; int flow = 'n'; + pr_info("%s: entry, idx=%u, uart = %px\n", __func__, co->index, uart); if (!uart) return -ENODEV; @@ -207,6 +296,9 @@ static int montage_console_setup(struct console *co, char *options) if (!port->membase) return -ENODEV; + pr_info("%s: [0x08] = %08x, [0x24] = %08x\n", __func__, + readl(port->membase + 0x08), readl(port->membase + 0x24)); + if (options) uart_parse_options(options, &baud, &parity, &bits, &flow); @@ -214,7 +306,7 @@ static int montage_console_setup(struct console *co, char *options) } static struct console montage_console = { - .name = "montage", + .name = "ttyS", .write = montage_console_write, .device = uart_console_device, .setup = montage_console_setup, diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c index 179ee199df343e..7994394c7e765b 100644 --- a/drivers/tty/serial/serial_core.c +++ b/drivers/tty/serial/serial_core.c @@ -2505,11 +2505,11 @@ uart_report_port(struct uart_driver *drv, struct uart_port *port) break; } - pr_info("%s%s%s at %s (irq = %d, base_baud = %d) is a %s\n", + pr_info("%s%s%s at %s (irq = %d, base_baud = %d) is a %s, port = %px\n", port->dev ? dev_name(port->dev) : "", port->dev ? ": " : "", port->name, - address, port->irq, port->uartclk / 16, uart_type(port)); + address, port->irq, port->uartclk / 16, uart_type(port), port); /* The magic multiplier feature is a bit obscure, so report it too. */ if (port->flags & UPF_MAGIC_MULTIPLIER) @@ -3052,35 +3052,43 @@ int uart_add_one_port(struct uart_driver *drv, struct uart_port *uport) int ret = 0; struct device *tty_dev; int num_groups; + int line = 0; if (uport->line >= drv->nr) return -EINVAL; + pr_info("%s: %d\n", __func__, line++); state = drv->state + uport->line; port = &state->port; + pr_info("%s: %d\n", __func__, line++); mutex_lock(&port_mutex); mutex_lock(&port->mutex); if (state->uart_port) { ret = -EINVAL; goto out; } + pr_info("%s: %d\n", __func__, line++); /* Link the port to the driver state table and vice versa */ + pr_info("%s: %d\n", __func__, line++); atomic_set(&state->refcount, 1); init_waitqueue_head(&state->remove_wait); state->uart_port = uport; uport->state = state; + pr_info("%s: %d\n", __func__, line++); state->pm_state = UART_PM_STATE_UNDEFINED; uport->cons = drv->cons; uport->minor = drv->tty_driver->minor_start + uport->line; uport->name = kasprintf(GFP_KERNEL, "%s%d", drv->dev_name, drv->tty_driver->name_base + uport->line); + pr_info("%s: %d\n", __func__, line++); if (!uport->name) { ret = -ENOMEM; goto out; } + pr_info("%s: %d\n", __func__, line++); /* * If this port is in use as a console then the spinlock is already @@ -3088,28 +3096,37 @@ int uart_add_one_port(struct uart_driver *drv, struct uart_port *uport) */ if (!uart_console_enabled(uport)) uart_port_spin_lock_init(uport); + pr_info("%s: %d\n", __func__, line++); if (uport->cons && uport->dev) of_console_check(uport->dev->of_node, uport->cons->name, uport->line); + pr_info("%s: %d, drv=%px, uport=%px\n", __func__, line++, drv, uport); tty_port_link_device(port, drv->tty_driver, uport->line); + pr_info("%s: %d\n", __func__, line++); uart_configure_port(drv, state, uport); + pr_info("%s: %d\n", __func__, line++); port->console = uart_console(uport); + pr_info("%s: %d\n", __func__, line++); num_groups = 2; if (uport->attr_group) num_groups++; + pr_info("%s: %d\n", __func__, line++); uport->tty_groups = kcalloc(num_groups, sizeof(*uport->tty_groups), GFP_KERNEL); + pr_info("%s: %d\n", __func__, line++); if (!uport->tty_groups) { ret = -ENOMEM; goto out; } + pr_info("%s: %d\n", __func__, line++); uport->tty_groups[0] = &tty_dev_attr_group; if (uport->attr_group) uport->tty_groups[1] = uport->attr_group; + pr_info("%s: %d\n", __func__, line++); /* * Register the port whether it's detected or not. This allows @@ -3117,17 +3134,20 @@ int uart_add_one_port(struct uart_driver *drv, struct uart_port *uport) */ tty_dev = tty_port_register_device_attr_serdev(port, drv->tty_driver, uport->line, uport->dev, port, uport->tty_groups); + pr_info("%s: %d\n", __func__, line++); if (!IS_ERR(tty_dev)) { device_set_wakeup_capable(tty_dev, 1); } else { dev_err(uport->dev, "Cannot register tty device on line %d\n", uport->line); } + pr_info("%s: %d\n", __func__, line++); /* * Ensure UPF_DEAD is not set. */ uport->flags &= ~UPF_DEAD; + pr_info("%s: %d\n", __func__, line++); out: mutex_unlock(&port->mutex); diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h index d657f2a42a7b8f..fc3ced63b07e0d 100644 --- a/include/linux/serial_core.h +++ b/include/linux/serial_core.h @@ -214,7 +214,7 @@ struct gpio_desc; * This call must not sleep * * @set_termios: ``void ()(struct uart_port *port, struct ktermios *new, - * struct ktermios *old)`` + * const struct ktermios *old)`` * * Change the @port parameters, including word length, parity, stop bits. * Update @port->read_status_mask and @port->ignore_status_mask to diff --git a/include/uapi/linux/serial_core.h b/include/uapi/linux/serial_core.h index 3ba34d8378bd0e..f12281f639cb41 100644 --- a/include/uapi/linux/serial_core.h +++ b/include/uapi/linux/serial_core.h @@ -276,4 +276,7 @@ /* Sunplus UART */ #define PORT_SUNPLUS 123 +/* Montage UART */ +#define PORT_MONTAGE 124 + #endif /* _UAPILINUX_SERIAL_CORE_H */ diff --git a/kernel/irq/chip.c b/kernel/irq/chip.c index 8ac37e8e738a3b..3c1f96d0415129 100644 --- a/kernel/irq/chip.c +++ b/kernel/irq/chip.c @@ -333,6 +333,7 @@ void irq_shutdown_and_deactivate(struct irq_desc *desc) void irq_enable(struct irq_desc *desc) { + pr_info("%s %px -> %lu\n", __func__, desc, desc->irq_data.hwirq); if (!irqd_irq_disabled(&desc->irq_data)) { unmask_irq(desc); } else { @@ -430,6 +431,7 @@ void mask_irq(struct irq_desc *desc) void unmask_irq(struct irq_desc *desc) { + pr_info("%s %px -> %lu\n", __func__, desc, desc->irq_data.hwirq); if (!irqd_irq_masked(&desc->irq_data)) return; diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c index 40fe7806cc8c99..4b61e2b73b2e8e 100644 --- a/kernel/irq/manage.c +++ b/kernel/irq/manage.c @@ -953,7 +953,7 @@ int __irq_set_trigger(struct irq_desc *desc, unsigned long flags) * IRQF_TRIGGER_* but the PIC does not support multiple * flow-types? */ - pr_debug("No set_type function for IRQ %d (%s)\n", + pr_info("No set_type function for IRQ %d (%s)\n", irq_desc_get_irq(desc), chip ? (chip->name ? : "unknown") : "unknown"); return 0; @@ -993,6 +993,7 @@ int __irq_set_trigger(struct irq_desc *desc, unsigned long flags) pr_err("Setting trigger mode %lu for irq %u failed (%pS)\n", flags, irq_desc_get_irq(desc), chip->irq_set_type); } + pr_info("%s: about to unmask %lu? %s\n", __func__, desc->irq_data.hwirq, unmask? "true":"false"); if (unmask) unmask_irq(desc); return ret; @@ -1500,6 +1501,8 @@ __setup_irq(unsigned int irq, struct irq_desc *desc, struct irqaction *new) unsigned long flags, thread_mask = 0; int ret, nested, shared = 0; + pr_info("%s: %lu\n", __func__, desc->irq_data.hwirq); + if (!desc) return -EINVAL; @@ -2143,8 +2146,12 @@ int request_threaded_irq(unsigned int irq, irq_handler_t handler, struct irq_desc *desc; int retval; - if (irq == IRQ_NOTCONNECTED) + pr_info("%s: %u\n", __func__, irq); + + if (irq == IRQ_NOTCONNECTED) { + pr_info("%s: exit (not connected)\n", __func__); return -ENOTCONN; + } /* * Sanity-check: shared interrupts must pass in a real dev-ID, @@ -2162,16 +2169,22 @@ int request_threaded_irq(unsigned int irq, irq_handler_t handler, if (((irqflags & IRQF_SHARED) && !dev_id) || ((irqflags & IRQF_SHARED) && (irqflags & IRQF_NO_AUTOEN)) || (!(irqflags & IRQF_SHARED) && (irqflags & IRQF_COND_SUSPEND)) || - ((irqflags & IRQF_NO_SUSPEND) && (irqflags & IRQF_COND_SUSPEND))) + ((irqflags & IRQF_NO_SUSPEND) && (irqflags & IRQF_COND_SUSPEND))) { + pr_info("%s: exit due to bad flags\n", __func__); return -EINVAL; + } desc = irq_to_desc(irq); - if (!desc) + if (!desc) { + pr_info("%s: exit (can't convert to desc)\n", __func__); return -EINVAL; + } if (!irq_settings_can_request(desc) || - WARN_ON(irq_settings_is_per_cpu_devid(desc))) + WARN_ON(irq_settings_is_per_cpu_devid(desc))) { + pr_info("%s: exit (something something settings)\n", __func__); return -EINVAL; + } if (!handler) { if (!thread_fn) @@ -2192,10 +2205,12 @@ int request_threaded_irq(unsigned int irq, irq_handler_t handler, retval = irq_chip_pm_get(&desc->irq_data); if (retval < 0) { kfree(action); + pr_info("%s: exit (pm_get failed)\n", __func__); return retval; } retval = __setup_irq(irq, desc, action); + pr_info("%s: __setup_irq retval=%d\n", __func__, retval); if (retval) { irq_chip_pm_put(&desc->irq_data); @@ -2222,6 +2237,7 @@ int request_threaded_irq(unsigned int irq, irq_handler_t handler, enable_irq(irq); } #endif + pr_info("%s: done!\n", __func__); return retval; } EXPORT_SYMBOL(request_threaded_irq); diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c index e4f1e7478b521a..dc7f653fa6d981 100644 --- a/kernel/printk/printk.c +++ b/kernel/printk/printk.c @@ -2373,6 +2373,8 @@ static int __add_preferred_console(char *name, int idx, char *options, struct console_cmdline *c; int i; + pr_info("%s: %s\n", __func__, name); + /* * See if this tty is not yet registered, and * if we have a slot free. @@ -3020,33 +3022,46 @@ static int try_enable_preferred_console(struct console *newcon, struct console_cmdline *c; int i, err; + pr_info("%s: %s\n", __func__, newcon->name); + for (i = 0, c = console_cmdline; i < MAX_CMDLINECONSOLES && c->name[0]; i++, c++) { + pr_info("%s a\n", __func__); if (c->user_specified != user_specified) continue; + pr_info("%s b\n", __func__); if (!newcon->match || newcon->match(newcon, c->name, c->index, c->options) != 0) { /* default matching */ + pr_info("%s d\n", __func__); BUILD_BUG_ON(sizeof(c->name) != sizeof(newcon->name)); + pr_info("%s e: %s vs %s\n", __func__, c->name, newcon->name); if (strcmp(c->name, newcon->name) != 0) continue; + pr_info("%s f\n", __func__); if (newcon->index >= 0 && newcon->index != c->index) continue; + pr_info("%s g\n", __func__); if (newcon->index < 0) newcon->index = c->index; + pr_info("%s h\n", __func__); if (_braille_register_console(newcon, c)) return 0; + pr_info("%s i\n", __func__); if (newcon->setup && (err = newcon->setup(newcon, c->options)) != 0) return err; + pr_info("%s j\n", __func__); } + pr_info("%s c\n", __func__); newcon->flags |= CON_ENABLED; if (i == preferred_console) newcon->flags |= CON_CONSDEV; + pr_info("%s found one: %s\n", __func__, newcon->name); return 0; } @@ -3055,7 +3070,7 @@ static int try_enable_preferred_console(struct console *newcon, * without matching. Accept the pre-enabled consoles only when match() * and setup() had a chance to be called. */ - if (newcon->flags & CON_ENABLED && c->user_specified == user_specified) + if (newcon->flags & CON_ENABLED && c->user_specified == user_specified) return 0; return -ENOENT; @@ -3107,6 +3122,8 @@ void register_console(struct console *newcon) bool realcon_enabled = false; int err; + pr_info("%s\n", __func__); + for_each_console(con) { if (WARN(con == newcon, "console '%s%d' already registered\n", con->name, con->index))