console_64.c 1012 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. // SPDX-License-Identifier: GPL-2.0
  2. /* console.c: Routines that deal with sending and receiving IO
  3. * to/from the current console device using the PROM.
  4. *
  5. * Copyright (C) 1995 David S. Miller (davem@davemloft.net)
  6. * Copyright (C) 1996,1997 Jakub Jelinek (jj@sunsite.mff.cuni.cz)
  7. */
  8. #include <linux/types.h>
  9. #include <linux/kernel.h>
  10. #include <linux/sched.h>
  11. #include <asm/openprom.h>
  12. #include <asm/oplib.h>
  13. #include <linux/string.h>
  14. static int __prom_console_write_buf(const char *buf, int len)
  15. {
  16. unsigned long args[7];
  17. int ret;
  18. args[0] = (unsigned long) "write";
  19. args[1] = 3;
  20. args[2] = 1;
  21. args[3] = (unsigned int) prom_stdout;
  22. args[4] = (unsigned long) buf;
  23. args[5] = (unsigned int) len;
  24. args[6] = (unsigned long) -1;
  25. p1275_cmd_direct(args);
  26. ret = (int) args[6];
  27. if (ret < 0)
  28. return -1;
  29. return ret;
  30. }
  31. void prom_console_write_buf(const char *buf, int len)
  32. {
  33. while (len) {
  34. int n = __prom_console_write_buf(buf, len);
  35. if (n < 0)
  36. continue;
  37. len -= n;
  38. buf += len;
  39. }
  40. }