summaryrefslogtreecommitdiffstats
path: root/sys/dev/sio
Commit message (Collapse)AuthorAgeFilesLines
* Follow up to r225203 refining break-to-debugger run-time configurationrwatson2011-08-271-1/+0
| | | | | | | | | | | | improvements: (1) Implement new model in previously missed at91 UART driver (2) Move BREAK_TO_DEBUGGER and ALT_BREAK_TO_DEBUGGER from opt_comconsole.h to opt_kdb.h (spotted by np) (3) Garbage collect now-unused opt_comconsole.h MFC after: 3 weeks Approved by: re (bz)
* Attempt to make break-to-debugger and alternative break-to-debugger morerwatson2011-08-261-29/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | accessible: (1) Always compile in support for breaking into the debugger if options KDB is present in the kernel. (2) Disable both by default, but allow them to be enabled via tunables and sysctls debug.kdb.break_to_debugger and debug.kdb.alt_break_to_debugger. (3) options BREAK_TO_DEBUGGER and options ALT_BREAK_TO_DEBUGGER continue to behave as before -- only now instead of compiling in break-to-debugger support, they change the default values of the above sysctls to enable those features by default. Current kernel configurations should, therefore, continue to behave as expected. (4) Migrate alternative break-to-debugger state machine logic out of individual device drivers into centralised KDB code. This has a number of upsides, but also one downside: it's now tricky to release sio spin locks when entering the debugger, so we don't. However, similar logic does not exist in other device drivers, including uart. (5) dcons requires some special handling; unlike other console types, it allows overriding KDB's own debugger selection, so we need a new interface to KDB to allow that to work. GENERIC kernels in -CURRENT will now support break-to-debugger as long as appropriate boot/run-time options are set, which should improve the debuggability of BETA kernels significantly. MFC after: 3 weeks Reviewed by: kib, nwhitehorn Approved by: re (bz)
* Based on discussions on the svn-src mailing list, rework r218195:mdf2011-02-081-1/+0
| | | | | | | | | | | | | | | | | | | | | | - entirely eliminate some calls to uio_yeild() as being unnecessary, such as in a sysctl handler. - move should_yield() and maybe_yield() to kern_synch.c and move the prototypes from sys/uio.h to sys/proc.h - add a slightly more generic kern_yield() that can replace the functionality of uio_yield(). - replace source uses of uio_yield() with the functional equivalent, or in some cases do not change the thread priority when switching. - fix a logic inversion bug in vlrureclaim(), pointed out by bde@. - instead of using the per-cpu last switched ticks, use a per thread variable for should_yield(). With PREEMPTION, the only reasonable use of this is to determine if a lock has been held a long time and relinquish it. Without PREEMPTION, this is essentially the same as the per-cpu variable.
* remove now-redunant cardbus attachment.imp2009-03-091-1/+0
|
* Allow device hints to wire the unit numbers of devices.jhb2008-11-182-60/+0
| | | | | | | | | | | | | | | | | | | | - An "at" hint now reserves a device name. - A new BUS_HINT_DEVICE_UNIT method is added to the bus interface. When determining the unit number of a device, this method is invoked to let the bus driver specify the unit of a device given a specific devclass. This is the only way a device can be given a name reserved via an "at" hint. - Implement BUS_HINT_DEVICE_UNIT() for the acpi(4) and isa(4) bus drivers. Both of these busses implement this by comparing the resources for a given hint device with the resources enumerated by ACPI/PnPBIOS and wire a unit if the hint resources are a subset of the "real" resources. - Use bus_hinted_children() for adding hinted devices on isa(4) busses now instead of doing it by hand. - Remove the unit kludging from sio(4) as it is no longer necessary. Prodding from: peter, imp OK'd by: marcel MFC after: 1 month
* Add a note about a bug in how sio manages its softc. This wasimp2008-10-081-0/+15
| | | | | discovered by Dorr H. Clark. I'm not at all sure how to fix it, but wanted to document it at the very least...
* Expand kdb_alt_break a little, most commonly used with the optionpeter2008-05-041-3/+23
| | | | | | | | | | | | | | | | | | | ALT_BREAK_TO_DEBUGGER. In addition to "Enter ~ ctrl-B" (to enter the debugger), there is now "Enter ~ ctrl-P" (force panic) and "Enter ~ ctrl-R" (request clean reboot, ala ctrl-alt-del on syscons). We've used variations of this at work. The force panic sequence is best used with KDB_UNATTENDED for when you just want it to dump and get on with it. The reboot request is a safer way of getting into single user than a power cycle. eg: you've hosed the ability to log in (pam, rtld, etc). It gives init the reboot signal, which causes an orderly reboot. I've taken my best guess at what the !x86 and non-sio code changes should be. This also makes sio release its spinlock before calling KDB/DDB.
* Add a new 'why' argument to kdb_enter(), and a set of constants to userwatson2007-12-251-2/+4
| | | | | | | | | for that argument. This will allow DDB to detect the broad category of reason why the debugger has been entered, which it can use for the purposes of deciding which DDB script to run. Assign approximate why values to all current consumers of the kdb_enter() interface.
* Stop serial console and gdb serial port from getting all screwed up.julian2007-12-051-1/+1
| | | | | | PR: 65278 MFC in: 3 days Submitted by: ups@
* Allow the sio acpi attachment to be disabled (ie: use hints only). Thispeter2007-11-301-0/+4
| | | | | | | | | | hack means you can get the units and flags to match up more easily with serial consoles on machines with acpi tables that cause the com ports to be probed in the wrong order (and hence get the wrong sio unit number). This replaces the common alternative hack of editing the code to comment out the acpi attachment. This could go away entirely when device wiring patches are committed.
* Add sio_puc_kludge_unit() to stop sio devices originating from pucpeter2007-11-301-0/+29
| | | | | | | stomping on the units intended for the motherboard sio ports. This is no real substitute for the not-yet-committed device wiring enhancements. Code taken from sio's pci attachment.
* Spelling fix for interupt -> interruptkevlo2007-10-121-1/+1
|
* o Revert last. The chip is already supported by puc(4).maxim2007-03-291-1/+0
| | | | Pointed out by: marcel, Joseph Terner
* o Add MosChip 9835 PCI Dual UART PCI id.maxim2007-03-281-0/+1
| | | | | | PR: kern/110967 Submitted by: Joseph Terner MFC after: 1 month
* o break newbus api: add a new argument of type driver_filter_t topiso2007-02-231-5/+7
| | | | | | | | | | | | | 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@
* Only treat positive values as errors...jmg2006-09-141-1/+1
| | | | | Pointed out by: wsk Message-ID: <45060FC4.2090308@gddsn.org.cn>
* Restore the status quo before my last commit. Prior to it, sio tookimp2006-07-171-2/+2
| | | | | | | | | precedence uart. With my last change, it became a tie, and uart seems to always win on my amd64. This was not my intention, so have sio be just a tiny bit more preferred than uart. Note: I'm not making any judgement on the merits of uart winning. I'm just saying that if we want to change it, we do it on purpose.
* Have sio return BIS_PROBE_DEFAULT like all the other drivers in theimp2006-06-301-2/+2
| | | | | | | | | | | | tree... John Baldwin noted that sio might pass values between probe and attach via softc. It appears that sio does leave the hardware in a known state after probing, so other drivers that try to probe might leave it in a worse state. It doesn't seem to pass any data in softc, however, that I could find... I think we should not be probing for anything but nonPnP isa, but that's a change for another day. Submitted by: Frank Behrens PR: 87845
* Eliminate gdb_checkc member from GDB_DBGPORT(), it is never used.phk2006-05-261-8/+2
| | | | | Use polling behaviour for gdb_getc() where convenient, this edges us closer to the console code.
* Convert to use CONSOLE_DRIVER() macro:phk2006-05-261-43/+9
| | | | Remove cngetc, rename cncheckc to cngetc (fix GDB console accordingly)
* Insert a '_' in the console function names to be more consistent withphk2006-05-261-17/+17
| | | | the future.
* Rewrite of puc(4). Significant changes are:marcel2006-04-281-11/+18
| | | | | | | | | | | | | | | | | | | | 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.
* - Use bus_setup_intr() and bus_teardown_intr() to register device driverjhb2006-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.
* Use __DEVOLATILE to cast conspeed.imp2005-12-071-1/+1
|
* Reorganize the interrupt handling code a bit to make a few things cleanerjhb2005-10-251-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | and increase flexibility to allow various different approaches to be tried in the future. - Split struct ithd up into two pieces. struct intr_event holds the list of interrupt handlers associated with interrupt sources. struct intr_thread contains the data relative to an interrupt thread. Currently we still provide a 1:1 relationship of events to threads with the exception that events only have an associated thread if there is at least one threaded interrupt handler attached to the event. This means that on x86 we no longer have 4 bazillion interrupt threads with no handlers. It also means that interrupt events with only INTR_FAST handlers no longer have an associated thread either. - Renamed struct intrhand to struct intr_handler to follow the struct intr_foo naming convention. This did require renaming the powerpc MD struct intr_handler to struct ppc_intr_handler. - INTR_FAST no longer implies INTR_EXCL on all architectures except for powerpc. This means that multiple INTR_FAST handlers can attach to the same interrupt and that INTR_FAST and non-INTR_FAST handlers can attach to the same interrupt. Sharing INTR_FAST handlers may not always be desirable, but having sio(4) and uhci(4) fight over an IRQ isn't fun either. Drivers can always still use INTR_EXCL to ask for an interrupt exclusively. The way this sharing works is that when an interrupt comes in, all the INTR_FAST handlers are executed first, and if any threaded handlers exist, the interrupt thread is scheduled afterwards. This type of layout also makes it possible to investigate using interrupt filters ala OS X where the filter determines whether or not its companion threaded handler should run. - Aside from the INTR_FAST changes above, the impact on MD interrupt code is mostly just 's/ithread/intr_event/'. - A new MI ddb command 'show intrs' walks the list of interrupt events dumping their state. It also has a '/v' verbose switch which dumps info about all of the handlers attached to each event. - We currently don't destroy an interrupt thread when the last threaded handler is removed because it would suck for things like ppbus(8)'s braindead behavior. The code is present, though, it is just under #if 0 for now. - Move the code to actually execute the threaded handlers for an interrrupt event into a separate function so that ithread_loop() becomes more readable. Previously this code was all in the middle of ithread_loop() and indented halfway across the screen. - Made struct intr_thread private to kern_intr.c and replaced td_ithd with a thread private flag TDP_ITHREAD. - In statclock, check curthread against idlethread directly rather than curthread's proc against idlethread's proc. (Not really related to intr changes) Tested on: alpha, amd64, i386, sparc64 Tested on: arm, ia64 (older version of patch by cognet and marcel)
* Eliminate two unused arguments to ttycreate().phk2005-10-161-1/+1
|
* 'PC Card' instead of other variantsimp2005-09-221-2/+2
|
* Last change to this file actually removed the oldcard compat code.imp2005-09-191-2/+1
| | | | This change removes one last K&Rism.
* Make sure that we call if_free(ifp) after bus_teardown_intr. Since weimp2005-09-191-21/+9
| | | | | | | could get an interrupt after we free the ifp, and the interrupt handler depended on the ifp being still alive, this could, in theory, cause a crash. Eliminate this possibility by moving the if_free to after the bus_teardown_intr() call.
* Remove bus_{mem,p}io.h and related code for a micro-optimization on i386nyan2005-05-295-5/+0
| | | | | | and amd64. The optimization is a trivial on recent machines. Reviewed by: -arch (imp, marcel, dfr)
* Oops, revert a commit that snuck in with the earlier critical sectionjhb2005-04-051-1/+0
| | | | | | changes. Noticed by: bde
* Divorce critical sections from spinlocks. Critical sections as denoted byjhb2005-04-041-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | critical_enter() and critical_exit() are now solely a mechanism for deferring kernel preemptions. They no longer have any affect on interrupts. This means that standalone critical sections are now very cheap as they are simply unlocked integer increments and decrements for the common case. Spin mutexes now use a separate KPI implemented in MD code: spinlock_enter() and spinlock_exit(). This KPI is responsible for providing whatever MD guarantees are needed to ensure that a thread holding a spin lock won't be preempted by any other code that will try to lock the same lock. For now all archs continue to block interrupts in a "spinlock section" as they did formerly in all critical sections. Note that I've also taken this opportunity to push a few things into MD code rather than MI. For example, critical_fork_exit() no longer exists. Instead, MD code ensures that new threads have the correct state when they are created. Also, we no longer try to fixup the idlethreads for APs in MI code. Instead, each arch sets the initial curthread and adjusts the state of the idle thread it borrows in order to perform the initial context switch. This change is largely a big NOP, but the cleaner separation it provides will allow for more efficient alternative locking schemes in other parts of the kernel (bare critical sections rather than per-CPU spin mutexes for per-CPU data for example). Reviewed by: grehan, cognet, arch@, others Tested on: i386, alpha, sparc64, powerpc, arm, possibly more
* Simplify the "and if we're in the debugger, don't use locks" logic,rwatson2005-02-081-9/+5
| | | | | | correcting some misthinking. Discussed with (really this time): bde
* When entering siocnputc() with (kdb_active), don't acquire (orrwatson2005-02-031-5/+9
| | | | | | | | | | | release) the sio spin mutex, as use of synchronization primitives in the debugger can result in substantial problems. With this patch in place entering the debugger via a serial console is made substantially more reliable. MFC after: 1 week Tested by: kris Discussed with: bde
* puc handles this card, so remove it from here.imp2005-01-111-1/+0
| | | | PR: 48468
* Start each of the license/copyright comments with /*-, minor shuffle of linesimp2005-01-062-2/+2
|
* Remove local hacks to set flags now that the device probe does this for us.njl2004-10-141-4/+0
| | | | | | | Tested on every device except sio_pci and the pc98 fd.c. Perhaps something similar should be done for the "disabled" hints also. MFC after: 2 weeks
* Use generic tty code instead of local stuff.phk2004-10-131-521/+79
| | | | NB: device names are now consistent: {cua,tty}d$(port)[.lock,.init]
* Use ttyconsolemode() to set the console tty modes.phk2004-10-121-8/+1
|
* MFpc98: Check a pointer is NULL, remove unused variable.nyan2004-09-201-3/+4
|
* Fix an issue with ng_tty which (ab)used the tty->t_sc field which isphk2004-09-171-4/+6
| | | | | | reserved for the device drivers: Add a t_lsc field for line discipline private use.
* Use ttyalloc() instead of ttymalloc(NULL)phk2004-09-171-1/+1
|
* Allocate tty at attach time rather than open time.phk2004-09-161-49/+43
| | | | | | | | Use the init/lock*in/out fields in struct tty and remove them from our softc. Use tty->t_sc to find out softc when convenient. Mostly OK'ed by: bde
* If you insert a pccard modem and then eject it, you get a panic. Thisimp2004-07-221-1/+2
| | | | | | | happens because the sio device was never opened and com->tp is therefore NULL. ttygone can't swallow a NULL, so guard against that possibility. Other places in this function make similar checks, so I believe this is correct.
* Preparation commit for the tty cleanups that will follow in the nearphk2004-07-151-2/+2
| | | | | | | | | future: rename ttyopen() -> tty_open() and ttyclose() -> tty_close(). We need the ttyopen() and ttyclose() for the new generic cdevsw functions for tty devices in order to have consistent naming.
* Introduce ttygone() which indicates that the hardware is detached.phk2004-07-111-38/+5
| | | | Move dtrwait logic to the generic TTY level.
* Update for the KDB framework. Sanitize the alpha console code now thatmarcel2004-07-101-209/+76
| | | | | | | | | | | | | | | | | | it's in the way even more. Basicly: remove all alpha specific console support from gfb(4), sio(4) and syscons(4). Rewrite the alpha console initialization to be identical to all other platforms. In a nutshell: call cninit(). The platform specific code now only sets or clears RB_SERIAL and thus automaticly causes the right console to be selected. sio.c: o Replace the remote GDB hacks and use the GDB debug port interface instead. o Make debugging code conditional upon KDB instead of DDB. o Call kdb_alt_break() instead of db_alt_break(). o Call kdb_enter() instead of breakpoint(). o Remove the ugly compatibility of using the console as the debug port.
* Define the tty methods as typedefs.phk2004-06-301-3/+2
| | | | | | Change the return type for t_break to void. Add t_ioctl (more about this later).
* - Shorten the names for the TTY related swi interrupt handlers as thejhb2004-06-281-2/+2
| | | | | | | | 'tty:' prefix is largely redundant. - Fix the priority of the low-priority TTY SWIs that are hung off of the softclock thread. Submitted by: bde (2)
* Guard against us having no tty pointer.phk2004-06-271-1/+2
|
OpenPOWER on IntegriCloud