ia64/linux-2.6.18-xen.hg

view arch/sparc/prom/misc.c @ 912:dd42cdb0ab89

[IA64] Build blktap2 driver by default in x86 builds.

add CONFIG_XEN_BLKDEV_TAP2=y to buildconfigs/linux-defconfig_xen_ia64.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
author Isaku Yamahata <yamahata@valinux.co.jp>
date Mon Jun 29 12:09:16 2009 +0900 (2009-06-29)
parents 831230e53067
children
line source
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 */
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'. */
21 void
22 prom_reboot(char *bcommand)
23 {
24 unsigned long flags;
25 spin_lock_irqsave(&prom_lock, flags);
26 (*(romvec->pv_reboot))(bcommand);
27 /* Never get here. */
28 restore_current();
29 spin_unlock_irqrestore(&prom_lock, flags);
30 }
32 /* Forth evaluate the expression contained in 'fstring'. */
33 void
34 prom_feval(char *fstring)
35 {
36 unsigned long flags;
37 if(!fstring || fstring[0] == 0)
38 return;
39 spin_lock_irqsave(&prom_lock, flags);
40 if(prom_vers == PROM_V0)
41 (*(romvec->pv_fortheval.v0_eval))(strlen(fstring), fstring);
42 else
43 (*(romvec->pv_fortheval.v2_eval))(fstring);
44 restore_current();
45 spin_unlock_irqrestore(&prom_lock, flags);
46 }
48 /* We want to do this more nicely some day. */
49 extern void (*prom_palette)(int);
51 /* Drop into the prom, with the chance to continue with the 'go'
52 * prom command.
53 */
54 void
55 prom_cmdline(void)
56 {
57 extern void install_obp_ticker(void);
58 extern void install_linux_ticker(void);
59 unsigned long flags;
61 if(!serial_console && prom_palette)
62 prom_palette (1);
63 spin_lock_irqsave(&prom_lock, flags);
64 install_obp_ticker();
65 (*(romvec->pv_abort))();
66 restore_current();
67 install_linux_ticker();
68 spin_unlock_irqrestore(&prom_lock, flags);
69 #ifdef CONFIG_SUN_AUXIO
70 set_auxio(AUXIO_LED, 0);
71 #endif
72 if(!serial_console && prom_palette)
73 prom_palette (0);
74 }
76 /* Drop into the prom, but completely terminate the program.
77 * No chance of continuing.
78 */
79 void
80 prom_halt(void)
81 {
82 unsigned long flags;
83 again:
84 spin_lock_irqsave(&prom_lock, flags);
85 (*(romvec->pv_halt))();
86 /* Never get here. */
87 restore_current();
88 spin_unlock_irqrestore(&prom_lock, flags);
89 goto again; /* PROM is out to get me -DaveM */
90 }
92 typedef void (*sfunc_t)(void);
94 /* Set prom sync handler to call function 'funcp'. */
95 void
96 prom_setsync(sfunc_t funcp)
97 {
98 if(!funcp) return;
99 *romvec->pv_synchook = funcp;
100 }
102 /* Get the idprom and stuff it into buffer 'idbuf'. Returns the
103 * format type. 'num_bytes' is the number of bytes that your idbuf
104 * has space for. Returns 0xff on error.
105 */
106 unsigned char
107 prom_get_idprom(char *idbuf, int num_bytes)
108 {
109 int len;
111 len = prom_getproplen(prom_root_node, "idprom");
112 if((len>num_bytes) || (len==-1)) return 0xff;
113 if(!prom_getproperty(prom_root_node, "idprom", idbuf, num_bytes))
114 return idbuf[0];
116 return 0xff;
117 }
119 /* Get the major prom version number. */
120 int
121 prom_version(void)
122 {
123 return romvec->pv_romvers;
124 }
126 /* Get the prom plugin-revision. */
127 int
128 prom_getrev(void)
129 {
130 return prom_rev;
131 }
133 /* Get the prom firmware print revision. */
134 int
135 prom_getprev(void)
136 {
137 return prom_prev;
138 }