Commit Graph

6673 Commits

Author SHA1 Message Date
John Baldwin
7e1f6dfe9d Modify the critical section API as follows:
- The MD functions critical_enter/exit are renamed to start with a cpu_
  prefix.
- MI wrapper functions critical_enter/exit maintain a per-thread nesting
  count and a per-thread critical section saved state set when entering
  a critical section while at nesting level 0 and restored when exiting
  to nesting level 0.  This moves the saved state out of spin mutexes so
  that interlocking spin mutexes works properly.
- Most low-level MD code that used critical_enter/exit now use
  cpu_critical_enter/exit.  MI code such as device drivers and spin
  mutexes use the MI wrappers.  Note that since the MI wrappers store
  the state in the current thread, they do not have any return values or
  arguments.
- mtx_intr_enable() is replaced with a constant CRITICAL_FORK which is
  assigned to curthread->td_savecrit during fork_exit().

Tested on:	i386, alpha
2001-12-18 00:27:18 +00:00
Orion Hodson
2ae4ee833d Added a sysctl control variable "ac97rate" to allow manual tuning of
the link rate - some ich motherboards overclock ac97 out of the box.

Will hopefully replace this with a callibration loop in time for 4.5R
freeze.

Problem reported by Luigi Rizzo and fix derived from his code (put
diff in ich.c rather than ac97.c).

MFC after:	3 days
2001-12-17 01:57:42 +00:00
Orion Hodson
1abb0234c3 Addition of sysctl variable to enable spdif. By default spdif is disabled.
MFC after:	3 days
2001-12-17 01:39:36 +00:00
Justin T. Gibbs
786b4a3132 Remove reliance on i++ in multiple arguments to a function. C does not
guarantee the order of increment.

Noticed by: GCC 3.0 use by the Linux community and jhb
2001-12-16 17:38:30 +00:00
Joerg Wunsch
94896f7b05 Oops, forgot to commit one file in the fd driver mega update. Here it
is, some more constants for NE765 & Co.

Pointed out by: silby, Dave Cornejo <dave@dogwood.com>
2001-12-16 07:52:13 +00:00
Yoshihiro Takahashi
5229d0a11d Remove PC98 code. This file is not used by PC98. 2001-12-16 05:37:22 +00:00
Joerg Wunsch
1a6bed6863 Long promised major enhancement set for the floppy disk driver:
. The main device node now supports automatic density selection for
  commonly used media densities.  So you can stuff your 1.44 MB and
  720 KB media into your drive and just access /dev/fd0, no questions
  asked.  It's all that easy, isn't it? :)

. Device density handling has been completely overhauled.  The old way
  of hardwired kernel density knowledge is no longer there.  Instead,
  the kernel now implements 16 subdevices per drive.  The first
  subdevice uses automatic density selection, while the remaining 15
  devices are freely programmable.  They can be assigned an arbitrary
  name of the form /dev/fd[:digit]+.[:digit:]{1,4}, where the second
  number is meant to either implement device names that are mnemonic
  for their raw capacity (as it used to be), or they can alternatively
  be created as "anonymous" devices like fd0.1 through fd0.15,
  depending on the taste of the administrator.  After creating a
  subdevice, it is initialized to the maximal native density of the
  respective drive type, so it needs to be customized for other
  densities by using fdcontrol(8).  Pseudo-partition devices (fd0a
  through fd0h) are still supported as symlinks.

. The old hack to use flags 0x1 to always assume drive 0 were there is
  no longer supported; this is now supposed to be done by wiring the
  devices down from the loader via device flags.  On IA32
  architectures, the first two drives are looked up in the CMOS
  configuration records though.  On PCMCIA (i. e., the Y-E Data
  controller of the Toshiba Libretto), a single drive is always
  assumed.

. Other specialities like disabling the FIFO and not probing the drive
  at boot-time are selected by per-controller or per-drive flags, too.

