shithub: riscv

Download patch

ref: 9278b94623bbadcf64c1e3b6feb5f770379e18aa
parent: 885d41dd7b87c41cb618140d50dd23501b6d4279
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Sun Jan 22 16:12:38 EST 2017

pc/pc64: get rid of timerset(0) case, was used with "i8253set off" ctl

--- a/sys/src/9/pc/apic.c
+++ b/sys/src/9/pc/apic.c
@@ -396,15 +396,12 @@
 	Apictimer *a;
 
 	a = &lapictimer[m->machno];
-	period = a->max;
-	if(next != 0){
-		period = next - fastticks(nil);
-		period /= a->div;
-		if(period < a->min)
-			period = a->min;
-		else if(period > a->max - a->min)
-			period = a->max;
-	}
+	period = next - fastticks(nil);
+	period /= a->div;
+	if(period < a->min)
+		period = a->min;
+	else if(period > a->max - a->min)
+		period = a->max;
 	lapicw(LapicTICR, period);
 }
 
--- a/sys/src/9/pc/devarch.c
+++ b/sys/src/9/pc/devarch.c
@@ -69,8 +69,6 @@
 int (*_pcmspecial)(char*, ISAConf*);
 void (*_pcmspecialclose)(int);
 
-static int doi8253set = 1;
-
 /*
  * Add a file to the #P listing.  Once added, you can't delete it.
  * You can't add a file with the same name as one already there,
@@ -923,7 +921,6 @@
 		p = seprint(p, ep, "cmpswap486\n");
 	else
 		p = seprint(p, ep, "0x%p\n", cmpswap);
-	p = seprint(p, ep, "i8253set %s\n", doi8253set ? "on" : "off");
 	p = seprint(p, ep, "arch %s\n", arch->id);
 	n = p - buf;
 	n += mtrrprint(p, ep - p);
@@ -938,7 +935,6 @@
 {
 	CMpge,
 	CMcoherence,
-	CMi8253set,
 	CMcache,
 };
 
@@ -946,7 +942,6 @@
 {
 	CMpge,		"pge",		2,
 	CMcoherence,	"coherence",	2,
-	CMi8253set,	"i8253set",	2,
 	CMcache,	"cache",	4,
 };
 
@@ -994,15 +989,6 @@
 		}else
 			cmderror(cb, "invalid coherence ctl");
 		break;
-	case CMi8253set:
-		if(strcmp(cb->f[1], "on") == 0)
-			doi8253set = 1;
-		else if(strcmp(cb->f[1], "off") == 0){
-			doi8253set = 0;
-			(*arch->timerset)(0);
-		}else
-			cmderror(cb, "invalid i2853set ctl");
-		break;
 	case CMcache:
 		base = strtoull(cb->f[1], &ep, 0);
 		if(*ep)
@@ -1144,8 +1130,7 @@
 void
 timerset(Tval x)
 {
-	if(doi8253set)
-		(*arch->timerset)(x);
+	(*arch->timerset)(x);
 }
 
 /*
--- a/sys/src/9/pc/i8253.c
+++ b/sys/src/9/pc/i8253.c
@@ -199,17 +199,14 @@
 	ulong want;
 	ulong now;
 
-	period = MaxPeriod;
-	if(next != 0){
-		want = next>>Tickshift;
-		now = i8253.ticks;	/* assuming whomever called us just did fastticks() */
+	want = next>>Tickshift;
+	now = i8253.ticks;	/* assuming whomever called us just did fastticks() */
 
-		period = want - now;
-		if(period < MinPeriod)
-			period = MinPeriod;
-		else if(period > MaxPeriod)
-			period = MaxPeriod;
-	}
+	period = want - now;
+	if(period < MinPeriod)
+		period = MinPeriod;
+	else if(period > MaxPeriod)
+		period = MaxPeriod;
 
 	/* hysteresis */
 	if(i8253.period != period){