Home | History | Annotate | Download | only in dev
History log of /src/sys/arch/amiga/dev/clock.c
RevisionDateAuthorComments
 1.59  20-Dec-2023  thorpej Remove unnecessary <sys/malloc.h> include.
 1.58  03-Jul-2020  maxv hardclock_ticks -> getticks()
 1.57  29-May-2020  rin For clk_timecounter:
- Use C99 initializer.
- Leave .tc_name NULL initially.
No functional changes.
 1.56  19-May-2020  rin Round amiga_clk_interval to the nearest integer, in order to emulate
100 Hz clock better by that running at PAL frequency (709379 Hz).

No functional changes for systems running at NTSC freq (715909 Hz).
 1.55  12-Nov-2015  phx Use the MD_BTOP() macro as replacement for m68k_btop() in all device
drivers which are shared with amigappc.
 1.54  27-Oct-2012  chs branches: 1.54.14;
split device_t/softc for all remaining drivers.
replace "struct device *" with "device_t".
use device_xname(), device_unit(), etc.
 1.53  03-Jun-2011  matt branches: 1.53.2; 1.53.12;
CFATTACH_DECL_NEW, device_t, cfdata_t
 1.52  08-Feb-2011  rmind branches: 1.52.2;
Remove clause 3 (UCB advertising clause) from the University of Utah
copyright. Confirmed by Mike Hibler, mike at cs.utah.edu - thanks!
Also, merge UCB and Utah copyright texts back into one, as they
originally were.

Extra verification by snj@.
 1.51  12-Dec-2009  phx branches: 1.51.4; 1.51.6; 1.51.8;
Reverted the CIA-timer based delay() to the pre-5.0 method of a calibrated
delay loop.
This fixes keyboard handshaking problems with some A1200 models since 5.0
and restores the precision for short delays on DraCo systems (the QuickLogic
timer has only a seventh of the CIA precision).
Changed the keyboard handshaking delay from 2000 back to 200ms, although
even the recommended 85ms were successfully tested on the most problematic
A1200 keyboards.
All those changes were tested on an A3000 and A1200 with 68060/50 CPU, and
previously discussed on the port-amiga ML.
 1.50  11-Sep-2009  phx Handle the situation of a wrapped interval counter, while the hardclock()
interrupt was not yet executed to update the hardclock_ticks variable.
 1.49  11-Sep-2009  phx Reverted last change after discussion with the author, Michael L. Hitch:
http://mail-index.netbsd.org/port-amiga/2009/08/14/msg007164.html
We have a full 32-bit counter, so the masking is not needed.
 1.48  07-Dec-2008  mhitch Fix timecounters using interval timers: amiga counters are not 32 bits,
so the tc_counter_mask needs to be set based on the interval timer.
Process cpu usage was returning negative or very large values.
 1.47  06-Jan-2008  mhitch branches: 1.47.6; 1.47.10; 1.47.16; 1.47.18; 1.47.20;
Add timecounter support and borrow counter-based delay from i386.
From joerg; testing and final tweaks by me.
 1.46  04-Mar-2007  christos branches: 1.46.20; 1.46.26; 1.46.32;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.45  05-Sep-2006  mhitch branches: 1.45.8;
Switch amiga to MI todr.
 1.44  11-Dec-2005  christos branches: 1.44.4; 1.44.8;
merge ktrace-lwp.
 1.43  13-Jun-2005  jmc branches: 1.43.2;
Fix a ton of const/volatile issues shown with new warning flags
 1.42  07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.41  02-Oct-2002  thorpej branches: 1.41.6;
Use CFATTACH_DECL().
 1.40  27-Sep-2002  thorpej Declare all cfattach structures const.
 1.39  14-May-2002  matt Eliminate commons. (including a few unused or mismatched ones).
 1.38  28-Jan-2002  aymeric add __KERNEL_RCSID as suggested by Luke Mewburn
 1.37  26-Jan-2002  aymeric - ANSIfy
- remove some trailing spaces/tabs
- minor style nits
 1.36  15-Mar-2001  chs branches: 1.36.2; 1.36.8;
eliminate the KERN_* error codes in favor of the traditional E* codes.
the mapping is:

KERN_SUCCESS 0
KERN_INVALID_ADDRESS EFAULT
KERN_PROTECTION_FAILURE EACCES
KERN_NO_SPACE ENOMEM
KERN_INVALID_ARGUMENT EINVAL
KERN_FAILURE various, mostly turn into KASSERTs
KERN_RESOURCE_SHORTAGE ENOMEM
KERN_NOT_RECEIVER <unused>
KERN_NO_ACCESS <unused>
KERN_PAGES_LOCKED <unused>
 1.35  29-Jun-2000  mrg branches: 1.35.2;
