Commit Graph

53705 Commits

Author SHA1 Message Date
Peter Wemm
d1734bad0a It seems I introduced a new prerequisite for <machine/pcb.h> on i386,
which is included from <sys/user.h>.  Add a bandaid for userland.
2005-04-14 04:13:27 +00:00
Matt Jacob
4a296eb866 Apply quirk.
PR:		57469
Submitted by:	walter@pelissero.de
MFC after:	1 week
2005-04-14 04:12:45 +00:00
Matt Jacob
dbd93079d3 Applied conservative version of suggested quirk.
PR:		57468
Submitted by:	walter@pelissero.de
MFC after:	1 week
2005-04-14 04:05:00 +00:00
Matt Jacob
b1ce2b3e22 Apply quirk suggested by submitter.
PR:		75486
Submitted by:	no_bs@web.de
MFC after:	1 week
2005-04-14 03:59:48 +00:00
Matt Jacob
8b11740052 The divide by zero panic must have been due to a bogus
period value. I suppose the BT adapter driver should be
fixed, but more importantly we should protect against
dividing by zero.

PR:		kern/75603
MFC after:	1 week
2005-04-14 03:52:50 +00:00
Peter Wemm
4740f5439a Allow user processes to completely empty out their LDT, now that user
processes run from segment selectors that live in the GDT.  Doing this
used to be equivalent to committing suicide, but now this is a NOP.
2005-04-14 03:16:58 +00:00
Jeff Roberson
74a5123246 - Remove a debugging printf that slipped in.
Spotted by:	Peter Wemm
2005-04-13 23:36:28 +00:00
Peter Wemm
e0ab2c6d10 Change the segment limits to 4GB, we set the user accessible bit on all
of the kernel address space already.  Intel recommend this anyway, because
using a non-4GB limit adds an additional clock cycle to address generation.
We were able to install 4GB segments into the LDT, so any limits we imposed
on %cs and %ds were academic anyway.  More importantly, this allows us to
make a page in the kernel readable to user applications, for holding things
like the signal trampoline and other fun things.

Move the user %cs/%ds segments from the LDT to the GDT.  There was no good
reason for them to be there anyway.  The old LDT entries are still there
but we can now relax the restriction that prevented users from emptying
the default LDT entries.

Putting user and kernel %cs and %ds together allows us to access the fast
sysenter/sysexit/syscall/sysret instructions.  syscall/sysret in particular
require that the user/kernel segments be laid out this way.  Reserve a slot
specifically for NDIS while here.

Create two user controllable slots in the GDT that are context switched
with the (kernel) thread.  This allows user applications to set two
user privilige selectors to arbitary values.  Create
i386_set_fsbase(void *base) and friends. (get/set, fs/gs).  For i386,
%gs is used by tls and the thread libraries and this means that user
processes no longer have to have the cost of having a custom LDT, and
we will no longer to do a ldt switch when activating a kthread/ithread in
the usual case any more.

