Commit Graph

1340 Commits

Author SHA1 Message Date
Marius Strobl
c7974ff135 Fix an endianness issue in pnp_eisaformat(). This corrects printing PnP IDs
on big-endian archs like sparc64, e.g.:
uart0: <16550 or compatible> at port 0x3f8-0x3ff irq 43 pnpid @HEd041 on isa0
is now correctly printed as:
uart0: <16550 or compatible> at port 0x3f8-0x3ff irq 43 pnpid PNP0501 on isa0

There are probably other endianness issues lurking in the PnP code which
however aren't exhibited on sparc64 as the PnP devices there are sort of
PnP BIOS devices rather than ISA PnP devices.

Tested on:	i386, sparc64
MFC after:	1 week
2005-09-28 15:01:58 +00:00
Warner Losh
a81804d94f Add pnp and location info for the ISA bus. The pnp info is the
primary vendor id for this device.  The location is empty because ISA
doesn't give one a way to generally locate a card.  PNP BIOS entries
do provide a way to locate cards, as do isa pnp cards.  These
locations will be added as soon as the code to remember them is
written.
2005-08-01 07:03:10 +00:00
John Baldwin
db015a9153 Fixup some more fallout from the lapic/i8254 changes:
- Make sure timer0_max_count is set to a correct value in the lapic case.
- Revert i8254_restore() to explicitly reprogram timer 0 rather than
  calling set_timer_freq() to do it.  set_timer_freq() only reprograms
  the counter if the max count changes which it never does on resume.  This
  unbreaks suspend/resume for several people.

Tested by:	marks, others
Reviewed by:	bde
MFC after:	3 days
2005-07-13 15:43:21 +00:00
John Baldwin
623b1a868e Remove a || 1 that crept into the i8254 commit and was subsequently
copied and pasted.  I had actually tested without this change in my
trees as had the other testers.

Reported by:	bde, Rostislav Krasny rosti dot bsd at gmail dot com
Approved by:	re (scottl)
Pointy hat to:	jhb
2005-07-05 20:13:12 +00:00
John Baldwin
7df0015945 Use a simpler implementation for the i8254 timecounter when using the lapic
timer since irq0 isn't being driven at hz in that case and we don't need to
try to handle edge cases with rollover, etc. that require irq0 to be firing
for the timecounter to actually work.

Submitted by:	phk
Tested by:	schweikh
Approved by:	re (scottl)
2005-07-01 15:47:27 +00:00
Marius Strobl
520b635320 - Hook up the new locations of the atkbdc(4), atkbd(4) and psm(4) source
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
2005-06-10 20:56:38 +00:00
Yoshihiro Takahashi
d4fcf3cba5 Remove bus_{mem,p}io.h and related code for a micro-optimization on i386
and amd64.  The optimization is a trivial on recent machines.

Reviewed by:	-arch (imp, marcel, dfr)
2005-05-29 04:42:30 +00:00
Yoshihiro Takahashi
b22bf66063 - Move bus dependent defines to {isa,cbus}_dmareg.h.
- Use isa/isareg.h rather than <arch>/isa/isa.h.

Tested on: i386, pc98
2005-05-14 10:14:56 +00:00
Yoshihiro Takahashi
24072ca35b - Move timerreg.h to <arch>/include and split i8253 specific defines into
i8253reg.h, and add some defines to control a speaker.
- Move PPI related defines from i386/isa/spkr.c into ppireg.h and use them.
- Move IO_{PPI,TIMER} defines into ppireg.h and timerreg.h respectively.
- Use isa/isareg.h rather than <arch>/isa/isa.h.

