History log of /freebsd-current/sys/powerpc/powerpc/clock.c
Revision Date Author Comments
# fdafd315 24-Nov-2023 Warner Losh <imp@FreeBSD.org>

sys: Automated cleanup of cdefs and other formatting

Apply the following automated changes to try to eliminate
no-longer-needed sys/cdefs.h includes as well as now-empty
blank lines in a row.

Remove /^#if.*\n#endif.*\n#include\s+<sys/cdefs.h>.*\n/
Remove /\n+#include\s+<sys/cdefs.h>.*\n+#if.*\n#endif.*\n+/
Remove /\n+#if.*\n#endif.*\n+/
Remove /^#if.*\n#endif.*\n/
Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/types.h>/
Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/param.h>/
Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/capsicum.h>/

Sponsored by: Netflix


# 685dc743 16-Aug-2023 Warner Losh <imp@FreeBSD.org>

sys: Remove $FreeBSD$: one-line .c pattern

Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/


# 4d846d26 10-May-2023 Warner Losh <imp@FreeBSD.org>

spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSD

The SPDX folks have obsoleted the BSD-2-Clause-FreeBSD identifier. Catch
up to that fact and revert to their recommended match of BSD-2-Clause.

Discussed with: pfg
MFC After: 3 days
Sponsored by: Netflix


# 8701571d 21-Jun-2022 Mitchell Horne <mhorne@FreeBSD.org>

set_cputicker: use a bool

The third argument to this function indicates whether the supplied
ticker is fixed or variable, i.e. requiring calibration. Give this
argument a type and name that better conveys this purpose.

Reviewed by: kib, markj
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D35459


# 328b5f25 07-Sep-2020 Brandon Bergren <bdragon@FreeBSD.org>

[PowerPC] Implement VDSO timebase access on powerpc*

Implement the remaining pieces needed to allow userland timestamp reading.

Rewritten based on an intial essay into the problem by Justin Hibbits.
(Copyright changed to my own on his request.)

Tested on ppc64 (POWER9 Talos II), powerpcspe (e500v2 RB800), and
powerpc (g4 PowerBook).

Reviewed by: jhibbits (in irc)
Sponsored by: Tag1 Consulting, Inc.
Differential Revision: https://reviews.freebsd.org/D26347


# b64b3133 01-Sep-2020 Mateusz Guzik <mjg@FreeBSD.org>

powerpc: clean up empty lines in .c and .h files


# 77eb50c7 12-Apr-2019 Justin Hibbits <jhibbits@FreeBSD.org>

powerpc: Add file forgotten in r346144

Forgot to add the changes for DELAY(), which lowers priority during the
delay period. Also, mark the timebase read as volatile so newer GCC does
not optimize it away, as it reportedly does currently.

MFC after: 2 weeks
MFC with: r346144


# 2bf95012 05-Jul-2018 Andrew Turner <andrew@FreeBSD.org>

Create a new macro for static DPCPU data.

On arm64 (and possible other architectures) we are unable to use static
DPCPU data in kernel modules. This is because the compiler will generate
PC-relative accesses, however the runtime-linker expects to be able to
relocate these.

In preparation to fix this create two macros depending on if the data is
global or static.

Reviewed by: bz, emaste, markj
Sponsored by: ABT Systems Ltd
Differential Revision: https://reviews.freebsd.org/D16140


# f32ebdc8 20-Feb-2018 Wojciech Macek <wma@FreeBSD.org>

PowerPC: Switch to more accurate unit to avoid division rounding

On POWER8 architecture there is a timer with 512Mhz frequency.
It has about 1,95ns period, but it is rounded to 1ns which is not accurate.

Submitted by: Patryk Duda <pdk@semihalf.com>
Obtained from: Semihalf
Reviewed by: wma
Sponsored by: IBM, QCM Technologies
Differential revision: https://reviews.freebsd.org/D14433


# d5d7606c 31-Dec-2017 Colin Percival <cperciva@FreeBSD.org>

Use the TSLOG framework to record entry/exit timestamps for DELAY and
_vprintf; these functions are called in many places and can contribute
meaningfully to the total time spent booting.


# 71e3c308 27-Nov-2017 Pedro F. Giffuni <pfg@FreeBSD.org>

sys/powerpc: further adoption of SPDX licensing ID tags.

Mainly focus on files that use BSD 2-Clause license, however the tool I
was using misidentified many licenses so this was mostly a manual - error
prone - task.

The Software Package Data Exchange (SPDX) group provides a specification
to make it easier for automated tools to detect and summarize well known
opensource licenses. We are gradually adopting the specification, noting
that the tags are considered only advisory and do not, in any way,
superceed or replace the license texts.


# 8a92c52a 25-Nov-2017 Nathan Whitehorn <nwhitehorn@FreeBSD.org>

On AIM systems, it is not actually possible to stop the CPU timer, so we
just set it to a large default value (and inherit any previously existing
value), hoping it never turns over. Instead, silently allow spurious
one-shots from rollovers.

MFC after: 10 days


# 910c0798 26-Apr-2016 Pedro F. Giffuni <pfg@FreeBSD.org>

sys/powerpc: make use of the howmany() macro when available.

We have a howmany() macro in the <sys/param.h> header that is
convenient to re-use as it makes things easier to read.


# 72c775da 20-Oct-2013 Nathan Whitehorn <nwhitehorn@FreeBSD.org>

Fix 80-column line wrapping in a comment.


# 228f09b3 20-Oct-2013 Nathan Whitehorn <nwhitehorn@FreeBSD.org>

Replace the two almost-exactly-identical AIM and Book-E clock.c
implementations with a single one after the application of a very small
amount of #ifdef.


