ip27-console.c
上传用户:jlfgdled
上传日期:2013-04-10
资源大小:33168k
文件大小:1k
源码类别:

Linux/Unix编程

开发平台:

Unix_Linux

  1. /*
  2.  * This file is subject to the terms and conditions of the GNU General Public
  3.  * License.  See the file "COPYING" in the main directory of this archive
  4.  * for more details.
  5.  *
  6.  * Copyright (C) 2001 Ralf Baechle
  7.  */
  8. #include <linux/init.h>
  9. #include <linux/console.h>
  10. #include <linux/kdev_t.h>
  11. #include <linux/major.h>
  12. #include <asm/sn/addrs.h>
  13. #include <asm/sn/sn0/hub.h>
  14. #include <asm/sn/klconfig.h>
  15. #include <asm/sn/ioc3.h>
  16. #include <asm/sn/sn_private.h>
  17. void prom_putchar(char c)
  18. {
  19. struct ioc3 *ioc3;
  20. struct ioc3_uartregs *uart;
  21. ioc3 = (struct ioc3 *)KL_CONFIG_CH_CONS_INFO(master_nasid)->memory_base;
  22. uart = &ioc3->sregs.uarta;
  23. while ((uart->iu_lsr & 0x20) == 0);
  24. uart->iu_thr = c;
  25. }
  26. char __init prom_getchar(void)
  27. {
  28. return 0;
  29. }
  30. static void
  31. ip27prom_console_write(struct console *con, const char *s, unsigned n)
  32. {
  33. prom_printf("%s", s);
  34. }
  35. static kdev_t
  36. ip27prom_console_dev(struct console *c)
  37. {
  38. return MKDEV(TTY_MAJOR, 64 + c->index);
  39. }
  40. static struct console ip27_prom_console = {
  41.     name: "prom",
  42.     write: ip27prom_console_write,
  43.     device: ip27prom_console_dev,
  44.     flags: CON_PRINTBUFFER,
  45.     index: -1,
  46. };
  47. __init void ip27_setup_console(void)
  48. {
  49. register_console(&ip27_prom_console);
  50. }