Tested on: i386, pc98
2005-05-14 09:10:02 +00:00
Yoshihiro Takahashi
d6c331a30d Remove unused IO_NPX* defines. 2005-05-12 12:36:31 +00:00
Matthew N. Dodd
2ca94fca7e Add ISACFGATTR_HINTS flag to allow detection of a device that was created
as a result of the hints mechanism.
2005-04-13 03:26:24 +00:00
Matthew N. Dodd
93fa9a8d72 Replace spl protection in rtcin() and writertc() with spinlocks
using the existing clock_lock mutex.
2005-04-12 20:49:31 +00:00
John Baldwin
d336ab43c6 - Don't enable periodic interrupts from the RTC by default in rtc_statusb.
Instead, explicitly enable them when we setup the interrupt handler.
  Also, move the setting of stathz and profhz down to the same place so
  that the code flow is simpler and easier to follow.
- Don't setup an interrupt handler for IRQ0 if we are using the lapic timer
  as it doesn't do anything productive in that case.
2005-03-24 21:34:16 +00:00
Warner Losh
36fed96550 Use STAILQ in preference to SLIST for the resources. Insert new resources
last in the list rather than first.

This makes the resouces print in the 4.x order rather than the 5.x order
(eg fdc0 at 0x3f0-0x3f5,0x3f7 is 4.x, but 0x3f7,0x3f0-0x3f5 is 5.x).  This
also means that the pci code will once again print the resources in BAR
ascending order.
2005-03-18 05:19:50 +00:00
Peter Wemm
0cd202bb09 Whitespace sync with amd64. (Rather than re-add the extra blank lines
on amd64, I'm removing them here)
2005-03-11 22:10:25 +00:00
John Baldwin
dd1d2889f2 - Remove the BURN_BRIDGES marked support for hooking into the ISA timer 0
interrupt.
- Remove the timer_func variable as it now has a static value of
  hardclock() and is only used in one place.

Axe borrowed from:	phk
2005-03-09 15:33:58 +00:00
Ian Dowse
528433ba71 Save and restore the VGA state across a suspend-resume cycle. This
is particularly useful when VESA is available (either `options VESA'
or load the vesa module), as BIOSes in some notebooks may correctly
save and restore LCD panel settings using VESA in cases where calling
the video BIOS POST is not effective. On some systems it may also
be necessary to set the hw.acpi.reset_video sysctl to 0.
2005-02-28 21:06:14 +00:00
Poul-Henning Kamp
e70377df79 Use dynamic major number allocation. 2005-02-27 22:16:30 +00:00
John Baldwin
e8ce55117b Use the local APIC timer to drive the various kernel clocks on SMP machines
rather than forwarding interrupts from the clock devices around using IPIs:
- Add an IDT vector that pushes a clock frame and calls
  lapic_handle_timer().
- Add functions to program the local APIC timer including setting the
  divisor, and setting up the timer to either down a periodic countdown
  or one-shot countdown.
- Add a lapic_setup_clock() function that the BSP calls from
  cpu_init_clocks() to setup the local APIC timer if it is going to be
  used.  The setup uses a one-shot countdown to calibrate the timer.  We
  then program the timer on each CPU to fire at a frequency of hz * 3.
  stathz is defined as freq / 23 (hz * 3 / 23), and profhz is defined as
  freq / 2 (hz * 3 / 2).  This gives the clocks relatively prime divisors
  while keeping a low LCM for the frequency of the clock interrupts.
  Thanks to Peter Jeremy for suggesting this approach.
- Remove the hardclock and statclock forwarding code including the two
  associated IPIs.  The bitmap IPI handler has now effectively degenerated
  to just IPI_AST.
- When the local APIC timer is used we don't turn the RTC on at all, but
  we still enable interrupts on the ISA timer 0 (i8254) for timecounting
  purposes.
2005-02-08 20:25:07 +00:00
Poul-Henning Kamp
0c3c54da63 Since we are quite unlikely to ever face another platform which
uses the i8237 without trying to emulate the PC architecture move
the register definitions for the i8237 chip into the central include
file for the chip, except for the PC98 case which is magic.

Add new isa_dmatc() function which tells us as cheaply as possible
if the terminal count has been reached for a given channel.
2005-02-06 13:46:39 +00:00
John Baldwin
aa96fcdb61 Anytime we write to the RTC's status B register to possibly enable
interrupts, read from the interrupt status register to clear any pending
interrupts.  Otherwise in some rare cases the RTC would never fire any
interrupts as it constantly thinks it has an interrupt pending.

PR:		i386/17800
PR:		kern/76776
Submitted by:	Jose M. Alcaide jose at we dot lc dot ehu dot es
MFC after:	2 weeks
2005-02-03 19:06:03 +00:00
Warner Losh
784d07b40d Protect against wrapping. This appaers to fix some hangs that people
have seen in the isa pnp case where a resource buts up against
0xffffffff.  This would only impact when the board was booted without
ACPI.

Submitted by: Ed Maste (freebsd-stable <20050103145720.GA90754@sandvine.com>)
MFC After: 5 days
2005-01-23 03:03:58 +00:00
Philip Paeps
df616c9022 Make life for owners of Synaptics Touchpads more pleasant :-)
o Implement a shiny new algorithm to keep track of finger movement at
   slow speeds.  This dramatically reduces the level of questionable
   language from users trying to resize windows.

 o Properly catch the many extra buttons and dials which manufacturers
   are known to screw onto Synaptics touchpad controllers.  Currently,
   up to seven buttons are known to work, more should work too.

 o Add a number of sysctls allowing one to tune the driver to taste in
   a simple way:

     # Should the extra buttons act as axes or as middle button
     hw.psm.synaptics.directional_scrolls

     # These control the 'stickiness' at low speeds
     hw.psm.synaptics.low_speed_threshold
     hw.psm.synaptics.min_movement
     hw.psm.synaptics.squelch_level

PR:		kern/75725
Submitted by:	Jason Kuri <jay@oneway.com>
MFC after:	1 month
2005-01-10 13:05:58 +00:00
Warner Losh
86cb007f9f /* -> /*- for copyright notices, minor format tweaks as necessary 2005-01-06 22:18:23 +00:00
Philip Paeps
9fd851bb17 Reduce diffs to work in progress before checking in serious changes.
o Move the sysctls under debug.psm.* and hw.psm.* making them a bit
   clearer and more consistent with other drivers.

 o Remove the debug.psm_soft_timeout sysctl.  It was introduced many
   moons ago in r1.64 but never referenced anywhere.

 o Introduce hw.psm.tap_threshold and hw.psm.tap_timeout to control
   the behaviour of taps on touchpads.  People might like to fiddle
   with these if tapping seems to slow or too fast for them.

 o Add debug.psm.loglevel as a tunable so that verbosity can be set
   easily at boot-time (to watch probes and such) without having to
   compile a kernel with options PSM_DEBUG=N.
2005-01-03 13:19:49 +00:00
Warner Losh
9b01161ec3 Formatting nits 2004-12-27 18:18:38 +00:00
Warner Losh
812fb8f294 Get rid of #ifdef for legacy system. Move that into the MD code.
Export minimal symbols to allow this to happen.
2004-12-24 23:03:17 +00:00
Warner Losh
09aafea1c6 A few style(9) changes before more extensive changes:
o u_intXX_t -> uintXX_t
o use 8 character tabs
o proper wrapping
o return (value);
2004-12-24 22:31:47 +00:00
Warner Losh
934bd5ede9 Make the other pnp messages more explicit as well... 2004-12-24 22:18:19 +00:00
Warner Losh
2e63992f34 Note when we're done probing PNP. There's been several reports over the
years of hangs that turned out to be in the PNP code.  Add an explicit end
marker so such hangs are more apparent.
2004-12-24 22:16:06 +00:00
Warner Losh
7a83aa6339 Various style(9) items before of some more extensive work:
o return (value);
o u_intXX_t -> uintXX_t
o break lines
o consistantly use 8 space tab stops
o minor grammar nits in a few printfs
2004-12-24 22:08:57 +00:00
Warner Losh
b4e9316e7b GC #if 0'd code. It can go away now... 2004-12-24 21:53:21 +00:00
Warner Losh
993fd0c509 PNP BIOS devices are fundamentally different than ISA PNP devices.
These devices should be probed first because they are at fixed
locations and cannot be turned off.  ISA PNP devices, on the other
hand, can be turned off and often can be flexible in the resources
they use.  Probe them last, as always.
2004-12-07 05:30:02 +00:00
Poul-Henning Kamp
61eb992fc2 Stop printing the VGA registers during verbose boot, in order to not
needlessly overflow the msgbuffer.  Can be reenabled if somebody ever
takes an interest in syscons again.
2004-11-03 09:07:44 +00:00
Nate Lawson
e5979322ba Remove local hacks to set flags now that the device probe does this for us.
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
2004-10-14 22:21:59 +00:00
Philip Paeps
34ed91b45b Introduce a tunable to disable support for Synaptics touchpads. A number of
people have reported problems (stickyness, aiming difficulty) which is proving
difficult to fix, so this will default to disable until sometime after 5.3R.

To enable Synaptics support, set the 'hw.psm.synaptics_support=1' tunable.

MT5 candidate.

Approved by:	njl
2004-09-29 23:49:57 +00:00
Peter Wemm
2169193596 Converge towards i386. I originally resisted creating <machine/pc/bios.h>
because it was mostly irrelevant - except for the silly BIOS_PADDRTOVADDR
etc macros.  Along the way of working around this, I missed a few things.

* Make syscons properly inherit the bios capslock/shiftlock/etc state like
  i386 does.  Note that we cannot inherit the bios key repeat rate because
  that requires a bios call (which is impossible for us).
* Give syscons the ability to beep on amd64.  Oops.

While here, make bios.c compile and add it to files.amd64.
2004-09-24 01:08:34 +00:00
Poul-Henning Kamp
7ce1979be6 Add new a function isa_dma_init() which returns an errno when it fails
and which takes a M_WAITOK/M_NOWAIT flag argument.

Add compatibility isa_dmainit() macro which whines loudly if
isa_dma_init() fails.

Problem uncovered by:	tegge
2004-09-15 12:09:50 +00:00
Justin T. Gibbs
5fb0f52712 Improve sync recovery algorithm:
o Remove PSM_SYNCERR_THRESHOLD1.  This value specified how many sync
   errors were required before the mouse is re-initialised.
   Re-initialisation is now done after (packetsize * 2) sync errors as
   things aren't likely to improve after that.

 o Reset lastinputerror when re-initialisation occurs.  We don't want
   to continue to drop data after re-initialisation.

 o Count the number of failed packets independently of the syncerrors
   statistic.  syncerrors is useful for recovering sync within a single
   packet.  pkterrors allows us to detect when the mouse changes its
   packet mode due to some external event (e.g. KVM switch).

 o Reinitialize the mouse if we see more than psmpkterrthresh errors
   during the validation period.  The validation period begins as soon
   as a sync error is detected and continues until psmerrsecs/msecs
   time has elapsed.  The defaults for these two values force a reset
   if we see two packet errors in a 2 second period.  This allows rapid
   detection of packet framing errors caused by the mouse changing packet
   modes.

 o Export psmpkterrthresh as a sysctl

 o Export psmloglevel as a sysctl.

 o Enable more debugging code to be enabled at runtime via psmloglevel.

 o Simplify verbose conditioned loging by using a VLOG macro.

 o Add several comments describing the sync recovery algorithm of
   this driver.

Large Portions by: Brian Somers <brian@Awfulhak.org>
Inspired and Frustrated by: Belkin KVMs
Reviewed by: njl, philip
2004-08-27 21:25:16 +00:00
Justin T. Gibbs
e55a65d092 Defer the capture of the "expected sync bits" until the first "normal"
data packet is received from the mouse.  In the case of many KVM's,
this avoids a bug in their mouse emulation that sends back incorrect
sync when you explicitly request a data packet from the mouse.  Without
this change, you must force the driver into stock PS/2 mode or be flooded
with a never ending stream of "out of sync" messages on these KVMs.

Approved by: re
2004-08-17 18:12:37 +00:00
Philip Paeps
5459a0063b Don't initialize static variables to 0 (C should just take care of that).
Spotted by:	njl
2004-08-16 20:19:09 +00:00
Philip Paeps
8547e74f4f Update support for Synaptics Touchpads (Volume V)
o Add (long awaited) support for guest devices

Submitted by:	Arne Schwabe <arne@rfc2549.org>
Approved by:	njl (in a former revision)
2004-08-16 16:28:27 +00:00
Philip Paeps
c4dbfe3893 Assume a finger of regular width when no width value is reported by
the touchpad (which happens when it has no extended capabilities).

Spotted by:	dhw
Forgotten by:	philip
2004-08-08 01:26:00 +00:00
Philip Paeps
1b5dd3aee5 Update support for Synaptics Touchpads (Volume IV)
o Change the motion calculation to result in
   a more reasonable speed of motion

This should fix the 'aiming' problems people have reported.  It also
mitigates (but doesn't completely solve) the 'stalling' problems at
very low speeds.

Tested by:	many subscribers to -current
Approved by:	njl
2004-08-08 01:10:23 +00:00
Philip Paeps
bc1418f61c Update support for Synaptics Touchpads (Volume III)
o Catch 'taps' as button presses

 o One finger sends button1, two fingers send button3,
   three fingers send button2 (double-click)

Tested by:	many subscribers to -current
Approved by:	njl
2004-08-08 01:00:31 +00:00
Philip Paeps
7589cb5cae Update support for Synaptics Touchpads (Volume II)
o Handle the 'up/down' buttons some touchpads have as
   a z-axis (scrollwheel) as recommended by the specs

 o Report the buttons as button4 and button5 instead
   of button2 and button4, button2 can be emulated by
   pressing button1 and button3 simultaneously.  This
   allows one to use the two extra buttons for other
   purposes if one so desires.

Tested by:	many subscribers to -current
Approved by:	njl
2004-08-08 00:57:07 +00:00
Philip Paeps
4079d722ac Update support for Synaptics Touchpads (Volume I)
o Clean up whitespace and comments in the
   enable_synaptics() probing function

 o Only use (and rely on) the extended capability
   bits when we are told they actually exist

 o Partly ignore the (possibly dated?) part of the
   specification about the mode byte so that we
   can support 'guest devices' too.

Tested by:	many subscribers to -current
Approved by:	njl
2004-08-08 00:52:11 +00:00
Nate Lawson
a4cdf60c7d Add support for the Synaptics Touchpad mouse driver. I reworked the
submitted version with style cleanups and changes to comments.  I also
modified the ioctl interface.  This version only has one ioctl (to get
the Synaptics-specific config parameters) since this is the only
information a user might want.

Submitted by:	Arne Schwabe <arne -at- rfc2549.org>
2004-07-30 00:59:40 +00:00
Maxime Henrion
d49311a74f Ignore more strange return values of the test_aux_port() function,
because some notebooks (apparently Compaq, Toshiba and Acer ones)
erroneously return 2 or 3 there.

PR:		kern/61482, kern/54188
Submitted by:	Ulf Lilleengen <lulf@kerneled.org>,
		Victor Balada Diaz <victor@alf.dyndns.ws>
MFC after:	3 days
2004-07-16 22:04:29 +00:00
Marcel Moolenaar
45cfc0a914 Partially revert previous commit. Calling getit() unconditionally fixed
a problem that could also be fixed differently without reverting previous
attempts to fix DELAY while the debugger is active (rev 1.204). The bug
was that the i8254 implements a countdown timer, while for (k)db_active
a countup timer was implemented. This resulted in premature termination
and consequently the breakage of DELAY. The fix (relative to rev 1.211)
is to implement a countdown timer for the kdb_active case. As such the
ability to step clock initialization is preserved and DELAY does what is
expected of it.

Blushed: bde :-)
Submitted by: bde
2004-07-11 17:50:59 +00:00