Browse Source

Plan 9 from Bell Labs 2013-02-22

David du Colombier 11 years ago
parent
commit
edb399c51c
5 changed files with 27 additions and 3 deletions
  1. 2 2
      sys/doc/port.ms
  2. 22 0
      sys/src/9/bcm/archbcm.c
  3. 1 0
      sys/src/9/bcm/clock.c
  4. 1 0
      sys/src/9/bcm/fns.h
  5. 1 1
      sys/src/cmd/plumb/fsys.c

+ 2 - 2
sys/doc/port.ms

@@ -294,10 +294,10 @@ we hope to add USB, flash memory and video drivers.
 .SH
 The Broadcom 2835 operating system
 .PP
-This is terminal and CPU kernels for the ARM1176 processor
+This consists of terminal and CPU kernels for the ARM1176 processor
 in the Broadcom 2835 system-on-a-chip.
 The hardware includes VFP2 floating-point.
-It runs on the Raspberry Pi Model B.
+It runs on the Raspberry Pi Models A and B.
 .
 .ig
 .SH

+ 22 - 0
sys/src/9/bcm/archbcm.c

@@ -18,6 +18,7 @@
 
 enum {
 	Wdogfreq	= 65536,
+	Wdogtime	= 5,	/* seconds, ≤ 15 */
 };
 
 /*
@@ -28,6 +29,7 @@ enum {
 		Password	= 0x5A<<24,
 		CfgMask		= 0x03<<4,
 		CfgReset	= 0x02<<4,
+	Rsts		= 0x20>>2,
 	Wdog		= 0x24>>2,
 };
 
@@ -50,6 +52,25 @@ archreboot(void)
 		;
 }
 
+static void
+wdogfeed(void)
+{
+	u32int *r;
+
+	r = (u32int*)POWERREGS;
+	r[Wdog] = Password | (Wdogtime * Wdogfreq);
+	r[Rstc] = Password | (r[Rstc] & ~CfgMask) | CfgReset;
+}
+
+void
+wdogoff(void)
+{
+	u32int *r;
+
+	r = (u32int*)POWERREGS;
+	r[Rstc] = Password | (r[Rstc] & ~CfgMask);
+}
+	
 void
 cpuidprint(void)
 {
@@ -59,6 +80,7 @@ cpuidprint(void)
 void
 archbcmlink(void)
 {
+	addclock0link(wdogfeed, HZ);
 }
 
 int

+ 1 - 0
sys/src/9/bcm/clock.c

@@ -84,6 +84,7 @@ clockshutdown(void)
 
 	tm = (Armtimer*)ARMTIMER;
 	tm->ctl = 0;
+	wdogoff();
 }
 
 void

+ 1 - 0
sys/src/9/bcm/fns.h

@@ -73,6 +73,7 @@ extern void uartconsinit(void);
 extern int userureg(Ureg*);
 extern void vectors(void);
 extern void vtable(void);
+extern void wdogoff(void);
 
 /*
  * floating point emulation

+ 1 - 1
sys/src/cmd/plumb/fsys.c

@@ -10,7 +10,7 @@
 
 enum
 {
-	Stack = 8*1024
+	Stack = 16*1024
 };
 
 typedef struct Dirtab Dirtab;