History log of /freebsd-11-stable/sys/dev/ppbus/pps.c
Revision Date Author Comments
(<<< Hide modified files)
(Show modified files >>>)
# 302408 07-Jul-2016 gjb

Copy head@r302406 to stable/11 as part of the 11.0-RELEASE cycle.
Prune svn:mergeinfo from the new branch, as nothing has been merged
here.

Additional commits post-branch will follow.

Approved by: re (implicit)
Sponsored by: The FreeBSD Foundation


/freebsd-11-stable/MAINTAINERS
/freebsd-11-stable/cddl
/freebsd-11-stable/cddl/contrib/opensolaris
/freebsd-11-stable/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/print
/freebsd-11-stable/cddl/contrib/opensolaris/cmd/zfs
/freebsd-11-stable/cddl/contrib/opensolaris/lib/libzfs
/freebsd-11-stable/contrib/amd
/freebsd-11-stable/contrib/apr
/freebsd-11-stable/contrib/apr-util
/freebsd-11-stable/contrib/atf
/freebsd-11-stable/contrib/binutils
/freebsd-11-stable/contrib/bmake
/freebsd-11-stable/contrib/byacc
/freebsd-11-stable/contrib/bzip2
/freebsd-11-stable/contrib/com_err
/freebsd-11-stable/contrib/compiler-rt
/freebsd-11-stable/contrib/dialog
/freebsd-11-stable/contrib/dma
/freebsd-11-stable/contrib/dtc
/freebsd-11-stable/contrib/ee
/freebsd-11-stable/contrib/elftoolchain
/freebsd-11-stable/contrib/elftoolchain/ar
/freebsd-11-stable/contrib/elftoolchain/brandelf
/freebsd-11-stable/contrib/elftoolchain/elfdump
/freebsd-11-stable/contrib/expat
/freebsd-11-stable/contrib/file
/freebsd-11-stable/contrib/gcc
/freebsd-11-stable/contrib/gcclibs/libgomp
/freebsd-11-stable/contrib/gdb
/freebsd-11-stable/contrib/gdtoa
/freebsd-11-stable/contrib/groff
/freebsd-11-stable/contrib/ipfilter
/freebsd-11-stable/contrib/ldns
/freebsd-11-stable/contrib/ldns-host
/freebsd-11-stable/contrib/less
/freebsd-11-stable/contrib/libarchive
/freebsd-11-stable/contrib/libarchive/cpio
/freebsd-11-stable/contrib/libarchive/libarchive
/freebsd-11-stable/contrib/libarchive/libarchive_fe
/freebsd-11-stable/contrib/libarchive/tar
/freebsd-11-stable/contrib/libc++
/freebsd-11-stable/contrib/libc-vis
/freebsd-11-stable/contrib/libcxxrt
/freebsd-11-stable/contrib/libexecinfo
/freebsd-11-stable/contrib/libpcap
/freebsd-11-stable/contrib/libstdc++
/freebsd-11-stable/contrib/libucl
/freebsd-11-stable/contrib/libxo
/freebsd-11-stable/contrib/llvm
/freebsd-11-stable/contrib/llvm/projects/libunwind
/freebsd-11-stable/contrib/llvm/tools/clang
/freebsd-11-stable/contrib/llvm/tools/lldb
/freebsd-11-stable/contrib/llvm/tools/llvm-dwarfdump
/freebsd-11-stable/contrib/llvm/tools/llvm-lto
/freebsd-11-stable/contrib/mdocml
/freebsd-11-stable/contrib/mtree
/freebsd-11-stable/contrib/ncurses
/freebsd-11-stable/contrib/netcat
/freebsd-11-stable/contrib/ntp
/freebsd-11-stable/contrib/nvi
/freebsd-11-stable/contrib/one-true-awk
/freebsd-11-stable/contrib/openbsm
/freebsd-11-stable/contrib/openpam
/freebsd-11-stable/contrib/openresolv
/freebsd-11-stable/contrib/pf
/freebsd-11-stable/contrib/sendmail
/freebsd-11-stable/contrib/serf
/freebsd-11-stable/contrib/sqlite3
/freebsd-11-stable/contrib/subversion
/freebsd-11-stable/contrib/tcpdump
/freebsd-11-stable/contrib/tcsh
/freebsd-11-stable/contrib/tnftp
/freebsd-11-stable/contrib/top
/freebsd-11-stable/contrib/top/install-sh
/freebsd-11-stable/contrib/tzcode/stdtime
/freebsd-11-stable/contrib/tzcode/zic
/freebsd-11-stable/contrib/tzdata
/freebsd-11-stable/contrib/unbound
/freebsd-11-stable/contrib/vis
/freebsd-11-stable/contrib/wpa
/freebsd-11-stable/contrib/xz
/freebsd-11-stable/crypto/heimdal
/freebsd-11-stable/crypto/openssh
/freebsd-11-stable/crypto/openssl
/freebsd-11-stable/gnu/lib
/freebsd-11-stable/gnu/usr.bin/binutils
/freebsd-11-stable/gnu/usr.bin/cc/cc_tools
/freebsd-11-stable/gnu/usr.bin/gdb
/freebsd-11-stable/lib/libc/locale/ascii.c
/freebsd-11-stable/sys/cddl/contrib/opensolaris
/freebsd-11-stable/sys/contrib/dev/acpica
/freebsd-11-stable/sys/contrib/ipfilter
/freebsd-11-stable/sys/contrib/libfdt
/freebsd-11-stable/sys/contrib/octeon-sdk
/freebsd-11-stable/sys/contrib/x86emu
/freebsd-11-stable/sys/contrib/xz-embedded
/freebsd-11-stable/usr.sbin/bhyve/atkbdc.h
/freebsd-11-stable/usr.sbin/bhyve/bhyvegc.c
/freebsd-11-stable/usr.sbin/bhyve/bhyvegc.h
/freebsd-11-stable/usr.sbin/bhyve/console.c
/freebsd-11-stable/usr.sbin/bhyve/console.h
/freebsd-11-stable/usr.sbin/bhyve/pci_fbuf.c
/freebsd-11-stable/usr.sbin/bhyve/pci_xhci.c
/freebsd-11-stable/usr.sbin/bhyve/pci_xhci.h
/freebsd-11-stable/usr.sbin/bhyve/ps2kbd.c
/freebsd-11-stable/usr.sbin/bhyve/ps2kbd.h
/freebsd-11-stable/usr.sbin/bhyve/ps2mouse.c
/freebsd-11-stable/usr.sbin/bhyve/ps2mouse.h
/freebsd-11-stable/usr.sbin/bhyve/rfb.c
/freebsd-11-stable/usr.sbin/bhyve/rfb.h
/freebsd-11-stable/usr.sbin/bhyve/sockstream.c
/freebsd-11-stable/usr.sbin/bhyve/sockstream.h
/freebsd-11-stable/usr.sbin/bhyve/usb_emul.c
/freebsd-11-stable/usr.sbin/bhyve/usb_emul.h
/freebsd-11-stable/usr.sbin/bhyve/usb_mouse.c
/freebsd-11-stable/usr.sbin/bhyve/vga.c
/freebsd-11-stable/usr.sbin/bhyve/vga.h
# 187576 21-Jan-2009 jhb

