[OpenBIOS] r166 - in openbios-devel: arch/sparc32 drivers

svn at openbios.org svn at openbios.org
Fri Jul 20 13:23:30 CEST 2007


Author: blueswirl
Date: 2007-07-20 13:23:30 +0200 (Fri, 20 Jul 2007)
New Revision: 166

Modified:
   openbios-devel/arch/sparc32/init.fs
   openbios-devel/arch/sparc32/romvec.c
   openbios-devel/drivers/iommu.c
   openbios-devel/drivers/obio.c
Log:
Fix mapping of a single byte area, fix reset and poweroff

Modified: openbios-devel/arch/sparc32/init.fs
===================================================================
--- openbios-devel/arch/sparc32/init.fs	2007-07-11 19:48:31 UTC (rev 165)
+++ openbios-devel/arch/sparc32/init.fs	2007-07-20 11:23:30 UTC (rev 166)
@@ -52,12 +52,6 @@
  
 device-end
 
-: sparc32-reset-all
-  h# 71f00000 1 iow!
-  ;
-
-' sparc32-reset-all to reset-all
-
 : rmap@    ( virt -- rmentry )
   drop 0
   ;

Modified: openbios-devel/arch/sparc32/romvec.c
===================================================================
--- openbios-devel/arch/sparc32/romvec.c	2007-07-11 19:48:31 UTC (rev 165)
+++ openbios-devel/arch/sparc32/romvec.c	2007-07-20 11:23:30 UTC (rev 166)
@@ -244,7 +244,7 @@
 
 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_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_halt(void)
 {
-    extern volatile int *power_reg;
+    extern volatile unsigned char *power_reg;
 
     printk("halt, power off\n");
     *power_reg = 1;

Modified: openbios-devel/drivers/iommu.c
===================================================================
--- openbios-devel/drivers/iommu.c	2007-07-11 19:48:31 UTC (rev 165)
+++ openbios-devel/drivers/iommu.c	2007-07-20 11:23:30 UTC (rev 166)
@@ -195,7 +195,7 @@
     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);

Modified: openbios-devel/drivers/obio.c
===================================================================
--- openbios-devel/drivers/obio.c	2007-07-11 19:48:31 UTC (rev 165)
+++ openbios-devel/drivers/obio.c	2007-07-20 11:23:30 UTC (rev 166)
@@ -812,9 +812,15 @@
     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)
 {
     ob_new_obio_device("power", NULL);
@@ -824,6 +830,10 @@
     // 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");




More information about the OpenBIOS mailing list