Commit Graph

221 Commits

Author SHA1 Message Date
Eitan Adler
4c8d7275a4 Revert r255152:
It turns out that synaptics_support was turned off by default
because its probing method is too intrusive not because it was unstable.

Once this is fixed it should be enabled once again.

Reported by:	delphij, jkim
2013-09-04 18:42:05 +00:00
Jean-Sébastien Pédron
79d98ecd19 psm: Add support for middle and extended buttons on Synaptics touchpads
PR:		kern/170834
Submitted by:	Brandon Gooch <jamesbrandongooch@gmail.com>
Tested by:	Artyom Mirgorodskiy <artyom.mirgorodsky@gmail.com>
MFC after:	1 month
2013-09-02 19:15:20 +00:00
Eitan Adler
abcdcce124 synaptics and trackpoint support are stable enough to be on by default.
Eventually both options should be removed.

Reviewed by:	dumbbell
2013-09-02 18:25:18 +00:00
Jung-uk Kim
634cf355b0 Remove a bogus re-assignment.
MFC after:	3 days
2013-05-13 20:03:59 +00:00
Jung-uk Kim
78260bb30a List TrackPoint device before generic model. 2013-03-18 23:31:22 +00:00
Jung-uk Kim
569d8f7e27 Add preliminary support for IBM/Lenovo TrackPoint.
PR:		kern/147237 (based on the initial patch for 8.x)
Tested by:	glebius (device detection and suspend/resume)
MFC after:	1 month
2013-03-18 23:22:47 +00:00
Warner Losh
0897438a74 Pass the device_t into atkbd_{probe,attach}_unit and get the
controller unit and keyboard unit from there. It will be needed
for other things in the future as well...
2013-01-11 21:42:23 +00:00
Warner Losh
f0143dac9a style(9) changes before I do more real changes. 2013-01-11 21:19:45 +00:00
Jean-Sébastien Pédron
778dcb1c13 psm: Support detection of Synaptics touchpad v7.5 and above
Starting with firmware v7.5, the "Read TouchPad Modes" ($01) and "Read
Capabilities" ($02) commands changed: previously constant bytes now
carry variable information.

We now compare those bytes to expected constants only for firmware prior
to v7.5.

Tested by:	Zeus Panchenko <zeus@gnu.org.ua>
MFC after:	1 week
2012-12-18 20:02:53 +00:00
Kevin Lo
26f370d011 Fix typo: s/protocl/protocol 2012-09-20 10:07:31 +00:00
John Baldwin
ecbb462c38 Use callout(9) instead of timeout(9) to manage timers. 2012-09-07 19:42:36 +00:00
John Baldwin
fec4b62adf Add another PS/2 keyboard PNP ID. This ID is listed as
"Reserved by Microsoft" in the standard PNP ID table, but has been seen
in the wild on at least one laptop.

PR:		kern/169571
Submitted by:	Matthias Apitz  guru unixarea de
MFC after:	3 days
2012-07-06 12:13:28 +00:00
Jung-uk Kim
a6e69b92e6 Add a PNP ID for Japanese 106-key keyboard.
PR:		kern/166459
MFC after:	3 days
2012-03-28 17:58:37 +00:00
Jung-uk Kim
f9be5550f7 - Do not clobber softc when psm(4) is reintialized.
- Make INITAFTERSUSPEND flag independent of HOOKRESUME flag.
- Automatically set INITAFTERSUSPEND flag when ALPS GlidePoint is detected.
- Always probe Synaptics Touchpad.  Allow MOUSE_SYN_GETHWINFO ioctl and
automatically set INITAFTERSUSPEND flag when a supported device is detected,
regardless of "hw.psm.synaptics_support" tunable setting.
- Update psm(4) to reflect the above changes.
- Remove long-time defunct SYNCHACK flag while I am in the neighborhood.

MFC after:	1 month
2012-03-27 23:43:01 +00:00
Ed Schouten
6472ac3d8a Mark all SYSCTL_NODEs static that have no corresponding SYSCTL_DECLs.
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.
2011-11-07 15:43:11 +00:00
Ed Schouten
78d4d8eeb2 Restore binary compatibility for GIO_KEYMAP and PIO_KEYMAP.
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.
2011-07-17 08:19:19 +00:00
Xin LI
d82aac763c Correct a typo.
Submitted by:	Fabian Keil <fk fabiankeil de>
MFC after:	3 days
2011-06-20 16:42:20 +00:00
Xin LI
97ae66672f Add comments about the validation. 2011-06-11 01:19:19 +00:00
Jung-uk Kim
393ec7ad27 Validate INT 15h and 16h vectors more strictly. Traditionally these entry
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
2011-06-06 23:03:37 +00:00
Jung-uk Kim
7d09e4ab23 Revert r222152. The root cause was analysed and better fix is upcoming.
Discussed with:	delphij
2011-06-06 22:18:40 +00:00
Xin LI
dd4aae65f1 Add a new knob to atkbd(4) to enable typematic rate detection on boot,
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
2011-05-20 22:36:17 +00:00
John Baldwin
a11df0cbe6 Only use the BIOS-supplied IRQ for the atkbdc device for a child atkbd
device.  Specifically, do not reuse it for a child psm device.

