aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/puc/puc.c
Commit message (Collapse)AuthorAgeFilesLines
* Mark more nodes as CTLFLAG_MPSAFE or CTLFLAG_NEEDGIANT (17 of many)Pawel Biernacki2020-02-261-1/+2
| | | | | | | | | | | | | | | | | | | r357614 added CTLFLAG_NEEDGIANT to make it easier to find nodes that are still not MPSAFE (or already are but aren’t properly marked). Use it in preparation for a general review of all nodes. This is non-functional change that adds annotations to SYSCTL_NODE and SYSCTL_PROC nodes using one of the soon-to-be-required flags. Mark all obvious cases as MPSAFE. All entries that haven't been marked as MPSAFE before are by default marked as NEEDGIANT Approved by: kib (mentor, blanket) Commented by: kib, gallatin, melifaro Differential Revision: https://reviews.freebsd.org/D23718 Notes: svn path=/head/; revision=358333
* sys/dev: further adoption of SPDX licensing ID tags.Pedro F. Giffuni2017-11-271-0/+2
| | | | | | | | | | | | | | | Mainly focus on files that use BSD 2-Clause license, however the tool I was using misidentified many licenses so this was mostly a manual - error prone - task. The Software Package Data Exchange (SPDX) group provides a specification to make it easier for automated tools to detect and summarize well known opensource licenses. We are gradually adopting the specification, noting that the tags are considered only advisory and do not, in any way, superceed or replace the license texts. Notes: svn path=/head/; revision=326255
* Fix device delete child function.Hans Petter Selasky2016-10-171-2/+1
| | | | | | | | | | | | | | | | | | | | | | | When detaching device trees parent devices must be detached prior to detaching its children. This is because parent devices can have pointers to the child devices in their softcs which are not invalidated by device_delete_child(). This can cause use after free issues and panic(). Device drivers implementing trees, must ensure its detach function detaches or deletes all its children before returning. While at it remove now redundant device_detach() calls before device_delete_child() and device_delete_children(), mostly in the USB controller drivers. Tested by: Jan Henrik Sylvester <me@janh.de> Reviewed by: jhb Differential Revision: https://reviews.freebsd.org/D8070 MFC after: 2 weeks Notes: svn path=/head/; revision=307518
* Replace some more default range checks with RMAN_IS_DEFAULT_RANGE().Justin Hibbits2016-03-021-1/+1
| | | | | | | This is a follow-on to r295832. Notes: svn path=/head/; revision=296298
* Convert rman to use rman_res_t instead of u_longJustin Hibbits2016-01-271-4/+4
| | | | | | | | | | | | | | | | | | | | | | | Summary: Migrate to using the semi-opaque type rman_res_t to specify rman resources. For now, this is still compatible with u_long. This is step one in migrating rman to use uintmax_t for resources instead of u_long. Going forward, this could feasibly be used to specify architecture-specific definitions of resource ranges, rather than baking a specific integer type into the API. This change has been broken out to facilitate MFC'ing drivers back to 10 without breaking ABI. Reviewed By: jhb Sponsored by: Alex Perez/Inertial Computing Differential Revision: https://reviews.freebsd.org/D5075 Notes: svn path=/head/; revision=294883
* Add MSI support to puc(9)Ryan Stone2014-03-131-1/+3
| | | | | | | | | | | | | | Add support for MSI interrupts in the puc(9) driver. By default the driver will prefer MSI interrupts to legacy interrupts. A tunable, hw.puc.msi_disable, has been added to force the allocation of legacy interrupts. Reviewed by: jhb@ MFC after: 2 weeks Sponsored by: Sandvine Inc. Notes: svn path=/head/; revision=263109
* Do not require a filter-only interrupt handler for puc ports that are notJohn Baldwin2013-01-151-1/+1
| | | | | | | | | | | serial devices (such as printer ports). This allows ppc devices attached to puc to correctly setup an interrupt handler and work. Tested by: Andre Albsmeier Andre.Albsmeier@siemens.com MFC after: 1 week Notes: svn path=/head/; revision=245471
* Mark MALLOC_DEFINEs static that have no corresponding MALLOC_DECLAREs.Ed Schouten2011-11-071-1/+1
| | | | | | | This means that their use is restricted to a single C file. Notes: svn path=/head/; revision=227293
* Add location and pnpinfo strings for puc device ports. The location isJohn Baldwin2011-06-141-0/+38
| | | | | | | | | | | 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 Notes: svn path=/head/; revision=223091
* Fix interrupt handling. It started off broken and grew worse over time.Marcel Moolenaar2009-12-111-46/+62
| | | | | | | | | | | | | | | | | | 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 Notes: svn path=/head/; revision=200397
* -axe p_ih from struct puc_port cause it was uselessPaolo Pisati2007-06-061-8/+4
| | | | | | | | | | -correctly check for filter only handler Reviewed by: marcel Tested by: marcel Notes: svn path=/head/; revision=170386
* o break newbus api: add a new argument of type driver_filter_t toPaolo Pisati2007-02-231-10/+12
| | | | | | | | | | | | | | | | 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
* Fix building with GCC 4.2: ensure types are defined before refering to them.David E. O'Brien2006-06-291-1/+1
| | | | Notes: svn path=/head/; revision=160030
* Rewrite of puc(4). Significant changes are:Marcel Moolenaar2006-04-281-466/+563
| | | | | | | | | | | | | | | | | | | | | | | 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. Notes: svn path=/head/; revision=158124
* Use bus_setup_intr() rather than invoking BUS_SETUP_INTR() directly so thatJohn Baldwin2006-02-221-4/+2
| | | | | | | puc still prints out [FAST] on Peter's box. Notes: svn path=/head/; revision=155917
* Don't enable PUC_FASTINTR by default in the source. Instead, enable itJohn Baldwin2005-11-211-4/+0
| | | | | | | | | | | | | | 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. Notes: svn path=/head/; revision=152662
* Eliminate tinderbox errors.Craig Rodrigues2005-11-071-3/+5
| | | | Notes: svn path=/head/; revision=152154
* Avoid trouble with PUC_FASTINTR if it is already defined.Poul-Henning Kamp2005-11-061-0/+2
| | | | Notes: svn path=/head/; revision=152124
* Now that fast interrupts can be shared we can use them in puc.Poul-Henning Kamp2005-11-051-0/+1
| | | | Notes: svn path=/head/; revision=152104
* puc(4) does strange things to resources in order to fool thePoul-Henning Kamp2005-09-281-4/+3
| | | | | | | | | | | | | 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. Notes: svn path=/head/; revision=150698
* __RMAN_RESOURCE_VISIBLE not needed.Poul-Henning Kamp2005-09-251-1/+0
| | | | Notes: svn path=/head/; revision=150549
* - sparc64/fhc/fhc.c:Marius Strobl2005-03-041-9/+0
| | | | | | | | | | | | | | | | | | | | 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 Notes: svn path=/head/; revision=143142
* Add a stopgap allowing puc(4) to allocate IRQs on fhc(4). Given thatMarius Strobl2005-02-261-0/+9
| | | | | | | | | | | | | 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 Notes: svn path=/head/; revision=142531
* fail gracefully rather than using an invalid array index if unableSam Leffler2005-02-251-2/+6
| | | | | | | | | | to allocate a bar; it's unclear whether this can happen in practice Noticed by: Coverity Prevent analysis tool Discussed with: marcel Notes: svn path=/head/; revision=142502
* Revert part of last commit that was unintentionalWarner Losh2005-01-111-1/+1
| | | | Notes: svn path=/head/; revision=140046
* Use the standard FreeBSD licenseWarner Losh2005-01-111-13/+13
| | | | Notes: svn path=/head/; revision=140040
* Start each of the license/copyright comments with /*-, minor shuffle of linesWarner Losh2005-01-061-1/+1
| | | | Notes: svn path=/head/; revision=139749
* Remove duplicate FreeBSD idWarner Losh2004-07-011-3/+0
| | | | Notes: svn path=/head/; revision=131419
* While this file still needs __RMAN_RESOURCE_VISIBLE to get the size ofWarner Losh2004-07-011-6/+9
| | | | | | | | the struct resource for a malloc, it no longer needs it for the r_ elements of struct resource with this commit. Notes: svn path=/head/; revision=131418
* Remove extra RMAN_RESOURCE_VISISBLEWarner Losh2004-06-301-1/+0
| | | | Notes: svn path=/head/; revision=131372
* puc needs to peek into struct resource too.Warner Losh2004-06-301-0/+1
| | | | Notes: svn path=/head/; revision=131371
* This needs __RMAN_RESOURCE_VISIBLEPoul-Henning Kamp2004-06-301-1/+1
| | | | Notes: svn path=/head/; revision=131370
* Convert callers to the new bus_alloc_resource_any(9) API.Nate Lawson2004-03-171-3/+3
| | | | | | | | Submitted by: Mark Santcroos <marks@ripe.net> Reviewed by: imp, dfr, bde Notes: svn path=/head/; revision=127135
* Make the port number available to the sub-device with PUC_IVAR_PORT.Marcel Moolenaar2003-09-261-3/+8
| | | | Notes: svn path=/head/; revision=120451
* Enhance puc(4) to support uart(4). This includes:Marcel Moolenaar2003-09-061-69/+80
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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. Notes: svn path=/head/; revision=119814
* Use __FBSDID().David E. O'Brien2003-08-241-0/+3
| | | | | | | Also some minor style cleanups. Notes: svn path=/head/; revision=119418
* Add printer support to puc(4) driver.Doug Ambrisko2003-08-011-2/+15
| | | | | | | | | | | | | | - 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
* Add support for IC Book Ironclad Pro/Lite 8-port cards.Maxim Sobolev2003-04-301-2/+2
| | | | | | | | Sponsired by: IC Book Labs MFC After: 2 weeks Notes: svn path=/head/; revision=114344
* - Add minimal support for TI16754 4xUART chip into sio(4) driver and removeMaxim Sobolev2003-03-151-6/+68
| | | | | | | | | | | | | | | 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 Notes: svn path=/head/; revision=112270
* Back out M_* changes, per decision of the TRB.Warner Losh2003-02-191-1/+1
| | | | | | | Approved by: trb Notes: svn path=/head/; revision=111119
* Remove M_TRYWAIT/M_WAITOK/M_WAIT. Callers should use 0.Alfred Perlstein2003-01-211-1/+1
| | | | | | | Merge M_NOWAIT/M_DONTWAIT into a single flag M_NOWAIT. Notes: svn path=/head/; revision=109623
* MFp4: Add support for memory mapped UARTs, but don't add any devicesMarcel Moolenaar2003-01-181-9/+15
| | | | | | | | | | 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. Notes: svn path=/head/; revision=109458
* Fix typos, mostly s/ an / a / where appropriate and a few s/an/and/Jens Schweikhardt2002-12-301-1/+1
| | | | | | | Add FreeBSD Id tag where missing. Notes: svn path=/head/; revision=108470
* Add a field so we can specify flags per port to the underlying device driver.Poul-Henning Kamp2002-09-271-0/+2
| | | | Notes: svn path=/head/; revision=104068
* Don't let children attach fast interrupts if the parent interrupt is normal.Poul-Henning Kamp2002-09-041-2/+2
| | | | | | | Submitted by: bde Notes: svn path=/head/; revision=102931
* Bring back the PUC_FASTINTR option, and implement it correctly so thatPoul-Henning Kamp2002-09-041-2/+12
| | | | | | | | | child devices also know if they are fast or normal. Requested by: bde Notes: svn path=/head/; revision=102929
* Fix interrupt registration:Poul-Henning Kamp2002-09-031-10/+3
| | | | | | | | | 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. Notes: svn path=/head/; revision=102895
* Style: fix a function whitespace stuff-up. Remove a debugging printf.Poul-Henning Kamp2002-09-031-2/+3
| | | | Notes: svn path=/head/; revision=102894
* Style: move a global variable up to the top of the file.Poul-Henning Kamp2002-09-031-3/+2
| | | | Notes: svn path=/head/; revision=102893
* Stylistic fixes for the inclusion of the opt_puc.h header, so it comes from theJuli Mallett2002-09-011-3/+2
| | | | | | | | | | 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> Notes: svn path=/head/; revision=102751