2 * misc.c: Miscellaneous prom functions that don't belong
5 * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
8 #include <linux/types.h>
9 #include <linux/kernel.h>
10 #include <linux/sched.h>
11 #include <linux/module.h>
13 #include <asm/openprom.h>
14 #include <asm/oplib.h>
15 #include <asm/auxio.h>
16 #include <asm/system.h>
18 extern void restore_current(void);
20 DEFINE_SPINLOCK(prom_lock);
22 /* Reset and reboot the machine with the command 'bcommand'. */
24 prom_reboot(char *bcommand)
27 spin_lock_irqsave(&prom_lock, flags);
28 (*(romvec->pv_reboot))(bcommand);
31 spin_unlock_irqrestore(&prom_lock, flags);
34 /* Forth evaluate the expression contained in 'fstring'. */
36 prom_feval(char *fstring)
39 if(!fstring || fstring[0] == 0)
41 spin_lock_irqsave(&prom_lock, flags);
42 if(prom_vers == PROM_V0)
43 (*(romvec->pv_fortheval.v0_eval))(strlen(fstring), fstring);
45 (*(romvec->pv_fortheval.v2_eval))(fstring);
47 spin_unlock_irqrestore(&prom_lock, flags);
49 EXPORT_SYMBOL(prom_feval);
51 /* Drop into the prom, with the chance to continue with the 'go'
57 extern void install_obp_ticker(void);
58 extern void install_linux_ticker(void);
61 spin_lock_irqsave(&prom_lock, flags);
63 (*(romvec->pv_abort))();
65 install_linux_ticker();
66 spin_unlock_irqrestore(&prom_lock, flags);
67 set_auxio(AUXIO_LED, 0);
70 /* Drop into the prom, but completely terminate the program.
71 * No chance of continuing.
78 spin_lock_irqsave(&prom_lock, flags);
79 (*(romvec->pv_halt))();
82 spin_unlock_irqrestore(&prom_lock, flags);
83 goto again; /* PROM is out to get me -DaveM */
86 typedef void (*sfunc_t)(void);
88 /* Set prom sync handler to call function 'funcp'. */
90 prom_setsync(sfunc_t funcp)
93 *romvec->pv_synchook = funcp;
96 /* Get the idprom and stuff it into buffer 'idbuf'. Returns the
97 * format type. 'num_bytes' is the number of bytes that your idbuf
98 * has space for. Returns 0xff on error.
101 prom_get_idprom(char *idbuf, int num_bytes)
105 len = prom_getproplen(prom_root_node, "idprom");
106 if((len>num_bytes) || (len==-1)) return 0xff;
107 if(!prom_getproperty(prom_root_node, "idprom", idbuf, num_bytes))
113 /* Get the major prom version number. */
117 return romvec->pv_romvers;
120 /* Get the prom plugin-revision. */
127 /* Get the prom firmware print revision. */