console_64.c 976 B

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