mirror of
https://gitlab.com/qemu-project/openbios.git
synced 2024-02-13 08:34:06 +08:00
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:
@@ -52,12 +52,6 @@
|
||||
|
||||
device-end
|
||||
|
||||
: sparc32-reset-all
|
||||
h# 71f00000 1 iow!
|
||||
;
|
||||
|
||||
' sparc32-reset-all to reset-all
|
||||
|
||||
: rmap@ ( virt -- rmentry )
|
||||
drop 0
|
||||
;
|
||||
|
||||
@@ -244,7 +244,7 @@ static int obp_nbputchar(int ch)
|
||||
|
||||
static void obp_reboot(char *str)
|
||||
{
|
||||
extern volatile int *reset_reg;
|
||||
extern volatile unsigned char *reset_reg;
|
||||
|
||||
printk("rebooting (%s)\n", str);
|
||||
*reset_reg = 1;
|
||||
@@ -254,7 +254,7 @@ static void obp_reboot(char *str)
|
||||
|
||||
static void obp_abort(void)
|
||||
{
|
||||
extern volatile int *power_reg;
|
||||
extern volatile unsigned char *power_reg;
|
||||
|
||||
printk("abort, power off\n");
|
||||
*power_reg = 1;
|
||||
@@ -264,7 +264,7 @@ static void obp_abort(void)
|
||||
|
||||
static void obp_halt(void)
|
||||
{
|
||||
extern volatile int *power_reg;
|
||||
extern volatile unsigned char *power_reg;
|
||||
|
||||
printk("halt, power off\n");
|
||||
*power_reg = 1;
|
||||
|
||||
@@ -195,7 +195,7 @@ map_io(uint64_t pa, int size)
|
||||
unsigned int mva;
|
||||
|
||||
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);
|
||||
|
||||
va = mem_alloc(&cio, npages * PAGE_SIZE, PAGE_SIZE);
|
||||
|
||||
@@ -812,7 +812,13 @@ ob_auxio_init(uint64_t base, uint64_t offset)
|
||||
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
|
||||
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
|
||||
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);
|
||||
|
||||
fword("finish-device");
|
||||
|
||||
Reference in New Issue
Block a user