summaryrefslogtreecommitdiffstats
path: root/sys/arch/amd64/isa/clock.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* timecounting: use C99-style initialization for all timecounter structscheloha2021-02-231-2/+9
| | | | | | | | | | | | | | | | | | The timecounter struct is large and I think it may change in the future. Changing it later will be easier if we use C99-style initialization for all timecounter structs. It also makes reading the code a bit easier. For reasons I cannot explain, switching to C99-style initialization sometimes changes the hash of the resulting object file, even though the resulting struct should be the same. So there is a binary change here, but only sometimes. No behavior should change in either case. I can't compile-test this everywhere but I have been staring at the diff for days now and I'm relatively confident this will not break compilation. Fingers crossed. ok gnezdo@
* Add support for timeconting in userland.pirofti2020-07-061-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | This diff exposes parts of clock_gettime(2) and gettimeofday(2) to userland via libc eliberating processes from the need for a context switch everytime they want to count the passage of time. If a timecounter clock can be exposed to userland than it needs to set its tc_user member to a non-zero value. Tested with one or multiple counters per architecture. The timing data is shared through a pointer found in the new ELF auxiliary vector AUX_openbsd_timekeep containing timehands information that is frequently updated by the kernel. Timing differences between the last kernel update and the current time are adjusted in userland by the tc_get_timecount() function inside the MD usertc.c file. This permits a much more responsive environment, quite visible in browsers, office programs and gaming (apparently one is are able to fly in Minecraft now). Tested by robert@, sthen@, naddy@, kmos@, phessler@, and many others! OK from at least kettenis@, cheloha@, naddy@, sthen@
* Fix buglet in previous commit; use time from the struct timeval that waskettenis2020-05-021-2/+2
| | | | | | passed in when setting the RTC time instead of the global time_second. ok mpi@
* Use the same inittodr()/resettodr() implementation as on arm64/armv7/sparc64kettenis2020-04-281-69/+28
| | | | | | | and move it to the end of machdep.c. Rework the actual implementation for te MC14818 compatible RTC into something that can be used as a todr_handle. ok mpi@
* sysctl(2): add kern.utc_offset: successor to the DST/TIMEZONE options(4)cheloha2019-08-211-9/+4
| | | | | | | | | | | | | | | | | | | | | The DST and TIMEZONE options(4) are incompatible with KARL, so we need some other way to compensate for an RTC running with a known offset. Enter kern.utc_offset, an offset in minutes East of UTC. TIMEZONE has always been minutes West, but this is inconsistent with how everyone else talks about timezones, hence the flip. TIMEZONE has the advantage of being compiled into the binary. Our new sysctl(2) has no such luck, so it needs to be set as early as possible in boot, from sysctl.conf(5), so we can correct the kernel clock from the RTC's local time to UTC before daemons like ntpd(8) and cron(8) start. To encourage this, kern.utc_offset is made immutable after the securelevel(7) is raised to 1. Prompted by yasuoka@. Discussed with deraadt@, kettenis@, yasuoka@. Additional testing by yasuoka@. ok deraadt@, yasuoka@
* i8254_delay(): simplify tick computationcheloha2019-07-191-29/+6
| | | | | | | | | | Back in the mid-90s these optimizations probably made sense, but these days the compiler will produce even better code if we just explicitly use 64-bit math and do the obvious thing. joerg@netbsd.org even popped in on tech@ to agree. ok guenther@
* zap reference to non-existent function in a commentjasper2019-05-231-5/+2
| | | | ok mpi@
* Use the MI interrupt enable/distable API instead of the MD one on amd64 andkettenis2018-07-271-9/+8
| | | | | | remove the MD API. ok guenther@, deraadt@, mpi@
* Mark the i8254 clock interrupt MPSAFE. It isn't, but it doesn't matterkettenis2018-07-091-5/+9
| | | | | | as it is impossoble to run an anything but a single-CPU machine with it. ok mpi@, guenther@
* reduce the amount of includes in arch/amd64jsg2017-10-141-3/+1
| | | | ok mpi@ deraadt@
* don't bother checking diagnostic status (which patrick reportsjcs2017-08-111-7/+1
| | | | | | | actually hangs a particular machine) to avoid reporting an error which is common on modern machines ok deraadt, patrick
* tedu some code that has not been executed since time_t became 64 bitstom2017-01-251-20/+1
| | | | guenther@ deraadt@
* not having a century is a known layout by nowjcs2016-08-031-6/+3
|
* Remove some includes include-what-you-use claims don'tjsg2015-03-141-2/+1
| | | | | | | have any direct symbols used. Tested for indirect use by compiling amd64/i386/sparc64 kernels. ok tedu@ deraadt@
* It's been a quarter century: we can assume volatile is present with that name.guenther2014-03-291-3/+3
| | | | ok dlg@ mpi@ deraadt@
* Don't set the frequency of the statclock if we don't have one.gerhard2013-04-171-5/+9
| | | | | | Prevents strange hang-ups during reboot. Joint work with hshoexer@. ok mikeb@, mlarkin@, miod@, deraadt@
* N: Thou shalt not call hardclock() with biglock held.oga2011-07-051-2/+2
| | | | | | | i386 disobeys the Nth commandment. Fix this. While here, make i386 and amd64 definitions of iplclock and statclock match. ok art@, kettenis@
* remove uneeded inlines here as was done in rev 1.24 ofjsg2011-04-081-5/+5
| | | | | | the equivalent i386 file ok kettenis@ deraadt@
* Disable the RTC the periodic interrupt. Leaving it enabled causes thekettenis2010-08-111-1/+7
| | | | | | | Dell Inspirion 4150 to wake up immediately even though RTC_EN isn't set in the PM1 Enable register. ok deraadt@, mlarkin@
* Someone went nuts with spaces and tabs. No binary change.marco2010-08-101-11/+11
|
* Don't forget to register the i8254-based timecounter if we use the i8254kettenis2010-07-291-1/+3
| | | | for clock interrupts. Unbreaks amd64 in PIC mode.
* in the clock drivers, seperate the soft-state and hard-state which wasderaadt2010-07-251-47/+27
| | | | | | | | | all jumbled up in the same functions. the rtc (mc chip) and clock (i8243) startup was also mixed up. they the soft state and hardware state can be started in the right order, and it is easy to restart just the neccessary parts upon resume. tested in numerous cases: (apic, pic) * (GENERIC.MP, GENERIC) * (mp, non-mp) * (i386, amd64) ok kettenis
* copy nvram code from i386, because amd64 can use it too. done byderaadt2007-08-021-2/+2
| | | | tybollt@solace.miun.se, ok jcs
* Remove MCA ghosts, no changes in .o files.grange2007-05-031-30/+1
| | | | Free commit ticket from miod@.
* ansi/deregisterjsg2007-01-151-29/+15
|
* Timecounters for amd64. Diff by art@, tested by many. ok deraadt@otto2006-11-071-142/+113
|
* Remove dead sysbeep driver and unused sysbeep() routine. No functional change.miod2006-02-121-60/+1
|
* Remove the advertising clause in the UCB license which Berkeleyjsg2005-12-131-6/+2
| | | | | rescinded 22 July 1999. Checked by ian@, deraadt@ and millert@, arm portion checked by drahn@
* Kill MCA related includes.krw2005-12-101-8/+1
| | | | ok deraadt@
* make options TIMEZONE and DST work; from formderaadt2005-09-271-5/+9
|
* Use new event counter API for interrupt counting on amd64. Based in partderaadt2004-06-281-2/+3
| | | | on some changes in the i386 codebase.
* SMP support. Big parts from NetBSD, but with some really serious debuggingart2004-06-251-26/+5
| | | | | | | done by me, niklas and others. Especially wrt. NXE support. Still needs some polishing, especially in dmesg messages, but we're now building kernel faster than ever.
* Initialize msb and lsb tables (from NetBSD).nordin2004-03-221-1/+70
| | | | Use lsb table when calculating microtime. deraadt@ ok
* simplify the delay stuffderaadt2004-03-091-22/+36
|
* an amd64 arch support.mickey2004-01-281-0/+765
hacked by art@ from netbsd sources and then later debugged by me into the shape where it can host itself. no bootloader yet as needs redoing from the recent advanced i386 sources (anyone? ;)