Tested by:	many
2010-12-21 12:49:37 +00:00
Tijl Coosemans
81bd5041a2 Merge amd64 and i386 bus.h and move the resulting header to x86. Replace
the original amd64 and i386 headers with stubs.

Rename (AMD64|I386)_BUS_SPACE_* to X86_BUS_SPACE_* everywhere.

Reviewed by:	imp (previous version), jhb
Approved by:	kib (mentor)
2010-12-20 16:39:43 +00:00
John Baldwin
ce7a3e4774 - If the atkbdc device is assigned an IRQ resource by ACPI or the PnPBIOS,
allow the child atkbd device to reuse that IRQ resource instead of
  reallocating the same IRQ from the parent bus inside the atkbd driver.
- Don't allocate a shared IRQ for the atkbd driver.  For AT keyboard
  devices on an ISA bus the IRQ is not shareable.  Instead, the bus driver
  should mark the IRQ shareable if the bus supports shared IRQs.
- Don't identify child devices until after the atkbdc device itself has
  attached.
2010-12-16 17:14:37 +00:00
John Baldwin
2f29acd7ec - When moving the IRQ resource from the psmcpnp device to the psm device,
delete the IRQ resource from the psmcpnp device completely.
- Don't allocate the IRQ resource shared.  It is not a shareable interrupt
  on ISA.  The bus driver can set RF_SHAREABLE if the IRQ is actually
  shareable on a non-ISA bus.
2010-12-16 17:08:43 +00:00
John Baldwin
d2014f5180 Various small typos and grammar nits in comments. 2010-11-18 22:17:20 +00:00
Andriy Gapon
3d844eddb7 bus_add_child: change type of order parameter to u_int
This reflects actual type used to store and compare child device orders.
Change is mostly done via a Coccinelle (soon to be devel/coccinelle)
semantic patch.
Verified by LINT+modules kernel builds.

Followup to:	r212213
MFC after:	10 days
2010-09-10 11:19:03 +00:00
Ed Schouten
1901fd2ffe Let psm(4) use si_drv1 to refer to its softc. 2010-09-09 07:52:15 +00:00
Maxim Sobolev
ff605594dd On certain chipsets AT keyboard controller isn't present and is
emulated by BIOS using SMI interrupt. On those chipsets reading
from the status port may be thousand times slower than usually.
Sometimes this emilation is not working properly resulting in
commands timing out and since we assume that inb() operation
takes very little time to complete we need to adjust number of
retries to keep waiting time within a designed limits (100ms).
Measure time it takes to make read_status() call and adjust
number of retries accordingly.

To keep it simple, use TSC to measure inb() performance and
keep it to amd64-only, since TSC may not available on older
CPUs.

Also enable detection of the AT controller absence on amd64.

Reviewed by:	jhb
MFC after:	1 month
2010-04-29 06:16:00 +00:00
Jean-Sébastien Pédron
b469a43897 Add new "hw.psm.tap_enabled" tunable and sysctl.
This tunable allows one to enable (1) or disable (0) gestures like tap
and tap-hold on Synaptics TouchPad when the Extended mode isn't enabled
(ie. "hw.psm.synaptics_support" not set).

By default, the value is -1 in order to keep the current behaviour of
not enabling/disabling gestures explicitly.

PR:		kern/139272
Submitted by:	David Horn <dhorn2000 AT gmail DOT com>
Reviewed by:	David Horn <dhorn2000 AT gmail DOT com>
2009-12-18 17:46:57 +00:00
Jung-uk Kim
3219f535d9 Rewrite x86bios and update its dependent drivers.
- 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).
2009-10-19 20:58:10 +00:00
Jung-uk Kim
7ca724d57b Fix couple of style nits missed in the previous commit. 2009-09-25 20:06:31 +00:00
Jung-uk Kim
ee8cbcb471 - Use x86bios_offset() instead of BIOS_PADDRTOVADDR() macro.[1]
- 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]
2009-09-25 19:49:07 +00:00
Jung-uk Kim
a867274808 - Use FreeBSD function naming convention.
- Change x86biosCall() to more appropriate x86bios_intr().[1]

Discussed with:	delphij, paradox (ddkprog yahoo com)
Submitted by:	paradox (ddkprog yahoo com)[1]
2009-09-24 19:24:42 +00:00
Jung-uk Kim
19de5df5e5 Move sys/dev/x86bios to sys/compat/x86bios.
It may not be optimal but it is clearly better than the old place.

