aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sparc
diff options
context:
space:
mode:
authorDavid Woodhouse <David.Woodhouse@intel.com>2010-10-30 07:35:11 -0400
committerDavid Woodhouse <David.Woodhouse@intel.com>2010-10-30 07:35:11 -0400
commit67577927e8d7a1f4b09b4992df640eadc6aacb36 (patch)
tree2e9efe6b5745965faf0dcc084d4613d9356263f9 /arch/sparc
parent6fe4c590313133ebd5dadb769031489ff178ece1 (diff)
parent51f00a471ce8f359627dd99aeac322947a0e491b (diff)
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git
Conflicts: drivers/mtd/mtd_blkdevs.c Merge Grant's device-tree bits so that we can apply the subsequent fixes. Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
Diffstat (limited to 'arch/sparc')
-rw-r--r--arch/sparc/Kconfig4
-rw-r--r--arch/sparc/include/asm/Kbuild1
-rw-r--r--arch/sparc/include/asm/floppy_32.h3
-rw-r--r--arch/sparc/include/asm/irqflags_32.h35
-rw-r--r--arch/sparc/include/asm/irqflags_64.h29
-rw-r--r--arch/sparc/include/asm/jump_label.h32
-rw-r--r--arch/sparc/include/asm/memblock.h2
-rw-r--r--arch/sparc/include/asm/openprom.h16
-rw-r--r--arch/sparc/include/asm/oplib_32.h44
-rw-r--r--arch/sparc/include/asm/oplib_64.h39
-rw-r--r--arch/sparc/include/asm/perf_event.h4
-rw-r--r--arch/sparc/include/asm/prom.h5
-rw-r--r--arch/sparc/kernel/Makefile2
-rw-r--r--arch/sparc/kernel/apc.c1
-rw-r--r--arch/sparc/kernel/auxio_32.c4
-rw-r--r--arch/sparc/kernel/btext.c4
-rw-r--r--arch/sparc/kernel/devices.c23
-rw-r--r--arch/sparc/kernel/irq_32.c13
-rw-r--r--arch/sparc/kernel/jump_label.c47
-rw-r--r--arch/sparc/kernel/leon_kernel.c2
-rw-r--r--arch/sparc/kernel/mdesc.c1
-rw-r--r--arch/sparc/kernel/module.c6
-rw-r--r--arch/sparc/kernel/pci_msi.c8
-rw-r--r--arch/sparc/kernel/pcic.c4
-rw-r--r--arch/sparc/kernel/pcr.c8
-rw-r--r--arch/sparc/kernel/perf_event.c240
-rw-r--r--arch/sparc/kernel/prom.h6
-rw-r--r--arch/sparc/kernel/prom_common.c202
-rw-r--r--arch/sparc/kernel/setup_64.c2
-rw-r--r--arch/sparc/kernel/starfire.c2
-rw-r--r--arch/sparc/kernel/tadpole.c2
-rw-r--r--arch/sparc/mm/init_64.c48
-rw-r--r--arch/sparc/mm/srmmu.c8
-rw-r--r--arch/sparc/mm/sun4c.c2
-rw-r--r--arch/sparc/prom/init_32.c2
-rw-r--r--arch/sparc/prom/init_64.c4
-rw-r--r--arch/sparc/prom/memory.c3
-rw-r--r--arch/sparc/prom/misc_64.c6
-rw-r--r--arch/sparc/prom/p1275.c2
-rw-r--r--arch/sparc/prom/ranges.c6
-rw-r--r--arch/sparc/prom/tree_32.c58
-rw-r--r--arch/sparc/prom/tree_64.c62
42 files changed, 465 insertions, 527 deletions
diff --git a/arch/sparc/Kconfig b/arch/sparc/Kconfig
index 491e9d6de191..8e7bafc5dd0e 100644
--- a/arch/sparc/Kconfig
+++ b/arch/sparc/Kconfig
@@ -19,6 +19,7 @@ config SPARC
19 bool 19 bool
20 default y 20 default y
21 select OF 21 select OF
22 select OF_PROMTREE
22 select HAVE_IDE 23 select HAVE_IDE
23 select HAVE_OPROFILE 24 select HAVE_OPROFILE
24 select HAVE_ARCH_KGDB if !SMP || SPARC64 25 select HAVE_ARCH_KGDB if !SMP || SPARC64
@@ -26,10 +27,12 @@ config SPARC
26 select ARCH_WANT_OPTIONAL_GPIOLIB 27 select ARCH_WANT_OPTIONAL_GPIOLIB
27 select RTC_CLASS 28 select RTC_CLASS
28 select RTC_DRV_M48T59 29 select RTC_DRV_M48T59
30 select HAVE_IRQ_WORK
29 select HAVE_PERF_EVENTS 31 select HAVE_PERF_EVENTS
30 select PERF_USE_VMALLOC 32 select PERF_USE_VMALLOC
31 select HAVE_DMA_ATTRS 33 select HAVE_DMA_ATTRS
32 select HAVE_DMA_API_DEBUG 34 select HAVE_DMA_API_DEBUG
35 select HAVE_ARCH_JUMP_LABEL
33 36
34config SPARC32 37config SPARC32
35 def_bool !64BIT 38 def_bool !64BIT
@@ -53,6 +56,7 @@ config SPARC64
53 select RTC_DRV_BQ4802 56 select RTC_DRV_BQ4802
54 select RTC_DRV_SUN4V 57 select RTC_DRV_SUN4V
55 select RTC_DRV_STARFIRE 58 select RTC_DRV_STARFIRE
59 select HAVE_IRQ_WORK
56 select HAVE_PERF_EVENTS 60 select HAVE_PERF_EVENTS
57 select PERF_USE_VMALLOC 61 select PERF_USE_VMALLOC
58 62
diff --git a/arch/sparc/include/asm/Kbuild b/arch/sparc/include/asm/Kbuild
index deeb0fba8029..3c93f08ce187 100644
--- a/arch/sparc/include/asm/Kbuild
+++ b/arch/sparc/include/asm/Kbuild
@@ -7,7 +7,6 @@ header-y += display7seg.h
7header-y += envctrl.h 7header-y += envctrl.h
8header-y += fbio.h 8header-y += fbio.h
9header-y += jsflash.h 9header-y += jsflash.h
10header-y += openprom.h
11header-y += openpromio.h 10header-y += openpromio.h
12header-y += perfctr.h 11header-y += perfctr.h
13header-y += psrcompat.h 12header-y += psrcompat.h
diff --git a/arch/sparc/include/asm/floppy_32.h b/arch/sparc/include/asm/floppy_32.h
index c792830636de..86666f70322e 100644
--- a/arch/sparc/include/asm/floppy_32.h
+++ b/arch/sparc/include/asm/floppy_32.h
@@ -304,7 +304,8 @@ static struct linux_prom_registers fd_regs[2];
304static int sun_floppy_init(void) 304static int sun_floppy_init(void)
305{ 305{
306 char state[128]; 306 char state[128];
307 int tnode, fd_node, num_regs; 307 phandle tnode, fd_node;
308 int num_regs;
308 struct resource r; 309 struct resource r;
309 310
310 use_virtual_dma = 1; 311 use_virtual_dma = 1;
diff --git a/arch/sparc/include/asm/irqflags_32.h b/arch/sparc/include/asm/irqflags_32.h
index 0fca9d97d44f..d4d0711de0f9 100644
--- a/arch/sparc/include/asm/irqflags_32.h
+++ b/arch/sparc/include/asm/irqflags_32.h
@@ -5,33 +5,40 @@
5 * 5 *
6 * This file gets included from lowlevel asm headers too, to provide 6 * This file gets included from lowlevel asm headers too, to provide
7 * wrapped versions of the local_irq_*() APIs, based on the 7 * wrapped versions of the local_irq_*() APIs, based on the
8 * raw_local_irq_*() functions from the lowlevel headers. 8 * arch_local_irq_*() functions from the lowlevel headers.
9 */ 9 */
10#ifndef _ASM_IRQFLAGS_H 10#ifndef _ASM_IRQFLAGS_H
11#define _ASM_IRQFLAGS_H 11#define _ASM_IRQFLAGS_H
12 12
13#ifndef __ASSEMBLY__ 13#ifndef __ASSEMBLY__
14 14
15extern void raw_local_irq_restore(unsigned long); 15#include <linux/types.h>
16extern unsigned long __raw_local_irq_save(void);
17extern void raw_local_irq_enable(void);
18 16
19static inline unsigned long getipl(void) 17extern void arch_local_irq_restore(unsigned long);
18extern unsigned long arch_local_irq_save(void);
19extern void arch_local_irq_enable(void);
20
21static inline unsigned long arch_local_save_flags(void)
20{ 22{
21 unsigned long retval; 23 unsigned long flags;
24
25 asm volatile("rd %%psr, %0" : "=r" (flags));
26 return flags;
27}
22 28
23 __asm__ __volatile__("rd %%psr, %0" : "=r" (retval)); 29static inline void arch_local_irq_disable(void)
24 return retval; 30{
31 arch_local_irq_save();
25} 32}
26 33
27#define raw_local_save_flags(flags) ((flags) = getipl()) 34static inline bool arch_irqs_disabled_flags(unsigned long flags)
28#define raw_local_irq_save(flags) ((flags) = __raw_local_irq_save()) 35{
29#define raw_local_irq_disable() ((void) __raw_local_irq_save()) 36 return (flags & PSR_PIL) != 0;
30#define raw_irqs_disabled() ((getipl() & PSR_PIL) != 0) 37}
31 38
32static inline int raw_irqs_disabled_flags(unsigned long flags) 39static inline bool arch_irqs_disabled(void)
33{ 40{
34 return ((flags & PSR_PIL) != 0); 41 return arch_irqs_disabled_flags(arch_local_save_flags());
35} 42}
36 43
37#endif /* (__ASSEMBLY__) */ 44#endif /* (__ASSEMBLY__) */
diff --git a/arch/sparc/include/asm/irqflags_64.h b/arch/sparc/include/asm/irqflags_64.h
index bfa1ea45b4cd..aab969c82c2b 100644
--- a/arch/sparc/include/asm/irqflags_64.h
+++ b/arch/sparc/include/asm/irqflags_64.h
@@ -5,7 +5,7 @@
5 * 5 *
6 * This file gets included from lowlevel asm headers too, to provide 6 * This file gets included from lowlevel asm headers too, to provide
7 * wrapped versions of the local_irq_*() APIs, based on the 7 * wrapped versions of the local_irq_*() APIs, based on the
8 * raw_local_irq_*() functions from the lowlevel headers. 8 * arch_local_irq_*() functions from the lowlevel headers.
9 */ 9 */
10#ifndef _ASM_IRQFLAGS_H 10#ifndef _ASM_IRQFLAGS_H
11#define _ASM_IRQFLAGS_H 11#define _ASM_IRQFLAGS_H
@@ -14,7 +14,7 @@
14 14
15#ifndef __ASSEMBLY__ 15#ifndef __ASSEMBLY__
16 16
17static inline unsigned long __raw_local_save_flags(void) 17static inline unsigned long arch_local_save_flags(void)
18{ 18{
19 unsigned long flags; 19 unsigned long flags;
20 20
@@ -26,10 +26,7 @@ static inline unsigned long __raw_local_save_flags(void)
26 return flags; 26 return flags;
27} 27}
28 28
29#define raw_local_save_flags(flags) \ 29static inline void arch_local_irq_restore(unsigned long flags)
30 do { (flags) = __raw_local_save_flags(); } while (0)
31
32static inline void raw_local_irq_restore(unsigned long flags)
33{ 30{
34 __asm__ __volatile__( 31 __asm__ __volatile__(
35 "wrpr %0, %%pil" 32 "wrpr %0, %%pil"
@@ -39,7 +36,7 @@ static inline void raw_local_irq_restore(unsigned long flags)
39 ); 36 );
40} 37}
41 38
42static inline void raw_local_irq_disable(void) 39static inline void arch_local_irq_disable(void)
43{ 40{
44 __asm__ __volatile__( 41 __asm__ __volatile__(
45 "wrpr %0, %%pil" 42 "wrpr %0, %%pil"
@@ -49,7 +46,7 @@ static inline void raw_local_irq_disable(void)
49 ); 46 );
50} 47}
51 48
52static inline void raw_local_irq_enable(void) 49static inline void arch_local_irq_enable(void)
53{ 50{
54 __asm__ __volatile__( 51 __asm__ __volatile__(
55 "wrpr 0, %%pil" 52 "wrpr 0, %%pil"
@@ -59,22 +56,17 @@ static inline void raw_local_irq_enable(void)
59 ); 56 );
60} 57}
61 58
62static inline int raw_irqs_disabled_flags(unsigned long flags) 59static inline int arch_irqs_disabled_flags(unsigned long flags)
63{ 60{
64 return (flags > 0); 61 return (flags > 0);
65} 62}
66 63
67static inline int raw_irqs_disabled(void) 64static inline int arch_irqs_disabled(void)
68{ 65{
69 unsigned long flags = __raw_local_save_flags(); 66 return arch_irqs_disabled_flags(arch_local_save_flags());
70
71 return raw_irqs_disabled_flags(flags);
72} 67}
73 68
74/* 69static inline unsigned long arch_local_irq_save(void)
75 * For spinlocks, etc:
76 */
77static inline unsigned long __raw_local_irq_save(void)
78{ 70{
79 unsigned long flags, tmp; 71 unsigned long flags, tmp;
80 72
@@ -100,9 +92,6 @@ static inline unsigned long __raw_local_irq_save(void)
100 return flags; 92 return flags;
101} 93}
102 94
103#define raw_local_irq_save(flags) \
104 do { (flags) = __raw_local_irq_save(); } while (0)
105
106#endif /* (__ASSEMBLY__) */ 95#endif /* (__ASSEMBLY__) */
107 96
108#endif /* !(_ASM_IRQFLAGS_H) */ 97#endif /* !(_ASM_IRQFLAGS_H) */
diff --git a/arch/sparc/include/asm/jump_label.h b/arch/sparc/include/asm/jump_label.h
new file mode 100644
index 000000000000..62e66d7b2fb6
--- /dev/null
+++ b/arch/sparc/include/asm/jump_label.h
@@ -0,0 +1,32 @@
1#ifndef _ASM_SPARC_JUMP_LABEL_H
2#define _ASM_SPARC_JUMP_LABEL_H
3
4#ifdef __KERNEL__
5
6#include <linux/types.h>
7#include <asm/system.h>
8
9#define JUMP_LABEL_NOP_SIZE 4
10
11#define JUMP_LABEL(key, label) \
12 do { \
13 asm goto("1:\n\t" \
14 "nop\n\t" \
15 "nop\n\t" \
16 ".pushsection __jump_table, \"a\"\n\t"\
17 ".word 1b, %l[" #label "], %c0\n\t" \
18 ".popsection \n\t" \
19 : : "i" (key) : : label);\
20 } while (0)
21
22#endif /* __KERNEL__ */
23
24typedef u32 jump_label_t;
25
26struct jump_entry {
27 jump_label_t code;
28 jump_label_t target;
29 jump_label_t key;
30};
31
32#endif
diff --git a/arch/sparc/include/asm/memblock.h b/arch/sparc/include/asm/memblock.h
index f12af880649b..c67b047ef85e 100644
--- a/arch/sparc/include/asm/memblock.h
+++ b/arch/sparc/include/asm/memblock.h
@@ -5,6 +5,4 @@
5 5
6#define MEMBLOCK_DBG(fmt...) prom_printf(fmt) 6#define MEMBLOCK_DBG(fmt...) prom_printf(fmt)
7 7
8#define MEMBLOCK_REAL_LIMIT 0
9
10#endif /* !(_SPARC64_MEMBLOCK_H) */ 8#endif /* !(_SPARC64_MEMBLOCK_H) */
diff --git a/arch/sparc/include/asm/openprom.h b/arch/sparc/include/asm/openprom.h
index 963e1a45c35f..81cd43432dc0 100644
--- a/arch/sparc/include/asm/openprom.h
+++ b/arch/sparc/include/asm/openprom.h
@@ -11,6 +11,8 @@
11#define LINUX_OPPROM_MAGIC 0x10010407 11#define LINUX_OPPROM_MAGIC 0x10010407
12 12
13#ifndef __ASSEMBLY__ 13#ifndef __ASSEMBLY__
14#include <linux/of.h>
15
14/* V0 prom device operations. */ 16/* V0 prom device operations. */
15struct linux_dev_v0_funcs { 17struct linux_dev_v0_funcs {
16 int (*v0_devopen)(char *device_str); 18 int (*v0_devopen)(char *device_str);
@@ -26,7 +28,7 @@ struct linux_dev_v0_funcs {
26 28
27/* V2 and later prom device operations. */ 29/* V2 and later prom device operations. */
28struct linux_dev_v2_funcs { 30struct linux_dev_v2_funcs {
29 int (*v2_inst2pkg)(int d); /* Convert ihandle to phandle */ 31 phandle (*v2_inst2pkg)(int d); /* Convert ihandle to phandle */
30 char * (*v2_dumb_mem_alloc)(char *va, unsigned sz); 32 char * (*v2_dumb_mem_alloc)(char *va, unsigned sz);
31 void (*v2_dumb_mem_free)(char *va, unsigned sz); 33 void (*v2_dumb_mem_free)(char *va, unsigned sz);
32 34
@@ -168,12 +170,12 @@ struct linux_romvec {
168 170
169/* Routines for traversing the prom device tree. */ 171/* Routines for traversing the prom device tree. */
170struct linux_nodeops { 172struct linux_nodeops {
171 int (*no_nextnode)(int node); 173 phandle (*no_nextnode)(phandle node);
172 int (*no_child)(int node); 174 phandle (*no_child)(phandle node);
173 int (*no_proplen)(int node, const char *name); 175 int (*no_proplen)(phandle node, const char *name);
174 int (*no_getprop)(int node, const char *name, char *val); 176 int (*no_getprop)(phandle node, const char *name, char *val);
175 int (*no_setprop)(int node, const char *name, char *val, int len); 177 int (*no_setprop)(phandle node, const char *name, char *val, int len);
176 char * (*no_nextprop)(int node, char *name); 178 char * (*no_nextprop)(phandle node, char *name);
177}; 179};
178 180
179/* More fun PROM structures for device probing. */ 181/* More fun PROM structures for device probing. */
diff --git a/arch/sparc/include/asm/oplib_32.h b/arch/sparc/include/asm/oplib_32.h
index 33e31ce6b31f..51296a6f5005 100644
--- a/arch/sparc/include/asm/oplib_32.h
+++ b/arch/sparc/include/asm/oplib_32.h
@@ -30,7 +30,7 @@ extern unsigned int prom_rev, prom_prev;
30/* Root node of the prom device tree, this stays constant after 30/* Root node of the prom device tree, this stays constant after
31 * initialization is complete. 31 * initialization is complete.
32 */ 32 */
33extern int prom_root_node; 33extern phandle prom_root_node;
34 34
35/* Pointer to prom structure containing the device tree traversal 35/* Pointer to prom structure containing the device tree traversal
36 * and usage utility functions. Only prom-lib should use these, 36 * and usage utility functions. Only prom-lib should use these,
@@ -178,68 +178,68 @@ extern void prom_putsegment(int context, unsigned long virt_addr,
178/* PROM device tree traversal functions... */ 178/* PROM device tree traversal functions... */
179 179
180/* Get the child node of the given node, or zero if no child exists. */ 180/* Get the child node of the given node, or zero if no child exists. */
181extern int prom_getchild(int parent_node); 181extern phandle prom_getchild(phandle parent_node);
182 182
183/* Get the next sibling node of the given node, or zero if no further 183/* Get the next sibling node of the given node, or zero if no further
184 * siblings exist. 184 * siblings exist.
185 */ 185 */
186extern int prom_getsibling(int node); 186extern phandle prom_getsibling(phandle node);
187 187
188/* Get the length, at the passed node, of the given property type. 188/* Get the length, at the passed node, of the given property type.
189 * Returns -1 on error (ie. no such property at this node). 189 * Returns -1 on error (ie. no such property at this node).
190 */ 190 */
191extern int prom_getproplen(int thisnode, const char *property); 191extern int prom_getproplen(phandle thisnode, const char *property);
192 192
193/* Fetch the requested property using the given buffer. Returns 193/* Fetch the requested property using the given buffer. Returns
194 * the number of bytes the prom put into your buffer or -1 on error. 194 * the number of bytes the prom put into your buffer or -1 on error.
195 */ 195 */
196extern int __must_check prom_getproperty(int thisnode, const char *property, 196extern int __must_check prom_getproperty(phandle thisnode, const char *property,
197 char *prop_buffer, int propbuf_size); 197 char *prop_buffer, int propbuf_size);
198 198
199/* Acquire an integer property. */ 199/* Acquire an integer property. */
200extern int prom_getint(int node, char *property); 200extern int prom_getint(phandle node, char *property);
201 201
202/* Acquire an integer property, with a default value. */ 202/* Acquire an integer property, with a default value. */
203extern int prom_getintdefault(int node, char *property, int defval); 203extern int prom_getintdefault(phandle node, char *property, int defval);
204 204
205/* Acquire a boolean property, 0=FALSE 1=TRUE. */ 205/* Acquire a boolean property, 0=FALSE 1=TRUE. */
206extern int prom_getbool(int node, char *prop); 206extern int prom_getbool(phandle node, char *prop);
207 207
208/* Acquire a string property, null string on error. */ 208/* Acquire a string property, null string on error. */
209extern void prom_getstring(int node, char *prop, char *buf, int bufsize); 209extern void prom_getstring(phandle node, char *prop, char *buf, int bufsize);
210 210
211/* Does the passed node have the given "name"? YES=1 NO=0 */ 211/* Does the passed node have the given "name"? YES=1 NO=0 */
212extern int prom_nodematch(int thisnode, char *name); 212extern int prom_nodematch(phandle thisnode, char *name);
213 213
214/* Search all siblings starting at the passed node for "name" matching 214/* Search all siblings starting at the passed node for "name" matching
215 * the given string. Returns the node on success, zero on failure. 215 * the given string. Returns the node on success, zero on failure.
216 */ 216 */
217extern int prom_searchsiblings(int node_start, char *name); 217extern phandle prom_searchsiblings(phandle node_start, char *name);
218 218
219/* Return the first property type, as a string, for the given node. 219/* Return the first property type, as a string, for the given node.
220 * Returns a null string on error. 220 * Returns a null string on error.
221 */ 221 */
222extern char *prom_firstprop(int node, char *buffer); 222extern char *prom_firstprop(phandle node, char *buffer);
223 223
224/* Returns the next property after the passed property for the given 224/* Returns the next property after the passed property for the given
225 * node. Returns null string on failure. 225 * node. Returns null string on failure.
226 */ 226 */
227extern char *prom_nextprop(int node, char *prev_property, char *buffer); 227extern char *prom_nextprop(phandle node, char *prev_property, char *buffer);
228 228
229/* Returns phandle of the path specified */ 229/* Returns phandle of the path specified */
230extern int prom_finddevice(char *name); 230extern phandle prom_finddevice(char *name);
231 231
232/* Returns 1 if the specified node has given property. */ 232/* Returns 1 if the specified node has given property. */
233extern int prom_node_has_property(int node, char *property); 233extern int prom_node_has_property(phandle node, char *property);
234 234
235/* Set the indicated property at the given node with the passed value. 235/* Set the indicated property at the given node with the passed value.
236 * Returns the number of bytes of your value that the prom took. 236 * Returns the number of bytes of your value that the prom took.
237 */ 237 */
238extern int prom_setprop(int node, const char *prop_name, char *prop_value, 238extern int prom_setprop(phandle node, const char *prop_name, char *prop_value,
239 int value_size); 239 int value_size);
240 240
241extern int prom_pathtoinode(char *path); 241extern phandle prom_pathtoinode(char *path);
242extern int prom_inst2pkg(int); 242extern phandle prom_inst2pkg(int);
243 243
244/* Dorking with Bus ranges... */ 244/* Dorking with Bus ranges... */
245 245
@@ -247,13 +247,13 @@ extern int prom_inst2pkg(int);
247extern void prom_apply_obio_ranges(struct linux_prom_registers *obioregs, int nregs); 247extern void prom_apply_obio_ranges(struct linux_prom_registers *obioregs, int nregs);
248 248
249/* Apply ranges of any prom node (and optionally parent node as well) to registers. */ 249/* Apply ranges of any prom node (and optionally parent node as well) to registers. */
250extern void prom_apply_generic_ranges(int node, int parent, 250extern void prom_apply_generic_ranges(phandle node, phandle parent,
251 struct linux_prom_registers *sbusregs, int nregs); 251 struct linux_prom_registers *sbusregs, int nregs);
252 252
253/* CPU probing helpers. */ 253/* CPU probing helpers. */
254int cpu_find_by_instance(int instance, int *prom_node, int *mid); 254int cpu_find_by_instance(int instance, phandle *prom_node, int *mid);
255int cpu_find_by_mid(int mid, int *prom_node); 255int cpu_find_by_mid(int mid, phandle *prom_node);
256int cpu_get_hwmid(int prom_node); 256int cpu_get_hwmid(phandle prom_node);
257 257
258extern spinlock_t prom_lock; 258extern spinlock_t prom_lock;
259 259
diff --git a/arch/sparc/include/asm/oplib_64.h b/arch/sparc/include/asm/oplib_64.h
index 3e0b2d62303d..c9cc078e3e31 100644
--- a/arch/sparc/include/asm/oplib_64.h
+++ b/arch/sparc/include/asm/oplib_64.h
@@ -16,7 +16,7 @@ extern char prom_version[];
16/* Root node of the prom device tree, this stays constant after 16/* Root node of the prom device tree, this stays constant after
17 * initialization is complete. 17 * initialization is complete.
18 */ 18 */
19extern int prom_root_node; 19extern phandle prom_root_node;
20 20
21/* PROM stdin and stdout */ 21/* PROM stdin and stdout */
22extern int prom_stdin, prom_stdout; 22extern int prom_stdin, prom_stdout;
@@ -24,7 +24,7 @@ extern int prom_stdin, prom_stdout;
24/* /chosen node of the prom device tree, this stays constant after 24/* /chosen node of the prom device tree, this stays constant after
25 * initialization is complete. 25 * initialization is complete.
26 */ 26 */
27extern int prom_chosen_node; 27extern phandle prom_chosen_node;
28 28
29/* Helper values and strings in arch/sparc64/kernel/head.S */ 29/* Helper values and strings in arch/sparc64/kernel/head.S */
30extern const char prom_peer_name[]; 30extern const char prom_peer_name[];
@@ -218,68 +218,69 @@ extern void prom_unmap(unsigned long size, unsigned long vaddr);
218/* PROM device tree traversal functions... */ 218/* PROM device tree traversal functions... */
219 219
220/* Get the child node of the given node, or zero if no child exists. */ 220/* Get the child node of the given node, or zero if no child exists. */
221extern int prom_getchild(int parent_node); 221extern phandle prom_getchild(phandle parent_node);
222 222
223/* Get the next sibling node of the given node, or zero if no further 223/* Get the next sibling node of the given node, or zero if no further
224 * siblings exist. 224 * siblings exist.
225 */ 225 */
226extern int prom_getsibling(int node); 226extern phandle prom_getsibling(phandle node);
227 227
228/* Get the length, at the passed node, of the given property type. 228/* Get the length, at the passed node, of the given property type.
229 * Returns -1 on error (ie. no such property at this node). 229 * Returns -1 on error (ie. no such property at this node).
230 */ 230 */
231extern int prom_getproplen(int thisnode, const char *property); 231extern int prom_getproplen(phandle thisnode, const char *property);
232 232
233/* Fetch the requested property using the given buffer. Returns 233/* Fetch the requested property using the given buffer. Returns
234 * the number of bytes the prom put into your buffer or -1 on error. 234 * the number of bytes the prom put into your buffer or -1 on error.
235 */ 235 */
236extern int prom_getproperty(int thisnode, const char *property, 236extern int prom_getproperty(phandle thisnode, const char *property,
237 char *prop_buffer, int propbuf_size); 237 char *prop_buffer, int propbuf_size);
238 238
239/* Acquire an integer property. */ 239/* Acquire an integer property. */
240extern int prom_getint(int node, const char *property); 240extern int prom_getint(phandle node, const char *property);
241 241
242/* Acquire an integer property, with a default value. */ 242/* Acquire an integer property, with a default value. */
243extern int prom_getintdefault(int node, const char *property, int defval); 243extern int prom_getintdefault(phandle node, const char *property, int defval);
244 244
245/* Acquire a boolean property, 0=FALSE 1=TRUE. */ 245/* Acquire a boolean property, 0=FALSE 1=TRUE. */
246extern int prom_getbool(int node, const char *prop); 246extern int prom_getbool(phandle node, const char *prop);
247 247
248/* Acquire a string property, null string on error. */ 248/* Acquire a string property, null string on error. */
249extern void prom_getstring(int node, const char *prop, char *buf, int bufsize); 249extern void prom_getstring(phandle node, const char *prop, char *buf,
250 int bufsize);
250 251
251/* Does the passed node have the given "name"? YES=1 NO=0 */ 252/* Does the passed node have the given "name"? YES=1 NO=0 */
252extern int prom_nodematch(int thisnode, const char *name); 253extern int prom_nodematch(phandle thisnode, const char *name);
253 254
254/* Search all siblings starting at the passed node for "name" matching 255/* Search all siblings starting at the passed node for "name" matching
255 * the given string. Returns the node on success, zero on failure. 256 * the given string. Returns the node on success, zero on failure.
256 */ 257 */
257extern int prom_searchsiblings(int node_start, const char *name); 258extern phandle prom_searchsiblings(phandle node_start, const char *name);
258 259
259/* Return the first property type, as a string, for the given node. 260/* Return the first property type, as a string, for the given node.
260 * Returns a null string on error. Buffer should be at least 32B long. 261 * Returns a null string on error. Buffer should be at least 32B long.
261 */ 262 */
262extern char *prom_firstprop(int node, char *buffer); 263extern char *prom_firstprop(phandle node, char *buffer);
263 264
264/* Returns the next property after the passed property for the given 265/* Returns the next property after the passed property for the given
265 * node. Returns null string on failure. Buffer should be at least 32B long. 266 * node. Returns null string on failure. Buffer should be at least 32B long.
266 */ 267 */
267extern char *prom_nextprop(int node, const char *prev_property, char *buffer); 268extern char *prom_nextprop(phandle node, const char *prev_property, char *buf);
268 269
269/* Returns 1 if the specified node has given property. */ 270/* Returns 1 if the specified node has given property. */
270extern int prom_node_has_property(int node, const char *property); 271extern int prom_node_has_property(phandle node, const char *property);
271 272
272/* Returns phandle of the path specified */ 273/* Returns phandle of the path specified */
273extern int prom_finddevice(const char *name); 274extern phandle prom_finddevice(const char *name);
274 275
275/* Set the indicated property at the given node with the passed value. 276/* Set the indicated property at the given node with the passed value.
276 * Returns the number of bytes of your value that the prom took. 277 * Returns the number of bytes of your value that the prom took.
277 */ 278 */
278extern int prom_setprop(int node, const char *prop_name, char *prop_value, 279extern int prom_setprop(phandle node, const char *prop_name, char *prop_value,
279 int value_size); 280 int value_size);
280 281
281extern int prom_pathtoinode(const char *path); 282extern phandle prom_pathtoinode(const char *path);
282extern int prom_inst2pkg(int); 283extern phandle prom_inst2pkg(int);
283extern int prom_service_exists(const char *service_name); 284extern int prom_service_exists(const char *service_name);
284extern void prom_sun4v_guest_soft_state(void); 285extern void prom_sun4v_guest_soft_state(void);
285 286
diff --git a/arch/sparc/include/asm/perf_event.h b/arch/sparc/include/asm/perf_event.h
index 727af70646cb..6e8bfa1786da 100644
--- a/arch/sparc/include/asm/perf_event.h
+++ b/arch/sparc/include/asm/perf_event.h
@@ -1,10 +1,6 @@
1#ifndef __ASM_SPARC_PERF_EVENT_H 1#ifndef __ASM_SPARC_PERF_EVENT_H
2#define __ASM_SPARC_PERF_EVENT_H 2#define __ASM_SPARC_PERF_EVENT_H
3 3
4extern void set_perf_event_pending(void);
5
6#define PERF_EVENT_INDEX_OFFSET 0
7
8#ifdef CONFIG_PERF_EVENTS 4#ifdef CONFIG_PERF_EVENTS
9#include <asm/ptrace.h> 5#include <asm/ptrace.h>
10 6
diff --git a/arch/sparc/include/asm/prom.h b/arch/sparc/include/asm/prom.h
index 291f12575edd..56bbaadef646 100644
--- a/arch/sparc/include/asm/prom.h
+++ b/arch/sparc/include/asm/prom.h
@@ -18,6 +18,7 @@
18 * 2 of the License, or (at your option) any later version. 18 * 2 of the License, or (at your option) any later version.
19 */ 19 */
20#include <linux/types.h> 20#include <linux/types.h>
21#include <linux/of_pdt.h>
21#include <linux/proc_fs.h> 22#include <linux/proc_fs.h>
22#include <linux/mutex.h> 23#include <linux/mutex.h>
23#include <asm/atomic.h> 24#include <asm/atomic.h>
@@ -67,8 +68,8 @@ extern struct device_node *of_console_device;
67extern char *of_console_path; 68extern char *of_console_path;
68extern char *of_console_options; 69extern char *of_console_options;
69 70
70extern void (*prom_build_more)(struct device_node *dp, struct device_node ***nextp); 71extern void irq_trans_init(struct device_node *dp);
71extern char *build_full_name(struct device_node *dp); 72extern char *build_path_component(struct device_node *dp);
72 73
73#endif /* __KERNEL__ */ 74#endif /* __KERNEL__ */
74#endif /* _SPARC_PROM_H */ 75#endif /* _SPARC_PROM_H */
diff --git a/arch/sparc/kernel/Makefile b/arch/sparc/kernel/Makefile
index 0c2dc1f24a9a..599398fbbc7c 100644
--- a/arch/sparc/kernel/Makefile
+++ b/arch/sparc/kernel/Makefile
@@ -119,3 +119,5 @@ obj-$(CONFIG_COMPAT) += $(audit--y)
119 119
120pc--$(CONFIG_PERF_EVENTS) := perf_event.o 120pc--$(CONFIG_PERF_EVENTS) := perf_event.o
121obj-$(CONFIG_SPARC64) += $(pc--y) 121obj-$(CONFIG_SPARC64) += $(pc--y)
122
123obj-$(CONFIG_SPARC64) += jump_label.o
diff --git a/arch/sparc/kernel/apc.c b/arch/sparc/kernel/apc.c
index 2c0046ecc715..52de4a9424e8 100644
--- a/arch/sparc/kernel/apc.c
+++ b/arch/sparc/kernel/apc.c
@@ -132,6 +132,7 @@ static const struct file_operations apc_fops = {
132 .unlocked_ioctl = apc_ioctl, 132 .unlocked_ioctl = apc_ioctl,
133 .open = apc_open, 133 .open = apc_open,
134 .release = apc_release, 134 .release = apc_release,
135 .llseek = noop_llseek,
135}; 136};
136 137
137static struct miscdevice apc_miscdev = { APC_MINOR, APC_DEVNAME, &apc_fops }; 138static struct miscdevice apc_miscdev = { APC_MINOR, APC_DEVNAME, &apc_fops };
diff --git a/arch/sparc/kernel/auxio_32.c b/arch/sparc/kernel/auxio_32.c
index ee8d214cae1e..35f48837871a 100644
--- a/arch/sparc/kernel/auxio_32.c
+++ b/arch/sparc/kernel/auxio_32.c
@@ -23,7 +23,7 @@ static DEFINE_SPINLOCK(auxio_lock);
23 23
24void __init auxio_probe(void) 24void __init auxio_probe(void)
25{ 25{
26 int node, auxio_nd; 26 phandle node, auxio_nd;
27 struct linux_prom_registers auxregs[1]; 27 struct linux_prom_registers auxregs[1];
28 struct resource r; 28 struct resource r;
29 29
@@ -113,7 +113,7 @@ volatile unsigned char * auxio_power_register = NULL;
113void __init auxio_power_probe(void) 113void __init auxio_power_probe(void)
114{ 114{
115 struct linux_prom_registers regs; 115 struct linux_prom_registers regs;
116 int node; 116 phandle node;
117 struct resource r; 117 struct resource r;
118 118
119 /* Attempt to find the sun4m power control node. */ 119 /* Attempt to find the sun4m power control node. */
diff --git a/arch/sparc/kernel/btext.c b/arch/sparc/kernel/btext.c
index 8cc2d56ffe9a..89aa4eb20cf5 100644
--- a/arch/sparc/kernel/btext.c
+++ b/arch/sparc/kernel/btext.c
@@ -40,7 +40,7 @@ static unsigned char *dispDeviceBase __force_data;
40 40
41static unsigned char vga_font[cmapsz]; 41static unsigned char vga_font[cmapsz];
42 42
43static int __init btext_initialize(unsigned int node) 43static int __init btext_initialize(phandle node)
44{ 44{
45 unsigned int width, height, depth, pitch; 45 unsigned int width, height, depth, pitch;
46 unsigned long address = 0; 46 unsigned long address = 0;
@@ -309,7 +309,7 @@ static struct console btext_console = {
309 309
310int __init btext_find_display(void) 310int __init btext_find_display(void)
311{ 311{
312 unsigned int node; 312 phandle node;
313 char type[32]; 313 char type[32];
314 int ret; 314 int ret;
315 315
diff --git a/arch/sparc/kernel/devices.c b/arch/sparc/kernel/devices.c
index 62dc7a021413..d2eddd6647cd 100644
--- a/arch/sparc/kernel/devices.c
+++ b/arch/sparc/kernel/devices.c
@@ -31,9 +31,9 @@ static char *cpu_mid_prop(void)
31 return "mid"; 31 return "mid";
32} 32}
33 33
34static int check_cpu_node(int nd, int *cur_inst, 34static int check_cpu_node(phandle nd, int *cur_inst,
35 int (*compare)(int, int, void *), void *compare_arg, 35 int (*compare)(phandle, int, void *), void *compare_arg,
36 int *prom_node, int *mid) 36 phandle *prom_node, int *mid)
37{ 37{
38 if (!compare(nd, *cur_inst, compare_arg)) { 38 if (!compare(nd, *cur_inst, compare_arg)) {
39 if (prom_node) 39 if (prom_node)
@@ -51,8 +51,8 @@ static int check_cpu_node(int nd, int *cur_inst,
51 return -ENODEV; 51 return -ENODEV;
52} 52}
53 53
54static int __cpu_find_by(int (*compare)(int, int, void *), void *compare_arg, 54static int __cpu_find_by(int (*compare)(phandle, int, void *),
55 int *prom_node, int *mid) 55 void *compare_arg, phandle *prom_node, int *mid)
56{ 56{
57 struct device_node *dp; 57 struct device_node *dp;
58 int cur_inst; 58 int cur_inst;
@@ -71,7 +71,7 @@ static int __cpu_find_by(int (*compare)(int, int, void *), void *compare_arg,
71 return -ENODEV; 71 return -ENODEV;
72} 72}
73 73
74static int cpu_instance_compare(int nd, int instance, void *_arg) 74static int cpu_instance_compare(phandle nd, int instance, void *_arg)
75{ 75{
76 int desired_instance = (int) _arg; 76 int desired_instance = (int) _arg;
77 77
@@ -80,13 +80,13 @@ static int cpu_instance_compare(int nd, int instance, void *_arg)
80 return -ENODEV; 80 return -ENODEV;
81} 81}
82 82
83int cpu_find_by_instance(int instance, int *prom_node, int *mid) 83int cpu_find_by_instance(int instance, phandle *prom_node, int *mid)
84{ 84{
85 return __cpu_find_by(cpu_instance_compare, (void *)instance, 85 return __cpu_find_by(cpu_instance_compare, (void *)instance,
86 prom_node, mid); 86 prom_node, mid);
87} 87}
88 88
89static int cpu_mid_compare(int nd, int instance, void *_arg) 89static int cpu_mid_compare(phandle nd, int instance, void *_arg)
90{ 90{
91 int desired_mid = (int) _arg; 91 int desired_mid = (int) _arg;
92 int this_mid; 92 int this_mid;
@@ -98,7 +98,7 @@ static int cpu_mid_compare(int nd, int instance, void *_arg)
98 return -ENODEV; 98 return -ENODEV;
99} 99}
100 100
101int cpu_find_by_mid(int mid, int *prom_node) 101int cpu_find_by_mid(int mid, phandle *prom_node)
102{ 102{
103 return __cpu_find_by(cpu_mid_compare, (void *)mid, 103 return __cpu_find_by(cpu_mid_compare, (void *)mid,
104 prom_node, NULL); 104 prom_node, NULL);
@@ -108,7 +108,7 @@ int cpu_find_by_mid(int mid, int *prom_node)
108 * address (0-3). This gives us the true hardware mid, which might have 108 * address (0-3). This gives us the true hardware mid, which might have
109 * some other bits set. On 4d hardware and software mids are the same. 109 * some other bits set. On 4d hardware and software mids are the same.
110 */ 110 */
111int cpu_get_hwmid(int prom_node) 111int cpu_get_hwmid(phandle prom_node)
112{ 112{
113 return prom_getintdefault(prom_node, cpu_mid_prop(), -ENODEV); 113 return prom_getintdefault(prom_node, cpu_mid_prop(), -ENODEV);
114} 114}
@@ -119,7 +119,8 @@ void __init device_scan(void)
119 119
120#ifndef CONFIG_SMP 120#ifndef CONFIG_SMP
121 { 121 {
122 int err, cpu_node; 122 phandle cpu_node;
123 int err;
123 err = cpu_find_by_instance(0, &cpu_node, NULL); 124 err = cpu_find_by_instance(0, &cpu_node, NULL);
124 if (err) { 125 if (err) {
125 /* Probably a sun4e, Sun is trying to trick us ;-) */ 126 /* Probably a sun4e, Sun is trying to trick us ;-) */
diff --git a/arch/sparc/kernel/irq_32.c b/arch/sparc/kernel/irq_32.c
index e1af43728329..0116d8d10def 100644
--- a/arch/sparc/kernel/irq_32.c
+++ b/arch/sparc/kernel/irq_32.c
@@ -57,7 +57,7 @@
57#define SMP_NOP2 57#define SMP_NOP2
58#define SMP_NOP3 58#define SMP_NOP3
59#endif /* SMP */ 59#endif /* SMP */
60unsigned long __raw_local_irq_save(void) 60unsigned long arch_local_irq_save(void)
61{ 61{
62 unsigned long retval; 62 unsigned long retval;
63 unsigned long tmp; 63 unsigned long tmp;
@@ -74,8 +74,9 @@ unsigned long __raw_local_irq_save(void)
74 74
75 return retval; 75 return retval;
76} 76}
77EXPORT_SYMBOL(arch_local_irq_save);
77 78
78void raw_local_irq_enable(void) 79void arch_local_irq_enable(void)
79{ 80{
80 unsigned long tmp; 81 unsigned long tmp;
81 82
@@ -89,8 +90,9 @@ void raw_local_irq_enable(void)
89 : "i" (PSR_PIL) 90 : "i" (PSR_PIL)
90 : "memory"); 91 : "memory");
91} 92}
93EXPORT_SYMBOL(arch_local_irq_enable);
92 94
93void raw_local_irq_restore(unsigned long old_psr) 95void arch_local_irq_restore(unsigned long old_psr)
94{ 96{
95 unsigned long tmp; 97 unsigned long tmp;
96 98
@@ -105,10 +107,7 @@ void raw_local_irq_restore(unsigned long old_psr)
105 : "i" (PSR_PIL), "r" (old_psr) 107 : "i" (PSR_PIL), "r" (old_psr)
106 : "memory"); 108 : "memory");
107} 109}
108 110EXPORT_SYMBOL(arch_local_irq_restore);
109EXPORT_SYMBOL(__raw_local_irq_save);
110EXPORT_SYMBOL(raw_local_irq_enable);
111EXPORT_SYMBOL(raw_local_irq_restore);
112 111
113/* 112/*
114 * Dave Redman (djhr@tadpole.co.uk) 113 * Dave Redman (djhr@tadpole.co.uk)
diff --git a/arch/sparc/kernel/jump_label.c b/arch/sparc/kernel/jump_label.c
new file mode 100644
index 000000000000..ea2dafc93d78
--- /dev/null
+++ b/arch/sparc/kernel/jump_label.c
@@ -0,0 +1,47 @@
1#include <linux/kernel.h>
2#include <linux/types.h>
3#include <linux/mutex.h>
4#include <linux/cpu.h>
5
6#include <linux/jump_label.h>
7#include <linux/memory.h>
8
9#ifdef HAVE_JUMP_LABEL
10
11void arch_jump_label_transform(struct jump_entry *entry,
12 enum jump_label_type type)
13{
14 u32 val;
15 u32 *insn = (u32 *) (unsigned long) entry->code;
16
17 if (type == JUMP_LABEL_ENABLE) {
18 s32 off = (s32)entry->target - (s32)entry->code;
19
20#ifdef CONFIG_SPARC64
21 /* ba,pt %xcc, . + (off << 2) */
22 val = 0x10680000 | ((u32) off >> 2);
23#else
24 /* ba . + (off << 2) */
25 val = 0x10800000 | ((u32) off >> 2);
26#endif
27 } else {
28 val = 0x01000000;
29 }
30
31 get_online_cpus();
32 mutex_lock(&text_mutex);
33 *insn = val;
34 flushi(insn);
35 mutex_unlock(&text_mutex);
36 put_online_cpus();
37}
38
39void arch_jump_label_text_poke_early(jump_label_t addr)
40{
41 u32 *insn_p = (u32 *) (unsigned long) addr;
42
43 *insn_p = 0x01000000;
44 flushi(insn_p);
45}
46
47#endif
diff --git a/arch/sparc/kernel/leon_kernel.c b/arch/sparc/kernel/leon_kernel.c
index 6a7b4dbc8e09..2d51527d810f 100644
--- a/arch/sparc/kernel/leon_kernel.c
+++ b/arch/sparc/kernel/leon_kernel.c
@@ -282,5 +282,5 @@ void __init leon_init_IRQ(void)
282 282
283void __init leon_init(void) 283void __init leon_init(void)
284{ 284{
285 prom_build_more = &leon_node_init; 285 of_pdt_build_more = &leon_node_init;
286} 286}
diff --git a/arch/sparc/kernel/mdesc.c b/arch/sparc/kernel/mdesc.c
index 83e85c2e802a..6addb914fcc8 100644
--- a/arch/sparc/kernel/mdesc.c
+++ b/arch/sparc/kernel/mdesc.c
@@ -890,6 +890,7 @@ static ssize_t mdesc_read(struct file *file, char __user *buf,
890static const struct file_operations mdesc_fops = { 890static const struct file_operations mdesc_fops = {
891 .read = mdesc_read, 891 .read = mdesc_read,
892 .owner = THIS_MODULE, 892 .owner = THIS_MODULE,
893 .llseek = noop_llseek,
893}; 894};
894 895
895static struct miscdevice mdesc_misc = { 896static struct miscdevice mdesc_misc = {
diff --git a/arch/sparc/kernel/module.c b/arch/sparc/kernel/module.c
index f848aadf54dc..ee3c7dde8d9f 100644
--- a/arch/sparc/kernel/module.c
+++ b/arch/sparc/kernel/module.c
@@ -18,6 +18,9 @@
18#include <asm/spitfire.h> 18#include <asm/spitfire.h>
19 19
20#ifdef CONFIG_SPARC64 20#ifdef CONFIG_SPARC64
21
22#include <linux/jump_label.h>
23
21static void *module_map(unsigned long size) 24static void *module_map(unsigned long size)
22{ 25{
23 struct vm_struct *area; 26 struct vm_struct *area;
@@ -227,6 +230,9 @@ int module_finalize(const Elf_Ehdr *hdr,
227 const Elf_Shdr *sechdrs, 230 const Elf_Shdr *sechdrs,
228 struct module *me) 231 struct module *me)
229{ 232{
233 /* make jump label nops */
234 jump_label_apply_nops(me);
235
230 /* Cheetah's I-cache is fully coherent. */ 236 /* Cheetah's I-cache is fully coherent. */
231 if (tlb_type == spitfire) { 237 if (tlb_type == spitfire) {
232 unsigned long va; 238 unsigned long va;
diff --git a/arch/sparc/kernel/pci_msi.c b/arch/sparc/kernel/pci_msi.c
index 548b8ca9c210..b210416ace7b 100644
--- a/arch/sparc/kernel/pci_msi.c
+++ b/arch/sparc/kernel/pci_msi.c
@@ -114,10 +114,10 @@ static void free_msi(struct pci_pbm_info *pbm, int msi_num)
114 114
115static struct irq_chip msi_irq = { 115static struct irq_chip msi_irq = {
116 .name = "PCI-MSI", 116 .name = "PCI-MSI",
117 .mask = mask_msi_irq, 117 .irq_mask = mask_msi_irq,
118 .unmask = unmask_msi_irq, 118 .irq_unmask = unmask_msi_irq,
119 .enable = unmask_msi_irq, 119 .irq_enable = unmask_msi_irq,
120 .disable = mask_msi_irq, 120 .irq_disable = mask_msi_irq,
121 /* XXX affinity XXX */ 121 /* XXX affinity XXX */
122}; 122};
123 123
diff --git a/arch/sparc/kernel/pcic.c b/arch/sparc/kernel/pcic.c
index d36a8d391ca0..aeaa09a3c655 100644
--- a/arch/sparc/kernel/pcic.c
+++ b/arch/sparc/kernel/pcic.c
@@ -284,7 +284,7 @@ int __init pcic_probe(void)
284 struct linux_prom_registers regs[PROMREG_MAX]; 284 struct linux_prom_registers regs[PROMREG_MAX];
285 struct linux_pbm_info* pbm; 285 struct linux_pbm_info* pbm;
286 char namebuf[64]; 286 char namebuf[64];
287 int node; 287 phandle node;
288 int err; 288 int err;
289 289
290 if (pcic0_up) { 290 if (pcic0_up) {
@@ -440,7 +440,7 @@ static int __devinit pdev_to_pnode(struct linux_pbm_info *pbm,
440{ 440{
441 struct linux_prom_pci_registers regs[PROMREG_MAX]; 441 struct linux_prom_pci_registers regs[PROMREG_MAX];
442 int err; 442 int err;
443 int node = prom_getchild(pbm->prom_node); 443 phandle node = prom_getchild(pbm->prom_node);
444 444
445 while(node) { 445 while(node) {
446 err = prom_getproperty(node, "reg", 446 err = prom_getproperty(node, "reg",
diff --git a/arch/sparc/kernel/pcr.c b/arch/sparc/kernel/pcr.c
index c4a6a50b4849..b87873c0e8ea 100644
--- a/arch/sparc/kernel/pcr.c
+++ b/arch/sparc/kernel/pcr.c
@@ -7,7 +7,7 @@
7#include <linux/init.h> 7#include <linux/init.h>
8#include <linux/irq.h> 8#include <linux/irq.h>
9 9
10#include <linux/perf_event.h> 10#include <linux/irq_work.h>
11#include <linux/ftrace.h> 11#include <linux/ftrace.h>
12 12
13#include <asm/pil.h> 13#include <asm/pil.h>
@@ -43,14 +43,14 @@ void __irq_entry deferred_pcr_work_irq(int irq, struct pt_regs *regs)
43 43
44 old_regs = set_irq_regs(regs); 44 old_regs = set_irq_regs(regs);
45 irq_enter(); 45 irq_enter();
46#ifdef CONFIG_PERF_EVENTS 46#ifdef CONFIG_IRQ_WORK
47 perf_event_do_pending(); 47 irq_work_run();
48#endif 48#endif
49 irq_exit(); 49 irq_exit();
50 set_irq_regs(old_regs); 50 set_irq_regs(old_regs);
51} 51}
52 52
53void set_perf_event_pending(void) 53void arch_irq_work_raise(void)
54{ 54{
55 set_softint(1 << PIL_DEFERRED_PCR_WORK); 55 set_softint(1 << PIL_DEFERRED_PCR_WORK);
56} 56}
diff --git a/arch/sparc/kernel/perf_event.c b/arch/sparc/kernel/perf_event.c
index 6318e622cfb0..0d6deb55a2ae 100644
--- a/arch/sparc/kernel/perf_event.c
+++ b/arch/sparc/kernel/perf_event.c
@@ -658,13 +658,16 @@ static u64 maybe_change_configuration(struct cpu_hw_events *cpuc, u64 pcr)
658 658
659 enc = perf_event_get_enc(cpuc->events[i]); 659 enc = perf_event_get_enc(cpuc->events[i]);
660 pcr &= ~mask_for_index(idx); 660 pcr &= ~mask_for_index(idx);
661 pcr |= event_encoding(enc, idx); 661 if (hwc->state & PERF_HES_STOPPED)
662 pcr |= nop_for_index(idx);
663 else
664 pcr |= event_encoding(enc, idx);
662 } 665 }
663out: 666out:
664 return pcr; 667 return pcr;
665} 668}
666 669
667void hw_perf_enable(void) 670static void sparc_pmu_enable(struct pmu *pmu)
668{ 671{
669 struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events); 672 struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
670 u64 pcr; 673 u64 pcr;
@@ -691,7 +694,7 @@ void hw_perf_enable(void)
691 pcr_ops->write(cpuc->pcr); 694 pcr_ops->write(cpuc->pcr);
692} 695}
693 696
694void hw_perf_disable(void) 697static void sparc_pmu_disable(struct pmu *pmu)
695{ 698{
696 struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events); 699 struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
697 u64 val; 700 u64 val;
@@ -710,19 +713,65 @@ void hw_perf_disable(void)
710 pcr_ops->write(cpuc->pcr); 713 pcr_ops->write(cpuc->pcr);
711} 714}
712 715
713static void sparc_pmu_disable(struct perf_event *event) 716static int active_event_index(struct cpu_hw_events *cpuc,
717 struct perf_event *event)
718{
719 int i;
720
721 for (i = 0; i < cpuc->n_events; i++) {
722 if (cpuc->event[i] == event)
723 break;
724 }
725 BUG_ON(i == cpuc->n_events);
726 return cpuc->current_idx[i];
727}
728
729static void sparc_pmu_start(struct perf_event *event, int flags)
730{
731 struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
732 int idx = active_event_index(cpuc, event);
733
734 if (flags & PERF_EF_RELOAD) {
735 WARN_ON_ONCE(!(event->hw.state & PERF_HES_UPTODATE));
736 sparc_perf_event_set_period(event, &event->hw, idx);
737 }
738
739 event->hw.state = 0;
740
741 sparc_pmu_enable_event(cpuc, &event->hw, idx);
742}
743
744static void sparc_pmu_stop(struct perf_event *event, int flags)
745{
746 struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
747 int idx = active_event_index(cpuc, event);
748
749 if (!(event->hw.state & PERF_HES_STOPPED)) {
750 sparc_pmu_disable_event(cpuc, &event->hw, idx);
751 event->hw.state |= PERF_HES_STOPPED;
752 }
753
754 if (!(event->hw.state & PERF_HES_UPTODATE) && (flags & PERF_EF_UPDATE)) {
755 sparc_perf_event_update(event, &event->hw, idx);
756 event->hw.state |= PERF_HES_UPTODATE;
757 }
758}
759
760static void sparc_pmu_del(struct perf_event *event, int _flags)
714{ 761{
715 struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events); 762 struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
716 struct hw_perf_event *hwc = &event->hw;
717 unsigned long flags; 763 unsigned long flags;
718 int i; 764 int i;
719 765
720 local_irq_save(flags); 766 local_irq_save(flags);
721 perf_disable(); 767 perf_pmu_disable(event->pmu);
722 768
723 for (i = 0; i < cpuc->n_events; i++) { 769 for (i = 0; i < cpuc->n_events; i++) {
724 if (event == cpuc->event[i]) { 770 if (event == cpuc->event[i]) {
725 int idx = cpuc->current_idx[i]; 771 /* Absorb the final count and turn off the
772 * event.
773 */
774 sparc_pmu_stop(event, PERF_EF_UPDATE);
726 775
727 /* Shift remaining entries down into 776 /* Shift remaining entries down into
728 * the existing slot. 777 * the existing slot.
@@ -734,13 +783,6 @@ static void sparc_pmu_disable(struct perf_event *event)
734 cpuc->current_idx[i]; 783 cpuc->current_idx[i];
735 } 784 }
736 785
737 /* Absorb the final count and turn off the
738 * event.
739 */
740 sparc_pmu_disable_event(cpuc, hwc, idx);
741 barrier();
742 sparc_perf_event_update(event, hwc, idx);
743
744 perf_event_update_userpage(event); 786 perf_event_update_userpage(event);
745 787
746 cpuc->n_events--; 788 cpuc->n_events--;
@@ -748,23 +790,10 @@ static void sparc_pmu_disable(struct perf_event *event)
748 } 790 }
749 } 791 }
750 792
751 perf_enable(); 793 perf_pmu_enable(event->pmu);
752 local_irq_restore(flags); 794 local_irq_restore(flags);
753} 795}
754 796
755static int active_event_index(struct cpu_hw_events *cpuc,
756 struct perf_event *event)
757{
758 int i;
759
760 for (i = 0; i < cpuc->n_events; i++) {
761 if (cpuc->event[i] == event)
762 break;
763 }
764 BUG_ON(i == cpuc->n_events);
765 return cpuc->current_idx[i];
766}
767
768static void sparc_pmu_read(struct perf_event *event) 797static void sparc_pmu_read(struct perf_event *event)
769{ 798{
770 struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events); 799 struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
@@ -774,15 +803,6 @@ static void sparc_pmu_read(struct perf_event *event)
774 sparc_perf_event_update(event, hwc, idx); 803 sparc_perf_event_update(event, hwc, idx);
775} 804}
776 805
777static void sparc_pmu_unthrottle(struct perf_event *event)
778{
779 struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
780 int idx = active_event_index(cpuc, event);
781 struct hw_perf_event *hwc = &event->hw;
782
783 sparc_pmu_enable_event(cpuc, hwc, idx);
784}
785
786static atomic_t active_events = ATOMIC_INIT(0); 806static atomic_t active_events = ATOMIC_INIT(0);
787static DEFINE_MUTEX(pmc_grab_mutex); 807static DEFINE_MUTEX(pmc_grab_mutex);
788 808
@@ -877,7 +897,7 @@ static int sparc_check_constraints(struct perf_event **evts,
877 if (!n_ev) 897 if (!n_ev)
878 return 0; 898 return 0;
879 899
880 if (n_ev > perf_max_events) 900 if (n_ev > MAX_HWEVENTS)
881 return -1; 901 return -1;
882 902
883 msk0 = perf_event_get_msk(events[0]); 903 msk0 = perf_event_get_msk(events[0]);
@@ -984,23 +1004,27 @@ static int collect_events(struct perf_event *group, int max_count,
984 return n; 1004 return n;
985} 1005}
986 1006
987static int sparc_pmu_enable(struct perf_event *event) 1007static int sparc_pmu_add(struct perf_event *event, int ef_flags)
988{ 1008{
989 struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events); 1009 struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
990 int n0, ret = -EAGAIN; 1010 int n0, ret = -EAGAIN;
991 unsigned long flags; 1011 unsigned long flags;
992 1012
993 local_irq_save(flags); 1013 local_irq_save(flags);
994 perf_disable(); 1014 perf_pmu_disable(event->pmu);
995 1015
996 n0 = cpuc->n_events; 1016 n0 = cpuc->n_events;
997 if (n0 >= perf_max_events) 1017 if (n0 >= MAX_HWEVENTS)
998 goto out; 1018 goto out;
999 1019
1000 cpuc->event[n0] = event; 1020 cpuc->event[n0] = event;
1001 cpuc->events[n0] = event->hw.event_base; 1021 cpuc->events[n0] = event->hw.event_base;
1002 cpuc->current_idx[n0] = PIC_NO_INDEX; 1022 cpuc->current_idx[n0] = PIC_NO_INDEX;
1003 1023
1024 event->hw.state = PERF_HES_UPTODATE;
1025 if (!(ef_flags & PERF_EF_START))
1026 event->hw.state |= PERF_HES_STOPPED;
1027
1004 /* 1028 /*
1005 * If group events scheduling transaction was started, 1029 * If group events scheduling transaction was started,
1006 * skip the schedulability test here, it will be peformed 1030 * skip the schedulability test here, it will be peformed
@@ -1020,12 +1044,12 @@ nocheck:
1020 1044
1021 ret = 0; 1045 ret = 0;
1022out: 1046out:
1023 perf_enable(); 1047 perf_pmu_enable(event->pmu);
1024 local_irq_restore(flags); 1048 local_irq_restore(flags);
1025 return ret; 1049 return ret;
1026} 1050}
1027 1051
1028static int __hw_perf_event_init(struct perf_event *event) 1052static int sparc_pmu_event_init(struct perf_event *event)
1029{ 1053{
1030 struct perf_event_attr *attr = &event->attr; 1054 struct perf_event_attr *attr = &event->attr;
1031 struct perf_event *evts[MAX_HWEVENTS]; 1055 struct perf_event *evts[MAX_HWEVENTS];
@@ -1038,22 +1062,33 @@ static int __hw_perf_event_init(struct perf_event *event)
1038 if (atomic_read(&nmi_active) < 0) 1062 if (atomic_read(&nmi_active) < 0)
1039 return -ENODEV; 1063 return -ENODEV;
1040 1064
1041 pmap = NULL; 1065 switch (attr->type) {
1042 if (attr->type == PERF_TYPE_HARDWARE) { 1066 case PERF_TYPE_HARDWARE:
1043 if (attr->config >= sparc_pmu->max_events) 1067 if (attr->config >= sparc_pmu->max_events)
1044 return -EINVAL; 1068 return -EINVAL;
1045 pmap = sparc_pmu->event_map(attr->config); 1069 pmap = sparc_pmu->event_map(attr->config);
1046 } else if (attr->type == PERF_TYPE_HW_CACHE) { 1070 break;
1071
1072 case PERF_TYPE_HW_CACHE:
1047 pmap = sparc_map_cache_event(attr->config); 1073 pmap = sparc_map_cache_event(attr->config);
1048 if (IS_ERR(pmap)) 1074 if (IS_ERR(pmap))
1049 return PTR_ERR(pmap); 1075 return PTR_ERR(pmap);
1050 } else if (attr->type != PERF_TYPE_RAW) 1076 break;
1051 return -EOPNOTSUPP; 1077
1078 case PERF_TYPE_RAW:
1079 pmap = NULL;
1080 break;
1081
1082 default:
1083 return -ENOENT;
1084
1085 }
1052 1086
1053 if (pmap) { 1087 if (pmap) {
1054 hwc->event_base = perf_event_encode(pmap); 1088 hwc->event_base = perf_event_encode(pmap);
1055 } else { 1089 } else {
1056 /* User gives us "(encoding << 16) | pic_mask" for 1090 /*
1091 * User gives us "(encoding << 16) | pic_mask" for
1057 * PERF_TYPE_RAW events. 1092 * PERF_TYPE_RAW events.
1058 */ 1093 */
1059 hwc->event_base = attr->config; 1094 hwc->event_base = attr->config;
@@ -1071,7 +1106,7 @@ static int __hw_perf_event_init(struct perf_event *event)
1071 n = 0; 1106 n = 0;
1072 if (event->group_leader != event) { 1107 if (event->group_leader != event) {
1073 n = collect_events(event->group_leader, 1108 n = collect_events(event->group_leader,
1074 perf_max_events - 1, 1109 MAX_HWEVENTS - 1,
1075 evts, events, current_idx_dmy); 1110 evts, events, current_idx_dmy);
1076 if (n < 0) 1111 if (n < 0)
1077 return -EINVAL; 1112 return -EINVAL;
@@ -1107,10 +1142,11 @@ static int __hw_perf_event_init(struct perf_event *event)
1107 * Set the flag to make pmu::enable() not perform the 1142 * Set the flag to make pmu::enable() not perform the
1108 * schedulability test, it will be performed at commit time 1143 * schedulability test, it will be performed at commit time
1109 */ 1144 */
1110static void sparc_pmu_start_txn(const struct pmu *pmu) 1145static void sparc_pmu_start_txn(struct pmu *pmu)
1111{ 1146{
1112 struct cpu_hw_events *cpuhw = &__get_cpu_var(cpu_hw_events); 1147 struct cpu_hw_events *cpuhw = &__get_cpu_var(cpu_hw_events);
1113 1148
1149 perf_pmu_disable(pmu);
1114 cpuhw->group_flag |= PERF_EVENT_TXN; 1150 cpuhw->group_flag |= PERF_EVENT_TXN;
1115} 1151}
1116 1152
@@ -1119,11 +1155,12 @@ static void sparc_pmu_start_txn(const struct pmu *pmu)
1119 * Clear the flag and pmu::enable() will perform the 1155 * Clear the flag and pmu::enable() will perform the
1120 * schedulability test. 1156 * schedulability test.
1121 */ 1157 */
1122static void sparc_pmu_cancel_txn(const struct pmu *pmu) 1158static void sparc_pmu_cancel_txn(struct pmu *pmu)
1123{ 1159{
1124 struct cpu_hw_events *cpuhw = &__get_cpu_var(cpu_hw_events); 1160 struct cpu_hw_events *cpuhw = &__get_cpu_var(cpu_hw_events);
1125 1161
1126 cpuhw->group_flag &= ~PERF_EVENT_TXN; 1162 cpuhw->group_flag &= ~PERF_EVENT_TXN;
1163 perf_pmu_enable(pmu);
1127} 1164}
1128 1165
1129/* 1166/*
@@ -1131,7 +1168,7 @@ static void sparc_pmu_cancel_txn(const struct pmu *pmu)
1131 * Perform the group schedulability test as a whole 1168 * Perform the group schedulability test as a whole
1132 * Return 0 if success 1169 * Return 0 if success
1133 */ 1170 */
1134static int sparc_pmu_commit_txn(const struct pmu *pmu) 1171static int sparc_pmu_commit_txn(struct pmu *pmu)
1135{ 1172{
1136 struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events); 1173 struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
1137 int n; 1174 int n;
@@ -1147,28 +1184,24 @@ static int sparc_pmu_commit_txn(const struct pmu *pmu)
1147 return -EAGAIN; 1184 return -EAGAIN;
1148 1185
1149 cpuc->group_flag &= ~PERF_EVENT_TXN; 1186 cpuc->group_flag &= ~PERF_EVENT_TXN;
1187 perf_pmu_enable(pmu);
1150 return 0; 1188 return 0;
1151} 1189}
1152 1190
1153static const struct pmu pmu = { 1191static struct pmu pmu = {
1154 .enable = sparc_pmu_enable, 1192 .pmu_enable = sparc_pmu_enable,
1155 .disable = sparc_pmu_disable, 1193 .pmu_disable = sparc_pmu_disable,
1194 .event_init = sparc_pmu_event_init,
1195 .add = sparc_pmu_add,
1196 .del = sparc_pmu_del,
1197 .start = sparc_pmu_start,
1198 .stop = sparc_pmu_stop,
1156 .read = sparc_pmu_read, 1199 .read = sparc_pmu_read,
1157 .unthrottle = sparc_pmu_unthrottle,
1158 .start_txn = sparc_pmu_start_txn, 1200 .start_txn = sparc_pmu_start_txn,
1159 .cancel_txn = sparc_pmu_cancel_txn, 1201 .cancel_txn = sparc_pmu_cancel_txn,
1160 .commit_txn = sparc_pmu_commit_txn, 1202 .commit_txn = sparc_pmu_commit_txn,
1161}; 1203};
1162 1204
1163const struct pmu *hw_perf_event_init(struct perf_event *event)
1164{
1165 int err = __hw_perf_event_init(event);
1166
1167 if (err)
1168 return ERR_PTR(err);
1169 return &pmu;
1170}
1171
1172void perf_event_print_debug(void) 1205void perf_event_print_debug(void)
1173{ 1206{
1174 unsigned long flags; 1207 unsigned long flags;
@@ -1244,7 +1277,7 @@ static int __kprobes perf_event_nmi_handler(struct notifier_block *self,
1244 continue; 1277 continue;
1245 1278
1246 if (perf_event_overflow(event, 1, &data, regs)) 1279 if (perf_event_overflow(event, 1, &data, regs))
1247 sparc_pmu_disable_event(cpuc, hwc, idx); 1280 sparc_pmu_stop(event, 0);
1248 } 1281 }
1249 1282
1250 return NOTIFY_STOP; 1283 return NOTIFY_STOP;
@@ -1285,28 +1318,21 @@ void __init init_hw_perf_events(void)
1285 1318
1286 pr_cont("Supported PMU type is '%s'\n", sparc_pmu_type); 1319 pr_cont("Supported PMU type is '%s'\n", sparc_pmu_type);
1287 1320
1288 /* All sparc64 PMUs currently have 2 events. */ 1321 perf_pmu_register(&pmu);
1289 perf_max_events = 2;
1290
1291 register_die_notifier(&perf_event_nmi_notifier); 1322 register_die_notifier(&perf_event_nmi_notifier);
1292} 1323}
1293 1324
1294static inline void callchain_store(struct perf_callchain_entry *entry, u64 ip) 1325void perf_callchain_kernel(struct perf_callchain_entry *entry,
1295{ 1326 struct pt_regs *regs)
1296 if (entry->nr < PERF_MAX_STACK_DEPTH)
1297 entry->ip[entry->nr++] = ip;
1298}
1299
1300static void perf_callchain_kernel(struct pt_regs *regs,
1301 struct perf_callchain_entry *entry)
1302{ 1327{
1303 unsigned long ksp, fp; 1328 unsigned long ksp, fp;
1304#ifdef CONFIG_FUNCTION_GRAPH_TRACER 1329#ifdef CONFIG_FUNCTION_GRAPH_TRACER
1305 int graph = 0; 1330 int graph = 0;
1306#endif 1331#endif
1307 1332
1308 callchain_store(entry, PERF_CONTEXT_KERNEL); 1333 stack_trace_flush();
1309 callchain_store(entry, regs->tpc); 1334
1335 perf_callchain_store(entry, regs->tpc);
1310 1336
1311 ksp = regs->u_regs[UREG_I6]; 1337 ksp = regs->u_regs[UREG_I6];
1312 fp = ksp + STACK_BIAS; 1338 fp = ksp + STACK_BIAS;
@@ -1330,13 +1356,13 @@ static void perf_callchain_kernel(struct pt_regs *regs,
1330 pc = sf->callers_pc; 1356 pc = sf->callers_pc;
1331 fp = (unsigned long)sf->fp + STACK_BIAS; 1357 fp = (unsigned long)sf->fp + STACK_BIAS;
1332 } 1358 }
1333 callchain_store(entry, pc); 1359 perf_callchain_store(entry, pc);
1334#ifdef CONFIG_FUNCTION_GRAPH_TRACER 1360#ifdef CONFIG_FUNCTION_GRAPH_TRACER
1335 if ((pc + 8UL) == (unsigned long) &return_to_handler) { 1361 if ((pc + 8UL) == (unsigned long) &return_to_handler) {
1336 int index = current->curr_ret_stack; 1362 int index = current->curr_ret_stack;
1337 if (current->ret_stack && index >= graph) { 1363 if (current->ret_stack && index >= graph) {
1338 pc = current->ret_stack[index - graph].ret; 1364 pc = current->ret_stack[index - graph].ret;
1339 callchain_store(entry, pc); 1365 perf_callchain_store(entry, pc);
1340 graph++; 1366 graph++;
1341 } 1367 }
1342 } 1368 }
@@ -1344,13 +1370,12 @@ static void perf_callchain_kernel(struct pt_regs *regs,
1344 } while (entry->nr < PERF_MAX_STACK_DEPTH); 1370 } while (entry->nr < PERF_MAX_STACK_DEPTH);
1345} 1371}
1346 1372
1347static void perf_callchain_user_64(struct pt_regs *regs, 1373static void perf_callchain_user_64(struct perf_callchain_entry *entry,
1348 struct perf_callchain_entry *entry) 1374 struct pt_regs *regs)
1349{ 1375{
1350 unsigned long ufp; 1376 unsigned long ufp;
1351 1377
1352 callchain_store(entry, PERF_CONTEXT_USER); 1378 perf_callchain_store(entry, regs->tpc);
1353 callchain_store(entry, regs->tpc);
1354 1379
1355 ufp = regs->u_regs[UREG_I6] + STACK_BIAS; 1380 ufp = regs->u_regs[UREG_I6] + STACK_BIAS;
1356 do { 1381 do {
@@ -1363,17 +1388,16 @@ static void perf_callchain_user_64(struct pt_regs *regs,
1363 1388
1364 pc = sf.callers_pc; 1389 pc = sf.callers_pc;
1365 ufp = (unsigned long)sf.fp + STACK_BIAS; 1390 ufp = (unsigned long)sf.fp + STACK_BIAS;
1366 callchain_store(entry, pc); 1391 perf_callchain_store(entry, pc);
1367 } while (entry->nr < PERF_MAX_STACK_DEPTH); 1392 } while (entry->nr < PERF_MAX_STACK_DEPTH);
1368} 1393}
1369 1394
1370static void perf_callchain_user_32(struct pt_regs *regs, 1395static void perf_callchain_user_32(struct perf_callchain_entry *entry,
1371 struct perf_callchain_entry *entry) 1396 struct pt_regs *regs)
1372{ 1397{
1373 unsigned long ufp; 1398 unsigned long ufp;
1374 1399
1375 callchain_store(entry, PERF_CONTEXT_USER); 1400 perf_callchain_store(entry, regs->tpc);
1376 callchain_store(entry, regs->tpc);
1377 1401
1378 ufp = regs->u_regs[UREG_I6] & 0xffffffffUL; 1402 ufp = regs->u_regs[UREG_I6] & 0xffffffffUL;
1379 do { 1403 do {
@@ -1386,34 +1410,16 @@ static void perf_callchain_user_32(struct pt_regs *regs,
1386 1410
1387 pc = sf.callers_pc; 1411 pc = sf.callers_pc;
1388 ufp = (unsigned long)sf.fp; 1412 ufp = (unsigned long)sf.fp;
1389 callchain_store(entry, pc); 1413 perf_callchain_store(entry, pc);
1390 } while (entry->nr < PERF_MAX_STACK_DEPTH); 1414 } while (entry->nr < PERF_MAX_STACK_DEPTH);
1391} 1415}
1392 1416
1393/* Like powerpc we can't get PMU interrupts within the PMU handler, 1417void
1394 * so no need for separate NMI and IRQ chains as on x86. 1418perf_callchain_user(struct perf_callchain_entry *entry, struct pt_regs *regs)
1395 */
1396static DEFINE_PER_CPU(struct perf_callchain_entry, callchain);
1397
1398struct perf_callchain_entry *perf_callchain(struct pt_regs *regs)
1399{ 1419{
1400 struct perf_callchain_entry *entry = &__get_cpu_var(callchain); 1420 flushw_user();
1401 1421 if (test_thread_flag(TIF_32BIT))
1402 entry->nr = 0; 1422 perf_callchain_user_32(entry, regs);
1403 if (!user_mode(regs)) { 1423 else
1404 stack_trace_flush(); 1424 perf_callchain_user_64(entry, regs);
1405 perf_callchain_kernel(regs, entry);
1406 if (current->mm)
1407 regs = task_pt_regs(current);
1408 else
1409 regs = NULL;
1410 }
1411 if (regs) {
1412 flushw_user();
1413 if (test_thread_flag(TIF_32BIT))
1414 perf_callchain_user_32(regs, entry);
1415 else
1416 perf_callchain_user_64(regs, entry);
1417 }
1418 return entry;
1419} 1425}
diff --git a/arch/sparc/kernel/prom.h b/arch/sparc/kernel/prom.h
index eeb04a782ec8..cf5fe1c0b024 100644
--- a/arch/sparc/kernel/prom.h
+++ b/arch/sparc/kernel/prom.h
@@ -4,12 +4,6 @@
4#include <linux/spinlock.h> 4#include <linux/spinlock.h>
5#include <asm/prom.h> 5#include <asm/prom.h>
6 6
7extern void * prom_early_alloc(unsigned long size);
8extern void irq_trans_init(struct device_node *dp);
9
10extern unsigned int prom_unique_id;
11
12extern char *build_path_component(struct device_node *dp);
13extern void of_console_init(void); 7extern void of_console_init(void);
14 8
15extern unsigned int prom_early_allocated; 9extern unsigned int prom_early_allocated;
diff --git a/arch/sparc/kernel/prom_common.c b/arch/sparc/kernel/prom_common.c
index 1f830da2ddf2..ed25834328f4 100644
--- a/arch/sparc/kernel/prom_common.c
+++ b/arch/sparc/kernel/prom_common.c
@@ -20,14 +20,13 @@
20#include <linux/mutex.h> 20#include <linux/mutex.h>
21#include <linux/slab.h> 21#include <linux/slab.h>
22#include <linux/of.h> 22#include <linux/of.h>
23#include <linux/of_pdt.h>
23#include <asm/prom.h> 24#include <asm/prom.h>
24#include <asm/oplib.h> 25#include <asm/oplib.h>
25#include <asm/leon.h> 26#include <asm/leon.h>
26 27
27#include "prom.h" 28#include "prom.h"
28 29
29void (*prom_build_more)(struct device_node *dp, struct device_node ***nextp);
30
31struct device_node *of_console_device; 30struct device_node *of_console_device;
32EXPORT_SYMBOL(of_console_device); 31EXPORT_SYMBOL(of_console_device);
33 32
@@ -119,192 +118,47 @@ int of_find_in_proplist(const char *list, const char *match, int len)
119} 118}
120EXPORT_SYMBOL(of_find_in_proplist); 119EXPORT_SYMBOL(of_find_in_proplist);
121 120
122unsigned int prom_unique_id; 121/*
123 122 * SPARC32 and SPARC64's prom_nextprop() do things differently
124static struct property * __init build_one_prop(phandle node, char *prev, 123 * here, despite sharing the same interface. SPARC32 doesn't fill in 'buf',
125 char *special_name, 124 * returning NULL on an error. SPARC64 fills in 'buf', but sets it to an
126 void *special_val, 125 * empty string upon error.
127 int special_len) 126 */
127static int __init handle_nextprop_quirks(char *buf, const char *name)
128{ 128{
129 static struct property *tmp = NULL; 129 if (!name || strlen(name) == 0)
130 struct property *p; 130 return -1;
131 const char *name;
132
133 if (tmp) {
134 p = tmp;
135 memset(p, 0, sizeof(*p) + 32);
136 tmp = NULL;
137 } else {
138 p = prom_early_alloc(sizeof(struct property) + 32);
139 p->unique_id = prom_unique_id++;
140 }
141
142 p->name = (char *) (p + 1);
143 if (special_name) {
144 strcpy(p->name, special_name);
145 p->length = special_len;
146 p->value = prom_early_alloc(special_len);
147 memcpy(p->value, special_val, special_len);
148 } else {
149 if (prev == NULL) {
150 name = prom_firstprop(node, p->name);
151 } else {
152 name = prom_nextprop(node, prev, p->name);
153 }
154 131
155 if (!name || strlen(name) == 0) {
156 tmp = p;
157 return NULL;
158 }
159#ifdef CONFIG_SPARC32 132#ifdef CONFIG_SPARC32
160 strcpy(p->name, name); 133 strcpy(buf, name);
161#endif 134#endif
162 p->length = prom_getproplen(node, p->name); 135 return 0;
163 if (p->length <= 0) {
164 p->length = 0;
165 } else {
166 int len;
167
168 p->value = prom_early_alloc(p->length + 1);
169 len = prom_getproperty(node, p->name, p->value,
170 p->length);
171 if (len <= 0)
172 p->length = 0;
173 ((unsigned char *)p->value)[p->length] = '\0';
174 }
175 }
176 return p;
177}
178
179static struct property * __init build_prop_list(phandle node)
180{
181 struct property *head, *tail;
182
183 head = tail = build_one_prop(node, NULL,
184 ".node", &node, sizeof(node));
185
186 tail->next = build_one_prop(node, NULL, NULL, NULL, 0);
187 tail = tail->next;
188 while(tail) {
189 tail->next = build_one_prop(node, tail->name,
190 NULL, NULL, 0);
191 tail = tail->next;
192 }
193
194 return head;
195}
196
197static char * __init get_one_property(phandle node, const char *name)
198{
199 char *buf = "<NULL>";
200 int len;
201
202 len = prom_getproplen(node, name);
203 if (len > 0) {
204 buf = prom_early_alloc(len);
205 len = prom_getproperty(node, name, buf, len);
206 }
207
208 return buf;
209}
210
211static struct device_node * __init prom_create_node(phandle node,
212 struct device_node *parent)
213{
214 struct device_node *dp;
215
216 if (!node)
217 return NULL;
218
219 dp = prom_early_alloc(sizeof(*dp));
220 dp->unique_id = prom_unique_id++;
221 dp->parent = parent;
222
223 kref_init(&dp->kref);
224
225 dp->name = get_one_property(node, "name");
226 dp->type = get_one_property(node, "device_type");
227 dp->phandle = node;
228
229 dp->properties = build_prop_list(node);
230
231 irq_trans_init(dp);
232
233 return dp;
234}
235
236char * __init build_full_name(struct device_node *dp)
237{
238 int len, ourlen, plen;
239 char *n;
240
241 plen = strlen(dp->parent->full_name);
242 ourlen = strlen(dp->path_component_name);
243 len = ourlen + plen + 2;
244
245 n = prom_early_alloc(len);
246 strcpy(n, dp->parent->full_name);
247 if (!of_node_is_root(dp->parent)) {
248 strcpy(n + plen, "/");
249 plen++;
250 }
251 strcpy(n + plen, dp->path_component_name);
252
253 return n;
254} 136}
255 137
256static struct device_node * __init prom_build_tree(struct device_node *parent, 138static int __init prom_common_nextprop(phandle node, char *prev, char *buf)
257 phandle node,
258 struct device_node ***nextp)
259{ 139{
260 struct device_node *ret = NULL, *prev_sibling = NULL; 140 const char *name;
261 struct device_node *dp;
262
263 while (1) {
264 dp = prom_create_node(node, parent);
265 if (!dp)
266 break;
267
268 if (prev_sibling)
269 prev_sibling->sibling = dp;
270
271 if (!ret)
272 ret = dp;
273 prev_sibling = dp;
274
275 *(*nextp) = dp;
276 *nextp = &dp->allnext;
277
278 dp->path_component_name = build_path_component(dp);
279 dp->full_name = build_full_name(dp);
280
281 dp->child = prom_build_tree(dp, prom_getchild(node), nextp);
282
283 if (prom_build_more)
284 prom_build_more(dp, nextp);
285
286 node = prom_getsibling(node);
287 }
288 141
289 return ret; 142 buf[0] = '\0';
143 name = prom_nextprop(node, prev, buf);
144 return handle_nextprop_quirks(buf, name);
290} 145}
291 146
292unsigned int prom_early_allocated __initdata; 147unsigned int prom_early_allocated __initdata;
293 148
149static struct of_pdt_ops prom_sparc_ops __initdata = {
150 .nextprop = prom_common_nextprop,
151 .getproplen = prom_getproplen,
152 .getproperty = prom_getproperty,
153 .getchild = prom_getchild,
154 .getsibling = prom_getsibling,
155};
156
294void __init prom_build_devicetree(void) 157void __init prom_build_devicetree(void)
295{ 158{
296 struct device_node **nextp; 159 of_pdt_build_devicetree(prom_root_node, &prom_sparc_ops);
297
298 allnodes = prom_create_node(prom_root_node, NULL);
299 allnodes->path_component_name = "";
300 allnodes->full_name = "/";
301
302 nextp = &allnodes->allnext;
303 allnodes->child = prom_build_tree(allnodes,
304 prom_getchild(allnodes->phandle),
305 &nextp);
306 of_console_init(); 160 of_console_init();
307 161
308 printk("PROM: Built device tree with %u bytes of memory.\n", 162 pr_info("PROM: Built device tree with %u bytes of memory.\n",
309 prom_early_allocated); 163 prom_early_allocated);
310} 164}
diff --git a/arch/sparc/kernel/setup_64.c b/arch/sparc/kernel/setup_64.c
index 5f72de67588b..29bafe051bb1 100644
--- a/arch/sparc/kernel/setup_64.c
+++ b/arch/sparc/kernel/setup_64.c
@@ -315,7 +315,7 @@ void __init setup_arch(char **cmdline_p)
315 315
316#ifdef CONFIG_IP_PNP 316#ifdef CONFIG_IP_PNP
317 if (!ic_set_manually) { 317 if (!ic_set_manually) {
318 int chosen = prom_finddevice ("/chosen"); 318 phandle chosen = prom_finddevice("/chosen");
319 u32 cl, sv, gw; 319 u32 cl, sv, gw;
320 320
321 cl = prom_getintdefault (chosen, "client-ip", 0); 321 cl = prom_getintdefault (chosen, "client-ip", 0);
diff --git a/arch/sparc/kernel/starfire.c b/arch/sparc/kernel/starfire.c
index 060d0f3a6151..a4446c0fb7a1 100644
--- a/arch/sparc/kernel/starfire.c
+++ b/arch/sparc/kernel/starfire.c
@@ -23,7 +23,7 @@ int this_is_starfire = 0;
23 23
24void check_if_starfire(void) 24void check_if_starfire(void)
25{ 25{
26 int ssnode = prom_finddevice("/ssp-serial"); 26 phandle ssnode = prom_finddevice("/ssp-serial");
27 if (ssnode != 0 && ssnode != -1) 27 if (ssnode != 0 && ssnode != -1)
28 this_is_starfire = 1; 28 this_is_starfire = 1;
29} 29}
diff --git a/arch/sparc/kernel/tadpole.c b/arch/sparc/kernel/tadpole.c
index f476a5f4af6a..9aba8bd5a78b 100644
--- a/arch/sparc/kernel/tadpole.c
+++ b/arch/sparc/kernel/tadpole.c
@@ -100,7 +100,7 @@ static void swift_clockstop(void)
100 100
101void __init clock_stop_probe(void) 101void __init clock_stop_probe(void)
102{ 102{
103 unsigned int node, clk_nd; 103 phandle node, clk_nd;
104 char name[20]; 104 char name[20];
105 105
106 prom_getstring(prom_root_node, "name", name, sizeof(name)); 106 prom_getstring(prom_root_node, "name", name, sizeof(name));
diff --git a/arch/sparc/mm/init_64.c b/arch/sparc/mm/init_64.c
index f0434513df15..2f6ae1d1fb6b 100644
--- a/arch/sparc/mm/init_64.c
+++ b/arch/sparc/mm/init_64.c
@@ -88,7 +88,7 @@ static void __init read_obp_memory(const char *property,
88 struct linux_prom64_registers *regs, 88 struct linux_prom64_registers *regs,
89 int *num_ents) 89 int *num_ents)
90{ 90{
91 int node = prom_finddevice("/memory"); 91 phandle node = prom_finddevice("/memory");
92 int prop_size = prom_getproplen(node, property); 92 int prop_size = prom_getproplen(node, property);
93 int ents, ret, i; 93 int ents, ret, i;
94 94
@@ -785,8 +785,7 @@ static int find_node(unsigned long addr)
785 return -1; 785 return -1;
786} 786}
787 787
788static unsigned long long nid_range(unsigned long long start, 788u64 memblock_nid_range(u64 start, u64 end, int *nid)
789 unsigned long long end, int *nid)
790{ 789{
791 *nid = find_node(start); 790 *nid = find_node(start);
792 start += PAGE_SIZE; 791 start += PAGE_SIZE;
@@ -804,8 +803,7 @@ static unsigned long long nid_range(unsigned long long start,
804 return start; 803 return start;
805} 804}
806#else 805#else
807static unsigned long long nid_range(unsigned long long start, 806u64 memblock_nid_range(u64 start, u64 end, int *nid)
808 unsigned long long end, int *nid)
809{ 807{
810 *nid = 0; 808 *nid = 0;
811 return end; 809 return end;
@@ -822,8 +820,7 @@ static void __init allocate_node_data(int nid)
822 struct pglist_data *p; 820 struct pglist_data *p;
823 821
824#ifdef CONFIG_NEED_MULTIPLE_NODES 822#ifdef CONFIG_NEED_MULTIPLE_NODES
825 paddr = memblock_alloc_nid(sizeof(struct pglist_data), 823 paddr = memblock_alloc_try_nid(sizeof(struct pglist_data), SMP_CACHE_BYTES, nid);
826 SMP_CACHE_BYTES, nid, nid_range);
827 if (!paddr) { 824 if (!paddr) {
828 prom_printf("Cannot allocate pglist_data for nid[%d]\n", nid); 825 prom_printf("Cannot allocate pglist_data for nid[%d]\n", nid);
829 prom_halt(); 826 prom_halt();
@@ -843,8 +840,7 @@ static void __init allocate_node_data(int nid)
843 if (p->node_spanned_pages) { 840 if (p->node_spanned_pages) {
844 num_pages = bootmem_bootmap_pages(p->node_spanned_pages); 841 num_pages = bootmem_bootmap_pages(p->node_spanned_pages);
845 842
846 paddr = memblock_alloc_nid(num_pages << PAGE_SHIFT, PAGE_SIZE, nid, 843 paddr = memblock_alloc_try_nid(num_pages << PAGE_SHIFT, PAGE_SIZE, nid);
847 nid_range);
848 if (!paddr) { 844 if (!paddr) {
849 prom_printf("Cannot allocate bootmap for nid[%d]\n", 845 prom_printf("Cannot allocate bootmap for nid[%d]\n",
850 nid); 846 nid);
@@ -972,19 +968,19 @@ int of_node_to_nid(struct device_node *dp)
972 968
973static void __init add_node_ranges(void) 969static void __init add_node_ranges(void)
974{ 970{
975 int i; 971 struct memblock_region *reg;
976 972
977 for (i = 0; i < memblock.memory.cnt; i++) { 973 for_each_memblock(memory, reg) {
978 unsigned long size = memblock_size_bytes(&memblock.memory, i); 974 unsigned long size = reg->size;
979 unsigned long start, end; 975 unsigned long start, end;
980 976
981 start = memblock.memory.region[i].base; 977 start = reg->base;
982 end = start + size; 978 end = start + size;
983 while (start < end) { 979 while (start < end) {
984 unsigned long this_end; 980 unsigned long this_end;
985 int nid; 981 int nid;
986 982
987 this_end = nid_range(start, end, &nid); 983 this_end = memblock_nid_range(start, end, &nid);
988 984
989 numadbg("Adding active range nid[%d] " 985 numadbg("Adding active range nid[%d] "
990 "start[%lx] end[%lx]\n", 986 "start[%lx] end[%lx]\n",
@@ -1281,7 +1277,7 @@ static void __init bootmem_init_nonnuma(void)
1281{ 1277{
1282 unsigned long top_of_ram = memblock_end_of_DRAM(); 1278 unsigned long top_of_ram = memblock_end_of_DRAM();
1283 unsigned long total_ram = memblock_phys_mem_size(); 1279 unsigned long total_ram = memblock_phys_mem_size();
1284 unsigned int i; 1280 struct memblock_region *reg;
1285 1281
1286 numadbg("bootmem_init_nonnuma()\n"); 1282 numadbg("bootmem_init_nonnuma()\n");
1287 1283
@@ -1292,15 +1288,14 @@ static void __init bootmem_init_nonnuma(void)
1292 1288
1293 init_node_masks_nonnuma(); 1289 init_node_masks_nonnuma();
1294 1290
1295 for (i = 0; i < memblock.memory.cnt; i++) { 1291 for_each_memblock(memory, reg) {
1296 unsigned long size = memblock_size_bytes(&memblock.memory, i);
1297 unsigned long start_pfn, end_pfn; 1292 unsigned long start_pfn, end_pfn;
1298 1293
1299 if (!size) 1294 if (!reg->size)
1300 continue; 1295 continue;
1301 1296
1302 start_pfn = memblock.memory.region[i].base >> PAGE_SHIFT; 1297 start_pfn = memblock_region_memory_base_pfn(reg);
1303 end_pfn = start_pfn + memblock_size_pages(&memblock.memory, i); 1298 end_pfn = memblock_region_memory_end_pfn(reg);
1304 add_active_range(0, start_pfn, end_pfn); 1299 add_active_range(0, start_pfn, end_pfn);
1305 } 1300 }
1306 1301
@@ -1318,7 +1313,7 @@ static void __init reserve_range_in_node(int nid, unsigned long start,
1318 unsigned long this_end; 1313 unsigned long this_end;
1319 int n; 1314 int n;
1320 1315
1321 this_end = nid_range(start, end, &n); 1316 this_end = memblock_nid_range(start, end, &n);
1322 if (n == nid) { 1317 if (n == nid) {
1323 numadbg(" MATCH reserving range [%lx:%lx]\n", 1318 numadbg(" MATCH reserving range [%lx:%lx]\n",
1324 start, this_end); 1319 start, this_end);
@@ -1334,17 +1329,12 @@ static void __init reserve_range_in_node(int nid, unsigned long start,
1334 1329
1335static void __init trim_reserved_in_node(int nid) 1330static void __init trim_reserved_in_node(int nid)
1336{ 1331{
1337 int i; 1332 struct memblock_region *reg;
1338 1333
1339 numadbg(" trim_reserved_in_node(%d)\n", nid); 1334 numadbg(" trim_reserved_in_node(%d)\n", nid);
1340 1335
1341 for (i = 0; i < memblock.reserved.cnt; i++) { 1336 for_each_memblock(reserved, reg)
1342 unsigned long start = memblock.reserved.region[i].base; 1337 reserve_range_in_node(nid, reg->base, reg->base + reg->size);
1343 unsigned long size = memblock_size_bytes(&memblock.reserved, i);
1344 unsigned long end = start + size;
1345
1346 reserve_range_in_node(nid, start, end);
1347 }
1348} 1338}
1349 1339
1350static void __init bootmem_init_one_node(int nid) 1340static void __init bootmem_init_one_node(int nid)
diff --git a/arch/sparc/mm/srmmu.c b/arch/sparc/mm/srmmu.c
index b0b43aa5e45a..92319aa8b662 100644
--- a/arch/sparc/mm/srmmu.c
+++ b/arch/sparc/mm/srmmu.c
@@ -1262,7 +1262,8 @@ extern unsigned long bootmem_init(unsigned long *pages_avail);
1262 1262
1263void __init srmmu_paging_init(void) 1263void __init srmmu_paging_init(void)
1264{ 1264{
1265 int i, cpunode; 1265 int i;
1266 phandle cpunode;
1266 char node_str[128]; 1267 char node_str[128];
1267 pgd_t *pgd; 1268 pgd_t *pgd;
1268 pmd_t *pmd; 1269 pmd_t *pmd;
@@ -1398,7 +1399,8 @@ static void __init srmmu_is_bad(void)
1398 1399
1399static void __init init_vac_layout(void) 1400static void __init init_vac_layout(void)
1400{ 1401{
1401 int nd, cache_lines; 1402 phandle nd;
1403 int cache_lines;
1402 char node_str[128]; 1404 char node_str[128];
1403#ifdef CONFIG_SMP 1405#ifdef CONFIG_SMP
1404 int cpu = 0; 1406 int cpu = 0;
@@ -2082,7 +2084,7 @@ static void __init get_srmmu_type(void)
2082 2084
2083 /* Next check for Fujitsu Swift. */ 2085 /* Next check for Fujitsu Swift. */
2084 if(psr_typ == 0 && psr_vers == 4) { 2086 if(psr_typ == 0 && psr_vers == 4) {
2085 int cpunode; 2087 phandle cpunode;
2086 char node_str[128]; 2088 char node_str[128];
2087 2089
2088 /* Look if it is not a TurboSparc emulating Swift... */ 2090 /* Look if it is not a TurboSparc emulating Swift... */
diff --git a/arch/sparc/mm/sun4c.c b/arch/sparc/mm/sun4c.c
index 4289f90f8697..ddd0d86e508e 100644
--- a/arch/sparc/mm/sun4c.c
+++ b/arch/sparc/mm/sun4c.c
@@ -420,7 +420,7 @@ volatile unsigned long __iomem *sun4c_memerr_reg = NULL;
420 420
421void __init sun4c_probe_memerr_reg(void) 421void __init sun4c_probe_memerr_reg(void)
422{ 422{
423 int node; 423 phandle node;
424 struct linux_prom_registers regs[1]; 424 struct linux_prom_registers regs[1];
425 425
426 node = prom_getchild(prom_root_node); 426 node = prom_getchild(prom_root_node);
diff --git a/arch/sparc/prom/init_32.c b/arch/sparc/prom/init_32.c
index ccb36c7f9b8c..d342dba4dd54 100644
--- a/arch/sparc/prom/init_32.c
+++ b/arch/sparc/prom/init_32.c
@@ -20,7 +20,7 @@ enum prom_major_version prom_vers;
20unsigned int prom_rev, prom_prev; 20unsigned int prom_rev, prom_prev;
21 21
22/* The root node of the prom device tree. */ 22/* The root node of the prom device tree. */
23int prom_root_node; 23phandle prom_root_node;
24EXPORT_SYMBOL(prom_root_node); 24EXPORT_SYMBOL(prom_root_node);
25 25
26/* Pointer to the device tree operations structure. */ 26/* Pointer to the device tree operations structure. */
diff --git a/arch/sparc/prom/init_64.c b/arch/sparc/prom/init_64.c
index 7b00f89490a4..3ff911e7d25b 100644
--- a/arch/sparc/prom/init_64.c
+++ b/arch/sparc/prom/init_64.c
@@ -19,7 +19,7 @@ char prom_version[80];
19 19
20/* The root node of the prom device tree. */ 20/* The root node of the prom device tree. */
21int prom_stdin, prom_stdout; 21int prom_stdin, prom_stdout;
22int prom_chosen_node; 22phandle prom_chosen_node;
23 23
24/* You must call prom_init() before you attempt to use any of the 24/* You must call prom_init() before you attempt to use any of the
25 * routines in the prom library. It returns 0 on success, 1 on 25 * routines in the prom library. It returns 0 on success, 1 on
@@ -30,7 +30,7 @@ extern void prom_cif_init(void *, void *);
30 30
31void __init prom_init(void *cif_handler, void *cif_stack) 31void __init prom_init(void *cif_handler, void *cif_stack)
32{ 32{
33 int node; 33 phandle node;
34 34
35 prom_cif_init(cif_handler, cif_stack); 35 prom_cif_init(cif_handler, cif_stack);
36 36
diff --git a/arch/sparc/prom/memory.c b/arch/sparc/prom/memory.c
index fac7899a29c3..3f263a64857d 100644
--- a/arch/sparc/prom/memory.c
+++ b/arch/sparc/prom/memory.c
@@ -31,7 +31,8 @@ static int __init prom_meminit_v0(void)
31static int __init prom_meminit_v2(void) 31static int __init prom_meminit_v2(void)
32{ 32{
33 struct linux_prom_registers reg[64]; 33 struct linux_prom_registers reg[64];
34 int node, size, num_ents, i; 34 phandle node;
35 int size, num_ents, i;
35 36
36 node = prom_searchsiblings(prom_getchild(prom_root_node), "memory"); 37 node = prom_searchsiblings(prom_getchild(prom_root_node), "memory");
37 size = prom_getproperty(node, "available", (char *) reg, sizeof(reg)); 38 size = prom_getproperty(node, "available", (char *) reg, sizeof(reg));
diff --git a/arch/sparc/prom/misc_64.c b/arch/sparc/prom/misc_64.c
index 6cb1581d6aef..d24bc44e361e 100644
--- a/arch/sparc/prom/misc_64.c
+++ b/arch/sparc/prom/misc_64.c
@@ -183,7 +183,8 @@ unsigned char prom_get_idprom(char *idbuf, int num_bytes)
183 183
184int prom_get_mmu_ihandle(void) 184int prom_get_mmu_ihandle(void)
185{ 185{
186 int node, ret; 186 phandle node;
187 int ret;
187 188
188 if (prom_mmu_ihandle_cache != 0) 189 if (prom_mmu_ihandle_cache != 0)
189 return prom_mmu_ihandle_cache; 190 return prom_mmu_ihandle_cache;
@@ -201,7 +202,8 @@ int prom_get_mmu_ihandle(void)
201static int prom_get_memory_ihandle(void) 202static int prom_get_memory_ihandle(void)
202{ 203{
203 static int memory_ihandle_cache; 204 static int memory_ihandle_cache;
204 int node, ret; 205 phandle node;
206 int ret;
205 207
206 if (memory_ihandle_cache != 0) 208 if (memory_ihandle_cache != 0)
207 return memory_ihandle_cache; 209 return memory_ihandle_cache;
diff --git a/arch/sparc/prom/p1275.c b/arch/sparc/prom/p1275.c
index fa6e4e219b9c..d9850c2b9bf2 100644
--- a/arch/sparc/prom/p1275.c
+++ b/arch/sparc/prom/p1275.c
@@ -39,7 +39,7 @@ void p1275_cmd_direct(unsigned long *args)
39 unsigned long flags; 39 unsigned long flags;
40 40
41 raw_local_save_flags(flags); 41 raw_local_save_flags(flags);
42 raw_local_irq_restore(PIL_NMI); 42 raw_local_irq_restore((unsigned long)PIL_NMI);
43 raw_spin_lock(&prom_entry_lock); 43 raw_spin_lock(&prom_entry_lock);
44 44
45 prom_world(1); 45 prom_world(1);
diff --git a/arch/sparc/prom/ranges.c b/arch/sparc/prom/ranges.c
index aeff43e44e45..541fc829c207 100644
--- a/arch/sparc/prom/ranges.c
+++ b/arch/sparc/prom/ranges.c
@@ -68,7 +68,7 @@ EXPORT_SYMBOL(prom_apply_obio_ranges);
68 68
69void __init prom_ranges_init(void) 69void __init prom_ranges_init(void)
70{ 70{
71 int node, obio_node; 71 phandle node, obio_node;
72 int success; 72 int success;
73 73
74 num_obio_ranges = 0; 74 num_obio_ranges = 0;
@@ -89,8 +89,8 @@ void __init prom_ranges_init(void)
89 prom_printf("PROMLIB: obio_ranges %d\n", num_obio_ranges); 89 prom_printf("PROMLIB: obio_ranges %d\n", num_obio_ranges);
90} 90}
91 91
92void 92void prom_apply_generic_ranges(phandle node, phandle parent,
93prom_apply_generic_ranges (int node, int parent, struct linux_prom_registers *regs, int nregs) 93 struct linux_prom_registers *regs, int nregs)
94{ 94{
95 int success; 95 int success;
96 int num_ranges; 96 int num_ranges;
diff --git a/arch/sparc/prom/tree_32.c b/arch/sparc/prom/tree_32.c
index b21592f8e3fe..63e08e149774 100644
--- a/arch/sparc/prom/tree_32.c
+++ b/arch/sparc/prom/tree_32.c
@@ -20,10 +20,10 @@ extern void restore_current(void);
20static char promlib_buf[128]; 20static char promlib_buf[128];
21 21
22/* Internal version of prom_getchild that does not alter return values. */ 22/* Internal version of prom_getchild that does not alter return values. */
23int __prom_getchild(int node) 23phandle __prom_getchild(phandle node)
24{ 24{
25 unsigned long flags; 25 unsigned long flags;
26 int cnode; 26 phandle cnode;
27 27
28 spin_lock_irqsave(&prom_lock, flags); 28 spin_lock_irqsave(&prom_lock, flags);
29 cnode = prom_nodeops->no_child(node); 29 cnode = prom_nodeops->no_child(node);
@@ -36,9 +36,9 @@ int __prom_getchild(int node)
36/* Return the child of node 'node' or zero if no this node has no 36/* Return the child of node 'node' or zero if no this node has no
37 * direct descendent. 37 * direct descendent.
38 */ 38 */
39int prom_getchild(int node) 39phandle prom_getchild(phandle node)
40{ 40{
41 int cnode; 41 phandle cnode;
42 42
43 if (node == -1) 43 if (node == -1)
44 return 0; 44 return 0;
@@ -52,10 +52,10 @@ int prom_getchild(int node)
52EXPORT_SYMBOL(prom_getchild); 52EXPORT_SYMBOL(prom_getchild);
53 53
54/* Internal version of prom_getsibling that does not alter return values. */ 54/* Internal version of prom_getsibling that does not alter return values. */
55int __prom_getsibling(int node) 55phandle __prom_getsibling(phandle node)
56{ 56{
57 unsigned long flags; 57 unsigned long flags;
58 int cnode; 58 phandle cnode;
59 59
60 spin_lock_irqsave(&prom_lock, flags); 60 spin_lock_irqsave(&prom_lock, flags);
61 cnode = prom_nodeops->no_nextnode(node); 61 cnode = prom_nodeops->no_nextnode(node);
@@ -68,9 +68,9 @@ int __prom_getsibling(int node)
68/* Return the next sibling of node 'node' or zero if no more siblings 68/* Return the next sibling of node 'node' or zero if no more siblings
69 * at this level of depth in the tree. 69 * at this level of depth in the tree.
70 */ 70 */
71int prom_getsibling(int node) 71phandle prom_getsibling(phandle node)
72{ 72{
73 int sibnode; 73 phandle sibnode;
74 74
75 if (node == -1) 75 if (node == -1)
76 return 0; 76 return 0;
@@ -86,7 +86,7 @@ EXPORT_SYMBOL(prom_getsibling);
86/* Return the length in bytes of property 'prop' at node 'node'. 86/* Return the length in bytes of property 'prop' at node 'node'.
87 * Return -1 on error. 87 * Return -1 on error.
88 */ 88 */
89int prom_getproplen(int node, const char *prop) 89int prom_getproplen(phandle node, const char *prop)
90{ 90{
91 int ret; 91 int ret;
92 unsigned long flags; 92 unsigned long flags;
@@ -106,7 +106,7 @@ EXPORT_SYMBOL(prom_getproplen);
106 * 'buffer' which has a size of 'bufsize'. If the acquisition 106 * 'buffer' which has a size of 'bufsize'. If the acquisition
107 * was successful the length will be returned, else -1 is returned. 107 * was successful the length will be returned, else -1 is returned.
108 */ 108 */
109int prom_getproperty(int node, const char *prop, char *buffer, int bufsize) 109int prom_getproperty(phandle node, const char *prop, char *buffer, int bufsize)
110{ 110{
111 int plen, ret; 111 int plen, ret;
112 unsigned long flags; 112 unsigned long flags;
@@ -126,7 +126,7 @@ EXPORT_SYMBOL(prom_getproperty);
126/* Acquire an integer property and return its value. Returns -1 126/* Acquire an integer property and return its value. Returns -1
127 * on failure. 127 * on failure.
128 */ 128 */
129int prom_getint(int node, char *prop) 129int prom_getint(phandle node, char *prop)
130{ 130{
131 static int intprop; 131 static int intprop;
132 132
@@ -140,7 +140,7 @@ EXPORT_SYMBOL(prom_getint);
140/* Acquire an integer property, upon error return the passed default 140/* Acquire an integer property, upon error return the passed default
141 * integer. 141 * integer.
142 */ 142 */
143int prom_getintdefault(int node, char *property, int deflt) 143int prom_getintdefault(phandle node, char *property, int deflt)
144{ 144{
145 int retval; 145 int retval;
146 146
@@ -152,7 +152,7 @@ int prom_getintdefault(int node, char *property, int deflt)
152EXPORT_SYMBOL(prom_getintdefault); 152EXPORT_SYMBOL(prom_getintdefault);
153 153
154/* Acquire a boolean property, 1=TRUE 0=FALSE. */ 154/* Acquire a boolean property, 1=TRUE 0=FALSE. */
155int prom_getbool(int node, char *prop) 155int prom_getbool(phandle node, char *prop)
156{ 156{
157 int retval; 157 int retval;
158 158
@@ -166,7 +166,7 @@ EXPORT_SYMBOL(prom_getbool);
166 * string on error. The char pointer is the user supplied string 166 * string on error. The char pointer is the user supplied string
167 * buffer. 167 * buffer.
168 */ 168 */
169void prom_getstring(int node, char *prop, char *user_buf, int ubuf_size) 169void prom_getstring(phandle node, char *prop, char *user_buf, int ubuf_size)
170{ 170{
171 int len; 171 int len;
172 172
@@ -180,7 +180,7 @@ EXPORT_SYMBOL(prom_getstring);
180/* Does the device at node 'node' have name 'name'? 180/* Does the device at node 'node' have name 'name'?
181 * YES = 1 NO = 0 181 * YES = 1 NO = 0
182 */ 182 */
183int prom_nodematch(int node, char *name) 183int prom_nodematch(phandle node, char *name)
184{ 184{
185 int error; 185 int error;
186 186
@@ -194,10 +194,11 @@ int prom_nodematch(int node, char *name)
194/* Search siblings at 'node_start' for a node with name 194/* Search siblings at 'node_start' for a node with name
195 * 'nodename'. Return node if successful, zero if not. 195 * 'nodename'. Return node if successful, zero if not.
196 */ 196 */
197int prom_searchsiblings(int node_start, char *nodename) 197phandle prom_searchsiblings(phandle node_start, char *nodename)
198{ 198{
199 199
200 int thisnode, error; 200 phandle thisnode;
201 int error;
201 202
202 for(thisnode = node_start; thisnode; 203 for(thisnode = node_start; thisnode;
203 thisnode=prom_getsibling(thisnode)) { 204 thisnode=prom_getsibling(thisnode)) {
@@ -213,7 +214,7 @@ int prom_searchsiblings(int node_start, char *nodename)
213EXPORT_SYMBOL(prom_searchsiblings); 214EXPORT_SYMBOL(prom_searchsiblings);
214 215
215/* Interal version of nextprop that does not alter return values. */ 216/* Interal version of nextprop that does not alter return values. */
216char * __prom_nextprop(int node, char * oprop) 217char *__prom_nextprop(phandle node, char * oprop)
217{ 218{
218 unsigned long flags; 219 unsigned long flags;
219 char *prop; 220 char *prop;
@@ -228,7 +229,7 @@ char * __prom_nextprop(int node, char * oprop)
228 229
229/* Return the first property name for node 'node'. */ 230/* Return the first property name for node 'node'. */
230/* buffer is unused argument, but as v9 uses it, we need to have the same interface */ 231/* buffer is unused argument, but as v9 uses it, we need to have the same interface */
231char * prom_firstprop(int node, char *bufer) 232char *prom_firstprop(phandle node, char *bufer)
232{ 233{
233 if (node == 0 || node == -1) 234 if (node == 0 || node == -1)
234 return ""; 235 return "";
@@ -241,7 +242,7 @@ EXPORT_SYMBOL(prom_firstprop);
241 * at node 'node' . Returns empty string if no more 242 * at node 'node' . Returns empty string if no more
242 * property types for this node. 243 * property types for this node.
243 */ 244 */
244char * prom_nextprop(int node, char *oprop, char *buffer) 245char *prom_nextprop(phandle node, char *oprop, char *buffer)
245{ 246{
246 if (node == 0 || node == -1) 247 if (node == 0 || node == -1)
247 return ""; 248 return "";
@@ -250,11 +251,11 @@ char * prom_nextprop(int node, char *oprop, char *buffer)
250} 251}
251EXPORT_SYMBOL(prom_nextprop); 252EXPORT_SYMBOL(prom_nextprop);
252 253
253int prom_finddevice(char *name) 254phandle prom_finddevice(char *name)
254{ 255{
255 char nbuf[128]; 256 char nbuf[128];
256 char *s = name, *d; 257 char *s = name, *d;
257 int node = prom_root_node, node2; 258 phandle node = prom_root_node, node2;
258 unsigned int which_io, phys_addr; 259 unsigned int which_io, phys_addr;
259 struct linux_prom_registers reg[PROMREG_MAX]; 260 struct linux_prom_registers reg[PROMREG_MAX];
260 261
@@ -298,7 +299,7 @@ int prom_finddevice(char *name)
298} 299}
299EXPORT_SYMBOL(prom_finddevice); 300EXPORT_SYMBOL(prom_finddevice);
300 301
301int prom_node_has_property(int node, char *prop) 302int prom_node_has_property(phandle node, char *prop)
302{ 303{
303 char *current_property = ""; 304 char *current_property = "";
304 305
@@ -314,7 +315,7 @@ EXPORT_SYMBOL(prom_node_has_property);
314/* Set property 'pname' at node 'node' to value 'value' which has a length 315/* Set property 'pname' at node 'node' to value 'value' which has a length
315 * of 'size' bytes. Return the number of bytes the prom accepted. 316 * of 'size' bytes. Return the number of bytes the prom accepted.
316 */ 317 */
317int prom_setprop(int node, const char *pname, char *value, int size) 318int prom_setprop(phandle node, const char *pname, char *value, int size)
318{ 319{
319 unsigned long flags; 320 unsigned long flags;
320 int ret; 321 int ret;
@@ -329,9 +330,9 @@ int prom_setprop(int node, const char *pname, char *value, int size)
329} 330}
330EXPORT_SYMBOL(prom_setprop); 331EXPORT_SYMBOL(prom_setprop);
331 332
332int prom_inst2pkg(int inst) 333phandle prom_inst2pkg(int inst)
333{ 334{
334 int node; 335 phandle node;
335 unsigned long flags; 336 unsigned long flags;
336 337
337 spin_lock_irqsave(&prom_lock, flags); 338 spin_lock_irqsave(&prom_lock, flags);
@@ -345,9 +346,10 @@ int prom_inst2pkg(int inst)
345/* Return 'node' assigned to a particular prom 'path' 346/* Return 'node' assigned to a particular prom 'path'
346 * FIXME: Should work for v0 as well 347 * FIXME: Should work for v0 as well
347 */ 348 */
348int prom_pathtoinode(char *path) 349phandle prom_pathtoinode(char *path)
349{ 350{
350 int node, inst; 351 phandle node;
352 int inst;
351 353
352 inst = prom_devopen (path); 354 inst = prom_devopen (path);
353 if (inst == -1) return 0; 355 if (inst == -1) return 0;
diff --git a/arch/sparc/prom/tree_64.c b/arch/sparc/prom/tree_64.c
index 9d3f9137a43a..691be68932f8 100644
--- a/arch/sparc/prom/tree_64.c
+++ b/arch/sparc/prom/tree_64.c
@@ -16,7 +16,7 @@
16#include <asm/oplib.h> 16#include <asm/oplib.h>
17#include <asm/ldc.h> 17#include <asm/ldc.h>
18 18
19static int prom_node_to_node(const char *type, int node) 19static phandle prom_node_to_node(const char *type, phandle node)
20{ 20{
21 unsigned long args[5]; 21 unsigned long args[5];
22 22
@@ -28,20 +28,20 @@ static int prom_node_to_node(const char *type, int node)
28 28
29 p1275_cmd_direct(args); 29 p1275_cmd_direct(args);
30 30
31 return (int) args[4]; 31 return (phandle) args[4];
32} 32}
33 33
34/* Return the child of node 'node' or zero if no this node has no 34/* Return the child of node 'node' or zero if no this node has no
35 * direct descendent. 35 * direct descendent.
36 */ 36 */
37inline int __prom_getchild(int node) 37inline phandle __prom_getchild(phandle node)
38{ 38{
39 return prom_node_to_node("child", node); 39 return prom_node_to_node("child", node);
40} 40}
41 41
42inline int prom_getchild(int node) 42inline phandle prom_getchild(phandle node)
43{ 43{
44 int cnode; 44 phandle cnode;
45 45
46 if (node == -1) 46 if (node == -1)
47 return 0; 47 return 0;
@@ -52,9 +52,9 @@ inline int prom_getchild(int node)
52} 52}
53EXPORT_SYMBOL(prom_getchild); 53EXPORT_SYMBOL(prom_getchild);
54 54
55inline int prom_getparent(int node) 55inline phandle prom_getparent(phandle node)
56{ 56{
57 int cnode; 57 phandle cnode;
58 58
59 if (node == -1) 59 if (node == -1)
60 return 0; 60 return 0;
@@ -67,14 +67,14 @@ inline int prom_getparent(int node)
67/* Return the next sibling of node 'node' or zero if no more siblings 67/* Return the next sibling of node 'node' or zero if no more siblings
68 * at this level of depth in the tree. 68 * at this level of depth in the tree.
69 */ 69 */
70inline int __prom_getsibling(int node) 70inline phandle __prom_getsibling(phandle node)
71{ 71{
72 return prom_node_to_node(prom_peer_name, node); 72 return prom_node_to_node(prom_peer_name, node);
73} 73}
74 74
75inline int prom_getsibling(int node) 75inline phandle prom_getsibling(phandle node)
76{ 76{
77 int sibnode; 77 phandle sibnode;
78 78
79 if (node == -1) 79 if (node == -1)
80 return 0; 80 return 0;
@@ -89,7 +89,7 @@ EXPORT_SYMBOL(prom_getsibling);
89/* Return the length in bytes of property 'prop' at node 'node'. 89/* Return the length in bytes of property 'prop' at node 'node'.
90 * Return -1 on error. 90 * Return -1 on error.
91 */ 91 */
92inline int prom_getproplen(int node, const char *prop) 92inline int prom_getproplen(phandle node, const char *prop)
93{ 93{
94 unsigned long args[6]; 94 unsigned long args[6];
95 95
@@ -113,7 +113,7 @@ EXPORT_SYMBOL(prom_getproplen);
113 * 'buffer' which has a size of 'bufsize'. If the acquisition 113 * 'buffer' which has a size of 'bufsize'. If the acquisition
114 * was successful the length will be returned, else -1 is returned. 114 * was successful the length will be returned, else -1 is returned.
115 */ 115 */
116inline int prom_getproperty(int node, const char *prop, 116inline int prom_getproperty(phandle node, const char *prop,
117 char *buffer, int bufsize) 117 char *buffer, int bufsize)
118{ 118{
119 unsigned long args[8]; 119 unsigned long args[8];
@@ -141,7 +141,7 @@ EXPORT_SYMBOL(prom_getproperty);
141/* Acquire an integer property and return its value. Returns -1 141/* Acquire an integer property and return its value. Returns -1
142 * on failure. 142 * on failure.
143 */ 143 */
144inline int prom_getint(int node, const char *prop) 144inline int prom_getint(phandle node, const char *prop)
145{ 145{
146 int intprop; 146 int intprop;
147 147
@@ -156,7 +156,7 @@ EXPORT_SYMBOL(prom_getint);
156 * integer. 156 * integer.
157 */ 157 */
158 158
159int prom_getintdefault(int node, const char *property, int deflt) 159int prom_getintdefault(phandle node, const char *property, int deflt)
160{ 160{
161 int retval; 161 int retval;
162 162
@@ -169,7 +169,7 @@ int prom_getintdefault(int node, const char *property, int deflt)
169EXPORT_SYMBOL(prom_getintdefault); 169EXPORT_SYMBOL(prom_getintdefault);
170 170
171/* Acquire a boolean property, 1=TRUE 0=FALSE. */ 171/* Acquire a boolean property, 1=TRUE 0=FALSE. */
172int prom_getbool(int node, const char *prop) 172int prom_getbool(phandle node, const char *prop)
173{ 173{
174 int retval; 174 int retval;
175 175
@@ -184,7 +184,8 @@ EXPORT_SYMBOL(prom_getbool);
184 * string on error. The char pointer is the user supplied string 184 * string on error. The char pointer is the user supplied string
185 * buffer. 185 * buffer.
186 */ 186 */
187void prom_getstring(int node, const char *prop, char *user_buf, int ubuf_size) 187void prom_getstring(phandle node, const char *prop, char *user_buf,
188 int ubuf_size)
188{ 189{
189 int len; 190 int len;
190 191
@@ -198,7 +199,7 @@ EXPORT_SYMBOL(prom_getstring);
198/* Does the device at node 'node' have name 'name'? 199/* Does the device at node 'node' have name 'name'?
199 * YES = 1 NO = 0 200 * YES = 1 NO = 0
200 */ 201 */
201int prom_nodematch(int node, const char *name) 202int prom_nodematch(phandle node, const char *name)
202{ 203{
203 char namebuf[128]; 204 char namebuf[128];
204 prom_getproperty(node, "name", namebuf, sizeof(namebuf)); 205 prom_getproperty(node, "name", namebuf, sizeof(namebuf));
@@ -210,10 +211,10 @@ int prom_nodematch(int node, const char *name)
210/* Search siblings at 'node_start' for a node with name 211/* Search siblings at 'node_start' for a node with name
211 * 'nodename'. Return node if successful, zero if not. 212 * 'nodename'. Return node if successful, zero if not.
212 */ 213 */
213int prom_searchsiblings(int node_start, const char *nodename) 214phandle prom_searchsiblings(phandle node_start, const char *nodename)
214{ 215{
215 216 phandle thisnode;
216 int thisnode, error; 217 int error;
217 char promlib_buf[128]; 218 char promlib_buf[128];
218 219
219 for(thisnode = node_start; thisnode; 220 for(thisnode = node_start; thisnode;
@@ -234,7 +235,7 @@ static const char *prom_nextprop_name = "nextprop";
234/* Return the first property type for node 'node'. 235/* Return the first property type for node 'node'.
235 * buffer should be at least 32B in length 236 * buffer should be at least 32B in length
236 */ 237 */
237inline char *prom_firstprop(int node, char *buffer) 238inline char *prom_firstprop(phandle node, char *buffer)
238{ 239{
239 unsigned long args[7]; 240 unsigned long args[7];
240 241
@@ -260,7 +261,7 @@ EXPORT_SYMBOL(prom_firstprop);
260 * at node 'node' . Returns NULL string if no more 261 * at node 'node' . Returns NULL string if no more
261 * property types for this node. 262 * property types for this node.
262 */ 263 */
263inline char *prom_nextprop(int node, const char *oprop, char *buffer) 264inline char *prom_nextprop(phandle node, const char *oprop, char *buffer)
264{ 265{
265 unsigned long args[7]; 266 unsigned long args[7];
266 char buf[32]; 267 char buf[32];
@@ -288,8 +289,7 @@ inline char *prom_nextprop(int node, const char *oprop, char *buffer)
288} 289}
289EXPORT_SYMBOL(prom_nextprop); 290EXPORT_SYMBOL(prom_nextprop);
290 291
291int 292phandle prom_finddevice(const char *name)
292prom_finddevice(const char *name)
293{ 293{
294 unsigned long args[5]; 294 unsigned long args[5];
295 295
@@ -307,7 +307,7 @@ prom_finddevice(const char *name)
307} 307}
308EXPORT_SYMBOL(prom_finddevice); 308EXPORT_SYMBOL(prom_finddevice);
309 309
310int prom_node_has_property(int node, const char *prop) 310int prom_node_has_property(phandle node, const char *prop)
311{ 311{
312 char buf [32]; 312 char buf [32];
313 313
@@ -325,7 +325,7 @@ EXPORT_SYMBOL(prom_node_has_property);
325 * of 'size' bytes. Return the number of bytes the prom accepted. 325 * of 'size' bytes. Return the number of bytes the prom accepted.
326 */ 326 */
327int 327int
328prom_setprop(int node, const char *pname, char *value, int size) 328prom_setprop(phandle node, const char *pname, char *value, int size)
329{ 329{
330 unsigned long args[8]; 330 unsigned long args[8];
331 331
@@ -355,10 +355,10 @@ prom_setprop(int node, const char *pname, char *value, int size)
355} 355}
356EXPORT_SYMBOL(prom_setprop); 356EXPORT_SYMBOL(prom_setprop);
357 357
358inline int prom_inst2pkg(int inst) 358inline phandle prom_inst2pkg(int inst)
359{ 359{
360 unsigned long args[5]; 360 unsigned long args[5];
361 int node; 361 phandle node;
362 362
363 args[0] = (unsigned long) "instance-to-package"; 363 args[0] = (unsigned long) "instance-to-package";
364 args[1] = 1; 364 args[1] = 1;
@@ -377,10 +377,10 @@ inline int prom_inst2pkg(int inst)
377/* Return 'node' assigned to a particular prom 'path' 377/* Return 'node' assigned to a particular prom 'path'
378 * FIXME: Should work for v0 as well 378 * FIXME: Should work for v0 as well
379 */ 379 */
380int 380phandle prom_pathtoinode(const char *path)
381prom_pathtoinode(const char *path)
382{ 381{
383 int node, inst; 382 phandle node;
383 int inst;
384 384
385 inst = prom_devopen (path); 385 inst = prom_devopen (path);
386 if (inst == 0) 386 if (inst == 0)