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/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>
16 extern void restore_current(void);
18 DEFINE_SPINLOCK(prom_lock
);
20 /* Reset and reboot the machine with the command 'bcommand'. */
22 prom_reboot(char *bcommand
)
25 spin_lock_irqsave(&prom_lock
, flags
);
26 (*(romvec
->pv_reboot
))(bcommand
);
29 spin_unlock_irqrestore(&prom_lock
, flags
);
32 /* Forth evaluate the expression contained in 'fstring'. */
34 prom_feval(char *fstring
)
37 if(!fstring
|| fstring
[0] == 0)
39 spin_lock_irqsave(&prom_lock
, flags
);
40 if(prom_vers
== PROM_V0
)
41 (*(romvec
->pv_fortheval
.v0_eval
))(strlen(fstring
), fstring
);
43 (*(romvec
->pv_fortheval
.v2_eval
))(fstring
);
45 spin_unlock_irqrestore(&prom_lock
, flags
);
48 <<<<<<< HEAD
:arch
/sparc
/prom
/misc
.c
49 /* We want to do this more nicely some day. */
50 extern void (*prom_palette
)(int);
53 >>>>>>> 264e3e889d86e552b4191d69bb60f4f3b383135a
:arch
/sparc
/prom
/misc
.c
54 /* Drop into the prom, with the chance to continue with the 'go'
60 extern void install_obp_ticker(void);
61 extern void install_linux_ticker(void);
64 <<<<<<< HEAD
:arch
/sparc
/prom
/misc
.c
68 >>>>>>> 264e3e889d86e552b4191d69bb60f4f3b383135a
:arch
/sparc
/prom
/misc
.c
69 spin_lock_irqsave(&prom_lock
, flags
);
71 (*(romvec
->pv_abort
))();
73 install_linux_ticker();
74 spin_unlock_irqrestore(&prom_lock
, flags
);
75 #ifdef CONFIG_SUN_AUXIO
76 set_auxio(AUXIO_LED
, 0);
78 <<<<<<< HEAD
:arch
/sparc
/prom
/misc
.c
82 >>>>>>> 264e3e889d86e552b4191d69bb60f4f3b383135a
:arch
/sparc
/prom
/misc
.c
85 /* Drop into the prom, but completely terminate the program.
86 * No chance of continuing.
93 spin_lock_irqsave(&prom_lock
, flags
);
94 (*(romvec
->pv_halt
))();
97 spin_unlock_irqrestore(&prom_lock
, flags
);
98 goto again
; /* PROM is out to get me -DaveM */
101 typedef void (*sfunc_t
)(void);
103 /* Set prom sync handler to call function 'funcp'. */
105 prom_setsync(sfunc_t funcp
)
108 *romvec
->pv_synchook
= funcp
;
111 /* Get the idprom and stuff it into buffer 'idbuf'. Returns the
112 * format type. 'num_bytes' is the number of bytes that your idbuf
113 * has space for. Returns 0xff on error.
116 prom_get_idprom(char *idbuf
, int num_bytes
)
120 len
= prom_getproplen(prom_root_node
, "idprom");
121 if((len
>num_bytes
) || (len
==-1)) return 0xff;
122 if(!prom_getproperty(prom_root_node
, "idprom", idbuf
, num_bytes
))
128 /* Get the major prom version number. */
132 return romvec
->pv_romvers
;
135 /* Get the prom plugin-revision. */
142 /* Get the prom firmware print revision. */