diff options
author | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-04-16 18:20:36 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-04-16 18:20:36 -0400 |
commit | 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 (patch) | |
tree | 0bba044c4ce775e45a88a51686b5d9f90697ea9d /arch/sparc/prom/misc.c |
Linux-2.6.12-rc2v2.6.12-rc2
Initial git repository build. I'm not bothering with the full history,
even though we have it. We can create a separate "historical" git
archive of that later if we want to, and in the meantime it's about
3.2GB when imported into git - space that would just make the early
git days unnecessarily complicated, when we don't have a lot of good
infrastructure for it.
Let it rip!
Diffstat (limited to 'arch/sparc/prom/misc.c')
-rw-r--r-- | arch/sparc/prom/misc.c | 139 |
1 files changed, 139 insertions, 0 deletions
diff --git a/arch/sparc/prom/misc.c b/arch/sparc/prom/misc.c new file mode 100644 index 000000000000..c840c2062342 --- /dev/null +++ b/arch/sparc/prom/misc.c | |||
@@ -0,0 +1,139 @@ | |||
1 | /* $Id: misc.c,v 1.18 2000/08/26 02:38:03 anton Exp $ | ||
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/config.h> | ||
9 | #include <linux/types.h> | ||
10 | #include <linux/kernel.h> | ||
11 | #include <linux/sched.h> | ||
12 | #include <asm/openprom.h> | ||
13 | #include <asm/oplib.h> | ||
14 | #include <asm/auxio.h> | ||
15 | #include <asm/system.h> | ||
16 | |||
17 | extern void restore_current(void); | ||
18 | |||
19 | DEFINE_SPINLOCK(prom_lock); | ||
20 | |||
21 | /* Reset and reboot the machine with the command 'bcommand'. */ | ||
22 | void | ||
23 | prom_reboot(char *bcommand) | ||
24 | { | ||
25 | unsigned long flags; | ||
26 | spin_lock_irqsave(&prom_lock, flags); | ||
27 | (*(romvec->pv_reboot))(bcommand); | ||
28 | /* Never get here. */ | ||
29 | restore_current(); | ||
30 | spin_unlock_irqrestore(&prom_lock, flags); | ||
31 | } | ||
32 | |||
33 | /* Forth evaluate the expression contained in 'fstring'. */ | ||
34 | void | ||
35 | prom_feval(char *fstring) | ||
36 | { | ||
37 | unsigned long flags; | ||
38 | if(!fstring || fstring[0] == 0) | ||
39 | return; | ||
40 | spin_lock_irqsave(&prom_lock, flags); | ||
41 | if(prom_vers == PROM_V0) | ||
42 | (*(romvec->pv_fortheval.v0_eval))(strlen(fstring), fstring); | ||
43 | else | ||
44 | (*(romvec->pv_fortheval.v2_eval))(fstring); | ||
45 | restore_current(); | ||
46 | spin_unlock_irqrestore(&prom_lock, flags); | ||
47 | } | ||
48 | |||
49 | /* We want to do this more nicely some day. */ | ||
50 | extern void (*prom_palette)(int); | ||
51 | |||
52 | /* Drop into the prom, with the chance to continue with the 'go' | ||
53 | * prom command. | ||
54 | */ | ||
55 | void | ||
56 | prom_cmdline(void) | ||
57 | { | ||
58 | extern void install_obp_ticker(void); | ||
59 | extern void install_linux_ticker(void); | ||
60 | unsigned long flags; | ||
61 | |||
62 | if(!serial_console && prom_palette) | ||
63 | prom_palette (1); | ||
64 | spin_lock_irqsave(&prom_lock, flags); | ||
65 | install_obp_ticker(); | ||
66 | (*(romvec->pv_abort))(); | ||
67 | restore_current(); | ||
68 | install_linux_ticker(); | ||
69 | spin_unlock_irqrestore(&prom_lock, flags); | ||
70 | #ifdef CONFIG_SUN_AUXIO | ||
71 | set_auxio(AUXIO_LED, 0); | ||
72 | #endif | ||
73 | if(!serial_console && prom_palette) | ||
74 | prom_palette (0); | ||
75 | } | ||
76 | |||
77 | /* Drop into the prom, but completely terminate the program. | ||
78 | * No chance of continuing. | ||
79 | */ | ||
80 | void | ||
81 | prom_halt(void) | ||
82 | { | ||
83 | unsigned long flags; | ||
84 | again: | ||
85 | spin_lock_irqsave(&prom_lock, flags); | ||
86 | (*(romvec->pv_halt))(); | ||
87 | /* Never get here. */ | ||
88 | restore_current(); | ||
89 | spin_unlock_irqrestore(&prom_lock, flags); | ||
90 | goto again; /* PROM is out to get me -DaveM */ | ||
91 | } | ||
92 | |||
93 | typedef void (*sfunc_t)(void); | ||
94 | |||
95 | /* Set prom sync handler to call function 'funcp'. */ | ||
96 | void | ||
97 | prom_setsync(sfunc_t funcp) | ||
98 | { | ||
99 | if(!funcp) return; | ||
100 | *romvec->pv_synchook = funcp; | ||
101 | } | ||
102 | |||
103 | /* Get the idprom and stuff it into buffer 'idbuf'. Returns the | ||
104 | * format type. 'num_bytes' is the number of bytes that your idbuf | ||
105 | * has space for. Returns 0xff on error. | ||
106 | */ | ||
107 | unsigned char | ||
108 | prom_get_idprom(char *idbuf, int num_bytes) | ||
109 | { | ||
110 | int len; | ||
111 | |||
112 | len = prom_getproplen(prom_root_node, "idprom"); | ||
113 | if((len>num_bytes) || (len==-1)) return 0xff; | ||
114 | if(!prom_getproperty(prom_root_node, "idprom", idbuf, num_bytes)) | ||
115 | return idbuf[0]; | ||
116 | |||
117 | return 0xff; | ||
118 | } | ||
119 | |||
120 | /* Get the major prom version number. */ | ||
121 | int | ||
122 | prom_version(void) | ||
123 | { | ||
124 | return romvec->pv_romvers; | ||
125 | } | ||
126 | |||
127 | /* Get the prom plugin-revision. */ | ||
128 | int | ||
129 | prom_getrev(void) | ||
130 | { | ||
131 | return prom_rev; | ||
132 | } | ||
133 | |||
134 | /* Get the prom firmware print revision. */ | ||
135 | int | ||
136 | prom_getprev(void) | ||
137 | { | ||
138 | return prom_prev; | ||
139 | } | ||