devops_64.c 1006 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. /*
  2. * devops.c: Device operations using the PROM.
  3. *
  4. * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
  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. /* Open the device described by the string 'dstr'. Returns the handle
  13. * to that device used for subsequent operations on that device.
  14. * Returns 0 on failure.
  15. */
  16. int
  17. prom_devopen(const char *dstr)
  18. {
  19. return p1275_cmd ("open", P1275_ARG(0,P1275_ARG_IN_STRING)|
  20. P1275_INOUT(1,1),
  21. dstr);
  22. }
  23. /* Close the device described by device handle 'dhandle'. */
  24. int
  25. prom_devclose(int dhandle)
  26. {
  27. p1275_cmd ("close", P1275_INOUT(1,0), dhandle);
  28. return 0;
  29. }
  30. /* Seek to specified location described by 'seekhi' and 'seeklo'
  31. * for device 'dhandle'.
  32. */
  33. void
  34. prom_seek(int dhandle, unsigned int seekhi, unsigned int seeklo)
  35. {
  36. p1275_cmd ("seek", P1275_INOUT(3,1), dhandle, seekhi, seeklo);
  37. }