summaryrefslogtreecommitdiffstats
path: root/sys/i386/isa/clock.c
Commit message (Collapse)AuthorAgeFilesLines
* This adds the i386 specific support for systems with a MicroChannelmdodd1999-09-031-0/+10
| | | | | | Architecture bus. Reviewed by: msmith
* $Id$ -> $FreeBSD$peter1999-08-281-1/+1
|
* Merge the cons.c and cons.h to the best of my ability. alpha may orphk1999-08-091-2/+2
| | | | may not compile, I can't test it.
* Remove XXX from the headers (broke the build, I'm betting.)green1999-07-291-2/+1
|
* We're called too early to have any idea whether APM is going to bemsmith1999-07-281-11/+7
| | | | | | | | | | | active or not. The only sane thing we can do here is assume that if APM is supported it might be active at some point, and bail. In reality, even this isn't good enough; regardless of whether we support APM or not, the system may well futz with the CPU's clock speed and throw the TSC off. We need to stop using it for timekeeping except under controlled circumstances. Curse the lack of a dependable high-resolution timer.
* Updated acquire_timer2()'s state machine to work when the i8254 isbde1999-07-181-23/+10
| | | | | | | being used for timecounting. Fixed a race or two in it. Undisabled it. PR: 10455
* Don't let the machdep.tsc_freq sysctl proceed if the TSC is presentbde1999-07-181-6/+6
| | | | | | | | | | but broken, since tsc_timecounter is not initialised in that case, and updating an uninitialised timecounter is fatal. Fixed style bugs in the machdep.i8254_freq and machdep.tsc_freq sysctls. Reviewed by: phk
* Shut up gcc.peter1999-06-271-1/+3
|
* This commit gives support for the Rise mP6 CPU. It has two changes:green1999-06-241-5/+7
| | | | | | | | | | | | | 1. Rise is recognized in identdcpu.c. 2. The TSC is not written to. A workaround for the CPU bug is being applied to clock.c (the bug being that the mP6 has TSC enabled in its CPUID-capabilities, but it only supports reading it. If we try to write to it (MSR 16), a GPF occurs.) The new behavior is that FreeBSD will _not_ zero the TSC. Instead, we do a bit of 64-bit arithmetic. Reviewed by: msmith Obtained from: unfurl & msmith
* Remove fd driver from its old home and change files which include rtc.hdfr1999-05-311-2/+2
| | | | to account for its new location.
* Stop the TSC from being used as timecounter on K5/step0 machines.phk1999-05-291-2/+3
|
* Fixed glitches (jumps) of about 1/HZ seconds for the i8254 timecounter.bde1999-05-281-20/+21
| | | | | | | | | | | | | | | | The old version only worked right when the time was read strictly more often than every 1/HZ seconds, but we only guarantee reading it every (1/HZ + epsilon) seconds. Part of rev.1.126-1.127 attempted to fix this but didn't succeed. Detect counter rollover using the heuristic from the old version of microtime() with additional complications for supporting calls from fast interrupt handlers. This works provided i8254 interrupts are not delayed by more than 1/(2*HZ) seconds. This needs more comments, and cleanups for the SMP case, and more testing of the SMP case before it is merged into RELENG_3. Tested by: jhay
* For what it's worth, idelayed is declared as a volatile in the headers,peter1999-05-091-2/+2
| | | | and even though it's not used in this file make it a volatile here too.
* Make the machdep.i8254_freq and machdep.tsc_freq sysctls modify thephk1999-04-251-1/+3
| | | | | | timecounter as well Asked for by: bde, jhay
* oops, SMP was missing includes for a typedef.peter1999-04-211-2/+2
|
* Stage 1 of a cleanup of the i386 interrupt registration mechanism.peter1999-04-211-16/+12
| | | | | | | Interrupts under the new scheme are managed by the i386 nexus with the awareness of the resource manager. There is further room for optimizing the interfaces still. All the users of register_intr()/intr_create() should be gone, with the exception of pcic and i386/isa/clock.c.
* Fix tabs that should have been spaces. Some were in kernel error messages.mckay1998-12-141-22/+22
|
* Update timecounters to new interface.phk1998-10-231-11/+11
|
* Attempt to work around a bug in the previous commit related tobde1998-09-201-3/+3
| | | | | non-reentrancy of SMP clock locking. Depend on the giant lock protecting clkintr().
* Ensure that the i8254 timecounter doesn't go backards. It sometimesbde1998-09-201-6/+21
| | | | | | | | | | went backwards when interrupts were masked for more than one i8254 interrupt period. It sometimes went backwards when the i8254 counter was reprogrammed. Neither of these should happen in normal operation. Update the i8254 timecounter support variables atomically. Calling timecounter functions from fast interrupt handlers may actually work in all cases now.
* Maintain a mapping from irq number to (ioapic number, int pin) tuple,tegge1998-09-061-3/+3
| | | | | | | | | | | | and use this when masking/unmasking interrupts. Maintain a mapping from (iopaic number, int pin) tuple to irq number, and use this when configuring devices and programming the ioapics. Previous code assumed that irq number was equal to int pin number, and that the ioapic number was 0. Don't let an AP enter _cpu_switch before all local apics are initialized.
* Add a tc_ prefix to struct timecounter members.phk1998-06-091-6/+6
| | | | Urged by: bde
* Add a member function more to the timecounters, this one is for usephk1998-06-071-1/+3
| | | | | with latch based PPS implementations. The client that uses it will be committed after more testing.
* Add a "this" style argument and a "void *private" so timecounters canphk1998-06-071-5/+5
| | | | figure out which instance to wount with.
* Some cleanups related to timecounters and weird ifdefs in <sys/time.h>.phk1998-05-281-3/+3
| | | | | | | | | | | | | | | | | | | | Clean up (or if antipodic: down) some of the msgbuf stuff. Use an inline function rather than a macro for timecounter delta. Maintain process "on-cpu" time as 64 bits of microseconds to avoid needless second rollover overhead. Avoid calling microuptime the second time in mi_switch() if we do not pass through _idle in cpu_switch() This should reduce our context-switch overhead a bit, in particular on pre-P5 and SMP systems. WARNING: Programs which muck about with struct proc in userland will have to be fixed. Reviewed, but found imperfect by: bde
* Change a data type internal to the timecounters, and remove the "delta"phk1998-05-191-18/+9
| | | | | | function. Reviewed, but not entirely approved by: bde
* Remove some unneeded statements that enabled interrupts.tegge1998-04-051-3/+2
|
* Eradicate the variable "time" from the kernel, using various measures.phk1998-03-301-3/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | "time" wasn't a atomic variable, so splfoo() protection were needed around any access to it, unless you just wanted the seconds part. Most uses of time.tv_sec now uses the new variable time_second instead. gettime() changed to getmicrotime(0. Remove a couple of unneeded splfoo() protections, the new getmicrotime() is atomic, (until Bruce sets a breakpoint in it). A couple of places needed random data, so use read_random() instead of mucking about with time which isn't random. Add a new nfs_curusec() function. Mark a couple of bogosities involving the now disappeard time variable. Update ffs_update() to avoid the weird "== &time" checks, by fixing the one remaining call that passwd &time as args. Change profiling in ncr.c to use ticks instead of time. Resolution is the same. Add new function "tvtohz()" to avoid the bogus "splfoo(), add time, call hzto() which subtracts time" sequences. Reviewed by: bde
* Be less draconian about the TSC if APM is configured, use it forphk1998-03-161-8/+31
| | | | | timecounting if APM-BIOS isn't found. Be just as draconian about SMP as always, but explain it better.
* On SMP systems, initially follow the MP spec with regard to which pintegge1998-03-141-38/+90
| | | | | | on the IOAPIC being connected to the 8254 timer interrupt. Verify that timer interrupts are delivered. If they aren't, attempt a fallback to mixed mode (i.e. routing the timer interrupt via the 8259 PIC).
* Remove special handling for resuming clock interrupt when using APIC_IO.tegge1998-03-051-6/+6
| | | | The `generic' vector stubs do the right thing.
* Prevent the TSC from being used on APM machines, we have no idea ifphk1998-02-281-2/+6
| | | | | | | | it runs at a constant frequency. This was less of an issue before, because the TSC only interpolated in the HZ intervals, but now where the timecounter is used all the way, this becomes much more visible. Nit: Fix a printf which triggered the bde-filter.
* Quick fix for the i8254 timecounter often gaining 10 msec.bde1998-02-231-1/+2
|
* Add missing CLOCK_UNLOCK() before write_eflags().jkh1998-02-211-1/+2
| | | | Submitted by: dave adkins <adkin003@tc.umn.edu>
* Replace TOD clock code with more systematic approach.phk1998-02-201-68/+115
| | | | | | | | | | | | | | | Highlights: * Simple model for underlying hardware. * Hardware basis for timekeeping can be changed on the fly. * Only one hardware clock responsible for TOD keeping. * Provides a real nanotime() function. * Time granularity: .232E-18 seconds. * Frequency granularity: .238E-12 s/s * Frequency adjustment is continuous in time. * Less overhead for frequency adjustment. * Improves xntpd performance. Reviewed by: bde, bde, bde
* Update timer0_prescaler_count before calling hardclock() while timer0bde1998-02-131-15/+22
| | | | | | | | | | | | | | | | is "acquired". This fixes a TSC biasing error of about 10 msec when pcaudio is active. Update `time' before calling hardclock() when timer0 is being released. This is not known to be important. Added some delays in writertc(). Efficiency is not critical here, unlike in rtcin(), and we already use conservative delays there. Don't touch the hardware when machdep.i8254_freq is being changed but the maximum count wouldn't change. This fixes jitter of up to 10 msec for most small adjustments to machdep.i8254_freq. When the maximum count needs to change, the hardware should be adjusted more carefully.
* Staticize.eivind1998-02-091-2/+2
|
* APM calls inittodr(0) which is stupid, but at least stop setting thephk1998-01-281-5/+7
| | | | clock back to when Dennis had a good idea.
* More cleanup relating to our use of the TSC.phk1997-12-281-40/+30
| | | | Look in the cpu_feature (CPUID output) to see if we have it.
* wash, sort and put in order various nits from the i586_ctr -> tscphk1997-12-281-11/+11
| | | | | | commit. Pointed out by: bde
* Rename "i586_ctr" to "tsc" (both upper and lower case instances).phk1997-12-261-28/+28
| | | | | | Fix a couple of printfs too. Warning: This changes the names of a couple of kernel options!
* Removed #unused includes.bde1997-11-181-3/+4
| | | | Added a used #include (don't depend on yet to be fixed namespace pollution).
* Don't include <machine/cputypes.h> or declare cputype/class interfacesbde1997-10-281-2/+5
| | | | | | | in <machine/cpu.h>. Moved the declarations to <machine/cputypes.h>. Fixed style bugs in the moved code. Fixed everything that depended on the nested include. Don't include <machine/cpu.h> (in the changed files) unless something in it is used directly.
* General cleanup of the sub-system locking macros.fsmp1997-09-011-35/+12
| | | | | | | | Eliminated the RECURSIVE_MPINTRLOCK. clock.c and microtime use clock_lock. sio.c and cy.c use com_lock. Suggestions by: Bruce Evans <bde@zeta.org.au>
* Another round of lock pushdown.fsmp1997-08-301-12/+43
| | | | | | | | | Add a simplelock to deal with disable_intr()/enable_intr() as used in UP kernel. UP kernel expects that this is enough to guarantee exclusive access to regions of code bracketed by these 2 functions. Add a simplelock to bracket clock accesses in clock.c: clock_lock. Help from: Bruce Evans <bde@zeta.org.au>
* #include <machine/limits.h> explicitly in the few places that it is required.bde1997-08-211-1/+2
|
* Made PEND_INTS default.fsmp1997-08-211-34/+6
| | | | | | | | | | Made NEW_STRATEGY default. Removed misc. old cruft. Centralized simple locks into mp_machdep.c Centralized simple lock macros into param.h More cleanup in the direction of making splxx()/cpl MP-safe.
* clock.c:fsmp1997-07-261-54/+23
| | | | | | | | | | | | | | - removed TEST_ALTTIMER. - removed APIC_PIN0_TIMER. - removed TIMER_ALL. apic_vector.s: - new algorithm where a CPU uses try_mplock instead of get_mplock: if successful continue as before. if fail set ipending bit, mask INT (to avoid recursion), cleanup & iret. This allows the CPU to return to successful work, while the ISR will be run by the CPU holding the lock as part of the doreti dance.
* Last commit didn't take, operator error???fsmp1997-07-221-29/+6
|
* Developed a new strategy for handling the 8254/8259/APIC issue.fsmp1997-07-201-30/+64
|
OpenPOWER on IntegriCloud