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
5 * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
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>
17 extern void restore_current(void);
19 DEFINE_SPINLOCK(prom_lock);
21 /* Reset and reboot the machine with the command 'bcommand'. */
23 prom_reboot(char *bcommand)
26 spin_lock_irqsave(&prom_lock, flags);
27 (*(romvec->pv_reboot))(bcommand);
30 spin_unlock_irqrestore(&prom_lock, flags);
33 /* Forth evaluate the expression contained in 'fstring'. */
35 prom_feval(char *fstring)
38 if(!fstring || fstring[0] == 0)
40 spin_lock_irqsave(&prom_lock, flags);
41 if(prom_vers == PROM_V0)
42 (*(romvec->pv_fortheval.v0_eval))(strlen(fstring), fstring);
44 (*(romvec->pv_fortheval.v2_eval))(fstring);
46 spin_unlock_irqrestore(&prom_lock, flags);
49 /* We want to do this more nicely some day. */
50 extern void (*prom_palette)(int);
52 /* Drop into the prom, with the chance to continue with the 'go'
58 extern void install_obp_ticker(void);
59 extern void install_linux_ticker(void);
62 if(!serial_console && prom_palette)
64 spin_lock_irqsave(&prom_lock, flags);
66 (*(romvec->pv_abort))();
68 install_linux_ticker();
69 spin_unlock_irqrestore(&prom_lock, flags);
70 #ifdef CONFIG_SUN_AUXIO
71 set_auxio(AUXIO_LED, 0);
73 if(!serial_console && prom_palette)
77 /* Drop into the prom, but completely terminate the program.
78 * No chance of continuing.
85 spin_lock_irqsave(&prom_lock, flags);
86 (*(romvec->pv_halt))();
89 spin_unlock_irqrestore(&prom_lock, flags);
90 goto again; /* PROM is out to get me -DaveM */
93 typedef void (*sfunc_t)(void);
95 /* Set prom sync handler to call function 'funcp'. */
97 prom_setsync(sfunc_t funcp)
100 *romvec->pv_synchook = funcp;
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.
108 prom_get_idprom(char *idbuf, int num_bytes)
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))
120 /* Get the major prom version number. */
124 return romvec->pv_romvers;
127 /* Get the prom plugin-revision. */
134 /* Get the prom firmware print revision. */