aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/ppc/ppc.c
Commit message (Collapse)AuthorAgeFilesLines
* Fix build.Gleb Smirnoff2013-02-211-2/+2
| | | | Notes: svn path=/head/; revision=247094
* Replace splhigh() with critical_enter()/leave() to ensure we write theWarner Losh2013-02-211-13/+30
| | | | | | | | config mode unlock sequence quickly enough. This likely isn't too critical, since splhigh() has been a noop for a decade... Notes: svn path=/head/; revision=247066
* Rename device_delete_all_children() into device_delete_children().Hans Petter Selasky2011-11-221-1/+1
| | | | | | | | Suggested by: jhb @ and marius @ MFC after: 1 week Notes: svn path=/head/; revision=227849
* Move the device_delete_all_children() function from usb_util.cHans Petter Selasky2011-11-191-8/+1
| | | | | | | | | | | to kern/subr_bus.c. Simplify this function so that it no longer depends on malloc() to execute. Identify a few other places where it makes sense to use device_delete_all_children(). MFC after: 1 week Notes: svn path=/head/; revision=227701
* reset_epp and ecp_sync both return int.Warner Losh2009-02-051-7/+7
| | | | Notes: svn path=/head/; revision=188173
* Add locking to ppc and ppbus and mark the whole lot MPSAFE:John Baldwin2009-01-211-64/+58
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - 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 :-( Notes: svn path=/head/; revision=187576
* Various whitespace and style fixes.John Baldwin2008-11-161-61/+61
| | | | Notes: svn path=/head/; revision=185003
* Fix build with PPC_PROBE_CHIPSET enabled.John Baldwin2008-10-221-10/+13
| | | | Notes: svn path=/head/; revision=184176
* Several cleanups to remove the need for explicit unit numbers and a fewJohn Baldwin2008-10-211-24/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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@ Notes: svn path=/head/; revision=184130
* Rework the handling of interrupt handlers for children of ppc and ppbus:John Baldwin2008-09-151-57/+101
| | | | | | | | | | | | | | | | | | | | - 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. Notes: svn path=/head/; revision=183053
* Use bus_foo() rather than bus_space_foo() and remove bus handle and tagJohn Baldwin2008-08-221-11/+8
| | | | | | | from softc. Notes: svn path=/head/; revision=182016
* Don't call bus_deactivate_resource() explicitly before callingYoshihiro Takahashi2007-03-211-8/+0
| | | | | | | | bus_release_resource(). This is needed for pc98 by upcoming nexus related change. Notes: svn path=/head/; revision=167753
* o Wrap ppc_setup_intr() at 80.Paolo Pisati2007-03-061-3/+6
| | | | | | | o Fix a bit the indentation. Notes: svn path=/head/; revision=167264
* Whitespace fix.John Baldwin2007-02-231-1/+1
| | | | Notes: svn path=/head/; revision=166933
* Use 'pause' in several places rather than trying to tsleep() on NULL (whichJohn Baldwin2007-02-231-2/+1
| | | | | | | | | triggers a KASSERT) or local variables. In the case of kern_ndis, the tsleep() actually used a common sleep address (curproc) making it susceptible to a premature wakeup. Notes: svn path=/head/; revision=166909
* o break newbus api: add a new argument of type driver_filter_t toPaolo Pisati2007-02-231-4/+4
| | | | | | | | | | | | | | | | 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@ Notes: svn path=/head/; revision=166901
* Remove various bits of conditional Alpha code and fixup a few comments.John Baldwin2006-05-121-9/+0
| | | | Notes: svn path=/head/; revision=158471
* o Move ISA specific code from ppc.c to ppc_isa.c -- a bus front-Marcel Moolenaar2006-04-241-236/+66
| | | | | | | | | | | | | | | | | end for isa(4). o Add a seperate bus frontend for acpi(4) and allow ISA DMA for it when ISA is configured in the kernel. This allows acpi(4) attachments in non-ISA configurations, as is possible for ia64. o Add a seperate bus frontend for pci(4) and detect known single port parallel cards. o Merge PC98 specific changes under pc98/cbus into the MI driver. The changes are minor enough for conditional compilation and in this form invites better abstraction. o Have ppc(4) usabled on all platforms, now that ISA specifics are untangled enough. Notes: svn path=/head/; revision=158005
* Import ACPI Dock Station support. Note that this is still very young.Mitsuru IWASAKI2006-04-151-0/+42
| | | | | | | | | | | Additional detach implementaions (or maybe improvement) for other deivce drivers is required. Reviewed by: njl, imp MFC after: 1 week Notes: svn path=/head/; revision=157774
* G/C unused variable.John Baldwin2006-02-221-1/+0
| | | | Notes: svn path=/head/; revision=155927
* - Use bus_setup_intr() and bus_teardown_intr() to register device driverJohn Baldwin2006-02-221-2/+2
| | | | | | | | | | | | | interrupt handlers rather than BUS_SETUP_INTR() and BUS_TEARDOWN_INTR(). Uses of the BUS_*() versions in the implementation of foo_intr methods in bus drivers were not changed. Mostly this just means that some drivers might start printing diagnostic messages like [FAST] when appropriate as well as honoring mpsafenet=0. - Fix two more of the ppbus drivers' identify routines to function correctly in the mythical case of a machine with more than one ppbus. Notes: svn path=/head/; revision=155921
* Add missing MODULE_DEPEND() so that ppbus.ko and these .ko's can beRuslan Ermilov2005-12-211-0/+1
| | | | | | | loaded dynamically. Notes: svn path=/head/; revision=153610
* Fix -Wundef.Ruslan Ermilov2005-12-041-1/+1
| | | | Notes: svn path=/head/; revision=153072
* don't use C keyword register as CPP macro argument nameWarner Losh2005-04-121-2/+2
| | | | Notes: svn path=/head/; revision=144973
* Add missing <sys/module.h> includesPoul-Henning Kamp2004-05-301-0/+1
| | | | Notes: svn path=/head/; revision=129879
* Convert callers to the new bus_alloc_resource_any(9) API.Nate Lawson2004-03-171-4/+6
| | | | | | | | Submitted by: Mark Santcroos <marks@ripe.net> Reviewed by: imp, dfr, bde Notes: svn path=/head/; revision=127135
* Add printer support to puc(4) driver.Doug Ambrisko2003-08-011-42/+35
| | | | | | | | | | | | | | - Move isa/ppc* to sys/dev/ppc (repo-copy) - Add an attachment method to ppc for puc - In puc we need to walk the chain of parents. Still to do, is to make ppc(4) & puc(4) work on other platforms. Testers wanted. PR: 38372 (in spirit done differently) Verified by: Make universe (if I messed up a platform please fix) Notes: svn path=/head/; revision=118292
* Use __FBSDID().David E. O'Brien2003-06-111-3/+3
| | | | Notes: svn path=/head/; revision=116181
* Remove break after return;Poul-Henning Kamp2003-05-311-7/+0
| | | | | | | Found by: FlexeLint Notes: svn path=/head/; revision=115545
* Fix some easy, global, lint warnings. In most cases, this meansMark Murray2003-04-301-1/+1
| | | | | | | | making some local variables static. In a couple of cases, this means removing an unused variable. Notes: svn path=/head/; revision=114293
* More low-hanging fruit: kill caddr_t in calls to wakeup(9) / [mt]sleep(9).Dag-Erling Smørgrav2003-03-021-3/+3
| | | | Notes: svn path=/head/; revision=111748
* Restore the original copyrightNicolas Souchu2002-03-231-0/+1
| | | | Notes: svn path=/head/; revision=93021
* Update to C99, s/__FUNCTION__/__func__/,David E. O'Brien2001-12-101-11/+11
| | | | | | | also don't use ANSI string concatenation. Notes: svn path=/head/; revision=87599
* Add ACPI attachments.Mike Smith2001-08-301-0/+1
| | | | Notes: svn path=/head/; revision=82555
* Convert inb/outb to bus_space.Nicolas Souchu2001-06-231-8/+12
| | | | | | | Submitted by: jcm@FreeBSD-uk.eu.org Notes: svn path=/head/; revision=78646
* Consider that the chipset may be in ECP mode (from BIOS settings)Nicolas Souchu2001-01-251-35/+35
| | | | | | | | | | even if mode PS/2 is forced with bootflags. As a matter of fact, chipsets needs some extra configuration for accessing PS/2 mode from ECP. The current patch is only relevant for generic chipsets since specific code is supposed to deal with this during detection. Notes: svn path=/head/; revision=71622
* Fix the PR. Getting a dma channel equal to 0 remains a problem though.Nicolas Souchu2000-12-191-1/+1
| | | | | | | PR: i386/22568 Notes: svn path=/head/; revision=70201
* Add support for the PC87303 chipset (found on Miata alphas) and addDoug Rabson2000-07-201-6/+46
| | | | | | | | | | support for relocating the port address if the isa hints specify a different address from the address the chipset currently has. Submitted by: Andrew M. Miklic <miklic@ibm.net> Notes: svn path=/head/; revision=63624
* Add smc37c935 chipset support and clean up the code which tries toDoug Rabson2000-07-181-30/+110
| | | | | | | | | | allocate a short port range in some alpha configurations. Submitted by: "Andrew M. Miklic" <miklic@udlkern.fc.hp.com>, Mark Abene <phiber@radicalmedia.com> Notes: svn path=/head/; revision=63403
* Only print the diagnostic about extended I/O ports if bootverbose is true.Doug Rabson2000-06-251-2/+4
| | | | Notes: svn path=/head/; revision=62061
* Port ppc driver to alpha.Doug Rabson2000-05-141-1/+25
| | | | | | | Submitted by: Andrew M. Miklic <miklic@ibm.net> Notes: svn path=/head/; revision=60544
* Enable PnP attachment for parallel port controllers.Garrett Wollman2000-04-221-6/+11
| | | | | | | PR: 17495 Notes: svn path=/head/; revision=59491
* Remove #include "ppc.h" and #if NPPC > 0 - this is always true as it isPeter Wemm2000-01-291-4/+0
| | | | | | | 'optional ppc' in conf/files* Notes: svn path=/head/; revision=56818
* * Don't use ivars to access resources, bus_set/get_resource is much better.Doug Rabson2000-01-251-10/+26
| | | | | | | * First approximation of making this work on alpha (not working yet). Notes: svn path=/head/; revision=56617
* Don't do device_set_desc() until after checking for PnP probes. OtherwisePeter Wemm2000-01-141-3/+4
| | | | | | | | | | | things like sound cards can get called "Parallel port". A note to the unwary; the isa-pnp devices in the system are probed like PCI - each device ID is passed to *all* isa probe routines to find the best match. If the driver is not prepared to deal with this, it must abort in this scenario or it will try and claim all PnP devices. Notes: svn path=/head/; revision=55948
* Port of ppbus standalone framework to the newbus system.Nicolas Souchu2000-01-141-308/+506
| | | | | | | | | | | | | | | | | | | | | | | | 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). Notes: svn path=/head/; revision=55939
* $Id$ -> $FreeBSD$Peter Wemm1999-08-281-1/+1
| | | | Notes: svn path=/head/; revision=50477
* Return the port size from the probe.Peter Wemm1999-04-221-2/+3
| | | | | | | | "ppc0 at port 0x378 irq 7 drq 3 on isa0" becomes "ppc0 at port 0x378-0x37f irq 7 drq 3 on isa0" Notes: svn path=/head/; revision=45935
* More appropriate fix to the id_irq read during probeNicolas Souchu1999-02-141-3/+3
| | | | Notes: svn path=/head/; revision=44023
* The way the interrupt id was calculated was wrong and the lptNicolas Souchu1999-02-141-2/+2
| | | | | | | | | | driver was thinking irq was enabled although it wasn't. This case was particular to a no-interrupt static configuration. Reported by: "Norman C. Rice" <nrice@emu.sourcee.com> Notes: svn path=/head/; revision=44001