OK'ed by:	delphij, paradox (ddkprog yahoo com)
2009-09-23 20:49:14 +00:00
Xin LI
bacfa53de3 Temporarily disable typematic retrieving code until we get a real fix,
which currently causes hangs in some configurations.

Reported by:	joel
Submitted by:	swell.k at gmail.com
2009-09-22 20:12:10 +00:00
Xin LI
8b1620e069 Allow atkbd to obtain keyboard repeat rate from BIOS on amd64.
Submitted by:	swell.k at gmail.com
2009-09-21 08:24:22 +00:00
John Baldwin
a56fe095f0 Temporarily revert the new-bus locking for 8.0 release. It will be
reintroduced after HEAD is reopened for commits by re@.

Approved by:	re (kib), attilio
2009-08-20 19:17:53 +00:00
Attilio Rao
444b91868b Make the newbus subsystem Giant free by adding the new newbus sxlock.
The newbus lock is responsible for protecting newbus internIal structures,
device states and devclass flags. It is necessary to hold it when all
such datas are accessed. For the other operations, softc locking should
ensure enough protection to avoid races.

Newbus lock is automatically held when virtual operations on the device
and bus are invoked when loading the driver or when the suspend/resume
take place. For other 'spourious' operations trying to access/modify
the newbus topology, newbus lock needs to be automatically acquired and
dropped.

For the moment Giant is also acquired in some key point (modules subsystem)
in order to avoid problems before the 8.0 release as module handlers could
make assumptions about it. This Giant locking should go just after
the release happens.

Please keep in mind that the public interface can be expanded in order
to provide more support, if there are really necessities at some point
and also some bugs could arise as long as the patch needs a bit of
further testing.

Bump __FreeBSD_version in order to reflect the newbus lock introduction.

Reviewed by:    ed, hps, jhb, imp, mav, scottl
No answer by:   ariff, thompsa, yongari
Tested by:      pho,
                G. Trematerra <giovanni dot trematerra at gmail dot com>,
                Brandon Gooch <jamesbrandongooch at gmail dot com>
Sponsored by:   Yahoo! Incorporated
Approved by:	re (ksmith)
2009-08-02 14:28:40 +00:00
Maksim Yevmenkin
018cd707c0 Prevent atkbd(4) interrupt handler from calling keyboard callback function
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
2009-04-17 00:30:56 +00:00
Robert Noland
910ac6da21 Teach psm about O_ASYNC
This makes Xorg happy if you aren't using moused.

MFC after:	3 days
2009-03-16 08:21:51 +00:00
Warner Losh
66a149db32 bus_add_child takes a const char *. 2009-02-05 18:38:39 +00:00
Jean-Sébastien Pédron
c9d986fe54 Synaptics touchpads must be reinitialized after suspend/resume.
This fixes touchpad resume on Asus EeePC among others.

Submitted by:	rpaulo
2008-12-17 10:42:53 +00:00
Jean-Sébastien Pédron
e3c46ebb60 Rephrase and/or fix some comments in Synaptics touchpad initialization
function.
2008-12-16 09:51:13 +00:00
Jean-Sébastien Pédron
19ff29fb35 Rewrite Synaptics touchpads support with the following goals in mind:
o  better quality of the movement smoothing
    o  more features such as tap-hold and virtual scrolling

Support must still be enabled with this line in your /boot/loader.conf:
    hw.psm.synaptics_support="1"

The following sysctls were removed:
    hw.psm.synaptics.low_speed_threshold
    hw.psm.synaptics.min_movement
    hw.psm.synaptics.squelch_level

An overview of this new driver and a short documentation about the added
sysctls is available on the wiki:
http://wiki.freebsd.org/SynapticsTouchpad
2008-10-14 17:48:36 +00:00
Ed Schouten
6bfa9a2d66 Replace all calls to minor() with dev2unit().
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
2008-09-27 08:51:18 +00:00
Tom Rhodes
ad291f81da Fill in sysctl descriptions.
Approved by:	philip
2008-07-26 00:01:19 +00:00
Philip Paeps
be38401738 Try to detect a Synaptics touchpad before IntelliMouse. Some touchpads will
pretend to be IntelliMouse (which have a few more features than generic mice)
causing the IntelliMouse probe to work and the Synaptics code never to be
called.

This should not break "real" IntelliMouse because the Synaptics detection code
is fairly specific.

PR:		kern/120833
Submitted by:	Eygene Ryabinkin <rea-fbsd -at- codelabs.ru>
MFC after:	1 week
2008-06-01 13:44:51 +00:00
Jung-uk Kim
fb4865e7de Clean up and fix style(9) nits. 2008-04-08 19:09:45 +00:00
Jung-uk Kim
ff0af72c39 - Add write(2) support for psm(4) in native operation level. Now arbitrary
commands can be written to /dev/psm%d and status can be read back from it.
- Reflect the change in psm(4) and bump version for ports.

MFC after:	1 week
2008-04-08 17:55:26 +00:00