History log of /freebsd-9.3-release/sys/dev/puc/puc.c
Revision Date Author Comments
(<<< Hide modified files)
(Show modified files >>>)
# 267654 19-Jun-2014 gjb

Copy stable/9 to releng/9.3 as part of the 9.3-RELEASE cycle.

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

# 249132 05-Apr-2013 mav

MFC r227293 (by ed):
Mark MALLOC_DEFINEs static that have no corresponding MALLOC_DECLAREs.

This means that their use is restricted to a single C file.


# 247489 28-Feb-2013 jhb

MFC 245471:
Do not require a filter-only interrupt handler for puc ports that are not
serial devices (such as printer ports). This allows ppc devices attached
to puc to correctly setup an interrupt handler and work.


# 225736 22-Sep-2011 kensmith

Copy head to stable/9 as part of 9.0-RELEASE release cycle.

Approved by: re (implicit)


# 223091 14-Jun-2011 jhb

Add location and pnpinfo strings for puc device ports. The location is
announced during boot and contains the port number. The pnpinfo string
lists the port type (PUC_TYPE_* constants).

Tested by: Boris Samorodov bsam ipt ru
MFC after: 1 week


# 200397 11-Dec-2009 marcel

Fix interrupt handling. It started off broken and grew worse over time.
The rewrite of the interrupt handler includes:
o loop until all pending interrupts are handled. This closes a
race condition.
o count the number of interrupt sources we handled so that we can
properly return FILTER_HANDLED or FILTER_STRAY when we break out
of the loop.
o When matching the interrupt source to the devices that have that
source pending, check only from the set of devices we found to
have a pending interrupt.

PR: kern/140947
MFC after: 3 days


# 170386 06-Jun-2007 piso

-axe p_ih from struct puc_port cause it was useless
-correctly check for filter only handler

Reviewed by: marcel
Tested by: marcel


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


# 160030 29-Jun-2006 obrien

Fix building with GCC 4.2: ensure types are defined before refering to them.


# 158124 28-Apr-2006 marcel

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.


# 155917 22-Feb-2006 jhb

Use bus_setup_intr() rather than invoking BUS_SETUP_INTR() directly so that
puc still prints out [FAST] on Peter's box.


# 152662 21-Nov-2005 jhb

Don't enable PUC_FASTINTR by default in the source. Instead, enable it
via the DEFAULTS kernel configs. This allows folks to turn it that option
off in the kernel configs if desired without having to hack the source.
This is especially useful since PUC_FASTINTR hangs the kernel boot on my
ultra60 which has two uart(4) devices hung off of a puc(4) device.

I did not enable PUC_FASTINTR by default on powerpc since powerpc does not
currently allow sharing of INTR_FAST with non-INTR_FAST like the other
archs.


# 152154 07-Nov-2005 rodrigc

Eliminate tinderbox errors.


# 152124 06-Nov-2005 phk

Avoid trouble with PUC_FASTINTR if it is already defined.


# 152104 05-Nov-2005 phk

Now that fast interrupts can be shared we can use them in puc.


# 150698 28-Sep-2005 phk

puc(4) does strange things to resources in order to fool the
subdrivers to hook up.

It should probably be rewritten to implement a simple bus to which
the sub drivers attach using some kind of hint.

Until then, provide a couple of crutch functions with big warning
signs so it can survive the recent changes to struct resource.


# 150549 25-Sep-2005 phk

__RMAN_RESOURCE_VISIBLE not needed.


# 143142 04-Mar-2005 marius

- sparc64/fhc/fhc.c:
Change fhc(4) to use IRQ numbers instead of RIDs for allocating the
IRQs of children. This works similar to e.g. sbus(4), i.e. add the
IRQ resources as fully specified to the resource lists of the children,
allocate them like normal. When establishing the interrupt search the
interrupt maps of the children for a matching INO to determine which
map we need to write the fully specified interrupt number to and to
enable the mapping (before the RID was used to indicate which interrupt
map to use).

- dev/puc/puc.c:
Revert rev. 1.38, with the above change fhc(4) no longer needs special
treatment for allocating IRQs.

Thanks to: joerg for providing access to an E3500