remove include of <vm/vm.h>. <vm/vm.h> -> <uvm/uvm_extern.h>
 1.34  14-Mar-1999  is branches: 1.34.8;
Use the 1/256s-resolution when reading the DraCo battery backed clock
 1.33  26-Jul-1998  is yet more atomic operations accessing DraCo registers
 1.32  12-Jan-1998  thorpej Adjust for changes to config.
 1.31  15-Sep-1997  is Only create verbose delay loop calibration message for DIAGNOSTIC kernels.
 1.30  19-Jul-1997  is branches: 1.30.2;
Make Amiga battery clocks autoconfiguration devices, so that they can be
left out of specialized configurations.
 1.29  17-Jul-1997  is Make the DraCo hardware clock an autoconfiguration device.
 1.28  06-Jul-1997  is Implement the RTC_OFFSET kernel option/rtc_offset variable for the Amiga port.
To get the old behaviour, set options RTC_OFFSET=0 in your kernel configuration
file.
 1.27  06-Jul-1997  is A first hack at DraCo real-time clock support; only reads clock, currently.
Also only whole seconds are used (while the hardware provides 1/256 seconds).
 1.26  25-May-1997  veego Converted for the use of sys/dev/clock_subr.[ch].
Add some comments about the a2000 oki clock chip and stop the clock while
writing.
 1.25  02-Jan-1997  is Use the right parameter to decide whether it's early configuration. (I wonder
why this worked with some configurations... it shouldn't have).

While we're here, correct the 2.4% error in the delay divisor message.
 1.24  23-Dec-1996  veego Get rid of __BROKEN_INDIRECT_CONFIG.
 1.23  17-Dec-1996  is Make clock an early configuration device, configured before early console
configuration. This way, the delay loop is calibrated before graphics and
serial hardware is touched.

This change should smooth pr 2890 by Thorsten Frueauf (also privately
reported by Laurent Badoukh). While the real problem with those is the
paranoically high delay() calls in the grf_cl initialization, it was made
even more visible by the miscalibrated (to the save side) new style delay
loop.
 1.22  14-Oct-1996  is KNF patrol.
 1.21  13-Oct-1996  christos backout previous kprintf change
 1.20  11-Oct-1996  mhitch Fix compile errors when not configured for the Draco.
 1.19  10-Oct-1996  christos printf -> kprintf, sprintf -> ksprintf
 1.18  29-Sep-1996  is a) replace our delay() with a Gordon Ross style one, calibrated at
clock_attach() time (for now).
This removes our dependance on the DraCo ROM access timing and frees
the second CIA on Amigas.
b) support for DraCo rev. >= 4 native timer chips.
 1.17  20-Jun-1996  is Use the right microsecond delay address. To achieve this, also map that
