2005-04-17 06:20:36 +08:00
|
|
|
/* $Id: misc.c,v 1.20 2001/09/21 03:17:07 kanoj Exp $
|
|
|
|
* misc.c: Miscellaneous prom functions that don't belong
|
|
|
|
* anywhere else.
|
|
|
|
*
|
|
|
|
* Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
|
|
|
|
* Copyright (C) 1996,1997 Jakub Jelinek (jj@sunsite.mff.cuni.cz)
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <linux/config.h>
|
|
|
|
#include <linux/types.h>
|
|
|
|
#include <linux/kernel.h>
|
|
|
|
#include <linux/sched.h>
|
|
|
|
#include <linux/interrupt.h>
|
|
|
|
#include <linux/delay.h>
|
|
|
|
#include <asm/openprom.h>
|
|
|
|
#include <asm/oplib.h>
|
|
|
|
#include <asm/system.h>
|
|
|
|
|
|
|
|
/* Reset and reboot the machine with the command 'bcommand'. */
|
[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>
2005-09-23 11:11:33 +08:00
|
|
|
void prom_reboot(const char *bcommand)
|
2005-04-17 06:20:36 +08:00
|
|
|
{
|
|
|
|
p1275_cmd("boot", P1275_ARG(0, P1275_ARG_IN_STRING) |
|
|
|
|
P1275_INOUT(1, 0), bcommand);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Forth evaluate the expression contained in 'fstring'. */
|
[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>
2005-09-23 11:11:33 +08:00
|
|
|
void prom_feval(const char *fstring)
|
2005-04-17 06:20:36 +08:00
|
|
|
{
|
|
|
|
if (!fstring || fstring[0] == 0)
|
|
|
|
return;
|
|
|
|
p1275_cmd("interpret", P1275_ARG(0, P1275_ARG_IN_STRING) |
|
|
|
|
P1275_INOUT(1, 1), fstring);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* We want to do this more nicely some day. */
|
|
|
|
extern void (*prom_palette)(int);
|
|
|
|
|
|
|
|
#ifdef CONFIG_SMP
|
|
|
|
extern void smp_capture(void);
|
|
|
|
extern void smp_release(void);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/* Drop into the prom, with the chance to continue with the 'go'
|
|
|
|
* prom command.
|
|
|
|
*/
|
|
|
|
void prom_cmdline(void)
|
|
|
|
{
|
|
|
|
unsigned long flags;
|
|
|
|
|
|
|
|
local_irq_save(flags);
|
|
|
|
|
|
|
|
if (!serial_console && prom_palette)
|
|
|
|
prom_palette(1);
|
|
|
|
|
|
|
|
#ifdef CONFIG_SMP
|
|
|
|
smp_capture();
|
|
|
|
#endif
|
|
|
|
|
|
|
|
p1275_cmd("enter", P1275_INOUT(0, 0));
|
|
|
|
|
|
|
|
#ifdef CONFIG_SMP
|
|
|
|
smp_release();
|
|
|
|
#endif
|
|
|
|
|
|
|
|
if (!serial_console && prom_palette)
|
|
|
|
prom_palette(0);
|
|
|
|
|
|
|
|
local_irq_restore(flags);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Drop into the prom, but completely terminate the program.
|
|
|
|
* No chance of continuing.
|
|
|
|
*/
|
|
|
|
void prom_halt(void)
|
|
|
|
{
|
|
|
|
again:
|
|
|
|
p1275_cmd("exit", P1275_INOUT(0, 0));
|
|
|
|
goto again; /* PROM is out to get me -DaveM */
|
|
|
|
}
|
|
|
|
|
|
|
|
void prom_halt_power_off(void)
|
|
|
|
{
|
|
|
|
p1275_cmd("SUNW,power-off", P1275_INOUT(0, 0));
|
|
|
|
|
|
|
|
/* if nothing else helps, we just halt */
|
|
|
|
prom_halt();
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Set prom sync handler to call function 'funcp'. */
|
|
|
|
void prom_setcallback(callback_func_t funcp)
|
|
|
|
{
|
|
|
|
if (!funcp)
|
|
|
|
return;
|
|
|
|
p1275_cmd("set-callback", P1275_ARG(0, P1275_ARG_IN_FUNCTION) |
|
|
|
|
P1275_INOUT(1, 1), funcp);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Get the idprom and stuff it into buffer 'idbuf'. Returns the
|
|
|
|
* format type. 'num_bytes' is the number of bytes that your idbuf
|
|
|
|
* has space for. Returns 0xff on error.
|
|
|
|
*/
|
|
|
|
unsigned char prom_get_idprom(char *idbuf, int num_bytes)
|
|
|
|
{
|
|
|
|
int len;
|
|
|
|
|
|
|
|
len = prom_getproplen(prom_root_node, "idprom");
|
|
|
|
if ((len >num_bytes) || (len == -1))
|
|
|
|
return 0xff;
|
|
|
|
if (!prom_getproperty(prom_root_node, "idprom", idbuf, num_bytes))
|
|
|
|
return idbuf[0];
|
|
|
|
|
|
|
|
return 0xff;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Get the major prom version number. */
|
|
|
|
int prom_version(void)
|
|
|
|
{
|
|
|
|
return PROM_P1275;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Get the prom plugin-revision. */
|
|
|
|
int prom_getrev(void)
|
|
|
|
{
|
|
|
|
return prom_rev;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Get the prom firmware print revision. */
|
|
|
|
int prom_getprev(void)
|
|
|
|
{
|
|
|
|
return prom_prev;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Install Linux trap table so PROM uses that instead of its own. */
|
|
|
|
void prom_set_trap_table(unsigned long tba)
|
|
|
|
{
|
|
|
|
p1275_cmd("SUNW,set-trap-table", P1275_INOUT(1, 0), tba);
|
|
|
|
}
|
|
|
|
|
|
|
|
int prom_get_mmu_ihandle(void)
|
|
|
|
{
|
|
|
|
int node, ret;
|
|
|
|
|
[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>
2005-09-23 11:11:33 +08:00
|
|
|
if (prom_mmu_ihandle_cache != 0)
|
|
|
|
return prom_mmu_ihandle_cache;
|
2005-04-17 06:20:36 +08:00
|
|
|
|
[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>
2005-09-23 11:11:33 +08:00
|
|
|
node = prom_finddevice(prom_chosen_path);
|
|
|
|
ret = prom_getint(node, prom_mmu_name);
|
2005-04-17 06:20:36 +08:00
|
|
|
if (ret == -1 || ret == 0)
|
[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>
2005-09-23 11:11:33 +08:00
|
|
|
prom_mmu_ihandle_cache = -1;
|
2005-04-17 06:20:36 +08:00
|
|
|
else
|
[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>
2005-09-23 11:11:33 +08:00
|
|
|
prom_mmu_ihandle_cache = ret;
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int prom_get_memory_ihandle(void)
|
|
|
|
{
|
|
|
|
static int memory_ihandle_cache;
|
|
|
|
int node, ret;
|
|
|
|
|
|
|
|
if (memory_ihandle_cache != 0)
|
|
|
|
return memory_ihandle_cache;
|
|
|
|
|
|
|
|
node = prom_finddevice("/chosen");
|
|
|
|
ret = prom_getint(node, "memory");
|
|
|
|
if (ret == -1 || ret == 0)
|
|
|
|
memory_ihandle_cache = -1;
|
|
|
|
else
|
|
|
|
memory_ihandle_cache = ret;
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Load explicit I/D TLB entries. */
|
|
|
|
long prom_itlb_load(unsigned long index,
|
|
|
|
unsigned long tte_data,
|
|
|
|
unsigned long vaddr)
|
|
|
|
{
|
[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>
2005-09-23 11:11:33 +08:00
|
|
|
return p1275_cmd(prom_callmethod_name,
|
2005-04-17 06:20:36 +08:00
|
|
|
(P1275_ARG(0, P1275_ARG_IN_STRING) |
|
|
|
|
P1275_ARG(2, P1275_ARG_IN_64B) |
|
|
|
|
P1275_ARG(3, P1275_ARG_IN_64B) |
|
|
|
|
P1275_INOUT(5, 1)),
|
|
|
|
"SUNW,itlb-load",
|
|
|
|
prom_get_mmu_ihandle(),
|
|
|
|
/* And then our actual args are pushed backwards. */
|
|
|
|
vaddr,
|
|
|
|
tte_data,
|
|
|
|
index);
|
|
|
|
}
|
|
|
|
|
|
|
|
long prom_dtlb_load(unsigned long index,
|
|
|
|
unsigned long tte_data,
|
|
|
|
unsigned long vaddr)
|
|
|
|
{
|
[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>
2005-09-23 11:11:33 +08:00
|
|
|
return p1275_cmd(prom_callmethod_name,
|
2005-04-17 06:20:36 +08:00
|
|
|
(P1275_ARG(0, P1275_ARG_IN_STRING) |
|
|
|
|
P1275_ARG(2, P1275_ARG_IN_64B) |
|
|
|
|
P1275_ARG(3, P1275_ARG_IN_64B) |
|
|
|
|
P1275_INOUT(5, 1)),
|
|
|
|
"SUNW,dtlb-load",
|
|
|
|
prom_get_mmu_ihandle(),
|
|
|
|
/* And then our actual args are pushed backwards. */
|
|
|
|
vaddr,
|
|
|
|
tte_data,
|
|
|
|
index);
|
|
|
|
}
|
|
|
|
|
|
|
|
int prom_map(int mode, unsigned long size,
|
|
|
|
unsigned long vaddr, unsigned long paddr)
|
|
|
|
{
|
[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>
2005-09-23 11:11:33 +08:00
|
|
|
int ret = p1275_cmd(prom_callmethod_name,
|
2005-04-17 06:20:36 +08:00
|
|
|
(P1275_ARG(0, P1275_ARG_IN_STRING) |
|
|
|
|
P1275_ARG(3, P1275_ARG_IN_64B) |
|
|
|
|
P1275_ARG(4, P1275_ARG_IN_64B) |
|
|
|
|
P1275_ARG(6, P1275_ARG_IN_64B) |
|
|
|
|
P1275_INOUT(7, 1)),
|
[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>
2005-09-23 11:11:33 +08:00
|
|
|
prom_map_name,
|
2005-04-17 06:20:36 +08:00
|
|
|
prom_get_mmu_ihandle(),
|
|
|
|
mode,
|
|
|
|
size,
|
|
|
|
vaddr,
|
|
|
|
0,
|
|
|
|
paddr);
|
|
|
|
|
|
|
|
if (ret == 0)
|
|
|
|
ret = -1;
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
void prom_unmap(unsigned long size, unsigned long vaddr)
|
|
|
|
{
|
[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>
2005-09-23 11:11:33 +08:00
|
|
|
p1275_cmd(prom_callmethod_name,
|
2005-04-17 06:20:36 +08:00
|
|
|
(P1275_ARG(0, P1275_ARG_IN_STRING) |
|
|
|
|
P1275_ARG(2, P1275_ARG_IN_64B) |
|
|
|
|
P1275_ARG(3, P1275_ARG_IN_64B) |
|
|
|
|
P1275_INOUT(4, 0)),
|
[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>
2005-09-23 11:11:33 +08:00
|
|
|
prom_unmap_name,
|
2005-04-17 06:20:36 +08:00
|
|
|
prom_get_mmu_ihandle(),
|
|
|
|
size,
|
|
|
|
vaddr);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Set aside physical memory which is not touched or modified
|
|
|
|
* across soft resets.
|
|
|
|
*/
|
[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>
2005-09-23 11:11:33 +08:00
|
|
|
unsigned long prom_retain(const char *name,
|
2005-04-17 06:20:36 +08:00
|
|
|
unsigned long pa_low, unsigned long pa_high,
|
|
|
|
long size, long align)
|
|
|
|
{
|
|
|
|
/* XXX I don't think we return multiple values correctly.
|
|
|
|
* XXX OBP supposedly returns pa_low/pa_high here, how does
|
|
|
|
* XXX it work?
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* If align is zero, the pa_low/pa_high args are passed,
|
|
|
|
* else they are not.
|
|
|
|
*/
|
|
|
|
if (align == 0)
|
|
|
|
return p1275_cmd("SUNW,retain",
|
|
|
|
(P1275_ARG(0, P1275_ARG_IN_BUF) | P1275_INOUT(5, 2)),
|
|
|
|
name, pa_low, pa_high, size, align);
|
|
|
|
else
|
|
|
|
return p1275_cmd("SUNW,retain",
|
|
|
|
(P1275_ARG(0, P1275_ARG_IN_BUF) | P1275_INOUT(3, 2)),
|
|
|
|
name, size, align);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Get "Unumber" string for the SIMM at the given
|
|
|
|
* memory address. Usually this will be of the form
|
|
|
|
* "Uxxxx" where xxxx is a decimal number which is
|
|
|
|
* etched into the motherboard next to the SIMM slot
|
|
|
|
* in question.
|
|
|
|
*/
|
|
|
|
int prom_getunumber(int syndrome_code,
|
|
|
|
unsigned long phys_addr,
|
|
|
|
char *buf, int buflen)
|
|
|
|
{
|
[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>
2005-09-23 11:11:33 +08:00
|
|
|
return p1275_cmd(prom_callmethod_name,
|
2005-04-17 06:20:36 +08:00
|
|
|
(P1275_ARG(0, P1275_ARG_IN_STRING) |
|
|
|
|
P1275_ARG(3, P1275_ARG_OUT_BUF) |
|
|
|
|
P1275_ARG(6, P1275_ARG_IN_64B) |
|
|
|
|
P1275_INOUT(8, 2)),
|
|
|
|
"SUNW,get-unumber", prom_get_memory_ihandle(),
|
|
|
|
buflen, buf, P1275_SIZE(buflen),
|
|
|
|
0, phys_addr, syndrome_code);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Power management extensions. */
|
|
|
|
void prom_sleepself(void)
|
|
|
|
{
|
|
|
|
p1275_cmd("SUNW,sleep-self", P1275_INOUT(0, 0));
|
|
|
|
}
|
|
|
|
|
|
|
|
int prom_sleepsystem(void)
|
|
|
|
{
|
|
|
|
return p1275_cmd("SUNW,sleep-system", P1275_INOUT(0, 1));
|
|
|
|
}
|
|
|
|
|
|
|
|
int prom_wakeupsystem(void)
|
|
|
|
{
|
|
|
|
return p1275_cmd("SUNW,wakeup-system", P1275_INOUT(0, 1));
|
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef CONFIG_SMP
|
|
|
|
void prom_startcpu(int cpunode, unsigned long pc, unsigned long o0)
|
|
|
|
{
|
|
|
|
p1275_cmd("SUNW,start-cpu", P1275_INOUT(3, 0), cpunode, pc, o0);
|
|
|
|
}
|
|
|
|
|
|
|
|
void prom_stopself(void)
|
|
|
|
{
|
|
|
|
p1275_cmd("SUNW,stop-self", P1275_INOUT(0, 0));
|
|
|
|
}
|
|
|
|
|
|
|
|
void prom_idleself(void)
|
|
|
|
{
|
|
|
|
p1275_cmd("SUNW,idle-self", P1275_INOUT(0, 0));
|
|
|
|
}
|
|
|
|
|
|
|
|
void prom_resumecpu(int cpunode)
|
|
|
|
{
|
|
|
|
p1275_cmd("SUNW,resume-cpu", P1275_INOUT(1, 0), cpunode);
|
|
|
|
}
|
|
|
|
#endif
|