. Unit attentions (media has been changed) are supposed to be detected
  now; density autoselection only occurs after a unit attention.  (Can
  be turned off by a per-drive flag, this will cause each Fdopen() to
  perform the autoselection.)

. FM floppies can be handled now (on controllers that actually support
  it -- not all do these days).

. Fdopen() can be told to avoid density selection by setting
  O_NONBLOCK; this leaves the descriptor in a half-opened state where
  only a few ioctls are accepted.  This is necessary to run fdformat
  on a device that uses automatic density selection (since you cannot
  autoselect on an unformatted medium, obviously).

. Just differentiate between a plain old NE765 and the enhanced chips,
  but don't try more; the existing code was wrong and only misdetected
  the chips anyway.

BUGS and TODOs:

. All documentation update still needs to be done.

. Formatting not-so-standard format yields unpredictable results; i
  have yet to figure out why this happens.  "Standard" formats like
  720 and 1440 KB do work, however.

. rc scripts are needed to setup device nodes with nonstandard
  densities (like the old /dev/fdN.MMM we used to have).

. Obtaining device flags from the kernel environment doesn't work yet,
  thus currently only drives that are present in (IA32) CMOS are
  really detected.  Someone who knows the odds and ends about device
  flags is needed here, i can't figure out what i'm doing wrong.

. 2.88 MB still needs to be done.
2001-12-15 19:09:04 +00:00
Noriaki Mitsunaga
499b1f4b70 o Add KLD support for scsi_low.
o Add KLD dependency of ncv, nsp and stg drivers to scsi_low.

Submitted by: takawata
2001-12-15 12:32:23 +00:00
Warner Losh
a432b68b87 Add support for suspending/resuming CardBus bridges.
We really should have and use power state information, but none exists
today.

Submitted by: YAMAMOTO Shigeru-san <shigeru@iij.ad.jp>
2001-12-15 05:58:28 +00:00
Peter Wemm
80c706c80e Patch up some existing style bugs and some that crept in with the
DEVICE_POLLING stuff.
2001-12-15 02:51:21 +00:00
Peter Wemm
6481f3012e Fix (again) some blatent style bugs in DEVICE_POLLING code. 2001-12-15 02:41:52 +00:00
David Greenman
eb48892e1d Disabled input hardware checksum due to it being calculated incorrected
for some packets, in particular small (0 byte payload) packets. May also
be related to TCP options.

Approved by:	wpaul
MFC after:	3 days
2001-12-14 22:04:58 +00:00
Søren Schmidt
ae22ec847b Adjust the timings for the SiS chips a bit, also add the SiS 645.
Cosmetics on the Acer chips (print right modes)
2001-12-14 21:28:49 +00:00
Søren Schmidt
de56c1c5d8 Do be so anal on detach, properly free interrupt even if no devices. 2001-12-14 21:23:19 +00:00
Luigi Rizzo
e4fc250c15 Device Polling code for -current.
Non-SMP, i386-only, no polling in the idle loop at the moment.

To use this code you must compile a kernel with

        options DEVICE_POLLING

and at runtime enable polling with

        sysctl kern.polling.enable=1

The percentage of CPU reserved to userland can be set with

        sysctl kern.polling.user_frac=NN (default is 50)

while the remainder is used by polling device drivers and netisr's.
These are the only two variables that you should need to touch. There
are a few more parameters in kern.polling but the default values
are adequate for all purposes. See the code in kern_poll.c for
more details on them.

Polling in the idle loop will be implemented shortly by introducing
a kernel thread which does the job. Until then, the amount of CPU
dedicated to polling will never exceed (100-user_frac).
The equivalent (actually, better) code for -stable is at

	http://info.iet.unipi.it/~luigi/polling/

and also supports polling in the idle loop.

NOTE to Alpha developers:
There is really nothing in this code that is i386-specific.
If you move the 2 lines supporting the new option from
sys/conf/{files,options}.i386 to sys/conf/{files,options} I am
pretty sure that this should work on the Alpha as well, just that
I do not have a suitable test box to try it. If someone feels like
trying it, I would appreciate it.

