Commit Graph

55528 Commits

Author SHA1 Message Date
Robert Watson
6dd84b0bdc Only poll the fifo for read events if the fifo is attached to a readable
file descriptor.  Otherwise, the read end of a fifo might return that it
is writable (which it isn't).

Only poll the fifo for write events if the fifo attached to a writable
file descriptor.  Otherwise, the write end of a fifo might return that
it is readable (which it isn't).

In the event that a file is FREAD|FWRITE (which is allowed by POSIX, but
has undefined behavior), we poll for both.

MFC after:	3 days
2005-09-12 10:16:18 +00:00
Robert Watson
845e8e827b After going to some trouble to identify only the write-related events
to poll the write socket for, the fifo polling code proceeded to poll
for the complete set of events.  Use 'levents' instead of 'events' as
the argument to poll, and only poll the write socket if there is
interest in write events.

MFC after:	3 days
2005-09-12 10:13:15 +00:00
Robert Watson
ab5182012a When a writer opens a fifo, wake up the read socket for read, not the
write socket.

MFC after:	3 days
2005-09-12 10:07:21 +00:00
Robert Watson
a1b9943657 Add an assertion that fifo_open() doesn't race against other threads
while sleeping to allocate fifo state: due to using the vnode lock to
serialize access to a fifo during open, it shouldn't happen (tm).

MFC after:	3 days
2005-09-12 10:06:38 +00:00
Robert Watson
ba9eeb43fe Rather than reaching into the internals of the UNIX domain socket code
by calling uipc_connect2() to connect two socket endpoints to create a
fifo, call soconnect2().

MFC after:	3 days
2005-09-12 10:05:08 +00:00
Poul-Henning Kamp
2883ba6668 Introduce vfs_read_dirent() which can help VOP_READDIR() implementations
by handling all the cookie stuff.
2005-09-12 08:46:07 +00:00
Poul-Henning Kamp
21806f30bc Clean up prototypes. 2005-09-12 08:03:15 +00:00
Gleb Smirnoff
fb3eb9dace Remove ng_callout_init_mtx() macro. Mutexed callouts are incompatible
with netgraph(4).
2005-09-12 07:41:31 +00:00
Warner Losh
5c4f7048b8 This appears to be good for some folks, but really bad for others.
Until we know why, back out 1.127.
2005-09-12 05:35:11 +00:00
Warner Losh
d78baf42dc Since opti_detect is now only called on !PC98 machines, only declare
and define there as well.  This should fix the pc98 tinderbox.
2005-09-12 04:12:50 +00:00
David E. O'Brien
09c666c10e MFamd64: use register_t's. 2005-09-12 03:34:05 +00:00
David E. O'Brien
c679d15b66 Note that Keyspan is also InnoSys Inc. 2005-09-12 03:32:46 +00:00
Tor Egge
6ff5e2db45 Don't retry when vget() returns ENOENT in the nonblocking case due to the
vnode being doomed.  It causes a livelock.
2005-09-12 01:48:57 +00:00
Tor Egge
2f0ffabcf4 Giant is no longer needed here. 2005-09-12 01:21:42 +00:00
Alan Cox
ac31d065a6 Eliminate unused definitions. 2005-09-11 20:51:15 +00:00
Matt Jacob
519d7f81e4 Restore the 929X support that got nuked in merge 2005-09-11 19:58:19 +00:00
David E. O'Brien
2a191126de Canonize the include of acpi.h. 2005-09-11 18:39:03 +00:00
David E. O'Brien
1aa7b020d7 Per a request from Nick Triantos of nVidia, nVidia's legal department asked
that we provide their license document beside their nForce MCP object code.
2005-09-11 17:50:20 +00:00
Alexander Leidinger
df54be7080 Fix hang at init for MagicMedia 256A[VX] chips. [1]
In case this causes trouble for some other chipsets add a comment how to
proceed. If we don't get bugreports, this should be removed after a while
(some releases?).

PR:		56617 [1], 29465, 39260, 40574,	68225
Submitted by:	Matthew E. Gove <mgove@comcast.net> [1]
2005-09-11 17:30:27 +00:00
Craig Rodrigues
6a3d26b2b7 Forward declare z_errmsg with static linkage since it is defined
with static linkage later in the file.  Eliminates GCC 4.0 error.
2005-09-11 16:13:02 +00:00
Craig Rodrigues
7b7a19f3c8 Forward declare atalkdomain with static linkage, not extern, since
it is defined with static linkage later in the file.  Eliminates
GCC 4.0 error.
2005-09-11 16:04:56 +00:00
Craig Rodrigues
b575132598 Cast bf_sysid to const char * when passing it to strncmp(), because
strncmp does not take an unsigned char *.  Eliminates warning with GCC 4.0.
2005-09-11 16:02:14 +00:00
Craig Rodrigues
2a3e0acc5d Do not declare M_NTFSMNT with extern linkage here, since
it is defined with static linkage in ntfs_vfsops.c.
Fixes compilation with GCC 4.0.
2005-09-11 15:57:07 +00:00
Alexander Leidinger
5ad14b759d Power up the external amplifiers additionally to powering up the DAC and ADC.
PR:		47029
Submitted by:	Anish Mistry <mistry.7@osu.edu>
Tested by:	David Murphy <dm@dmz.ie>
2005-09-11 14:15:05 +00:00
Alexander Leidinger
70001ecea2 Add some ad_wait_init() calls to fix some problems in some configs (e.g.
PC98, CS4231A, "pcm0: play interrupt timeout").

PR:		45682
Submitted by:	Watanabe Kazuhiro <CQG00620@nifty.ne.jp>
2005-09-11 13:59:02 +00:00
Alexander Leidinger
3159d831fc Allow to record non 8bit-mono formats even in half-duplex configurations.
PR:		45679
Submitted by:	Watanabe Kazuhiro <CQG00620@nifty.ne.jp>
2005-09-11 13:49:24 +00:00
Poul-Henning Kamp
9fbea3e365 Do not destroy the queue mutex until the thread is done with it. 2005-09-11 12:35:32 +00:00
Max Laier
922e338183 Stop leaking a lock. This used to cause a propagate_priority() page fault
when setting syncdev and syncpeer.

Reported by:	Dominic Marks
2005-09-11 11:55:39 +00:00
Alexander Leidinger
6643b656bb Fix misdetection of the sound chip on PC98 systems. The submitter doesn't
believe that there are PC98 systems with an OPTi chip.

I don't know enough about this special PC architecture to be sure about
this, so let's find out by letting people with such a system complain in
case this commit breaks the sound system for them. It's easy to revert
then.

PR:		45673
Submitted by:	Watanabe Kazuhiro <CQG00620@nifty.ne.jp>
2005-09-11 10:07:12 +00:00
Alexander Leidinger
caad740808 Fix a bug in volume calculation, this sometimes gives a USB audio device an
unexpected value (when the volume is high).

Submitted by:	Kazuhito HONDA <kazuhito@ph.noda.tus.ac.jp>
2005-09-11 09:15:42 +00:00
Don Lewis
908b3deb2b Relocate witness_levelall(), witness_leveldescendents(), and
witness_displaydescendants() so that they are protected by
"#ifdef DDB/#endif" to unbreak kernels not using "option DDB".

MFC after:	3 weeks
2005-09-11 07:57:06 +00:00
David E. O'Brien
5385446ad3 The kernel-depend target doesn't get any information from "compile-with",
so repeat the includes paths for that target.
2005-09-11 07:33:43 +00:00
Warner Losh
6c996a0055 Change hw.pci.do_powerstate from a boolean to a range. 0 means the
same as today: do no power management.  1 means be conservative about
what you power down (any device class that has caused problems gets
added here).  2 means be agressive about what gets powered down (any
device class that's fundamental to the system is here).  3 means power
them all down, reguardless.  The default is 1.

The effect in the default system is to add mass storage devices to the
list that we don't power down.  From all the pciconf -l lists that
I've seen for the aac and amr issue, the bad device has been a mass
storage device class.

This is an attempt at a compromise between the very small number of
systems that have extreme issues with powerdown, and the very large
number of systems that gain real benefits from powerdown (I get about
20% more battery life when I attach a minimal set of drivers on my
Sony).  Hopefully it will strike the proper balance.

MFC After: 3 days (before next beta)
2005-09-11 04:09:44 +00:00
David E. O'Brien
d85986ec1c Don't pollute the entire kernel build with -I$S/contrib/dev/ath and
-I$S/contrib/dev/ath/freebsd.  "ATH_BUILDING_FROM_SOURCE" can be defined to
globally get back -I$S/contrib/dev/ath.
2005-09-11 03:38:18 +00:00
Warner Losh
6de560ab92 Allow one to access the cached values for CMDREG, CACHELNSZ, MINGNT,
MAXLAT and LATTIMER.

Improve error message when a bogus RID type is requested for a bar.
2005-09-11 03:22:03 +00:00
David E. O'Brien
7014a50853 Don't pollute the entire kernel build with -I$S/contrib/ipfilter. 2005-09-11 02:27:34 +00:00
David E. O'Brien
b186613e42 Don't pollute the entire kernel build with -I$S/contrib/pf. 2005-09-11 02:04:04 +00:00
David E. O'Brien
94caedfbd3 Don't pollute the entire kernel build with -I$S/contrib/ngatm. 2005-09-11 01:28:05 +00:00
David E. O'Brien
ede2033b1f Don't pollute the entire kernel build with -I$S/dev/twa. 2005-09-11 00:52:05 +00:00
David E. O'Brien
e319790c0c For HEAD, install a kernel with debug information if DEBUG is a kernel
config option.  It is too easy to loose the build directory and not have
symbols for kgdb to read.
2005-09-11 00:22:21 +00:00
Craig Rodrigues
bdb7d194d0 In ext2_mountfs(), check that the superblock size, SBSIZE,
is aligned with the sectorsize value returned by GEOM, before
doing a bread() of the superblock.
This eliminates a panic when trying the following on an empty CD-ROM drive:
mount_ext2fs /dev/acd0 /mnt

Reviewed by:	phk
2005-09-10 21:30:49 +00:00
Peter Grehan
72ed31087b Fix boot-time hang/panic on G3 systems when modifying IBAT0 in
pmap_bootstrap by using the sync;isync big hammer to make sure
all prior operations have completed.

Reported by:	Nathan Whitehorn <nathan at uchicago edu>
MFC after:	2 days
2005-09-10 21:03:10 +00:00
Alexander Leidinger
97d69a9620 - channel.h
* New definition CHN_F_HAS_VCHAN.
- channel.c
  * Use CHN_F_HAS_VCHAN to mark channel with vchan capability instead
    of relying on SLIST_EMPTY(&channel->children) == true for better
    clarification and future possible usages of children (like
    'slave' channel).
  * Various fixes, including blocksize / format bps allignment,
    better 24bit seeking (mplayer, others).
  * Improve format chain building, it's now possible to record something
    to a format non-native to the soundcard through various feeder format
    converters or to higher sampling rate. This also gains another feature,
    like doing vchan mixing on non s16le soundcard such as sb8.
- sound.c
  * Increase robustness within various function that handle vchan
    creation / termination (these function need a total rewrite, but
    that would cause other major rewrite within various places too!).
    As far as its robustness can be guaranteed, leave it as is.
  * Optimize channel ordering, prefer *real* hardware playback
    channels over virtual channels. cat /dev/sndstat should look
    better.
  * Increase sndstat verbosity to include bufsoft/bufhard allocation.
- vchan.c
  * Fix LOR 119.
    - http://sources.zabbadoz.net/freebsd/lor.html#119
  * Reorder / increase robustness of vchan_create() / destroy().
    Enforce destroy_dev() during destroy operation, fix possible
    panic / dangling character device.
    - http://lists.freebsd.org/pipermail/freebsd-current/2005-May/050308.html
  * Tolerate a little bit more during mixing process, this should help
    non s16le soundcards.

Note: Recoring in a non-native rate/format may result in overruns. A friendly
      application is wavrec from audio/wavplay. The problem is under
      investigation.

Submitted by:	Ariff Abdullah <skywizard@MyBSD.org.my>
2005-09-10 18:10:31 +00:00
Alexander Leidinger
a423446c40 Release lock for a while during chn_reset() / pcm_chnalloc() operation
while malloc()ing, this fixes LOR 129.

See
 - http://lists.freebsd.org/pipermail/freebsd-current/2005-June/051157.html
 - http://lists.freebsd.org/pipermail/freebsd-current/2005-August/054620.html
 - http://sources.zabbadoz.net/freebsd/lor.html#129

Submitted by:	Ariff Abdullah <skywizard@MyBSD.org.my>
2005-09-10 17:51:38 +00:00
Alexander Leidinger
5cfcc28b60 - fake.c
* Add missing A_LAW / MU_LAW format.
- feeder.c
  * Fix format chain building. Traverse backward instead of forward
    during format chainning.
- feeder_fmt.c
  * Add missing alaw/mulaw converter.
  * Add 16 -> 24/32bit converter.
  * whitespace cleanup.
- sound.h
  * alaw / mulaw are member of AFMT_8BIT.

Submitted by:	Ariff Abdullah <skywizard@MyBSD.org.my>
2005-09-10 17:47:39 +00:00
Alexander Leidinger
8633619643 - Few buggy codecs (STAC9704, probably others) return inconsistent
ac97_rdcd() value. Enable aggresive workaround.
- Fix mixer resolution detection for 5/6 bit register, carefully not to
  overflow others.

PR:		84728
Submitted by:	Ariff Abdullah <skywizard@MyBSD.org.my>
2005-09-10 17:42:59 +00:00
Alexander Leidinger
0725262365 Fix panic caused by full duplex operation.
From the PR:
---snip---
The vibra16X supports full duplex. I traced the Windows driver, and what is
does is that it programs one DMA channel 8-bit, and the other 16-bit. There
might be some kind of auto detection logic here, because it always uses 8-bit
for playback, even if I play 16-bit sound ...
---snip---

PR:		80977
Submitted by:	Hans Petter Selasky <hselasky@c2i.net>
2005-09-10 17:33:58 +00:00
Christian S.J. Peron
fe0fc7efe3 Protect interface and address lists using the appropriate mutex. These
locks were not aquired because the user buffers were not wired, thus it was
possible that that SYSCTL_OUT could sleep, causing a number of different
problems such as lock ordering issues and dead locks.

-Wire user supplied buffer to ensure SYSCTL_OUT will not sleep.
-Pickup ifnet locks to protect the list.
-Where applicable pickup address locks.
-Pickup radix node head locks.
-Remove splnet stubs
-Remove various comments about locking here, because they are no
 longer needed.

It is the hope that these changes will make sysctl_rtsock MP safe.

MFC after:	3 weeks
2005-09-10 15:12:24 +00:00
Pawel Jakub Dawidek
71270ca60b Fix copy&paste typo.
MFC after:	3 days
2005-09-10 07:46:47 +00:00
Pawel Jakub Dawidek
cf47954083 Don't forget to initialize crp_etype field.
Reported by:	Nick Evans <nevans@syphen.net>
MFC after:	3 days
2005-09-10 07:45:10 +00:00
Andre Oppermann
ffabe3dce8 In tcp_ctlinput() do not swap ip->ip_len a second time. It
has been done in icmp_input() already.

This fixes the ICMP_UNREACH_NEEDFRAG case where no MTU was
proposed in the ICMP reply.

PR:		kern/81813
Submitted by:	Vitezslav Novy <vita at fio.cz>
MFC after:	3 days
2005-09-10 07:43:29 +00:00
Marcel Moolenaar
8115693121 Merge db_interface.c and db_trace.c into db_machdep.c. 2005-09-10 03:18:51 +00:00
Marcel Moolenaar
216e80c2ba Move the prototypes of db_md_set_watchpoint(), db_md_clr_watchpoint()
and db_md_list_watchpoints() to ddb/ddb.h.
2005-09-10 03:01:25 +00:00
Marcel Moolenaar
464d16ddf0 Move the ia32_sigcode structure from ia32_sigtramp.c to ia32_signal.c.
It's a bit excessive to have it in a file of its own.
2005-09-10 02:12:49 +00:00
Marcel Moolenaar
0522a40412 Remove redundant $FreeBSD$ 2005-09-10 01:13:33 +00:00
Warner Losh
1376a07bcf MFp4:
Reduce the size of ed a little by removing some CIS based entries (others
likely can be removed too):
o The D-Link DFE-670TXD doesn't need its own entry based on strings.
o The Xircom CompactCard appears to be a TDK design, so list it there by ID
  and remove the strings.

Increase the size of ed a little:
o Add support for the Addtron AE-660CT and Addtron AE-660.  This is a very
  generic NE-2000 clone (so generic that its CIS tags say NE-2000 generic
  card!).
2005-09-10 00:17:55 +00:00
Marcel Moolenaar
87a59250b5 Change the High FP lock from a sleep lock to a spin lock. We can
take the lock from interrupt context, which causes an implicit
lock order reversal. We've been using the lock carefully enough
that making it a spin lock should not be harmful.
2005-09-09 19:18:36 +00:00
Gleb Smirnoff
a20e25385c - Do not hold route entry lock, when calling arprequest(). One such
call was introduced by me in 1.139, the other one was present before.
- Do all manipulations with rtentry and la before dropping the lock.
- Copy interface address from route into local variable before dropping
  the lock. Supply this copy as argument to arprequest()

LORs fixed:
		http://sources.zabbadoz.net/freebsd/lor/003.html
		http://sources.zabbadoz.net/freebsd/lor/037.html
		http://sources.zabbadoz.net/freebsd/lor/061.html
		http://sources.zabbadoz.net/freebsd/lor/062.html
		http://sources.zabbadoz.net/freebsd/lor/064.html
		http://sources.zabbadoz.net/freebsd/lor/068.html
		http://sources.zabbadoz.net/freebsd/lor/071.html
		http://sources.zabbadoz.net/freebsd/lor/074.html
		http://sources.zabbadoz.net/freebsd/lor/077.html
		http://sources.zabbadoz.net/freebsd/lor/093.html
		http://sources.zabbadoz.net/freebsd/lor/135.html
		http://sources.zabbadoz.net/freebsd/lor/140.html
		http://sources.zabbadoz.net/freebsd/lor/142.html
		http://sources.zabbadoz.net/freebsd/lor/145.html
		http://sources.zabbadoz.net/freebsd/lor/152.html
		http://sources.zabbadoz.net/freebsd/lor/158.html
2005-09-09 10:06:27 +00:00
Gleb Smirnoff
5d40d65b5a When a carp(4) interface is being destroyed and is in a promiscous mode,
first interface is detached from parent and then bpfdetach() is called.
If the interface was the last carp(4) interface attached to parent, then
the mutex on parent is destroyed. When bpfdetach() calls if_setflags()
we panic on destroyed mutex.

To prevent the above scenario, clear pointer to parent, when we detach
ourselves from parent.
2005-09-09 08:41:39 +00:00
Alan Cox
f353d3388f Introduce a new lock for the purpose of synchronizing access to the
UMA boot pages.

Disable recursion on the general UMA lock now that startup_alloc() no
longer uses it.

Eliminate the variable uma_boot_free.  It serves no purpose.

Note: This change eliminates a lock-order reversal between a system
map mutex and the UMA lock.  See
http://sources.zabbadoz.net/freebsd/lor.html#109 for details.

MFC after: 3 days
2005-09-09 06:03:08 +00:00
Lukas Ertl
fcac1be89a Set the G_PF_WITHER flag on the subdisk provider that is about to
be destroyed.  That way the GEOM system handles all deallocations
and we don't have to do it ourselves.
2005-09-08 20:08:46 +00:00
Max Laier
82f0cb7f33 Unbreak the build. Committed from the wrong directory. 2005-09-08 17:42:42 +00:00
Warner Losh
8fe5efa81f Minor improvement for the suspend case for Ricoh based (and others)
CardBus bridges.
2005-09-08 17:18:42 +00:00
Warner Losh
fd410513a9 The ed driver lock is already held in the mii frobbing routines. Remove
locking from these routines.
2005-09-08 17:17:13 +00:00
Warner Losh
c16a45fc5b Add note about what ED_DEFAULT_MAC_OFFSET applies to 2005-09-08 17:16:23 +00:00
Warner Losh
b3ffa2ae22 Note that pc98 specific defines maybe would be better in a header file. 2005-09-08 17:07:12 +00:00
Max Laier
5e11e6c096 Commit imported changes to HEAD:
pf_ioctl.c Revision 1.153 Sun Aug 7 11:37:33 2005 UTC by dhartmei
 | verify ticket in DIOCADDADDR, from Boris Polevoy, ok deraadt@

 pf_ioctl.c Revision 1.158 Mon Sep 5 14:51:08 2005 UTC by dhartmei
 | in DIOCCHANGERULE, properly initialize table, if used in NAT rule.
 | from Boris Polevoy <vapcom at mail dot ru>, ok mcbride@

 pf.c Revision 1.502 Mon Aug 22 11:54:25 2005 UTC by dhartmei
 | when nat'ing icmp 'connections', replace icmp id with proxy values
 | (similar to proxy ports for tcp/udp). not all clients use
 | per-invokation random ids, this allows multiple concurrent
 | connections from such clients.
 | thanks for testing to Rod Whitworth, "looks ok" markus@

 pf.c Revision 1.501 Mon Aug 22 09:48:05 2005 UTC by dhartmei
 | fix rdr to bitmask replacement address pool. patch from Max Laier,
 | reported by Boris Polevoy, tested by Jean Debogue, ok henning@

Obtained from:	OpenBSD
MFC after:	3 days
2005-09-08 15:06:52 +00:00
Gleb Smirnoff
1bf8e0faed Fix an item leak, that happens when some node calls ng_callout() two
times consequently, without checking whether callout has been serviced
or not. (ng_pptpgre and ng_ppp were catched in this behavior).

  - In ng_callout() save old item before calling callout_reset(). If the
    latter has returned 1, then free this item.
  - In ng_uncallout() clear c->c_arg.

Problem reported by:	Alexandre Kardanev
2005-09-08 14:32:19 +00:00
Gleb Smirnoff
83beeed993 Rework locking, that I have introduced recently, since it was incorrect:
First, mutexed callouts are incompatible with netgraph nodes, because
  netgraph(4) can guarantee that the function will be called with mutex
  held.

  Second, nodes should not send data to their neighbor holding their
  mutex. A node does not know what stack can it enter sending data in
  some direction. May be executing will encounter a place to sleep.

New locking:

  - ng_pptpgre_recv() and ng_pptpgre_xmit() must be entered with mutex held.
  - ng_pptpgre_recv() and ng_pptpgre_xmit() unlock mutex before
    sending data and then return unlocked.
  - callout routines acquire mutex themselves.
2005-09-08 14:26:23 +00:00
Gleb Smirnoff
d04304d155 Make callout_reset() return a non-zero value if a pending callout
was rescheduled. If there was no pending callout, then return 0.

Reviewed by:	iedowse, cperciva
2005-09-08 14:20:39 +00:00
Scott Long
e1ab829ad2 Fix a typo that broke LINT. 2005-09-08 14:13:36 +00:00
Ken Smith
55915fe666 Move hme_stop() after ether_ifdetach() and if_free() to prevent a
memory-referenced-after-free panic if the hme interface fails to
attach.

Patch obtained from:	marius
Suggested same thing:	brooks

MFC after:	3 days
2005-09-08 13:50:16 +00:00
Don Lewis
d07f87a218 Add a new struct buf flag bit, B_PERSISTENT, and use it to tag
struct bufs that are persistently held by ext2fs.  Ignore any buffers
with this flag in the code in boot() that counts "busy" and dirty
buffers and attempts to sync the dirty buffers, which is done before
attempting to unmount all the file systems during shutdown.

This fixes the problem caused by any ext2fs file systems that are
mounted at system shutdown time, which caused boot() to give up on
a non-zero number of buffers and skip the call to vfs_unmountall().
This left all the mounted file systems in a dirty state and caused
them to all require cleanup by fsck on reboot.

Move the two separate copies of the "busy" buffer test in boot()
to a separate function.

Nuke the useless spl() stuff in the ext2fs ULCK_BUF() macro.

Bring the PRINT_BUF_FLAGS definition in sys/buf.h up to date with
this and previous flag changes.

PR:		kern/56675, kern/85163
Tested by:	"Matthias Andree" matthias.andree at gmx.de
Reviewed by:	bde
MFC after:	3 days
2005-09-08 06:30:05 +00:00
Scott Long
dc8540a9a0 Hook up the hptmv driver for amd64.
MFC After: 3 days
2005-09-08 03:29:18 +00:00
Scott Long
d2bd3ab995 Import new version of the HPTMV driver from Highpoint. The major change
here is the support for amd64, as well as possible support for PAE.  Many
thanks to Highpoint for continuing to support FreeBSD.

Obtained from:  Steve Chang @ Highpoint
MFC After: 3 days.
2005-09-07 23:33:26 +00:00
Warner Losh
8d5d6a36cd Sorting the belly button lint of history:
o Note that the first 255 locations are reserved for JEDEC Ids from
	  publication 106 (current revision Q, each one verified with
	  JEDEC and the PMCICA).
	o Move ADAPTEC2 to the right section.
	o Sort TOSHIBA2 numerically.
2005-09-07 22:13:31 +00:00
David E. O'Brien
a7d30e5ffb Use the more readable empty() syntax. 2005-09-07 17:38:46 +00:00
Craig Rodrigues
3a9c56bec9 In set_mouse_pos(), try to avoid division by zero errors. 2005-09-07 15:19:03 +00:00
David E. O'Brien
5ddf29857e Ensure the full value is written into inode variables.
PR:		85503
Submitted by:	Dmitry Pryanishnikov <dmitry@atlantis.dp.ua>
2005-09-07 10:32:58 +00:00
David E. O'Brien
7ba26d99d8 IPv6 was improperly defining its malloc type the same as IPv4 (M_IPMADDR,
M_IPMOPTS, M_MRTABLE).  Thus we had conflicting instantiations.
Create an IPv6-specific type to overcome this.
2005-09-07 10:11:49 +00:00
David E. O'Brien
5b1c0294e4 Forward declaring static variables as extern is invalid ISO-C. Now that
GCC can properly handle forward static declarations, do this properly.
2005-09-07 10:06:14 +00:00
David E. O'Brien
8070a603b2 Reorder code to not depend on an ISO-C illegal forward extern declaration. 2005-09-07 09:53:35 +00:00
Warner Losh
63f90381e9 Consistancy is the hobgoblin of small minds:
o DLINK -> DL100XX
2005-09-07 03:34:24 +00:00
Warner Losh
f2e03f728c Minor reorg of pccard attach code to fix ax88x90 case broken after fixing
dl100xx case.
o We no longer acquire and release resources during attach many times.  We now
  do it once at the beginning.
o Move setting the resource offsets to just after acquiring the ports in
  attach.
o Move ax88x90 code to the end of the file, just after the dl100xx specific
  code.
o Rename ed_pccard_Linksys to ed_pccard_dl100xx to reflect the underlying
  chipset.
o Pass the ed_product structure into ed_pccard_{dl100xx,ax88x90} and have
  those routines test the flags to see if this card should be probed in that
  way.
o transition from ed_probe_Novell to ed_probe_Novell_generic since we already
  have the resources setup.
o Move use of ed_probe_Novell_generic into ed_pccard_dl100xx to be more
  consistant with ax88x90 case.
o simplify the code where we probe for the chipsets
2005-09-07 03:30:58 +00:00
Warner Losh
3ba88ec464 o Expose ed_probe_Novel_generic, it is useful for pccard case.
o Fix a now stale comment.  There are likely many others like them, but this
  one definitely hasn't been true since DELAY was introduced into the tree.
2005-09-07 03:20:33 +00:00
Alan Cox
57b5187b16 Eliminate an incorrect cast. 2005-09-07 01:42:30 +00:00
Warner Losh
56013d44db Fix DL100xx based cards. Don't drop resources. It was approrpiate in
the probe code that this used to be part of, but as part of the
attach, we shouldn't be dropping the resources here.

Also, allocate the proper rid in the ax88x90 setup.
2005-09-07 00:00:16 +00:00
Warner Losh
6942fac077 move away from K&R function definitions 2005-09-06 23:15:21 +00:00
Warner Losh
79e277f155 Work around a bug I've seen on Linksys EC2T cards. For some reason,
as yet unknown, those cards report their MAC address a byte at a time.
However, other AX88x90 cards report the MAC address a word at a time.
Add a heuristic which looks at the high order bytes of the first 6
words.  If they are all '0', assume the card is behaving like the
Linksys EC2T card.  Since the default prefix for these cards appears
to be 00:e0:98, this appears to be a safe heuristic.  While some cards
have been observed with different prefixes, they all work with this
heuristic.

I'm unsure if this is a bug in the EC2T card, or if it is a bug in the
initialization of the card.  No other OS has this heuristic (although
w/o it, the MAC address that is used works).
2005-09-06 22:55:32 +00:00
Warner Losh
e10a8107c6 Go ahead and | in ED_CR_PAGE_0, even though this doesn't change things
at all.  It makes the code clearer.

fix a comment comments about why we need to write i/o address to certain
registers.
2005-09-06 22:46:41 +00:00
Warner Losh
15a38fff14 It turns out that many of the ambicom cards have their CIS resources
listed in different orders.  Since it is easy to identify the Modem
resources vs the Ethernet resources by looking at the size, use that
rather than hard coded rids.  For such parts, go ahead and guess which
rid we should use based on the size.  This guess appears reliable for
the two example cards that I have with different CIS info.
2005-09-06 22:44:26 +00:00
Andrew Thompson
59280079d3 Add support for multicast to the bridge and allow inet6 addresses to be
assigned to the interface.

IPv6 auto-configuration is disabled. An IPv6 link-local address has a
link-local scope within one link, the spec is unclear for the bridge case and
it may cause scope violation.

An address can be assigned in the usual way;
  ifconfig bridge0 inet6 xxxx:...

Tested by:	bmah
Reviewed by:	ume (netinet6)
Approved by:	mlaier (mentor)
MFC after:	1 week
2005-09-06 21:11:59 +00:00
Craig Rodrigues
4506b763e0 In sc_set_text_mode(), reset fontwidth if it is <= 0.
Eliminates division by zero errors in syscons driver.

Reported by:	keramida, Slawa Olhovchenkov <slw at zxy dot spb dot ru>,
		Kyryll Mirnenko <mirya at matrix dot kiev dot ua>
Tested by:	keramida, rodrigc
2005-09-06 20:38:39 +00:00
Gleb Smirnoff
ba5b359aef Fix build. 2005-09-06 20:36:38 +00:00
Søren Schmidt
fba8a154bd Fix problem with finding the still working disk in a broken mirror on VIA. 2005-09-06 19:17:48 +00:00
Gleb Smirnoff
e71fefbe21 When we read data from socket buffer using soreceive() the socket layer
does not clear m_nextpkt for us. The mbufs are sent into netgraph and
then, if they contain a TCP packet delivered locally, they will enter
socket code again. They can pass the first assert in sbappendstream()
because m_nextpkt may be set not in the first mbuf, but deeper in the
chain. So the problem will trigger much later, when local program
reads the data from socket, and an mbuf with m_nextpkt becomes a
first one.

This bug was demasked by revision 1.54, when I made upcall queueable.
Before revision 1.54 there was a very small probability to have 2
mbufs in GRE socket buffer, because ng_ksocket_incoming2() dequeued
the first one immediately.

 - in ng_ksocket_incoming2() clear m_nextpkt on all mbufs
   read from socket.
 - restore rev. 1.54 change in ng_ksocket_incoming().

PR:			kern/84952
PR:			kern/82413
In collaboration with:	rwatson
2005-09-06 17:15:42 +00:00
Gleb Smirnoff
016e62123a In soreceive(), when a first mbuf is removed from socket buffer use
sockbuf_pushsync(). Previous manipulation could lead to an inconsistent
mbuf.

Reviewed by:	rwatson
2005-09-06 17:05:11 +00:00
Gleb Smirnoff
b32cfb3228 In INVARIANTS case also check that nodes do not pass queues of mbufs
each other.
2005-09-06 17:02:13 +00:00
Gleb Smirnoff
c6118fcc1c Raise one more bit in READER_MASK. I believe that before this change
it was possible to have 1 reader and 1 writer thread working on
a node simultaneously.

Reviewed by:	julian
2005-09-06 16:58:25 +00:00
Gleb Smirnoff
f46ab10c02 Document flags of a pollrec. 2005-09-06 11:09:18 +00:00
Christian S.J. Peron
d1dfd92177 Convert the primary ACL allocator from malloc(9) to using a UMA zone instead.
Also introduce an aclinit function which will be used to create the UMA zone
for use by file systems at system start up.

MFC after:	1 month
Discussed with:	rwatson
2005-09-06 00:06:30 +00:00
Christian S.J. Peron
b75a24a075 Instead of caching the PID which opened the bpf descriptor, continuously
refresh the PID which has the descriptor open. The PID is refreshed in various
operations like ioctl(2), kevent(2) or poll(2). This produces more accurate
information about current bpf consumers. While we are here remove the bd_pcomm
member of the bpf stats structure because now that we have an accurate PID we
can lookup the via the kern.proc.pid sysctl variable. This is the trick that
NetBSD decided to use to deal with this issue.

Special care needs to be taken when MFC'ing this change, as we have made a
change to the bpf stats structure. What will end up happening is we will leave
the pcomm structure but just mark it as being un-used. This way we keep the ABI
in tact.

MFC after:	1 month
Discussed with:	Rui Paulo < rpaulo at NetBSD dot org >
2005-09-05 23:08:04 +00:00
Tor Egge
d536ff2edb Retain generation count when writing zeroes instead of an inode to disk.
Don't free a struct inodedep if another process is allocating saved inode
memory for the same struct inodedep in initiate_write_inodeblock_ufs[12]().

Handle disappearing dependencies in softdep_disk_io_initiation().

Reviewed by:	mckusick
2005-09-05 22:14:33 +00:00
Marcel Moolenaar
cca2e0f1cc Milestone: enable SMP by default. 2005-09-05 21:36:28 +00:00
Marcel Moolenaar
ab870058d7 o In pmap_remove_pte: always invalidate the page. Previously the page
was not invalidated if the PTE was not actually being removed.  In
   an UP kernel this didn't cause problems, because the new mapping
   would preempt the old one. In an SMP kernel this could lead to the
   use of stale translations when processes move between CPUs at the
   "right" moment.  This fixes the last of the obvious SMP problems
   and it should be safe to enable SMP by default now.
o  In pmap_remove_pte: minor code refactoring to avoid duplication.
o  Test all PTE pointers against NULL. Don't use implicit boolean
   tests.
2005-09-05 21:32:02 +00:00
R. Imura
884a8db7a8 Fix panic when loading libiconv.ko on sparc64.
It seems that this issue only become obvious when compiled with -O2
on sparc64.

Since each struct iconv_converter_class has been initialized by
DEFINE_CLASS macro, not all members of struct iconv_converter_class
has been allocated on memory and cc_link member has not been
initialized, while iconv_register_converter() wanted to access it
with TAILQ.
Now we modify KICONV_CONVERTER macro and fix this bug.

Problem reported on:	freebsd-sparc64
Pointed out by:		yongari
Discussed with:		yongari
Tested by:		yongari
MFC after:		3 days
2005-09-05 17:03:40 +00:00
Gleb Smirnoff
16901c0186 Remove Giant mutex from polling(4) and use a separate poll_mtx(4)
instead. Detailed changelist:

o Add flags field to struct pollrec, to indicate that
  are particular entry is being worked on.
o Define a macro PR_VALID() to check that a pollrec
  is valid and pollable.
o Mark ISRs as mpsafe.

o ether_poll()
  - Acquire poll_mtx while traversing pollrec array.
  - Skip pollrecs, that are being worked on.
  - Conditionally acquire Giant when entering handler.

o netisr_pollmore()
  - Conditionally assert Giant.
  - Acquire poll_mtx while working with statistics.

o netisr_poll()
  - Conditionally assert Giant.
  - Acquire poll_mtx while working with statistics
    and traversing pollrec array.

o ether_poll_register(), ether_poll_deregister()
  - Conditionally assert Giant.
  - Acquire poll_mtx while working with pollrec array.

o poll_idle()
  - Remove all strange manipulations with Giant.

In collaboration with:	ru, pjd
In collaboration with:	Oleg Bulyzhin <oleg rinet.ru>
In collaboration with:	dima <_pppp mail.ru>
2005-09-05 16:02:11 +00:00
Poul-Henning Kamp
e4da09c03f Remove a race condition that could result in processes being stuck
waiting for geom events to happen:

Instead of maintaining a count of outstanding events, simply look if
the queue is empty.  Make sure to not remove events from the queue
until they are executed in order to not open a new race.

Much work by:	pjd
Tested by:	kris
MT6:		yes, should be.
2005-09-04 19:14:19 +00:00
Alan Cox
3be99ffc1a Eliminate unnecessary TLB invalidations by pmap_enter(). Specifically,
eliminate TLB invalidations when permissions are relaxed, such as when a
read-only mapping is changed to a read/write mapping.  Additionally,
eliminate TLB invalidations when bits that are ignored by the hardware,
such as PG_W ("wired mapping"), are changed.

Reviewed by:	tegge
2005-09-04 19:06:27 +00:00
Xin LI
5248ef8a3c When padding with zero, do pad after prefixes rather than padding
before prefixes.

Use cases:
	printf("%05d", -42);   -->   "00-42"   (should be "-0042")
	printf("%#05x", 12);   -->   "000xc"   (should be "0x00c")

Submitted by:	Oliver Fromme
PR:		kern/85520
MFC After:	1 week
2005-09-04 18:03:45 +00:00
Sam Leffler
245c31ccaf clear lock on error in O_LIMIT case of install_state
Submitted by:	Ted Unangst
MFC after:	3 days
2005-09-04 17:33:40 +00:00
Sam Leffler
62313e4c3f reclaim sbuf and clear lock on error in ifconf
Submitted by:	Ted Unangst
Reviewed by:	rwatson
MFC after:	3 days
2005-09-04 17:32:47 +00:00
Pawel Jakub Dawidek
dcc34049f8 When bge_stop() is called from bge_detach(), mii is already NULL, so check
before trying to use it.
This fix allows to 'kldunload if_bge' without panicing.

Reviewed by:	bz
MFC after:	3 days
2005-09-04 06:35:59 +00:00
David E. O'Brien
59f3cbd7f1 de(4) is now properly busdma'ed.
Reviewed by:	jhb
2005-09-04 05:37:55 +00:00
Marcel Moolenaar
5280c8c2ab o s/vhpt_size/pmap_vhpt_log2size/g
o  s/vhpt_base/pmap_vhpt_base/g
o  s/vhpt_bucket/pmap_vhpt_bucket/g
o  Declare the above in <machine/pmap.h>
o  Move the vm.stats.vhpt.* sysctls to machdep.vhpt.*
o  Create a tunable machdep.vhpt.log2size, with corresponding sysctl.
   The tunable allows the user to specify the VHPT size from the loader.
o  Don't keep track of the number of PTEs in the VHPT. Calculate the
   population when necessary by iterating the buckets and summing up
   the length of the buckets.
o  Don't perform the tpa instruction with a bucket lock held. The
   instruction can (theoretically) fault and locking is not needed.
2005-09-03 23:53:50 +00:00
Warner Losh
a8cbc96cd8 More consistantly return the correct BAR size. Before, we'd only
return the correct bar size if we encountered a 64-bit BAR that had
its resources already assigned.  If the resources weren't yet
assigned, we'd bogusly assume it was a 32-bit bar and return 1.
2005-09-03 23:15:46 +00:00
Suleiman Souhlal
68da388325 Unbreak hpfs/ntfs/udf/ext2fs/reiserfs mounting.
Another pointyhat to:	ssouhlal
2005-09-03 20:23:41 +00:00
Marcel Moolenaar
43be3aac7a Fix collision chain termination checks. The result of IA64_PHYS_TO_RR7
is never 0, so one cannot test for a NULL pointer after a physical
address is translated into a virtual pointer with said macro. Instead,
keep the physical address around and test it against 0. Note that
this obviously implies that a PTE can never be allocated at physical
address 0. This isn't exactly guaranteed, but hasn't been a problem
so far. We test the physical address against 0 for as long as the ia64
port exists...
2005-09-03 19:43:15 +00:00
Alan Cox
ba8bca610c Pass a value of type vm_prot_t to pmap_enter_quick() so that it determine
whether the mapping should permit execute access.
2005-09-03 18:20:20 +00:00
Poul-Henning Kamp
ac4b76b7ff Typo. 2005-09-03 11:03:10 +00:00
Poul-Henning Kamp
1e7d2c4763 If we ignore an unknown % sequence, we must stop interpreting the
remaining % arguments because the varargs are now out of sync and
there is a risk that we might for instance dereference an integer
in a %s argument.

Sponsored by: Napatech.com
2005-09-03 10:28:08 +00:00
Suleiman Souhlal
44bd2bc19a Unbreak the build.
Pointyhat to:	ssouhlal
2005-09-03 00:40:19 +00:00
John Baldwin
b3c04741dd Add a SYSUNINIT() to SX_SYSINIT() to call sx_destroy() to destroy the sx
lock when a module is unloaded similar to the recent change made to
MTX_SYSINIT().

Suggested by:	pjd
MFC after:	3 days
2005-09-02 20:41:03 +00:00
John Baldwin
acc0265cc2 - Add some comments to some of the static lock orders. Don't explicitly
link proctree and allproc to Giant since that order is already implicitly
  enforced.
- Use a goto to handle the case where we want to enforce a reversal before
  calling isitmydescendant() in witness_checkorder() so that the logic is
  easier to follow and so that it is easier to add more forced-reversal
  cases in the future.

MFC after:	 3 days
2005-09-02 20:23:49 +00:00
John Baldwin
83cece6fa1 - Add an assertion to panic if one tries to call mtx_trylock() on a spin
mutex.
- Don't panic if a spin lock is held too long inside _mtx_lock_spin() if
  panicstr is set (meaning that we are already in a panic).  Just keep
  spinning forever instead.
2005-09-02 20:21:49 +00:00
John Baldwin
83de502d59 Add witness warnings to panic if a thread tries to exit while holding any
locks.

Requested by:	jeff
MFC after:	3 days
2005-09-02 20:20:01 +00:00
Gleb Smirnoff
6064e568ec Use non-debug macros inside debugging functions, to prevent
important information from being rewritten.
2005-09-02 19:52:54 +00:00
Gleb Smirnoff
1048c51f6d Change default KTR_COMPILE from KTR_GEN to KTR_ALL, to match with
manual page.

Reviewed by:	jhb, pjd
2005-09-02 19:34:13 +00:00
Nate Lawson
9000b91eb9 Break out the checks for duplicates and absolute settings being too high
instead of trying to do them all at once.  This should fix the level sorting
problems from the previous revision.

Testing help:	ume
2005-09-02 16:32:43 +00:00
Suleiman Souhlal
1f71de49e1 Print out a warning and a backtrace if we try to unlock a lockmgr that
we do not hold.

Glanced at by:	phk
MFC after:	3 days
2005-09-02 15:56:01 +00:00
Suleiman Souhlal
cdeb72045b Use vput() instead of vrele() in null_reclaim() since the lower vnode
is locked.

MFC after:	3 days
2005-09-02 15:49:55 +00:00
Suleiman Souhlal
75d7ba93af *_mountfs() (if the filesystem mounts from a device) needs devvp to be
locked, so lock it.

Glanced at by:	phk
MFC after:	3 days
2005-09-02 15:27:23 +00:00
Suleiman Souhlal
fdedad764a ffs_mountfs() needs devvp to be locked, so lock it.
Glanced at by:	phk
Tested by:	pjd
MFC after:	3 days
2005-09-02 13:52:55 +00:00
Suleiman Souhlal
2611e5a6a9 Don't unbusy the devfs mount in vfs_mountroot_try() as it gets accessed
and unbusied in devfs_fixup(), which assumes that the devfs mount is
still locked.

Granced at by:	phk
MFC after:	3 days
2005-09-02 13:37:54 +00:00
Warner Losh
9baacb5117 MFp4: kill bogus comment 2005-09-02 03:15:51 +00:00
Pawel Jakub Dawidek
d8b464e51e In case of mac_check_vnode_rename_from() or vn_start_write() failure,
vn_finished_write() should not be called.

Reviewed by:	ssouhlal
MFC after:	3 days
2005-09-01 21:46:33 +00:00
Warner Losh
16e16d771c At some point in the past, we read the PROM by words. Now we read
PROM by bytes.  Adjust the extraction of the MAC address from this data
to reflect this change.

This gets the AX88x90 based PC Cards MAC address working again (my
UMAX Ethernet and Linksys EC2T cards now work).

MFC After: 3 days
2005-09-01 20:08:24 +00:00
John Baldwin
9a1bbc523c Typo in comment. 2005-09-01 16:41:42 +00:00
Warner Losh
b81b5c06b4 Treat resources that are 0xfffff.... as being 'unassigned'.
Reviewed by: jhb
Tested by: Mark Kirkwood
MFC After: 3 days
2005-09-01 02:42:34 +00:00
Pawel Jakub Dawidek
7ee3c044d0 - Add md_mtx lock to protect ID number and list of devices.
- Always check mdnew() return value, as even in !autounit case
  kthread_create() can fail.

Those two changes fix serval panics provked by simple stress test.

Tested by:	Kris The BugMagnet
MFC after:	3 days
2005-08-31 19:45:11 +00:00
Maksim Yevmenkin
82e1becc5f Fix dangling callout problem in the Bluetooth L2CAP code that leads to
panic. The panic happens when outgoing L2CAP connection descriptor is
deleted with the L2CAP command(s) pending in the queue. In this case when
the last L2CAP command is deleted (due to cleanup) and reference counter
for the L2CAP connection goes down to zero the auto disconnect timeout
is incorrectly set. pjd gets credit for tracking this down and committing
bandaid.

Reported by:	Jonatan B <onatan at gmail dot com>
MFC after:	3 days
2005-08-31 18:13:23 +00:00
John Baldwin
7b7b9810bd - Only call txp_release_resources() once if attach fails.
- Set errno to ENXIO instead of 0 in several attach failure cases.
- Setup the interrupt handler at the very end of txp_attach() after
  ether_ifattach().
- Various whitespace fixes in function prototypes.
2005-08-31 18:09:54 +00:00
John Baldwin
7afed9d69a Use if_printf() and device_printf() for printf's and remove the unit number
from the softc.

MFC after:	3 days
2005-08-31 18:03:18 +00:00
Warner Losh
2401a67b34 Update for a few recently discovered Olicom token ring cards:
OC3231 Token Ring + 28.8 modem
	OC3232 Token Ring + 33.6 modem
2005-08-31 17:00:48 +00:00
Yaroslav Tykhiy
eefbcf0e62 Use VLAN_TAG_VALUE() not only to read a dot1q tag
value from an m_tag, but also to set it.  This reduces
complex code duplication and improves its readability.

Alas, we shouldn't rename the macro to VLAN_TAG_LVALUE()
globally because that would cause pain for kernel module
port maintainers and vendors using FreeBSD as their codebase.
Added a clarifying comment instead.

Discussed with:	ru, glebius
X-MFC-After:	6.0-RELEASE (MFC is good just to reduce the diff)
2005-08-31 11:36:50 +00:00
Gleb Smirnoff
a3a90a725c net.graph.ngqfreemax has been deprecated. 2005-08-31 10:51:55 +00:00
Craig Rodrigues
1217bf6a9b FDOPT_NORETRY is an option, and must be compared with fd->options,
not fd->flags.

PR:		kern/85481
Submitted by:	Lev Levinson <llevinson at inbox dot ru>
MFC after:	1 day
2005-08-30 23:12:18 +00:00
Andre Oppermann
fdcc028d11 Changes and cleanups to m_sanity():
o for() instead of while() looping  over mbuf chain
o paren's around all flag checks
o more verbose function and purpose description
o some more style changes

Based on feedback from:	sam
2005-08-30 21:31:42 +00:00
Andre Oppermann
e0068c3a69 Unbreak m_demote() and put back the 'all' flag. Without it we cannot
correctly test for m_nextpkt in an mbuf chain.
2005-08-30 21:14:30 +00:00
John Baldwin
a6c222c739 Various locking fixes and mark MPSAFE:
- Add locked variants of start(), init(), ifmedia_upd(), and poll() and stop
  recursing on the driver lock.
- Add locking to ifmedia_upd() and ifmedia_sts().
- Use callout_*() instead of timeout/untimeout.
- Fix locking in ioctl().

Tested by:	Bob Bishop rb at gid dot co dot uk
MFC after:	3 days
2005-08-30 20:35:08 +00:00