summaryrefslogtreecommitdiffstats
path: root/sys/dev/atkbdc/atkbd.c
Commit message (Collapse)AuthorAgeFilesLines
* MFC: r282269, r282277royger2015-05-211-65/+17
| | | | | atkbd: remove usage of x86bios Remove leftover from r282269.
* Pass the device_t into atkbd_{probe,attach}_unit and get theimp2013-01-111-5/+7
| | | | | controller unit and keyboard unit from there. It will be needed for other things in the future as well...
* style(9) changes before I do more real changes.imp2013-01-111-83/+79
|
* Restore binary compatibility for GIO_KEYMAP and PIO_KEYMAP.ed2011-07-171-0/+1
| | | | | | | | | 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.
* Correct a typo.delphij2011-06-201-1/+1
| | | | | Submitted by: Fabian Keil <fk fabiankeil de> MFC after: 3 days
* Add comments about the validation.delphij2011-06-111-0/+9
|
* Validate INT 15h and 16h vectors more strictly. Traditionally these entryjkim2011-06-061-1/+2
| | | | | | | | | | | | | | | | | | | points are fixed addresses and (U)EFI CSM specification also mandated that. Unfortunately, (U)EFI CSM specification does not specifically mention this is to call service routine via interrupt vector table or to jump directly to the entry point. As a result, some CSM seems to install two routines and acts differently, depending on how it was executed, unfortunately. When INT 15h is used, it calls a function pointer (which is probably a UEFI service function). When it jumps directly to the entry point, it executes a simple and traditional INT 15h service routine. Therefore, actually there are two possible fixes, i. e., this fix or jumping directly to the fixed entry point. However, we chose this fix because a) keyboard typematic support via BIOS is becoming extremely rarer and b) we cannot support random service routine installed by a firmware or a boot loader. This should fix Lenovo X220 laptop, specifically. Reviewed by: delphij MFC after: 3 days
* Revert r222152. The root cause was analysed and better fix is upcoming.jkim2011-06-061-3/+0
| | | | Discussed with: delphij
* Add a new knob to atkbd(4) to enable typematic rate detection on boot,delphij2011-05-201-0/+3
| | | | | | | | | which is now disabled by default. The detection is known to cause hangs on boot with some new Lenovo laptops on FreeBSD/amd64. Reported by: gnn Discussed with: jkim MFC after: 3 months
* Rewrite x86bios and update its dependent drivers.jkim2009-10-191-6/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Do not map entire real mode memory (1MB). Instead, we map IVT/BDA and ROM area separately. Most notably, ROM area is mapped as device memory (uncacheable) as it should be. User memory is dynamically allocated and free'ed with contigmalloc(9) and contigfree(9). Remove now redundant and potentially dangerous x86bios_alloc.c. If this emulator ever grows to support non-PC hardware, we may implement it with rman(9) later. - Move all host-specific initializations from x86emu_util.c to x86bios.c and remove now unnecessary x86emu_util.c. Currently, non-PC hardware is not supported. We may use bus_space(9) later when the KPI is fixed. - Replace all bzero() calls for emulated registers with more obviously named x86bios_init_regs(). This function also initializes DS and SS properly. - Add x86bios_get_intr(). This function checks if the interrupt vector is available for the platform. It is not necessary for PC-compatible hardware but it may be needed later. ;-) - Do not try turning off monitor if DPMS does not support the state. - Allocate stable memory for VESA OEM strings instead of just holding pointers to them. They may or may not be accessible always. Fix a memory leak of video mode table while I am here. - Add (experimental) BIOS POST call for vesa(4). This function calls VGA BIOS POST code from the current VGA option ROM. Some video controllers cannot save and restore the state properly even if it is claimed to be supported. Usually the symptom is blank display after resuming from suspend state. If the video mode does not match the previous mode after restoring, we try BIOS POST and force the known good initial state. Some magic was taken from NetBSD (and it was taken from vbetool, I believe.) - Add a loader tunable for vgapci(4) to give a hint to dpms(4) and vesa(4) to identify who owns the VESA BIOS. This is very useful for multi-display adapter setup. By default, the POST video controller is automatically probed and the tunable "hw.pci.default_vgapci_unit" is set to corresponding vgapci unit number. You may override it from loader but it is very unlikely to be necessary. Unfortunately only AGP/PCI/PCI-E controllers can be matched because ISA controller does not have necessary device IDs. - Fix a long standing bug in state save/restore function. The state buffer pointer should be ES:BX, not ES:DI according to VBE 3.0. If it ever worked, that's because BX was always zero. :-) - Clean up register initializations more clearer per VBE 3.0. - Fix a lot of style issues with vesa(4).
* Fix couple of style nits missed in the previous commit.jkim2009-09-251-1/+1
|
* - Use x86bios_offset() instead of BIOS_PADDRTOVADDR() macro.[1]jkim2009-09-251-14/+23
| | | | | | | | | | | | | | | - Clear all registers before calling real mode interrupt handlers as we did for dpms and vesa and re-enable the function as it should be fixed by this. - Tidy up register access. For example, when we call INT 0x15, AH=0xc0, we used to initialize AX=0xc000 to clear AL at the same time but it is very confusing. We don't have to do this any more because we are explicitly clearing all registers now. - Check size of system configuration table although it is almost always 8. This is to make sure we are not reading some random low physical memory. Hopefully it is just zero in that case. :-) - Fix some style nits and add more comments. Submitted by: paradox (ddkprog yahoo com)[1]
* - Use FreeBSD function naming convention.jkim2009-09-241-3/+3
| | | | | | | - Change x86biosCall() to more appropriate x86bios_intr().[1] Discussed with: delphij, paradox (ddkprog yahoo com) Submitted by: paradox (ddkprog yahoo com)[1]
* Move sys/dev/x86bios to sys/compat/x86bios.jkim2009-09-231-1/+1
| | | | | | It may not be optimal but it is clearly better than the old place. OK'ed by: delphij, paradox (ddkprog yahoo com)
* Temporarily disable typematic retrieving code until we get a real fix,delphij2009-09-221-2/+2
| | | | | | | which currently causes hangs in some configurations. Reported by: joel Submitted by: swell.k at gmail.com
* Allow atkbd to obtain keyboard repeat rate from BIOS on amd64.delphij2009-09-211-19/+18
| | | | Submitted by: swell.k at gmail.com
* Prevent atkbd(4) interrupt handler from calling keyboard callback functionemax2009-04-171-2/+4
| | | | | | | | | | when polled mode is enabled. This should help with duplicated/missing characters problem at mountroot, geli, etc. prompts on multi CPU systems while kbdmux(4) is enabled. Tested by: Tobias Grosser <grosser -at- fim -dot- uni-passau -dot- de> Tested by: Fabian Keil <freebsd-listen -at- fabiankeil -dot- de> MFC after: 3 days
* Remove explicit calls to keyboard methods with their respective variantswkoszek2007-12-291-4/+4
| | | | | | | | | | | | | | | 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
* Fix LEDs not working when atkbd is an active keyboard and the physicalru2006-10-251-16/+16
| | | | | | | | | | | | | | | | | | | | keyboard is attached only after the system has already booted. If USB keyboard is also present, and there's no kbdmux(4), the problem has been hiding itself because as soon as we get to multi-user, the USB keyboard becomes an active keyboard (see devd.conf), thus marking atkbd inactive and letting the old code initialize the keyboard. With kbdmux(4), or if there's no USB keyboard, the atkbd keyboard is always active, whether it's physically attached or not, thus it never initialized itself properly on a physical attach. To fix this, move block that initialized the keyboard on attach upper so it doesn't depend on the (KBD_IS_ACTIVE(kbd) && KBD_IS_BUSY(kbd)) condition. Also move KBD_FOUND_DEVICE() a few lines upper so that KDSETLED and KDSETREPEAT that follow it propagate to the controller. MFC after: 3 days
* Fix our ioctl(2) implementation when the argument is "int". Newru2006-09-271-0/+33
| | | | | | | | | | | | | ioctls passing integer arguments should use the _IOWINT() macro. This fixes a lot of ioctl's not working on sparc64, most notable being keyboard/syscons ioctls. Full ABI compatibility is provided, with the bonus of fixing the handling of old ioctls on sparc64. Reviewed by: bde (with contributions) Tested by: emax, marius MFC after: 1 week
* Send the pcvt(4) driver off to retirement.phk2006-05-171-3/+0
|
* Remove various bits of conditional Alpha code and fixup a few comments.jhb2006-05-121-1/+1
|
* Use the same method for detecting actual presence of AT-style keyboardsobomax2006-04-261-5/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | controller as we use in boot blocks (querying status register until bit 1 goes off). If that doesn't happed during reasonable period assume that the hardware doesn't have AT-style keyboard controller. This makes FreeBSD working almost OOB on MacBook Pro (still there are issues with putting second CPU core on-line, but since installation CD comes with UP kernel with this change one should be able to install FreeBSD without playing tricks with hints). Other legacy-free hardware (e.g. IBM NetVista S40) should benefit from this as well, but since I don't have any I can't verify. It should make no difference on the ordinary i386 hardware (since in that case that hardware already would be having an issues with A20 routines in boot blocks). I don't know much about AT-style keyboard controller on other platforms (and don't have dedicated access to one), therefore, the code is restricted to i386 for now. I suspect that amd64 may need this as well, but I would rather leave this decision to someone who knows better about the platform(s) in question. I have tested this change on as many "ordinary i386 boxes" as I can get my hands on, and it doesn't create any false negatives on hardware with AT-style keyboard present. MFC after: 1 month
* - Hook up the new locations of the atkbdc(4), atkbd(4) and psm(4) sourcemarius2005-06-101-7/+36
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* plug memory leaksam2005-02-261-18/+37
| | | | Noticed by: Coverity Prevent analysis tool
* Add a new flag to the atkbd(4) driver to disable testing the keyboardjhb2004-12-151-1/+2
| | | | | | | | | | | 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
* Remove atdevbase and replace it's remaining uses with direct references tojhb2004-06-101-0/+1
| | | | KERNBASE instead.
* Assign keycodes for Power, Sleep and Wake keys.fjoe2003-10-071-0/+9
| | | | Submitted by: Eugene Grosbein <eugen@grosbein.pp.ru>
* Use __FBSDID().obrien2003-08-241-1/+3
| | | | Also some minor style cleanups.
* Fix for FAIL_IF_NO_KBD case as expected.simokawa2003-07-131-1/+3
| | | | | | | | Even if we have no AT keyboard, an AT keyboard is registered because it's probed with KB_CONF_PROBE_ONLY flag set during console initialization. Unregister the keyboard if it doesn't present while second probe. This should fix USB keyboard only case without 'kbdcontrol -k /dev/kbd1'.
* - Use the new resource_disabled() helper function to see if devices arejhb2003-07-021-2/+1
| | | | | | | | | | | | disabled. - Change the apm driver to match the acpi driver's behavior by checking to see if the device is disabled in the identify routine instead of in the probe routine. This way if the device is disabled it is never created. Note that a few places (ips(4), Alpha SMP) used "disable" instead of "disabled" for their hint names, and these hints must be changed to "disabled". If this is a big problem, resource_disabled() can always be changed to honor both names.
* Fix some easy, global, lint warnings. In most cases, this meansmarkm2003-04-301-1/+1
| | | | | making some local variables static. In a couple of cases, this means removing an unused variable.
* Deprecate machine/limits.h in favor of new sys/limits.h.kan2003-04-291-2/+1
| | | | | | | Change all in-tree consumers to include <sys/limits.h> Discussed on: standards@ Partially submitted by: Craig Rodrigues <rodrigc@attbi.com>
* Spelling.charnier2003-02-051-1/+1
|
* Replace various spelling with FALLTHROUGH which is lint()ablecharnier2002-08-251-2/+2
|
* GC various bits and pieces of USERCONFIG from all over the place.phk2002-04-091-1/+1
|
* Fix typo: conole -> consoleasmodai2002-04-081-1/+1
| | | | | PR: 33965 Submitted by: Nicola Vitale <nivit@libero.it>
* Return consistent key action codes at key press and releaseyokota2001-07-201-1/+1
| | | | | | | | | | events. Otherwise you would see unexpected results if shift or locking keys are defined to give different actions depending on other shift/locking keys' state. Please keep the ukbd module and the kernel in sync, otherwise the USB keyboard won't work after this change. MFC after: 10 days
* Free the kbd pointer when it isn't NULL, as opposed to when it is.dwmalone2001-01-221-1/+1
| | | | | | This was a typo in the M_ZERO patches. Submitted by: Mike Silbersack <silby@silby.com>
* Convert more malloc+bzero to malloc+M_ZERO.dwmalone2000-12-081-9/+6
| | | | | Submitted by: josh@zipperup.org Submitted by: Robert Drehmel <robd@gmx.net>
* Remove unneeded #include <machine/clock.h>phk2000-10-151-1/+0
|
* Initiate deorbit burn sequence for <machine/console.h>.phk2000-10-081-1/+1
| | | | | | | | | Replace all in-tree uses with necessary subset of <sys/{fb,kb,cons}io.h>. This is also the appropriate fix for exo-tree sources. Put warnings in <machine/console.h> to discourage use. November 15th 2000 the warnings will be converted to errors. January 15th 2001 the <machine/console.h> files will be removed.
* Manipulate with AltGR Led (really CapsLock Led) only in K_XLATE mode, becauseache2000-05-281-1/+2
| | | | | | | | | all other modes not set ALKED flag and it means that CapsLock always turned off for them. Real bug example is X11 which never turn on CapsLock with Russian keyboard. PR: 18651 Submitted by: "Mike E. Matsnev" <mike@po.cs.msu.su>
* - Properly keep track of I/O port resources.yokota2000-03-191-9/+12
| | | | - Use bus_space_read/write() to access the ports.
* One more patch for the atkbd driver. It will make sure that theyokota2000-03-111-0/+12
| | | | | | | | | | | | | | keyboard port and interrupt is enabled and the driver is attached even when the keyboard itself is not present when the system is booting. (This has been the behavior through out 2.X and 3.X, but is somehow broken in 4.0.) # I certainly don't recommend people to `hot-plug' the AT keyboard, # because the interface isn't designed for hot-plugging and such act # will often break the keyboard controller. But, so many people want to # do that anyway... Approved by: jkh
* - Be slightly more cautious and try to make more sure the keyboardyokota2000-02-111-4/+9
| | | | | | | input queue is emptied when initializing the keyboard controller. - Remove an unnecessary `if' statement. Approved by: jkh
* Use config's conditional compilation rather than using #ifdefs that makepeter2000-01-291-5/+0
| | | | | modular compilation harder. I'm doing this because people seem to like cut/pasting examples of bad practices in existing code.
* - Add some comment from bde on the keyboard interrupt.yokota2000-01-201-11/+19
| | | | - Fix obsolete comments.
* Rework shifta/ctla/alta key handling. It appears that there wasyokota2000-01-111-7/+0
| | | | | misunderstanding between the PR originator and me. I hope I got it right this time.
* Obtain the initial key repeat rate setting via BIOS in i386 ifyokota2000-01-101-0/+54
| | | | possible.
OpenPOWER on IntegriCloud