piece of hardware into kernel virtual memory (was only a guess 'til now).
XXX Unfortunately, the hardware vendor reserves the right to change this in
future DraCo revisions. We must rethink delay() and DELAY(), at least for the
DraCo, soon.
 1.16  18-Jun-1996  is Don't use the inline assembler 64bit integer division if our kernel might
run on 68060. Some graphics boards need delay() in early initialization (that
is, before initcpu() was called.
 1.15  10-May-1996  is branches: 1.15.4;
Clean up the mess I left over from my yestereve's commit: partially unused
variables left over from color background debugging, partially wrong #ifdefs
making some variables unused in non-M68060 kernels.
 1.14  09-May-1996  is First part of M68060 and DraCo support.

* for the M68060 part: store buffer and branch target cache aren't
enabled yet (this needs cleanup of lots of locore.s code which is a
maze of little passages, all a little different) (and it wasn't yet
tested in an accellerated Amiga, only in the DraCo).

I've included a workaround for 2 of the CPU bugs in chips with Masks
1F43G and earlier, but didn't bother to deal with the can of worms
in the [0-3]D11W chips. Be sure to get "68060 rev. 1" or more
reported at kernel startup time, or at least mention it (or the mask
revision, if available) when reporting problems.

* for the DraCo: only machines with a CIA timer.

I assigned machine id 32000+nn (0x7Dnn), where n is the machine
readable Quicklogic custom chip revision (also printed at boot
time). "Guaranteed to work" up to rev. 3, newer DraCo's aren't
guaranteed to have any CIA (we don't have a driver for the new timer
yet).

Supported are:

- MF-II keyboards on the native interface and A3000 keyboards via
the CIA.
- builtin SCSI interface (yet another instance of siop)
- CIA timer.
- Zorro II devices which don't do DMA (don't get mapped to Zorro II
address space in the DraCo)
- "local bus" devices which are autoconfigured by the boot rom
(should be all); only an Altais driver is there (looks like a Retina Z3)

Not yet supported are:

- native timer of newer machines.
- Real Time Clock.
- serial, parallel + floppy on the SuperIO chip (that is also: no mouse)

XXX You need an enhanced boot loader, which will committed in a few days.

XXX std.draco should and will go away.
 1.13  21-Apr-1996  veego - Cleanup for -Wall and -Wstrict-prototypes
- Added support for multiple floppy drives
- CyberVision64:
- has now a real console mode
- another bugfix for boards with the new S3 chip
- Ariadne:
- fixed crashes with aeput (mbuf failure)
 1.12  17-Mar-1996  mhitch Clean up typos and other errors from new device attachment changes.
 1.11  17-Mar-1996  thorpej New device attachment scheme:

- split softc size and match/attach out from cfdriver into
a new struct cfattach.

- new "attach" directive for files.*. May specify the name of
the cfattach structure, so that devices may be easily attached
to parents with different autoconfiguration semantics.
 1.10  20-Feb-1995  chopps rtc now reads and writes erbe0011@FH-Karlsruhe.DE (Bernd Ernesti)
 1.9  12-Feb-1995  chopps Many changes from osymh@gemini.oscs.montana.edu (Michael L. Hitch)
Now use amiga HW for soft interrupts, non-contig options (2 or many chunks),
interrupt handler lists, 4066 ethernet, 1291 scsi, option to defer level 6
interrupts to level 4 (deal with icky built-in serial port)
 1.8  28-Dec-1994  chopps consolidate the zbusses. le support for multiple tx buffs and full use of 32k
RAM. AGA dbl PAL mode added for console. Many changes to siop--most not
yet done. All from osymh@gemini.oscs.montana.edu (Michael L. Hitch)
 1.7  01-Dec-1994  chopps bring up to current. change sun to sunos. handle changes in device
open params and autoconf match function params.
 1.6  26-Oct-1994  cgd new RCS ID format.
 1.5  16-Jun-1994  chopps fix boot diag output.
 1.4  15-Jun-1994  chopps clock now uses passed in frequency if present protect dma cache
flush calls from non 040. don't compile ite_xx if not used.
 1.3  13-Jun-1994  chopps some cleanup and various fixes for new fs code. plus some general
fixes from from osymh@gemini.oscs.montana.edu (Michael L. Hitch)
 1.2  09-May-1994  chopps update for recent sig changes and fix clock.c and ite.c
 1.1  08-May-1994  chopps resistance is futile, you will be assimilated.
amiga goes: config.new *and* /sys/scsi.
clock code coerced into a single .c file adding an accurate usec delay().
disklabel.c updated to DTRT, code to write RDB's to be added soon.
sbic (old scsi) converted over to new scsi and config this covers about
90% of users. Other drivers soon.
 1.15.4.2  21-Jun-1996  jtc Pulled up from version 1.17 by request from ignatios.

"use correct rather than guessed microsecond delay address in
delay() and DELAY() on the DraCo".,
 1.15.4.1  18-Jun-1996  is From trunk, to avoid kernel panics during initialization:
Don't use inline assembler 64bit division if we might run on 68060.
Some graphics drivers need deley during early console initialization (that
is, before initcpu() has installed the emulation software).
 1.30.2.1  22-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.34.8.2  27-Mar-2001  bouyer Sync with HEAD.
 1.34.8.1  20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.

I updated the amiga SCSI drivers, but completely untested yet (may not even
compile)
 1.35.2.1  09-Apr-2001  nathanw Catch up with -current.
 1.36.8.6  18-Oct-2002  nathanw Catch up to -current.
 1.36.8.5  24-Jun-2002  nathanw Curproc->curlwp renaming.

Change uses of "curproc->l_proc" back to "curproc", which is more like the
original use. Bare uses of "curproc" are now "curlwp".

"curproc" is now #defined in proc.h as ((curlwp) ? (curlwp)->l_proc) : NULL)
so that it is always safe to reference curproc (*de*referencing curproc
is another story, but that's always been true).
 1.36.8.4  20-Jun-2002  nathanw Catch up to -current.
 1.36.8.3  28-Feb-2002  nathanw Catch up to -current.
 1.36.8.2  17-Nov-2001  scw curproc now points to a struct lwp.
 1.36.8.1  15-Mar-2001  scw file clock.c was added on branch nathanw_sa on 2001-11-17 23:08:32 +0000
 1.36.2.3  10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.36.2.2  23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.36.2.1  11-Feb-2002  jdolecek Sync w/ -current.
 1.41.6.4  10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.41.6.3  21-Sep-2004  skrll Fix the sync with head I botched.
 1.41.6.2  18-Sep-2004  skrll Sync with HEAD.
 1.41.6.1  03-Aug-2004  skrll Sync with HEAD
 1.43.2.3  21-Jan-2008  yamt sync with head
 1.43.2.2  03-Sep-2007  yamt sync with head.
 1.43.2.1  30-Dec-2006  yamt sync with head.
 1.44.8.1  14-Sep-2006  yamt sync with head.
 1.44.4.1  09-Sep-2006  rpaulo sync with head
 1.45.8.1  12-Mar-2007  rmind Sync with HEAD.
 1.46.32.1  08-Jan-2008  bouyer Sync with HEAD
 1.46.26.1  18-Feb-2008  mjf Sync with HEAD.
 1.46.20.1  09-Jan-2008  matt sync with HEAD
 1.47.20.4  16-Jul-2010  riz Pull up following revision(s) (requested by phx in ticket #1412):
sys/arch/amiga/dev/clock.c: revision 1.51
sys/arch/amiga/amiga/locore.s: revision 1.149 via patch
sys/arch/amiga/dev/kbd.c: revision 1.53
sys/arch/amiga/amiga/amiga_init.c: revision 1.118
Reverted the CIA-timer based delay() to the pre-5.0 method of a calibrated
delay loop.
This fixes keyboard handshaking problems with some A1200 models since 5.0
and restores the precision for short delays on DraCo systems (the QuickLogic
timer has only a seventh of the CIA precision).
Changed the keyboard handshaking delay from 2000 back to 200ms, although
even the recommended 85ms were successfully tested on the most problematic
A1200 keyboards.
All those changes were tested on an A3000 and A1200 with 68060/50 CPU, and
previously discussed on the port-amiga ML.
 1.47.20.3  03-Oct-2009  snj Pull up following revision(s) (requested by mhitch in ticket #1049):
sys/arch/amiga/dev/clock.c: revision 1.49
Reverted last change after discussion with the author, Michael L. Hitch:
http://mail-index.netbsd.org/port-amiga/2009/08/14/msg007164.html
We have a full 32-bit counter, so the masking is not needed.
 1.47.20.2  26-Sep-2009  snj Pull up following revision(s) (requested by phx in ticket #1011):
sys/arch/amiga/dev/clock.c: revision 1.50
Handle the situation of a wrapped interval counter, while the hardclock()
interrupt was not yet executed to update the hardclock_ticks variable.
 1.47.20.1  10-Dec-2008  snj branches: 1.47.20.1.4;
Pull up following revision(s) (requested by mhitch in ticket #172):
sys/arch/amiga/dev/clock.c: revision 1.48
Fix timecounters using interval timers: amiga counters are not 32 bits,
so the tc_counter_mask needs to be set based on the interval timer.
Process cpu usage was returning negative or very large values.
 1.47.20.1.4.1  21-Apr-2010  matt sync to netbsd-5
 1.47.18.1  19-Jan-2009  skrll Sync with HEAD.
 1.47.16.1  13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.47.10.3  11-Mar-2010  yamt sync with head
 1.47.10.2  16-Sep-2009  yamt sync with head
 1.47.10.1  04-May-2009  yamt sync with head.
 1.47.6.1  17-Jan-2009  mjf Sync with HEAD.
 1.51.8.1  17-Feb-2011  bouyer Sync with HEAD
 1.51.6.1  06-Jun-2011  jruoho Sync with HEAD.
 1.51.4.2  12-Jun-2011  rmind sync with head
 1.51.4.1  05-Mar-2011  rmind sync with head
 1.52.2.1  23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.53.12.2  03-Dec-2017  jdolecek update from HEAD
 1.53.12.1  20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.53.2.1  30-Oct-2012  yamt sync with head
 1.54.14.1  27-Dec-2015  skrll Sync with HEAD (as of 26th Dec)

RSS XML Feed