# 142531 25-Feb-2005 marius

Add a stopgap allowing puc(4) to allocate IRQs on fhc(4). Given that
both a scc(4) is under way and fhc(4) will be change to use INOs this
shouldn't stay in HEAD for too long but we need a MFC-able solution
for FreeBSD 5.4.

Discussed with: marcel
Tested by: hrs, kris
MFC after: 3 days


# 142502 25-Feb-2005 sam

fail gracefully rather than using an invalid array index if unable
to allocate a bar; it's unclear whether this can happen in practice

Noticed by: Coverity Prevent analysis tool
Discussed with: marcel


# 140046 11-Jan-2005 imp

Revert part of last commit that was unintentional


# 140040 11-Jan-2005 imp

Use the standard FreeBSD license


# 139749 05-Jan-2005 imp

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


# 131419 01-Jul-2004 imp

Remove duplicate FreeBSD id


# 131418 01-Jul-2004 imp

While this file still needs __RMAN_RESOURCE_VISIBLE to get the size of
the struct resource for a malloc, it no longer needs it for the r_
elements of struct resource with this commit.


# 131372 30-Jun-2004 imp

Remove extra RMAN_RESOURCE_VISISBLE


# 131371 30-Jun-2004 imp

puc needs to peek into struct resource too.


# 131370 30-Jun-2004 phk

This needs __RMAN_RESOURCE_VISIBLE


# 127135 17-Mar-2004 njl

Convert callers to the new bus_alloc_resource_any(9) API.

Submitted by: Mark Santcroos <marks@ripe.net>
Reviewed by: imp, dfr, bde


# 120451 26-Sep-2003 marcel

Make the port number available to the sub-device with PUC_IVAR_PORT.


# 119814 06-Sep-2003 marcel

Enhance puc(4) to support uart(4). This includes:
o Introduce PUC_PORT_TYPE_UART so that we can attach to uart(4),
o Introduce port sub-types (eg PUC_PORT_UART_NS8250, PUC_PORT_UART_Z8530)
to handle different hardware and determine resource sizes.
o Introduce two new IVARs: PUC_IVAR_SUBTYPE and PUC_IVAR_REGSHFT. Both
are used by uart(4) to get sufficient information to talk to the HW.
o Introduce PUC_FLAGS_ALTRES to tell puc(4) to try memory mapped I/O
if I/O port space cannot be allocated, or vice versa.
o Have ports of type PUC_PORT_TYPE_COM attach to uart(1) if attaching
to sio(4) fails (due to not having the sio driver).
o Put struct puc_device_description in struct puc_softc instead of
having a pointer to a device description in the softc. This allows
us to create device descriptions on the fly without having to use
malloc() or otherwise have them staticly defined.
o Move puc_find_description() from puc.c to puc_pci.c as it's specific
to PCI.
o Add EBUS and SBUS frontends for use on sparc64. Note that the P in
puc stands for PCI, so we kinda mess things up here. It's too soon
to worry about it though. We'll know what to do about it in time.

NOTE: This commit changes the behaviour of puc(4) to not quieten the
device probe and attach for child devices. The uart(4) driver provides
additional device description that is valuable to have.


# 119418 24-Aug-2003 obrien

Use __FBSDID().
Also some minor style cleanups.


# 118292 01-Aug-2003 ambrisko

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)


# 114344 30-Apr-2003 sobomax

Add support for IC Book Ironclad Pro/Lite 8-port cards.

Sponsired by: IC Book Labs
MFC After: 2 weeks


# 112270 15-Mar-2003 sobomax

- Add minimal support for TI16754 4xUART chip into sio(4) driver and remove
now unnecessary hack from the previous commit;
- Add support for Interrupt Latch Register (ILR) into puc(4). So far only
ILRs compatible with specifications from Digi International are supported.
Support for other types of ILRs could be easily added later;
- Correct clock frequency for IC Book Labs Dreadnought x16 Lite board;
- Enable ILR detection/usage for IC Book Labs Dreadnought x16 boards.

Sponsored by: IC Book Labs
MFC after: 2 weeks


# 111119 19-Feb-2003 imp

Back out M_* changes, per decision of the TRB.

Approved by: trb