# 15cd8608 14-Dec-2007 Marcel Moolenaar <marcel@FreeBSD.org>

This file was repocopied to src/sys/powerpc/aim, where it will
live on -- an afterlife.


# 20588444 13-Nov-2007 Peter Grehan <grehan@FreeBSD.org>

Split decr_init() into two, with the section that reads the timebase
frequency from OpenFirmware moved out and into a routine that is called
from cpu_startup().

This allows correct reporting of the CPU clockspeed when printing out
CPU information at boot time.

Reported by: numerous
Reviewed by: marcel
MFC after: 1 day


# 82c663b4 27-May-2007 Marcel Moolenaar <marcel@FreeBSD.org>

Don't initialize the decrementer before initclocks() is called.
Use cpu_initclocks() for that as it assures that relevant locks
have been initialized.


# 46acbb75 05-Oct-2006 Peter Grehan <grehan@FreeBSD.org>

Catch up with recent clock modifications:
- include <sys/clock.h> for inittodr prototype
- remove now-conflicting SECDAY definition that is in <sys/clock.h>


# 8e52f546 02-Oct-2006 Poul-Henning Kamp <phk@FreeBSD.org>

remove orphaned sysctl_machdep_adjkerntz()


# b69f71eb 02-Oct-2006 Poul-Henning Kamp <phk@FreeBSD.org>

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.


# 1be75114 26-Jul-2006 Marcel Moolenaar <marcel@FreeBSD.org>

Include needed clock.h.


# c40da00c 16-May-2006 Poul-Henning Kamp <phk@FreeBSD.org>

Since DELAY() was moved, most <machine/clock.h> #includes have been
unnecessary.


# 3a8f1e72 11-May-2006 Poul-Henning Kamp <phk@FreeBSD.org>

Remove straggling reference to CPU_ macros


# b439e431 22-Dec-2005 John Baldwin <jhb@FreeBSD.org>

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)


# 6d2d8aca 03-Feb-2005 Peter Grehan <grehan@FreeBSD.org>

- add wall_cmos_clock and adjkerntz variables, required by msdosfs
- support adjkerntz sysctl to silence NTP, though it's a null
implementation at the moment.


# 60727d8b 06-Jan-2005 Warner Losh <imp@FreeBSD.org>

/* -> /*- for license, minor formatting changes


# 3102ccf3 11-Feb-2004 Peter Grehan <grehan@FreeBSD.org>

- fix compile warnings
- removed obsolete NetBSD-derived ADB conditionals


# 462ded37 20-Jan-2004 Peter Grehan <grehan@FreeBSD.org>

A syscons implementation using the 8-bit framebuffer set up by
OpenFirmware. Not at all optimized, but provides a PC-style
user-experience.

Tested on revA imac, B&W G3, 2k iBook, and G4 eMac.


# 02b63cea 26-Sep-2003 Peter Grehan <grehan@FreeBSD.org>

DELAY must be a routine, not a macro definition.


# 8368cf8f 03-Apr-2003 David E. O'Brien <obrien@FreeBSD.org>

Use __FBSDID rather than rcsid[].


# d8e36186 04-Feb-2003 Benno Rice <benno@FreeBSD.org>

Export the ns_per_tick variable through md_var.h rather than by declaring
it extern in cpu.c.


# 4a95ae9a 05-Feb-2003 Benno Rice <benno@FreeBSD.org>

Replace the inline asm in delay() with a while loop. This may not be as
efficient but it appears to actually work. Some investigation may be
required.


# 8bc7bc1e 05-Feb-2003 Benno Rice <benno@FreeBSD.org>

- Rename the "powerpc" timecounter to the "decrementer" timecounter.
- Initialise it earlier.


# 238dd320 03-Feb-2003 Jake Burkholder <jake@FreeBSD.org>

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


# 18ca6185 07-Jan-2003 Peter Grehan <grehan@FreeBSD.org>

Fetch the initial time from the rtc OpenFirmware node. This is a short-term
measure until the rtc h/w driver is written, and it's a lot better
than having "jan 1 1970" on filesys times.

Approved by: benno


# 6c2a0625 29-Jun-2002 Benno Rice <benno@FreeBSD.org>

Many fixes to low-level trap and interrupt handling:

- Tidy up clock code. Don't repeatedly call hardclock().
- Remove intrnames, decrnest and intrcnt from locore.s
- Coalesce all trap handling into a single stub that then calls a dispatch
function.

Submitted by: Peter Grehan <peterg@ptree32.com.au>


# 2266fe77 30-Apr-2002 Poul-Henning Kamp <phk@FreeBSD.org>

Don't export timecounter structures under debug. with sysctl, they
contain no truly interesting data anymore.


# f6310641 20-Apr-2002 Benno Rice <benno@FreeBSD.org>

Replace inline asm with it's inline function wrapper.


# 812344bc 20-Mar-2002 Alfred Perlstein <alfred@FreeBSD.org>

Remove __P.

Reveiwed by: benno


# 0e133866 27-Feb-2002 Benno Rice <benno@FreeBSD.org>

Various cleanups.


# d163144b 14-Oct-2001 Benno Rice <benno@FreeBSD.org>

- Correct the type of the argument to delay() so as to not conflict with
sys/boot/common/bootstrap.h.
- Add a prototype for fork_trampoline().


# 111c77dc 26-Jun-2001 Benno Rice <benno@FreeBSD.org>

Fix comment breakage.


# f9bac91b 09-Jun-2001 Benno Rice <benno@FreeBSD.org>

Bring in NetBSD code used in the PowerPC port.

Reviewed by: obrien, dfr
Obtained from: NetBSD