diff options
author | cinap_lenrek <cinap_lenrek@felloff.net> | 2021-01-17 21:21:12 +0100 |
---|---|---|
committer | cinap_lenrek <cinap_lenrek@felloff.net> | 2021-01-17 21:21:12 +0100 |
commit | a05bab362f66ddd6fa65f2e7cda9eaaa0217ec08 (patch) | |
tree | ccd2fdef5230d2d5369619e6e7f84b389928ad3d /sys/src/9/pc/devarch.c | |
parent | 999e98b9b856ae4fc75b3ad33783488e33cdd426 (diff) |
pc, pc64: add minimal HPET driver to measure LAPIC and TSC frequencies
This adds the new function pointer PCArch.clockinit(),
which is a timer dependent initialization routine.
It also takes over the job of guesscpuhz(). This way, the
architecture ident code can switch between different
timers (i8253, HPET and XEN timer).
Diffstat (limited to 'sys/src/9/pc/devarch.c')
-rw-r--r-- | sys/src/9/pc/devarch.c | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/sys/src/9/pc/devarch.c b/sys/src/9/pc/devarch.c index 4058808f5..3276a7a97 100644 --- a/sys/src/9/pc/devarch.c +++ b/sys/src/9/pc/devarch.c @@ -461,8 +461,6 @@ static X86type x86sis[] = { -1, -1, 23, "unknown", }, /* total default */ }; -static X86type *cputype; - static void simplecycles(uvlong*); void (*cycles)(uvlong*) = simplecycles; void _cycles(uvlong*); /* in l.s */ @@ -547,6 +545,7 @@ cpuidentify(void) || (t->family == -1)) break; + m->aalcycles = t->aalcycles; m->cpuidtype = t->name; /* @@ -560,11 +559,6 @@ cpuidentify(void) } /* - * use i8253 to guess our cpu speed - */ - guesscpuhz(t->aalcycles); - - /* * If machine check exception, page size extensions or page global bit * are supported enable them in CR4 and clear any other set extensions. * If machine check was enabled clear out any lingering status. @@ -690,7 +684,6 @@ cpuidentify(void) fpuinit(); - cputype = t; return t->family; } @@ -702,7 +695,7 @@ cputyperead(Chan*, void *a, long n, vlong offset) mhz = (m->cpuhz+999999)/1000000; - snprint(str, sizeof(str), "%s %lud\n", cputype->name, mhz); + snprint(str, sizeof(str), "%s %lud\n", m->cpuidtype, mhz); return readstr(offset, a, n, str); } @@ -715,7 +708,7 @@ archctlread(Chan*, void *a, long nn, vlong offset) p = buf = smalloc(READSTR); ep = p + READSTR; p = seprint(p, ep, "cpu %s %lud%s\n", - cputype->name, (ulong)(m->cpuhz+999999)/1000000, + m->cpuidtype, (ulong)(m->cpuhz+999999)/1000000, m->havepge ? " pge" : ""); p = seprint(p, ep, "pge %s\n", getcr4()&0x80 ? "on" : "off"); p = seprint(p, ep, "coherence "); @@ -877,6 +870,8 @@ archinit(void) arch->intrinit = knownarch[0]->intrinit; if(arch->intrassign == nil) arch->intrassign = knownarch[0]->intrassign; + if(arch->clockinit == nil) + arch->clockinit = knownarch[0]->clockinit; } /* |