aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-sparc64/oplib.h
diff options
context:
space:
mode:
authorDavid S. Miller <davem@sunset.davemloft.net>2005-09-22 23:11:33 -0400
committerDavid S. Miller <davem@sunset.davemloft.net>2005-09-22 23:11:33 -0400
commitbff06d552240ba7f5b49482a4865871d7bc03dc2 (patch)
treeee760e252023bec338921296b12bb54987bedcac /include/asm-sparc64/oplib.h
parent40fd3533c93f0062b6d1d8540961ef70fc8ab750 (diff)
[SPARC64]: Rewrite bootup sequence.
Instead of all of this cpu-specific code to remap the kernel to the correct location, use portable firmware calls to do this instead. What we do now is the following in position independant assembler: chosen_node = prom_finddevice("/chosen"); prom_mmu_ihandle_cache = prom_getint(chosen_node, "mmu"); vaddr = 4MB_ALIGN(current_text_addr()); prom_translate(vaddr, &paddr_high, &paddr_low, &mode); prom_boot_mapping_mode = mode; prom_boot_mapping_phys_high = paddr_high; prom_boot_mapping_phys_low = paddr_low; prom_map(-1, 8 * 1024 * 1024, KERNBASE, paddr_low); and that replaces the massive amount of by-hand TLB probing and programming we used to do here. The new code should also handle properly the case where the kernel is mapped at the correct address already (think: future kexec support). Consequently, the bulk of remap_kernel() dies as does the entirety of arch/sparc64/prom/map.S We try to share some strings in the PROM library with the ones used at bootup, and while we're here mark input strings to oplib.h routines with "const" when appropriate. There are many more simplifications now possible. For one thing, we can consolidate the two copies we now have of a lot of cpu setup code sitting in head.S and trampoline.S. This is a significant step towards CONFIG_DEBUG_PAGEALLOC support. Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/asm-sparc64/oplib.h')
-rw-r--r--include/asm-sparc64/oplib.h52
1 files changed, 33 insertions, 19 deletions
diff --git a/include/asm-sparc64/oplib.h b/include/asm-sparc64/oplib.h
index a432d9e7daaa..c628189b6c89 100644
--- a/include/asm-sparc64/oplib.h
+++ b/include/asm-sparc64/oplib.h
@@ -38,6 +38,20 @@ extern int prom_stdin, prom_stdout;
38 */ 38 */
39extern int prom_chosen_node; 39extern int prom_chosen_node;
40 40
41/* Helper values and strings in arch/sparc64/kernel/head.S */
42extern const char prom_finddev_name[];
43extern const char prom_chosen_path[];
44extern const char prom_getprop_name[];
45extern const char prom_mmu_name[];
46extern const char prom_callmethod_name[];
47extern const char prom_translate_name[];
48extern const char prom_map_name[];
49extern const char prom_unmap_name[];
50extern int prom_mmu_ihandle_cache;
51extern unsigned int prom_boot_mapped_pc;
52extern unsigned int prom_boot_mapping_mode;
53extern unsigned long prom_boot_mapping_phys_high, prom_boot_mapping_phys_low;
54
41struct linux_mlist_p1275 { 55struct linux_mlist_p1275 {
42 struct linux_mlist_p1275 *theres_more; 56 struct linux_mlist_p1275 *theres_more;
43 unsigned long start_adr; 57 unsigned long start_adr;
@@ -68,7 +82,7 @@ extern char *prom_getbootargs(void);
68 * of the string is different on V0 vs. V2->higher proms. The caller must 82 * of the string is different on V0 vs. V2->higher proms. The caller must
69 * know what he/she is doing! Returns the device descriptor, an int. 83 * know what he/she is doing! Returns the device descriptor, an int.
70 */ 84 */
71extern int prom_devopen(char *device_string); 85extern int prom_devopen(const char *device_string);
72 86
73/* Close a previously opened device described by the passed integer 87/* Close a previously opened device described by the passed integer
74 * descriptor. 88 * descriptor.
@@ -98,10 +112,10 @@ extern struct linux_mem_p1275 *prom_meminfo(void);
98/* Miscellaneous routines, don't really fit in any category per se. */ 112/* Miscellaneous routines, don't really fit in any category per se. */
99 113
100/* Reboot the machine with the command line passed. */ 114/* Reboot the machine with the command line passed. */
101extern void prom_reboot(char *boot_command); 115extern void prom_reboot(const char *boot_command);
102 116
103/* Evaluate the forth string passed. */ 117/* Evaluate the forth string passed. */
104extern void prom_feval(char *forth_string); 118extern void prom_feval(const char *forth_string);
105 119
106/* Enter the prom, with possibility of continuation with the 'go' 120/* Enter the prom, with possibility of continuation with the 'go'
107 * command in newer proms. 121 * command in newer proms.
@@ -154,7 +168,7 @@ extern char prom_getchar(void);
154extern void prom_putchar(char character); 168extern void prom_putchar(char character);
155 169
156/* Prom's internal routines, don't use in kernel/boot code. */ 170/* Prom's internal routines, don't use in kernel/boot code. */
157extern void prom_printf(char *fmt, ...); 171extern void prom_printf(const char *fmt, ...);
158extern void prom_write(const char *buf, unsigned int len); 172extern void prom_write(const char *buf, unsigned int len);
159 173
160/* Query for input device type */ 174/* Query for input device type */
@@ -215,7 +229,7 @@ extern int prom_getunumber(int syndrome_code,
215 char *buf, int buflen); 229 char *buf, int buflen);
216 230
217/* Retain physical memory to the caller across soft resets. */ 231/* Retain physical memory to the caller across soft resets. */
218extern unsigned long prom_retain(char *name, 232extern unsigned long prom_retain(const char *name,
219 unsigned long pa_low, unsigned long pa_high, 233 unsigned long pa_low, unsigned long pa_high,
220 long size, long align); 234 long size, long align);
221 235
@@ -269,28 +283,28 @@ extern int prom_getsibling(int node);
269/* Get the length, at the passed node, of the given property type. 283/* Get the length, at the passed node, of the given property type.
270 * Returns -1 on error (ie. no such property at this node). 284 * Returns -1 on error (ie. no such property at this node).
271 */ 285 */
272extern int prom_getproplen(int thisnode, char *property); 286extern int prom_getproplen(int thisnode, const char *property);
273 287
274/* Fetch the requested property using the given buffer. Returns 288/* Fetch the requested property using the given buffer. Returns
275 * the number of bytes the prom put into your buffer or -1 on error. 289 * the number of bytes the prom put into your buffer or -1 on error.
276 */ 290 */
277extern int prom_getproperty(int thisnode, char *property, 291extern int prom_getproperty(int thisnode, const char *property,
278 char *prop_buffer, int propbuf_size); 292 char *prop_buffer, int propbuf_size);
279 293
280/* Acquire an integer property. */ 294/* Acquire an integer property. */
281extern int prom_getint(int node, char *property); 295extern int prom_getint(int node, const char *property);
282 296
283/* Acquire an integer property, with a default value. */ 297/* Acquire an integer property, with a default value. */
284extern int prom_getintdefault(int node, char *property, int defval); 298extern int prom_getintdefault(int node, const char *property, int defval);
285 299
286/* Acquire a boolean property, 0=FALSE 1=TRUE. */ 300/* Acquire a boolean property, 0=FALSE 1=TRUE. */
287extern int prom_getbool(int node, char *prop); 301extern int prom_getbool(int node, const char *prop);
288 302
289/* Acquire a string property, null string on error. */ 303/* Acquire a string property, null string on error. */
290extern void prom_getstring(int node, char *prop, char *buf, int bufsize); 304extern void prom_getstring(int node, const char *prop, char *buf, int bufsize);
291 305
292/* Does the passed node have the given "name"? YES=1 NO=0 */ 306/* Does the passed node have the given "name"? YES=1 NO=0 */
293extern int prom_nodematch(int thisnode, char *name); 307extern int prom_nodematch(int thisnode, const char *name);
294 308
295/* Puts in buffer a prom name in the form name@x,y or name (x for which_io 309/* Puts in buffer a prom name in the form name@x,y or name (x for which_io
296 * and y for first regs phys address 310 * and y for first regs phys address
@@ -300,7 +314,7 @@ extern int prom_getname(int node, char *buf, int buflen);
300/* Search all siblings starting at the passed node for "name" matching 314/* Search all siblings starting at the passed node for "name" matching
301 * the given string. Returns the node on success, zero on failure. 315 * the given string. Returns the node on success, zero on failure.
302 */ 316 */
303extern int prom_searchsiblings(int node_start, char *name); 317extern int prom_searchsiblings(int node_start, const char *name);
304 318
305/* Return the first property type, as a string, for the given node. 319/* Return the first property type, as a string, for the given node.
306 * Returns a null string on error. Buffer should be at least 32B long. 320 * Returns a null string on error. Buffer should be at least 32B long.
@@ -310,21 +324,21 @@ extern char *prom_firstprop(int node, char *buffer);
310/* Returns the next property after the passed property for the given 324/* Returns the next property after the passed property for the given
311 * node. Returns null string on failure. Buffer should be at least 32B long. 325 * node. Returns null string on failure. Buffer should be at least 32B long.
312 */ 326 */
313extern char *prom_nextprop(int node, char *prev_property, char *buffer); 327extern char *prom_nextprop(int node, const char *prev_property, char *buffer);
314 328
315/* Returns 1 if the specified node has given property. */ 329/* Returns 1 if the specified node has given property. */
316extern int prom_node_has_property(int node, char *property); 330extern int prom_node_has_property(int node, const char *property);
317 331
318/* Returns phandle of the path specified */ 332/* Returns phandle of the path specified */
319extern int prom_finddevice(char *name); 333extern int prom_finddevice(const char *name);
320 334
321/* Set the indicated property at the given node with the passed value. 335/* Set the indicated property at the given node with the passed value.
322 * Returns the number of bytes of your value that the prom took. 336 * Returns the number of bytes of your value that the prom took.
323 */ 337 */
324extern int prom_setprop(int node, char *prop_name, char *prop_value, 338extern int prom_setprop(int node, const char *prop_name, char *prop_value,
325 int value_size); 339 int value_size);
326 340
327extern int prom_pathtoinode(char *path); 341extern int prom_pathtoinode(const char *path);
328extern int prom_inst2pkg(int); 342extern int prom_inst2pkg(int);
329 343
330/* CPU probing helpers. */ 344/* CPU probing helpers. */
@@ -334,7 +348,7 @@ int cpu_find_by_mid(int mid, int *prom_node);
334/* Client interface level routines. */ 348/* Client interface level routines. */
335extern void prom_set_trap_table(unsigned long tba); 349extern void prom_set_trap_table(unsigned long tba);
336 350
337extern long p1275_cmd (char *, long, ...); 351extern long p1275_cmd(const char *, long, ...);
338 352
339 353
340#if 0 354#if 0