console_64.c 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  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 <asm/system.h>
  13. #include <linux/string.h>
  14. extern int prom_stdin, prom_stdout;
  15. static int __prom_console_write_buf(const char *buf, int len)
  16. {
  17. unsigned long args[7];
  18. int ret;
  19. args[0] = (unsigned long) "write";
  20. args[1] = 3;
  21. args[2] = 1;
  22. args[3] = (unsigned int) prom_stdout;
  23. args[4] = (unsigned long) buf;
  24. args[5] = (unsigned int) len;
  25. args[6] = (unsigned long) -1;
  26. p1275_cmd_direct(args);
  27. ret = (int) args[6];
  28. if (ret < 0)
  29. return -1;
  30. return ret;
  31. }
  32. void prom_console_write_buf(const char *buf, int len)
  33. {
  34. while (len) {
  35. int n = __prom_console_write_buf(buf, len);
  36. if (n < 0)
  37. continue;
  38. len -= n;
  39. buf += len;
  40. }
  41. }