Add locking to ppc and ppbus and mark the whole lot MPSAFE:
- To avoid having a bunch of locks that end up always getting acquired as
a group, give each ppc(4) device a mutex which it shares with all the
child devices including ppbus(4), lpt(4), plip(4), etc. This mutex
is then used for all the locking.
- Rework the interrupt handling stuff yet again. Now ppbus drivers setup
their interrupt handler during attach and tear it down during detach
like most other drivers. ppbus(4) only invokes the interrupt handler
of the device that currently owns the bus (if any) when an interrupt
occurs, however. Also, interrupt handlers in general now accept their
softc pointers as their argument rather than the device_t. Another
feature of the ppbus interrupt handlers is that they are called with
the parent ppc device's lock already held. This minimizes the number
of lock operations during an interrupt.
- Mark plip(4), lpt(4), pcfclock(4), ppi(4), vpo(4) MPSAFE.
- lpbb(4) uses the ppc lock instead of Giant.
- Other plip(4) changes:
- Add a mutex to protect the global tables in plip(4) and free them on
module unload.
- Add a detach routine.
- Split out the init/stop code from the ioctl routine into separate
functions.
- Other lpt(4) changes:
- Use device_printf().
- Use a dedicated callout for the lptout timer.
- Allocate the I/O buffers at attach and detach rather than during
open and close as this simplifies the locking at the cost of
1024+32 bytes when the driver is attached.
- Other ppi(4) changes:
- Use an sx lock to serialize open and close.
- Remove unused HADBUS flag.
- Add a detach routine.
- Use a malloc'd buffer for each read and write to avoid races with
concurrent read/write.
- Other pps(4) changes:
- Use a callout rather than a callout handle with timeout().
- Conform to the new ppbus requirements (regular mutex, non-filter
interrupt handler). pps(4) is probably going to have to become a
standalone driver that doesn't use ppbus(4) to satisfy it's
requirements for low latency as a result.
- Use an sx lock to serialize open and close.
- Other vpo(4) changes:
- Use the parent ppc device's lock to create the CAM sim instead of
Giant.
- Other ppc(4) changes:
- Fix ppc_isa's detach method to detach instead of calling attach.