In other words, we can now set the base address for %fs and %gs to arbitary
addresses without the pain of messing with ldt segments.
2005-04-13 22:57:17 +00:00
Gleb Smirnoff
699df192d9 Fix mss byte order, only affects synproxy code path.
Submitted by:	John L. Scarfone via OpenBSD
Reviewed by:	mlaier
Obtained from:	OpenBSD, rev. 1.483
MFC after:	2 days
2005-04-13 21:05:55 +00:00
Warner Losh
283f4553ed Fix compile error :-(. 2005-04-13 19:10:27 +00:00
Peter Wemm
85b23d1138 Fix an evil bug that appeared in September 2003. VM86 bios calls use two
of the __pcb_spare longs.  Except that fields were changed and one of the
spare values was used and the __pcb_spare field was reduced from two to one
long.  Now VM86 bios calls can trash the first 4 bytes of the next page
following the kernel stack/pcb.  This Is Bad(TM).  This bug has been
present in 5.2-release and onwards, and is still in RELENG_5.

Instead of tempting fate and trying to use "spare" fields, explicitly
reserve them.
2005-04-13 18:13:40 +00:00
Matthew N. Dodd
8437ff3c79 Test for NULL before use.
Submitted by:	sam (Coverity)
2005-04-13 17:39:43 +00:00
Matthew N. Dodd
682249c035 Add KASSERT() to warn against NULL deref.
Submitted by:	sam (Coverity)
2005-04-13 17:36:18 +00:00
Bruce M Simpson
37ce43b71e Use pci_find_bsf() to retrieve the PCI device associated with
a bus/device/function tuple.
This change enables pciconf(8) to work with CardBus devices.

Reviewed by:	imp
2005-04-13 17:34:38 +00:00
Julian Elischer
b7fd00d97c The maximum allowable alloc is 16K not (16K-1).
This whole section is actually overly restrictive and
another patch is in the works.
2005-04-13 16:39:22 +00:00
Warner Losh
3f7d3c1e3c Since cbb implements the pcib_ interface, it must also implement the
pcib_route_interrupt interface.  Since there's only one interrupt pin
in the CardBus form factor, everybody gets to share it.  Implement
cbb_route_interrupt to return the interrupt we have.

Suggested by: bms
2005-04-13 16:35:15 +00:00
Warner Losh
491bfec707 Default to a interrupt router that returns an invalid interrupt.
Otherwise, busses that implement the pcib interface that forget to
implement pcib_route_interrupt would return EIO, which the caller
interprets as 'use interrupt 6'.  This is likely the cause of much of
the grief that we had when I enabled power modes for the cardbus
bridge, since the card needed to reroute the interrupt to it and it
was getting 6 which was d by the pccbb sanity checks.
2005-04-13 16:30:30 +00:00
Olivier Houchard
f5c4c316eb pmap_update() is gone. 2005-04-13 16:02:03 +00:00
Warner Losh
23804f1a7d Never hardcode /sys into these Makefiles. The proper way to spell it is $S.
Also, move the -I stuff to the centralized kern.pre.mk.  However, it
might be better to add these flags to files.conf.  This is a short
term fix to fix the broken builds on my machine (I don't have a valid
/sys link).
2005-04-13 14:49:57 +00:00
Gleb Smirnoff
20064a62a9 NG_MKRESPONSE() macro includes sizeof struct ng_mesg when doing allocation.
PR:		kern/79806
Submitted by:	Wojciech A. Koszek
2005-04-13 14:03:28 +00:00
Tai-hwa Liang
2d4420789d According to the comment in struct tty, t_modem is optional; hence we should
guard against NULL t_modem entry. Otherwise, driver doesn't have t_modem
callback implemented(such like sys/dev/usb/ucycom.c) would panic when
someone opens the driver's associated tty device.

Reviewed by:	phk, sam (mentor)
2005-04-13 13:56:17 +00:00
Yoshihiro Takahashi
ce45d2c162 - Remove ifdef PC98.
- Reduce diffs from i386.
2005-04-13 13:26:48 +00:00
Yoshihiro Takahashi
aaaf1a6d53 Remove a meaningless include. 2005-04-13 13:18:32 +00:00
Yoshihiro Takahashi
91649ac9bd Move pc98 specific parts to the pc98 specific file. 2005-04-13 13:12:12 +00:00
Yoshihiro Takahashi
99a4a4cabc Remove ifdef PC98. 2005-04-13 13:02:58 +00:00
Jeff Roberson
4585e3ac5a - Change all filesystems and vfs_cache to relock the dvp once the child is
locked in the ISDOTDOT case.  Se vfs_lookup.c r1.79 for details.

Sponsored by:	Isilon Systems, Inc.
2005-04-13 10:59:09 +00:00
Jeff Roberson
374df05fd3 - Change vop_lookup_post assertions to reflect recent vfs_lookup changes.
Sponsored by:	Isilon Systems, Inc.
2005-04-13 10:57:53 +00:00
Jeff Roberson
18ef8344b4 - Further simplify lookup; Force all filesystems to relock in the DOTDOT
case.  There are bugs in some which didn't unlock in the ISDOTDOT case
   to begin with that need to be addressed seperately.  This simplifies
   things anyway.
 - Fix relookup() to prevent it from vrele()'ing the dvp while the vp
   is locked.  Catch up to other lookup changes.

Sponsored by:	Isilon Systems, Inc.
Reported by:	Peter Wemm
2005-04-13 10:57:13 +00:00
Matthew N. Dodd
f7251b07e2 Add #defines for control fields and address bits. 2005-04-13 08:14:14 +00:00
Matthew N. Dodd
ce99e87705 Support for the GTCO Digipad. 2005-04-13 07:25:45 +00:00
Søren Schmidt
d5514ba365 Add a ata_setmode method so we dont panic on setmode.
Note that the mode is only set on the device, we (mostly) have
no knowledge on how to set mode on the controller if at all possible.
2005-04-13 07:14:17 +00:00
Matthew N. Dodd
8f6a80b791 Make it clear that the statement following the conditional is a NOP. 2005-04-13 06:42:43 +00:00
Eric Anholt
354096a348 Follow i386's suit and include AGP support in the generic kernel. 2005-04-13 06:00:07 +00:00
Matthew N. Dodd
014fbb87b8 Define additional commands.
Obtained from:	 Linux
2005-04-13 05:09:49 +00:00
Matthew N. Dodd
b1a9ec048e Whitespace cleanup. 2005-04-13 05:06:57 +00:00
Matthew N. Dodd
9cf4a5d55f Remove unnecessary dpt_free(). 2005-04-13 05:03:14 +00:00
Matthew N. Dodd
f9763094f1 Implement SOUND_MIXER_INFO ioctl in compat layer. 2005-04-13 04:33:06 +00:00
Matthew N. Dodd
73c730a694 Add support for O_NOFOLLOW and O_DIRECT to Linux fcntl() F_GETFL/F_SETFL. 2005-04-13 04:31:43 +00:00
Matthew N. Dodd
71ba49aa94 Invert conditional and use continue to reduce nesting. 2005-04-13 03:36:24 +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
Marcel Moolenaar
f6126e7b40 Build cpufreq on ia64. The upcoming Montecito processor supports the
Enhanced SpeedStep (that is, a follow-up of it called Foxton). Until
we actually have support for that, we build to catch regressions in
the framework.

Triggered by: njl
2005-04-13 02:20:17 +00:00
Matthew N. Dodd
c7ae8b4fa8 Invert conditional and use continue to reduce nesting. 2005-04-13 01:32:06 +00:00
Matthew N. Dodd
df214d19a3 Bump __FreeBSD_version for LOCAL_CREDS, LOCAL_CONNWAIT.
Requested by:    marcus
2005-04-13 00:45:49 +00:00
Matthew N. Dodd
b137ea624b Provide a sysctl (net.link.tap.user_open) to allow unpriviliged
acces to tap(4) device nodes based on file system permission.

Duplicate the 'debug.if_tap_debug' sysctl under the
'net.link.tap' hierarchy.
2005-04-13 00:30:19 +00:00
Matthew N. Dodd
6a2989fd54 Implement unix(4) socket options LOCAL_CREDS and LOCAL_CONNWAIT.
- Add unp_addsockcred() (for LOCAL_CREDS).
- Add an argument to unp_connect2() to differentiate between
  PRU_CONNECT and PRU_CONNECT2. (for LOCAL_CONNWAIT)

Obtained from:	 NetBSD (with some changes)
2005-04-13 00:01:46 +00:00
Robert Watson
87efd4d58a Consistently style function declarations in kern_malloc.c.
MFC after:	3 days
2005-04-12 23:54:34 +00:00
Warner Losh
1e4500012d don't use C keyword register as CPP macro argument name 2005-04-12 23:32:26 +00:00
John Baldwin
aa9aa68d2f Use PCPU_LAZY_INC() for cnt.v_{intr,trap,syscalls} rather than atomic
operations in some places and simple non-per CPU math in others.
2005-04-12 23:18:54 +00:00
John Baldwin
9fd0669542 Tidy vcnt() by moving a duplicated line above #ifdef and removing a useless
variable.
2005-04-12 23:15:28 +00:00
John Baldwin
ae3676c4e2 Use NULL rather than 0 in a couple of places. 2005-04-12 23:12:46 +00:00
John Baldwin
181897f05f The memory operands to fldcw and ldmxcsr are inputs, not outputs. 2005-04-12 23:12:00 +00:00
Olivier Houchard
ec2b39b483 We have an asm version of bcmp(), so we could use it as well. 2005-04-12 22:46:09 +00:00
Vinod Kashyap
f0c1dee27f The latest release of the FreeBSD driver (twa) for
3ware's 9xxx series controllers.  This corresponds to
the 9.2 release (for FreeBSD 5.2.1) on the 3ware website.

Highlights of this release are:

1. The driver has been re-architected to use a "Common Layer"
    (all tw_cl* files), which is a consolidation of all OS-independent
    parts of the driver.  The FreeBSD OS specific portions of the
    driver go into an "OS Layer" (all tw_osl* files).
    This re-architecture is to achieve better maintainability, consistency
    of behavior across OS's, and better portability to new OS's (drivers
    for new OS's can be written by just adding an OS Layer that's specific
    to the OS, by complying to a "Common Layer Programming Interface" API.

2. The driver takes advantage of multiple processors.

3. The driver has a new firmware image bundled, the new features of which
   include Online Capacity Expansion and multi-lun support, among others.
   More details about 3ware's 9.2 release can be found here:
   http://www.3ware.com/download/Escalade9000Series/9.2/9.2_Release_Notes_Web.pdf

Since the Common Layer is used across OS's, the FreeBSD specific include
path for header files (/sys/dev/twa) is not part of the #include pre-processor
directive in any of the source files.  For being able to integrate twa into
the kernel despite this, Makefile.<arch> has been changed to add the include
path to CFLAGS.

Reviewed by: scottl
2005-04-12 22:07:11 +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
Matthew N. Dodd
55ec9ed408 - Consistently protect against NULL dereference.
- Simplify conditional logic to make code easier to read.
2005-04-12 20:14:56 +00:00
Marcel Moolenaar
a08d773359 Dot the i's:
1  Move the debug.clock_adjust_* sysctls to debug.clock.adjust_* to
   make it easier to get only the clock statistics.
2  Make the sysctls read-only [suggested by Marius].
3  When determining the new clock adjustment, we checked for an error
   either larger than 12.5% or smaller than 12.5%. We left out an error
   of exactly 12.5%. For errors larger than 12.5% we adjust the clock
   reload value in such a way that the next clock interrupt would be
   early (as in premature). For errors less than 12.5% we stopped the
   adjustment.
   The current algorithm doesn't benefit from excluding an error of
   exactly 12.5%. Change the code to stop adjusting the clock if the
   error is *not* larger than 12.5% [suggested by Marius].

Discussed with: marius@
2005-04-12 18:50:57 +00:00
Sam Leffler
8ca623d734 honor new IEEE80211_KEY_GROUP key flag
Reviewed by:	Tai-hwa Liang
2005-04-12 17:56:43 +00:00
Sam Leffler
dd70e17b12 Revise crypto api lightly to improve group key handling:
o don't pre-assign key index to the global key table entries so device
  has a chance to decide what to use
o make ieee80211_crypto_newkey take the desired flags as an argument
  instead of wacking the key structure directly; this eliminates a
  bunch of code warts
o add a new flag IEEE80211_KEY_GROUP to indicate a key is a WPA Group
  key so devices don't need to guess (temporarily add this flag in the
  ioctl code until we can get wpa_supplicant+hostapd updated)
o shuffle IEEE80211_KEY_* bits to move flags used internally to the high
  nibble of the flags word

Reviewed by:	Tai-hwa Liang
2005-04-12 17:55:13 +00:00
Suleiman Souhlal
db81b64fc4 Unbreak the powerpc build by fixing some ATA constants that were renamed.
Approved by:	grehan (mentor)
2005-04-12 15:59:54 +00:00
Warner Losh
2bf7a0e949 Big cleanup of resource code for pccard. Once coventry noticed
problems here, it became clear we were being too complex.

o Don't keep track of resources in two places
o Use resource_list_purge instead of rolling our own
o Just reassign the ownership of the resource, rather than freeing it
  and reallocating it.
o Fix compile problems when sizeof(u_long) != sizeof(int)
2005-04-12 15:25:31 +00:00
Søren Schmidt
b71229c0ac On amd64 int64_t != long long. 2005-04-12 15:24:00 +00:00
Warner Losh
2bd5d8147a resource_list_purge: release the resources in this list, and purge the
elements of this list (eg, reset it).

Man page to follow
2005-04-12 15:20:36 +00:00
Søren Schmidt
5c2fe6346d Better use the right name for the VIA software RAID. 2005-04-12 13:29:47 +00:00
Søren Schmidt
8ef82837f5 Add support for VIA Tech metadata as used on thier SATA parts. 2005-04-12 12:25:27 +00:00
Pawel Jakub Dawidek
811787079b Protect against recursive labels creation in simlar way as it is done
in BSD and MBR classes, ie. if provider below us uses the same metadata,
don't create labels based on the metadata.
This allows to create labels on geoms with rank != 1 without hacks.

Tested by:	Chris Elsworth <chris@shagged.org> on sparc64
OK'ed by:	phk
MFC after:	2 weeks
2005-04-12 08:14:15 +00:00
Warner Losh
f351862a17 rman_set_device() seems to have been omitted by mistake. Implement it. 2005-04-12 06:21:59 +00:00
Warner Losh
1a3f777ef4 Cleanup of resource allocation code after having my attention focused on
this code:
o rid is stored in the resource, so don't bother keeping track of it here.
o Implement memory space
o Don't try to activate 'memory card' CFEs.  This is type memory, as opposed
  to the memory resource.
2005-04-12 06:00:06 +00:00
Jeff Roberson
0b581232df - Remove unused include. 2005-04-12 05:45:58 +00:00
Jeff Roberson
436901a86b - Differentiate two UPGRADE panics so I have a better idea of what's going
on here.
2005-04-12 05:43:03 +00:00
Warner Losh
a3e2432858 Use return value of resource_list_add to avoid a second
resource_list_find.  Check to make sure that rle is not NULL and panic
if it is (but it appears that resource_list_add already panics, so I'm
not entirely sure it is necessary now).

Add a test to make sure we have a interrupt resource when we're
disabling it.  This is also a cannot happen, but the extra care
shoudln't hurt.

Found by: Coventry tool via sam@
2005-04-12 04:30:35 +00:00
Warner Losh
cdf7c848cf Return the resource created/found in resource_list_add to avoid an extra
resouce_list_find in some places.

Suggested by: sam
Found by: Coventry Analysis tool.
2005-04-12 04:22:17 +00:00
Jeff Roberson
cbc5da3a74 - Add the mising ASSERT_VOP_ELOCKED code in the !DEBUG_VFS_LOCKS case.
Pointy hat to:	me
2005-04-12 00:44:46 +00:00
Ian Dowse
f04d2ba47f Fix the handling of the UCS_RXSTOP flag so that it always tracks
whether or not the receive pipe is stopped. This ensures that we
do not attempt to start the same transfer twice, and it allows
ucomstop() to skip the restarting of the read pipe if it was not
originally running, such as when called indirectly from ucomreadcb().

PR:		kern/79420
MFC after:	1 day
2005-04-12 00:26:40 +00:00
Søren Schmidt
308f942ec9 Fix the same silly alloc mistake for nVidia and SiS as with VIA in
the previous commit.
2005-04-11 20:50:14 +00:00
Søren Schmidt
50fc814789 Fix the bug that caused SATA disks on VIA etc to fail attach. 2005-04-11 20:28:15 +00:00
Bill Paul
0a5c534cd2 In winx32_wrap.S, preserve return values in the fastcall and regparm
wrappers by pushing them onto the stack rather than keeping them in %esi
and %edi.
2005-04-11 17:04:49 +00:00
Bill Paul
c1972c49a8 Add winx32_wrap.S to files.i386 for the NDISulator. 2005-04-11 16:23:13 +00:00
Jeff Roberson
17c916e321 - Mark the VOPs that require exclusive locks. Those that aren't marked
with E may be called with a shared lock held.  This list really could
   be made per filesystem if we had any filesystems which differed from
   ffs in locking guarantees.  VFS itself is not sensitive to this except
   where vgone() etc. are concerned.

Sponsored by:	Isilon Systems, Inc.
2005-04-11 15:19:29 +00:00
Jeff Roberson
539de9eda0 - Enable ASSERT_VOP_ELOCKED and assert_vop_elocked() now that vnode_if.awk
uses it.

Sponsored by:	Isilon Systems, Inc.
2005-04-11 15:17:06 +00:00
Jeff Roberson
680a1ec631 - Add the character "E" to the understood lock types. This means
the VOP requires an exclusive lock.

Sponsored by:	Isilon Systems, Inc.
2005-04-11 15:15:03 +00:00
Maxime Henrion
22a8b40510 Use comments after .endif to please make(1) with latest changes so
that it's possible to build a kernel without getting flooded with
thousands of warnings.
2005-04-11 12:54:03 +00:00
Jeff Roberson
8e82c4cd5f - Clear VI_OWEINACT before calling vget() with no lock type. We know
the node is actually already locked, and VOP_INACTIVE is not desirable
   in this case.
2005-04-11 11:17:20 +00:00
Jeff Roberson
316ec7bb7f - Honor the flags argument passed to null_root(). The filesystem below
us will decide whether or not to grab a real shared lock.
2005-04-11 11:16:29 +00:00
Gleb Smirnoff
d6bd5ec90c Remove goto. 2005-04-11 10:16:17 +00:00
Jeff Roberson
070898b1b3 - Change the VOP_LOCK UPGRADE in vput() to do a LK_NOWAIT to avoid a
potential lock order reversal.  Also, don't unlock the vnode if this
   fails, lockmgr has already unlocked it for us.
 - Restructure vget() now that vn_lock() does all of VI_DOOMED checking
   for us and also handles the case where there is no real lock type.
 - If VI_OWEINACT is set, we need to upgrade the lock request to EXCLUSIVE
   so that we can call inactive.  It's not legal to vget a vnode that hasn't
   had INACTIVE called yet.

Sponsored by:	Isilon Systems, Inc.
2005-04-11 09:28:32 +00:00
Jeff Roberson
1b19c74d73 - Assert that we're no longer doing recursive vn_locks in inactive/reclaim
as I'd like to get rid of the vxthread.
 - Handle lock requests which don't actually want a lock as this is a
   much more convenient place to handle this condition than in vget().
   These requests simply want to know that VI_DOOMED isn't set.
 - Correct a test at the end of vn_lock, if error !=0 should be
   if error == 0, this has been broken since I comitted the VI_DOOMED
   changes, but no one ran into it because vget() duplicated this
   functionality.

Sponsored by:	Isilon Systems, Inc.
2005-04-11 09:23:56 +00:00
Jeff Roberson
836c5b4149 - vput(tvp) before vrele(tdvp) in kern_rename() to avoid lock order issues. 2005-04-11 09:19:08 +00:00
Warner Losh
ca44abece9 It isn't a whinable offence to want memory when the bar says ioport.
Put that behind bootverbose to make the ata driver less chatty on
advanced hardware.

Requested by: sos
2005-04-11 02:08:05 +00:00
Bill Paul
d02239a3af Create new i386 windows/bsd thunking layer, similar to the amd64 thunking
layer, but with a twist.

The twist has to do with the fact that Microsoft supports structured
exception handling in kernel mode. On the i386 arch, exception handling
is implemented by hanging an exception registration list off the
Thread Environment Block (TEB), and the TEB is accessed via the %fs
register. The problem is, we use %fs as a pointer to the pcpu stucture,
which means any driver that tries to write through %fs:0 will overwrite
the curthread pointer and make a serious mess of things.

To get around this, Project Evil now creates a special entry in
the GDT on each processor. When we call into Windows code, a context
switch routine will fix up %fs so it points to our new descriptor,
which in turn points to a fake TEB. When the Windows code returns,
or calls out to an external routine, we swap %fs back again. Currently,
Project Evil makes use of GDT slot 7, which is all 0s by default.
I fully expect someone to jump up and say I can't do that, but I
couldn't find any code that makes use of this entry anywhere. Sadly,
this was the only method I could come up with that worked on both
UP and SMP. (Modifying the LDT works on UP, but becomes incredibly
complicated on SMP.) If necessary, the context switching stuff can
be yanked out while preserving the convention calling wrappers.

(Fortunately, it looks like Microsoft uses some special epilog/prolog
code on amd64 to implement exception handling, so the same nastiness
won't be necessary on that arch.)

The advantages are:

- Any driver that uses %fs as though it were a TEB pointer won't
  clobber pcpu.
- All the __stdcall/__fastcall/__regparm stuff that's specific to
  gcc goes away.

Also, while I'm here, switch NdisGetSystemUpTime() back to using
nanouptime() again. It turns out nanouptime() is way more accurate
than just using ticks(). On slower machines, the Atheros drivers
I tested seem to take a long time to associate due to the loss
in accuracy.
2005-04-11 02:02:35 +00:00
Warner Losh
69c5c40b2d Go ahead and try to allocate PCI_BAR(5) for ata devices. 2005-04-10 23:49:04 +00:00
Søren Schmidt
186ba2b70d Use the ata_suspend/resume functions instaead of the bus_generic ones.
This should unbreak suspend/resume.

Contributed by:	Wiktor Niesiobedzki
2005-04-10 21:43:29 +00:00
Søren Schmidt
b0e99d441c Fix FreeBSD native SPAN arrays.
Prodded by: Ian Dowse
2005-04-10 21:39:25 +00:00
Alan Cox
16f571bd18 Align the entry point to assembly language functions to a 16-byte boundary.
(The Opteron's instruction fetcher reads instructions from the L1 cache in
16-byte, aligned packets.)
2005-04-10 20:49:21 +00:00
Nate Lawson
0a133d67f3 Set CPU speed to 100% in acpi_throttle attach. This is needed for some
systems that boot with this value at the lowest setting.  Change the
default boot config back to "leave frequency as BIOS set it".  Also, fix
buglet where acpi_throttle wouldn't be used if p4tcc was present but
disabled by the user.

MFC after:	1 week
2005-04-10 20:04:30 +00:00
Nate Lawson
273efb3d32 Properly terminate the table generated from ACPI info. The cpufreq
settings are length-counted while the EST table is null-terminated.
This fixes extra garbage states being reported with ACPI probing.
2005-04-10 19:57:47 +00:00
Nate Lawson
f2d942579b Advertise that we can handle unified SMP control of processor power
states, idling, etc.  This has been supported since the cpufreq import.
2005-04-10 19:21:42 +00:00
Nate Lawson
25554b1f2b Advertise p4tcc via acpi_get_features() _PDC support. 2005-04-10 19:16:27 +00:00
Nate Lawson
8d9134815e Add debugging prints to all the methods in case there are problems with
managing levels.  This can be enabled with the debug.cpufreq.verbose
tunable and sysctl.
2005-04-10 19:11:23 +00:00
Nate Lawson
bce9288570 Fix support for _PDC by using the proper version/length format for the
buffer.  Also, reference the Intel document where the _PDC values were
found.  This now supports ACPI-assisted SpeedStep on my borrowed T42.
2005-04-10 19:07:08 +00:00
Alan Cox
fb41e04787 Eliminate a conditional branch and as a side-effect eliminate a branch to
a return instruction.  (The latter is discouraged by the Opteron
optimization manual because it disables branch prediction for the return
instruction.)

Reviewed by: bde
2005-04-10 18:12:07 +00:00
Robert Watson
313bcc9cb8 Update copyright: parts of the netipx implementation are covered by a
2005 copyright.

MFC after:	3 days
2005-04-10 18:05:46 +00:00
Robert Watson
e1968df17f Compare (mbuf *) with NULL, not 0.
MFC after:	3 days
2005-04-10 18:05:02 +00:00
Scott Long
c5cb8d604c Fix the output ports on the AD1988 codec. From the submitter:
Affects to people WITH an AD1888 codec, the system will output to the port
labeled "speaker" instead of microphone.  System will work the same in
multiple operating systems.

If people are currently using their systems with this codec they will need
to swap their output ports.

I have _not_ checked audio input or line input (basically, I have checked
nothing other than line-out).

I believe this is an appropriate change, it makes us consistent with
documentation, and other operating systems.  Furthermore, this feature
(playing) is the vast majority of sound activities, so if this makes is
right for playback and wrong for recording... playback is more important,
and we can fix recoding in the future without worries of screwing people
again in the future (since we'll be "right" on the playback).

Submitted by: David Cross
2005-04-10 14:45:27 +00:00
Søren Schmidt
abacbfaf5c Refine the SATA PHY code so the time consumed during probe is reduced.
Add the older nVidia nForce2 SATA chip to supported HW.
2005-04-10 10:20:25 +00:00
Paul Saab
cf09195ba5 - Tighten up the Timestamp checks to prevent a spoofed segment from
setting ts_recent to an arbitrary value, stopping further
  communication between the two hosts.
- If the Echoed Timestamp is greater than the current time,
  fall back to the non RFC 1323 RTT calculation.

Submitted by:	Raja Mukerji (raja at moselle dot com)
Reviewed by:	Noritoshi Demizu, Mohan Srinivasan
2005-04-10 05:24:59 +00:00
Paul Saab
e346eeff65 - If the reassembly queue limit was reached or if we couldn't allocate
a reassembly queue state structure, don't update (receiver) sack
  report.
- Similarly, if tcp_drain() is called, freeing up all items on the
  reassembly queue, clean the sack report.

Found, Submitted by:	Noritoshi Demizu <demizu at dd dot iij4u dot or dot jp>
Reviewed by:	Mohan Srinivasan (mohans at yahoo-inc dot com),
		Raja Mukerji (raja at moselle dot com).
2005-04-10 05:21:29 +00:00
Paul Saab
b962fa74b5 When the rightmost SACK block expands, rcv_lastsack should be updated.
(Fix for kern/78226).

Submitted by : Noritoshi Demizu <demizu at dd dot iij4u dot or dot jp>
Reviewed by  : Mohan Srinivasan (mohans at yahoo-inc dot com),
               Raja Mukerji (raja at moselle dot com).
2005-04-10 05:20:10 +00:00
Paul Saab
da39f5b963 Remove some unused sack fields.
Submitted by : Noritoshi Demizu, Mohan Srinivasan.
2005-04-10 05:19:22 +00:00
Yoshihiro Takahashi
07665b88f4 Oops, correct typo. 2005-04-10 03:36:13 +00:00
Xin LI
e8943128a9 Initialize vp before using it. Failing to do this can cause instant
panic when trying to access a file on mounted smbfs.

Submitted by:	takawata at jp freebsd org
2005-04-10 03:17:42 +00:00
David Schultz
f97c3df18d Suspend all other threads in the process while generating a core dump.
The main reason for doing this is that the ELF dump handler expects
the thread list to be fixed while the dump header is generated, so an
upcall that occurs at the wrong time can lead to buffer overruns and
other Bad Things.

Another solution would be to grab sched_lock in the ELF dump handler,
but we might as well single-thread, since the process is about to die.
Furthermore, I think this should ensure that the register sets in the
core file are sequentially consistent.
2005-04-10 02:31:24 +00:00
John Baldwin
85a4f4d527 Fix another instance of TDP_OWEPREEMPT -> td_owepreempt.
Reported by:	tinderbox
2005-04-09 18:15:17 +00:00
Stefan Farfeleder
94bd92c387 Fix 'implicit int' instance. 2005-04-09 14:07:13 +00:00
Pawel Jakub Dawidek
c19618dd7d CDEV lock should be before 'system map' lock.
Hardcode this order to help track down reported LOR.

LOR reported by:	Thierry Herbelot <thierry@herbelot.com>
LOR info:		http://sources.zabbadoz.net/freebsd/lor.html#080
2005-04-09 13:32:01 +00:00
Jeff Roberson
5ef9827cea - Remove the namei NOOBJ flag. It is meaningless now.
Sponsored by:	Isilon Systems, Inc.
2005-04-09 12:04:36 +00:00
Jeff Roberson
d3b78f7337 - If we vrele() a dvp while the child is locked we can potentially deadlock
when vrele() acquires the directory lock in the wrong order.  Fix this
   via the following changes:
 - Keep the directory locked after VOP_LOOKUP() until we've determined
   what we're going to do with the child.  This allows us to remove the
   complicated post LOOKUP code which determins whether we should lock or
   unlock the parent.  This means we may have to vput() in the appropriate
   cases later, rather than doing an unsafe vrele.
 - in NDFREE() keep two flags to indicate whether we need to unlock vp or
   dvp.  This allows us to vput rather than vrele in the appropriate
   cases without rechecking the flags.  Move the code to handle dvp after
   we handle vp.
 - Remove some dead code from namei() that was the result of changes to
   VFS_LOCK_GIANT().

Sponsored by:	Isilon Systems, Inc.
2005-04-09 11:53:16 +00:00
Pawel Jakub Dawidek
cd104dd3c1 Add a missing terminator.
Confirmed by:	rwatson
2005-04-09 11:31:31 +00:00
Scott Long
a91e1dfcd5 Explicity make atapi-cam depend on CAM.
Submitted by: Michal Mertl
2005-04-08 22:51:50 +00:00
David E. O'Brien
6ab95de3a3 'apic' isn't optional on amd64, so don't speak as if it is. 2005-04-08 20:24:45 +00:00
David E. O'Brien
fd92279bef Add nForce3-250. 2005-04-08 18:04:39 +00:00
Søren Schmidt
1ab4ad3675 Add support for the PHY on nVidia, SiS and VIA chips
This code is done blindfolded as I dont have such HW here, so reports
of success/failure are most welcome.

More SATA PHY cleanups.
2005-04-08 15:33:04 +00:00
John Baldwin
4d9ae2662a Change an instance of md_savecrit to md_saved_msr that I missed. 2005-04-08 14:26:55 +00:00
Gleb Smirnoff
4f20185860 Add additional newline to debug.mutex.prof.stats header, so that
column names are printed exactly above the columns.
2005-04-08 14:14:09 +00:00
Lukas Ertl
0ec44eb5e2 Add support for Sitecom USB to serial cable (v2)
PR:            usb/79230
Submitted by:  Rick van der Zwet <rick@wzoeterwoude.net>
2005-04-08 12:48:05 +00:00
Søren Schmidt
3c8b1aa784 Put the BUS_DMASYNC_PREWRITE in the rigth position. 2005-04-08 12:16:51 +00:00
Maxim Konovalov
800af1fb81 o Nano optimize ip_reass() code path for the first fragment: do not
try to reasseble the packet from the fragments queue with the only
fragment, finish with the first fragment as soon as we create a queue.

Spotted by:	Vijay Singh

o Drop the fragment if maxfragsperpacket == 0, no chances we
will be able to reassemble the packet in future.

Reviewed by:	silby
2005-04-08 10:25:13 +00:00
Søren Schmidt
b0a7e6a56a Generalise the SATA PHY handling code so it wont be duplicated for
each SATA chip.
Promise and Silicon Image are the current candidates for this.
2005-04-08 09:37:47 +00:00
Pawel Jakub Dawidek
cdae843174 Fix a long-standing bug. Error string has to be copyied from the user
process context.

Approved by:	phk
MFC after:	3 days
2005-04-08 09:28:08 +00:00
Maxim Konovalov
29f2a6ec18 o Tweak the comment a bit. 2005-04-08 08:43:21 +00:00
Maxim Konovalov
e99971bf2f o Disable random port allocation when ip.portrange.first ==
ip.portrange.last and there is the only port for that because:
a) it is not wise; b) it leads to a panic in the random ip port
allocation code.  In general we need to disable ip port allocation
randomization if the last - first delta is ridiculous small.

PR:		kern/79342
Spotted by:	Anjali Kulkarni
Glanced at by:	silby
MFC after:	2 weeks
2005-04-08 08:42:10 +00:00
Warner Losh
48c6558f4a Minor style(9) changes
o use prototype definition
o use mse_{isa,cbus}_{probe,attach,detach} in preference to
  mse_{probe,attach,detach}.
2005-04-08 05:22:58 +00:00
Peter Wemm
e76ce25370 Change the embedded module name from "bluetooth" to "ng_bluetooth" to match
the rest of the names assigned to this object.
2005-04-08 05:13:53 +00:00
Yoshihiro Takahashi
afa7e54ab7 Fix pc98 includes. 2005-04-08 03:38:13 +00:00
Stephan Uphoff
779186434a Sprinkle some volatile magic and rearrange things a bit to avoid race
conditions in critical_exit now that it no longer blocks interrupts.

Reviewed by:	jhb
2005-04-08 03:37:53 +00:00
Yoshihiro Takahashi
37da95af97 Don't use 'i386/include' directly. 2005-04-08 03:37:20 +00:00
Yoshihiro Takahashi
cefad5bb41 Remove the wl driver. The devices don't work on pc98. 2005-04-08 03:36:32 +00:00
Maxim Sobolev
0e9502aaaa Backout previous diffs - this functionality is already provided by the
hints to the atkbd(4).

PR:
Submitted by:   jhb
2005-04-07 23:59:37 +00:00
Olivier Houchard
0ea0d0973f Treat arm as i386. 2005-04-07 22:09:02 +00:00
Olivier Houchard
8d6b8c0f9a Get more love from GEOM on arm. 2005-04-07 22:06:56 +00:00
Olivier Houchard
ebc58b7dbc Don't announce the range SDRAM_START-freemempos until I figure out what's
going on, it produces random memory corruption.
2005-04-07 22:04:18 +00:00
Olivier Houchard
d4d0079826 pmap_update() is gone. 2005-04-07 22:03:34 +00:00
Olivier Houchard
2d93998b00 Import a basic implementation of the restartable atomic sequences to provide
atomic operations to userland (this is OK for UP only, but SMP is still so
far away).
2005-04-07 22:03:04 +00:00
Olivier Houchard
139e3f7c33 - Try harder to report dirty page.
- Garbage-collect pmap_update(), it became quite useless.
2005-04-07 22:01:53 +00:00
Maxim Sobolev
7ca67a6885 Make previous commit actually working by replacing TUNABLE_INT() with
TUNABLE_INT_FETCH(). Apparently keyboard init is performed earlier
in the boot process than fetching all static tunables.

MFC after:	1 day
2005-04-07 18:18:17 +00:00
Nate Lawson
cb3f3e5c9b Revert part of 1.19. We do want to set the count to 0 since otherwise
it would give false info to other parts of the driver.
2005-04-07 17:33:22 +00:00
Maxim Sobolev
9ec4f9e385 Provide a new tunable hw.atkbdc.broken_kit_cmd, which if set to 1
instructs the driver to avoid using Keyboard Interface Test command.
This command causes problems with some non-compliant hardware, resulting
in machine being abruptly powered down early in the boot process.

Particularly it's known that HP ZV5000 and Compaq R3000Z notebooks
are affected by this problem.

Due to popularity of those models this patch is good MFC5.4 candidate.

PR:		67745
Submitted by:	Jung-uk Kim jkim at niksun.com
MFC after:	1 days
2005-04-07 17:15:10 +00:00
Poul-Henning Kamp
f4b423ae60 Give msdosfs a unique inode number which is really the byteoffset of
the directory entry.

This solves the corruption problem I belive.

Regression test script by:	silby
2005-04-07 07:55:37 +00:00
Poul-Henning Kamp
2e0b9b22f0 Fix bug in vfs_hash_rehash(): use correct bucket. This only affected
msdosfs which is broken in other ways too.
2005-04-07 07:54:08 +00:00
Maksim Yevmenkin
dc612cfc34 Correct typo that could cause FIFO overflow.
PR:		kern/78431
MFC after:	3 days
2005-04-06 22:09:32 +00:00
Maksim Yevmenkin
aa9e985aed Remove PR_ATOMIC flag in ng_btsocket_protosw[] for BLUETOOTH_PROTO_RFCOMM
protocol. RFCOMM is a SOCK_STREAM protocol not SOCK_SEQPACKET. This was a
serious bug caused by cut-and-paste. I'm surprised it did not bite me before.
Dunce hat goes to me.

MFC after:	3 days
2005-04-06 20:54:05 +00:00
Maksim Yevmenkin
f93b258c94 In ng_btsocket_rfcomm_receive_frame() correctly set length variable when
EA bit is set in hdr->length (16-bit length). This currently has no effect
on the rest of the code. It just fixes the debug message.

MFC After:	3 weeks
2005-04-06 18:55:58 +00:00
Gleb Smirnoff
8351d04f34 When a packet has been reinjected into ipfw(4) after dummynet(4) processing
we have a non-NULL args.rule. If the same packet later is subject to "tee"
rule, its original is sent again into ipfw_chk() and it reenters at the same
rule. This leads to infinite loop and frozen router.

Assign args.rule to NULL, any time we are going to send packet back to
ipfw_chk() after a tee rule. This is a temporary workaround, which we
will leave for RELENG_5. In HEAD we are going to make divert(4) save
next rule the same way as dummynet(4) does.

PR:		kern/79546
Submitted by:	Oleg Bulyzhin
Reviewed by:	maxim, andre
MFC after:	3 days
2005-04-06 14:00:33 +00:00
Søren Schmidt
0e1eb6828c Add support for controllers that doesn't have the usual taskfile
layout.  No functional changes.
2005-04-06 10:22:56 +00:00
Poul-Henning Kamp
30a1695b11 Constify hexdump() harder. 2005-04-06 10:14:13 +00:00
Jeff Roberson
a96ab77002 - Remove dead code. 2005-04-06 10:11:14 +00:00
Jeff Roberson
d78e0ee9fd - Assert that the bufobj matches in flushbuflists. I still haven't gotten
to root cause on exactly how this happens.
 - If the assert is disabled, we presently try to handle this case, but the
   BUF_UNLOCK was missing.  Thus, if this condition ever hit we would leak
   a buf lock.

Many thanks to Peter Holm for all his help in finding this bug.  He really
put more effort into it than I did.
2005-04-06 06:49:46 +00:00
Colin Percival
d0b183c937 Fully initialize the required TSS fields so that the io permission
bitmap is set correctly.

Patch from:	peter
Security:	FreeBSD-SA-05:03.amd64
2005-04-06 01:05:51 +00:00
Brooks Davis
a0d17f7e98 Use ACTION_PTR(r) instead of (r->cmd + r->act_ofs).
Reviewed by:	md5
2005-04-06 00:26:08 +00:00
Brooks Davis
f4ff11976d Make dummynet_flush() match its prototype. 2005-04-05 23:38:16 +00:00
Peter Wemm
50860ac0ee Fix 32 bit signals on amd64. It turns out that I was sign extending
the register values coming back from sigreturn(2).  Normally this wouldn't
matter because the 32 bit environment would truncate the upper 32 bits
and re-save the truncated values at the next trap.  However, if we got
a fast second signal and it was pending while we were returning from
sigreturn(2) in the signal trampoline, we'd never have had a chance to
truncate the bogus values in 32 bit mode, and the new sendsig would get
an EFAULT when trying to write to the bogus user stack address.
2005-04-05 22:41:49 +00:00
Bernd Walter
1b285e5cce Add support for FTDI's FT2232C twin channel chip.
Tested by: Mike Tancsa <mike@sentex.net>
2005-04-05 22:09:18 +00:00
Bernd Walter
8a95014be7 remove usbd_errstr(err) from printf.
err has nothing to say about this specific error.
2005-04-05 22:03:07 +00:00
John Baldwin
fbe648c9b8 Don't free the _PSS buffer until after we check to see if we have no valid
states as otherwise we will try to free the buffer twice.
2005-04-05 19:39:44 +00:00
John Baldwin
b9d9b6ef3d Oops, revert a commit that snuck in with the earlier critical section
changes.

Noticed by:	bde
2005-04-05 18:06:28 +00:00
Marius Strobl
8386475dc8 Release the IRQ resource on detach. This fixes repeatedly loading and
unloading the hme(4) module in case it attaches to sbus(4).

MFC after:	1 week
2005-04-05 17:51:56 +00:00
Gleb Smirnoff
d8f5d037f8 Major overhaul and cleanup of ng_source node.
Functional changes:
- Cut struct source_hookinfo. Just use hook_p pointer.
- Remove "start_now" command. "start" command now requires number of
  packets to send as argument. "start" command actually starts sending.
  Move the code that actually starts sending from ng_source_rcvmsg()
  to ng_source_start().
- Remove check for NG_SOURCE_ACTIVE in ng_source_stop(). We can be called
  with flag cleared (see begin of ng_source_intr()).
- If NG_SEND_DATA_ONLY() use log(LOG_DEBUG) instead of printf(). Otherwise
  we will *flood* console.
- Add ng_connect_t method, which sends NGM_ETHER_GET_IFNAME command
  to "output" hook. Cut ng_source_request_output_ifp(). Refactor
  ng_source_store_output_ifp() to use ifunit() and don't muck through
  interface list.
- Add "setiface" command, which gives ability to configure interface
  in case when ng_source_connect() failed. This happens, when we are not
  connected directly to ng_ether(4) node.
- Remove KASSERTs, which can never fire.
- Don't check for M_PKTHDR in rcvdata method. netgraph(4) does this
  for us.

Style:
- Assign sc_p = NG_NODE_PRIVATE(node) in declaration, to be
  consistent with style of other nodes.
- Sort variables.
- u_intXX -> uintXX.
- Dots at ends of comments.

Sponsored by:   Rambler
2005-04-05 17:22:05 +00:00
John Baldwin
0d49a5c910 Fix a change in a debug printf I missed in an earlier commit. 2005-04-05 15:28:06 +00:00
Scott Long
b149b2d82f Fix a use-after-free problem in atapi_cb(). Add some necessary synchronization
to the XPT_PATH_INQ op.  Don't leak locks on failure in XPT_SCSIIO.  Correctly
fix the CAMDEBUG message.
2005-04-05 15:08:19 +00:00
Søren Schmidt
bbccd83251 Add firstshot support for Acer Labs Inc SATA parts
Update ALi PATA support to handle ATA133 as well
2005-04-05 14:51:43 +00:00
Poul-Henning Kamp
a8bc22b47a natd core dumps when -reverse switch is used because of a bug in
libalias.

In /usr/src/lib/libalias/alias.c, the functions LibAliasIn and
LibAliasOutTry call the legacy PacketAliasIn/PacketAliasOut instead
of LibAliasIn/LibAliasOut when the PKT_ALIAS_REVERSE option is set.
In this case, the context variable "la" gets lost because the legacy
compatibility routines expect "la" to be global.  This was obviously
an oversight when rewriting the PacketAlias* functions to the
LibAlias* functions.

The fix (as shown in the patch below) is to remove the legacy
subroutine calls and replace with the new ones using the "la" struct
as the first arg.

Submitted by:	Gil Kloepfer <fgil@kloepfer.org>
Confirmed by:	<nicolai@catpipe.net>
PR:		76839
MFC after:	3 days
2005-04-05 13:04:35 +00:00
Poul-Henning Kamp
c339c21b28 Push some faulty debugging aside so LINT compiles. 2005-04-05 09:42:52 +00:00
Jeff Roberson
2bbd6c9818 - Move NDFREE() from vfs_subr to vfs_lookup where namei() is. 2005-04-05 08:58:49 +00:00
Jeff Roberson
22fdc83f93 - Use taskqueue_thread rather than taskqueue_swi since our task is going
to vrele, which may vop lock.  This is not safe in a software interrupt
   context.
2005-04-05 08:51:45 +00:00
Jeff Roberson
ece9473efa - Consistently call 'vp' vp rather than ovp sometimes in ffs_truncate().
Do the same for oip.

Pointed out by:	glebius
2005-04-05 08:49:41 +00:00
Gleb Smirnoff
4369bfad31 Run em_local_timer() once per second instead of running it once per 2 seconds.
This makes gathering of error stats more precise, and netstat(1) output look
right.

Reviewed by:	tackerman
2005-04-05 07:06:47 +00:00
Alan Cox
fb9ce70f60 Add locking and enable INTR_MPSAFE. Eliminate spl calls.
Submitted by: Paul Willmann willmann at rice dot edu
MFC After: 3 weeks
2005-04-05 05:05:29 +00:00
Scott Long
c91a27d2d2 Re-enable the atapicam driver in NOTES. 2005-04-05 02:05:38 +00:00
Scott Long
db833d6633 Connect the atapicam module to the build. 2005-04-05 02:05:01 +00:00
Scott Long
ef35394ab4 Add a Makefile for atapi-cam. 2005-04-05 02:04:30 +00:00
Scott Long
700a992648 Commit ATAPI-CAM for ATAmkIII. Improvements and changes:
- newbus plumbing.  Each atapicam bus is a child off of a parent ata channel
  bus.  This is somewhat of a hack, but allows the ata core to be completely
  free of atapicam knowledge.
- No more global lists of softc's and no more groping around in internal ata
  structures on each command.
- Giant-free operation of the completion handler.
- Per-bus mutex for protecting the busy list and synchronizing detach.
- Lots of streamlining and dead code elimination, better adherence to the
  CAM locking protocol.

This feature still requires that the appropriate atapi-* driver be present
for each atapi device that you want to talk to (i.e. atapi-cd for cdroms).
It does work both compiled into the kernel and as a loadable module.

Reviewed by: thomas, sos
2005-04-05 02:03:31 +00:00
Christian S.J. Peron
f3e89267c0 Assert that the vnode is locked. This is meant to catch bugs or
mis-use of the vnode API in conditions where IO_NODELOCKED has been
used without the vnode actually being locked.
2005-04-05 01:11:43 +00:00
John Baldwin
c6a37e8413 Divorce critical sections from spinlocks. Critical sections as denoted by
critical_enter() and critical_exit() are now solely a mechanism for
deferring kernel preemptions.  They no longer have any affect on
interrupts.  This means that standalone critical sections are now very
cheap as they are simply unlocked integer increments and decrements for the
common case.

Spin mutexes now use a separate KPI implemented in MD code: spinlock_enter()
and spinlock_exit().  This KPI is responsible for providing whatever MD
guarantees are needed to ensure that a thread holding a spin lock won't
be preempted by any other code that will try to lock the same lock.  For
now all archs continue to block interrupts in a "spinlock section" as they
did formerly in all critical sections.  Note that I've also taken this
opportunity to push a few things into MD code rather than MI.  For example,
critical_fork_exit() no longer exists.  Instead, MD code ensures that new
threads have the correct state when they are created.  Also, we no longer
try to fixup the idlethreads for APs in MI code.  Instead, each arch sets
the initial curthread and adjusts the state of the idle thread it borrows
in order to perform the initial context switch.

This change is largely a big NOP, but the cleaner separation it provides
will allow for more efficient alternative locking schemes in other parts
of the kernel (bare critical sections rather than per-CPU spin mutexes
for per-CPU data for example).

Reviewed by:	grehan, cognet, arch@, others
Tested on:	i386, alpha, sparc64, powerpc, arm, possibly more
2005-04-04 21:53:56 +00:00
John Baldwin
a5c7ea5b9e Flip the switch and turn mpsafevm on by default for sparc64.
Approved by:	alc
2005-04-04 20:59:02 +00:00
Poul-Henning Kamp
a877d4a4e9 Don't leak mutex on open failure. 2005-04-04 17:37:35 +00:00
Nate Lawson
15785fbe81 Add support for _PDC/_OSC by advertising that we support direct access to
the PERF_CTL/STS MSRs via the new acpi_get_features() method.  This should
allow newer systems to use SpeedStep.
2005-04-04 15:51:13 +00:00
Nate Lawson
b29224c2a0 Add the acpi_get_features() method. This method is called on child drivers
to see what features they may support before calling identify/probe/attach.
This is necessary because the ACPI 3.0 spec requires driver support be
advertised before running any methods.  For now, the flags are as specified
in for the _PDC and _OSC methods but we can support private flags as needed.

Add an implementation of this for acpi_cpu.  It checks all its children
(notably cpufreq drivers) and calls the _PDC method to report the results.
2005-04-04 15:46:57 +00:00
Nate Lawson
4abfd70c87 Document that devclass_get_maxunit(9) returns one greater than the current
highest unit.

Reviewed by:	dfr
MFC after:	2 weeks
2005-04-04 15:37:59 +00:00
Nate Lawson
fada20b989 Add devclass_get_drivers(9) which provides an array of pointers to driver
instances in a given devclass.  This is useful for systems that want to
call code in driver static methods, similar to device_identify().

Reviewed by:	dfr
MFC after:	2 weeks
2005-04-04 15:26:51 +00:00
Jeff Roberson
d1cc6041e6 - Add a missing unlock of the vnode_free_list_mtx.
Spotted by:	Antoine Brodin
2005-04-04 12:07:16 +00:00
Jeff Roberson
92b8231d4f - Instead of waiting forever to get a vnode in getnewvnode() wait for
one to become available for one second and then return ENFILE.  We
   can run out of vnodes, and there must be a hard limit because without
   one we can quickly run out of KVA on x86.  Presently the system can
   deadlock if there are maxvnodes directories in the namecache.  The
   original 4.x BSD behavior was to return ENFILE if we reached the max,
   but 4.x BSD did not have the vnlru proc so it was less profitable to
   wait.
2005-04-04 11:43:44 +00:00
Philip Paeps
b308de8beb Fix a small locking error.
Submitted by:	Anish Mistry <mistry.7@osu.edu>
2005-04-04 10:21:20 +00:00
Jeff Roberson
9370c333ce - Fix union's assumptions about when the dvp is unlocked. It is only
unlocked in the ISDOTDOT case now, not for all !ISLASTCN lookups.
2005-04-04 09:36:26 +00:00
Warner Losh
9fc371f86b No need to ifdef this pc98. 2005-04-04 05:28:19 +00:00
Sam Leffler
0942c81c7a remove extern from function decls 2005-04-04 04:27:20 +00:00
Sam Leffler
31640eb774 use frame type returned by ieee80211_input to drive softled code
instead of monitoring the input packet count
2005-04-04 02:34:15 +00:00
Sam Leffler
1f29887956 change ieee80211_input to return the frame type or -1 2005-04-04 02:32:56 +00:00
Jeff Roberson
9a6bb8ad8f - Include opt_vfs.h for LOOKUP_SHARED.
- Control the behavior of shared lookups with the lookup_shared sysctl
   which has its default behavior set via the LOOKUP_SHARED option.
2005-04-03 23:50:20 +00:00
Jeff Roberson
dfe614392f - Move LOOKUP_SHARED from opt_global.h to opt_vfs.h so we don't have
to recompile the whole kernel if we change it.
2005-04-03 23:49:13 +00:00
Warner Losh
b756200647 Move pc98 specific parts to the pc98 specific file. 2005-04-03 23:27:11 +00:00
Jeff Roberson
6e4b282039 - Don't NULL the vnode's v_object pointer until after the object is torn
down.  If we have dirty pages, the putpages routine will need to know
   what the vnode's object is so that it may write out dirty pages.

Pointy hat:	phk
Found by:	obrien
2005-04-03 22:56:58 +00:00
Nate Lawson
a44732323f maxunit is actually one higher than the greatest currently-allocated unit
in a devclass.  All the other uses of maxunit are correct and this one was
safe since it checks the return value of devclass_get_device(), which would
always say that the highest unit device doesn't exist.

Reviewed by:	dfr
MFC after:	3 days
2005-04-03 22:23:18 +00:00
Warner Losh
523ab3b440 With pc98/include, we can have pc98 and i386 specific bus space
implementations in their own files named $MACHINE/include/bus.h.  Copy
the contents appropriately.
2005-04-03 17:47:03 +00:00
Pawel Jakub Dawidek
7e0b3120e7 - Add a missing g_io_deliver() in case of allocation failure - we didn't
completed I/O requests here.
- First allocate all needed bios, so if any of allocations fail, we can
  free memory before sending any I/O requests down.

Reported by:	Pawel Malachowski
MFC after:	3 days
2005-04-03 14:55:49 +00:00
Søren Schmidt
fa13a39e3c Fix a buglet that caused slaves to be nondetected. 2005-04-03 13:03:53 +00:00
Jeff Roberson
bcc8f66c8b - Use M_ZERO rather than explicitly calling bzero().
- Don't intermingle direct calls to lockmgr and indirect calls through
   VOPs.  This will be important in the future.
 - Dont lock the devvp's interlock just to release it on the next line by
   passing LK_INTERLOCK to lockmgr.
 - Restructure ffs_snapshot_unmount so we don't call free() with the
   devvp's interlock locked.
2005-04-03 12:03:44 +00:00
Jeff Roberson
20728d8f63 - Slightly restructure acquire() so I can add more ktr information and
an assert to help find two strange bugs.
 - Remove some nearby spls.
2005-04-03 11:49:02 +00:00
Jeff Roberson
41d4783d49 - In ffs_sync we need to pass LK_SLEEPFAIL in when we lock the vnode
because it may change identities while we're sleeping on the lock.
   Otherwise we may bail out of ffs_sync() early due to an error from
   deadfs.
 - Collapse a VOP_UNLOCK, vrele into a single vput().
2005-04-03 10:38:18 +00:00
Jeff Roberson
153910e0f5 - Move the contents of softdep_disk_prewrite into ffs_geom_strategy to fix
two bugs.
 - ffs_disk_prewrite was pulling the vp from the buf and checking for
   COPYONWRITE, when really it wanted the vp from the bufobj that we're
   writing to, which is the devvp.  This lead to us skipping the copy on
   write to all file data, which significantly broke snapshots for the
   last few months.
 - When the SOFTUPDATES option was not included in the kernel config we
   would also skip the copy on write check, which would effectively disable
   snapshots.
 - Remove an invalid mp_fixme().

Debugging tips from:	mckusick
Reported by:		iedowse, others
Discussed with:		phk
2005-04-03 10:29:55 +00:00
Jeff Roberson
f0ddc75ed0 - Now that writes to character devices supporting softupdates can
generate dirty bufs even with a locked vnode, 100 retries is not that
   many.  This should probably change from a retry count to an abort when
   we are no longer cleaning any buffers.
 - Don't call vprint() while we still hold the vnode locked.  Move the call
   to later in the function.
 - Clean up a comment.
2005-04-03 10:24:03 +00:00
Alan Cox
9f65fb13aa Remove GIANT_REQUIRED from elfN_load_section(). 2005-04-03 07:57:47 +00:00
Brooks Davis
6d9a161274 Don't init ifp->if_addrhead, if_attach() does it for us. 2005-04-03 05:21:29 +00:00
Warner Losh
722cb08d74 Fix buidling of boot blocks for pc98 with new links.
Submitted by: nyan@
2005-04-03 04:58:15 +00:00
Warner Losh
df3a103dc6 Don't forget to create new-style links for module builds.
Forgotten by: imp@
Reminded by: nyan@
2005-04-03 04:56:05 +00:00
Warner Losh
cfaacd7f0f Now that we have proper links, no need to fake up ones as part of
depend.  Now that we no longer need this hack, remove it.

Forgotten by: imp
Reminded by: nyan
2005-04-03 04:33:42 +00:00
Sam Leffler
15f139756b fix size_to_bin
Obtained from:	madwifi
2005-04-02 18:56:50 +00:00
Sam Leffler
a4d8dd103e nuke unintentional use of HAL_BOOL type 2005-04-02 18:54:30 +00:00
David Schultz
f0ceb98f93 Replace the current strspn() and strcspn() with significantly faster
implementations inspired by the ones in DragonFly.  Unlike the
DragonFly versions, these have a small data cache footprint, and my
tests show that they're never slower than the old code except when the
charset or the span is 0 or 1 characters.  This implementation is
generally faster than DragonFly until either the charset or the span
gets in the ballpark of 32 to 64 characters.
2005-04-02 18:52:44 +00:00
Alexander Leidinger
3df129097b The file machine/ieeefp.h needs sys/cdefs.h on amd64 and i386 after my
compiler features tests. This is ok, since machine/ieeefp.h is an internal
interface. But floatingpoint.h is a public interface and some ports use it,
so include sys/cdefs.h in the amd64 and i386 version of floatingpoint.h.

Note: some architectures don't provide recursive inclusion protection in
floatingpoint.h, namely alpha and ia64. Except for this part and now the
include of sys/cdefs.h, all those files are equal (from a compiler POV),
so they could be moved to only one version in src/include/.

Approved by:	joerg
2005-04-02 17:31:42 +00:00
David Schultz
0d892b4ac4 This header is supposed to declare pid_t, size_t, and time_t. 2005-04-02 12:33:36 +00:00
David Schultz
e616f979b8 Namespace issues. 2005-04-02 12:33:31 +00:00
David Schultz
5e9b87a863 Add some missing errnos from POSIX. Nothing in FreeBSD generates
these at the moment, but applications that test for them will now
have a better chance of compiling.

I have intentionally omitted errnos that are only good for STREAMS,
since apps that use STREAMS won't compile anyway.  The exception is
EPROTO, which was apparently intended for STREAMS, but worth having
anyway because Linux (mis)uses it for other things.
2005-04-02 12:33:28 +00:00
David Schultz
6d2f64c103 Define CLOCK_* and TIMER_* in time.h, where they are supposed to be. 2005-04-02 12:33:27 +00:00
David E. O'Brien
824a5e96dc nVidia AGP chipsets beyond nForce2 are AMD64-specific.
So move the AGP support to there.

Submitted by:	Jung-uk Kim <jkim@niksun.com>
2005-04-02 01:10:09 +00:00
Warner Losh
4dd0942599 Add reach-over include files to read i386/foo.h. In time, the pc98
specific code will migrate to these files to augment or replace the
version in i386/include and/or i386/linux.  This should, in the
fullness of time, allow many of the #ifdef PC98 in the tree.

# These files are in the public domain because there is insufficient
# creative content in them.  When you customize them, please add a
# copyright notice and license.

OK'd in principle by: nyan@
2005-04-01 23:19:43 +00:00
Warner Losh
5cc3e8555f Add i386 to machine lines 2005-04-01 22:59:25 +00:00
John-Mark Gurney
0e49742d03 fix misspelling of 0x30...
Spotted by:	reviewing MFC commit
2005-04-01 22:56:37 +00:00
Warner Losh
5abe8537a0 Update version number for latest config version bump 2005-04-01 22:56:10 +00:00
Scott Long
e5bd0ae156 Make life easier on those trying to use the asr utilities by automatically
creating the /dev/dpti%d entry that the software expects.  This is just
a band-aid until either someone (hopefully) rewrites the utilities, or all
asr/dpt cards in existance get blasted into the sun.
2005-04-01 22:12:53 +00:00
John Baldwin
98df9218da - Change the vm_mmap() function to accept an objtype_t parameter specifying
the type of object represented by the handle argument.
- Allow vm_mmap() to map device memory via cdev objects in addition to
  vnodes and anonymous memory.  Note that mmaping a cdev directly does not
  currently perform any MAC checks like mapping a vnode does.
- Unbreak the DRM getbufs ioctl by having it call vm_mmap() directly on the
  cdev the ioctl is acting on rather than trying to find a suitable vnode
  to map from.

Reviewed by:	alc, arch@
2005-04-01 20:00:11 +00:00
Scott Long
5ec8c336e7 FIx a botch with the addition of the arcmsr driver. 2005-04-01 19:32:12 +00:00
Warner Losh
9dd18bb07e Don't build arcmsr on pc98. The card either won't fit/work in the
pc98 machines because (a) it is PCIe or PCI-X (b) there's a BIOS that
must run at boot which assumes IBM-AT compatible boot environment.

Noticed by: scottl
2005-04-01 17:40:39 +00:00
Bill Paul
92b9707e2d Fix another KeInitializeDpc()/amd64 calling convention issue:
ndis_intrhand() has to be wrapped for the same reason as ndis_timercall().
2005-04-01 16:40:22 +00:00
John-Mark Gurney
5da5a253a5 move the statement about switching power states to just before we do it, so
we don't print a false statement if the destination powerstate is
unsupported...
2005-04-01 16:22:50 +00:00
Dag-Erling Smørgrav
8987631f85 MFi386 (1.610): let TUNABLE_ULONG_FETCH handle the suffix. 2005-04-01 10:59:13 +00:00
Warner Losh
8d42a36cf1 arcmsr_make_timespec, and arcmsr_getcmos_time appear to be unused, and
reference functions that don't exist on at least pc98.  #if 0 them
out.  This should fix the pc98 tinderbox breakage.  Tested only on
i386 and pc98.
2005-04-01 07:15:52 +00:00
Peter Grehan
98cbfce5db Introduce channel-level setmode newbus method.
Thanks to sos for the code re-org that allowed this.
2005-04-01 03:28:55 +00:00
John Baldwin
67d1e9191e Use kern_settimeofday() to avoid stackgap use. 2005-03-31 22:58:37 +00:00
John Baldwin
48052f99e7 - Use a custom version of copyinuio() to implement readv/writev using
kern_readv/writev.
- Use kern_settimeofday() and kern_adjtime() rather than stackgapping it.
2005-03-31 22:58:13 +00:00
John Baldwin
3dde27da5e - Use a custom version of copyinuio() to implement readv/writev using
kern_readv/writev.
- Use kern_sched_rr_get_interval() rather than the stackgap.
2005-03-31 22:57:21 +00:00
John Baldwin
50b584201d Use a custom version of copyinuio() to implement osf1_{read,write}v() via
kern_{read,write}v().
2005-03-31 22:56:14 +00:00
John Baldwin
fe24ab5fc5 Actually commit the code for kern_sched_get_rr_interval(). 2005-03-31 22:54:48 +00:00
Peter Wemm
8d2046fa1e Since the question keeps coming up, explain why the -mno-sse etc switches
are there and that it does not have an effect on user applications.
2005-03-31 22:53:58 +00:00
John Baldwin
b88ec951e1 Implement kern_adjtime(), kern_readv(), kern_sched_rr_get_interval(),
kern_settimeofday(), and kern_writev() to allow for further stackgap
reduction in the compat ABIs.
2005-03-31 22:51:18 +00:00
John Baldwin
e392175600 Bring back the WITNESS_WARN() check to _STOPEVENT() as all the callers have
been fixed for quite a while now.
2005-03-31 22:50:14 +00:00
John Baldwin
ea2b9b3e36 - Denote a few places where kobj class references are manipulated without
holding the appropriate lock.
- Add a comment explaining why we bump a driver's kobj class reference
  when loading a module.
2005-03-31 22:49:31 +00:00
John Baldwin
2945387fee Drop a bogus mp_fixme(). Adding a lock would do nothing to reduce userland
races regarding changing of jail-related sysctls.
2005-03-31 22:47:57 +00:00
John Baldwin
db8a98353d - Fix some sign extension problems with implicit 32 to 64 bit conversions.
- Fix the mmap2() wrapper to not truncate high addresses.

Submitted by:	Christian Zander
2005-03-31 22:47:18 +00:00
Sam Leffler
aa083c3dc6 plug resource leak
Submitted by:	mdodd
Noticed by:	Coverity Prevent analysis tool
2005-03-31 21:58:53 +00:00
Sam Leffler
23691262f0 fix potential null ptr deref
Noticed by:	Coverity Prevent analysis tool
2005-03-31 21:55:09 +00:00
Sam Leffler
001ea8fba8 avoid null ptr deref
Noticed by:	Coverity Prevent analysis tool
2005-03-31 21:53:21 +00:00