~kris/9p

9hist

2d32370b89cc5590ea216bf512f2a3112726dcab — David du Colombier 27 years ago 027781b
Plan 9 from Bell Labs 1999-02-28
6 files changed, 44 insertions(+), 39 deletions(-)

M carrera/clock.c
M carrera/devrtc.c
M pc/clock.c
M pc/i8253.c
M port/devcons.c
M port/devsd.c
M carrera/clock.c => carrera/clock.c +3 -3
@@ 124,10 124,10 @@ clock(Ureg *ur)
	}
}

uvlong
vlong
fastticks(uvlong *hz)
{
	if(hz)
		*hz = HZ;
	return m->ticks;
		*hz = HZ*100;
	return (vlong)m->ticks*100;
}

M carrera/devrtc.c => carrera/devrtc.c +0 -11
@@ 176,7 176,6 @@ _rtctime(void)
long
rtctime(void)
{
#ifdef notdef
	int i;
	long t, ot;



@@ 193,9 192,6 @@ rtctime(void)
	iunlock(&rtclock);

	return t;
#else
	return boottime+TK2SEC(MACHP(0)->ticks);
#endif /* notdef */
}

static long	 


@@ 264,8 260,6 @@ rtcwrite(Chan *c, void *buf, long n, vlong off)
			rtc.year = PUTBCD(rtc.year);
		}

/* disgusting hack because RTC doesn't work and m->ticks drifts */
if(boottime == 0){
		ilock(&rtclock);
		/* set clock values */
		x = (*(uchar*)Rtcindex)&~0x7f;


@@ 282,11 276,6 @@ if(boottime == 0){
		*(uchar*)Rtcindex = x|Year;
		*(uchar*)Rtcdata = rtc.year;
		iunlock(&rtclock);
}else{
		splhi();
		MACHP(0)->ticks = HZ*(secs - boottime);	/* inverse of SEC2TK() */
		spllo();
}

		return n;
	case Qnvram:

M pc/clock.c => pc/clock.c +0 -13
@@ 95,16 95,3 @@ microdelay(int microsecs)
		microsecs = 1;
	aamloop(microsecs);
}

ulong
TK2MS(ulong ticks)
{
	uvlong t, hz;

	t = ticks;
	hz = HZ;
	t *= 1000L;
	t = t/hz;
	ticks = t;
	return ticks;
}

M pc/i8253.c => pc/i8253.c +3 -3
@@ 131,12 131,12 @@ i8253enable(void)

/*
 *  return time elapsed since clock start in
 *  10ths of nanoseconds
 *  100 times hz
 */
uvlong
i8253read(uvlong *hz)
{
	if(hz)
		*hz = HZ;
	return m->ticks;
		*hz = HZ*100;
	return m->ticks*100;
}

M port/devcons.c => port/devcons.c +30 -1
@@ 394,12 394,41 @@ static Dirtab consdir[]={
	"user",		{Quser},	NAMELEN,	0666,
};

uvlong billion = 1000000000ULL;
uvlong bilbil = 1000000000ULL*1000000000ULL;

//
//  this routine is a hack till we get 64 bit ops faster
//
int
readvlnum(ulong off, char *buf, ulong n, uvlong val, int size)
{
	char tmp[64];
	char num[64];
	ulong y;
	int i;

	snprint(tmp, sizeof(tmp), "%*.0ulld", size-1, val);
	i = 0;
	if(val > bilbil){
		y = val/bilbil;
		i += sprint(num+i, "%lud", y);
		val -= y*bilbil;
		y = val/billion;
		i += sprint(num+i, "%9.9lud", y);
		val -= y*billion;
		y = val;
		sprint(num+i,  "%9.9lud", y);
	} else if(val > billion){
		y = val/billion;
		i += sprint(num+i, "%lud", y);
		val -= y*billion;
		y = val;
		sprint(num+i, "%9.9lud", y);
	} else {
		y = val;
		sprint(num+i, "%lud", y);
	}
	snprint(tmp, sizeof(tmp), "%*s", size-1, num);
	tmp[size-1] = ' ';
	if(off >= size)
		return 0;

M port/devsd.c => port/devsd.c +8 -8
@@ 132,12 132,12 @@ sdinit(void)
			type = scratch[0] & 0x1F;

			/*
			 * Read-capacity is mandatory for TypeDA, TypeMO and TypeCD.
			 * It may return 'not ready' if TypeDA is not spun up,
			 * TypeMO or TypeCD are not loaded or just plain slow getting
			 * their act together after a reset.
			 * If 'not ready' comes back, try starting a TypeDA and punt
			 * the get capacity until the drive is attached.
			 * Read-capacity is mandatory for TypeDA, TypeMO and
			 * TypeCD. It may return 'not ready' if TypeDA is not
			 * spun up, TypeMO or TypeCD are not loaded or just
			 * plain slow getting their act together after a reset.
			 * If 'not ready' comes back, try starting a TypeDA and
			 * punt the get capacity until the drive is attached.
			 */
			if(scsicap(d->t, d->lun, &d->size, &d->bsize) != STok) {
				nbytes = 0xFF;


@@ 150,9 150,9 @@ sdinit(void)
				case 0x02:
					break;
				case 0x06:
					if(scratch[12] == 0x28 && scratch[13] == 0)
					if(scratch[12] == 0x28 && !scratch[13])
						break;
					if(scratch[12] == 0x29 && scratch[13] == 0)
					if(scratch[12] == 0x29 && !scratch[13])
						break;
					/*FALLTHROUGH*/
				default: