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>
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);
48 EXPORT_SYMBOL(prom_feval);
50 /* Drop into the prom, with the chance to continue with the 'go'
58 spin_lock_irqsave(&prom_lock, flags);
59 (*(romvec->pv_abort))();
61 spin_unlock_irqrestore(&prom_lock, flags);
62 set_auxio(AUXIO_LED, 0);
65 /* Drop into the prom, but completely terminate the program.
66 * No chance of continuing.
73 spin_lock_irqsave(&prom_lock, flags);
74 (*(romvec->pv_halt))();
77 spin_unlock_irqrestore(&prom_lock, flags);
78 goto again; /* PROM is out to get me -DaveM */
81 typedef void (*sfunc_t)(void);
83 /* Set prom sync handler to call function 'funcp'. */
85 prom_setsync(sfunc_t funcp)
88 *romvec->pv_synchook = funcp;
91 /* Get the idprom and stuff it into buffer 'idbuf'. Returns the
92 * format type. 'num_bytes' is the number of bytes that your idbuf
93 * has space for. Returns 0xff on error.
96 prom_get_idprom(char *idbuf, int num_bytes)
100 len = prom_getproplen(prom_root_node, "idprom");
101 if((len>num_bytes) || (len==-1)) return 0xff;
102 if(!prom_getproperty(prom_root_node, "idprom", idbuf, num_bytes))
108 /* Get the major prom version number. */
112 return romvec->pv_romvers;
115 /* Get the prom plugin-revision. */
122 /* Get the prom firmware print revision. */