console.c 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. /*
  2. * arch/mips/dec/prom/console.c
  3. *
  4. * DECstation PROM-based early console support.
  5. *
  6. * Copyright (C) 2004 Maciej W. Rozycki
  7. *
  8. * This program is free software; you can redistribute it and/or
  9. * modify it under the terms of the GNU General Public License
  10. * as published by the Free Software Foundation; either version
  11. * 2 of the License, or (at your option) any later version.
  12. */
  13. #include <linux/console.h>
  14. #include <linux/init.h>
  15. #include <linux/kernel.h>
  16. #include <asm/dec/prom.h>
  17. static void __init prom_console_write(struct console *con, const char *s,
  18. unsigned int c)
  19. {
  20. static char sfmt[] __initdata = "%%%us";
  21. char fmt[13];
  22. snprintf(fmt, sizeof(fmt), sfmt, c);
  23. prom_printf(fmt, s);
  24. }
  25. static struct console promcons __initdata = {
  26. .name = "prom",
  27. .write = prom_console_write,
  28. .flags = CON_PRINTBUFFER,
  29. .index = -1,
  30. };
  31. static int promcons_output __initdata = 0;
  32. void __init register_prom_console(void)
  33. {
  34. if (!promcons_output) {
  35. promcons_output = 1;
  36. register_console(&promcons);
  37. }
  38. }
  39. void __init unregister_prom_console(void)
  40. {
  41. if (promcons_output) {
  42. unregister_console(&promcons);
  43. promcons_output = 0;
  44. }
  45. }
  46. void disable_early_printk(void)
  47. __attribute__((alias("unregister_prom_console")));