summaryrefslogtreecommitdiffstats
path: root/sys/dev/ppbus/pps.c
Commit message (Collapse)AuthorAgeFilesLines
* Add locking to ppc and ppbus and mark the whole lot MPSAFE:jhb2009-01-211-33/+56
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - 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 :-(
* Various whitespace and style fixes.jhb2008-11-161-4/+4
|
* Several cleanups to remove the need for explicit unit numbers and a fewjhb2008-10-211-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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@
* Rework the handling of interrupt handlers for children of ppc and ppbus:jhb2008-09-151-9/+5
| | | | | | | | | | | | | | | | | - 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.
* o break newbus api: add a new argument of type driver_filter_t topiso2007-02-231-4/+5
| | | | | | | | | | | | | 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@
* Add missing MODULE_DEPEND() so that ppbus.ko and these .ko's can beru2005-12-211-0/+1
| | | | loaded dynamically.
* In ppsintr, we needed ppsdev to get to the softc and nothing else.imp2005-04-141-11/+7
| | | | | | | | | | | | | | | 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.
* When locking a MTX_SPIN, one needs to use mtx_lock_spin.imp2005-03-171-5/+7
| | | | | | Lock the timeout routine as well. Submitted by: bde
* Make the pps interrupt register as MPSAFE and FAST. Use a spin lockimp2005-03-111-6/+15
| | | | | | | | 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
* Kill trailing white spaceimp2005-03-101-3/+3
|
* Back out previous commit. The description didn't match the commit,imp2005-03-061-1/+1
| | | | | 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).
* Use BUS_PROBE_DEFAULT for pci probe return valueimp2005-03-051-1/+1
|
* Start each of the license/copyright comments with /*-, minor shuffle of linesimp2005-01-061-1/+1
|
* Newbus returns a zeroed softc, so there's no need to call bzero() here.cognet2004-07-091-2/+0
|
* Do the dreaded s/dev_t/struct cdev */phk2004-06-161-5/+5
| | | | Bump __FreeBSD_version accordingly.
* Prevent the strange situation that after each load/unload of a ppbusguido2004-03-181-1/+5
| | | | | | | | | | | | | | | 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
* Device megapatch 4/6:phk2004-02-211-0/+2
| | | | | | | | 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.
* Device megapatch 1/6:phk2004-02-211-2/+0
| | | | | | | 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.
* Use __FBSDID().obrien2003-08-241-1/+3
| | | | Also some minor style cleanups.
* Gigacommit to improve device-driver source compatibility betweenphk2003-03-031-13/+5
| | | | | | | | | | | | | 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)
* Synchronize mode for ppsX devices to that found previously in MAKEDEVrwatson2002-12-271-2/+2
| | | | | | for consistency. Submitted by: kris
* Warning fixes for sizeof(int) != sizeof(void *).jhb2002-11-071-6/+6
|
* Fix warnings due to macro varargs.peter2002-05-241-1/+1
|
* Simplify the RFC2783 and PPS_SYNC timestamp collection API.phk2002-04-261-15/+7
|
* This makes ppbus childs like lpt and ppi succesfully connect to moreticso2002-04-071-1/+1
| | | | | | | | than just the first ppbus. The child drivers always tried to attach unit 0. Reviewed by: gallatin Approved by: gallatin
* Make this driver a better citizen by moving dev creation andimp2001-12-191-46/+45
| | | | | | | other initialization into attach from probe. Also hide a few printfs behind a bootverbose. approved in principle by: phk
* Give the pps driver an additional 8 inputs if we can persuade thephk2001-09-221-43/+154
| | | | | | 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.
* KSE Milestone 2julian2001-09-121-3/+3
| | | | | | | | | | | | | | 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
* Send the remains (such as I have located) of "block major numbers" tophk2001-03-261-1/+0
| | | | the bit-bucket.
* Unused include: #include "pps.h"peter2000-06-101-1/+0
|
* Remove ~25 unneeded #include <sys/conf.h>phk2000-04-191-1/+0
| | | | Remove ~60 unneeded #include <sys/malloc.h>
* Isolate the Timecounter internals in their own two files.phk2000-03-201-0/+1
| | | | | | | | | | | | | | | 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!)
* Some newbus-inspired tidy-ups. Use device_identify() rather than scanningpeter2000-01-231-20/+21
| | | | | | | | | | | | 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.
* Port of ppbus standalone framework to the newbus system.nsouch2000-01-141-55/+89
| | | | | | | | | | | | | | | | | | | | | 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).
* Remove five now unused fields from struct cdevsw. They should neverphk1999-09-251-5/+0
| | | | | | | | 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
* $Id$ -> $FreeBSD$peter1999-08-281-1/+1
|
* Remove compile time limit on number of devices.phk1999-08-081-25/+17
|
* Simplify cdevsw registration.phk1999-05-311-4/+5
| | | | | | | | | | | | | | | | | | | | | | | | | 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.
* This commit should be a extensive NO-OP:phk1999-05-301-6/+22
| | | | | | | | | | | | | 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.
* GC unused pps_drvinit() declarationpeter1999-05-061-2/+1
|
* Allow multiple opens.phk1999-04-251-5/+10
|
* Reduce Bruce-filter verbosity.phk1999-03-131-7/+3
|
* Make even more of the PPSAPI implementations generic.phk1999-03-111-53/+22
| | | | | | | | FLL support in hardpps() Various magic shuffles and improved comments Style fixes from Bruce.
* Distinguish EPP address/data register. Add EPP address register access to ppi.nsouch1999-01-301-1/+7
| | | | | | | | 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>
* The "easy" fixes for compiling the kernel -Wunused: remove unreferenced staticarchie1998-12-071-2/+3
| | | | and local variables, goto labels, and functions declared but not defined.
* Only claim PPS_HARDPPSONASSERT if we're compiled with PPS_SYNCphk1998-08-241-1/+5
|
* Major ppbus updates from the author.msmith1998-08-031-1/+2
| | | | | | | | | | | | | | | | | - 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>
* Removed unused includes.bde1998-06-211-2/+1
|
* Introduce std_pps_ioctl() to automagically DTRT.phk1998-06-131-32/+2
| | | | Add scaling capability to timex.offset, ntpd-4.0.73 will support this.
* Update to draft-mogul-pps-api-02.txt as submitted to IETFphk1998-06-121-6/+15
|
OpenPOWER on IntegriCloud