2 * devops.c: Device operations using the PROM.
4 * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
5 * Copyright (C) 1996,1997 Jakub Jelinek (jj@sunsite.mff.cuni.cz)
7 #include <linux/types.h>
8 #include <linux/kernel.h>
9 #include <linux/sched.h>
11 #include <asm/openprom.h>
12 #include <asm/oplib.h>
14 /* Open the device described by the string 'dstr'. Returns the handle
15 * to that device used for subsequent operations on that device.
16 * Returns 0 on failure.
19 prom_devopen(const char *dstr
)
21 unsigned long args
[5];
23 args
[0] = (unsigned long) "open";
26 args
[3] = (unsigned long) dstr
;
27 args
[4] = (unsigned long) -1;
29 p1275_cmd_direct(args
);
34 /* Close the device described by device handle 'dhandle'. */
36 prom_devclose(int dhandle
)
38 unsigned long args
[4];
40 args
[0] = (unsigned long) "close";
43 args
[3] = (unsigned int) dhandle
;
45 p1275_cmd_direct(args
);
50 /* Seek to specified location described by 'seekhi' and 'seeklo'
51 * for device 'dhandle'.
54 prom_seek(int dhandle
, unsigned int seekhi
, unsigned int seeklo
)
56 unsigned long args
[7];
58 args
[0] = (unsigned long) "seek";
61 args
[3] = (unsigned int) dhandle
;
64 args
[6] = (unsigned long) -1;
66 p1275_cmd_direct(args
);