# 109623 21-Jan-2003 alfred

Remove M_TRYWAIT/M_WAITOK/M_WAIT. Callers should use 0.
Merge M_NOWAIT/M_DONTWAIT into a single flag M_NOWAIT.


# 109458 18-Jan-2003 marcel

MFp4: Add support for memory mapped UARTs, but don't add any devices
yet that depend on it because sio(4) needs support for it before it
can be used. There's no reason why zs(4) couldn't attach to puc(4)
in the (near?) future (in principle), so don't make memory mapped I/O
support in sio(4) a precondition for this change.


# 108470 30-Dec-2002 schweikh

Fix typos, mostly s/ an / a / where appropriate and a few s/an/and/
Add FreeBSD Id tag where missing.


# 104068 27-Sep-2002 phk

Add a field so we can specify flags per port to the underlying device driver.


# 102931 04-Sep-2002 phk

Don't let children attach fast interrupts if the parent interrupt is normal.

Submitted by: bde


# 102929 04-Sep-2002 phk

Bring back the PUC_FASTINTR option, and implement it correctly so that
child devices also know if they are fast or normal.

Requested by: bde


# 102895 03-Sep-2002 phk

Fix interrupt registration:

PUC devices live on pccard or pci so INTR_FAST is never really an option.
Don't try to register the interrupt as fast and don't allow the children
to do so either.


# 102894 03-Sep-2002 phk

Style: fix a function whitespace stuff-up. Remove a debugging printf.


# 102893 03-Sep-2002 phk

Style: move a global variable up to the top of the file.


# 102751 31-Aug-2002 jmallett

Stylistic fixes for the inclusion of the opt_puc.h header, so it comes from the
right places, and so it's sorted consistently with how all the other N-hundreds
of files ding this do it.

Submitted by: Hiten Pandya <hiten@uk.FreeBSD.org>


# 102734 31-Aug-2002 phk

More cleaning up and unhacking:

Don't expect all RIDs to be PCI rids. The previous code made at
least 1 mistake, even for PCI.

Give the card definitions a chance to specify a init function.
Use this instead of the gross superio hack.
Move the win877 init function to puc_pci.c where it belongs.

RIDs can actually be zero, don't set badmuxed if so.

Set a less incorrect end for the construct SYS_RES_IOPORT entries,
I guess both sio and lpt happen to use 8 IO ports, but that shouldn't
really be hardcoded this way.

Fixup puc_pccard.c to match.

We're getting closer.


# 102717 31-Aug-2002 phk

Don't enable PUC_DEBUG by accident


# 102714 31-Aug-2002 phk

Split the puc driver in pci specific and generic parts.
Add a pccard frontend for it as well.

The PCcard stuff does not work yet because there is still some PCImagic
left in puc.c


# 100425 21-Jul-2002 imp

cardbus attachment.


# 95392 24-Apr-2002 jhay

Ignore the multifunction bit in the PCIR_HEADERTYPE.

PR: 37333
Submitted by: Ari Suutari <ari.suutari@syncrontech.com>
MFC after: 4 days


# 92739 20-Mar-2002 alfred

Remove __P.


# 91900 08-Mar-2002 jhay

Remove the #if __FreeBSD_version glue now that the puc driver is part of
-stable.


# 90925 19-Feb-2002 nyan

Release allocated memory and bus_space_handle on an error.

Reviewed by: jhay


# 90763 17-Feb-2002 nyan

Move the bus_space_subregion function from the puc driver to the bus_space
sutff.

Reviewed by: jhay


# 90731 16-Feb-2002 jhay

Add the puc (PCI "Universal" Communications) driver. The idea and some of
the structure definitions come from NetBSD to make it easier to share card
definitions. The driver only acts as a shim between the pci bus and the
sio driver. Later pci parallel ports could also be supported through this
driver. Support for most single and multiport pci serial cards should be
as simple as adding its definition to pucdata.c

Tested with the following pci cards:
Moxa Industio CP-114, 4 port RS-232,RS-422/485
Syba Tech Ltd. PCI-4S2P-550-ECP, 4 port RS-232 + 2 parallel ports
Netmos NM9835 PCI-2S-550, 2 port RS-232