serial.c 863 B

12345678910111213141516171819202122232425262728293031323334353637383940
  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) 2013 Cavium, Inc.
  7. */
  8. #include <linux/kernel.h>
  9. #include <linux/virtio_console.h>
  10. #include <linux/kvm_para.h>
  11. #include <asm/setup.h>
  12. /*
  13. * Emit one character to the boot console.
  14. */
  15. void prom_putchar(char c)
  16. {
  17. kvm_hypercall3(KVM_HC_MIPS_CONSOLE_OUTPUT, 0 /* port 0 */,
  18. (unsigned long)&c, 1 /* len == 1 */);
  19. }
  20. #ifdef CONFIG_VIRTIO_CONSOLE
  21. static int paravirt_put_chars(u32 vtermno, const char *buf, int count)
  22. {
  23. kvm_hypercall3(KVM_HC_MIPS_CONSOLE_OUTPUT, vtermno,
  24. (unsigned long)buf, count);
  25. return count;
  26. }
  27. static int __init paravirt_cons_init(void)
  28. {
  29. virtio_cons_early_init(paravirt_put_chars);
  30. return 0;
  31. }
  32. core_initcall(paravirt_cons_init);
  33. #endif