aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sparc/prom/misc_32.c
diff options
context:
space:
mode:
authorSam Ravnborg <sam@ravnborg.org>2008-11-30 01:15:38 -0500
committerDavid S. Miller <davem@davemloft.net>2008-12-04 12:17:16 -0500
commit708d4f09647106d549c646dc459c7ccf2c237cc8 (patch)
tree23657862535d88fcb71bc416c51c27cd480a93c4 /arch/sparc/prom/misc_32.c
parent5e53879008b9acefe9f43498fd36db7376e08739 (diff)
sparc: prepare prom/ for unification
- rename files where sparc64 uses identical names to *_32.c - refactor Makefile (but keep linking order) Signed-off-by: Sam Ravnborg <sam@ravnborg.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'arch/sparc/prom/misc_32.c')
-rw-r--r--arch/sparc/prom/misc_32.c131
1 files changed, 131 insertions, 0 deletions
diff --git a/arch/sparc/prom/misc_32.c b/arch/sparc/prom/misc_32.c
new file mode 100644
index 000000000000..49b5057b9601
--- /dev/null
+++ b/arch/sparc/prom/misc_32.c
@@ -0,0 +1,131 @@
1/*
2 * misc.c: Miscellaneous prom functions that don't belong
3 * anywhere else.
4 *
5 * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
6 */
7
8#include <linux/types.h>
9#include <linux/kernel.h>
10#include <linux/sched.h>
11#include <asm/openprom.h>
12#include <asm/oplib.h>
13#include <asm/auxio.h>
14#include <asm/system.h>
15
16extern void restore_current(void);
17
18DEFINE_SPINLOCK(prom_lock);
19
20/* Reset and reboot the machine with the command 'bcommand'. */
21void
22prom_reboot(char *bcommand)
23{
24 unsigned long flags;
25 spin_lock_irqsave(&prom_lock, flags);
26 (*(romvec->pv_reboot))(bcommand);
27 /* Never get here. */
28 restore_current();
29 spin_unlock_irqrestore(&prom_lock, flags);
30}
31
32/* Forth evaluate the expression contained in 'fstring'. */
33void
34prom_feval(char *fstring)
35{
36 unsigned long flags;
37 if(!fstring || fstring[0] == 0)
38 return;
39 spin_lock_irqsave(&prom_lock, flags);
40 if(prom_vers == PROM_V0)
41 (*(romvec->pv_fortheval.v0_eval))(strlen(fstring), fstring);
42 else
43 (*(romvec->pv_fortheval.v2_eval))(fstring);
44 restore_current();
45 spin_unlock_irqrestore(&prom_lock, flags);
46}
47
48/* Drop into the prom, with the chance to continue with the 'go'
49 * prom command.
50 */
51void
52prom_cmdline(void)
53{
54 extern void install_obp_ticker(void);
55 extern void install_linux_ticker(void);
56 unsigned long flags;
57
58 spin_lock_irqsave(&prom_lock, flags);
59 install_obp_ticker();
60 (*(romvec->pv_abort))();
61 restore_current();
62 install_linux_ticker();
63 spin_unlock_irqrestore(&prom_lock, flags);
64#ifdef CONFIG_SUN_AUXIO
65 set_auxio(AUXIO_LED, 0);
66#endif
67}
68
69/* Drop into the prom, but completely terminate the program.
70 * No chance of continuing.
71 */
72void
73prom_halt(void)
74{
75 unsigned long flags;
76again:
77 spin_lock_irqsave(&prom_lock, flags);
78 (*(romvec->pv_halt))();
79 /* Never get here. */
80 restore_current();
81 spin_unlock_irqrestore(&prom_lock, flags);
82 goto again; /* PROM is out to get me -DaveM */
83}
84
85typedef void (*sfunc_t)(void);
86
87/* Set prom sync handler to call function 'funcp'. */
88void
89prom_setsync(sfunc_t funcp)
90{
91 if(!funcp) return;
92 *romvec->pv_synchook = funcp;
93}
94
95/* Get the idprom and stuff it into buffer 'idbuf'. Returns the
96 * format type. 'num_bytes' is the number of bytes that your idbuf
97 * has space for. Returns 0xff on error.
98 */
99unsigned char
100prom_get_idprom(char *idbuf, int num_bytes)
101{
102 int len;
103
104 len = prom_getproplen(prom_root_node, "idprom");
105 if((len>num_bytes) || (len==-1)) return 0xff;
106 if(!prom_getproperty(prom_root_node, "idprom", idbuf, num_bytes))
107 return idbuf[0];
108
109 return 0xff;
110}
111
112/* Get the major prom version number. */
113int
114prom_version(void)
115{
116 return romvec->pv_romvers;
117}
118
119/* Get the prom plugin-revision. */
120int
121prom_getrev(void)
122{
123 return prom_rev;
124}
125
126/* Get the prom firmware print revision. */
127int
128prom_getprev(void)
129{
130 return prom_prev;
131}