Fix mapping of a single byte area, fix reset and poweroff

git-svn-id: svn://coreboot.org/openbios/openbios-devel@166 f158a5a8-5612-0410-a976-696ce0be7e32
This commit is contained in:
Blue Swirl
2007-07-20 11:23:30 +00:00
parent 1d39ac97cb
commit bca00a2c33
4 changed files with 15 additions and 11 deletions

View File

@@ -52,12 +52,6 @@
device-end device-end
: sparc32-reset-all
h# 71f00000 1 iow!
;
' sparc32-reset-all to reset-all
: rmap@ ( virt -- rmentry ) : rmap@ ( virt -- rmentry )
drop 0 drop 0
; ;

View File

@@ -244,7 +244,7 @@ static int obp_nbputchar(int ch)
static void obp_reboot(char *str) static void obp_reboot(char *str)
{ {
extern volatile int *reset_reg; extern volatile unsigned char *reset_reg;
printk("rebooting (%s)\n", str); printk("rebooting (%s)\n", str);
*reset_reg = 1; *reset_reg = 1;
@@ -254,7 +254,7 @@ static void obp_reboot(char *str)
static void obp_abort(void) static void obp_abort(void)
{ {
extern volatile int *power_reg; extern volatile unsigned char *power_reg;
printk("abort, power off\n"); printk("abort, power off\n");
*power_reg = 1; *power_reg = 1;
@@ -264,7 +264,7 @@ static void obp_abort(void)
static void obp_halt(void) static void obp_halt(void)
{ {
extern volatile int *power_reg; extern volatile unsigned char *power_reg;
printk("halt, power off\n"); printk("halt, power off\n");
*power_reg = 1; *power_reg = 1;

View File

@@ -195,7 +195,7 @@ map_io(uint64_t pa, int size)
unsigned int mva; unsigned int mva;
off = pa & (PAGE_SIZE - 1); off = pa & (PAGE_SIZE - 1);
npages = (off + (size - 1) + (PAGE_SIZE - 1)) / PAGE_SIZE; npages = (off + size - 1) / PAGE_SIZE + 1;
pa &= ~(PAGE_SIZE - 1); pa &= ~(PAGE_SIZE - 1);
va = mem_alloc(&cio, npages * PAGE_SIZE, PAGE_SIZE); va = mem_alloc(&cio, npages * PAGE_SIZE, PAGE_SIZE);

View File

@@ -812,7 +812,13 @@ ob_auxio_init(uint64_t base, uint64_t offset)
fword("finish-device"); fword("finish-device");
} }
volatile int *power_reg, *reset_reg; volatile unsigned char *power_reg, *reset_reg;
static void
sparc32_reset_all(void)
{
*reset_reg = 1;
}
static void static void
ob_power_init(uint64_t base, uint64_t offset, int intr) ob_power_init(uint64_t base, uint64_t offset, int intr)
@@ -824,6 +830,10 @@ ob_power_init(uint64_t base, uint64_t offset, int intr)
// Not in device tree // Not in device tree
reset_reg = map_io(base + (uint64_t)SLAVIO_RESET, RESET_REGS); reset_reg = map_io(base + (uint64_t)SLAVIO_RESET, RESET_REGS);
bind_func("sparc32-reset-all", sparc32_reset_all);
push_str("' sparc32-reset-all to reset-all");
fword("eval");
ob_intr(intr); ob_intr(intr);
fword("finish-device"); fword("finish-device");