Full support for Ginger Console
[linux-ginger.git] / arch / m68k / sun3 / prom / misc.c
blob3d60e1337f752bec5aa05e82aec8acd40800fba4
1 /*
2 * misc.c: Miscellaneous prom functions that don't belong
3 * anywhere else.
5 * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
6 */
8 #include <linux/types.h>
9 #include <linux/kernel.h>
10 #include <linux/sched.h>
11 #include <asm/sun3-head.h>
12 #include <asm/idprom.h>
13 #include <asm/openprom.h>
14 #include <asm/oplib.h>
15 #include <asm/movs.h>
17 /* Reset and reboot the machine with the command 'bcommand'. */
18 void
19 prom_reboot(char *bcommand)
21 unsigned long flags;
22 local_irq_save(flags);
23 (*(romvec->pv_reboot))(bcommand);
24 local_irq_restore(flags);
27 /* Drop into the prom, with the chance to continue with the 'go'
28 * prom command.
30 void
31 prom_cmdline(void)
35 /* Drop into the prom, but completely terminate the program.
36 * No chance of continuing.
38 void
39 prom_halt(void)
41 unsigned long flags;
42 again:
43 local_irq_save(flags);
44 (*(romvec->pv_halt))();
45 local_irq_restore(flags);
46 goto again; /* PROM is out to get me -DaveM */
49 typedef void (*sfunc_t)(void);
51 /* Get the idprom and stuff it into buffer 'idbuf'. Returns the
52 * format type. 'num_bytes' is the number of bytes that your idbuf
53 * has space for. Returns 0xff on error.
55 unsigned char
56 prom_get_idprom(char *idbuf, int num_bytes)
58 int i, oldsfc;
59 GET_SFC(oldsfc);
60 SET_SFC(FC_CONTROL);
61 for(i=0;i<num_bytes; i++)
63 /* There is a problem with the GET_CONTROL_BYTE
64 macro; defining the extra variable
65 gets around it.
67 int c;
68 GET_CONTROL_BYTE(SUN3_IDPROM_BASE + i, c);
69 idbuf[i] = c;
71 SET_SFC(oldsfc);
72 return idbuf[0];
75 /* Get the major prom version number. */
76 int
77 prom_version(void)
79 return romvec->pv_romvers;
82 /* Get the prom plugin-revision. */
83 int
84 prom_getrev(void)
86 return prom_rev;
89 /* Get the prom firmware print revision. */
90 int
91 prom_getprev(void)
93 return prom_prev;