Tested by: no one :-(


# 185003 16-Nov-2008 jhb

Various whitespace and style fixes.


# 184130 21-Oct-2008 jhb

Several cleanups to remove the need for explicit unit numbers and a few
other fixes:
- Add pointers back to device_t objects in softc structures instead
of storing the unit and using devclass_get_device().
- Add 'lpbb', 'pcf', 'pps', and 'vpo' child devices to every 'ppbus' device
instead of just the first one.
- Store softc pointers in si_drv1 of character devices instead of
pulling the unit number from the minor number and using
devclass_get_softc() and devclass_get_device().
- Store the LP_BYPASS flag in si_drv2 instead of encoding it in the minor
number.
- Destroy character devices for lpt(4) when detaching the device.
- Use bus_print_child_footer() instead of duplicating it in
ppbus_print_child() and fix ppbus_print_child()'s return value.
- Remove unused AVM ivar from ppbus.
- Don't store the 'mode' ivar in the ppbus ivars since we always fetch it
from the parent anyway.
- Try to detach all the child devices before deleting them in
ppbus_detach().
- Use pause() instead of a tsleep() on a dummy address when polling the
ppbus.
- Use if_printf() and device_printf() instead of explicit names with unit
numbers.

Silence on: current@


# 183053 15-Sep-2008 jhb

Rework the handling of interrupt handlers for children of ppc and ppbus:
- Retire IVARs for passing IRQs around. Instead, ppbus and ppc now allow
child devices to access the interrupt by via a rid 0 IRQ resource
using bus_alloc_resource_any().
- ppc creates its own interrupt event to manage the interrupt handlers of
child devices. ppc does not allow child devices to use filters. It
could allow this if needed, but none of the current drivers use them
and it adds a good bit of complication. It uses
intr_event_execute_handlers() to fire the child device interrupt handlers
from its threaded interrupt handler.
- Remove the ppbus_dummy_intr() hack. Now the ppc device always has an
interrupt handler registered and we no longer bounce all the way up to
nexus to manage adding/removing ppbus child interrupt handlers. Instead,
the child handlers are added and removed to the private interrupt event
in the ppc device.


# 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@


# 153610 21-Dec-2005 ru

Add missing MODULE_DEPEND() so that ppbus.ko and these .ko's can be
loaded dynamically.


# 145075 14-Apr-2005 imp

In ppsintr, we needed ppsdev to get to the softc and nothing else.
Save a memory dereference in the ISR by passing this in directly.
Calling pps_capture is MP safe for all other operations on struct
pps_state, so there's no need to aquire the lock before we do this,
even from a fast ISR. Avoid dereferencing sc->ppbus until after
pps_capture is called as well. These actions reduce somewhat the
cache effects that cause variance in interrupt times. On an
especially slow test machine (300MHz Cyrix GXm), this reduces the
interrupt latency about about 10% (from 21us to 19us) and helps a
little with the variance (although most of the variance seems to be
caused by lots of interrupt masking).

This also happens fixes one or two of bde's style issues.


# 143766 17-Mar-2005 imp

When locking a MTX_SPIN, one needs to use mtx_lock_spin.
Lock the timeout routine as well.

Submitted by: bde


# 143398 11-Mar-2005 imp

Make the pps interrupt register as MPSAFE and FAST. Use a spin lock
to syncrhonize access to the data as a result. This makes the pps
less likely to miss the 1ms pulse that I'm feeding it, but not
entirely reliable yet on my 133MHz P5.

Reviewed by: phk


# 143390 10-Mar-2005 imp

Kill trailing white space


# 143169 06-Mar-2005 imp

Back out previous commit. The description didn't match the commit,
and marking this interrupt as fast isn't quite right. It also needs
to be MP Safe, and I've not done that work (yet).


# 143158 05-Mar-2005 imp

Use BUS_PROBE_DEFAULT for pci probe return value


# 139749 05-Jan-2005 imp

Start each of the license/copyright comments with /*-, minor shuffle of lines


# 131874 09-Jul-2004 cognet

Newbus returns a zeroed softc, so there's no need to call bzero() here.


# 130585 16-Jun-2004 phk

Do the dreaded s/dev_t/struct cdev */
Bump __FreeBSD_version accordingly.


# 127189 18-Mar-2004 guido

Prevent the strange situation that after each load/unload of a ppbus
device, the device is probed multiple times (so each device is
detected N times after unloading/loading the module N-1 times).

The real fix is (quote Doug and Warner):
> : In an ideal world, there should be some kind of BUS_UNIDENTIFY method
> : which a driver could use to delete the devices it created in
> : BUS_IDENTIFY.
>
> Or the bus would have a driver deleted routine that got called and it
> would remove all instances of the devclass attached to it.

Reviewed by: Doug Rabson & Warner Losh


# 126080 21-Feb-2004 phk

Device megapatch 4/6:

Introduce d_version field in struct cdevsw, this must always be
initialized to D_VERSION.

Flip sense of D_NOGIANT flag to D_NEEDGIANT, this involves removing
four D_NOGIANT flags and adding 145 D_NEEDGIANT flags.


# 126076 21-Feb-2004 phk

Device megapatch 1/6:

Free approx 86 major numbers with a mostly automatically generated patch.

A number of strategic drivers have been left behind by caution, and a few
because they still (ab)use their major number.


# 119418 24-Aug-2003 obrien

Use __FBSDID().
Also some minor style cleanups.


# 111815 03-Mar-2003 phk

Gigacommit to improve device-driver source compatibility between
branches:

Initialize struct cdevsw using C99 sparse initializtion and remove
all initializations to default values.

This patch is automatically generated and has been tested by compiling
LINT with all the fields in struct cdevsw in reverse order on alpha,
sparc64 and i386.

Approved by: re(scottl)


# 108322 27-Dec-2002 rwatson

Synchronize mode for ppsX devices to that found previously in MAKEDEV
for consistency.

Submitted by: kris


# 106563 07-Nov-2002 jhb

Warning fixes for sizeof(int) != sizeof(void *).


# 97228 24-May-2002 peter

Fix warnings due to macro varargs.


# 95523 26-Apr-2002 phk

Simplify the RFC2783 and PPS_SYNC timestamp collection API.


# 94154 07-Apr-2002 ticso

This makes ppbus childs like lpt and ppi succesfully connect to more
than just the first ppbus.
The child drivers always tried to attach unit 0.

Reviewed by: gallatin
Approved by: gallatin


# 88220 19-Dec-2001 imp

Make this driver a better citizen by moving dev creation and
other initialization into attach from probe. Also hide a few
printfs behind a bootverbose.

approved in principle by: phk


# 83818 22-Sep-2001 phk

Give the pps driver an additional 8 inputs if we can persuade the
ppc to go into EPP mode. These 8 inputs are timestamped in polled
loop so their resolution will be nanoseconds but their granularity
will only be 1/hz.


# 83366 12-Sep-2001 julian

KSE Milestone 2
Note ALL MODULES MUST BE RECOMPILED
make the kernel aware that there are smaller units of scheduling than the
process. (but only allow one thread per process at this time).
This is functionally equivalent to teh previousl -current except
that there is a thread associated with each process.

Sorry john! (your next MFC will be a doosie!)

Reviewed by: peter@freebsd.org, dillon@freebsd.org

X-MFC after: ha ha ha ha


# 74810 26-Mar-2001 phk

Send the remains (such as I have located) of "block major numbers" to
the bit-bucket.


# 61490 10-Jun-2000 peter

Unused include: #include "pps.h"


# 59391 19-Apr-2000 phk

Remove ~25 unneeded #include <sys/conf.h>
Remove ~60 unneeded #include <sys/malloc.h>


# 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!)


# 56455 23-Jan-2000 peter

Some newbus-inspired tidy-ups. Use device_identify() rather than scanning
the resource table to locate children. The 'at ppbus?' can go again.
Remove a few #if Nxxx > 0' type things, config arranges this for us.
Move the newbus method glue next to the DRIVER_MODULE() stuff so we
don't need extra prototypes.
Don't set device descriptions until after the possibility of the probe
returning an error.
Remove all cdevsw_add() calls, all the drivers that did this also use
make_dev() correctly, so it's not required.
A couple of other minor nits.


# 55939 13-Jan-2000 nsouch

Port of ppbus standalone framework to the newbus system.

Note1: the correct interrupt level is invoked correctly for each driver.
For this purpose, drivers request the bus before being able to
call BUS_SETUP_INTR and BUS_TEARDOWN_INTR call is forced by the ppbus
core when drivers release it. Thus, when BUS_SETUP_INTR is called
at ppbus driver level, ppbus checks that the caller owns the
bus and stores the interrupt handler cookie (in order to unregister
it later).

Printing is impossible while plip link is up is still TRUE.
vpo (ZIP driver) and lpt are make in such a way that
using the ZIP and printing concurrently is permitted is also TRUE.

Note2: specific chipset detection is not done by default. PPC_PROBE_CHIPSET
is now needed to force chipset detection. If set, the flags 0x40
still avoid detection at boot.

Port of the pcf(4) driver to the newbus system (was previously directly
connected to the rootbus and attached by a bogus pcf_isa_probe function).


# 51658 25-Sep-1999 phk

Remove five now unused fields from struct cdevsw. They should never
have been there in the first place. A GENERIC kernel shrinks almost 1k.

Add a slightly different safetybelt under nostop for tty drivers.

Add some missing FreeBSD tags


# 50477 27-Aug-1999 peter

$Id$ -> $FreeBSD$


# 49550 08-Aug-1999 phk

Remove compile time limit on number of devices.


# 47640 31-May-1999 phk

Simplify cdevsw registration.

The cdevsw_add() function now finds the major number(s) in the
struct cdevsw passed to it. cdevsw_add_generic() is no longer
needed, cdevsw_add() does the same thing.

cdevsw_add() will print an message if the d_maj field looks bogus.

Remove nblkdev and nchrdev variables. Most places they were used
bogusly. Instead check a dev_t for validity by seeing if devsw()
or bdevsw() returns NULL.

Move bdevsw() and devsw() functions to kern/kern_conf.c

Bump __FreeBSD_version to 400006

This commit removes:
72 bogus makedev() calls
26 bogus SYSINIT functions

if_xe.c bogusly accessed cdevsw[], author/maintainer please fix.

I4b and vinum not changed. Patches emailed to authors. LINT
probably broken until they catch up.


# 47625 30-May-1999 phk

This commit should be a extensive NO-OP:

Reformat and initialize correctly all "struct cdevsw".

Initialize the d_maj and d_bmaj fields.

The d_reset field was not removed, although it is never used.

I used a program to do most of this, so all the files now use the
same consistent format. Please keep it that way.

Vinum and i4b not modified, patches emailed to respective authors.


# 46589 06-May-1999 peter

GC unused pps_drvinit() declaration


# 46053 25-Apr-1999 phk

Allow multiple opens.


# 44723 13-Mar-1999 phk

Reduce Bruce-filter verbosity.


# 44666 11-Mar-1999 phk

Make even more of the PPSAPI implementations generic.

FLL support in hardpps()

Various magic shuffles and improved comments

Style fixes from Bruce.


# 43433 30-Jan-1999 nsouch

Distinguish EPP address/data register. Add EPP address register access to ppi.

Change microseq offsets. Previously, offsets of the program counter where
added to the index of the current microinstruction. Make them rely on the
index of the next executed microinstruction.

Suggested by: Luigi Rizzo <luigi@labinfo.iet.unipi.it>


# 41591 07-Dec-1998 archie

The "easy" fixes for compiling the kernel -Wunused: remove unreferenced static
and local variables, goto labels, and functions declared but not defined.


# 38523 24-Aug-1998 phk

Only claim PPS_HARDPPSONASSERT if we're compiled with PPS_SYNC


# 38061 03-Aug-1998 msmith

Major ppbus updates from the author.

- ppbus now supports PLIP via the if_plip driver
- ieee1284 infrastructure added, including parallel-port PnP
- port microsequencer added, for scripting the sort of port I/O
that is common with parallel devices without endless calls up and down
through the driver structure.
- improved bus ownership behaviour among the ppbus-using drivers.
- improved I/O chipset feature detection

The vpo driver is now implemented using the microsequencer, leading to
some performance improvements as well as providing an extensive example
of its use.

Reviewed by: msmith
Submitted by: Nicolas Souchu <Nicolas.Souchu@prism.uvsq.fr>


# 37101 21-Jun-1998 bde

Removed unused includes.


# 36941 13-Jun-1998 phk

Introduce std_pps_ioctl() to automagically DTRT.

Add scaling capability to timex.offset, ntpd-4.0.73 will support this.


# 36938 12-Jun-1998 phk

Update to draft-mogul-pps-api-02.txt as submitted to IETF


# 36748 08-Jun-1998 bde

Fixed an ioctl which grew overnight.


# 36739 07-Jun-1998 phk

This is a prototype implementation of the draft-mogul-pps-api-##.txt
paper.

It will be updated along with the draft and possible subsequent
standard.

The ppbus based pps driver is updated to implement this API.


# 33442 16-Feb-1998 eivind

Delete apparently unused DEVFS control device creation code - code
didn't even compile. A (now seemingly correct) devfs node is still
created.


# 33396 15-Feb-1998 phk

A bunch of nits from bde.
Make the name "pps" all over the place.
Remove the hardcoded 10us offset, use sawtooth for it.


# 33326 13-Feb-1998 phk

Man, twice in as many days. Gotta learn to check that uname.


# 33323 13-Feb-1998 phk

Add a skelleton pulse-per-second timing driver. This will become more
useful when I get my timecounter changes past the Bruce-filter.