Commit Graph

72 Commits

Author SHA1 Message Date
Kai Wang
64fc5491db Added entries for Lava SP-PCI (1 serial + 1 parallel) PCI card. The
card is a multifunction PCI and report itself as two logical devices.
2009-02-11 00:08:03 +00:00
Warner Losh
3fd8527379 reset_epp and ecp_sync both return int. 2009-02-05 19:31:55 +00:00
John Baldwin
2067d312d4 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 :-(
2009-01-21 23:10:06 +00:00
John Baldwin
284c87f60e Various whitespace and style fixes. 2008-11-16 17:42:02 +00:00
John Baldwin
ff80967485 Fix build with PPC_PROBE_CHIPSET enabled. 2008-10-22 19:39:16 +00:00
John Baldwin
ae6b868a2a 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@
2008-10-21 18:30:10 +00:00
John Baldwin
ca3d37955c 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.
2008-09-15 22:26:32 +00:00
Yoshihiro Takahashi
c5fe188c44 Remove unneeded include. 2008-08-29 12:23:51 +00:00
John Baldwin
8fd40d8a9e Use bus_foo() rather than bus_space_foo() and remove bus handle and tag
from softc.
2008-08-22 18:43:19 +00:00
John Baldwin
19ab530d2a Use ppc_detach() for device_detach instead of ppc_attach().
MFC after:	1 week
2008-08-22 18:42:45 +00:00
Yoshihiro Takahashi
41f5bd0f6d Don't call bus_deactivate_resource() explicitly before calling
bus_release_resource().  This is needed for pc98 by upcoming nexus related
change.
2007-03-21 03:38:37 +00:00
Paolo Pisati
72565ac3e8 o Wrap ppc_setup_intr() at 80.
o Fix a bit the indentation.
2007-03-06 11:36:33 +00:00
John Baldwin
4a50bbc03e Whitespace fix. 2007-02-23 23:05:31 +00:00
John Baldwin
a96255b62d Use 'pause' in several places rather than trying to tsleep() on NULL (which
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.
2007-02-23 16:25:08 +00:00
Paolo Pisati
ef544f6312 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@
2007-02-23 12:19:07 +00:00
John Baldwin
73dbd3da73 Remove various bits of conditional Alpha code and fixup a few comments. 2006-05-12 05:04:46 +00:00
Marcel Moolenaar
64220a7e28 Rewrite of puc(4). Significant changes are:
o  Properly use rman(9) to manage resources. This eliminates the
   need to puc-specific hacks to rman. It also allows devinfo(8)
   to be used to find out the specific assignment of resources to
   serial/parallel ports.
o  Compress the PCI device "database" by optimizing for the common
   case and to use a procedural interface to handle the exceptions.
   The procedural interface also generalizes the need to setup the
   hardware (program chipsets, program clock frequencies).
o  Eliminate the need for PUC_FASTINTR. Serdev devices are fast by
   default and non-serdev devices are handled by the bus.
o  Use the serdev I/F to collect interrupt status and to handle
   interrupts across ports in priority order.
o  Sync the PCI device configuration to include devices found in
   NetBSD and not yet merged to FreeBSD.
o  Add support for Quatech 2, 4 and 8 port UARTs.
o  Add support for a couple dozen Timedia serial cards as found
   in Linux.
2006-04-28 21:21:53 +00:00
Marcel Moolenaar
df5fea7cad o Use __FBSDID
o  Whitespace fixes
o  Non-K&R functions
2006-04-26 21:25:13 +00:00
Marcel Moolenaar
cea4d8752f o Move ISA specific code from ppc.c to ppc_isa.c -- a bus front-
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.
2006-04-24 23:31:51 +00:00
Mitsuru IWASAKI
858a52f464 Import ACPI Dock Station support. Note that this is still very young.
Additional detach implementaions (or maybe improvement) for other
deivce drivers is required.

Reviewed by:	njl, imp
MFC after:	1 week
2006-04-15 12:31:34 +00:00
John Baldwin
93d74675d6 G/C unused variable. 2006-02-22 21:47:04 +00:00
John Baldwin
57fb5e6097 - Use bus_setup_intr() and bus_teardown_intr() to register device driver
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.
2006-02-22 18:16:26 +00:00
Ruslan Ermilov
f5fd56117e Add missing MODULE_DEPEND() so that ppbus.ko and these .ko's can be
loaded dynamically.
2005-12-21 10:54:47 +00:00
Ruslan Ermilov
f4e9888107 Fix -Wundef. 2005-12-04 02:12:43 +00:00
Warner Losh
1e4500012d don't use C keyword register as CPP macro argument name 2005-04-12 23:32:26 +00:00
Warner Losh
098ca2bda9 Start each of the license/copyright comments with /*-, minor shuffle of lines 2005-01-06 01:43:34 +00:00
Poul-Henning Kamp
fe12f24bb0 Add missing <sys/module.h> includes 2004-05-30 20:08:47 +00:00
Nate Lawson
5f96beb9e0 Convert callers to the new bus_alloc_resource_any(9) API.
Submitted by:	Mark Santcroos <marks@ripe.net>
Reviewed by:	imp, dfr, bde
2004-03-17 17:50:55 +00:00
Doug Ambrisko
92f282ea0f Forgot an added file in the last commit. 2003-08-01 05:02:55 +00:00
Doug Ambrisko
a373227418 Add printer support to puc(4) driver.
-	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)
2003-08-01 02:25:32 +00:00
David E. O'Brien
8c9bbf484a Use __FBSDID(). 2003-06-11 00:34:37 +00:00
Poul-Henning Kamp
7d4220518e Remove break after return;
Found by:       FlexeLint
2003-05-31 20:24:30 +00:00
Mark Murray
51da11a27a Fix some easy, global, lint warnings. In most cases, this means
making some local variables static. In a couple of cases, this means
removing an unused variable.
2003-04-30 12:57:40 +00:00
Dag-Erling Smørgrav
521f364b80 More low-hanging fruit: kill caddr_t in calls to wakeup(9) / [mt]sleep(9). 2003-03-02 16:54:40 +00:00
Nicolas Souchu
ddd22fb7fb Restore the original copyright 2002-03-23 15:36:13 +00:00
David E. O'Brien
6e551fb628 Update to C99, s/__FUNCTION__/__func__/,
also don't use ANSI string concatenation.
2001-12-10 08:09:49 +00:00
Mike Smith
5f063c7b09 Add ACPI attachments. 2001-08-30 09:17:03 +00:00
Nicolas Souchu
3ae3f8b0be Convert inb/outb to bus_space.
Submitted by:	jcm@FreeBSD-uk.eu.org
2001-06-23 06:52:54 +00:00
Nicolas Souchu
c264e80fb7 Consider that the chipset may be in ECP mode (from BIOS settings)
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.
2001-01-25 10:51:41 +00:00
Nicolas Souchu
1afd1f9956 Fix the PR. Getting a dma channel equal to 0 remains a problem though.
PR:		i386/22568
2000-12-19 21:28:17 +00:00
Doug Rabson
ac7ba92669 Add support for the PC87303 chipset (found on Miata alphas) and add
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>
2000-07-20 09:28:07 +00:00
Doug Rabson
6a5be8627c Add smc37c935 chipset support and clean up the code which tries to
allocate a short port range in some alpha configurations.

Submitted by: "Andrew M. Miklic" <miklic@udlkern.fc.hp.com>,
	      Mark Abene <phiber@radicalmedia.com>
2000-07-18 09:01:09 +00:00
Doug Rabson
76ea0c0c8f Only print the diagnostic about extended I/O ports if bootverbose is true. 2000-06-25 09:20:56 +00:00
Doug Rabson
5c885c3f83 Port ppc driver to alpha.
Submitted by: Andrew M. Miklic <miklic@ibm.net>
2000-05-14 13:47:57 +00:00
Garrett Wollman
7a15d61951 Enable PnP attachment for parallel port controllers.
PR:		17495
2000-04-22 15:08:50 +00:00
Peter Wemm
2b898d39e5 Remove #include "ppc.h" and #if NPPC > 0 - this is always true as it is
'optional ppc' in conf/files*
2000-01-29 14:02:30 +00:00
Doug Rabson
d64d73c906 * Don't use ivars to access resources, bus_set/get_resource is much better.
* First approximation of making this work on alpha (not working yet).
2000-01-25 22:21:45 +00:00
Peter Wemm
a9d565fcd2 Don't do device_set_desc() until after checking for PnP probes. Otherwise
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.
2000-01-14 05:03:23 +00:00
Nicolas Souchu
0f210c922b 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).
2000-01-14 00:18:06 +00:00
Peter Wemm
c3aac50f28 $Id$ -> $FreeBSD$ 1999-08-28 01:08:13 +00:00