void __init disable_early_printk(void) { unregister_console(&cons_bcm7xxx); }
void disable_early_printk(void) { unregister_console(&l4kdb_cons); }
void Gserial_console_exit(void) { unregister_console(&Gserial_console); }
/* * The console driver calls this routine during kernel initialization * to register the console printing procedure with printk() and to * print any messages that were printed by the kernel before the * console driver was initialized. */ void register_console(struct console *console) { int i; unsigned long flags; struct console *bootconsole = NULL; if (console_drivers) { if (console->flags & CON_BOOT) return; if (console_drivers->flags & CON_BOOT) bootconsole = console_drivers; } if (preferred_console < 0 || bootconsole || !console_drivers) preferred_console = selected_console; if (console->early_setup) console->early_setup(); /* * See if we want to use this console driver. If we * didn't select a console we take the first one * that registers here. */ if (preferred_console < 0) { if (console->index < 0) console->index = 0; if (console->setup == NULL || console->setup(console, NULL) == 0) { console->flags |= CON_ENABLED | CON_CONSDEV; preferred_console = 0; } } /* * See if this console matches one we selected on * the command line. */ for (i = 0; i < MAX_CMDLINECONSOLES && console_cmdline[i].name[0]; i++) { if (strcmp(console_cmdline[i].name, console->name) != 0) continue; if (console->index >= 0 && console->index != console_cmdline[i].index) continue; if (console->index < 0) console->index = console_cmdline[i].index; if (console->setup && console->setup(console, console_cmdline[i].options) != 0) break; console->flags |= CON_ENABLED; console->index = console_cmdline[i].index; if (i == selected_console) { console->flags |= CON_CONSDEV; preferred_console = selected_console; } break; } if (!(console->flags & CON_ENABLED)) return; if (bootconsole && (console->flags & CON_CONSDEV)) { printk(KERN_INFO "console handover: boot [%s%d] -> real [%s%d]\n", bootconsole->name, bootconsole->index, console->name, console->index); unregister_console(bootconsole); console->flags &= ~CON_PRINTBUFFER; } else { printk(KERN_INFO "console [%s%d] enabled\n", console->name, console->index); } /* * Put this console in the list - keep the * preferred driver at the head of the list. */ acquire_console_sem(); if ((console->flags & CON_CONSDEV) || console_drivers == NULL) { console->next = console_drivers; console_drivers = console; if (console->next) console->next->flags &= ~CON_CONSDEV; } else { console->next = console_drivers->next; console_drivers->next = console; } if (console->flags & CON_PRINTBUFFER) { /* * release_console_sem() will print out the buffered messages * for us. */ spin_lock_irqsave(&logbuf_lock, flags); con_start = log_start; spin_unlock_irqrestore(&logbuf_lock, flags); } release_console_sem(); }
static void pstore_unregister_console(void) { unregister_console(&pstore_console); }
static void cleanup_netconsole(void) { unregister_console(&netconsole); netpoll_cleanup(&np); }
static int __init xencons_init(void) { int rc; if (!is_running_on_xen()) return -ENODEV; if (xc_mode == XC_OFF) return 0; if (!is_initial_xendomain()) { rc = xencons_ring_init(); if (rc) return rc; } xencons_driver = alloc_tty_driver((xc_mode == XC_TTY) ? MAX_NR_CONSOLES : 1); if (xencons_driver == NULL) return -ENOMEM; DRV(xencons_driver)->name = "xencons"; DRV(xencons_driver)->major = TTY_MAJOR; DRV(xencons_driver)->type = TTY_DRIVER_TYPE_SERIAL; DRV(xencons_driver)->subtype = SERIAL_TYPE_NORMAL; DRV(xencons_driver)->init_termios = tty_std_termios; DRV(xencons_driver)->flags = TTY_DRIVER_REAL_RAW | TTY_DRIVER_RESET_TERMIOS | TTY_DRIVER_NO_DEVFS; DRV(xencons_driver)->termios = xencons_termios; DRV(xencons_driver)->termios_locked = xencons_termios_locked; switch (xc_mode) { case XC_XVC: DRV(xencons_driver)->name = "xvc"; DRV(xencons_driver)->major = XEN_XVC_MAJOR; DRV(xencons_driver)->minor_start = XEN_XVC_MINOR; DRV(xencons_driver)->name_base = xc_num; break; case XC_SERIAL: DRV(xencons_driver)->name = "ttyS"; DRV(xencons_driver)->minor_start = 64 + xc_num; DRV(xencons_driver)->name_base = xc_num; break; default: DRV(xencons_driver)->name = "tty"; DRV(xencons_driver)->minor_start = 1; DRV(xencons_driver)->name_base = 1; break; } tty_set_operations(xencons_driver, &xencons_ops); if ((rc = tty_register_driver(DRV(xencons_driver))) != 0) { printk("WARNING: Failed to register Xen virtual " "console driver as '%s%d'\n", DRV(xencons_driver)->name, DRV(xencons_driver)->name_base); put_tty_driver(xencons_driver); xencons_driver = NULL; return rc; } tty_register_device(xencons_driver, 0, NULL); if (is_initial_xendomain()) { xencons_priv_irq = bind_virq_to_irqhandler( VIRQ_CONSOLE, 0, xencons_priv_interrupt, 0, "console", NULL); BUG_ON(xencons_priv_irq < 0); } printk("Xen virtual console successfully installed as %s%d\n", DRV(xencons_driver)->name, xc_num); /* Check about framebuffer messing up the console */ if (!is_initial_xendomain() && !xenbus_exists(XBT_NIL, "device", "vfb")) { /* FIXME: this is ugly */ unregister_console(&kcons_info); kcons_info.flags |= CON_CONSDEV; register_console(&kcons_info); } return 0; }
int bsp_usb_console_init(void) { struct console* uart_console; struct usb_cdc_line_coding coding; int status = 0; /* alloc first tty driver for console */ gs_console_tty_driver = alloc_tty_driver(1); if (!gs_console_tty_driver) return -ENOMEM; gs_console_tty_driver->driver_name = "console_ser"; gs_console_tty_driver->name = g_acm_tty_type_table[ACM_CONSOLE_IDX].name; /* uses dynamically assigned dev_t values */ gs_console_tty_driver->type = TTY_DRIVER_TYPE_SERIAL; gs_console_tty_driver->subtype = SERIAL_TYPE_NORMAL; gs_console_tty_driver->flags = TTY_DRIVER_REAL_RAW | TTY_DRIVER_DYNAMIC_DEV; gs_console_tty_driver->init_termios = tty_std_termios; /* 9600-8-N-1 ... matches defaults expected by "usbser.sys" on * MS-Windows. Otherwise, most of these flags shouldn't affect * anything unless we were to actually hook up to a serial line. */ gs_console_tty_driver->init_termios.c_cflag = B9600 | CS8 | CREAD | HUPCL | CLOCAL; gs_console_tty_driver->init_termios.c_ispeed = 9600; gs_console_tty_driver->init_termios.c_ospeed = 9600; gs_console_tty_driver->num = 1; coding.dwDTERate = cpu_to_le32(9600); coding.bCharFormat = 8; coding.bParityType = USB_CDC_NO_PARITY; coding.bDataBits = USB_CDC_1_STOP_BITS; tty_set_operations(gs_console_tty_driver, &gs_tty_ops); /* export the driver ... */ status = tty_register_driver(gs_console_tty_driver); if (status) { pr_err("%s: cannot register, err %d\n", __func__, status); goto console_init_fail; } mutex_init(&ports[0].lock); status = gs_port_alloc(0, &coding); if (status) { goto console_init_fail; } if (gs_acm_is_console_enable()) { /* reg from uart shell to usb shell */ uart_console = bsp_get_uart_console(); if (uart_console) { unregister_console(uart_console); } register_console(&gs_console); console_start(&gs_console); } return 0; console_init_fail: put_tty_driver(gs_console_tty_driver); return status; }
static int __init viocons_init2(void) { atomic_t wait_flag; int rc; /* +2 for fudge */ rc = viopath_open(HvLpConfig_getPrimaryLpIndex(), viomajorsubtype_chario, VIOCHAR_WINDOW + 2); if (rc) printk(VIOCONS_KERN_WARN "error opening to primary %d\n", rc); if (viopath_hostLp == HvLpIndexInvalid) vio_set_hostlp(); /* * And if the primary is not the same as the hosting LP, open to the * hosting lp */ if ((viopath_hostLp != HvLpIndexInvalid) && (viopath_hostLp != HvLpConfig_getPrimaryLpIndex())) { printk(VIOCONS_KERN_INFO "open path to hosting (%d)\n", viopath_hostLp); rc = viopath_open(viopath_hostLp, viomajorsubtype_chario, VIOCHAR_WINDOW + 2); /* +2 for fudge */ if (rc) printk(VIOCONS_KERN_WARN "error opening to partition %d: %d\n", viopath_hostLp, rc); } if (vio_setHandler(viomajorsubtype_chario, vioHandleCharEvent) < 0) printk(VIOCONS_KERN_WARN "error seting handler for console events!\n"); /* * First, try to open the console to the hosting lp. * Wait on a semaphore for the response. */ atomic_set(&wait_flag, 0); if ((viopath_isactive(viopath_hostLp)) && (send_open(viopath_hostLp, (void *)&wait_flag) == 0)) { printk(VIOCONS_KERN_INFO "hosting partition %d\n", viopath_hostLp); while (atomic_read(&wait_flag) == 0) mb(); atomic_set(&wait_flag, 0); } /* * If we don't have an active console, try the primary */ if ((!viopath_isactive(port_info[0].lp)) && (viopath_isactive(HvLpConfig_getPrimaryLpIndex())) && (send_open(HvLpConfig_getPrimaryLpIndex(), (void *)&wait_flag) == 0)) { printk(VIOCONS_KERN_INFO "opening console to primary partition\n"); while (atomic_read(&wait_flag) == 0) mb(); } /* Initialize the tty_driver structure */ viotty_driver = alloc_tty_driver(VTTY_PORTS); viotty_driver->owner = THIS_MODULE; viotty_driver->driver_name = "vioconsole"; viotty_driver->devfs_name = "vcs/"; viotty_driver->name = "tty"; viotty_driver->name_base = 1; viotty_driver->major = TTY_MAJOR; viotty_driver->minor_start = 1; viotty_driver->type = TTY_DRIVER_TYPE_CONSOLE; viotty_driver->subtype = 1; viotty_driver->init_termios = tty_std_termios; viotty_driver->flags = TTY_DRIVER_REAL_RAW | TTY_DRIVER_RESET_TERMIOS; tty_set_operations(viotty_driver, &serial_ops); if (tty_register_driver(viotty_driver)) { printk(VIOCONS_KERN_WARN "couldn't register console driver\n"); put_tty_driver(viotty_driver); viotty_driver = NULL; } viocons_init_cfu_buffer(); unregister_console(&viocons_early); register_console(&viocons); return 0; }
/* Pretty sick eh? */ int prom_callback(long *args) { struct console *cons, *saved_console = NULL; unsigned long flags; char *cmd; extern spinlock_t prom_entry_lock; if (!args) return -1; if (!(cmd = (char *)args[0])) return -1; /* * The callback can be invoked on the cpu that first dropped * into prom_cmdline after taking the serial interrupt, or on * a slave processor that was smp_captured() if the * administrator has done a switch-cpu inside obp. In either * case, the cpu is marked as in-interrupt. Drop IRQ locks. */ irq_exit(smp_processor_id(), 0); save_and_cli(flags); spin_unlock(&prom_entry_lock); cons = console_drivers; while (cons) { unregister_console(cons); cons->flags &= ~(CON_PRINTBUFFER); cons->next = saved_console; saved_console = cons; cons = console_drivers; } register_console(&prom_console); if (!strcmp(cmd, "sync")) { prom_printf("PROM `%s' command...\n", cmd); show_free_areas(); if(current->pid != 0) { sti(); sys_sync(); cli(); } args[2] = 0; args[args[1] + 3] = -1; prom_printf("Returning to PROM\n"); } else if (!strcmp(cmd, "va>tte-data")) { unsigned long ctx, va; unsigned long tte = 0; long res = PROM_FALSE; ctx = args[3]; va = args[4]; if (ctx) { /* * Find process owning ctx, lookup mapping. */ struct task_struct *p; struct mm_struct *mm = NULL; pgd_t *pgdp; pmd_t *pmdp; pte_t *ptep; for_each_task(p) { mm = p->mm; if (CTX_HWBITS(mm->context) == ctx) break; } if (!mm || CTX_HWBITS(mm->context) != ctx) goto done; pgdp = pgd_offset(mm, va); if (pgd_none(*pgdp)) goto done; pmdp = pmd_offset(pgdp, va); if (pmd_none(*pmdp)) goto done; ptep = pte_offset(pmdp, va); if (!pte_present(*ptep)) goto done; tte = pte_val(*ptep); res = PROM_TRUE; goto done; } if ((va >= KERNBASE) && (va < (KERNBASE + (4 * 1024 * 1024)))) { /* Spitfire Errata #32 workaround */ __asm__ __volatile__("stxa %0, [%1] %2\n\t" "flush %%g6" : /* No outputs */ : "r" (0), "r" (PRIMARY_CONTEXT), "i" (ASI_DMMU)); /* * Locked down tlb entry. */ if (tlb_type == spitfire) tte = spitfire_get_dtlb_data(SPITFIRE_HIGHEST_LOCKED_TLBENT); else if (tlb_type == cheetah) tte = cheetah_get_ldtlb_data(CHEETAH_HIGHEST_LOCKED_TLBENT); res = PROM_TRUE; goto done; }
static void gs_unregister_console_work_handler(struct work_struct *work) { struct gs_port *port = container_of(work, struct gs_port, work_unregister); unregister_console(&port->port_console); }