NOTE to other developers:
sure some things could be done better, and as always I am open to
constructive criticism, which a few of you have already given and
I greatly appreciated.
However, before proposing radical architectural changes, please
take some time to possibly try out this code, or at the very least
read the comments in kern_poll.c, especially re. the reason why I
am using a soft netisr and cannot (I believe) replace it with a
simple timeout.

Quick description of files touched by this commit:

sys/conf/files.i386
        new file kern/kern_poll.c
sys/conf/options.i386
        new option
sys/i386/i386/trap.c
        poll in trap (disabled by default)
sys/kern/kern_clock.c
        initialization and hardclock hooks.
sys/kern/kern_intr.c
        minor swi_net changes
sys/kern/kern_poll.c
        the bulk of the code.
sys/net/if.h
        new flag
sys/net/if_var.h
        declaration for functions used in device drivers.
sys/net/netisr.h
        NETISR_POLL
sys/dev/fxp/if_fxp.c
sys/dev/fxp/if_fxpvar.h
sys/pci/if_dc.c
sys/pci/if_dcreg.h
sys/pci/if_sis.c
sys/pci/if_sisreg.h
        device driver modifications
2001-12-14 17:56:12 +00:00
Luigi Rizzo
268cc03905 Remove printf's on mbuf/cluster allocation failures. There are now
equivalent and less dangerous (rate limited) messages in
the mbuf allocation code.

MFC after: 3 days
2001-12-14 05:56:35 +00:00
David E. O'Brien
f414f5dc5c Convert C++ style comments to proper C ones.
Clean up C comments just a tad.
Fix ID's.
2001-12-13 23:48:34 +00:00
John Baldwin
7118b0c4c3 Use C comments instead of C++ comments.
Reported by:	gcc30
2001-12-13 19:54:12 +00:00
Jonathan Lemon
001cfa9228 Tone down and remove some obnoxious warnings that are slightly overkill. 2001-12-13 16:13:31 +00:00
John Baldwin
40ec4d938e Use ANSI C string contatenation instead of a multi-line string literal.
Reported by:	gcc30
2001-12-13 11:14:28 +00:00
John Baldwin
19f0fedd94 Comment tokens after #undef <macroname> and #endif.
Reported by:	gcc30
2001-12-13 11:12:30 +00:00
Matt Jacob
5b7cc8d153 Roll firmware to latest offerings... Fixes a number of f/w related
bugs.

MFC after:	1 week
2001-12-13 00:09:06 +00:00
Warner Losh
ebc7a029f4 Sync to pccarddevs 1.25 2001-12-12 20:06:29 +00:00
Warner Losh
a7958b9d73 Move LINKSYS2 to its correct numerical location.
Add BONDWELL B236 Game Card Joystick.  A PC Card joystick card.
2001-12-12 20:05:48 +00:00
Maxim Sobolev
1f891ff9ef Add DIVA USB mp3 player.
Submitted by:	Olexander Kunytsa <kunia@x-telecom.net>
MFC after:	3 days
2001-12-12 15:58:23 +00:00
Matt Jacob
c748b5e634 Explicitly decode GetAllNext SNS Response back *as*
a GetAllNext response. Otherwise, we won't unswizzle
it correctly. This was found on linux/PPC.

This mandated creating another inline: isp_get_gan_response.
2001-12-11 21:58:04 +00:00
Luigi Rizzo
2dfc960a5b Avoid an unnecessary copy of a packet if it is already in a single mbuf.
Introduce an additional device flag for those NICs which require the
transmit buffers to be aligned to 32-bit boundaries.

