aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sparc/include
diff options
context:
space:
mode:
authorAndres Salomon <dilinger@queued.net>2010-10-08 17:18:11 -0400
committerGrant Likely <grant.likely@secretlab.ca>2010-10-09 04:33:34 -0400
commit8d1255627d4ce9cb4b9d0a1c44b6c18d92e84a99 (patch)
tree0167da953304dbabc87ab871368bcc3c10660fa8 /arch/sparc/include
parent4e13efc99106723960a27e55f560028bced5076d (diff)
of/sparc: convert various prom_* functions to use phandle
Rather than passing around ints everywhere, use the phandle type where appropriate for the various functions that talk to the PROM. Signed-off-by: Andres Salomon <dilinger@queued.net> Acked-by: David S. Miller <davem@davemloft.net> Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
Diffstat (limited to 'arch/sparc/include')
-rw-r--r--arch/sparc/include/asm/floppy_32.h3
-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
4 files changed, 53 insertions, 49 deletions
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/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