aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sparc/include/asm/oplib_32.h
diff options
context:
space:
mode:
Diffstat (limited to 'arch/sparc/include/asm/oplib_32.h')
-rw-r--r--arch/sparc/include/asm/oplib_32.h119
1 files changed, 25 insertions, 94 deletions
diff --git a/arch/sparc/include/asm/oplib_32.h b/arch/sparc/include/asm/oplib_32.h
index 33e31ce6b31f..71e5e9aeb67e 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,
@@ -48,37 +48,6 @@ extern void prom_init(struct linux_romvec *rom_ptr);
48/* Boot argument acquisition, returns the boot command line string. */ 48/* Boot argument acquisition, returns the boot command line string. */
49extern char *prom_getbootargs(void); 49extern char *prom_getbootargs(void);
50 50
51/* Device utilities. */
52
53/* Map and unmap devices in IO space at virtual addresses. Note that the
54 * virtual address you pass is a request and the prom may put your mappings
55 * somewhere else, so check your return value as that is where your new
56 * mappings really are!
57 *
58 * Another note, these are only available on V2 or higher proms!
59 */
60extern char *prom_mapio(char *virt_hint, int io_space, unsigned int phys_addr, unsigned int num_bytes);
61extern void prom_unmapio(char *virt_addr, unsigned int num_bytes);
62
63/* Device operations. */
64
65/* Open the device described by the passed string. Note, that the format
66 * of the string is different on V0 vs. V2->higher proms. The caller must
67 * know what he/she is doing! Returns the device descriptor, an int.
68 */
69extern int prom_devopen(char *device_string);
70
71/* Close a previously opened device described by the passed integer
72 * descriptor.
73 */
74extern int prom_devclose(int device_handle);
75
76/* Do a seek operation on the device described by the passed integer
77 * descriptor.
78 */
79extern void prom_seek(int device_handle, unsigned int seek_hival,
80 unsigned int seek_lowval);
81
82/* Miscellaneous routines, don't really fit in any category per se. */ 51/* Miscellaneous routines, don't really fit in any category per se. */
83 52
84/* Reboot the machine with the command line passed. */ 53/* Reboot the machine with the command line passed. */
@@ -95,7 +64,7 @@ extern void prom_cmdline(void);
95/* Enter the prom, with no chance of continuation for the stand-alone 64/* Enter the prom, with no chance of continuation for the stand-alone
96 * which calls this. 65 * which calls this.
97 */ 66 */
98extern void prom_halt(void) __attribute__ ((noreturn)); 67extern void __noreturn prom_halt(void);
99 68
100/* Set the PROM 'sync' callback function to the passed function pointer. 69/* Set the PROM 'sync' callback function to the passed function pointer.
101 * When the user gives the 'sync' command at the prom prompt while the 70 * When the user gives the 'sync' command at the prom prompt while the
@@ -121,19 +90,8 @@ extern int prom_getrev(void);
121/* Get the prom firmware revision. */ 90/* Get the prom firmware revision. */
122extern int prom_getprev(void); 91extern int prom_getprev(void);
123 92
124/* Character operations to/from the console.... */ 93/* Write a buffer of characters to the console. */
125 94extern void prom_console_write_buf(const char *buf, int len);
126/* Non-blocking get character from console. */
127extern int prom_nbgetchar(void);
128
129/* Non-blocking put character to console. */
130extern int prom_nbputchar(char character);
131
132/* Blocking get character from console. */
133extern char prom_getchar(void);
134
135/* Blocking put character to console. */
136extern void prom_putchar(char character);
137 95
138/* Prom's internal routines, don't use in kernel/boot code. */ 96/* Prom's internal routines, don't use in kernel/boot code. */
139extern void prom_printf(const char *fmt, ...); 97extern void prom_printf(const char *fmt, ...);
@@ -147,25 +105,6 @@ extern void prom_write(const char *buf, unsigned int len);
147extern int prom_startcpu(int cpunode, struct linux_prom_registers *context_table, 105extern int prom_startcpu(int cpunode, struct linux_prom_registers *context_table,
148 int context, char *program_counter); 106 int context, char *program_counter);
149 107
150/* Stop the CPU with the passed device tree node. */
151extern int prom_stopcpu(int cpunode);
152
153/* Idle the CPU with the passed device tree node. */
154extern int prom_idlecpu(int cpunode);
155
156/* Re-Start the CPU with the passed device tree node. */
157extern int prom_restartcpu(int cpunode);
158
159/* PROM memory allocation facilities... */
160
161/* Allocated at possibly the given virtual address a chunk of the
162 * indicated size.
163 */
164extern char *prom_alloc(char *virt_hint, unsigned int size);
165
166/* Free a previously allocated chunk. */
167extern void prom_free(char *virt_addr, unsigned int size);
168
169/* Sun4/sun4c specific memory-management startup hook. */ 108/* Sun4/sun4c specific memory-management startup hook. */
170 109
171/* Map the passed segment in the given context at the passed 110/* Map the passed segment in the given context at the passed
@@ -174,72 +113,62 @@ extern void prom_free(char *virt_addr, unsigned int size);
174extern void prom_putsegment(int context, unsigned long virt_addr, 113extern void prom_putsegment(int context, unsigned long virt_addr,
175 int physical_segment); 114 int physical_segment);
176 115
116/* Initialize the memory lists based upon the prom version. */
117void prom_meminit(void);
177 118
178/* PROM device tree traversal functions... */ 119/* PROM device tree traversal functions... */
179 120
180/* Get the child node of the given node, or zero if no child exists. */ 121/* Get the child node of the given node, or zero if no child exists. */
181extern int prom_getchild(int parent_node); 122extern phandle prom_getchild(phandle parent_node);
182 123
183/* Get the next sibling node of the given node, or zero if no further 124/* Get the next sibling node of the given node, or zero if no further
184 * siblings exist. 125 * siblings exist.
185 */ 126 */
186extern int prom_getsibling(int node); 127extern phandle prom_getsibling(phandle node);
187 128
188/* Get the length, at the passed node, of the given property type. 129/* Get the length, at the passed node, of the given property type.
189 * Returns -1 on error (ie. no such property at this node). 130 * Returns -1 on error (ie. no such property at this node).
190 */ 131 */
191extern int prom_getproplen(int thisnode, const char *property); 132extern int prom_getproplen(phandle thisnode, const char *property);
192 133
193/* Fetch the requested property using the given buffer. Returns 134/* Fetch the requested property using the given buffer. Returns
194 * the number of bytes the prom put into your buffer or -1 on error. 135 * the number of bytes the prom put into your buffer or -1 on error.
195 */ 136 */
196extern int __must_check prom_getproperty(int thisnode, const char *property, 137extern int __must_check prom_getproperty(phandle thisnode, const char *property,
197 char *prop_buffer, int propbuf_size); 138 char *prop_buffer, int propbuf_size);
198 139
199/* Acquire an integer property. */ 140/* Acquire an integer property. */
200extern int prom_getint(int node, char *property); 141extern int prom_getint(phandle node, char *property);
201 142
202/* Acquire an integer property, with a default value. */ 143/* Acquire an integer property, with a default value. */
203extern int prom_getintdefault(int node, char *property, int defval); 144extern int prom_getintdefault(phandle node, char *property, int defval);
204 145
205/* Acquire a boolean property, 0=FALSE 1=TRUE. */ 146/* Acquire a boolean property, 0=FALSE 1=TRUE. */
206extern int prom_getbool(int node, char *prop); 147extern int prom_getbool(phandle node, char *prop);
207 148
208/* Acquire a string property, null string on error. */ 149/* Acquire a string property, null string on error. */
209extern void prom_getstring(int node, char *prop, char *buf, int bufsize); 150extern void prom_getstring(phandle node, char *prop, char *buf, int bufsize);
210
211/* Does the passed node have the given "name"? YES=1 NO=0 */
212extern int prom_nodematch(int thisnode, char *name);
213 151
214/* Search all siblings starting at the passed node for "name" matching 152/* Search all siblings starting at the passed node for "name" matching
215 * the given string. Returns the node on success, zero on failure. 153 * the given string. Returns the node on success, zero on failure.
216 */ 154 */
217extern int prom_searchsiblings(int node_start, char *name); 155extern phandle prom_searchsiblings(phandle node_start, char *name);
218
219/* Return the first property type, as a string, for the given node.
220 * Returns a null string on error.
221 */
222extern char *prom_firstprop(int node, char *buffer);
223 156
224/* Returns the next property after the passed property for the given 157/* Returns the next property after the passed property for the given
225 * node. Returns null string on failure. 158 * node. Returns null string on failure.
226 */ 159 */
227extern char *prom_nextprop(int node, char *prev_property, char *buffer); 160extern char *prom_nextprop(phandle node, char *prev_property, char *buffer);
228 161
229/* Returns phandle of the path specified */ 162/* Returns phandle of the path specified */
230extern int prom_finddevice(char *name); 163extern phandle prom_finddevice(char *name);
231
232/* Returns 1 if the specified node has given property. */
233extern int prom_node_has_property(int node, char *property);
234 164
235/* Set the indicated property at the given node with the passed value. 165/* 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. 166 * Returns the number of bytes of your value that the prom took.
237 */ 167 */
238extern int prom_setprop(int node, const char *prop_name, char *prop_value, 168extern int prom_setprop(phandle node, const char *prop_name, char *prop_value,
239 int value_size); 169 int value_size);
240 170
241extern int prom_pathtoinode(char *path); 171extern phandle prom_inst2pkg(int);
242extern int prom_inst2pkg(int);
243 172
244/* Dorking with Bus ranges... */ 173/* Dorking with Bus ranges... */
245 174
@@ -247,13 +176,15 @@ extern int prom_inst2pkg(int);
247extern void prom_apply_obio_ranges(struct linux_prom_registers *obioregs, int nregs); 176extern void prom_apply_obio_ranges(struct linux_prom_registers *obioregs, int nregs);
248 177
249/* Apply ranges of any prom node (and optionally parent node as well) to registers. */ 178/* Apply ranges of any prom node (and optionally parent node as well) to registers. */
250extern void prom_apply_generic_ranges(int node, int parent, 179extern void prom_apply_generic_ranges(phandle node, phandle parent,
251 struct linux_prom_registers *sbusregs, int nregs); 180 struct linux_prom_registers *sbusregs, int nregs);
252 181
182void prom_ranges_init(void);
183
253/* CPU probing helpers. */ 184/* CPU probing helpers. */
254int cpu_find_by_instance(int instance, int *prom_node, int *mid); 185int cpu_find_by_instance(int instance, phandle *prom_node, int *mid);
255int cpu_find_by_mid(int mid, int *prom_node); 186int cpu_find_by_mid(int mid, phandle *prom_node);
256int cpu_get_hwmid(int prom_node); 187int cpu_get_hwmid(phandle prom_node);
257 188
258extern spinlock_t prom_lock; 189extern spinlock_t prom_lock;
259 190