(the equivalen fix for STABLE is slightly simpler because there are
no supported chips which require this alignment there.)
2001-12-11 02:47:53 +00:00
Matt Jacob
4fd13c1ba2 Major restructuring for swizzling to the request queue and unswizzling from
the response queue. Instead of the ad hoc ISP_SWIZZLE_REQUEST, we now have
a complete set of inline functions in isp_inline.h. Each platform is
responsible for providing just one of a set of ISP_IOX_{GET,PUT}{8,16,32}
macros.

The reason this needs to be done is that we need to have a single set of
functions that will work correctly on multiple architectures for both little
and big endian machines. It also needs to work correctly in the case that
we have the request or response queues in memory that has to be treated
specially (e.g., have ddi_dma_sync called on it for Solaris after we update
it or before we read from it). It also has to handle the SBus cards (for
platforms that have them) which, while on a Big Endian machine, do *not*
require *most* of the request/response queue entry fields to be swizzled
or unswizzled.

One thing that falls out of this is that we no longer build requests in the
request queue itself. Instead, we build the request locally (e.g., on the
stack) and then as part of the swizzling operation, copy it to the request
queue entry we've allocated. I thought long and hard about whether this was
too expensive a change to make as it in a lot of cases requires an extra
copy. On balance, the flexbility is worth it. With any luck, the entry that
we build locally stays in a processor writeback cache (after all, it's only
64 bytes) so that the cost of actually flushing it to the memory area that is
the shared queue with the PCI device is not all that expensive. We may examine
this again and try to get clever in the future to try and avoid copies.

Another change that falls out of this is that MEMORYBARRIER should be taken
a lot more seriously. The macro ISP_ADD_REQUEST does a MEMORYBARRIER on the
entry being added. But there had been many other places this had been missing.
It's now very important that it be done.

Additional changes:

Fix a longstanding buglet of sorts. When we get an entry via isp_getrqentry,
the iptr value that gets returned is the value we intend to eventually plug
into the ISP registers as the entry *one past* the last one we've written-
*not* the current entry we're updating. All along we've been calling sync
functions on the wrong index value. Argh. The 'fix' here is to rename all
'iptr' variables as 'nxti' to remember that this is the 'next' pointer-
not the current pointer.

Devote a single bit to mboxbsy- and set aside bits for output mbox registers
that we need to pick up- we can have at least one command which does not
have any defined output registers (MBOX_EXECUTE_FIRMWARE).

MFC after:	2 weeks
2001-12-11 00:18:45 +00:00
Guido van Rooij
b60e55dbd0 Get rid of irritating (bogus) message:
pcm0: ac97 codec failed to reset extended mode (0, got 80)
This was due to not masking off the correct extended function bits
in the read value from the extended status reg.

MFC after:	2 days
2001-12-10 20:27:18 +00:00
Sheldon Hearn
06aa84ddfe Regen from usbdevs rev 1.70: added some AGFA scanners 2001-12-10 11:46:23 +00:00
Sheldon Hearn
56429b663c Add some AGFA scanners:
SnapScan 1236U	SnapScan e20
	SnapScan e25	SnapScan e26
	SnapScan e40	SnapScan e50
	SnapScan e52

PR:	kern/32649
Submitted by:	"Erik H. Bakke" <ebakke@trolltech.com>
2001-12-10 11:40:38 +00:00
David E. O'Brien
956d569b10 I missed a string concatenation. 2001-12-10 09:34:47 +00:00
David E. O'Brien
6e551fb628 Update to C99, s/__FUNCTION__/__func__/,
also don't use ANSI string concatenation.
2001-12-10 08:09:49 +00:00
Mitsuru IWASAKI
ece50487e9 Disable sleep requests for 5 sec after wakeup. This is needed for
some Toshiba and Thinkpad laptops.
Wakeup event is generated by power button or sleep button on some
laptops but this also generates SCI interrupt, and shutdown the system
as result.  So this is introduced so that acpi driver ignore given
requests for certain period.
2001-12-09 18:02:36 +00:00
Mike Smith
ffb6d5ad8f The ScanLogic SL11R-IDE claims to be SCSI-compatible, but actually requires
the UFI command set.  Even with this patch, it's incredibly slow on my
laptop, but at least now it works.

