aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/kbd
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
* kbd: merge linker set drivers into standard kbd driver listKyle Evans2019-12-262-44/+39
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This leads to the revert of r355806; this reduces duplication in keyboard registration and driver switch lookup and leaves us with one authoritative source for currently registered drivers. The reduced duplication later is nice as we have more procedure involved in keyboard setup. keyboard_driver->flags is used to more quickly detect bogus adds/removes. From KPI consumers' perspective, nothing changes- kbd_add_driver of an already-registered driver will succeed, and a single kbd_delete_driver will later remove it as expected. In contrast to historical behavior, kbd_delete_driver on a driver registered via linker set will now actually de-register the driver so that it may not be used -- e.g. if kbdmux's MOD_LOAD handler fails somewhere. Detection for already-registered drivers in kbd_add_driver has improved, as the previous SLIST_NEXT(driver) != NULL check would not have caught a driver that's at the tail end. kbdinit is now called from cninit() rather than via SYSINIT so that keyboard drivers are available as early as console drivers. This is particularly important as cnprobe will, in both syscons and vt, attempt to do any early configuration of keyboard drivers built-in (see: kbd_configure). Reviewed by: imp (earlier version, pre-cninit change) Differential Revision: https://reviews.freebsd.org/D22835 Notes: svn path=/head/; revision=356087
* kbd: const'ify a couple of keyboard_driver fieldsKyle Evans2019-12-171-4/+9
| | | | | | | | | | Nothing modifies these things, but const'ify out of an abundance of caution. If we could const'ify the definition in each keyboard driver, I likely would- improper mutations here can lead to misbehavior or slightly more annoying to debug state. Notes: svn path=/head/; revision=355842
* kbd: patch linker set methods, tooKyle Evans2019-12-161-0/+17
| | | | | | | | | | This is needed after r355796. Some double-registration of kbd drivers needs to be sorted out, then this sysinit will simply add these drivers into the normal list and kill off any other bits in the driver that are aware of the linker set, for simplicity. Notes: svn path=/head/; revision=355799
* kbd: remove kbdsw, store pointer to driver in each keyboard_tKyle Evans2019-12-162-92/+77
| | | | | | | | | | | | | | | | | | The previous implementation relied on a kbdsw array that mirrored the global keyboards array. This is fine, but also requires extra locking consideration when accessing to ensure that it's not being resized as new keyboards are added. The extra pointer costs little in a struct that there are relatively few of on any given system, and simplifies locking requirements ever-so-slightly as we only need to consider the locking requirements of whichever method is being invoked. __FreeBSD_version is bumped as any kbd modules will need rebuilt following this change. Notes: svn path=/head/; revision=355798
* kbd: provide default implementations of get_fkeystr/diagKyle Evans2019-12-162-5/+9
| | | | | | | | | Most keyboard drivers are using the genkbd implementations as it is; formally use them for any that aren't set and make genkbd_get_fkeystr/genkbd_diag private. Notes: svn path=/head/; revision=355796
* kbd: convert kbdd_* macros to inline functionsKyle Evans2019-12-151-47/+140
| | | | | | | | This reduces the noise when interested parties wish to de-Giant kbd; these accesses to kbdsw will need to be properly locked. Notes: svn path=/head/; revision=355775
* kbd: drop _KERNEL #ifdef in kbdreg.hKyle Evans2019-12-151-4/+0
| | | | | | | | | | This #ifdef is misleading as there are actually no user-serviceable parts inside and, as far as I can tell, there is no pollution leading from userland to this header. Furthermore, it becomes a slight nuisance when attempting to move things around in this header. Notes: svn path=/head/; revision=355769
* evdev: Remove evdev.ko linkage dependency on kbd driverVladimir Kondratyev2018-08-132-0/+43
| | | | | | | | | | | | | | | | | | Move evdev_ev_kbd_event() helper from evdev to kbd.c as otherwise evdev unconditionally requires all keyboard and console stuff to be compiled into the kernel. This dependency happens as evdev_ev_kbd_event() helper references kbdsw global variable defined in kbd.c through use of kbdd_ioctl() macro. While here make all keyboard drivers respect evdev_rcpt_mask while setting typematic rate and LEDs with evdev interface. Requested by: Milan Obuch <bsd@dino.sk> Reviewed by: hselasky, gonzo Differential Revision: https://reviews.freebsd.org/D16614 Notes: svn path=/head/; revision=337721
* Revert r327828, r327949, r327953, r328016-r328026, r328041:Pedro F. Giffuni2018-01-211-4/+3
| | | | | | | | | | | | | | | | | | Uses of mallocarray(9). The use of mallocarray(9) has rocketed the required swap to build FreeBSD. This is likely caused by the allocation size attributes which put extra pressure on the compiler. Given that most of these checks are superfluous we have to choose better where to use mallocarray(9). We still have more uses of mallocarray(9) but hopefully this is enough to bring swap usage to a reasonable level. Reported by: wosch PR: 225197 Notes: svn path=/head/; revision=328218
* dev: make some use of mallocarray(9).Pedro F. Giffuni2018-01-131-3/+4
| | | | | | | | | | | | | | Focus on code where we are doing multiplications within malloc(9). None of these is likely to overflow, however the change is still useful as some static checkers can benefit from the allocation attributes we use for mallocarray. This initial sweep only covers malloc(9) calls with M_NOWAIT. No good reason but I started doing the changes before r327796 and at that time it was convenient to make sure the sorrounding code could handle NULL values. Notes: svn path=/head/; revision=327949
* sys/dev: further adoption of SPDX licensing ID tags.Pedro F. Giffuni2017-11-273-0/+6
| | | | | | | | | | | | | | | 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
* Remove pc98 support completely.Yoshihiro Takahashi2017-01-281-12/+0
| | | | | | | | | I thank all developers and contributors for pc98. Relnotes: yes Notes: svn path=/head/; revision=312910
* Restore priority value for OGIO_KEYMAPNikolai Lifanov2017-01-071-1/+1
| | | | | | | | | | | | PR: 206678 Submitted by: ecturt@gmail.com Reviewed by: cem Approved by: cem, matthew (mentor) MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D5095 Notes: svn path=/head/; revision=311650
* Use M_WAITOK in PIO_KEYMAP ioctlEd Maste2016-10-121-1/+1
| | | | | | | | | | The malloc return value is not checked. Submitted by: CTurt <ecturt@gmail.com> MFC after: 1 week Notes: svn path=/head/; revision=307145
* apply some style(9) to kbd: make function name start in column 1Ed Maste2016-07-261-8/+8
| | | | | | | Sponsored by: The FreeBSD Foundation Notes: svn path=/head/; revision=303335
* Use unsigned version of min() when handling arguments of SETFKEY ioctl.Gleb Smirnoff2016-05-171-1/+1
| | | | | | | | | Submitted by: C Turt <cturt hardenedbsd.org> Security: SA-16:18 Security: CVE-2016-1886 Notes: svn path=/head/; revision=300089
* sys/dev: minor spelling fixes.Pedro F. Giffuni2016-05-031-1/+1
| | | | | | | Most affect comments, very few have user-visible effects. Notes: svn path=/head/; revision=298955
* sys: Make use of our rounddown() macro when sys/param.h is available.Pedro F. Giffuni2016-04-301-1/+1
| | | | | | | No functional change. Notes: svn path=/head/; revision=298848
* sys/dev: use our nitems() macro when it is avaliable through param.h.Pedro F. Giffuni2016-04-191-1/+1
| | | | | | | | | | No functional change, only trivial cases are done in this sweep, Drivers that can get further enhancements will be done independently. Discussed in: freebsd-current Notes: svn path=/head/; revision=298307
* Mark all SYSCTL_NODEs static that have no corresponding SYSCTL_DECLs.Ed Schouten2011-11-071-1/+1
| | | | | | | | | The SYSCTL_NODE macro defines a list that stores all child-elements of that node. If there's no SYSCTL_DECL macro anywhere else, there's no reason why it shouldn't be static. Notes: svn path=/head/; revision=227309
* Restore binary compatibility for GIO_KEYMAP and PIO_KEYMAP.Ed Schouten2011-07-171-8/+32
| | | | | | | | | | | | Back in 2009 I changed the ABI of the GIO_KEYMAP and PIO_KEYMAP ioctls to support wide characters. I created a patch to add ABI compatibility for the old calls, but I didn't get any feedback to that. It seems now people are upgrading from 8 to 9 they experience this issue, so add it anyway. Notes: svn path=/head/; revision=224126
* Explicitly tell the compiler that we don't care about the return valueRui Paulo2010-10-131-5/+5
| | | | | | | of kbdd_ioctl(). Notes: svn path=/head/; revision=213770
* Use an unsigned integer for storing the key code.Ed Schouten2009-09-221-1/+1
| | | | | | | | | | | | It seems Clang breaks when checking for SPCLKEY, which is now 0x80000000. Using an unsigned integer fixes this. This is also consistent with other pieces of kbd/syscons code, because these also use u_int. Submitted by: rdivacky Notes: svn path=/head/; revision=197400
* Make the keyboard layer Unicode aware.Ed Schouten2009-09-191-7/+19
| | | | | | | | | | | | | | | Just take keyent_t to use an u_int to store the Unicode codepoints. Unfortunately the keymap is now too big to be loaded using an ioctl argument, so change the ioctl to pick a pointer. This change breaks kbdcontrol ABI. It doesn't break X11, because X11 doesn't do anything with syscons keymaps. It just switches the device out of K_XLATE. Obtained from: //depot/user/ed/newcons/... Notes: svn path=/head/; revision=197330
* Move buffer management into kbd and kbdmux drivers.Ed Schouten2009-06-051-23/+51
| | | | | | | | | | | These two drivers seem to be the last consumers of clists. clists are quite overengineered for simple circular buffers, so I'm adding similar buffer management routines to the kbd and kbdmux drivers. The input buffer is now part of the softc structures, instead of having dynamically allocated cblocks. Notes: svn path=/head/; revision=193512
* Whitespace nitpickingMaksim Yevmenkin2009-04-091-2/+2
| | | | | | | MFC after: 1 week Notes: svn path=/head/; revision=190870
* Introduce KB_POLLED flag to struct keyboard's kb_flags field.Maksim Yevmenkin2009-04-091-0/+4
| | | | | | | | Reviewed by: freebsd-current@, freebsd-hackers@ MFC after: 1 week Notes: svn path=/head/; revision=190869
* Replace all calls to minor() with dev2unit().Ed Schouten2008-09-271-2/+2
| | | | | | | | | | | | | | | | | | After I removed all the unit2minor()/minor2unit() calls from the kernel yesterday, I realised calling minor() everywhere is quite confusing. Character devices now only have the ability to store a unit number, not a minor number. Remove the confusion by using dev2unit() everywhere. This commit could also be considered as a bug fix. A lot of drivers call minor(), while they should actually be calling dev2unit(). In -CURRENT this isn't a problem, but it turns out we never had any problem reports related to that issue in the past. I suspect not many people connect more than 256 pieces of the same hardware. Reviewed by: kib Notes: svn path=/head/; revision=183397
* Don't include <sys/tty.h> in non-TTY drivers.Ed Schouten2008-07-241-1/+2
| | | | | | | | | | | | | The kbd, kbdmux, ugen and uhid drivers included <sys/tty.h>, because they needed clists, which have been moved to <sys/clist.h> some time ago. In the MPSAFE TTY branch, <sys/tty.h> does not include <sys/clist.h>, which means we have to teach these drivers to include this header file directly. Approved by: philip (mentor, implicit) Notes: svn path=/head/; revision=180777
* Remove explicit calls to keyboard methods with their respective variantsWojciech A. Koszek2007-12-292-17/+56
| | | | | | | | | | | | | | | | | | implemented with macros. This patch improves code readability. Reasoning behind kbdd_* is a "keyboard discipline". List of macros is supposed to be complete--all methods of keyboard_switch should have their respective macros from now on. Functionally, this code should be no-op. My intention is to leave current behaviour of code as is. Glanced at by: rwatson Reviewed by: emax, marcel Approved by: cognet Notes: svn path=/head/; revision=174984
* Sweep kernel replacing suser(9) calls with priv(9) calls, assigningRobert Watson2006-11-061-9/+10
| | | | | | | | | | | | | | | | specific privilege names to a broad range of privileges. These may require some future tweaking. Sponsored by: nCircle Network Security, Inc. Obtained from: TrustedBSD Project Discussed on: arch@ Reviewed (at least in part) by: mlaier, jmg, pjd, bde, ceri, Alex Lyashkov <umka at sevcity dot net>, Skip Ford <skip dot ford at verizon dot net>, Antoine Brodin <antoine dot brodin at laposte dot net> Notes: svn path=/head/; revision=164033
* Integrate kbdmux(4) into syscons(4) and kbd code.Maksim Yevmenkin2006-02-281-0/+24
| | | | | | | | | | | | | | | | | | | | | | | By default syscons(4) will look for the kbdmux(4) keyboard first, and then, if not found, look for any keyboard. Current kbd code is modified so if kbdmux(4) is the current keyboard, all new keyboards are automatically added to the kbdmux(4). Switch to kbdmux(4) can be done at boot time, by loading kbdmux module at the loader prompt, or at runtime, by kldload'ing the kbdmux module and releasing current active keyboard. If, for whatever reason, kbdmux(4) is not required/desired then just do not load it and everything should work as before. It is also possible to kldunload kbdmux at runtime and syscons(4) will automatically switch to the first available keyboard. No response from: freebsd-current@ MFC after: 1 day Notes: svn path=/head/; revision=156126
* kbdmux(4) keyboard multiplexer integrationMaksim Yevmenkin2005-07-132-3/+18
| | | | | | | | | | | | | | | | | | | | | | o Add two new ioctl's KBADDKBD and KBRELKBD. These are used to add and remove keyboard to (and from) kbdmux(4) keyboard multiplexer; o Introduce new kbd_find_keyboard2() function. It does exactly the same job as kbd_find_keyboard() function except it allows to specify starting index. This function can be used to iterate over keyboards array; o Re-implement kbd_find_keyboard() as call to kbd_find_keyboard2() with starting index of zero; o Make sure syscons(4) passed KBADDKBD and KBRELKBD ioctl's onto currently active keyboard. These changes should not have any visible effect. MFC after: 1 week Notes: svn path=/head/; revision=147980
* - Hook up the new locations of the atkbdc(4), atkbd(4) and psm(4) sourceMarius Strobl2005-06-104-2795/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | files after they were repo-copied to sys/dev/atkbdc. The sources of atkbdc(4) and its children were moved to the new location in preparation for adding an EBus front-end to atkbdc(4) for use on sparc64; i.e. in order to not further scatter them over the whole tree which would have been the result of adding atkbdc_ebus.c in e.g. sys/sparc64/ebus. Another reason for the repo-copies was that some of the sources were misfiled, e.g. sys/isa/atkbd_isa.c wasn't ISA-specific at all but for hanging atkbd(4) off of atkbdc(4) and was renamed to atkbd_atkbdc.c accordingly. Most of sys/isa/psm.c, i.e. expect for its PSMC PNP part, also isn't ISA-specific. - Separate the parts of atkbdc_isa.c which aren't actually ISA-specific but are shareable between different atkbdc(4) bus front-ends into atkbdc_subr.c (repo-copied from atkbdc_isa.c). While here use bus_generic_rl_alloc_resource() and bus_generic_rl_release_resource() respectively in atkbdc_isa.c instead of rolling own versions. - Add sparc64 MD bits to atkbdc(4) and atkbd(4) and an EBus front-end for atkbdc(4). PS/2 controllers and input devices are used on a couple of Sun OEM boards and occur on either the EBus or the ISA bus. Depending on the board it's either the only on-board mean to connect a keyboard and mouse or an alternative to either RS232 or USB devices. - Wrap the PSMC PNP part of psm.c in #ifdef DEV_ISA so it can be compiled without isa(4) (e.g. for EBus-only machines). This ISA-specific part isn't separated into its own source file, yet, as it requires more work than was feasible for 6.0 in order to do it in a clean way. Actually philip@ is working on a rewrite of psm(4) so a more comprehensive clean-up and separation of hardware dependent and independent parts is expected to happen after 6.0. Tested on: i386, sparc64 (AX1105, AXe and AXi boards) Reviewed by: philip Notes: svn path=/head/; revision=147271
* Remove bus_{mem,p}io.h and related code for a micro-optimization on i386Yoshihiro Takahashi2005-05-291-1/+0
| | | | | | | | | and amd64. The optimization is a trivial on recent machines. Reviewed by: -arch (imp, marcel, dfr) Notes: svn path=/head/; revision=146734
* Move the pc98 keymap define into pckbdtables.h because it should be usedYoshihiro Takahashi2005-05-121-142/+0
| | | | | | | only on the pckbd driver. Notes: svn path=/head/; revision=146138
* Backout previous diffs - this functionality is already provided by theMaxim Sobolev2005-04-071-15/+0
| | | | | | | | | | hints to the atkbd(4). PR: Submitted by: jhb Notes: svn path=/head/; revision=144768
* Make previous commit actually working by replacing TUNABLE_INT() withMaxim Sobolev2005-04-071-10/+10
| | | | | | | | | | TUNABLE_INT_FETCH(). Apparently keyboard init is performed earlier in the boot process than fetching all static tunables. MFC after: 1 day Notes: svn path=/head/; revision=144753
* Provide a new tunable hw.atkbdc.broken_kit_cmd, which if set to 1Maxim Sobolev2005-04-071-0/+15
| | | | | | | | | | | | | | | | | | instructs the driver to avoid using Keyboard Interface Test command. This command causes problems with some non-compliant hardware, resulting in machine being abruptly powered down early in the boot process. Particularly it's known that HP ZV5000 and Compaq R3000Z notebooks are affected by this problem. Due to popularity of those models this patch is good MFC5.4 candidate. PR: 67745 Submitted by: Jung-uk Kim jkim at niksun.com MFC after: 1 days Notes: svn path=/head/; revision=144749
* plug memory leakSam Leffler2005-02-261-18/+37
| | | | | | | Noticed by: Coverity Prevent analysis tool Notes: svn path=/head/; revision=142569
* #include fcntl.h not vnode.h. Check O_NONBLOCK not IO_NDELAY.Poul-Henning Kamp2004-12-221-2/+2
| | | | Notes: svn path=/head/; revision=139193
* Add a new flag to the atkbd(4) driver to disable testing the keyboardJohn Baldwin2004-12-152-1/+3
| | | | | | | | | | | | | | port during the device probe as this can cause hangs on some machines, specifically Compaq R3000Z series amd64 laptops. The flag is bit 3, or 0x8. PR: amd64/67745 Reported by: Neil Winterbauer newntrbr at ucla dot edu, many others Tested by: ade, astrodog at gmail dot com, many others MFC after: 1 week Notes: svn path=/head/; revision=138900
* Do the dreaded s/dev_t/struct cdev */Poul-Henning Kamp2004-06-162-7/+7
| | | | | | | Bump __FreeBSD_version accordingly. Notes: svn path=/head/; revision=130585
* Remove atdevbase and replace it's remaining uses with direct references toJohn Baldwin2004-06-101-0/+1
| | | | | | | KERNBASE instead. Notes: svn path=/head/; revision=130312
* style(9): return foo -> return (foo)Dag-Erling Smørgrav2004-04-021-95/+95
| | | | | | | also fix a continuation indent I missed in the previous commit. Notes: svn path=/head/; revision=127752
* Clean up whitespace, fix continuation indents, wrap some long lines.Dag-Erling Smørgrav2004-04-021-27/+27
| | | | Notes: svn path=/head/; revision=127751
* Device megapatch 4/6:Poul-Henning Kamp2004-02-211-0/+2
| | | | | | | | | | | Introduce d_version field in struct cdevsw, this must always be initialized to D_VERSION. Flip sense of D_NOGIANT flag to D_NEEDGIANT, this involves removing four D_NOGIANT flags and adding 145 D_NEEDGIANT flags. Notes: svn path=/head/; revision=126080
* Device megapatch 1/6:Poul-Henning Kamp2004-02-211-2/+0
| | | | | | | | | | Free approx 86 major numbers with a mostly automatically generated patch. A number of strategic drivers have been left behind by caution, and a few because they still (ab)use their major number. Notes: svn path=/head/; revision=126076
* While USB keyboards attach as ukbd[0-9]+, the device node created byDag-Erling Smørgrav2004-01-271-1/+2
| | | | | | | | | | | | | | kbd_attach() is called kbd[0-9]+, with a different unit number. This makes it impossible to write a devd rule which will automatically switch to a USB keyboard when one is attached, because there is no way to guess the correct device node to pass to kbdcontrol. Therefore, change kbd_attach() to create a device node using the keyboard device's real name (atkbd0, ukbd0...), and create the kbd[0-9]+ node as an alias for backward compatibility. Notes: svn path=/head/; revision=125087