#
267654 |
|
19-Jun-2014 |
gjb |
Copy stable/9 to releng/9.3 as part of the 9.3-RELEASE cycle.
Approved by: re (implicit) Sponsored by: The FreeBSD Foundation |
#
225736 |
|
22-Sep-2011 |
kensmith |
Copy head to stable/9 as part of 9.0-RELEASE release cycle.
Approved by: re (implicit)
|
#
216490 |
|
16-Dec-2010 |
jhb |
Small style fixes: - Avoid side-effect assignments in if statements when possible. - Don't use ! to check for NULL pointers, explicitly check against NULL. - Explicitly check error return values against 0. - Don't use INTR_MPSAFE for interrupt handlers with only filters as it is meaningless. - Remove unneeded function casts.
|
#
213918 |
|
16-Oct-2010 |
avg |
atrtc: remove (pre-)historic check of RTC NVRAM at address 0x0e
Old scrolls tell that once upon a time IBM AT BIOS was known to put some useful system diagnostic information into RTC NVRAM. It is not really known if and for how long PC BIOSes followed that convention, but I believe that many, if not all, modern BIOSes do not do that any more (not mentioning other types of x86 firmware). Some diagnostic bits don't even make any sense any longer. The check results in confusing messages upon boot on some systems. So I am removing it.
Discussed with: bde, jhb, mav MFC after: 3 weeks
|
#
210298 |
|
20-Jul-2010 |
mav |
Fix several un-/signedness bugs of r210290 and r210293. Add one more check.
|
#
210290 |
|
20-Jul-2010 |
mav |
Extend timer driver API to report also minimal and maximal supported period lengths. Make MI wrapper code to validate periods in request. Make kernel clock management code to honor these hardware limitations while choosing hz, stathz and profhz values.
|
#
209990 |
|
13-Jul-2010 |
mav |
Rise knowledge about curthread->td_intr_frame by one step. Make timer callback argument really opaque. Not repeat interrupt handler's problem in case somebody will ever need to have both argument and frame.
|
#
209927 |
|
12-Jul-2010 |
mav |
Instead of deleting existing IRQ resource, which is not really working for ACPI bus, find wanted IRQ rid or spare one. This should fix panic during boot on systems reporting fancy IRQ numbers for attimer and atrtc.
|
#
209635 |
|
01-Jul-2010 |
mav |
Allow attimer to be hinted at ISA if not reported by ISA PNP or ACPI. Rephrase respective atrtc code same way to be more readable.
|
#
209634 |
|
01-Jul-2010 |
mav |
Rework r209456: Instead of using fake rid (which ISA doesn't like), delete untrusted IRQ resource and let it be recreated.
|
#
209456 |
|
23-Jun-2010 |
mav |
Do not trust IRQ reported by ACPI. There are cases when it is wrong.
|
#
209440 |
|
22-Jun-2010 |
mav |
Add "legacy route" support to HPET driver. When enabled, this mode makes HPET to steal IRQ0 from i8254 and IRQ8 from RTC timers. It can be suitable for HPETs without FSB interrupts support, as it gives them two unshared IRQs. It allows them to provide one per-CPU event timer on dual-CPU system, that should be suitable for further tickless kernels.
To enable it, such lines may be added to /boot/loader.conf: hint.atrtc.0.clock=0 hint.attimer.0.clock=0 hint.hpet.0.legacy_route=1
|
#
209401 |
|
21-Jun-2010 |
mav |
Fix i386 LINT build broken by r209371. There appeared such legacy thing as APM, that somehow breaking RTC.
|
#
209371 |
|
20-Jun-2010 |
mav |
Implement new event timers infrastructure. It provides unified APIs for writing event timer drivers, for choosing best possible drivers by machine independent code and for operating them to supply kernel with hardclock(), statclock() and profclock() events in unified fashion on various hardware.
Infrastructure provides support for both per-CPU (independent for every CPU core) and global timers in periodic and one-shot modes. MI management code at this moment uses only periodic mode, but one-shot mode use planned for later, as part of tickless kernel project.
For this moment infrastructure used on i386 and amd64 architectures. Other archs are welcome to follow, while their current operation should not be affected.
This patch updates existing drivers (i8254, RTC and LAPIC) for the new order, and adds event timers support into the HPET driver. These drivers have different capabilities: LAPIC - per-CPU timer, supports periodic and one-shot operation, may freeze in C3 state, calibrated on first use, so may be not exactly precise. HPET - depending on hardware can work as per-CPU or global, supports periodic and one-shot operation, usually provides several event timers. i8254 - global, limited to periodic mode, because same hardware used also as time counter. RTC - global, supports only periodic mode, set of frequencies in Hz limited by powers of 2.
Depending on hardware capabilities, drivers preferred in following orders, either LAPIC, HPETs, i8254, RTC or HPETs, LAPIC, i8254, RTC. User may explicitly specify wanted timers via loader tunables or sysctls: kern.eventtimer.timer1 and kern.eventtimer.timer2. If requested driver is unavailable or unoperational, system will try to replace it. If no more timers available or "NONE" specified for second, system will operate using only one timer, multiplying it's frequency by few times and uing respective dividers to honor hz, stathz and profhz values, set during initial setup.
|
#
204309 |
|
25-Feb-2010 |
attilio |
Introduce the new kernel sub-tree x86 which should contain all the code shared and generalized between our current amd64, i386 and pc98.
This is just an initial step that should lead to a more complete effort. For the moment, a very simple porting of cpufreq modules, BIOS calls and the whole MD specific ISA bus part is added to the sub-tree but ideally a lot of code might be added and more shared support should grow.
Sponsored by: Sandvine Incorporated Reviewed by: emaste, kib, jhb, imp Discussed on: arch MFC: 3 weeks
|
#
191766 |
|
03-May-2009 |
mav |
Rename statclock_disable variable to atrtcclock_disable that it actually is, and hide it inside of atrtc driver. Add new tunable hint.atrtc.0.clock controlling it. Setting it to 0 disables using RTC clock as stat-/ profclock sources.
Teach i386 and amd64 SMP platforms to emulate stat-/profclocks using i8254 hardclock, when LAPIC and RTC clocks are disabled.
This allows to reduce global interrupt rate of idle system down to about 100 interrupts per core, permitting C3 and deeper C-states provide maximum CPU power efficiency.
|
#
191733 |
|
01-May-2009 |
mav |
Add resume methods to i8254 and atrtc devices.
|
#
178192 |
|
14-Apr-2008 |
phk |
atrtc.c is a repocopy of the RTC device driver from i386/isa/clock.c
In addition to the device driver functionality, it exposes a number of functions which various other bits of code use to fondle the RTC chip.
|
#
178163 |
|
12-Apr-2008 |
phk |
Move i386 to generic RTC handling code.
Make clock_if.m and subr_rtc.c standard on i386
Add hints for "atrtc" driver, for non-PnP, non-ACPI systems. NB: Make sure to install GENERIC.hints into /boot/device.hints in these!
Nuke MD inittodr(), resettodr() functions.
Don't attach to PHP0B00 in the "attimer" dummy driver any more, and remove comments that no longer apply for that reason.
Add new "atrtc" device driver, which handles IBM PC AT Real Time Clock compatible devices using subr_rtc and clock_if.
This driver is not entirely clean: other code still fondles the hardware to get a statclock interrupt on non-ACPI timer systems.
Wrap some overly long lines.
After it has settled in -current, this will be ported to amd64.
Technically this is MFC'able, but I fail to see a good reason.
|
#
177651 |
|
26-Mar-2008 |
phk |
Back in the good old days, PC's had random pieces of rock for frequency generation and what frequency the generated was anyones guess.
In general the 32.768kHz RTC clock x-tal was the best, because that was a regular wrist-watch Xtal, whereas the X-tal generating the ISA bus frequency was much lower quality, often costing as much as several cents a piece, so it made good sense to check the ISA bus frequency against the RTC clock.
The other relevant property of those machines, is that they typically had no more than 16MB RAM.
These days, CPU chips croak if their clocks are not tightly within specs and all necessary frequencies are derived from the master crystal by means if PLL's.
Considering that it takes on average 1.5 second to calibrate the frequency of the i8254 counter, that more likely than not, we will not actually use the result of the calibration, and as the final clincher, we seldom use the i8254 for anything besides BEL in syscons anyway, it has become time to drop the calibration code.
If you need to tell the system what frequency your i8254 runs, you can do so from the loader using hw.i8254.freq or using the sysctl kern.timecounter.tc.i8254.frequency.
|
#
177642 |
|
26-Mar-2008 |
phk |
The "free-lance" timer in the i8254 is only used for the speaker these days, so de-generalize the acquire_timer/release_timer api to just deal with speakers.
The new (optional) MD functions are: timer_spkr_acquire() timer_spkr_release() and timer_spkr_setfreq()
the last of which configures the timer to generate a tone of a given frequency, in Hz instead of 1/1193182th of seconds.
Drop entirely timer2 on pc98, it is not used anywhere at all.
Move sysbeep() to kern/tty_cons.c and use the timer_spkr*() if they exist, and do nothing otherwise.
Remove prototypes and empty acquire-/release-timer() and sysbeep() functions from the non-beeping archs.
This eliminate the need for the speaker driver to know about i8254frequency at all. In theory this makes the speaker driver MI, contingent on the timer_spkr_*() functions existing but the driver does not know this yet and still attaches to the ISA bus.
Syscons is more tricky, in one function, sc_tone(), it knows the hz and things are just fine.
In the other function, sc_bell() it seems to get the period from the KDMKTONE ioctl in terms if 1/1193182th second, so we hardcode the 1193182 and leave it at that. It's probably not important.
Change a few other sysbeep() uses which obviously knew that the argument was in terms of i8254 frequency, and leave alone those that look like people thought sysbeep() took frequency in hertz.
This eliminates the knowledge of i8254_freq from all but the actual clock.c code and the prof_machdep.c on amd64 and i386, where I think it would be smart to ask for help from the timecounters anyway [TBD].
|
#
177631 |
|
26-Mar-2008 |
phk |
Rename timer0_max_count to i8254_max_count. Rename timer0_real_max_count to i8254_real_max_count and make it static. Rename timer_freq to i8254_freq and make it a loader tunable.
|
#
177628 |
|
26-Mar-2008 |
phk |
The RTC related pscnt and psdiv variables have no business being public.
|
#
175405 |
|
17-Jan-2008 |
jhb |
Use cpu_spinwait() (i.e., "pause") when spinning on rdtsc during DELAY().
MFC after: 1 week
|
#
172998 |
|
26-Oct-2007 |
peter |
Split /dev/nvram driver out of isa/clock.c for i386 and amd64. I have not refactored it to be a generic device. Instead of being part of the standard kernel, there is now a 'nvram' device for i386/amd64. It is in DEFAULTS like io and mem, and can be turned off with 'nodevice nvram'. This matches the previous behavior when it was first committed.
|
#
171612 |
|
27-Jul-2007 |
dwmalone |
It seems that some i386 mothermoards either do not implement the day of week field correctly, or they remember bad values that are written into the day of week field. For this reason, ignore the day of week field when reading the clock on i386 rather than bailing if it is set incorrectly.
Problems were seen on a number of platforms, including VMWare, qemu, EPIA ME6000, Epox-3PTA and ABIT-SL30T.
This is a slightly different fix to that proposed by Ted in his PR, but the same basic idea.
PR: 111117 Submitted by: Ted Faber <faber@lunabase.org> Approved by: re (rwatson) MFC after: 3 weeks
|
#
171553 |
|
23-Jul-2007 |
dwmalone |
If clock_ct_to_ts fails to convert time time from the real time clock, print a one line error message. Add some comments on not being able to trust the day of week field (I'll act on these comments in a follow up commit).
Approved by: re MFC after: 3 weeks
|
#
170802 |
|
15-Jun-2007 |
peter |
Prototype (but functional) Linux-ish /dev/nvram interface to the extra 114 bytes of cmos ram in the PC clock chip. The big difference between this and the Linux version is that we do not recalculate the checksums for bytes 16..31.
We use this at work when cloning identical machines - we can copy the bios settings as well. Reading /dev/nvram gives 114 bytes of data but you can seek/read/write whichever bytes you like.
Yes, this is a "foot, gun, fire!" type of device.
|
#
170289 |
|
04-Jun-2007 |
dwmalone |
Despite several examples in the kernel, the third argument of sysctl_handle_int is not sizeof the int type you want to export. The type must always be an int or an unsigned int.
Remove the instances where a sizeof(variable) is passed to stop people accidently cut and pasting these examples.
In a few places this was sysctl_handle_int was being used on 64 bit types, which would truncate the value to be exported. In these cases use sysctl_handle_quad to export them and change the format to Q so that sysctl(1) can still print them.
|
#
167221 |
|
05-Mar-2007 |
bde |
Partial fix for a bug in rev.1.231. If suspend/resume clobbers the RTC state, then it may clobber the RTC index register, so the index register must be restored before using it to restore control registers in rtc_restore().
The following problems remain: - rtc_restore() is only called if pmtimer is configured. Buggy suspend/resumes are more likely to clobber the index register than a control register, so pmtimer is more needed than it used to be. - pmtimer doesn't exist for amd64. - Restoring of the RTC state may race with rtcintr(). If an RTC interrupt is handled before the state is restored, then rtcin(RTC_INTR) in rtcintr() may read from the wrong register, so rtcintr() may spin forever. This may be mitigated by the most common state clobbering being to turn off RTC interrupts.
|
#
167192 |
|
04-Mar-2007 |
nyan |
style(9).
|
#
166901 |
|
23-Feb-2007 |
piso |
o break newbus api: add a new argument of type driver_filter_t to bus_setup_intr()
o add an int return code to all fast handlers
o retire INTR_FAST/IH_FAST
For more info: http://docs.freebsd.org/cgi/getmsg.cgi?fetch=465712+0+current/freebsd-current
Reviewed by: many Approved by: re@
|
#
166186 |
|
23-Jan-2007 |
bde |
Cleaned up declaration and initialization of clock_lock. It is only used by clock code, so don't export it to the world for machdep.c to initialize. There is a minor problem initializing it before it is used, since although clock initialization is split up so that parts of it can be done early, the first part was never done early enough to actually work. Split it up a bit more and do the first part as late as possible to document the necessary order. The functions that implement the split are still bogusly exported.
Cleaned up initialization of the i8254 clock hardware using the new split. Actually initialize it early enough, and don't work around it not being initialized in DELAY() when DELAY() is called early for initialization of some console drivers.
This unfortunately moves a little more code before the early debugger breakpoint so that it is harder to debug. The ordering of console and related initialization is delicate because we want to do as little as possible before the breakpoint, but must initialize a console.
|
#
164841 |
|
03-Dec-2006 |
bde |
Optimized RTC accesses by avoiding null writes to the index register and by only delaying when an RTC register is written to. The delay after writing to the data register is now not just a workaround.
This reduces the number of ISA accesses in the usual case from 4 to 1. The usual case is 2 rtcin()'s for each RTC interrupt. The index register is almost always RTC_INTR for this. The 3 extra ISA accesses were 1 for writing the index and 2 for delays. Some delays are needed in theory, but in practice they now just slow down slow accesses some more since almost eveyone including us does them wrong so modern systems enforce sufficient delays in hardware. I used to have the delays ifdefed out, but with the index register optimization the delays are rarely executed so the old magic ones can be kept or even implemented non- magically without significant cost.
Optimizing RTC interrupt handling is more interesting than it used to be because RTC interrupts are currently needed to fix the more efficient apic timer interrupts on some systems. apic_timer_hz is normally 2000 so the RTC interrupt rate needs to be 2048 to keep the apic timer firing on such systems. Without these changes, each RTC interrupt normally took 10 ISA accesses (2 PIC accesses and 2 sets of 4 RTC accesses). Each ISA access takes 1-1.5uS so 10 of then at 2048 Hz takes 2-3% of a CPU. Now 4 of them take 0.8-1.2% of a CPU.
|
#
162963 |
|
02-Oct-2006 |
phk |
Use calendaric calculation support from subr_clock.c instead of home-rolled.
Eventually, this RTC should probably use subr_rtc.c as well
|
#
162958 |
|
02-Oct-2006 |
phk |
Second part of a little cleanup in the calendar/timezone/RTC handling.
Split subr_clock.c in two parts (by repo-copy): subr_clock.c contains generic RTC and calendaric stuff. etc. subr_rtc.c contains the newbus'ified RTC interface.
Centralize the machdep.{adjkerntz,disable_rtc_set,wall_cmos_clock} sysctls and associated variables into subr_clock.c. They are not machine dependent and we have generic code that relies on being present so they are not even optional.
|
#
162954 |
|
02-Oct-2006 |
phk |
First part of a little cleanup in the calendar/timezone/RTC handling.
Move relevant variables to <sys/clock.h> and fix #includes as necessary.
Use libkern's much more time- & spamce-efficient BCD routines.
|
#
161141 |
|
09-Aug-2006 |
imp |
Eliminate one set of XBOX #ifdefs. The Xbox code just needs to set a different TIMER_FREQ value than default. Accomplish this via the config file rather than via an #ifdef.
|
#
153666 |
|
22-Dec-2005 |
jhb |
Tweak how the MD code calls the fooclock() methods some. Instead of passing a pointer to an opaque clockframe structure and requiring the MD code to supply CLKF_FOO() macros to extract needed values out of the opaque structure, just pass the needed values directly. In practice this means passing the pair (usermode, pc) to hardclock() and profclock() and passing the boolean (usermode) to hardclock_cpu() and hardclock_process(). Other details: - Axe clockframe and CLKF_FOO() macros on all architectures. Basically, all the archs were taking a trapframe and converting it into a clockframe one way or another. Now they can just extract the PC and usermode values directly out of the trapframe and pass it to fooclock(). - Renamed hardclock_process() to hardclock_cpu() as the latter is more accurate. - On Alpha, we now run profclock() at hz (profhz == hz) rather than at the slower stathz. - On Alpha, for the TurboLaser machines that don't have an 8254 timecounter, call hardclock() directly. This removes an extra conditional check from every clock interrupt on Alpha on the BSP. There is probably room for even further pruning here by changing Alpha to use the simplified timecounter we use on x86 with the lapic timer since we don't get interrupts from the 8254 on Alpha anyway. - On x86, clkintr() shouldn't ever be called now unless using_lapic_timer is false, so add a KASSERT() to that affect and remove a condition to slightly optimize the non-lapic case. - Change prototypeof arm_handler_execute() so that it's first arg is a trapframe pointer rather than a void pointer for clarity. - Use KCOUNT macro in profclock() to lookup the kernel profiling bucket.
Tested on: alpha, amd64, arm, i386, ia64, sparc64 Reviewed by: bde (mostly)
|
#
153384 |
|
13-Dec-2005 |
peter |
MFamd64 rev 1.223: Use the TSC to implement DELAY() if not marked broken and it has been calibrated.
|
#
152219 |
|
09-Nov-2005 |
imp |
Add support for XBOX to the FreeBSD port. The xbox architecture is nearly identical to wintel/ia32, with a couple of tweaks. Since it is so similar to ia32, it is optionally added to a i386 kernel. This port is preliminary, but seems to work well. Further improvements will improve the interaction with syscons(4), port Linux nforce driver and future versions of the xbox.
This supports the 64MB and 128MB boxes. You'll need the most recent CVS version of Cromwell (the Linux BIOS for the XBOX) to boot.
Rink will be maintaining this port, and is interested in feedback. He's setup a website http://xbox-bsd.nl to report the latest developments.
Any silly mistakes are my fault.
Submitted by: Rink P.W. Springer rink at stack dot nl and Ed Schouten ed at fxq dot nl
|
#
147969 |
|
13-Jul-2005 |
jhb |
Fixup some more fallout from the lapic/i8254 changes: - Make sure timer0_max_count is set to a correct value in the lapic case. - Revert i8254_restore() to explicitly reprogram timer 0 rather than calling set_timer_freq() to do it. set_timer_freq() only reprograms the counter if the max count changes which it never does on resume. This unbreaks suspend/resume for several people.
Tested by: marks, others Reviewed by: bde MFC after: 3 days
|
#
147783 |
|
05-Jul-2005 |
jhb |
Remove a || 1 that crept into the i8254 commit and was subsequently copied and pasted. I had actually tested without this change in my trees as had the other testers.
Reported by: bde, Rostislav Krasny rosti dot bsd at gmail dot com Approved by: re (scottl) Pointy hat to: jhb
|
#
147727 |
|
01-Jul-2005 |
jhb |
Use a simpler implementation for the i8254 timecounter when using the lapic timer since irq0 isn't being driven at hz in that case and we don't need to try to handle edge cases with rollover, etc. that require irq0 to be firing for the timecounter to actually work.
Submitted by: phk Tested by: schweikh Approved by: re (scottl)
|
#
146211 |
|
14-May-2005 |
nyan |
- Move timerreg.h to <arch>/include and split i8253 specific defines into i8253reg.h, and add some defines to control a speaker. - Move PPI related defines from i386/isa/spkr.c into ppireg.h and use them. - Move IO_{PPI,TIMER} defines into ppireg.h and timerreg.h respectively. - Use isa/isareg.h rather than <arch>/isa/isa.h.
Tested on: i386, pc98
|
#
144965 |
|
12-Apr-2005 |
mdodd |
Replace spl protection in rtcin() and writertc() with spinlocks using the existing clock_lock mutex.
|
#
144078 |
|
24-Mar-2005 |
jhb |
- Don't enable periodic interrupts from the RTC by default in rtc_statusb. Instead, explicitly enable them when we setup the interrupt handler. Also, move the setting of stathz and profhz down to the same place so that the code flow is simpler and easier to follow. - Don't setup an interrupt handler for IRQ0 if we are using the lapic timer as it doesn't do anything productive in that case.
|
#
143432 |
|
11-Mar-2005 |
peter |
Whitespace sync with amd64. (Rather than re-add the extra blank lines on amd64, I'm removing them here)
|
#
143324 |
|
09-Mar-2005 |
jhb |
- Remove the BURN_BRIDGES marked support for hooking into the ISA timer 0 interrupt. - Remove the timer_func variable as it now has a static value of hardclock() and is only used in one place.
Axe borrowed from: phk
|
#
141538 |
|
08-Feb-2005 |
jhb |
Use the local APIC timer to drive the various kernel clocks on SMP machines rather than forwarding interrupts from the clock devices around using IPIs: - Add an IDT vector that pushes a clock frame and calls lapic_handle_timer(). - Add functions to program the local APIC timer including setting the divisor, and setting up the timer to either down a periodic countdown or one-shot countdown. - Add a lapic_setup_clock() function that the BSP calls from cpu_init_clocks() to setup the local APIC timer if it is going to be used. The setup uses a one-shot countdown to calibrate the timer. We then program the timer on each CPU to fire at a frequency of hz * 3. stathz is defined as freq / 23 (hz * 3 / 23), and profhz is defined as freq / 2 (hz * 3 / 2). This gives the clocks relatively prime divisors while keeping a low LCM for the frequency of the clock interrupts. Thanks to Peter Jeremy for suggesting this approach. - Remove the hardclock and statclock forwarding code including the two associated IPIs. The bitmap IPI handler has now effectively degenerated to just IPI_AST. - When the local APIC timer is used we don't turn the RTC on at all, but we still enable interrupts on the ISA timer 0 (i8254) for timecounting purposes.
|
#
141211 |
|
03-Feb-2005 |
jhb |
Anytime we write to the RTC's status B register to possibly enable interrupts, read from the interrupt status register to clear any pending interrupts. Otherwise in some rare cases the RTC would never fire any interrupts as it constantly thinks it has an interrupt pending.
PR: i386/17800 PR: kern/76776 Submitted by: Jose M. Alcaide jose at we dot lc dot ehu dot es MFC after: 2 weeks
|
#
131991 |
|
11-Jul-2004 |
marcel |
Partially revert previous commit. Calling getit() unconditionally fixed a problem that could also be fixed differently without reverting previous attempts to fix DELAY while the debugger is active (rev 1.204). The bug was that the i8254 implements a countdown timer, while for (k)db_active a countup timer was implemented. This resulted in premature termination and consequently the breakage of DELAY. The fix (relative to rev 1.211) is to implement a countdown timer for the kdb_active case. As such the ability to step clock initialization is preserved and DELAY does what is expected of it.
Blushed: bde :-) Submitted by: bde
|
#
131938 |
|
10-Jul-2004 |
marcel |
Call getit() unconditionally and only grab clock_lock when the debugger is not active. The fixes breakages of DELAY() when running in the debugger, because not calling getit() when the debugger is active yields a DELAY that doesn't.
|
#
129876 |
|
30-May-2004 |
phk |
Add some missing <sys/module.h> includes which are masked by the one on death-row in <sys/kernel.h>
|
#
129130 |
|
11-May-2004 |
jhb |
Trim unused includes.
|
#
128695 |
|
27-Apr-2004 |
jhb |
- The i8254 uses IRQ 0, not IRQ 8. Correct i8254_intsrc to reference the correct interrupt source. - Cache a pointer to the i8254_intsrc's pending method to avoid several pointer indirections in i8254_get_timecount().
Reported by: bde
|
#
128019 |
|
07-Apr-2004 |
imp |
Remove advertising clause from University of California Regent's license, per letter dated July 22, 1999 and email from Peter Wemm, Alan Cox and Robert Watson.
Approved by: core, peter, alc, rwatson
|
#
122609 |
|
13-Nov-2003 |
phk |
Don't disable the TSC with statclock_disable.
|
#
121986 |
|
03-Nov-2003 |
jhb |
New APIC support code:
- The apic interrupt entry points have been rewritten so that each entry point can serve 32 different vectors. When the entry is executed, it uses one of the 32-bit ISR registers to determine which vector in its assigned range was triggered. Thus, the apic code can support 159 different interrupt vectors with only 5 entry points. - We now always to disable the local APIC to work around an errata in certain PPros and then re-enable it again if we decide to use the APICs to route interrupts. - We no longer map IO APICs or local APICs using special page table entries. Instead, we just use pmap_mapdev(). We also no longer export the virtual address of the local APIC as a global symbol to the rest of the system, but only in local_apic.c. To aid this, the APIC ID of each CPU is exported as a per-CPU variable. - Interrupt sources are provided for each intpin on each IO APIC. Currently, each source is given a unique interrupt vector meaning that PCI interrupts are not shared on most machines with an I/O APIC. That mapping for interrupt sources to interrupt vectors is up to the APIC enumerator driver however. - We no longer probe to see if we need to use mixed mode to route IRQ 0, instead we always use mixed mode to route IRQ 0 for now. This can be disabled via the 'NO_MIXED_MODE' kernel option. - The npx(4) driver now always probes to see if a built-in FPU is present since this test can now be performed with the new APIC code. However, an SMP kernel will panic if there is more than one CPU and a built-in FPU is not found. - PCI interrupts are now properly routed when using APICs to route interrupts, so remove the hack to psuedo-route interrupts when the intpin register was read. - The apic.h header was moved to apicreg.h and a new apicvar.h header that declares the APIs used by the new APIC code was added.
|
#
120404 |
|
24-Sep-2003 |
imp |
Per TRB vote: restore the aquire_timer0 and associated goo. This will be gone in FreeBSD 6, so put BURN_BRIDGES around it. The TRB also felt that if something better comes along sooner, it can be used to replace this code.
Delayed by: BSDcon and subsequent disk crash.
|
#
119847 |
|
07-Sep-2003 |
bde |
clock.c: Quick fix for calling DELAY() for ddb input in some (atkbd-based) console drivers. ddb must not use any normal locks, but DELAY() normally calls getit() which needs clock_lock. One problem with using normal locks in ddb is that deadlock is possible, but deadlock on clock_lock is unlikely becaluse clock_lock is bogusly recursive, apparently just to hide the problem of ddb using it. The i8254 clock hardware has mostly write-only registers so it is important for it to use a lock that gives exclusive access. (atkbd hardware is also unfriendly to reentrant software but that problem is more local and already solved.) I mostly saw the symptoms of the bug caused by unlocking in getit() running cpu_unpend(). cpu_unpend() should not be called while in ddb and Debugger() calls for failing assertions about this caused a breakpoint within ddb.
ddb must also not call getit() because ddb may be being used to step through clock initialization code that has stopped or otherwise mangled the clock. If the clock is stopped, then getit() always returns the same value and DELAY() takes forever if it trusts getit().
The quick fix is implement DELAY(n) as (n * timer_freq / 1000000) inb(0x84)'s if ddb is active.
machdep.c: Don't permit recursion on clock_lock.
|
#
118987 |
|
16-Aug-2003 |
phk |
Give timecounters a numeric quality field.
A timecounter will be selected when registered if its quality is not negative and no less than the current timecounters.
Add a sysctl to report all available timecounters and their qualities.
Give the dummy timecounter a solid negative quality of minus a million.
Give the i8254 zero and the ACPI 1000.
The TSC gets 800, unless APM or SMP forces it negative.
Other timecounters default to zero quality and thereby retain current selection behaviour.
|
#
118956 |
|
15-Aug-2003 |
phk |
remove acquire_timer0() and release_timer0() and related stuff.
|
#
118550 |
|
06-Aug-2003 |
phk |
Dont initialize a TSC timecounter until we know if it is broken or not.
|
#
115703 |
|
02-Jun-2003 |
obrien |
Use __FBSDID().
|
#
115544 |
|
31-May-2003 |
phk |
Don't rely on boolean expression evaluating to 1 or 0 by default.
Found by: FlexeLint
|
#
114216 |
|
29-Apr-2003 |
kan |
Deprecate machine/limits.h in favor of new sys/limits.h. Change all in-tree consumers to include <sys/limits.h>
Discussed on: standards@ Partially submitted by: Craig Rodrigues <rodrigc@attbi.com>
|
#
112551 |
|
24-Mar-2003 |
mdodd |
Use repo-copied files in sys/i386/bios.
|
#
112367 |
|
18-Mar-2003 |
phk |
Including <sys/stdint.h> is (almost?) universally only to be able to use %j in printfs, so put a newsted include in <sys/systm.h> where the printf prototype lives and save everybody else the trouble.
|
#
110687 |
|
11-Feb-2003 |
phk |
Switch to using the TSC code in i386/i386/tsc.c.
|
#
110299 |
|
03-Feb-2003 |
phk |
Split the global timezone structure into two integer fields to prevent the compiler from optimizing assignments into byte-copy operations which might make access to the individual fields non-atomic.
Use the individual fields throughout, and don't bother locking them with Giant: it is no longer needed.
Inspired by: tjr
|
#
110296 |
|
03-Feb-2003 |
jake |
Split statclock into statclock and profclock, and made the method for driving statclock based on profhz when profiling is enabled MD, since most platforms don't use this anyway. This removes the need for statclock_process, whose only purpose was to subdivide profhz, and gets the profiling clock running outside of sched_lock on platforms that implement suswintr. Also changed the interface for starting and stopping the profiling clock to do just that, instead of changing the rate of statclock, since they can now be separate.
Reviewed by: jhb, tmm Tested on: i386, sparc64
|
#
110039 |
|
29-Jan-2003 |
phk |
Make tsc_freq a 64bit quantity.
Inspired by: http://www.theinquirer.net/?article=7481
|
#
107576 |
|
04-Dec-2002 |
phk |
Use the correct value when writing the Day Of Week byte in the CMOS. The correct range is [1...7] with Sunday=1, but we have been writing [0...6] with Sunday=0.
The Soekris computers flagged the zero, zapped the date, so if you rebooted your soekris on a sunday, it would come up with a wrong date.
Bruce has a more extensive rework of this code, but we will stick with the minimalist fix for now.
Spotted by: Soren Kristensen <soren@soekris.com> Thanks to: Michael Sierchio <kudzu@tenebras.com>. Confirmed by: bde Approved by: re
|
#
105328 |
|
17-Oct-2002 |
iwasaki |
1. Fix a comment. Locking _is_ needed (but not done). 2. Update a comment. We now restore much more than RTC updates and interrupts. 3. Order change. Stop interrupts by writing to RTC_STATUSB, restore rate bits for the interrupts by writing to RTC_STATUSA, then enable interrupts again. This seems to be done perfectly backwards in startrtclock(). Otherwise, the idea for this change was obtained from startrtclock(). 4. Don't stop the clock (RTCB_HALT). We only program some control bits and don't want to stop the clock. 5. (Not really related.) Add caveats to the comment about timer_restore(). The update is non-atomic since locking is not done.
On locking: 6. rtcin() and writertc() are locked() adequately by splhigh() in RELENG_4, but this locking is null in -current. 7. Doing things in the correct order in (3) combined with (6) is probably enough locking for rtcrestore() in RELENG_4. In -current, the writertc()'s race with rtcintr() unless the BIOS disables RTC interrupts.
Submitted by: bde (including commit message) MFC after: 1 week
|
#
103733 |
|
21-Sep-2002 |
phk |
Fix a 3 year old oversight: Remove the #ifdef/#endif pair now that there is nothing between them anymore.
Spotted by: peter.
|
#
103527 |
|
18-Sep-2002 |
iwasaki |
Restore status register A of RTC at resume time. This should fix the 'too many RTC interrupts and statclock seems broken after resume' problem.
MFC after: 1 week
|
#
98618 |
|
22-Jun-2002 |
mp |
Clock frequencies reported by sysctl should be unsigned values. Discovered when machdep.tsc_freq returned a negative number on a 2.2GHz Xeon.
Submitted by: Brian Harrison <bharrison@ironport.com> Reviewed by: phk MFC after: 1 week
|
#
95814 |
|
30-Apr-2002 |
phk |
Don't export timecounter structures under debug. with sysctl, they contain no truly interesting data anymore.
|
#
95489 |
|
26-Apr-2002 |
phk |
Remove the tc_update() function. Any frequency change to the timecounter will be used starting at the next second, which is good enough for sysctl purposes. If better adjustment is needed the NTP PLL should be used.
|
#
93264 |
|
27-Mar-2002 |
dillon |
Compromise for critical*()/cpu_critical*() recommit. Cleanup the interrupt disablement assumptions in kern_fork.c by adding another API call, cpu_critical_fork_exit(). Cleanup the td_savecrit field by moving it from MI to MD. Temporarily move cpu_critical*() from <arch>/include/cpufunc.h to <arch>/<arch>/critical.c (stage-2 will clean this up).
Implement interrupt deferral for i386 that allows interrupts to remain enabled inside critical sections. This also fixes an IPI interlock bug, and requires uses of icu_lock to be enclosed in a true interrupt disablement.
This is the stage-1 commit. Stage-2 will occur after stage-1 has stabilized, and will move cpu_critical*() into its own header file(s) + other things. This commit may break non-i386 architectures in trivial ways. This should be temporary.
Reviewed by: core Approved by: core
|
#
92765 |
|
20-Mar-2002 |
alfred |
Remove __P.
|
#
91328 |
|
26-Feb-2002 |
dillon |
revert last commit temporarily due to whining on the lists.
|
#
91315 |
|
26-Feb-2002 |
dillon |
STAGE-1 of 3 commit - allow (but do not require) interrupts to remain enabled in critical sections and streamline critical_enter() and critical_exit().
This commit allows an architecture to leave interrupts enabled inside critical sections if it so wishes. Architectures that do not wish to do this are not effected by this change.
This commit implements the feature for the I386 architecture and provides a sysctl, debug.critical_mode, which defaults to 1 (use the feature). For now you can turn the sysctl on and off at any time in order to test the architectural changes or track down bugs.
This commit is just the first stage. Some areas of the code, specifically the MACHINE_CRITICAL_ENTER #ifdef'd code, is strictly temporary and will be cleaned up in the STAGE-2 commit when the critical_*() functions are moved entirely into MD files.
The following changes have been made:
* critical_enter() and critical_exit() for I386 now simply increment and decrement curthread->td_critnest. They no longer disable hard interrupts. When critical_exit() decrements the counter to 0 it effectively calls a routine to deal with whatever interrupts were deferred during the time the code was operating in a critical section.
Other architectures are unaffected.
* fork_exit() has been conditionalized to remove MD assumptions for the new code. Old code will still use the old MD assumptions in regards to hard interrupt disablement. In STAGE-2 this will be turned into a subroutine call into MD code rather then hardcoded in MI code.
The new code places the burden of entering the critical section in the trampoline code where it belongs.
* I386: interrupts are now enabled while we are in a critical section. The interrupt vector code has been adjusted to deal with the fact. If it detects that we are in a critical section it currently defers the interrupt by adding the appropriate bit to an interrupt mask.
* In order to accomplish the deferral, icu_lock is required. This is i386-specific. Thus icu_lock can only be obtained by mainline i386 code while interrupts are hard disabled. This change has been made.
* Because interrupts may or may not be hard disabled during a context switch, cpu_switch() can no longer simply assume that PSL_I will be in a consistent state. Therefore, it now saves and restores eflags.
* FAST INTERRUPT PROVISION. Fast interrupts are currently deferred. The intention is to eventually allow them to operate either while we are in a critical section or, if we are able to restrict the use of sched_lock, while we are not holding the sched_lock.
* ICU and APIC vector assembly for I386 cleaned up. The ICU code has been cleaned up to match the APIC code in regards to format and macro availability. Additionally, the code has been adjusted to deal with deferred interrupts.
* Deferred interrupts use a per-cpu boolean int_pending, and masks ipending, spending, and fpending. Being per-cpu variables it is not currently necessary to lock; bus cycles modifying them.
Note that the same mechanism will enable preemption to be incorporated as a true software interrupt without having to further hack up the critical nesting code.
* Note: the old critical_enter() code in kern/kern_switch.c is currently #ifdef to be compatible with both the old and new methodology. In STAGE-2 it will be moved entirely to MD code.
Performance issues:
One of the purposes of this commit is to enhance critical section performance, specifically to greatly reduce bus overhead to allow the critical section code to be used to protect per-cpu caches. These caches, such as Jeff's slab allocator work, can potentially operate very quickly making the effective savings of the new critical section code's performance very significant.
The second purpose of this commit is to allow architectures to enable certain interrupts while in a critical section. Specifically, the intention is to eventually allow certain FAST interrupts to operate rather then defer.
The third purpose of this commit is to begin to clean up the critical_enter()/critical_exit()/cpu_critical_enter()/ cpu_critical_exit() API which currently has serious cross pollution in MI code (in fork_exit() and ast() for example).
The fourth purpose of this commit is to provide a framework that allows kernel-preempting software interrupts to be implemented cleanly. This is currently used for two forward interrupts in I386. Other architectures will have the choice of using this infrastructure or building the functionality directly into critical_enter()/ critical_exit().
Finally, this commit is designed to greatly improve the flexibility of various architectures to manage critical section handling, software interrupts, preemption, and other highly integrated architecture-specific details.
|
#
89980 |
|
30-Jan-2002 |
bde |
Don't include <isa/isavar.h> or compile code depending on it when isa is not configured. Including <isa/isavar.h> when it is not used is harmful as well as bogus, since it includes "isa_if.h" which is not generated when isa is not configured.
This was fixed in 1999 but was broken by unconditionalizing PNPBIOS.
|
#
88322 |
|
20-Dec-2001 |
jhb |
Introduce a standard name for the lock protecting an interrupt controller and it's associated state variables: icu_lock with the name "icu". This renames the imen_mtx for x86 SMP, but also uses the lock to protect access to the 8259 PIC on x86 UP. This also adds an appropriate lock to the various Alpha chipsets which fixes problems with Alpha SMP machines dropping interrupts with an SMP kernel.
|
#
85835 |
|
01-Nov-2001 |
iwasaki |
Some fix for the recent apm module changes. - Now that apm loadable module can inform its existence to other kernel components (e.g. i386/isa/clock.c:startrtclock()'s TCS hack). - Exchange priority of SI_SUB_CPU and SI_SUB_KLD for above purpose. - Add simple arbitration mechanism for APM vs. ACPI. This prevents the kernel enables both of them. - Remove obsolete `#ifdef DEV_APM' related code. - Add abstracted interface for Powermanagement operations. Public apm(4) functions, such as apm_suspend(), should be replaced new interfaces. Currently only power_pm_suspend (successor of apm_suspend) is implemented.
Reviewed by: peter, arch@ and audit@
|
#
84721 |
|
09-Oct-2001 |
robert |
Remove an unneeded variable declaration and statement.
Approved by: jake
|
#
82971 |
|
04-Sep-2001 |
iwasaki |
Reenable RTC interrupts after wakeup. Some laptops have a problem with system statistics monitoring tools (such as systat, vmstat...) because of stopping RTC interrupts generation. Restore all the timers (RTC and i8254) atomically.
Reviewed by: bde MFC after: 1 week
|
#
82555 |
|
30-Aug-2001 |
msmith |
Add ACPI attachments.
|
#
76650 |
|
15-May-2001 |
jhb |
Remove unneeded includes of sys/ipl.h and machine/ipl.h.
|
#
76089 |
|
27-Apr-2001 |
jhb |
Add in a missing call to forward_hardclock() in the SMP case.
Submitted by: bde
|
#
76078 |
|
27-Apr-2001 |
jhb |
Overhaul of the SMP code. Several portions of the SMP kernel support have been made machine independent and various other adjustments have been made to support Alpha SMP.
- It splits the per-process portions of hardclock() and statclock() off into hardclock_process() and statclock_process() respectively. hardclock() and statclock() call the *_process() functions for the current process so that UP systems will run as before. For SMP systems, it is simply necessary to ensure that all other processors execute the *_process() functions when the main clock functions are triggered on one CPU by an interrupt. For the alpha 4100, clock interrupts are delievered in a staggered broadcast fashion, so we simply call hardclock/statclock on the boot CPU and call the *_process() functions on the secondaries. For x86, we call statclock and hardclock as usual and then call forward_hardclock/statclock in the MD code to send an IPI to cause the AP's to execute forwared_hardclock/statclock which then call the *_process() functions. - forward_signal() and forward_roundrobin() have been reworked to be MI and to involve less hackery. Now the cpu doing the forward sets any flags, etc. and sends a very simple IPI_AST to the other cpu(s). AST IPIs now just basically return so that they can execute ast() and don't bother with setting the astpending or needresched flags themselves. This also removes the loop in forward_signal() as sched_lock closes the race condition that the loop worked around. - need_resched(), resched_wanted() and clear_resched() have been changed to take a process to act on rather than assuming curproc so that they can be used to implement forward_roundrobin() as described above. - Various other SMP variables have been moved to a MI subr_smp.c and a new header sys/smp.h declares MI SMP variables and API's. The IPI API's from machine/ipl.h have moved to machine/smp.h which is included by sys/smp.h. - The globaldata_register() and globaldata_find() functions as well as the SLIST of globaldata structures has become MI and moved into subr_smp.c. Also, the globaldata list is only available if SMP support is compiled in.
Reviewed by: jake, peter Looked over by: eivind
|
#
74914 |
|
28-Mar-2001 |
jhb |
Catch up to header include changes: - <sys/mutex.h> now requires <sys/systm.h> - <sys/mutex.h> and <sys/sx.h> now require <sys/lock.h>
|
#
72678 |
|
19-Feb-2001 |
bde |
Fixed style bugs in clock.c rev.1.164 and cpu.h rev.1.52-1.53 -- declare tsc_present in the right places (together with other variables of the same linkage), and don't use messy ifdefs just to avoid exporting it in some cases.
|
#
72240 |
|
09-Feb-2001 |
jhb |
Catch up to changes to inthand_add().
|
#
72200 |
|
09-Feb-2001 |
bmilekic |
Change and clean the mutex lock interface.
mtx_enter(lock, type) becomes:
mtx_lock(lock) for sleep locks (MTX_DEF-initialized locks) mtx_lock_spin(lock) for spin locks (MTX_SPIN-initialized)
similarily, for releasing a lock, we now have:
mtx_unlock(lock) for MTX_DEF and mtx_unlock_spin(lock) for MTX_SPIN. We change the caller interface for the two different types of locks because the semantics are entirely different for each case, and this makes it explicitly clear and, at the same time, it rids us of the extra `type' argument.
The enter->lock and exit->unlock change has been made with the idea that we're "locking data" and not "entering locked code" in mind.
Further, remove all additional "flags" previously passed to the lock acquire/release routines with the exception of two:
MTX_QUIET and MTX_NOSWITCH
The functionality of these flags is preserved and they can be passed to the lock/unlock routines by calling the corresponding wrappers:
mtx_{lock, unlock}_flags(lock, flag(s)) and mtx_{lock, unlock}_spin_flags(lock, flag(s)) for MTX_DEF and MTX_SPIN locks, respectively.
Re-inline some lock acq/rel code; in the sleep lock case, we only inline the _obtain_lock()s in order to ensure that the inlined code fits into a cache line. In the spin lock case, we inline recursion and actually only perform a function call if we need to spin. This change has been made with the idea that we generally tend to avoid spin locks and that also the spin locks that we do have and are heavily used (i.e. sched_lock) do recurse, and therefore in an effort to reduce function call overhead for some architectures (such as alpha), we inline recursion for this case.
Create a new malloc type for the witness code and retire from using the M_DEV type. The new type is called M_WITNESS and is only declared if WITNESS is enabled.
Begin cleaning up some machdep/mutex.h code - specifically updated the "optimized" inlined code in alpha/mutex.h and wrote MTX_LOCK_SPIN and MTX_UNLOCK_SPIN asm macros for the i386/mutex.h as we presently need those.
Finally, caught up to the interface changes in all sys code.
Contributors: jake, jhb, jasone (in no particular order)
|
#
71797 |
|
29-Jan-2001 |
peter |
Convert mca (microchannel bus support) from something that we count (bogus) to something that we test for the presence of.
|
#
71320 |
|
21-Jan-2001 |
jasone |
Remove MUTEX_DECLARE() and MTX_COLD. Instead, postpone full mutex initialization until after malloc() is safe to call, then iterate through all mutexes and complete their initialization.
This change is necessary in order to avoid some circular bootstrapping dependencies.
|
#
71262 |
|
19-Jan-2001 |
peter |
Convert apm from a bogus 'count' into a plain option. Clean out some other cruft from the files.alpha and files.ia64 that were related to this.
|
#
69521 |
|
02-Dec-2000 |
markm |
Namespace cleanup. Remove some #includes in favour of an explicit declaration.
Asked for by: bde
|
#
67759 |
|
28-Oct-2000 |
phk |
Revert two experimental changes which escaped from my devel machine.
|
#
67708 |
|
27-Oct-2000 |
phk |
Convert all users of fldoff() to offsetof(). fldoff() is bad because it only takes a struct tag which makes it impossible to use unions, typedefs etc.
Define __offsetof() in <machine/ansi.h>
Define offsetof() in terms of __offsetof() in <stddef.h> and <sys/types.h>
Remove myriad of local offsetof() definitions.
Remove includes of <stddef.h> in kernel code.
NB: Kernelcode should *never* include from /usr/include !
Make <sys/queue.h> include <machine/ansi.h> to avoid polluting the API.
Deprecate <struct.h> with a warning. The warning turns into an error on 01-12-2000 and the file gets removed entirely on 01-01-2001.
Paritials reviews by: various. Significant brucifications by: bde
|
#
67551 |
|
25-Oct-2000 |
jhb |
- Overhaul the software interrupt code to use interrupt threads for each type of software interrupt. Roughly, what used to be a bit in spending now maps to a swi thread. Each thread can have multiple handlers, just like a hardware interrupt thread. - Instead of using a bitmask of pending interrupts, we schedule the specific software interrupt thread to run, so spending, NSWI, and the shandlers array are no longer needed. We can now have an arbitrary number of software interrupt threads. When you register a software interrupt thread via sinthand_add(), you get back a struct intrhand that you pass to sched_swi() when you wish to schedule your swi thread to run. - Convert the name of 'struct intrec' to 'struct intrhand' as it is a bit more intuitive. Also, prefix all the members of struct intrhand with 'ih_'. - Make swi_net() a MI function since there is now no point in it being MD.
Submitted by: cp
|
#
67356 |
|
20-Oct-2000 |
jhb |
- machine/mutex.h -> sys/mutex.h - machine/ipl.h -> sys/ipl.h - Use MUTEX_DECLARE() for clock_lock
|
#
66716 |
|
06-Oct-2000 |
jhb |
- Change fast interrupts on x86 to push a full interrupt frame and to return through doreti to handle ast's. This is necessary for the clock interrupts to work properly. - Change the clock interrupts on the x86 to be fast instead of threaded. This is needed because both hardclock() and statclock() need to run in the context of the current process, not in a separate thread context. - Kill the prevproc hack as it is no longer needed. - We really need Giant when we call psignal(), but we don't want to block during the clock interrupt. Instead, use two p_flag's in the proc struct to mark the current process as having a pending SIGVTALRM or a SIGPROF and let them be delivered during ast() when hardclock() has finished running. - Remove CLKF_BASEPRI, which was #ifdef'd out on the x86 anyways. It was broken on the x86 if it was turned on since cpl is gone. It's only use was to bogusly run softclock() directly during hardclock() rather than scheduling an SWI. - Remove the COM_LOCK simplelock and replace it with a clock_lock spin mutex. Since the spin mutex already handles disabling/restoring interrupts appropriately, this also lets us axe all the *_intr() fu. - Back out the hacks in the APIC_IO x86 cpu_initclocks() code to use temporary fast interrupts for the APIC trial. - Add two new process flags P_ALRMPEND and P_PROFPEND to mark the pending signals in hardclock() that are to be delivered in ast().
Submitted by: jakeb (making statclock safe in a fast interrupt) Submitted by: cp (concept of delaying signals until ast())
|
#
66698 |
|
05-Oct-2000 |
jhb |
- Heavyweight interrupt threads on the alpha for device I/O interrupts. - Make softinterrupts (SWI's) almost completely MI, and divorce them completely from the x86 hardware interrupt code. - The ihandlers array is now gone. Instead, there is a MI shandlers array that just contains SWI handlers. - Most of the former machine/ipl.h files have moved to a new sys/ipl.h. - Stub out all the spl*() functions on all architectures.
Submitted by: dfr
|
#
65822 |
|
13-Sep-2000 |
jhb |
- Remove the inthand2_t type and use the equivalent driver_intr_t type from newbus for referencing device interrupt handlers. - Move the 'struct intrec' type which describes interrupt sources into sys/interrupt.h instead of making it just be a x86 structure. - Don't create 'ithd' and 'intrec' typedefs, instead, just use 'struct ithd' and 'struct intrec' - Move the code to translate new-bus interrupt flags into an interrupt thread priority out of the x86 nexus code and into a MI ithread_priority() function in sys/kern/kern_intr.c. - Remove now-uneeded x86-specific headers from sys/dev/ata/ata-all.c and sys/pci/pci_compat.c.
|
#
65557 |
|
06-Sep-2000 |
jasone |
Major update to the way synchronization is done in the kernel. Highlights include:
* Mutual exclusion is used instead of spl*(). See mutex(9). (Note: The alpha port is still in transition and currently uses both.)
* Per-CPU idle processes.
* Interrupts are run in their own separate kernel threads and can be preempted (i386 only).
Partially contributed by: BSDi (BSD/OS) Submissions by (at least): cp, dfr, dillon, grog, jake, jhb, sheldonh
|
#
64031 |
|
30-Jul-2000 |
phk |
Allow use of TSC even if APM is compiled in but disabled.
|
#
62573 |
|
04-Jul-2000 |
phk |
Previous commit changing SYSCTL_HANDLER_ARGS violated KNF.
Pointed out by: bde
|
#
62454 |
|
03-Jul-2000 |
phk |
Style police catches up with rev 1.26 of src/sys/sys/sysctl.h:
Sanitize SYSCTL_HANDLER_ARGS so that simplistic tools can grog our sources:
-sysctl_vm_zone SYSCTL_HANDLER_ARGS +sysctl_vm_zone (SYSCTL_HANDLER_ARGS)
|
#
61994 |
|
23-Jun-2000 |
msmith |
Add PnP probe methods to some common AT hardware drivers. In each case, the PnP probe is merely a stub as we make assumptions about some of this hardware before we have probed it.
Since these devices (with the exception of the speaker) are 'standard', suppress output in the !bootverbose case to clean up the probe messages somewhat.
|
#
61126 |
|
31-May-2000 |
bde |
Add SWI_TQ_MASK to all interrupt masks except SWI_CLOCK_MASK. Use a new macro SWI_LOW_MASK to give the mask for low priority SWIs instead of hard-coding this mask as SWI_CLOCK_MASK.
Reviewed by: dfr
|
#
58377 |
|
20-Mar-2000 |
phk |
Isolate the Timecounter internals in their own two files.
Make the public interface more systematically named.
Remove the alternate method, it doesn't do any good, only ruins performance.
Add counters to profile the usage of the 8 access functions.
Apply the beer-ware to my code.
The weird +/- counts are caused by two repocopies behind the scenes: kern/kern_clock.c -> kern/kern_tc.c sys/time.h -> sys/timetc.h (thanks peter!)
|
#
55420 |
|
04-Jan-2000 |
tegge |
ISA device drivers use the ISA source interrupt number in locations where the low level interrupt handler number should be used. Change setup_apic_irq_mapping() to allocate low level interrupt handler X (Xintr${X}) for any ISA interrupt X mentioned in the MP table.
Remove an assumption in the driver for the system clock (clock.c) that interrupts mentioned in the MP table as delivered to IOAPIC #0 intpin Y is handled by low level interrupt handler Y (Xintr${Y}) but don't assume that low level interrupt handler 0 (Xintr0) is used.
Don't allocate two low level interrupt handlers for the system clock. Reviewed by: NOKUBI Hirotaka <hnokubi@yyy.or.jp>
|
#
55098 |
|
25-Dec-1999 |
bde |
Fixed races accessing the RTC. The races apparently caused apm_default_resume() to sometimes set a very wrong time. (1) Accesses to the RTC index and data registers were not atomic enough. Interrupts were not masked. This was only good enough until an interrupt handler (rtcintr()) started accessing the RTC in FreeBSD-2.0. (2) Access to the block of time registers in inittodr() was not atomic enough. inittodr() has 244us to read the time registers. Interrupts were not masked. This was only good enough until something (apm) started calling inittodr() after boot time in FreeBSD-2.0. The fix for (2) also makes the timecounter update more atomic, although this is currently unimportant due to the low resolution of the RTC.
Problem reported by: mckay
|
#
54890 |
|
20-Dec-1999 |
peter |
Remove references to register_intr() etc in comments.
|
#
52669 |
|
30-Oct-1999 |
iwasaki |
i8254_restore is called from apm_default_resume() to reload the countdown register. this should not be necessary but there are broken laptops that do not restore the countdown register on resume. when it happnes, it messes up the hardclock interval and system clock, which leads to the infamous "calcru: negative time" problem.
Submitted by: kjc, iwasaki Reviewed by: Steve O'Hara-Smith <steveo@eircom.net> and committers. Obtained from: PAO3
|
#
50823 |
|
03-Sep-1999 |
mdodd |
This adds the i386 specific support for systems with a MicroChannel Architecture bus.
Reviewed by: msmith
|
#
50477 |
|
27-Aug-1999 |
peter |
$Id$ -> $FreeBSD$
|
#
49558 |
|
09-Aug-1999 |
phk |
Merge the cons.c and cons.h to the best of my ability. alpha may or may not compile, I can't test it.
|
#
49196 |
|
28-Jul-1999 |
green |
Remove XXX from the headers (broke the build, I'm betting.)
|
#
49186 |
|
28-Jul-1999 |
msmith |
We're called too early to have any idea whether APM is going to be 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.
|
#
48889 |
|
18-Jul-1999 |
bde |
Updated acquire_timer2()'s state machine to work when the i8254 is being used for timecounting. Fixed a race or two in it. Undisabled it.
PR: 10455
|
#
48888 |
|
18-Jul-1999 |
bde |
Don't let the machdep.tsc_freq sysctl proceed if the TSC is present 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
|
#
48266 |
|
27-Jun-1999 |
peter |
Shut up gcc.
|
#
48160 |
|
24-Jun-1999 |
green |
This commit gives support for the Rise mP6 CPU. It has two changes: 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
|
#
47642 |
|
31-May-1999 |
dfr |
Remove fd driver from its old home and change files which include rtc.h to account for its new location.
|
#
47592 |
|
29-May-1999 |
phk |
Stop the TSC from being used as timecounter on K5/step0 machines.
|
#
47588 |
|
28-May-1999 |
bde |
Fixed glitches (jumps) of about 1/HZ seconds for the i8254 timecounter. 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
|
#
46847 |
|
09-May-1999 |
peter |
For what it's worth, idelayed is declared as a volatile in the headers, and even though it's not used in this file make it a volatile here too.
|
#
46054 |
|
25-Apr-1999 |
phk |
Make the machdep.i8254_freq and machdep.tsc_freq sysctls modify the timecounter as well
Asked for by: bde, jhay
|
#
45900 |
|
21-Apr-1999 |
peter |
oops, SMP was missing includes for a typedef.
|
#
45897 |
|
21-Apr-1999 |
peter |
Stage 1 of a cleanup of the i386 interrupt registration mechanism. 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.
|
#
41787 |
|
14-Dec-1998 |
mckay |
Fix tabs that should have been spaces. Some were in kernel error messages.
|
#
40610 |
|
23-Oct-1998 |
phk |
Update timecounters to new interface.
|
#
39526 |
|
20-Sep-1998 |
bde |
Attempt to work around a bug in the previous commit related to non-reentrancy of SMP clock locking. Depend on the giant lock protecting clkintr().
|
#
39503 |
|
20-Sep-1998 |
bde |
Ensure that the i8254 timecounter doesn't go backards. It sometimes 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.
|
#
38888 |
|
06-Sep-1998 |
tegge |
Maintain a mapping from irq number to (ioapic number, int pin) tuple, 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.
|
#
36810 |
|
09-Jun-1998 |
phk |
Add a tc_ prefix to struct timecounter members.
Urged by: bde
|
#
36741 |
|
07-Jun-1998 |
phk |
Add a member function more to the timecounters, this one is for use with latch based PPS implementations. The client that uses it will be committed after more testing.
|
#
36719 |
|
07-Jun-1998 |
phk |
Add a "this" style argument and a "void *private" so timecounters can figure out which instance to wount with.
|
#
36441 |
|
28-May-1998 |
phk |
Some cleanups related to timecounters and weird ifdefs in <sys/time.h>.
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
|
#
36198 |
|
19-May-1998 |
phk |
Change a data type internal to the timecounters, and remove the "delta" function.
Reviewed, but not entirely approved by: bde
|
#
35035 |
|
04-Apr-1998 |
tegge |
Remove some unneeded statements that enabled interrupts.
|
#
34961 |
|
30-Mar-1998 |
phk |
Eradicate the variable "time" from the kernel, using various measures. "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
|
#
34617 |
|
16-Mar-1998 |
phk |
Be less draconian about the TSC if APM is configured, use it for timecounting if APM-BIOS isn't found. Be just as draconian about SMP as always, but explain it better.
|
#
34571 |
|
14-Mar-1998 |
tegge |
On SMP systems, initially follow the MP spec with regard to which pin 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).
|
#
34058 |
|
05-Mar-1998 |
tegge |
Remove special handling for resuming clock interrupt when using APIC_IO. The `generic' vector stubs do the right thing.
|
#
33929 |
|
28-Feb-1998 |
phk |
Prevent the TSC from being used on APM machines, we have no idea if 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.
|
#
33753 |
|
22-Feb-1998 |
bde |
Quick fix for the i8254 timecounter often gaining 10 msec.
|
#
33727 |
|
21-Feb-1998 |
jkh |
Add missing CLOCK_UNLOCK() before write_eflags(). Submitted by: dave adkins <adkin003@tc.umn.edu>
|
#
33690 |
|
20-Feb-1998 |
phk |
Replace TOD clock code with more systematic approach.
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
|
#
33309 |
|
13-Feb-1998 |
bde |
Update timer0_prescaler_count before calling hardclock() while timer0 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.
|
#
33181 |
|
09-Feb-1998 |
eivind |
Staticize.
|
#
32850 |
|
28-Jan-1998 |
phk |
APM calls inittodr(0) which is stupid, but at least stop setting the clock back to when Dennis had a good idea.
|
#
32054 |
|
28-Dec-1997 |
phk |
More cleanup relating to our use of the TSC. Look in the cpu_feature (CPUID output) to see if we have it.
|
#
32052 |
|
28-Dec-1997 |
phk |
wash, sort and put in order various nits from the i586_ctr -> tsc commit.
Pointed out by: bde
|
#
32005 |
|
26-Dec-1997 |
phk |
Rename "i586_ctr" to "tsc" (both upper and lower case instances). Fix a couple of printfs too.
Warning: This changes the names of a couple of kernel options!
|
#
31253 |
|
18-Nov-1997 |
bde |
Removed #unused includes.
Added a used #include (don't depend on yet to be fixed namespace pollution).
|
#
30805 |
|
28-Oct-1997 |
bde |
Don't include <machine/cputypes.h> or declare cputype/class interfaces 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.
|
#
29000 |
|
01-Sep-1997 |
fsmp |
General cleanup of the sub-system locking macros. 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>
|
#
28921 |
|
30-Aug-1997 |
fsmp |
Another round of lock pushdown. 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>
|
#
28551 |
|
21-Aug-1997 |
bde |
#include <machine/limits.h> explicitly in the few places that it is required.
|
#
28487 |
|
21-Aug-1997 |
fsmp |
Made PEND_INTS default. 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.
|
#
27696 |
|
25-Jul-1997 |
fsmp |
clock.c: - 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.
|
#
27616 |
|
22-Jul-1997 |
fsmp |
Last commit didn't take, operator error???
|
#
27612 |
|
22-Jul-1997 |
fsmp |
Major cleanup of APIC code around the imen variable. This is the first step towards making INTREN()/INTRDIS() MP-safe.
|
#
27563 |
|
20-Jul-1997 |
fsmp |
Developed a new strategy for handling the 8254/8259/APIC issue.
|
#
27560 |
|
20-Jul-1997 |
fsmp |
Minor cleanup.
|
#
27555 |
|
20-Jul-1997 |
bde |
Removed unused #includes.
|
#
27522 |
|
19-Jul-1997 |
fsmp |
Added #code to support define APIC_PIN0_TIMER. This code ALWAYS runs the 8254 timer thru the 8259 ICU. It depricates the usage of "options SMP_TIMER_NC" in the config file.
|
#
27520 |
|
19-Jul-1997 |
fsmp |
SMP or APIC_IO: - Increased NIDT to 256. - Moved IPI vectors up above the linux compat vector. - Removed runtime setup of RTC vector.
|
#
27490 |
|
18-Jul-1997 |
fsmp |
Made the printing of the APIC INTs depend on bootverbose.
|
#
27352 |
|
12-Jul-1997 |
fsmp |
Cleanup old stop_cpus/restart_cpus() cruft. new code for handling mixed-mode 8259/APIC programming without 'ExtInt' new code to control other CPUs: stop_cpus()/restart_cpus()/_Xstopcpu
|
#
26949 |
|
25-Jun-1997 |
fsmp |
Modified to use merged/renamed functions:
- get_isa_apic_mask() -> isa_apic_mask() - get_isa_apic_irq() && get_eisa_apic_irq() -> isa_apic_pin()
|
#
26373 |
|
02-Jun-1997 |
dfr |
Move interrupt handling code from isa.c to a new file. This should make isa.c (slightly) more portable and will make my life developing the really portable version much easier.
Reviewed by: peter, fsmp
|
#
26309 |
|
31-May-1997 |
peter |
Include file updates.. <machine/spl.h> -> <machine/ipl.h>, add <machine/ipl.h> to those files that were depending on getting SWI_* implicitly via <machine/cpufunc.h>
|
#
26264 |
|
29-May-1997 |
peter |
No longer need opt_smp.h here
|
#
26129 |
|
25-May-1997 |
fsmp |
Made the array vec[] a global. This allows the APIC code to reorder the vectors at runtime.
|
#
25485 |
|
05-May-1997 |
peter |
correct the order of the variables use #ifdef where possible instead of #if defined
Submitted by: the KNF police, ie: bde :-)
|
#
25457 |
|
04-May-1997 |
peter |
Don't remove i586_ctr_freq from scope, leave it defined as zero. This simplifies some assumptions and stops some code compile problems.
This should fix the compile hiccup in PR#3491, but smp kernel profiling isn't likely to be fixed by this.
|
#
25164 |
|
26-Apr-1997 |
peter |
Man the liferafts! Here comes the long awaited SMP -> -current merge!
There are various options documented in i386/conf/LINT, there is more to come over the next few days.
The kernel should run pretty much "as before" without the options to activate SMP mode.
There are a handful of known "loose ends" that need to be fixed, but have been put off since the SMP kernel is in a moderately good condition at the moment.
This commit is the result of the tinkering and testing over the last 14 months by many people. A special thanks to Steve Passe for implementing the APIC code!
|
#
24676 |
|
06-Apr-1997 |
mckay |
Prevent wedging of the stat clock because of missed interrupts. This should cure the "alternate system clock has died!" problem.
Discussed with: bde, joerg
|
#
23393 |
|
05-Mar-1997 |
bde |
Only print clock calibration messages if the system was booted with -v.
Submitted by: partly by gpalmer
|
#
23386 |
|
04-Mar-1997 |
gpalmer |
Back out the patch to break up the clock probe lines. Instead, follow Bruce's suggestion of deleting "relative to mc146818A clock ", thus shortening the line ...
|
#
23375 |
|
04-Mar-1997 |
gpalmer |
Split the rather long and line-wrapping clock probe messages on boot. (2.2?)
Submitted by: Mathew Dood <winter@jurai.net>
|
#
22975 |
|
22-Feb-1997 |
peter |
Back out part 1 of the MCFH that changed $Id$ to $FreeBSD$. We are not ready for it yet.
|
#
22106 |
|
29-Jan-1997 |
bde |
Estimate an initial overhead of 0 usec instead of 20 usec in DELAY(). I have code to calibrate the overhead fairly accurately, but there is little point in using it since it is most accurate on machines where an estimate of 0 works well. On slow machines, the accuracy of DELAY() has a large variance since it is limited by the resolution of getit() even if the initial delay is calibrated perfectly.
Use fixed point and long longs to speed up scaling in DELAY(). The old method slowed down a lot when the frequency became variable. Assume the default frequency for short delays so that the fixed point calculation can be exact.
Fast scaling is only important for small delays. Scaling is done after looking at the counter and outside the loop, so it doesn't decrease accuracy or resolution provided it completes before the delay is up. The comment in the code is still confused about this.
|
#
21783 |
|
16-Jan-1997 |
bde |
Guard against the i8254 timer being uninitialzed if DELAY() is called early for console i/o. The timer is usually in BIOS mode if it isn't explicitly initialized. Then it counts twice as fast and has a max count of 65535 instead of 11932. The larger count tended to cause infinite loops for delays of > 20 us. Such delays are rare. For syscons and kbdio, DELAY() is only called early enough to matter for ddb input after booting with -d, and the delay is too small to matter (and too small to be correct) except in the PC98 case. For pcvt, DELAY() is not used for small delays (pcvt uses its own broken routine instead of the standard broken one), but some versions call DELAY() with a large arg when they unnecessarily initialize the keyboard for doing console output. The problem is more serious for pcvt because there is always some early console output.
Guard against the i8254 timer being partially or incorrectly initialized. This would have prevented the endless loop.
Should be in 2.2.
|
#
21673 |
|
14-Jan-1997 |
jkh |
Make the long-awaited change from $Id$ to $FreeBSD$
This will make a number of things easier in the future, as well as (finally!) avoiding the Id-smashing problem which has plagued developers for so long.
Boy, I'm glad we're not using sup anymore. This update would have been insane otherwise.
|
#
19186 |
|
25-Oct-1996 |
bde |
Removed initialization of a variable that went away. Oops.
|
#
19173 |
|
25-Oct-1996 |
bde |
Print the clock calibration messages all on one (long) line again so that they are easy to grep for.
Removed now-unused i586 counter variables.
Fixed some style bugs.
|
#
18842 |
|
09-Oct-1996 |
bde |
Put I*86_CPU defines in opt_cpu.h.
|
#
18297 |
|
14-Sep-1996 |
bde |
Attached simple external ddb commands `show rtc', `show pgrpdump' and `show cbstat'. The pgrpdump code was previously controlled by `#ifdef DEBUG'.
|
#
18288 |
|
14-Sep-1996 |
bde |
Changed cncheckc() interface so that it is 8-bit clean - return -1 instead of 0 if there is no input.
syscons.c: Added missing spl locking in sccncheckc(). Return the same value as sccngetc() would. It is wrong for sccngetc() to return non-ASCII, but stripping the non-ASCII bits doesn't help.
|
#
17395 |
|
02-Aug-1996 |
bde |
Eliminated i586_ctr_rate. Use i586_ctr_freq instead.
|
#
17353 |
|
30-Jul-1996 |
bde |
Fixed the machdep.i8254_freq and machdep.i586_freq sysctls. Writes were handled bogusly.
Centralized the setting of all the frequency variables. Set these variables atomically. Some new ones aren't used yet.
|
#
17236 |
|
21-Jul-1996 |
joerg |
Post-commit review by Bruce. Mostly stylistic changes.
Submitted by: bde
|
#
17231 |
|
20-Jul-1996 |
joerg |
Major cleanup of the timerX_{acquire,release} stuff. In particular, make it more intelligible, improve the partially bogus locking, and allow for a ``quick re-acquiration'' from a pending release of timer 0 that happened ``recently'', so it was not processed yet by clkintr(). This latter modification now finally allows to play XBoing over pcaudio without losing sounds or getting complaints. ;-) (XBoing opens/writes/closes the sound device all over the day.)
Correct locking for sysbeep().
Extensively (:-) reviewed by: bde
|
#
17194 |
|
17-Jul-1996 |
bde |
Fixed adjustment of `time' when timer0 is released. 27465 was 27645 in a comment and in code that was only used when pcaudio was closed. The maximum error was 66 usec.
|
#
16874 |
|
01-Jul-1996 |
bde |
Use the standard timer (interrupt) frequency while calibrating the clocks. Testing with the high frequency of 20000 Hz (to find problems) only found the problem that this frequency is too high for slow i386's.
Disable interrupts while setting the timer frequency. This was unnecessary before rev.1.57 and forgotten in rev.1.57. The critical (i8254) interrupts are disabled in another way at boot time but not in the sysctl to change the frequency.
|
#
16428 |
|
17-Jun-1996 |
bde |
In getit(), use read_eflags()/write_eflags() to preserve the interrupt enable flag instead of enable_intr() to restore it to its usual state. getit() is only called from DELAY() so there is no point in optimising its speed (this wasn't so clear when it was extern), and using enable_intr() made it inconvenient to call DELAY() from probes that need to run with interrupts disabled.
|
#
16300 |
|
11-Jun-1996 |
pst |
Move warning messages under bootverbose
|
#
16299 |
|
11-Jun-1996 |
pst |
Put clock calibration #defines in opt_clock.h to ease reconfiguration
|
#
15508 |
|
01-May-1996 |
bde |
Added calibration the i8254 and the i586 clocks agains the RTC at boot time. The results are currently ignored unless certain temporary options are used.
Added sysctls to support reading and writing the clock frequency variables (not the frequencies themselves). Writing is supposed to atomically adjust all related variables.
machdep.c: Fixed spelling of a function name in a comment so that I can log this message which should have been with the previous commit.
Initialize `cpu_class' earlier so that it can be used in startrtclock() instead of in calibrate_cyclecounter() (which no longer exists).
Removed range checking of `cpu'. It is always initialized to CPU_XXX so it is less likely to be out of bounds than most variables.
clock.h: Removed I586_CYCLECTR(). Use rdtsc() instead.
clock.c: TIMER_FREQ is now a variable timer_freq that defaults to the old value of TIMER_FREQ. #define'ing TIMER_FREQ should still work and may be the best way of setting the frequency.
Calibration involves counting cycles while watching the RTC for one second. This gives values correct to within (a few ppm) + (the innaccuracy of the RTC) on my systems.
|
#
15345 |
|
22-Apr-1996 |
nate |
- add apm to the GENERIC kernel (disabled by default), and add some comments regarding apm to LINT - Disabled the statistics clock on machines which have an APM BIOS and have the options "APM_BROKEN_STATCLOCK" enabled (which is default in GENERIC now) - move around some of the code in clock.c dealing with the rtc to make it more obvios the effects of disabling the statistics clock
Reviewed by: bde
|
#
15054 |
|
05-Apr-1996 |
ache |
Fix adjkerntz expression priority
|
#
15045 |
|
05-Apr-1996 |
ache |
Add wall_cmos_clock sysctl variable, needed to manage adjkerntz even for UTC cmos clocks (needed for Local Timezone FSes)
|
#
14943 |
|
31-Mar-1996 |
bde |
Moved rtcin() to clock.c.
Always delay using one inb(0x84) after each i/o in rtcin() - don't do this conditional on the bogus option DUMMY_NOPS not being defined. If you want an optionally slightly faster rtcin() again, then inline it and use a better named option or sysctl variable. It only needs to be fast in rtcintr().
|
#
14773 |
|
23-Mar-1996 |
nate |
Whoops, back out the last commit, which was accidentally committed at the same time as the if_zp cleanup patch.
The commit that occurred was an incomplete patch for APM on my laptop and needs more work.
|
#
14772 |
|
23-Mar-1996 |
nate |
Now that ac->ac_ipaddr and arpwhohas() no longer exist, remove the ifdef'd out code that used it.
|
#
13758 |
|
30-Jan-1996 |
wollman |
No longer use the cyclecounter to attempt to correct for late or missed clock interrupts.
Keep a 1-in-16 smoothed average of the length of each tick. If the CPU speed is correctly diagnosed, this should give experienced users enough information to figure out a more suitable value for `tick'.
|
#
13453 |
|
16-Jan-1996 |
ache |
Since new bcd* macros not argument range overflow resistant, fix argument overflow for years >= 2000
|
#
13445 |
|
15-Jan-1996 |
phk |
My wife is busy making me a new conical hat, so you don't need to send any to me this time. Commited an old copy of this files where the tables were swapped. Duh!.
|
#
13444 |
|
15-Jan-1996 |
phk |
Soren called an said that I screwed up badly, so I backup until I find out how... Sorry.
|
#
13438 |
|
15-Jan-1996 |
phk |
Make bin2bcd and bcd2bin global macroes instead of having local implementations all over the place.
|
#
13402 |
|
12-Jan-1996 |
bde |
Fixed handling of Feb 29 in resettodr().
|
#
13350 |
|
08-Jan-1996 |
ache |
Replace ugly year/month calculations in resettodr to more clean variants, idea taken from NetBSD clock.c. At least year calculation was wrong, pointed by Bruce. Use different strategy to store year for BIOS without RTC_CENTURY
|
#
13228 |
|
04-Jan-1996 |
wollman |
Convert DDB to new-style option.
|
#
13000 |
|
24-Dec-1995 |
dg |
Add Pentium Pro CPU detection and special handling. For now, all the optimizations we have for 586s also apply to 686s...this will be fine- tuned in the future as appropriate.
|
#
12941 |
|
20-Dec-1995 |
wollman |
Increase Pentium cyclecounter calibration time to 131072 us. This experimentally seems to give better results on my machine.
|
#
12844 |
|
14-Dec-1995 |
bde |
Fixed staticization of DDB functions.
|
#
12724 |
|
10-Dec-1995 |
phk |
Staticize and cleanup.
|
#
12533 |
|
29-Nov-1995 |
wollman |
Fix Pentium CPU rate diagnosis: - Don't print out meaningless iCOMP numbers, those are for droids. - Use a shorter wait to determine clock rate to avoid deficiencies in DELAY(). - Use a fixed-point representation with 8 bits of fraction to store the rate and rationalize the variable name. It would be possible to use even more fraction if it turns out to be worthwhile (I rather doubt it).
The question of source code arrangement remains unaddressed.
|
#
11872 |
|
28-Oct-1995 |
phk |
Remove unused functions and variables, make things static, and other cleanups.
|
#
11452 |
|
12-Oct-1995 |
wollman |
Reduce jitter of Pentium microtime() implementation by letting the counter free-run and doing a subtract in microtime() rather than resetting the counter to zero at every clock tick. In combination with the changes to kern_clock.c, this should eliminate all the immediately obvious sources of systematic jitter in timekeeping on Pentium machines.
|
#
10268 |
|
25-Aug-1995 |
bde |
Remove extra args from the calls to getit(). The bug was benign with the default function call convention.
|
#
9202 |
|
11-Jun-1995 |
rgrimes |
Merge RELENG_2_0_5 into HEAD
|
#
8876 |
|
30-May-1995 |
rgrimes |
Remove trailing whitespace.
|
#
8448 |
|
11-May-1995 |
bde |
Add variable `idelayed' and macros setdelayed() and schedsofttty() to access it. setdelayed() actually ORs the bits in `idelayed' into `ipending' and clears `idelayed'.
Call setdelayed() every (normal) clock tick to convert delayed interrupts into pending ones.
Drivers can set bits in `idelayed' at any time to schedule an interrupt at the next clock tick. This is more efficient than calling timeout(). Currently only software interrupts can be scheduled.
|
#
7090 |
|
16-Mar-1995 |
bde |
Add and move declarations to fix all of the warnings from `gcc -Wimplicit' (except in netccitt, netiso and netns) and most of the warnings from `gcc -Wnested-externs'. Fix all the bugs found. There were no serious ones.
|
#
5722 |
|
19-Jan-1995 |
ats |
Submitted by: Bruce Evans Put in the much shorter and cleaner version for the calibrate_cycle_counter for the Pentium that Bruce suggested. Tested here on my Pentium and it works okay.
|
#
5431 |
|
07-Jan-1995 |
ats |
Work around a compiler bug in gcc2.6.3 in handling (long long) variables and shifting. Also correct the original code as Garrett noticed it in mail. Leave the mishandled code in to use it later if future versions of gcc are correct. The code was part of the calibrate_cyclecounter routine to get the speed of the pentium chip.
|
#
5291 |
|
30-Dec-1994 |
bde |
icu.s: Move definition of `stat_imask' to clock.c.
clock.c: Rename `rtcmask' to `stat_imask' and export it. Rename `clkmask' to `clk_imask' for consistency.
Only calculate TIMER_DIV(hz) once.
Merge debugging and "garbage" code to produce debugging code and format the output better.
Make writertc() static inline and use it everywhere. Now all accesses to the clock registers go through rtcin() and writertc().
Move rtc initialization to cpu_initclocks().
Merge enablertclock() with cpu_initclocks() and remove enablertclock(). The extra entry point was just a leftover from 1.1.5.
|
#
4396 |
|
12-Nov-1994 |
ache |
Revision 1.6 fix was lost: don't write 0 to RTC_DIAG
|
#
4341 |
|
10-Nov-1994 |
ache |
Use adjkerntz into inittodr too (for APM stuff)
|
#
4180 |
|
05-Nov-1994 |
bde |
Maintain a new variable `timer0_overflow_threshold' so that microtime() doesn't have to calculate it every call.
Rename `timer0_prescale' to `timer0_prescaler_count' and maintain it correctly. Previously we lost a few 8253 cycles for every "prescaled" clock interrupt, and the lossage grows rapidly at 16 KHz. Now we only lose a few cycles for every standard clock interrupt.
Rename `*_divisor' to `*_max_count'.
Do the calculation of TIMER_DIV(rate) only once instead of 3 times each time the rate is changed.
Don't allow preposterously large interrupt rates. Bug fixes elsewhere should allow the system to survive rates that saturate the system, however.
Clean up declarations.
Include <machine/clock.h> to check our own declarations.
|
#
3867 |
|
25-Oct-1994 |
se |
BEWARE: Interface change of register_intr() !
Changed the fifth parameter to register_intr() from u_int mask into u_int *maskptr in preparation for new features (shared interrupts and removable devices, eg. for PCMCIA).
|
#
3366 |
|
04-Oct-1994 |
ache |
Add disable_rtc_set variable to block resettodr() call, needed for adjkerntz -i, per Bruce suggestion
|
#
3355 |
|
04-Oct-1994 |
ache |
RTC_CENTURY usage ifdefed out by USE_RTC_CENTURY compile option, pointed by Bruce
|
#
3185 |
|
29-Sep-1994 |
sos |
Updated pcaudio.c to latest from 1.1.5.1 Enabled timer reprogramming in clock.c (this could use more work).
Obtained from: FreeBSD-1.1.5.1
|
#
2932 |
|
20-Sep-1994 |
bde |
Don't lose the RTC interrupt in resettodr().
|
#
2913 |
|
19-Sep-1994 |
ache |
resettodr() implemented, inittodr() fixed Submitted by: me & chris@gnome.co.uk
|
#
2873 |
|
18-Sep-1994 |
bde |
Remove some unnecessary #includes.
Restore the simple leap year calculation as a macro and document it so that it doesn't become complicated again. The simple version works for all leap years covered by 32-bit time_t's. The complicated version doesn't work for all leap years covered by 64-bit time_t's since among other reasons, the solar system is not stable for long enough.
Fix declarations.
Nuke spinwait().
|
#
2858 |
|
18-Sep-1994 |
wollman |
Redo Kernel NTP PLL support, kernel side.
This code is mostly taken from the 1.1 port (which was in turn taken from Dave Mills's kern.tar.Z example). A few significant differences:
1) ntp_gettime() is now a MIB variable rather than a system call. A few fiddles are done in libc to make it behave the same.
2) mono_time does not participate in the PLL adjustments.
3) A new interface has been defined (in <machine/clock.h>) for doing possibly machine-dependent things around the time of the clock update. This is used in Pentium kernels to disable interrupts, set `time', and reset the CPU cycle counter as quickly as possible to avoid jitter in microtime(). Measurements show an apparent resolution of a bit more than 8.14usec, which is reasonable given system-call overhead.
|
#
2770 |
|
14-Sep-1994 |
ache |
1. adjkerntz variable added for preparation to resettodr() implementation 2. Leap year calculations fixed
|
#
2112 |
|
18-Aug-1994 |
wollman |
Fix up some sloppy coding practices:
- Delete redundant declarations. - Add -Wredundant-declarations to Makefile.i386 so they don't come back. - Delete sloppy COMMON-style declarations of uninitialized data in header files. - Add a few prototypes. - Clean up warnings resulting from the above.
NB: ioconf.c will still generate a redundant-declaration warning, which is unavoidable unless somebody volunteers to make `config' smarter.
|
#
2103 |
|
18-Aug-1994 |
dg |
Bruce Evans' dynamic interrupt support.
/usr/src/sys/i386/isa/clock.c: o Garrett's statclock changes. o Wire xxxintr, not Vclk. o Wire using register_intr(), not setidt().
/usr/src/sys/i386/isa/icu.s: o Garrett's statclock changes. o Removed unused variable high_imask. o Fake int 8 for rtc as well as int 0 for clk. Required for kernel profiling with statclock, harmless otherwise.
/usr/src/sys/i386/isa/isa.c: o Allow isdp->id_irq and other things in *isdp to be changed by probes. Changing interrupts later requires direct calls to register_intr() and unregister_intr() and more care. ALLOW_CONFLICT_* is brought over from 1.1.5, except ALLOW_CONFLICT_IRQ is not supported. IRQ conflict checking is delayed until after probing so that drivers can change the IRQ to a free one; real conflicts require more cooperation between drivers to handle. o Too many details to list. o This file requires splitting and a lot more work.
/usr/src/sys/i386/isa/isa_device.h: o Declare more things more completely.
/usr/src/sys/i386/isa/sio.c: o Prepare to register interrupt handlers as fast.
/usr/src/sys/i386/isa/vector.s: o Generate entry code for 16 fast interrupt handlers and 16 normal interrupt handlers. Changed some constants to variables: # $unit is now intr_unit[intr]. Type is int. Someday it should be a cookie suitable for the handler (e.g., a struct com_s for sio). # $handler is now intr_handler[intr]. # intrcnt_actv[id_num] is now *intr_countp[intr]. The indirection is required to get a contiguous range of counters for vmstat and so that the drivers depend more in the driver than on the interrupt number (drivers could take turns using an interrupt and the counts would remain correct). There is a separate counter for each device and for each stray interrupt. In 1.1.5, stray interrupt 7 clobbers the count for device 7 or something worse if there is no device 7 :-(. # mask is now intr_mask[intr] (was already indirect). o Entry points are now _XintrI and _XfastintrI (I = intr = 0-15), not _VdevU (U = unit). o Removed BUILD_VECTORS stuff. There's a trace of it left for the string table for vmstat but config now generates the string in one piece because nothing more is required. o Removed old handling of stray interrupts and older comments about it.
Submitted by: Bruce Evans
|
#
2074 |
|
15-Aug-1994 |
wollman |
Enable use of the RTC chip for the statistical clock. While this does not provide the full accuracy of a randomized statistical clock, it does provide greater accuracy than the previous method, while not significantly increasing overhead. It also provides profiling support at 1024 Hz.
You must re-compile config before making a new kernel, or you will end up with unresolved symbols.
Reviewed uy: Bruce evans said it worked for him.
|
#
2056 |
|
13-Aug-1994 |
wollman |
Change all #includes to follow the current Berkeley style. Some of these ``changes'' are actually not changes at all, but CVS sometimes has trouble telling the difference.
This also includes support for second-directory compiles. This is not quite complete yet, as `config' doesn't yet do the right thing. You can still make it work trivially, however, by doing the following:
rm /sys/compile mkdir /usr/obj/sys/compile ln -s M-. /sys/compile cd /sys/i386/conf config MYKERNEL cd ../../compile/MYKERNEL ln -s /sys @ rm machine ln -s @/i386/include machine make depend make
|
#
2017 |
|
10-Aug-1994 |
wollman |
For Pentium machines, use a faster version of microtime with 8 usec resolution (can probably be improved somewhat). Other machines take a three-instruction hit if I586_CPU is defined, none otherwise.
|
#
2014 |
|
10-Aug-1994 |
wollman |
Tell Pentium users their CPU speed. (More changes to make use of this to come later.)
|
#
1549 |
|
25-May-1994 |
rgrimes |
The big 4.4BSD Lite to FreeBSD 2.0.0 (Development) patch.
Reviewed by: Rodney W. Grimes Submitted by: John Dyson and David Greenman
|
#
1442 |
|
02-May-1994 |
sos |
Update the reprogram timer stuff, now the frequency of timer 0 can only be changed at the "right" times. Accuracy should be assured.
|
#
1407 |
|
23-Apr-1994 |
wollman |
Define new option, INACCURATE_MICROTIME_IS_OK. When this is defined, the NTP kernel PLL is disabled, and acquire_timer0() is enabled, thus opening the door for microtime() (and hence gettimeofday()) to return bogus timestamps. This option is necessary for the `pca' driver to work, but is implemented to underscore the fact that accurate timekeeping and the `pca' driver are incompatible at present. If someone writes a version of microtime() that works when the `pca' driver is being used, this can get junked.
|
#
1390 |
|
21-Apr-1994 |
sos |
New support for sharing the timers acquire_timer / release_timer
Pulled in timer related functions from isa.c
|
#
1104 |
|
06-Feb-1994 |
dg |
At the suggestion of Bruce Evans, don't zero RTC diag register. Doing so was causing problems for some machines.
|
#
879 |
|
18-Dec-1993 |
wollman |
Make everything compile with -Wtraditional. Make it easier to distribute a binary link-kit. Make all non-optional options (pagers, procfs) standard, and update LINT to reflect new symtab requirements.
NB: -Wtraditional will henceforth be forgotten. This editing pass was primarily intended to detect any constructions where the old code might have been relying on traditional C semantics or syntax. These were all fixed, and the result of fixing some of them means that -Wall is now a realistic possibility within a few weeks.
|
#
798 |
|
24-Nov-1993 |
wollman |
Make the LINT kernel compile with -W -Wreturn-type -Wcomment -Werror, and add same (sans -Werror) to Makefile for future compilations.
|
#
700 |
|
03-Nov-1993 |
ache |
DST offset calculation removed, it is wrong in any case.
|
#
619 |
|
16-Oct-1993 |
rgrimes |
Removed all patch kit headers, sccsid and rcsid strings, put $Id$ in, some minor cleanup. Added $Id$ to files that did not have any version info, etc
|
#
5 |
|
12-Jun-1993 |
rgrimes |
This commit was generated by cvs2svn to compensate for changes in r4, which included commits to RCS files with non-trunk default branches.
|
#
4 |
|
12-Jun-1993 |
rgrimes |
Initial import, 0.1 + pk 0.2.4-B1
|