Note that the drive is reported to CAM with the vendor and device IDs from
the device itself, forcing the user to patch the da(4) quirk table
manually.
2001-12-09 06:02:46 +00:00
Alfred Perlstein
68685eeb5b Replace %i formatting characters with %d since printf(9) doesn't support %i.
Someone forgot the long flamefest I lost to add %i to kernel printf.
2001-12-08 23:46:38 +00:00
Andrew R. Reiter
1f4bb1673d - Fix a bunch of malloc calls where the M_FLAG is incorrectly used; it
should be M_WAITOK.

Spotted by: des
2001-12-07 17:59:15 +00:00
Coleman Kane
a28920935a This patch will fix the lockups associated with AMD 751,761,762 based AGP
controllers. There still seems to be some issues with the DRI copying code
for some adapters, at least it doesn't hang the system now. Input would be
appreciated.

PR: 32301
Obtained from:	Eric Anhlot <eanholt@gladstone.uoregon.edu>, Joe <joeo@nks.net>
2001-12-07 05:41:26 +00:00
Peter Wemm
3b3ec2004a MFS (merge from stable): rev 1.9.2.28, fix ordering of IFF_RUNNING mods.
The reason we are required to commit to -current first is so that later
MFC's do not risk the loss of existing bug fixes.  Even if this was not
strictly required in -current, it should still be fixed there too.
2001-12-07 00:57:57 +00:00
Prafulla Deuskar
8798701fd5 Fixed two problems:
1. Changed incorrect conditional in fxhw.c which would never
evaluate to true. Thanks to John Polstra for pointing that out.
2. Write to PCI config space by default, enabling memory access and
bus master enable.

Submitted by:Prafulla Deuskar
MFC after:3 days
2001-12-06 17:50:21 +00:00
Guido van Rooij
3068bdba98 Fix resume for HP Omnibook 500's.
MFC after:	1 week
2001-12-05 10:36:32 +00:00
Warner Losh
6aed731b38 Split joystick driver into ISA and PC Card front ends.
Similar code was submitted in PR 5559 by Takeshi OHASHI-san, but the
PC Card system has changed much since then, so this is a fresh
implementation.

PR:	i386/5559
Submitted by: Takeshi OHASHI
2001-12-05 09:08:23 +00:00
Warner Losh
3b289629db Implement prism2 detection from NetBSD. This mostly obsoletes the
prism2 flag in pccard.conf, but I'm leaving it place for the moment in
case the small sample of PrismII cards that I've tried is not
representative.

MFC After: 30 days
Obtained from: NetBSD
2001-12-05 08:57:36 +00:00
Søren Schmidt
bc48b9d025 Allow setting the CD type on cue sheets 2001-12-04 21:39:34 +00:00
Warner Losh
d29f1aafa9 implement MFC links properly (and I think long links too). This make
the sprint wireless card try to attach.  Sadly, the pci code at the
bridge keeps this from happening.

Bug w/o PR: jhb :-)
2001-12-04 13:48:16 +00:00
Scott Long
8ea9ab6622 MFS: Use correct terminology for RAID 0/1 and 0/5. 2001-12-04 02:39:06 +00:00
Luigi Rizzo
40129585e3 Remove error messages on mbuf allocation failures, now
this is done more safely in kern/subr_mbuf.c

Two-days'-delay-thanks-to: @home shutting down service
2001-12-04 02:30:53 +00:00
Scott Long
1c4c22583c BAH! Missed another change to this file. 2001-12-04 02:26:57 +00:00
Scott Long
a1078af4df Bah, I missed this file on the last commit 2001-12-04 02:24:07 +00:00
Scott Long
c3d15322a1 Use d_thread_t to reduce diffs between current and stable.
Spell ACQUIRE correctly.
2001-12-03 22:55:14 +00:00