Commit Graph

1432 Commits

Author SHA1 Message Date
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
Marcel Moolenaar
7f46949fdf Call getit() unconditionally and only grab clock_lock when the
debugger is not active. The fixes breakages of DELAY() when
running in the debugger, because not calling getit() when the
debugger is active yields a DELAY that doesn't.
2004-07-10 22:16:18 +00:00
Warner Losh
969947cbe7 These option roms are defined in the ISA standard, and in the ISA
hole, so call them ISA Options rom(s).
2004-07-05 17:26:04 +00:00
Poul-Henning Kamp
89c9c53da0 Do the dreaded s/dev_t/struct cdev */
Bump __FreeBSD_version accordingly.
2004-06-16 09:47:26 +00:00
John Baldwin
092a5c4530 Remove atdevbase and replace it's remaining uses with direct references to
KERNBASE instead.
2004-06-10 20:31:00 +00:00
Poul-Henning Kamp
5dba30f15a add missing #include <sys/module.h> 2004-05-30 20:27:19 +00:00
Poul-Henning Kamp
41ee9f1c69 Add some missing <sys/module.h> includes which are masked by the
one on death-row in <sys/kernel.h>
2004-05-30 17:57:46 +00:00
Warner Losh
6cd91141eb Move fdc from isa/fd.c to dev/fdc/fdc.c. The old files were
repocopied.  Soon there will be additional bus attachments and
specialization for isa, acpi and pccard (and maybe pc98's cbus).

This was approved by nate, joerg and myself.  bde dissented on the new
location, but appeared to be OK after some discussion.
2004-05-17 05:46:16 +00:00
John Baldwin
d4d4ece72d Trim unused includes. 2004-05-11 20:14:53 +00:00
John Baldwin
f9acc6410e - The i8254 uses IRQ 0, not IRQ 8. Correct i8254_intsrc to reference the
correct interrupt source.
- Cache a pointer to the i8254_intsrc's pending method to avoid several
  pointer indirections in i8254_get_timecount().

Reported by:	bde
2004-04-27 20:03:26 +00:00
Bruce Evans
a3a10d1c3c Fixed breakage of the formatting operation in rev.1.266. The wrong
clause of an if-else statement was removed.

Reviewed by:	no response from maintainer in 12 days
2004-04-25 04:33:56 +00:00
Maxime Henrion
0335702b9f Don't check for device_get_softc() returning NULL, it can't happen. 2004-04-17 10:25:04 +00:00
Warner Losh
f36cfd49ad Remove advertising clause from University of California Regent's
license, per letter dated July 22, 1999 and email from Peter Wemm,
Alan Cox and Robert Watson.

Approved by: core, peter, alc, rwatson
2004-04-07 20:46:16 +00:00
Mark Murray
44e421c906 Put a bunch of output that us really only useful in a debug
scenario into #ifdef DEBUG. This makes my cluster with Belkin
KVM switch completely usable, even if the KVM switch and mouse
get a bit confused sometimes.

Without this, when the mouse gets confused, all sorts of crud
gets spammed all over the screen. With this, the mouse may appear
dead for a second or three, but it recovers silently.
2004-04-04 16:36:21 +00:00
Nate Lawson
5f96beb9e0 Convert callers to the new bus_alloc_resource_any(9) API.
Submitted by:	Mark Santcroos <marks@ripe.net>
Reviewed by:	imp, dfr, bde
2004-03-17 17:50:55 +00:00
Poul-Henning Kamp
db42ff97da Remove unused FDNUMTOUNIT() macro 2004-02-29 10:21:40 +00:00
Poul-Henning Kamp
503799ea5c Make mode setting with fdcontrol(8) stick.
Recognize when configured for "auto".
2004-02-25 13:44:58 +00:00
Poul-Henning Kamp
dc08ffec87 Device megapatch 4/6:
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.
2004-02-21 21:10:55 +00:00
Poul-Henning Kamp
c9c7976f7f Device megapatch 1/6:
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.
2004-02-21 19:42:58 +00:00
Nate Lawson
64746d0689 Workaround some ACPI BIOSen which break the IO port into multiple
resources.  (Note that the correct range is 0x3f7,0x3f0-0x3f5.)  Such
devices will be detected as follows:

  fdc0: <Enhanced floppy controller (i82077, NE72065 or clone)> port
  0x3f7,0x3f4-0x3f5,0x3f2-0x3f3,0x3f0-0x3f1 irq 6 drq 2 on acpi0

To do this, we find the minimum and maximum start addresses for the
resources and use them as the base for the IO and control ports.

Help from:	jhb
2004-02-15 20:30:22 +00:00
Alfred Perlstein
de75fd6d2b Significantly reduce the "jitter" that is typical for PS/2 mice
when using a KVM.

There is no actual solution possible, but this gets us pretty close.

Typically when switching back to a FreeBSD box and moving the mouse
wild data is produced, because the protocol's validation/checksum
system is extremely weak it is impossible to determine that we're
out of sync before dropping several bogus packets to user land.

The actual solution that appears to offer the best clamping of
jitter is to buffer the mouse packets if we've not seen mouse
activity for more than .5 seconds.  Then waiting to flush that data
for 1/20th of a second.  If within that 20th of a second we get any
packets that do fail the weak test we drop the entire queue and
back off accepting data from the mouse for 2 seconds and then repeat
the whole deal.

You can still get _some_ jitter, notably if you switch to the FreeBSD
box, then move the mouse just enough to generate one or two packets.
Those packets may be bogus, but may still pass the validity check.

One way to finally kill the problem once and for all is to check
the initial packets for "wild" values.  Typically one sees packets
in the +/-60 range during normal operation, however when bogus data
is generated it's typically near the outer range of +/-120 or more,
those packets would be a good candidate for dropping or clamping.

I've been running with this for several weeks now and it has
significantly helped me stay sane even with a piece of junk Belkin
KVM causing wild jitter each and every time I switch.

Lastly I'd like to note that my experience with Windows shows me that
somehow the Microsoft PS/2 driver typically avoids this problem, but
that may only be possible when running the mouse in a dumb-ed down PS/2
mode that Belkin recommends on their site.
2003-12-11 11:28:11 +00:00
Poul-Henning Kamp
daf9092bcd Don't disable the TSC with statclock_disable. 2003-11-13 10:02:12 +00:00
Seigo Tanimura
512824f8f7 - Implement selwakeuppri() which allows raising the priority of a
thread being waken up.  The thread waken up can run at a priority as
  high as after tsleep().

- Replace selwakeup()s with selwakeuppri()s and pass appropriate
  priorities.

- Add cv_broadcastpri() which raises the priority of the broadcast
  threads.  Used by selwakeuppri() if collision occurs.

Not objected in:	-arch, -current
2003-11-09 09:17:26 +00:00
John Baldwin
6f92bdd0c1 New APIC support code:
- The apic interrupt entry points have been rewritten so that each entry
  point can serve 32 different vectors.  When the entry is executed, it
  uses one of the 32-bit ISR registers to determine which vector in its
  assigned range was triggered.  Thus, the apic code can support 159
  different interrupt vectors with only 5 entry points.
- We now always to disable the local APIC to work around an errata in
  certain PPros and then re-enable it again if we decide to use the APICs
  to route interrupts.
- We no longer map IO APICs or local APICs using special page table
  entries.  Instead, we just use pmap_mapdev().  We also no longer
  export the virtual address of the local APIC as a global symbol to
  the rest of the system, but only in local_apic.c.  To aid this, the
  APIC ID of each CPU is exported as a per-CPU variable.
- Interrupt sources are provided for each intpin on each IO APIC.
  Currently, each source is given a unique interrupt vector meaning that
  PCI interrupts are not shared on most machines with an I/O APIC.
  That mapping for interrupt sources to interrupt vectors is up to the
  APIC enumerator driver however.
- We no longer probe to see if we need to use mixed mode to route IRQ 0,
  instead we always use mixed mode to route IRQ 0 for now.  This can be
  disabled via the 'NO_MIXED_MODE' kernel option.
- The npx(4) driver now always probes to see if a built-in FPU is present
  since this test can now be performed with the new APIC code.  However,
  an SMP kernel will panic if there is more than one CPU and a built-in
  FPU is not found.
- PCI interrupts are now properly routed when using APICs to route
  interrupts, so remove the hack to psuedo-route interrupts when the
  intpin register was read.
- The apic.h header was moved to apicreg.h and a new apicvar.h header
  that declares the APIs used by the new APIC code was added.
2003-11-03 21:53:38 +00:00
Nate Lawson
e8c321c92f Fix a panic that occurs when resuming. For some reason, sc->cur_scp is
NULL.

Submitted by:	Andrew Thompson <andy@fud.org.nz>
2003-10-29 20:48:13 +00:00
Peter Wemm
042093540c Look at the equipment list for amd64 as well as i386 for autodetecting
floppy drives in the absence of hints.
2003-10-23 05:52:52 +00:00
Poul-Henning Kamp
b52b7f465d Eliminate use bio_blkno. 2003-10-18 17:51:26 +00:00
Poul-Henning Kamp
4866f95d76 Change fb_attach() and fb_detach() to take a integer unit number rather
than a dev_t.

All of the dev_t's passed were bogusly created with makedev()
2003-09-26 10:41:44 +00:00
Warner Losh
00dc18b5a8 Per TRB vote: restore the aquire_timer0 and associated goo. This will
be gone in FreeBSD 6, so put BURN_BRIDGES around it.  The TRB also
felt that if something better comes along sooner, it can be used to
replace this code.

Delayed by: BSDcon and subsequent disk crash.
2003-09-24 15:33:33 +00:00
Poul-Henning Kamp
a2f19df9cc Pick up softc from dev_t rathern than through newbus gymnastics. 2003-09-17 07:40:00 +00:00
Poul-Henning Kamp
f967c4f96e Since it is static these days, there is no reason to uppercase the
first letter of fdopen() to avoid nameclashing with other stuff.
2003-09-17 07:21:20 +00:00
Poul-Henning Kamp
0c7721e8f9 Disable the use of cloning use in floppy and CD drivers.
This commit puts the relevant code snippets under #ifdef GONE_IN_5
(rather than #ifndef BURN_BRIDGES) thereby disabling the code now.

The code wil be entirely removed before 5.2 unless we find reasons
why this would be a bad idea.

Approach suggested by:	imp
2003-09-11 19:27:24 +00:00
Bruce Evans
4df0520624 clock.c:
Quick fix for calling DELAY() for ddb input in some (atkbd-based)
console drivers.  ddb must not use any normal locks, but DELAY()
normally calls getit() which needs clock_lock.  One problem with using
normal locks in ddb is that deadlock is possible, but deadlock on
clock_lock is unlikely becaluse clock_lock is bogusly recursive,
apparently just to hide the problem of ddb using it.  The i8254 clock
hardware has mostly write-only registers so it is important for it to
use a lock that gives exclusive access.  (atkbd hardware is also
unfriendly to reentrant software but that problem is more local and
already solved.)  I mostly saw the symptoms of the bug caused by
unlocking in getit() running cpu_unpend().  cpu_unpend() should not
be called while in ddb and Debugger() calls for failing assertions
about this caused a breakpoint within ddb.

ddb must also not call getit() because ddb may be being used to step
through clock initialization code that has stopped or otherwise mangled
the clock.  If the clock is stopped, then getit() always returns the
same value and DELAY() takes forever if it trusts getit().

The quick fix is implement DELAY(n) as (n * timer_freq / 1000000)
inb(0x84)'s if ddb is active.

machdep.c:
Don't permit recursion on clock_lock.
2003-09-07 14:23:08 +00:00
Peter Wemm
b324e86370 Clean up some antique stuff. We do not support Weitek FPUs etc, and never
did.
2003-09-05 14:54:26 +00:00
Poul-Henning Kamp
7837155fa2 Put the device cloning functions for disk-drivers under #ifndef BURN_BRIDGES.
For the floppy driver, use fdcontrol to manipulate density selection.

For the CD drivers, the 'a' and 'c' suffix is without actual effect and
any applications insisting on it can be satisfied with a symlink:
	ln -s /dev/cd0 /dev/cd0a

Ongoing discussion may result in these pieces of code being removed before
the 5-stable branch as opposed to after.
2003-09-05 10:40:16 +00:00
Poul-Henning Kamp
78a49a45bc Give timecounters a numeric quality field.
A timecounter will be selected when registered if its quality is
not negative and no less than the current timecounters.

Add a sysctl to report all available timecounters and their qualities.

Give the dummy timecounter a solid negative quality of minus a million.

Give the i8254 zero and the ACPI 1000.

The TSC gets 800, unless APM or SMP forces it negative.

Other timecounters default to zero quality and thereby retain current
selection behaviour.
2003-08-16 08:23:53 +00:00
Poul-Henning Kamp
8dcee923b5 remove acquire_timer0() and release_timer0() and related stuff. 2003-08-15 15:50:49 +00:00
Poul-Henning Kamp
2fbc275447 Dont initialize a TSC timecounter until we know if it is broken or not. 2003-08-06 15:05:27 +00:00
Doug Ambrisko
a373227418 Add printer support to puc(4) driver.
-	Move isa/ppc* to sys/dev/ppc (repo-copy)
      -	Add an attachment method to ppc for puc
      -	In puc we need to walk the chain of parents.
Still to do, is to make ppc(4) & puc(4) work on other platforms.  Testers
wanted.

PR:		38372 (in spirit done differently)
Verified by:	Make universe (if I messed up a platform please fix)
2003-08-01 02:25:32 +00:00
Mike Heffner
e0c22597cb Add support for the A4 Tech RFSW-35 mouse wheel. Probe is similar to
4D Plus.

PR:		44333
2003-07-12 18:36:04 +00:00
John Baldwin
c37faf267c - Make the isab devclass global to allow for multiple ISA bridge drivers.
- Factor out code common to all ISA bridge drivers attach methods into a
  isab_attach() function.
- Rename the PCI-ISA bridge driver's attach function to pci_isab_attach()
  and have it call isab_attach().
2003-07-08 18:56:58 +00:00
Mike Heffner
b1181a94a3 Reset the PSM aux device twice to help pierce through some KVM's to
get the correct data from the attached mouse. Multiple resets should
be harmless, but just in case, the second one is non-fatal and is just
ignored.
2003-07-07 05:40:13 +00:00
John Baldwin
8a9bc9c03b - Use the new resource_disabled() helper function to see if devices are
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.
2003-07-02 16:09:02 +00:00
Mike Heffner
6d1c16554d Add PnP PS/2 id for Dell Latitude X200.
PR:		48516
MFC after:	2 weeks
2003-07-01 14:41:16 +00:00
Yaroslav Tykhiy
62cc1e0584 Force media autodetection if the device has lost its parameter table.
Previously, any normal I/O on an fdc(4) device would fail with ENXIO
if the device had been opened in non-blocking mode and then closed
prior to the conventional access; that would last until the floppy
disk was ejected and re-inserted to raise the unit attention condition.

Add a clarifying comment.
2003-06-16 08:42:20 +00:00
Yaroslav Tykhiy
f79981aca8 If in non-blocking mode, return EAGAIN instead of ENXIO
on an I/O attempt.  This is needed for consistency with
the concept of the half-opened state of fdc(4).

PR:		kern/52338
2003-06-16 07:50:17 +00:00
Yaroslav Tykhiy
83efe35a66 Always set bio_resid properly in fdstrategy(),
as should every block device strategy routine.
There was at least one evil consequence of not doing so:
Some errors returned by fdstrategy() could be lost (EAGAIN,
in particular.)

PR:		kern/52338 (in the audit-trail)
Discussed with:	bde
2003-06-15 18:13:17 +00:00
Yaroslav Tykhiy
29ec21d1e3 Check whether the floppy type pointer has been set before trying
to access floppy parameters through it.

Note: The DIOCGSECTORSIZE and DIOCGMEDIASIZE handlers withing
fdioctl() couldn't be just moved to below the existing check
for blocking mode because fd->ft can be non-NULL while still
in non-blocking mode (fd->ft can be set with the FD_STYPE ioctl.)

PR:		kern/52338
No MFC:		Not applicable to STABLE
2003-06-15 16:18:58 +00:00
David E. O'Brien
8c9bbf484a Use __FBSDID(). 2003-06-11 00:34:37 +00:00
David E. O'Brien
006124d811 Use __FBSDID(). 2003-06-02 16:32:55 +00:00
Poul-Henning Kamp
a3e7d3f16f wrap macro in do {...} while(0) 2003-05-31 21:11:51 +00:00
Poul-Henning Kamp
670966596b Remove unused variable(s).
Found by:       FlexeLint
2003-05-31 20:29:34 +00:00
Poul-Henning Kamp
7d4220518e Remove break after return;
Found by:       FlexeLint
2003-05-31 20:24:30 +00:00
Poul-Henning Kamp
9a3454805e Don't rely on boolean expression evaluating to 1 or 0 by default.
Found by:       FlexeLint
2003-05-31 20:23:46 +00:00
Poul-Henning Kamp
30f5ad0faf Remove unused variable(s).
Mark a non-critical memoryleak with XXX comment

Found by:       FlexeLint
2003-05-31 20:21:53 +00:00
Poul-Henning Kamp
c7b24d7dcd Remove unused variable.
Found by:       FlexeLint
2003-05-31 18:45:32 +00:00
Poul-Henning Kamp
9d4b1fa40e Remove extra ';'
Found by:       FlexeLint
2003-05-31 18:37:30 +00:00
Peter Wemm
33a9fd010d Only use the pc bios stuff on i386's. I think this might even be unused
there too.
2003-05-01 04:23:15 +00:00
Peter Wemm
0eb8d2e84a Create a 'legacy' node for AMD64 as well as i386. While we'll never
have to use it since all AMD64 machines are supposed to have acpi etc,
I'm using it during development so I can avoid the acpi code for now.
Yes, this is cheating.
2003-04-30 21:41:41 +00:00
Mark Murray
51da11a27a Fix some easy, global, lint warnings. In most cases, this means
making some local variables static. In a couple of cases, this means
removing an unused variable.
2003-04-30 12:57:40 +00:00
Alexander Kabaev
104a9b7e3e Deprecate machine/limits.h in favor of new sys/limits.h.
Change all in-tree consumers to include <sys/limits.h>

Discussed on:	standards@
Partially submitted by: Craig Rodrigues <rodrigc@attbi.com>
2003-04-29 13:36:06 +00:00
Matthew N. Dodd
f7130d0977 Add a module version number. 2003-04-15 04:19:49 +00:00
Poul-Henning Kamp
891619a66d Use bioq_flush() to drain a bio queue with a specific error code.
Retain the mistake of not updating the devstat API for now.

Spell bioq_disksort() consistently with the remaining bioq_*().

#include <geom/geom_disk.h> where this is more appropriate.
2003-04-01 15:06:26 +00:00
Matthew N. Dodd
adbc4f03a6 Correct an argument to bus_alloc_resource(). 2003-03-25 04:34:33 +00:00
Jake Burkholder
227f9a1c58 - Add vm_paddr_t, a physical address type. This is required for systems
where physical addresses larger than virtual addresses, such as i386s
  with PAE.
- Use this to represent physical addresses in the MI vm system and in the
  i386 pmap code.  This also changes the paddr parameter to d_mmap_t.
- Fix printf formats to handle physical addresses >4G in the i386 memory
  detection code, and due to kvtop returning vm_paddr_t instead of u_long.

Note that this is a name change only; vm_paddr_t is still the same as
vm_offset_t on all currently supported platforms.

Sponsored by:	DARPA, Network Associates Laboratories
Discussed with:	re, phk (cdevsw change)
2003-03-25 00:07:06 +00:00
Matthew N. Dodd
b7b5ae3edb Use repo-copied files in sys/i386/bios. 2003-03-24 19:14:46 +00:00
Poul-Henning Kamp
b4b138c27f Including <sys/stdint.h> is (almost?) universally only to be able to use
%j in printfs, so put a newsted include in <sys/systm.h> where the printf
prototype lives and save everybody else the trouble.
2003-03-18 08:45:25 +00:00
Poul-Henning Kamp
8595de4aec Fix a malloc() with no legal modeflag. 2003-03-17 07:26:25 +00:00
Poul-Henning Kamp
1ecc485c1b Call devstat_start_transaction_bio() instead of devstat_start_transaction() 2003-03-15 10:50:44 +00:00
Poul-Henning Kamp
8098046099 Allocate the devstat structure with devstat_new_entry(). 2003-03-08 21:32:59 +00:00
Poul-Henning Kamp
7ac40f5f59 Gigacommit to improve device-driver source compatibility between
branches:

Initialize struct cdevsw using C99 sparse initializtion and remove
all initializations to default values.

This patch is automatically generated and has been tested by compiling
LINT with all the fields in struct cdevsw in reverse order on alpha,
sparc64 and i386.

Approved by:    re(scottl)
2003-03-03 12:15:54 +00:00
Dag-Erling Smørgrav
521f364b80 More low-hanging fruit: kill caddr_t in calls to wakeup(9) / [mt]sleep(9). 2003-03-02 16:54:40 +00:00
Maxime Henrion
07159f9c56 Cleanup of the d_mmap_t interface.
- Get rid of the useless atop() / pmap_phys_address() detour.  The
  device mmap handlers must now give back the physical address
  without atop()'ing it.
- Don't borrow the physical address of the mapping in the returned
  int.  Now we properly pass a vm_offset_t * and expect it to be
  filled by the mmap handler when the mapping was successful.  The
  mmap handler must now return 0 when successful, any other value
  is considered as an error.  Previously, returning -1 was the only
  way to fail.  This change thus accidentally fixes some devices
  which were bogusly returning errno constants which would have been
  considered as addresses by the device pager.
- Garbage collect the poorly named pmap_phys_address() now that it's
  no longer used.
- Convert all the d_mmap_t consumers to the new API.

I'm still not sure wheter we need a __FreeBSD_version bump for this,
since and we didn't guarantee API/ABI stability until 5.1-RELEASE.

Discussed with:		alc, phk, jake
Reviewed by:		peter
Compile-tested on:	LINT (i386), GENERIC (alpha and sparc64)
Runtime-tested on:	i386
2003-02-25 03:21:22 +00:00
Poul-Henning Kamp
70d8e2e9aa Switch to using the TSC code in i386/i386/tsc.c. 2003-02-11 11:43:25 +00:00
Poul-Henning Kamp
91f1c2b3cc Split the global timezone structure into two integer fields to
prevent the compiler from optimizing assignments into byte-copy
operations which might make access to the individual fields non-atomic.

Use the individual fields throughout, and don't bother locking them with
Giant: it is no longer needed.

Inspired by:    tjr
2003-02-03 19:49:35 +00:00
Jake Burkholder
238dd3209a Split statclock into statclock and profclock, and made the method for driving
statclock based on profhz when profiling is enabled MD, since most platforms
don't use this anyway.  This removes the need for statclock_process, whose
only purpose was to subdivide profhz, and gets the profiling clock running
outside of sched_lock on platforms that implement suswintr.
Also changed the interface for starting and stopping the profiling clock to
do just that, instead of changing the rate of statclock, since they can now
be separate.

Reviewed by:	jhb, tmm
Tested on:	i386, sparc64
2003-02-03 17:53:15 +00:00
Yoshihiro Takahashi
afb79ecedd Correct error message. 2003-02-02 13:06:18 +00:00
Poul-Henning Kamp
3c99c0bc50 Make tsc_freq a 64bit quantity.
Inspired by:    http://www.theinquirer.net/?article=7481
2003-01-29 11:36:39 +00:00
Marcel Moolenaar
19ad245042 YAM: This id is found in a Sony Vaio GRX-670. When will this end?
Submitted by: Chuck McCrobie <mccrobie2000@yahoo.com>
2003-01-22 22:02:09 +00:00
Jeffrey Hsu
033aebebc4 Add yet another Sony Vaio PS/2 mouse ID. This one is found on a VX88.
Submitted by:	marcel
2003-01-22 03:31:08 +00:00
Marcel Moolenaar
99fd68d987 Add yet another Sony Vaio PS/2 mouse ID. This one is found in a R505GL.
The ACPI data for the mouse includes the compatibility ID, but we
apparently don't make use of it.
2003-01-21 10:00:32 +00:00
Matthew N. Dodd
dcb65c595d Make the SC_NO_SUSPEND_VTYSWITCH kernel option available as a loader
tunable and sysctl (hw.syscons.sc_no_suspend_vtswitch).
2003-01-15 03:45:27 +00:00
Matthew N. Dodd
6dc61b5ae5 - GC a few more hand-rolled 'abs' macros.
- GC a few hand-rolled min()/max() macros while I'm here.
2003-01-15 02:15:57 +00:00
Joerg Wunsch
294d88444b Bail out of fd_clone() if the parsed unit number doesn't match our
expectation.

This solves the problem, where in a constellation with two (or more)
drives, an attempt is made to access a device name for that device
using a historic partition letter, like /dev/fd1c.  This is supposed
to create a symlink to the master device, but previously, the link was
always created to /dev/fd0, even if the request was for fd1*.
2003-01-11 20:10:41 +00:00
Poul-Henning Kamp
2b64426519 Remove calls to cdevsw_add(), they are dreprecated on this branch now. 2002-12-28 21:39:04 +00:00
Poul-Henning Kamp
92a306a2b6 Use the correct value when writing the Day Of Week byte in the CMOS.
The correct range is [1...7] with Sunday=1, but we have been writing
[0...6] with Sunday=0.

The Soekris computers flagged the zero, zapped the date, so if you
rebooted your soekris on a sunday, it would come up with a wrong
date.

Bruce has a more extensive rework of this code, but we will stick with
the minimalist fix for now.

Spotted by:	Soren Kristensen <soren@soekris.com>
Thanks to:	Michael Sierchio <kudzu@tenebras.com>.
Confirmed by:	bde
Approved by:	re
2002-12-04 13:46:49 +00:00
Maxime Henrion
2ac8c61ac4 Capitalize the first letter of device descriptions
for consistency with the rest of the drivers.
2002-11-11 15:26:08 +00:00
John Baldwin
fbfed1cf09 Fix compile with options SC_NO_SUSPEND_VTYSWITCH. 2002-10-17 16:09:13 +00:00
Mitsuru IWASAKI
0ebefa8c4e 1. Fix a comment. Locking _is_ needed (but not done).
2. Update a comment.  We now restore much more than RTC updates and
   interrupts.
3. Order change.  Stop interrupts by writing to RTC_STATUSB,
   restore rate bits for the interrupts by writing to RTC_STATUSA,
   then enable interrupts again.
   This seems to be done perfectly backwards in startrtclock().
   Otherwise, the idea for this change was obtained from
   startrtclock().
4. Don't stop the clock (RTCB_HALT).  We only program some control bits
   and don't want to stop the clock.
5. (Not really related.)  Add caveats to the comment about timer_restore().
   The update is non-atomic since locking is not done.

On locking:
6. rtcin() and writertc() are locked() adequately by splhigh() in RELENG_4,
   but this locking is null in -current.
7. Doing things in the correct order in (3) combined with (6) is probably
   enough locking for rtcrestore() in RELENG_4.  In -current, the
   writertc()'s race with rtcintr() unless the BIOS disables RTC interrupts.

Submitted by:	bde (including commit message)
MFC after:	1 week
2002-10-17 13:55:39 +00:00
Mitsuru IWASAKI
c42946c4c1 Add new syscons option SC_NO_SUSPEND_VTYSWITCH.
This disables vty switch during suspend/resume.
2002-10-17 07:04:31 +00:00
Poul-Henning Kamp
8b7f9bdcdf Put an XXX: comment here to point out a couple of free() issues on
pnp_read_bytes().

Spotted by:	FlexeLint
2002-10-16 10:40:43 +00:00
Poul-Henning Kamp
633eb1fc9e No need to declare M_ISADEV here.
Spotted by:	FlexeLint.
2002-10-16 10:38:48 +00:00
Poul-Henning Kamp
6dbb527e47 Properly put macro args in ().
Spotted by:	FlexeLint.
2002-10-16 09:07:30 +00:00
John Baldwin
63e30378bc - Use __BUS_ACCESSOR() to define the ISA ivar accessor functions instead of
homerolling our own version.
- Rename the enum for memsize from ISA_IVAR_MSIZE to ISA_IVAR_MEMSIZE
  since using 'MSIZE' in the macro invocation of ISA_ACCESSOR() conflicts
  with the 'MSIZE' kernel option.  The accessor function is still
  isa_get_msize().
2002-10-15 00:02:51 +00:00
Poul-Henning Kamp
42117b6c4d Fix a probably rare and inconsequential memory leak.
Spotted by:	FlexeLint
2002-10-02 20:29:54 +00:00
Poul-Henning Kamp
c91a63aa2c Add support for DIOCGMEDIASIZE and DIOCGSECTORSIZE.
Remove all traces of disklabel.

Sponsored by:	DARPA & NAI Labs.
2002-09-30 13:53:22 +00:00
Poul-Henning Kamp
419f39ce0f Prefix private BIO commands with "FD" so people get a hint that they
are in fact private.

Sponsored by:	DARPA & NAI Labs.
2002-09-30 13:42:06 +00:00
Poul-Henning Kamp
f46708e081 Don't leak memory in case device_add_child_ordered() returns NULL.
Found by:	FlexeLint
2002-09-30 07:56:12 +00:00
Yoshihiro Takahashi
7698537b29 Added some buggy PC-98 PnP cards support. 2002-09-29 13:31:26 +00:00
Poul-Henning Kamp
37c841831f Be consistent about "static" functions: if the function is marked
static in its prototype, mark it static at the definition too.

Inspired by:    FlexeLint warning #512
2002-09-28 17:15:38 +00:00
John Baldwin
c1e309b38b Argh, isa(4), eisa(4) and mca(4) now attach to legacy(4) instead of
nexus(4) in the case of machines w/o equivalent bridges on a PCI bus.

Reported by:	winter
Pointy hat to:	jhb
2002-09-26 18:40:06 +00:00
Poul-Henning Kamp
bc8c3c3e37 Fix a 3 year old oversight: Remove the #ifdef/#endif pair now that there
is nothing between them anymore.

Spotted by:	peter.
2002-09-21 07:59:06 +00:00
Poul-Henning Kamp
f90c382c0c Make FreeBSD "struct disklabel" agnostic, step 311 of 723:
Rename diskerr() to disk_err() for naming consistency.

Drop the by now entirely useless struct disklabel argument.

Add a flag argument for new-line termination.

Fix a couple of printf-format-casts to %j instead of %l.

Correctly print the name of all bio commands.

Move the function from subr_disklabel.c to subr_disk.c,
and from <sys/disklabel.h> to <sys/disk.h>.

Use the new disk_err() throughout, #include <sys/disk.h> as needed.

Bump __FreeBSD_version for the sake of the aac disk drivers #ifdefs.

Remove unused disklabel members of softc for aac, amr and mlx, which seem
to originally have been intended for diskerr() use, but which only rotted
and got Copy&Pasted at least two times to many.

Sponsored by:   DARPA & NAI Labs.
2002-09-20 12:52:03 +00:00
Mitsuru IWASAKI
076ef4620b Restore status register A of RTC at resume time.
This should fix the 'too many RTC interrupts and statclock seems
broken after resume' problem.

MFC after:	1 week
2002-09-18 07:34:04 +00:00
Poul-Henning Kamp
c3bdb2f779 Suitably shrink a comment so it applies again.
Submitted by:	bde
2002-09-15 21:25:55 +00:00
Poul-Henning Kamp
02aad38c79 Fix a bug were a struct bio was freed and certain members subsequently
examined.  Use biowait() instead of DIY.
2002-09-13 11:37:38 +00:00
Joerg Wunsch
9a5e3ddb2d Pass the physical instead of the logical block number in
bp->bio_pblkno.  Otherwise, all formats not using 512 byte
physical sectors got screwed.
2002-09-12 20:53:50 +00:00
Mitsuru IWASAKI
9c4d34df76 Add suspend/resume method to syscons. This switch the mode
(text <-> graphics) by changing current vty during ACPI
sleep/wakeup (maybe APM also).
2002-08-25 18:35:44 +00:00
Philippe Charnier
93b0017f88 Replace various spelling with FALLTHROUGH which is lint()able 2002-08-25 13:23:09 +00:00