[OpenBIOS] r180 - openbios-devel/drivers

svn at openbios.org svn at openbios.org
Sun Dec 9 18:04:52 CET 2007


Author: blueswirl
Date: 2007-12-09 18:04:51 +0100 (Sun, 09 Dec 2007)
New Revision: 180

Modified:
   openbios-devel/drivers/obio.c
   openbios-devel/drivers/obio.h
Log:
Add support for eccmemctl

Modified: openbios-devel/drivers/obio.c
===================================================================
--- openbios-devel/drivers/obio.c	2007-11-19 19:11:38 UTC (rev 179)
+++ openbios-devel/drivers/obio.c	2007-12-09 17:04:51 UTC (rev 180)
@@ -72,9 +72,10 @@
 }
 
 static unsigned long
-ob_reg(uint64_t base, uint64_t offset, unsigned long size, int map)
+map_reg(uint64_t base, uint64_t offset, unsigned long size, int map,
+        int phys_hi)
 {
-    PUSH(0);
+    PUSH(phys_hi);
     fword("encode-int");
     PUSH(offset);
     fword("encode-int");
@@ -102,6 +103,12 @@
     return 0;
 }
 
+static unsigned long
+ob_reg(uint64_t base, uint64_t offset, unsigned long size, int map)
+{
+    return map_reg(base, offset, size, map, 0);
+}
+
 static void
 ob_intr(int intr)
 {
@@ -289,6 +296,47 @@
     }
 }
 
+static void
+ob_eccmemctl_init(void)
+{
+    uint32_t version, *regs;
+    const char *mc_type;
+
+    push_str("/");
+    fword("find-device");
+    fword("new-device");
+
+    push_str("eccmemctl");
+    fword("device-name");
+
+    PUSH(0x20);
+    fword("encode-int");
+    push_str("width");
+    fword("property");
+
+    regs = map_reg(ECC_BASE, 0, ECC_SIZE, 1, ECC_BASE >> 32);
+
+    version = regs[0];
+    switch (version) {
+    case 0x00000000:
+        mc_type = "MCC";
+        break;
+    case 0x10000000:
+        mc_type = "EMC";
+        break;
+    default:
+    case 0x20000000:
+        mc_type = "SMC";
+        break;
+    }
+    push_str(mc_type);
+    fword("encode-string");
+    push_str("mc-type");
+    fword("property");
+
+    fword("finish-device");
+}
+
 static unsigned char *nvram;
 ohwcfg_v3_t nv_info;
 
@@ -752,6 +800,7 @@
         fword("encode-string");
         push_str("name");
         fword("property");
+        ob_eccmemctl_init();
         break;
     case 0x72:
         push_str("SPARCstation 10 (1 X 390Z55)");
@@ -766,6 +815,7 @@
         fword("encode-string");
         push_str("name");
         fword("property");
+        ob_eccmemctl_init();
         break;
     case 0x80:
         push_str("SPARCstation 5");

Modified: openbios-devel/drivers/obio.h
===================================================================
--- openbios-devel/drivers/obio.h	2007-11-19 19:11:38 UTC (rev 179)
+++ openbios-devel/drivers/obio.h	2007-12-09 17:04:51 UTC (rev 180)
@@ -32,6 +32,9 @@
 #define SLAVIO_RESET     0x00f00000ULL
 #define RESET_REGS       1
 
+#define ECC_BASE         0xf00000000ULL
+#define ECC_SIZE         0x20
+
 #define SLAVIO_SIZE      0x01000000
 
 #define SUN4M_NCPUS      16




More information about the OpenBIOS mailing list