Commit Graph

49350 Commits

Author SHA1 Message Date
Marcel Moolenaar
344bbdbd54 As I said: the previous commit was untested... Remove an #endif which
should have ceased to exist when its corresponding #if was removed.
2004-08-16 19:05:08 +00:00
Marcel Moolenaar
97752b2cbd Catch up with the drive-by renaming of IA32 to COMPAT_IA32. It must
have been rush hour...

While here, move COMPAT_IA32 from opt_global.h to opt_compat.h like on
amd64. Consequently, it's unsafe to use the option in pcb.h. We now
unconditionally have the ia32 specific registers in the PCB.

This commit is untested.
2004-08-16 18:54:23 +00:00
Bill Paul
161a639981 The Texas Instruments ACX111 driver wants srand(), so provide it. 2004-08-16 18:52:37 +00:00
Bill Paul
f454f98c31 Make the Texas Instruments 802.11g chipset work with the NDISulator.
This was tested with a Netgear WG311v2 802.11b/g PCI card. Things
that were fixed:

- This chip has two memory mapped regions, one at PCIR_BAR(0) and the
  other at PCIR_BAR(1). This is a little different from the other
  chips I've seen with two PCI shared memory regions, since they tend
  to have the second BAR ad PCIR_BAR(2). if_ndis_pci.c tests explicitly
  for PCIR_BAR(2). This has been changed to simply fill in ndis_res_mem
  first and ndis_res_altmem second, if a second shared memory range
  exists. Given that NDIS drivers seem to scan for BARs in ascending
  order, I think this should be ok.

- Fixed the code that tries to process firmware images that have been
  loaded as .ko files. To save a step, I was setting up the address
  mapping in ndis_open_file(), but ndis_map_file() flags pre-existing
  mappings as an error (to avoid duplicate mappings). Changed this so
  that the mapping is now donw in ndis_map_file() as expected.

- Made the typedef for 'driver_entry' explicitly include __stdcall
  to silence gcc warning in ndis_load_driver().

NOTE: the Texas Instruments ACX111 driver needs firmware. With my
card, there were 3 .bin files shipped with the driver. You must
either put these files in /compat/ndis or convert them with
ndiscvt -f and kldload them so the driver can use them. Without
the firmware image, the NIC won't work.
2004-08-16 18:50:20 +00:00
Arun Sharma
646c6dd2c0 ITC.{i,d} instructions use format M41 not M42.
reviewed by: marcel@
2004-08-16 18:41:24 +00:00
Robert Watson
a4f757cd5d White space cleanup for netinet before branch:
- Trailing tab/space cleanup
- Remove spurious spaces between or before tabs

This change avoids touching files that Andre likely has in his working
set for PFIL hooks changes for IPFW/DUMMYNET.

Approved by:	re (scottl)
Submitted by:	Xin LI <delphij@frontfree.net>
2004-08-16 18:32:07 +00:00
Max Laier
e89d8405c7 Comment out rev. 1.4 after problems w/ IPv6, a better solution must be
found.
2004-08-16 17:58:12 +00:00
Roman Kurakin
23ee8af5f5 Fix low level code for Tau-PCI/2E1 and Tau-PCI/4E1 that was broken by previous
commit.
Pointy hat: rik
2004-08-16 17:28:04 +00:00
Doug Ambrisko
05f1103b26 Allow i386 binaries to do amr ioctls such as LSI's megamgr on amd64 and
ia64.

PR:	63155
Submitted by:	Mikhail Teterin
Tested on:	i386, amd64 (via 64bit Xeon system)
2004-08-16 17:23:09 +00:00
Philip Paeps
8547e74f4f Update support for Synaptics Touchpads (Volume V)
o Add (long awaited) support for guest devices

Submitted by:	Arne Schwabe <arne@rfc2549.org>
Approved by:	njl (in a former revision)
2004-08-16 16:28:27 +00:00
Yoshihiro Takahashi
c3c04b646f agp_amd64.c is not needed on pc98. 2004-08-16 16:01:40 +00:00
Warner Losh
977b24f6e6 Some cards don't have the info entries in the CIS, so vendorstr and/or
prodstr may be NULL when fetched.  For the default device description,
guard against this and return the numeric IDs instead when this
happens.  For the matching routines, and consider NULL to not match
those entries that aren't NULL w/o calling strcmp.

Early patches by: Anders Hanssen
2004-08-16 15:57:18 +00:00
Marius Strobl
39513fa664 Instead of "OpenFirmware", "openfirmware", etc. use the official spelling
"Open Firmware" from IEEE 1275 and OpenFirmware.org (no pun intended).

Ok'ed by:	tmm
2004-08-16 15:45:27 +00:00
Warner Losh
76c4b2cb5d And isa_if.h 2004-08-16 15:24:03 +00:00
Warner Losh
763cd88752 Add pccbb_isa.c and pccbb_pci.c 2004-08-16 15:23:10 +00:00
Alexander Kabaev
c8b876219f Upgrading a lock does not play well together with acquiring an exclusive lock
and can lead to two threads being granted exclusive access. Check that no one
has the same lock in exclusive  mode before proceeding to acquire it.

The LK_WANT_EXCL and LK_WANT_UPGRADE bits act as mini-locks and can block
other threads.  Normally this is not a problem since the mini locks are
upgraded to full locks and the release of the locks will unblock the other
threads.  However if a thread reset the bits without obtaining a full lock
other threads are not awoken. Add missing wakeups for these cases.

PR:		kern/69964
Submitted by:	Stephan Uphoff <ups at tree dot com>
Very good catch by: Stephan Uphoff <ups at tree dot com>
2004-08-16 15:01:22 +00:00
Robert Watson
56af75a582 Add MP_WATCHDOG option information to pc98, as it uses the i386
mp_machdep.c, which relies on the option's include file and
defines.

Constancy of:	tinderbox
2004-08-16 13:59:01 +00:00
Suleiman Souhlal
c0763d3763 Add /dev/mem and /dev/kmem to powerpc.
Approved by:	grehan (mentor)
2004-08-16 13:07:40 +00:00
David E. O'Brien
7a071c6a49 Complete 'IA32' -> 'COMPAT_IA32' change for the Linuxulator32. 2004-08-16 12:51:33 +00:00
Tim J. Robbins
7a47419763 Un-comment LINPROCFS. 2004-08-16 12:39:27 +00:00
David E. O'Brien
3c749e3fb1 AMD64 on-CPU GART support.
This also applies to AMD64 HW running 'i386' OS.

Submitted by:	Jung-uk Kim <jkim@niksun.com>
Integration by:	obrien
2004-08-16 12:25:48 +00:00
David E. O'Brien
15720d822e style.9. 2004-08-16 12:23:53 +00:00
David E. O'Brien
b61c60d401 Fix the 'DEBUG' argument code to unbreak the amd64 LINT build. 2004-08-16 12:15:07 +00:00
David E. O'Brien
5af87d0ea1 Put the 'antispoof' opcode in the proper place in the opcode list such
that it doesn't break the ipfw2 ABI.
2004-08-16 12:05:19 +00:00
Roman Kurakin
c8a7b935f6 Update low level code for Cronyx Tau-PCI:
1. Add support for Cronyx Tau-PCI/E3 rev.B.
2. Improve model identification and firmware load procedure.
2004-08-16 12:00:07 +00:00
David E. O'Brien
ce55a234ee I missed an 'IA32' in the documentation. 2004-08-16 11:15:46 +00:00
David E. O'Brien
4a16b489ca Fix the 'DEBUG' argument code to unbreak the amd64 LINT build. 2004-08-16 11:12:57 +00:00
David E. O'Brien
c680f6b12d I'm not sure what tjr envisioned for turning on FreeBSD/i386 rt support,
but make it COMPAT_IA32 for now.
Fix the 'DEBUG' argument code to unbreak the amd64 LINT build.
2004-08-16 11:09:59 +00:00
David E. O'Brien
186b870df3 Fix the 'DEBUG' argument code to unbreak the amd64 LINT build. 2004-08-16 10:54:25 +00:00
David E. O'Brien
3a2e3a4aa7 Fix the 'DEBUG' argument code to unbreak the LINT build. 2004-08-16 10:36:12 +00:00
David E. O'Brien
fa6a78376f Minor style.9 cleanup. 2004-08-16 10:33:35 +00:00
David Malone
da126abaf1 When looking for some extra data to include in the hash, use the
address of the dirhash, rather than the first sizeof(struct dirhash
*) bytes of the structure (which, thankfully, seem to be constant).

Submitted by:	Ted Unangst <tedu@zeitbombe.org>
MFC after:	2 weeks
2004-08-16 10:00:44 +00:00
Søren Schmidt
5f7a48ef1e Improve (hopefully) on the workaround code for devices that doesn't
interrupt when command is done, ie some ATAPI CD drives with no
media loaded.
2004-08-16 09:32:35 +00:00
Søren Schmidt
fe76f7b6c8 Fix Promise sx4/sx4000 support that broke on the latest race fixes. 2004-08-16 09:29:46 +00:00
David E. O'Brien
9c737de401 Increase the scaling of VM_KMEM_SIZE_MAX.
Submitted by:	alc
2004-08-16 08:35:22 +00:00
David E. O'Brien
78c37b0de8 s/MAX_SAFE_MAXVNODES/MAXVNODES_MAX/g 2004-08-16 08:33:37 +00:00
Pawel Jakub Dawidek
809a9dc601 Decrease debug level to 0. 2004-08-16 08:33:04 +00:00
Pawel Jakub Dawidek
5e6db16cd6 Fix warning. 2004-08-16 08:21:31 +00:00
Tim J. Robbins
84880f87d0 Add support for 32-bit Linux binary emulation on amd64:
- include <machine/../linux32/linux.h> instead of <machine/../linux/linux.h>
  if building with the COMPAT_LINUX32 option.
- make minimal changes to the i386 linprocfs_docpuinfo() function to support
  amd64. We return a fake CPU family of 6 for now.
2004-08-16 08:19:18 +00:00
Tim J. Robbins
6766a2386d Regen. 2004-08-16 08:07:06 +00:00
Tim J. Robbins
ea0fabbc4f Add preliminary support for running 32-bit Linux binaries on amd64, enabled
with the COMPAT_LINUX32 option. This is largely based on the i386 MD Linux
emulations bits, but also builds on the 32-bit FreeBSD and generic IA-32
binary emulation work.

Some of this is still a little rough around the edges, and will need to be
revisited before 32-bit and 64-bit Linux emulation support can coexist in
the same kernel.
2004-08-16 07:55:06 +00:00
Tim J. Robbins
4af2762336 Changes to MI Linux emulation code necessary to run 32-bit Linux binaries
on AMD64, and the general case where the emulated platform has different
size pointers than we use natively:
- declare certain structure members as l_uintptr_t and use the new PTRIN
  and PTROUT macros to convert to and from native pointers.
- declare some structures __packed on amd64 when the layout would differ
  from that used on i386.
- include <machine/../linux32/linux.h> instead of <machine/../linux/linux.h>
  if compiling with COMPAT_LINUX32. This will need to be revisited before
  32-bit and 64-bit Linux emulation support can coexist in the same kernel.
- other small scattered changes.

This should be a no-op on i386 and Alpha.
2004-08-16 07:28:16 +00:00
Tim J. Robbins
0e73a96209 Add a new type, l_uintptr_t, which is an unsigned integer type with the
same width as a pointer under Linux. Add two new macros, PTRIN and PTROUT,
which convert between l_uintptr_t and native pointers.
2004-08-16 07:05:44 +00:00
Pawel Jakub Dawidek
e81856c34c Connect RAID3 GEOM class to the build. 2004-08-16 06:36:21 +00:00
Warner Losh
b67471f34a Don't need to declare cbb module. don't know why I never saw
duplicate messages..
2004-08-16 06:33:58 +00:00
Peter Grehan
dbc13869ee Advertise that color is supported so that syscons doesn't come up
in monochrome mode when run as init.
2004-08-16 06:26:15 +00:00
Pawel Jakub Dawidek
2d1661a5b6 Introduce GEOM RAID3 class, i.e. kernel module, which implements RAID3
transformation and graid3(8) userland utility, which can be used for
configuration. No manual page yet, sorry.

Hardware provided by:	Daniel Seuffert
2004-08-16 06:23:14 +00:00
Alan Cox
c1fbc251cd - Introduce and use a new tunable "debug.mpsafevm". At present, setting
"debug.mpsafevm" results in (almost) Giant-free execution of zero-fill
   page faults.  (Giant is held only briefly, just long enough to determine
   if there is a vnode backing the faulting address.)

   Also, condition the acquisition and release of Giant around calls to
   pmap_remove() on "debug.mpsafevm".

   The effect on performance is significant.  On my dual Opteron, I see a
   3.6% reduction in "buildworld" time.

 - Use atomic operations to update several counters in vm_fault().
2004-08-16 06:16:12 +00:00
Robert Watson
40f2ac28a0 Always acquire the UNIX domain socket subsystem lock (UNP lock)
before dereferencing sotounpcb() and checking its value, as so_pcb
is protected by protocol locking, not subsystem locking.  This
prevents races during close() by one thread and use of ths socket
in another.

unp_bind() now assert the UNP lock, and uipc_bind() now acquires
the lock around calls to unp_bind().
2004-08-16 04:41:03 +00:00
Brian Feldman
7c938963a4 Rather than bringing back all of the changes to make VM map deletion
wait for system wires to disappear, do so (much more trivially) by
instead only checking for system wires of user maps and not kernel maps.

Alternative by:	tor
Reviewed by:	alc
2004-08-16 03:11:09 +00:00
Brian Feldman
8912c44d9f Add the missing knote_fdclose(). 2004-08-16 03:09:01 +00:00
Brian Feldman
1c0f9af5b5 Allocate the marker, when scanning a kqueue, from the "heap" instead of the
stack.  When swapped out, a process's kernel stack would be unavailable,
and we could get a page fault when scanning the same kqueue.

PR:	kern/61849
2004-08-16 03:08:38 +00:00
Warner Losh
9fea47c8e6 Didn't intend to commit debugging code enabled 2004-08-16 01:57:06 +00:00
Robert Watson
ce5f32de11 Annotate the current UNIX domain socket locking strategies, order,
strengths, and weaknesses in a comment.  Assert a copyright over the
changes made as part of the locking work.
2004-08-16 01:52:04 +00:00
Mike Silbersack
5173e8f567 Major enhancements to pipe memory usage:
- pipespace is now able to resize non-empty pipes; this allows
  for many more resizing opportunities

- Backing is no longer pre-allocated for the reverse direction
  of pipes.  This direction is rarely (if ever) used, so this cuts the
  amount of map space allocated to a pipe in half.

- Pipe growth is now much more dynamic; a pipe will now grow when
  the total amount of data it contains and the size of the write are
  larger than the size of pipe.  Previously, only individual writes greater
  than the size of the pipe would cause growth.

- In low memory situations, pipes will now shrink during both read
  and write operations, where possible.  Once the memory shortage
  ends, the growth code will cause these pipes to grow back to an appropriate
  size.

- If the full PIPE_SIZE allocation fails when a new pipe is created, the
  allocation will be retried with SMALL_PIPE_SIZE.  This helps to deal
  with the situation of a fragmented map after a low memory period has
  ended.

- Minor documentation + code changes to support the above.

In total, these changes increase the total number of pipes that
can be allocated simultaneously, drastically reducing the chances that
pipe allocation will fail.

Performance appears unchanged due to dynamic resizing.
2004-08-16 01:27:24 +00:00
Warner Losh
1ff2328528 Tweak the compatibility macros a little so that the device printing is
moved into them.
2004-08-15 23:39:18 +00:00
Warner Losh
cc81f0c35e Other part of the cbb isa/pci split. This likely is causing problems
wrt cbb module.
2004-08-15 23:17:54 +00:00
Marius Strobl
9c0c82c161 Add a kludge for building SBus-only kernels, i.e. kernels without support
for EBus, ISA and PCI, by compiling ofw_isa.c and ofw_pci_if.m unconditio-
nally. The correct way is to rewrite OF_decode_addr() in ofw_machdep.c in
a bus-neutral way. That's certainly possible but we unfortunately didn't
make it for FreeBSD 5.3.

Approved by:	tmm
2004-08-15 22:59:34 +00:00
Dag-Erling Smørgrav
c9b9a82654 Release the vnode cache mutex when calling vgone(), since vgone() may
sleep.  This makes pfs_exit() even less efficient than before, but on
the bright side, the vnode cache mutex no longer needs to be recursive.
2004-08-15 21:58:02 +00:00
Marius Strobl
775f3c3c28 Correct some uses of the wrong members of the *min()/*max()-familiy, e.g.
min() on unsigned long. None of these are believed to have been fatal though.

Reviewed by:	tmm
2004-08-15 21:37:52 +00:00
Alan Cox
87b9823ede - Make pmap_emulate_reference() MP and preemption safe. Previously, it
contained "sanity" checks that could be violated if another CPU modified
   the pmap between the emulation trap and locking the pmap in
   pmap_emulate_reference().  As a result, the pte could be inconsistent
   with the access that caused the emulation trap.  In such cases,
   pmap_emulate_reference() now flushes the current CPU's TLB entry and
   returns.
 - Make pmap_changebit() an inline function, reducing object code size.
2004-08-15 20:54:25 +00:00
Robert Watson
273ad9acbc Preemptive anti-footshooting: cause a #error if MP_WATCHDOG is compiled
with SCHED_ULE.
2004-08-15 20:32:40 +00:00
Robert Watson
932431328b Spell MP_WATCHDIG right: I fixed the build without MP_WATCHDOG after
testing MP_WATCHDOG, and used an incorrect ifdef.
2004-08-15 19:57:14 +00:00
Don Lewis
b6915bdbe5 Yet another tweak to the shutdown messages in boot():
Don't count busy buffers before the initial call to sync() and
  don't skip the initial sync() if no busy buffers were called.
  Always call sync() at least once if syncing is requested.  This
  defers the "Syncing disks, buffers remaining..." message until
  after the initial sync() call and the first count of busy
  buffers.  This backs out changes in kern_shutdown 1.162.

  Print a different message when there are no busy buffers after the
  initial sync(), which is now the expected situation.

  Print an additional message when syncing has completed successfully
  in the unusual situation where the work of syncing was done by
  boot().

  Uppercase one message to make it consistent with all of the other
  kernel shutdown messages.

Discussed with:	bde (in a much earlier form, prior to 1.162)
Reviewed by:	njl (in an earlier form)
2004-08-15 19:17:23 +00:00
Robert Watson
a632deec30 Add an "options MP_WATCHDOG" to i386. This option allows one of the
logical CPUs on a system to be used as a dedicated watchdog to cause a
drop to the debugger and/or generate an NMI to the boot processor if
the kernel ceases to respond.  A sysctl enables the watchdog running
out of the processor's idle thread; a callout is launched to reset a
timer in the watchdog.  If the callout fails to reset the timer for ten
seconds, the watchdog will fire.  The sysctl allows you to select which
CPU will run the watchdog.

A sample "debug.leak_schedlock" is included, which causes a sysctl to
spin holding sched_lock in order to trigger the watchdog.  On my Xeons,
the watchdog is able to detect this failure mode and break into the
debugger, which cannot otherwise be done without an NMI button.

This option does not currently work with sched_ule due to ule's push
notion of scheduling, similar to machdep.hlt_logical_cpus failing to
work with that scheduler.

On face value, this might seem somewhat inefficient, but there are a
lot of dual-processor Xeons with HTT around, so using one as a watchdog
for testing is not as inefficient as one might fear.
2004-08-15 18:02:09 +00:00
John-Mark Gurney
aafa519a46 move the declaration of struct kqlist into the non-KERNEL visable section
to fix userland.
2004-08-15 15:36:18 +00:00
Pawel Jakub Dawidek
f62d59df32 Avoid code duplication by introducing g_mirror_write_metadata() function,
which is used now by g_mirror_clear_metadata() function and
g_mirror_update_metadata() function.
2004-08-15 13:58:29 +00:00
Tim J. Robbins
ae8e14a6ac Replace linux_getitimer() and linux_setitimer() with implementations
based on those in freebsd32_misc.c, removing the assumption that Linux
uses the same layout for struct itimerval as we use natively.
2004-08-15 12:34:15 +00:00
Tim J. Robbins
d1d6dbf120 Avoid assuming that l_timeval is the same as the native struct timeval
in linux_select().
2004-08-15 12:24:05 +00:00
Tim J. Robbins
6fa534bad8 Use sv_psstrings from the current process's sysentvec structure instead
of PS_STRINGS. This is a no-op at present, but it will be needed when
running 32-bit Linux binaries on amd64 to ensure PS_STRINGS is in
addressable memory.
2004-08-15 11:52:45 +00:00
Ian Dowse
4ba861fa77 Use the USBD_FORCE_SHORT_XFER flag when setting up transmit transfers.
Without this, the device cannot detect the end of ethernet packets
whose size is a multiple of the USB packat size.

PR:		kern/70474
Submitted by:	Andrew Thompson <andy@fud.org.nz>
MFC after:	1 week
2004-08-15 10:51:21 +00:00
John-Mark Gurney
ad3b9257c2 Add locking to the kqueue subsystem. This also makes the kqueue subsystem
a more complete subsystem, and removes the knowlege of how things are
implemented from the drivers.  Include locking around filter ops, so a
module like aio will know when not to be unloaded if there are outstanding
knotes using it's filter ops.

Currently, it uses the MTX_DUPOK even though it is not always safe to
aquire duplicate locks.  Witness currently doesn't support the ability
to discover if a dup lock is ok (in some cases).

Reviewed by:	green, rwatson (both earlier versions)
2004-08-15 06:24:42 +00:00
Marius Strobl
115e9ac656 Fix a style(9) bug (variable definitions inside a nested scope) a patch
of mine introduced in revision 1.10.

Approved by:	marcel
Prodded by:	marcel
2004-08-15 02:17:20 +00:00
Robert Watson
d8939d82cb Add a new sysctl, debug.kdb.stop_cpus, which controls whether or not we
attempt to IPI other cpus when entering the debugger in order to stop
them while in the debugger.  The default remains to issue the stop;
however, that can result in a hang if another cpu has interrupts disabled
and is spinning, since the IPI won't be received and the KDB will wait
indefinitely.  We probably need to add a timeout, but this is a useful
stopgap in the mean time.

Reviewed by:	marcel
2004-08-15 02:06:27 +00:00
Marius Strobl
adb03c6788 sio(4), which never really worked on sparc64, was removed in favour of
uart(4) in sparc64/conf/GENERIC revision 1.63 about 9 months ago. Remove
its source files here, too.
2004-08-15 00:10:59 +00:00
Marius Strobl
efa79eb77e - Introduce an uart_cpu_identify() which is implemented in uart_cpu_<arch>.c
and that can be used as an identify function for all kinds of busses on a
  certain platform. Expect for sparc64 these are only stubs right now. [1]
- For sparc64, add code to its uart_cpu_identify() for registering the on-
  board ISA UARTs and their resources based on information obtained from
  Open Firmware.
  It would be better if this would be done in the OFW ISA code. However, due
  to the common FreeBSD ISA code and PNP-IDs not always being present in the
  properties of the ISA nodes there seems to be no good way to implement that.
  Therefore special casing UARTs as the sole really relevant ISA devices on
  sparc64 seemed reasonable. [2]

Approved by:	marcel
Discussed with:	marcel [1], tmm [2]
Tested by:	make universe
2004-08-14 23:54:27 +00:00
Marius Strobl
d25ed517a4 Add sparc64/pci/ofw_pci_if.m to the list of MFILES so modules can use
sparc64/pci/ofw_pci.h. This is a bit messy right now but (hopefully) will
get better once the MI OFW PCI code has moved from sparc64/pci to dev/ofw.
2004-08-14 23:53:04 +00:00
Marius Strobl
ac341582da Now that hme(4) is MI build its module on all platforms.
Tested by:	`make universe` and powerpc cross-build on i386
2004-08-14 22:40:16 +00:00
Marius Strobl
52c07e1c12 Add hme(4) here now that it's MI. 2004-08-14 22:38:50 +00:00
Marius Strobl
f348e5ac4b Make hme(4), i.e. the PCI-variant, MI by reading the MAC address on sytems
without Open Firmware directly instead of using OF_getetheraddr(). This is
a bit painful though, as the MAC address is contained in the NA field of
the VPD of the EBus bridge, which is is another function of the same chip.
To make it worse, the VPD of the EBus bridge can't be accessed via the PCI
capability pointer but has to be digged out from the Boot PROM and has a
non-standard format.
The PCI VPD struct and macros used here should be part of the FreeBSD PCI
code nevertheless.

Approved by:	tmm
Based on:	NetBSD
Tested with:	Sun X1032A (hme(4)-isp(4)-combo card) on alpha and i386
2004-08-14 22:38:20 +00:00
Warner Losh
487d427700 Next step in making usb more newbus:
o reprobe children when a new driver is added to uhub
o fix the usbd_probe_and_attach to set the ivars to a malloc'd area, as well
  as freeing the ivars on child destruction.
o Don't delete children that don't attach. Evidentally, the need to do this
  is a common misconception.
o minor formatting foo that may violate style(9) at the moment, but keeps the
  diffs against my p4 tree smaller.

This does not solve the ugen gobbling things up problem, but the fixes
I have for that expose bugs in other parts of the tree...
2004-08-14 22:10:26 +00:00
Marius Strobl
b7b6c9e6fa - Make OF_getetheraddr() honour the "local-mac-address?" system config
variable. If set to "true" OF_getetheraddr() will now return the unique
  MAC address stored in the "local-mac-address" property of the device's
  OFW node if present and the host address/system default MAC address if
  the node doesn't doesn't have such a property. If set to "false" the
  host address will be returned for all devices like before this change.
  This brings the behaviour of device drivers for NICs with OFW support/
  FCode, i.e. dc(4) for on-board DM9102A on Sun machines, gem(4) and hme(4),
  regarding "local-mac-address?" in line with NetBSD and Solaris.
  The man pages of the respective drivers will be updated separately to
  reflect this change.
- Remove OF_getetheraddr2() which was used as a stopgap in dc(4). Its
  functionality is now part of OF_getetheraddr().
2004-08-14 21:43:37 +00:00
Poul-Henning Kamp
3abefc9e56 Remove confused comment. 2004-08-14 21:40:28 +00:00
Alan Cox
6eaee3fee4 Remove spl calls. 2004-08-14 18:57:41 +00:00
Robert Watson
6cbea71c82 Cause pfind() not to return processes in the PRS_NEW state. As a result,
threads consuming the result of pfind() will not need to check for a NULL
credential pointer or other signs of an incompletely created process.
However, this also means that pfind() cannot be used to test for the
existence or find such a process.  Annotate pfind() to indicate that this
is the case.  A review of curent consumers seems to indicate that this is
not a problem for any of them.  This closes a number of race conditions
that could result in NULL pointer dereferences and related failure modes.
Other related races continue to exist, especially during iteration of the
allproc list without due caution.

Discussed with:	tjr, green
2004-08-14 17:15:16 +00:00
David Malone
1f44b0a1b5 Get rid of the RANDOM_IP_ID option and make it a sysctl. NetBSD
have already done this, so I have styled the patch on their work:

        1) introduce a ip_newid() static inline function that checks
        the sysctl and then decides if it should return a sequential
        or random IP ID.

        2) named the sysctl net.inet.ip.random_id

        3) IPv6 flow IDs and fragment IDs are now always random.
        Flow IDs and frag IDs are significantly less common in the
        IPv6 world (ie. rarely generated per-packet), so there should
        be smaller performance concerns.

The sysctl defaults to 0 (sequential IP IDs).

Reviewed by:	andre, silby, mlaier, ume
Based on:	NetBSD
MFC after:	2 months
2004-08-14 15:32:40 +00:00
Poul-Henning Kamp
e7581f0fc2 Fix outgoing ICMP on global instance. 2004-08-14 14:21:09 +00:00
Lukas Ertl
71fd4f60da Make informational output look less like an accident. 2004-08-14 09:56:17 +00:00
Poul-Henning Kamp
41befa53a4 Add XXX comment about findcdev() misuse. 2004-08-14 08:38:17 +00:00
Poul-Henning Kamp
d8e8b6755c Add some KASSERTS. 2004-08-14 08:33:49 +00:00
Julian Elischer
f0017f3321 Whitespace nit. 2004-08-14 07:21:20 +00:00
Marcel Moolenaar
c66fdb617d Allocate memory in the unwinder with M_NOWAIT. We may need to provide
backtraces with locks held.
2004-08-14 05:00:37 +00:00
Robert Watson
b295bdcded After completing a name lookup for a target UNIX domain socket to
connect to, re-check that the local UNIX domain socket hasn't been
closed while we slept, and if so, return EINVAL.  This affects the
system running both with and without Giant over the network stack,
and recent ULE changes appear to cause it to trigger more
frequently than previously under load.  While here, improve catching
of possibly closed UNIX domain sockets in one or two additional
circumstances.  I have a much larger set of related changes in
Perforce, but they require more testing before they can be merged.

One debugging printf is left in place to indicate when such a race
takes place: this is typically triggered by a buggy application
that simultaenously connect()'s and close()'s a UNIX domain socket
file descriptor.  I'll remove this at some point in the future, but
am interested in seeing how frequently this is reported.  In the
case of Martin's reported problem, it appears to be a result of a
non-thread safe syslog() implementation in the C library, which
does not synchronize access to its logging file descriptor.

Reported by:	mbr
2004-08-14 03:43:49 +00:00
Doug Ambrisko
386aa69b89 Add new PCI device ID for PERC4/DI. 2004-08-14 02:48:13 +00:00
Robert Watson
9baf5f2da1 Since if_oltr doesn't contain locking or run with INTR_MPSAFE, mark
the interface as IFF_NEEDSGIANT so if_start is run holding Giant.
2004-08-14 00:19:07 +00:00
Robert Watson
f92e0b28a4 Since if_ixgb doesn't contain locking or run with INTR_MPSAFE, mark
the interface as IFF_NEEDSGIANT so if_start is run holding Giant.
2004-08-14 00:17:04 +00:00
Robert Watson
7e3a88ea3c Since if_xe doesn't contain locking or run with INTR_MPSAFE, mark
the interface as IFF_NEEDSGIANT so if_start is run holding Giant.
2004-08-14 00:15:26 +00:00
Robert Watson
7eadb7d5e9 Since if_vx doesn't contain locking or run with INTR_MPSAFE, mark
the interface as IFF_NEEDSGIANT so if_start is run holding Giant.
2004-08-14 00:12:42 +00:00
Robert Watson
095f2ac443 Since if_txp doesn't contain locking or run with INTR_MPSAFE, mark
the interface as IFF_NEEDSGIANT so if_start is run holding Giant.

Note: mutexes are initialized in the softc for this driver, but the
locking appears inadequate to allow Giant-free operation.
2004-08-13 23:53:36 +00:00
Robert Watson
85d5028a78 Since if_tx doesn't contain locking or run with INTR_MPSAFE, mark
the interface as IFF_NEEDSGIANT so if_start is run holding Giant.
2004-08-13 23:52:33 +00:00
Robert Watson
d87e67338d Since if_sr doesn't contain locking or run with INTR_MPSAFE, mark
the interface as IFF_NEEDSGIANT so if_start is run holding Giant.
2004-08-13 23:49:48 +00:00
Robert Watson
5ce832e127 Since if_snc doesn't contain locking or run with INTR_MPSAFE, mark
the interface as IFF_NEEDSGIANT so if_start is run holding Giant.
2004-08-13 23:47:01 +00:00
Robert Watson
ae9be8d3bb Since if_sbni doesn't contain locking or run with INTR_MPSAFE, mark
the interface as IFF_NEEDSGIANT so if_start is run holding Giant.
2004-08-13 23:41:00 +00:00
Robert Watson
1d6aa1687f Since if_ray doesn't contain locking or run with INTR_MPSAFE, mark
the interface as IFF_NEEDSGIANT so if_start is run holding Giant.
2004-08-13 23:39:07 +00:00
Robert Watson
68c7bc6de8 Since if_plip doesn't contain locking or run with INTR_MPSAFE, mark
the interface as IFF_NEEDSGIANT so if_start is run holding Giant.
2004-08-13 23:32:17 +00:00
Robert Watson
fc4af83ae9 Since if_nge doesn't contain locking or run with INTR_MPSAFE, mark
the interface as IFF_NEEDSGIANT so if_start is run holding Giant.

Note: this driver does declare and occasionally reference mutexes,
but I believe not nearly enough to provide safety.
2004-08-13 23:22:53 +00:00
Robert Watson
26ec2d74aa Since if_lnc doesn't contain locking or run with INTR_MPSAFE, mark
the interface as IFF_NEEDSGIANT so if_start is run holding Giant.
2004-08-13 23:20:50 +00:00
Robert Watson
b095765df6 Since if_lge doesn't contain locking or run with INTR_MPSAFE, mark
the interface as IFF_NEEDSGIANT so if_start is run holding Giant.
2004-08-13 23:18:01 +00:00
Robert Watson
9c7d53aa85 Since if_ic doesn't contain locking or run with INTR_MPSAFE, mark
the interface as IFF_NEEDSGIANT so if_start is run holding Giant.
2004-08-13 23:16:44 +00:00
Robert Watson
be0fd0eb55 Since if_ie doesn't contain locking or run with INTR_MPSAFE, mark
the interface as IFF_NEEDSGIANT so if_start is run holding Giant.
2004-08-13 23:15:44 +00:00
Robert Watson
3acd3b73c5 Since if_hme doesn't contain locking or run with INTR_MPSAFE, mark
the interface as IFF_NEEDSGIANT so if_start is run holding Giant.
2004-08-13 23:14:50 +00:00
Robert Watson
268f132afc Since if_gem doesn't contain locking or run with INTR_MPSAFE, mark
the interface as IFF_NEEDSGIANT so if_start is run holding Giant.
2004-08-13 23:11:24 +00:00
Robert Watson
a1755216cf Since if_fwip doesn't contain locking or run with INTR_MPSAFE, mark
the interface as IFF_NEEDSGIANT so if_start is run holding Giant.

Approved by:	dfr
2004-08-13 23:09:41 +00:00
Robert Watson
65da4658f0 Since if_fe doesn't contain locking or run with INTR_MPSAFE, mark
the interface as IFF_NEEDSGIANT so if_start is run holding Giant.
2004-08-13 23:08:08 +00:00
Robert Watson
54c32b7d98 Since if_ex doesn't contain locking or run with INTR_MPSAFE, mark
the interface as IFF_NEEDSGIANT so if_start is run holding Giant.

Note: there are locking macros in if_exreg.h, but they appear to be
unused.
2004-08-13 23:06:55 +00:00
Robert Watson
463d14faf8 Since if_ed doesn't contain locking or run with INTR_MPSAFE, mark
the interface as IFF_NEEDSGIANT so if_start is run holding Giant.
2004-08-13 23:04:23 +00:00
Robert Watson
de1af409d2 Since if_cs doesn't contain locking or run with INTR_MPSAFE, mark
the interface as IFF_NEEDSGIANT so if_start is run holding Giant.
2004-08-13 23:03:11 +00:00
Robert Watson
c84843f1e5 Since if_cp doesn't contain locking or run with INTR_MPSAFE, mark
the interface as IFF_NEEDSGIANT so if_start is run holding Giant.
2004-08-13 23:02:17 +00:00
Robert Watson
07f3ffc4fe Since if_cm doesn't contain locking or run with INTR_MPSAFE, mark
the interface as IFF_NEEDSGIANT so if_start is run holding Giant.
2004-08-13 22:57:44 +00:00
Robert Watson
ec722f0875 Since if_awi doesn't contain locking or run with INTR_MPSAFE, mark
the interface as IFF_NEEDSGIANT so if_start is run holding Giant.
2004-08-13 22:55:25 +00:00
Robert Watson
ea69bf33ec Since if_arl doesn't contain locking or run with INTR_MPSAFE, mark
the interface as IFF_NEEDSGIANT so if_start is run holding Giant.
2004-08-13 22:54:19 +00:00
Robert Watson
b68828c941 As the if_ar driver doesn't contain locking or run its interrupt
MPSAFE, mark it as IFF_NEEDSGIANT so that its if_start routine is
run holding Giant.
2004-08-13 22:52:11 +00:00
Robert Watson
09e54b95d3 Since the if_de driver doesn't contain locking, mark it as
IFF_NEEDSGIANT so that ifp->if_start won't be called without Giant
when running debug.mpsafenet=1.
2004-08-13 22:48:05 +00:00
Doug Ambrisko
4f1132a88a Fix the memory scaling bug when basemem was converted to Kbytes from
bytes for AMD64.  Otherwise the AP will be started at 640K which
won't work.  Bug found on a Xeon 64bit system.
2004-08-13 22:30:55 +00:00
Robert Watson
3b7d076fe7 Use IFQ_SET_MAXLEN() to set the maximum queue depth of the routing
socket netisr queue.

Pointed out by:	winter
2004-08-13 22:23:21 +00:00
Justin T. Gibbs
39250c18b8 Extend critical section protection around portions of selection processing
that cannot tolerate changes to the waiting for selection queue by the
host or the host canceling an active selection.
2004-08-13 21:41:23 +00:00
Justin T. Gibbs
31d80b6045 Fix an off by one in the critical section clearing code. The
code was adjusting twice for the instruction pointer indicating
the *next* instruction to execute.  The aic79xx driver had a similar
bug, but was fixed some time ago.
2004-08-13 21:39:14 +00:00
Robert Watson
d990378077 Commit a work-around for a more general bug involving process state:
check whether p_ucred is NULL or not in pfs_getattr() before
dereferencing the credential, and return ENOENT if there wasn't one.

This is a symptom of a larger problem, wherein pfind() can return
references to incompletely initialized processes, and we instead ought
to not return them, or check the process state before acting on the
process.

Reported by:	kris
Discussed with:	tjr, others
2004-08-13 20:27:56 +00:00
Nate Lawson
c2c373f9a0 Fix building for the ACPI_DEBUG case. 2004-08-13 19:27:21 +00:00
Alan Cox
edf181d07e Add pmap locking to pmap_remove_all(). 2004-08-13 18:54:21 +00:00
Matt Jacob
6e6a585e3f When printing out an unknown sense code we should print it in hex, not
decimal.

Reviewed by: gibbs, nate, kdm
2004-08-13 18:45:04 +00:00
Nate Lawson
e1ebe17579 Record the new status after checking if it has changed, not before. This
fixes lost AC line transition events.

Bug report:	Kevin Oberman
2004-08-13 17:47:40 +00:00
John-Mark Gurney
ac77164d64 clean up whitespace... 2004-08-13 17:43:53 +00:00
Ruslan Ermilov
48aea4da66 Removed COPTS support from kmod.mk and kern.pre.mk.
COPTS support in bsd.prog.mk is preserved but discouraged.
2004-08-13 14:30:26 +00:00
Roman Kurakin
47a1257e20 Fix resource check while autodetection. 2004-08-13 12:35:52 +00:00
Roman Kurakin
f14ab395f4 White space cleanup. 2004-08-13 12:27:24 +00:00
Roman Kurakin
d71a0dc2e6 White space cleanup. 2004-08-13 12:22:01 +00:00
Roman Kurakin
a162fe531c White space cleanup. 2004-08-13 12:14:39 +00:00
Max Khon
75261008d7 Add geom_uzip -- geom class that implements read-only compressed disks.
Currently supports cloop V2.0 disk compression format.
May support more formats in future.
2004-08-13 09:40:58 +00:00
Søren Schmidt
8b68793ab3 Allow the use of a supplied function to set the PRD table. This is
needed for new chips that supports 64bit addressing.
2004-08-13 08:14:27 +00:00
Alan Cox
0164e05781 Replace the linear search in vm_map_findspace() with an O(log n)
algorithm built into the map entry splay tree.  This replaces the
first_free hint in struct vm_map with two fields in vm_map_entry:
adj_free, the amount of free space following a map entry, and
max_free, the maximum amount of free space in the entry's subtree.
These fields make it possible to find a first-fit free region of a
given size in one pass down the tree, so O(log n) amortized using
splay trees.

This significantly reduces the overhead in vm_map_findspace() for
applications that mmap() many hundreds or thousands of regions, and
has a negligible slowdown (0.1%) on buildworld.  See, for example, the
discussion of a micro-benchmark titled "Some mmap observations
compared to Linux 2.6/OpenBSD" on -hackers in late October 2003.

OpenBSD adopted this approach in March 2002, and NetBSD added it in
November 2003, both with Red-Black trees.

Submitted by: Mark W. Krentel
2004-08-13 08:06:34 +00:00
John-Mark Gurney
7d5e45a391 looks like rwatson forgot tabs... :) 2004-08-13 07:38:58 +00:00
Warner Losh
c397ea6713 Move PNP IDs back into oldcard files 2004-08-13 06:57:31 +00:00
Nate Lawson
8781a7852f MPSAFE locking
* Serialize access to the sysctl routines and the notify handler
* Assert that the sx lock is held in any functions they call.
* Note that recursively calling to re-enable the hotkeys is sub-optimal.
2004-08-13 06:22:35 +00:00
Nate Lawson
e8a162f4f3 MPSAFE locking
* Serialize access to the sysctl routines and the notify handler
* Assert that the sx lock is held in any functions they call.
2004-08-13 06:22:31 +00:00
Nate Lawson
1051a7c2da MPSAFE locking
* Serialize access to the sysctl routines and the notify handler.
2004-08-13 06:22:29 +00:00
Nate Lawson
25d32a9b77 MPSAFE locking
* Simplify taskqueue locking.
* Don't acquire Giant around calls to the taskqueue function.
* Remove 4.x compatibility routines.
2004-08-13 06:22:26 +00:00
Nate Lawson
e13cc46e0c MPSAFE locking
* Remove the interrupt wrapper that locked Giant and call the handler
  directly.  Mark the handler as MPSAFE.
* Don't attempt to detect if a handler is installed.  Leave that to the
  bus_alloc_resource() function.
2004-08-13 06:22:24 +00:00
Nate Lawson
5bfe5826f0 MPSAFE locking
* Serialize operations in acpi_video_bind_outputs(), acpi_video_detach(),
  acpi_video_notify_handler(), acpi_video_power_profile(), and the sysctls.
  The main goal is to protect the shared device list and prevent conflicting
  settings.
* Add assertions that the sx lock is held in the leaf functions.
2004-08-13 06:22:20 +00:00
Nate Lawson
956690d41b MPSAFE locking
* Restructure the event handling path.  acpi_tz_thread() now calls
  acpi_tz_timeout() any time an event occurs.  acpi_tz_timeout() checks
  the flags and calls acpi_tz_power_profile(), acpi_tz_establish(), and
  acpi_tz_monitor() as appropriate.  Notifies only do a wakeup and let
  acpi_tz_thread() do the actual work.  This path is cleaner and allows
  locking since the call path is now always a D.A.G.
* Add the acpi_tz_signal() function to set flags and wake the thread.
* Remove the tz_tmp_updating flag since calls are serialized by
  acpi_tz_thread().
* Remove Giant locking.
2004-08-13 06:22:17 +00:00
Nate Lawson
cece02d7b3 MPSAFE locking: Add a comment that we need resource list and device_t
refcounting/locking.
2004-08-13 06:22:13 +00:00
Nate Lawson
d317428f44 MPSAFE locking
* Serialize acpi_pwr_switch_consumer() and acpi_pwr_wake_enable().
* Make acpi_pwr_switch_consumer() have a single exit point.
* Add assertions to the leaf functions they call.
* Fix a memory leak in acpi_pwr_deregister_consumer().  However, it is
  currently ifdefed out so this code was unused.
2004-08-13 06:22:10 +00:00
Nate Lawson
bbf7c27a9c MPSAFE locking
* Serialize calls to acpi_pcib_route_interrupt().
* Note that acpi_pcib_attach() should not be called concurrently.
2004-08-13 06:22:07 +00:00
Nate Lawson
86b697a70b MPSAFE locking
* Serialize access to acpi_pci_link_config(), acpi_pci_find_prt(),
  acpi_pci_link_route(), and acpi_pci_link_resume().
* Add lock assertions to all functions called by them.
2004-08-13 06:22:03 +00:00
Nate Lawson
f4e6d08d46 MPSAFE locking
* Serialize access to acpi_pci_set_powerstate_method().
2004-08-13 06:21:58 +00:00
Nate Lawson
2014ed9841 MPSAFE locking
* Serialize notifying the user in acpi_lid_notify_status_changed().  This
  way multiple lid events occur in order.
* Add an initialization pass to get the lid status at boot-time.  This
  pass does not notify any apps but gets the initial status.
2004-08-13 06:21:55 +00:00
Nate Lawson
f4b7de154d MPSAFE locking
* Use the common serialization macros instead of rolling our own.
* Increase the coverage of the lock in EcSpaceHandler() to cover the entire
  loop to avoid dropping the lock when reading more than one byte.
2004-08-13 06:21:53 +00:00
Nate Lawson
d92a2ebdb2 MPSAFE locking
* Hold the ACPI lock over table register writes.
* Serialize calls to acpi_cpu_throttle_set() and the sysctls.
2004-08-13 06:21:47 +00:00
Nate Lawson
98b2573f26 MPSAFE locking
* Serialize ops in acpi_cmbat_notify_handler(), acpi_cmbat_ioctl(),
  acpi_cmbat_init_battery(), and acpi_cmbat_get_battinfo().
* Get the softc directly in acpi_cmbat_get_total_battinfo() rather than
  build an array of them.
* Don't queue a _BIF query after receiving a notify.  Since we clear the
  timespec, a _BIF query will be done in the context of the next caller.
* Add asserts to leaf functions that operate on shared data.
* Remove the bst/bif updating flags now that we hold the lock over the
  full query.
* Explain various comments in more detail.
2004-08-13 06:21:44 +00:00
Nate Lawson
07d4077ebf MPSAFE locking
* Serialize acpi_battery_get_battdesc(), acpi_battery_register(), and
  acpi_battery_remove().
* Assert that the sx lock is held in acpi_batteries_init().
* Remove check for device_get_softc() returning NULL.
2004-08-13 06:21:41 +00:00
Nate Lawson
99eaaec19e MPSAFE locking
* Serialize notification of acline changes in acpi_acad_get_status().
* Remove the initializing flag.  With the locking, we don't need to
  push off requests for the acline before initialization is done.
* Don't check device_get_softc(), it can't return NULL.
2004-08-13 06:21:36 +00:00
Nate Lawson
15e2f34f90 MPSAFE locking
* Serialize calls to acpi_alloc_resource(), acpi_release_resource(),
  acpi_Enable(), acpi_Disable(), and acpi_debug_sysctl().
* Acquire the ACPI mutex in acpi_register_ioctl(), acpi_deregister_ioctl(),
  and acpiioctl().
* Acquire the mutex while disabling subsequent requests to enter a
  sleep state in acpi_SetSleepState().
* Be sure to re-enable sleep requests and don't run resume methods when
  the current request fails.
* Don't check if sleep requests are disabled in the ACPIIO_SETSLPSTATE
  ioctl.  acpi_SetSleepState() does this for us.
* Remove the acquisition of Giant from the struct cdevsw.
* Remove the ACPI_USE_THREADS option.
2004-08-13 06:21:32 +00:00
Nate Lawson
3a9865dd34 MPSAFE locking
* Add and comment our locking primitives.  The mutex primitives use a
  a static mutex and the serialization ones use a static sx lock.  A global
  acpi_mutex is used for access to global resources (i.e., writes to the
  SMI_CMD register.)
* Remove 4.x compat defines.
2004-08-13 06:21:19 +00:00
Scott Long
4afedc314e Add support for the Adaptec RAID-On-Chip architecture. This in turn
provides support for the Adaptec 2130S adapter.  Thanks to Adaptec for
providing hardware for this.
2004-08-13 01:44:09 +00:00
Julian Elischer
c00661f83c Don't keep evaluating our own cpu mask..
it's not likely to have changed....
2004-08-13 00:57:43 +00:00
Julian Elischer
9a9472afd9 Add a macro to define the size of a subsection of a structure.
Used in fork1() and thr_create()
2004-08-13 00:53:40 +00:00
Tony Ackerman
b59db7bbe8 Added two new media types for 10GBASE-SR and 10GBASE-LR 2004-08-12 23:48:26 +00:00
MIHIRA Sanpei Yoshiro
bac683b5db add support for SanDisk Cruzer Mini 256MB USB 2.0 Flash Drive
PR:		kern/65438
Submitted by:	Peter D. Quilty <pdquilty@adelphia.net>
MFC after:	1 week
2004-08-12 23:29:22 +00:00
MIHIRA Sanpei Yoshiro
58e8a8006a add support Frontier Labs NEX IA+ Digital Audio Player with USB CF card reader/writer
PR:		kern/70158
Submitted by:	Bernd Strau. <no_bs@web.de>
MFC after:	1 week
2004-08-12 23:17:09 +00:00
Christian S.J. Peron
31c88a3043 Add the ability to associate ipfw rules with a specific prison ID.
Since the only thing truly unique about a prison is it's ID, I figured
this would be the most granular way of handling this.

This commit makes the following changes:

- Adds tokenizing and parsing for the ``jail'' command line option
  to the ipfw(8) userspace utility.
- Append the ipfw opcode list with O_JAIL.
- While Iam here, add a comment informing others that if they
  want to add additional opcodes, they should append them to the end
  of the list to avoid ABI breakage.
- Add ``fw_prid'' to the ipfw ucred cache structure.
- When initializing ucred cache, if the process is jailed,
  set fw_prid to the prison ID, otherwise set it to -1.
- Update man page to reflect these changes.

This change was a strong motivator behind the ucred caching
mechanism in ipfw.

A sample usage of this new functionality could be:

    ipfw add count ip from any to any jail 2

It should be noted that because ucred based constraints
are only implemented for TCP and UDP packets, the same
applies for jail associations.

Conceptual head nod by:	pjd
Reviewed by:	rwatson
Approved by:	bmilekic (mentor)
2004-08-12 22:06:55 +00:00
Marius Strobl
f7abebde9e - Use bus_space_subregion() rather than arithmetic on bus_space_handle_t. [1]
- Properly use the error variable and return it on failure in the attach-
  routines.

Reviewed by:	tmm
Inspired by:	NetBSD [1]
2004-08-12 20:37:02 +00:00
Tor Egge
19dc560756 The vm map lock is needed in vm_fault() after the page has been found,
to avoid later changes before pmap_enter() and vm_fault_prefault()
has completed.

Simplify deadlock avoidance by not blocking on vm map relookup.

In collaboration with: alc
2004-08-12 20:14:49 +00:00
MIHIRA Sanpei Yoshiro
882a77b811 add support Sitecom CN-311 usb flash reader(aka SIIG_WINTERREADER)
PR:		kern/64722
Submitted by:	Thiemo Nordenholz <nz@thiemo.net>
MFC after:	1 week
2004-08-12 20:14:20 +00:00
Robert Watson
8a0c4da871 When allocating the IPv6 header to stick in front of raw packet being
sent via a raw IPv6 socket, use M_DONTWAIT not M_TRYWAIT, as we're
holding the raw pcb mutex.

Reported, tested by:	kuriyama
2004-08-12 18:31:36 +00:00
David Malone
849112666a In tcp6_ctlinput, lock tcbinfo around the call to syncache_unreach
so that the locks held are the same as the IPv4 case.

Reviewed by:	rwatson
2004-08-12 18:19:36 +00:00
Robert Watson
44f31f7556 Trim trailing white space. 2004-08-12 18:06:21 +00:00
Marius Strobl
26280d88d7 - Introduce an ofw_bus kobj-interface for retrieving the OFW node and a
subset ("compatible", "device_type", "model" and "name") of the standard
  properties in drivers for devices on Open Firmware supported busses. The
  standard properties "reg", "interrupts" und "address" are not covered by
  this interface because they are only of interest in the respective bridge
  code. There's a remaining standard property "status" which is unclear how
  to support properly but which also isn't used in FreeBSD at present.
  This ofw_bus kobj-interface allows to replace the various (ebus_get_node(),
  ofw_pci_get_node(), etc.) and partially inconsistent (central_get_type()
  vs. sbus_get_device_type(), etc.) existing IVAR ones with a common one.
  This in turn allows to simplify and remove code-duplication in drivers for
  devices that can hang off of more than one OFW supported bus.
- Convert the sparc64 Central, EBus, FHC, PCI and SBus bus drivers and the
  drivers for their children to use the ofw_bus kobj-interface. The IVAR-
  interfaces of the Central, EBus and FHC are entirely replaced by this. The
  PCI bus driver used its own kobj-interface and now also uses the ofw_bus
  one. The IVARs special to the SBus, e.g. for retrieving the burst size,
  remain.
  Beware: this causes an ABI-breakage for modules of drivers which used the
  IVAR-interfaces, i.e. esp(4), hme(4), isp(4) and uart(4), which need to be
  recompiled.
  The style-inconsistencies introduced in some of the bus drivers will be
  fixed by tmm@ in a generic clean-up of the respective drivers later (he
  requested to add the changes in the "new" style).
- Convert the powerpc MacIO bus driver and the drivers for its children to
  use the ofw_bus kobj-interface. This invloves removing the IVARs related
  to the "reg" property which were unused and a leftover from the NetBSD
  origini of the code. There's no ABI-breakage caused by this because none
  of these driver are currently built as modules.
  There are other powerpc bus drivers which can be converted to the ofw_bus
  kobj-interface, e.g. the PCI bus driver, which should be done together
  with converting powerpc to use the OFW PCI code from sparc64.
- Make the SBus and FHC front-end of zs(4) and the sparc64 eeprom(4) take
  advantage of the ofw_bus kobj-interface and simplify them a bit.

Reviewed by:	grehan, tmm
Approved by:	re (scottl)
Discussed with:	tmm
Tested with:	Sun AX1105, AXe, Ultra 2, Ultra 60; PPC cross-build on i386
2004-08-12 17:41:33 +00:00
Warner Losh
9f7f340a0f Minor formatting fixes for lines > 80 characters 2004-08-12 17:26:22 +00:00
Brian Feldman
c5f60ffccf Re-delete the comment from r1.352. 2004-08-12 17:22:28 +00:00
Nate Lawson
56a7639b91 Skip dependent functions when finding the resource from _PRS to use for
later calls to _SRS.  Add note that this code should be centralized at
some point.

Bug from:	Jiawei Ye <leafy7382_AT_gmail.com>
2004-08-12 17:06:05 +00:00
Nate Lawson
12f57103bb Only print the link name if there is a link. For the hardwired case, don't
bother printing it.  This fixes a panic and acpi_name() has been more robust
as well.

Bug from:	Tai-hwa Liang <avatar-at-mmlab.cse.yzu.edu.tw>
2004-08-12 17:04:19 +00:00
Nate Lawson
0a9a1f44ce Allow null handles to be passed into acpi_name(). 2004-08-12 17:02:53 +00:00
Hartmut Brandt
a7e2239469 Allow the ATM call control module to be built into the kernel. 2004-08-12 15:01:59 +00:00
Hartmut Brandt
4f6f019206 Add the module build stuff for the ATM call control module. 2004-08-12 14:58:46 +00:00
Hartmut Brandt
a2931871f7 This is the netgraph node framework for the user side call control
node for ATM. This node implements the API to the signalling services.
2004-08-12 14:22:00 +00:00
Max Laier
571065e55f Loopback fix from Mathieu Sauve-Frankel:
Add missing check for NULL in DIOCCHANGERULE. This prevents a crash
	in certain rare cases.
2004-08-12 14:15:42 +00:00
Max Laier
01105bbf3b Loopback fix from Daniel Hartmeier:
pf_cksum_fixup() was called without last argument from
	normalization, also fixup checksum when random-id modifies ip_id.
	This would previously lead to incorrect checksums for packets
	modified by scrub random-id.

(Originally) Submitted by:	yongari
2004-08-12 13:59:44 +00:00
Max Laier
91a9e0b42b Loopback fix from Henning Brauer:
skip over interface addresses without IFA_ROUTE, fixes some issue
	with pppd

PR:	misc/69954
2004-08-12 13:54:50 +00:00
Andre Oppermann
9d804f818c Fix two cases of incorrect IPQ_UNLOCK'ing in the merged ip_reass() function.
The first one was going to 'dropfrag', which unlocks the IPQ, before the lock
was aquired; The second one doing a unlock and then a 'goto dropfrag' which
led to a double-unlock.

Tripped over by:	des
2004-08-12 08:37:42 +00:00
Søren Schmidt
d53fc3e41c Change the order of ata_dmainit/ata_allocate in preparation of
supporting new chipsets where this is needed.
2004-08-12 08:20:36 +00:00
Jeff Roberson
f2b74cbf28 - Introduce a new flag KEF_HOLD that prevents sched_add() from doing a
migration.  Use this in sched_prio() and sched_switch() to stop us from
   migrating threads that are in short term sleeps or are runnable.  These
   extra migrations were added in the patches to support KSE.
 - Only set NEEDRESCHED if the thread we're adding in sched_add() is a
   lower priority and is being placed on the current queue.
 - Fix some minor whitespace problems.
2004-08-12 07:56:33 +00:00
Warner Losh
93185c7468 Move towards isa attachment for pccbb. This is a work in progress, but
works well with the pci attachment.
2004-08-12 06:50:29 +00:00
Scott Long
dc9efde5b7 Destroy mutexes on detach. 2004-08-12 05:31:17 +00:00
Scott Long
ba1d57e7d9 Change FREE() to free() 2004-08-12 05:09:17 +00:00
Scott Long
bb6fe253cc Remove the AAC_LOCK macros. They no longer abstract anything and only
obfuscate the code.  No functional differences.
2004-08-12 05:05:06 +00:00
Scott Long
3576af8fd7 Release the sync fib after the controller has been shut down. This also
releases the I/O lock instead of just leaking it.
2004-08-12 04:47:32 +00:00
Robert Watson
52bc12b3da Set IFF_NEEDSGIANT for fwe network interface since the firewire
framework isn't yet MPSAFE.

Approved by:	simokawa
2004-08-12 03:02:16 +00:00
Nate Lawson
310953d935 Fix the PRT entry code in acpi_pci_link to always add the entry, even if
there is no irq link.  Since we now use the stored copy of PRT, not the
one that used to be passed into acpi_pcib_route_interrupt(), we need it in
the list. [1]

Fix a bug in acpi_pci_find_prt() where we weren't checking the bus, thus
choosing the wrong PRT entry to use for routing the link.  Also, add a
printf for the case where the PRT entry is not found as this should not
happen.

Tested by:	marcel [1]
2004-08-12 02:06:19 +00:00
Robert Watson
c19c5239a6 When udp_send() fails, make sure to free the control mbufs as well as
the data mbuf.  This was done in most error cases, but not the case
where the inpcb pointer is surprisingly NULL.
2004-08-12 01:34:27 +00:00
Pawel Jakub Dawidek
887c9fd564 MFp4: Simplify code a bit:
- Remove kern.geom.mirror.sync_block_size sysctl. It is quite obvious that we
  want to use the biggest size possible.
- Do not use UMA zone for sync data allocations. There could be only one
  synchronization request per synchronized disk at a time, so allocate memory
  for one request on whole synchronization process related to one disk.

Tested by synchronizing one component (out of three) and by synchronizing
two components (out of three) in parallel.
2004-08-11 23:41:53 +00:00
David Xu
91574a97b7 Mark end of frames. 2004-08-11 23:23:05 +00:00
Pawel Jakub Dawidek
445a4b68f2 Actually, HARDCODED flag isn't stored in metadata, so don't bother
dumping it.
2004-08-11 22:16:42 +00:00
Pawel Jakub Dawidek
2def749bb1 - Fix typo.
- Dump HARDCODED flag.
2004-08-11 22:12:44 +00:00
Don Lewis
414ce15cb3 Deorbit the fxp tuning hint (hint.fxp.UNIT_NUMBER.ipcbxmit_disable)
introduced in if_fxp.c revision 1.180.  The bug fix committed in
revision 1.180 fixed the packet truncation problem.
2004-08-11 21:41:25 +00:00
Marius Strobl
490a46bf68 Unbreak after struct resource was hidden. Tested with EBus front-end on
Sun AXe board.
2004-08-11 21:19:31 +00:00
Marius Strobl
a4954466bd - Use the rman_get_* functions instead of reaching into struct resource.
- Remove __RMAN_RESORUCE_VISIBLE again. It's no longer required either
  because of the above change or because struct rman is no longer hidden.

Reviewed by:	grehan
Tested by:	cross-compile on i386
2004-08-11 21:09:40 +00:00
Julian Elischer
0f54f48225 Properly keep track of how many kses are on the system run queue(s). 2004-08-11 20:54:48 +00:00
Nate Lawson
8f24713075 Add some more verbose warning/error messages to help with users reporting
problems with irq routing.
2004-08-11 20:37:24 +00:00
Justin T. Gibbs
28606ea437 Correctly export the size of our softc to newbus in our EISA attachement.
This avoids a panic upon first softc field reference.
2004-08-11 20:35:55 +00:00
Andre Oppermann
420a281164 Backout removal of UMA_ZONE_NOFREE flag for all zones which are established
for structures with timers in them.  It might be that a timer might fire
even when the associated structure has already been free'd.  Having type-
stable storage in this case is beneficial for graceful failure handling and
debugging.

Discussed with:	bosko, tegge, rwatson
2004-08-11 20:30:08 +00:00
Andre Oppermann
2dc1d58164 Convert the routing table to use an UMA zone for rtentries. The zone is
called "rtentry".

This saves a considerable amount of kernel memory.  R_Zmalloc previously
used 256 byte blocks (plus kmalloc overhead) whereas UMA only needs 132
bytes.

Idea from:	OpenBSD
2004-08-11 17:26:56 +00:00
Warner Losh
a9a74ddc37 Remove badly broken pcic driver for NEWCARD 2004-08-11 17:24:42 +00:00
Warner Losh
1b868fa919 Remove pcic for NEWCARD 2004-08-11 17:23:32 +00:00
Warner Losh
215e417c4d Remove references to pcic for newcard from NOTES. 2004-08-11 17:22:37 +00:00
Andre Oppermann
4efb805c0c Remove the UMA_ZONE_NOFREE flag to all uma_zcreate() calls in the IP and
TCP code.  This flag would have prevented giving back excessive free slabs
to the global pool after a transient peak usage.
2004-08-11 17:08:31 +00:00
Nate Lawson
e4116e931c Re-work ACPI PCI IRQ routing (_PRT, link devices). The old approach was
incomplete in that the PRT routing was not aware of link programming.
Fix this by doing all routing through the link devices.  The new algorithm
for setting up links is:

1. Read _CRS to get current setting.  If invalid (not in _PRS), then set
   to 0.
2. Attempt to call _DIS on the link.  If successful, mark the link as not
   routed.  Otherwise, assume it still is.

Then when a routing request occurs:

3. Update weights for all IRQs
4. Attempt to route the initial IRQ if valid
5. If that fails, walk through the sorted list, attempting to route IRQs.
6. Configure the trigger/polarity based on _PRS.

Other changes:
* Add acpi_pci_find_prt() to look up the PRT entry for a given device and
  acpi_pci_link_route() to select/route the best IRQ for it.
* Remove duplicated code in acpi_pcib_route_interrupt() that picked the
  first IRQ from _PRS.
* Remove unneeded arguments from acpi_pcib_resume() and friends.
* Ignore _STA on link devices but report if it seems strange.
* Add a prt_source handle to the PRT structure since the ACPI struct
  ACPI_PCI_ROUTING_TABLE uses a fixed-size entry for it.  We'll need to
  dynamically size this object if we want to use it the same way ACPI-CA
  does.  Null-terminate the source.

Tested by:	Luo Hong <luohong99_at_mails.tsinghua.edu.cn>,
		Jeffrey Katcher <jmkatcher_at_yahoo.com>
Info from:	jhb, Len Brown (Intel)
2004-08-11 14:52:50 +00:00
Pawel Jakub Dawidek
a5ef629f10 Increase default kern.geom.stripe.maxmem to 50 elements. 2004-08-11 12:57:17 +00:00
Andre Oppermann
67d0b24ed1 Make use of in_localip() function and replace previous direct LIST_FOREACH
loops over INADDR_HASH.
2004-08-11 12:32:10 +00:00
Hartmut Brandt
63fa1c3303 Exclusion list for easier import. 2004-08-11 12:25:09 +00:00
Hartmut Brandt
f3e103df9f This commit was generated by cvs2svn to compensate for changes in r133492,
which included commits to RCS files with non-trunk default branches.
2004-08-11 12:21:36 +00:00
Hartmut Brandt
e42ab7cde1 Virgin import of NgATM shared kernel/user part 1.1 2004-08-11 12:21:36 +00:00
Pawel Jakub Dawidek
1b949c05a3 When sending request once again because of ENOMEM, reset bio_children
and bio_inbed fields to 0. Without this change we can end up with
I/O leakage in some rare situations.
I tested this change by putting failure probability mechanism simlar
to this used in NOP class into g_clone_bio(9) function, so it was
able to return NULL with the given probability.

Discussed with:	phk
2004-08-11 12:04:35 +00:00
Andre Oppermann
2eccc90b61 Add the function in_localip() which returns 1 if an internet address is for
the local host and configured on one of its interfaces.
2004-08-11 11:49:48 +00:00
Andre Oppermann
6e234ede37 Only invoke verify_path() for verrevpath and versrcreach when we have an IP packet. 2004-08-11 11:41:11 +00:00
Pawel Jakub Dawidek
6d8fb92d78 Try harder to not panic on 'stop -f'.
After the commit, this command should be really safe to use.
2004-08-11 11:10:46 +00:00
Andre Oppermann
767981878c Only check for local broadcast addresses if the mbuf is flagged with M_BCAST. 2004-08-11 10:49:56 +00:00
Andre Oppermann
0b17fba7bc Consistently use NULL for pointer comparisons. 2004-08-11 10:46:15 +00:00
Andre Oppermann
de2e5d1e20 Make IP fastforwarding ALTQ-aware by adding the input traffic conditioner
check and disabling the early output interface queue length check.
2004-08-11 10:42:59 +00:00
Andre Oppermann
8f07801654 RFC 2292 requires to check msg_controllen, in case that the kernel returns
an empty list for some reasons.

Obtained from:

 NetBSD: socket.h,v 1.62 2001/09/07 08:13:01 itojun
 OpenBSD: socket.h,v 1.39 2001/09/07 16:45:25 itojun

MFC after:	2 weeks
2004-08-11 10:18:49 +00:00
Andre Oppermann
2f6e6e9b4c Correct the displayed bandwidth calculation for a readout via sysctl. The
saved value does not have to be scaled with HZ; it is already in bytes per
second.  Only the multiply by eight remains to show bits per second (bps).
2004-08-11 10:12:16 +00:00
Marcel Moolenaar
3a00930042 In set_regs(), flush the dirty registers onto the backingstore before
we update the registers. That way we don't have any dirty registers to
worry about and also know that bsp=bspstore, which makes updating the
RSE related registers predictable.
This is not the end of it. We need more validity checks, but for now
this allows us to complete the gdb testsuite without crashing the
kernel.
2004-08-11 05:29:13 +00:00
Robert Watson
bf029145fb Add 'axe' interface to NOTES so it is built with LINT as with other USB
network interface device drivers.
2004-08-11 04:44:49 +00:00
Robert Watson
27f74fd0ed Assert the locks of inpcbinfo's and inpcb's passed into in_pcbconnect()
and in_pcbconnect_setup(), since these functions frob the port and
address state of inpcbs.
2004-08-11 04:35:20 +00:00
Scott Long
8ab79fb0e1 Revert rev 1.93 and replace it by grabbing the vr lock before calling
mii_pollstat().  The previous was causing the vr lock to recurse.

PR:	kern/70189
2004-08-11 04:30:49 +00:00
Robert Watson
217a4b6e4e Replace a reference to splnet() with a reference to locking in a comment. 2004-08-11 03:43:10 +00:00
Robert Watson
1510469e95 Mark USB ethernet devices as IFF_NEEDSGIANT, since the USB framework
if_start routines cannot currently be entered without Giant.  When
the kernel is running with debug.mpsafenet != 0, this will defer
if_start execution to a task queue thread holding Giant, which may
introduce additional latency, but avoid incorrect execution.

Suggested by:	dfr
2004-08-11 03:38:55 +00:00
Robert Watson
38c9c1708b Perform a lockless read to test whether an entropy havesting fifo is
full, avoiding the cost of mutex operations if it is.  We re-test
once the mutex is acquired to make sure it's still true before doing
the -modify-write part of the read-modify-write.  Note that due to
the maximum fifo depth being pretty deep, this is unlikely to improve
harvesting performance yet.

Approved by:	markm
2004-08-11 03:33:32 +00:00
Marcel Moolenaar
4da47b2fec Add __elfN(dump_thread). This function is called from __elfN(coredump)
to allow dumping per-thread machine specific notes. On ia64 we use this
function to flush the dirty registers onto the backingstore before we
write out the PRSTATUS notes.

Tested on: alpha, amd64, i386, ia64 & sparc64
Not tested on: arm, powerpc
2004-08-11 02:35:06 +00:00
Robert Watson
b505f47bef Add ADAPTIVE_GIANT to GENERIC on i386, with the intent of making it
a standard configuration similar to [NO_]ADAPTIVE_MUTEXES.  This
feature causes Giant to be included in the set of mutexes adaptively
spun on.  It appears to have a positive effect on performance on SMP
across several workloads, including measurements of a 16% improvement
on buildworld, and 30%+ improvement for MySQL using the supersmack
benchmark with Giant over the network stack; a 6% improvement without
Giant on the network stack (as a result of less giant contention).
2004-08-11 01:34:18 +00:00
Robert Watson
87e83e7d4c In v_addpollinfo(), we allocate storage to back vp->v_pollinfo. However,
we may sleep when doing so; check that we didn't race with another thread
allocating storage for the vnode after allocation is made to a local
pointer, and only update the vnode pointer if it's still NULL.  Otherwise,
accept that another thread got there first, and release the local storage.

Discussed with:	jmg
2004-08-11 01:27:53 +00:00
Maksim Yevmenkin
285b72aa78 Set IFF_RUNNING flag on the interface as soon as the control device is opened. 2004-08-11 00:12:27 +00:00
Robert Watson
39dfb406e1 Modify vnode locking key: the v_pollinfo pointer itself is protected
by Giant; the contents are protected by the pollinfo mutex.  We rely
on Giant to prevent races in assigning the value of v_pollinfo.
2004-08-10 23:52:45 +00:00
Nate Lawson
c7f88fc386 Don't call DEVICE_RESUME a second time if DEVICE_SUSPEND fails. The
bus_generic_suspend method does this for us.  Disable interrupts before
entering S1.  This may help some systems suspend to S1 successfully.
2004-08-10 22:02:52 +00:00
Alan Cox
fad44deea3 Eliminate the acquisition and release of Giant within physio(). Remove
the spl calls.

Reviewed by: phk@
Discussed with: scottl@
2004-08-10 21:47:11 +00:00
Alan Cox
6306df6b89 Add a comment describing pmap_extract_and_hold() noting that the protection
check still needs implementation on arm.
2004-08-10 21:43:40 +00:00
Alan Cox
2c0680e659 Add pmap locking to many of the functions.
Implement the protection check required by the pmap_extract_and_hold()
specification.

Remove the acquisition and release of Giant from pmap_extract_and_hold() and
pmap_protect().

Many thanks to Ken Smith for resolving a sparc64-specific initialization
problem in my original patch.

Tested by: kensmith@
2004-08-10 20:53:26 +00:00
Lukas Ertl
92f49a969d If we kill the worklist thread of a RAID5 plex we can destroy
the worklist mutex at the same time, so move the mtx_destroy() call
to gv_kill_thread().
2004-08-10 20:51:48 +00:00
Lukas Ertl
ecffb8e64b Lock the topology before calling gv_parse_config, not afterwards. 2004-08-10 20:15:12 +00:00
Pawel Jakub Dawidek
6b2b3e8745 - Recognize HARDCODED flag when dumping consumer configuration.
- Improve code readabilty a bit.
2004-08-10 19:53:31 +00:00
Pawel Jakub Dawidek
c38d2f4eca Forgot to commit those: introduce hardcoded provider functionality,
which allow to store provider's name in the metadata and avoid
problems when few providers share the same last sector.
2004-08-10 19:52:12 +00:00
Marcel Moolenaar
03e62bf373 Comment-out the debugging printf I left in in case there were some
packet related problems. No problems have been reported.
2004-08-10 19:32:33 +00:00
Pawel Jakub Dawidek
4ffa3fef69 Fix one of the lastest commit. This bio_caller1 should also be changed to
bio_driver1 (as all the rest).
This introduced a small memory leak, but it wasn't really critical,
because maximum memory for g_stripe_zone is always set, so after few
requests gstripe was working in "economic" mode.
2004-08-10 19:07:55 +00:00
John Baldwin
274f8f48e8 Synchronize the extra SA threading checks and return value handling of
condition variables with that of msleep().

Reviewed by:	davidxu
2004-08-10 17:42:59 +00:00
Brian Feldman
0ada205ee6 Back out all behavioral chnages. 2004-08-10 14:42:48 +00:00
David Xu
767d9fcf7c As AMD64 architecture volume 1 chapter 3.1.2 says, high 32 bits of %rflags
are resevered, they can be written with anything, but they always read
as zero, we should simulate it in set_regs() as we are reading/writting
real hardware %rflags register.
2004-08-10 12:15:27 +00:00
Jeff Roberson
2454aaf51c - Use a new flag, KEF_XFERABLE, to record with certainty that this kse had
contributed to the transferable load count.  This prevents any potential
   problems with sched_pin() being used around calls to setrunqueue().
 - Change the sched_add() load balancing algorithm to try to migrate on
   wakeup.  This attempts to place threads that communicate with each other
   on the same CPU.
 - Don't clear the idle counts in kseq_transfer(), let the cpus do that when
   they call sched_add() from kseq_assign().
 - Correct a few out of date comments.
 - Make sure the ke_cpu field is correct when we preempt.
 - Call kseq_assign() from sched_clock() to catch any assignments that were
   done without IPI.  Presently all assignments are done with an IPI, but I'm
   trying a patch that limits that.
 - Don't migrate a thread if it is still runnable in sched_add().  Previously,
   this could only happen for KSE threads, but due to changes to
   sched_switch() all threads went through this path.
 - Remove some code that was added with preemption but is not necessary.
2004-08-10 07:52:21 +00:00
Robert Watson
d7aed12f45 Don't acquire Giant in cryptof_close(), as the code is intended to be
able to run MPsafe (and appears to be MPsafe).

Discussed with (some time ago):	sam
2004-08-10 03:26:17 +00:00
Robert Watson
1761672b75 Inline umich license from COPYRIGHT to make it clear what license the
umich copyright is asserting.

Clarify that the copyright I'm asserting is the standard Berkeley
license.

Remove Giant assertions from AARP and DDP input routines.
2004-08-10 03:23:05 +00:00
Marcel Moolenaar
0797d69c78 Catch up with change to <machine/pte.h>. 2004-08-10 02:08:57 +00:00
Nate Lawson
c8c216d558 Skip the syncing disks loop if there are no dirty buffers. Remove a
variable used to flag the initial printf.

Submitted by:	truckman (earlier version)
2004-08-10 01:32:05 +00:00
Maksim Yevmenkin
b25877a384 Introduce ng_hci_inquiry_response structure and use it in the hccontrol(8) 2004-08-10 00:38:50 +00:00
Scott Long
0f4ad91810 Add a temporary debugging hack to detect a deadlock in setrunqueue(). This
is here so that we can gather stats on the nature of the recent rash of
hard lockups, and in this particular case panic the machine instead of
letting it deadlock forever.
2004-08-10 00:26:25 +00:00
David Xu
d421c2dc36 In syscall, always make a copy of parameters from trapframe, this
becauses some syscalls using set_mcontext can sneakily change
parameters and later when those syscalls references parameters,
they will wrongly use register values in mcontext_t.

Approved by: peter
2004-08-09 23:57:59 +00:00
Julian Elischer
73f3c121b6 Clean up and add coments.
reserve some bits in flag words for upcoming work.
Note the unused bits so they can be found easier.
2004-08-09 23:24:22 +00:00
Julian Elischer
e2105bce2a Slight changes to comments and some whitespace changes. 2004-08-09 21:57:30 +00:00
Eric Anholt
b6e05739c5 Minimal fix to prevent crashes when an AGP v2 card is used with the new v3 VIA
chipsets, based on Linux's via-agp.c.  On boot, the system selects which AGP
version to use based on the inserted card.  If v2 was chosen, the chipset
needs to be programmed with the v2 registers still.  Also included in kern/69953
are changes to make the programming of the v3 registers match linux, but that
will be left out until the need to do so is confirmed (want specs or a tester).

PR:		kern/69953
Submitted by:	Oleg Sharoiko <os@rsu.ru>
Tested by:	Oleg Sharoiko <os@rsu.ru>, Geoff Speicher <geoff@speicher.org>
		(full version from PR)
2004-08-09 21:01:49 +00:00
Marcel Moolenaar
b4b7c60d70 Better preserve the original protection for the mappings we maintain.
The hardware always gives read access for privilege level 0, which
means that we cannot use the hardware access rights and privilege
level in the PTE to test whether there's a change in protection.  So,
we save the original vm_prot_t in the PTE as well.
Add pmap_pte_prot() to set the proper access rights and privilege
level on the PTE given a pmap and the requested protection.

The above allows us to compare the protection in pmap_extract_and_hold()
which was missing. While in pmap_extract_and_hold(), add pmap locking.

While here, clean up most (i.e. all but one) PTE macros we inherited
from alpha. They were either unused, used inconsistently, badly named
or simply weren't beneficial. We save the wired and managed state of
the PTE in distinct (bit) fields.

While in pte.h, s/u_int64_t/uint64_t/g

pmap locking obtained from: alc@
feedback & review by: alc@
2004-08-09 20:44:41 +00:00
Julian Elischer
1a5cd27b4b Make kg->kg_runnable actually count runnable threads in the ksegrp run queue
instead of only doing it sometimes.. This is not used outdide of debugging code
in the current code, but that will probably change.
2004-08-09 20:36:03 +00:00
Brian Feldman
6eb3cb4a13 Fix rl(4)'s lock behavior upon deinitialization. I would get a panic
when kldunloading due to its private locking being acquired recursively.
2004-08-09 20:22:17 +00:00
Julian Elischer
332e72ddb7 Remove typos on KASSERT messages. 2004-08-09 20:13:07 +00:00
Brian Feldman
9689d5e5ee Revamp VM map wiring.
* Allow no-fault wiring/unwiring to succeed for consistency;
  however, the wired count remains at zero, so it's a special case.

* Fix issues inside vm_map_wire() and vm_map_unwire() where the
  exact state of user wiring (one or zero) and system wiring
  (zero or more) could be confused; for example, system unwiring
  could succeed in removing a user wire, instead of being an
  error.

* Require all mappings to be unwired before they are deleted.
  When VM space is still wired upon deletion, it will be waited
  upon for the following unwire.  This makes vslock(9) work
  rather than allowing kernel-locked memory to be deleted
  out from underneath of its consumer as it would before.
2004-08-09 19:52:29 +00:00
Alan Cox
8673599662 Make two changes to vm_fault().
1. Move a comment to its proper place, updating it.  (Except for white-
   space, this comment had been unchanged since revision 1.1!)
2. Remove spl calls.
2004-08-09 18:46:39 +00:00
Brian Feldman
83dd6b37e1 Normalize the VM wiring done with SPARSE_MAPPING: check for errors, and
unmap when done.  For whatever reason, SPARSE_MAPPING is not even a
config option, so this is dead code.
2004-08-09 18:46:13 +00:00
Julian Elischer
732d95288a Increase the amount of data exported by KTR in the KTR_RUNQ setting.
This extra data is needed to really follow what is going on in the
threaded case.
2004-08-09 18:21:12 +00:00
Alan Cox
91491c3566 Remove a stale comment from vm_map_lookup() that pertains to share maps.
(The last vestiges of the share map code were removed in revisions 1.153
and 1.159.)
2004-08-09 18:15:46 +00:00
Warner Losh
e0eb3c19a7 Remove commented out pcic driver. It is too broken to work (even if you
fix the obvious bugs, nastier ones reside below the surfac), and having
it commented out here just encourages people to try it.

# I'm not removing it from the base system, yet.
2004-08-09 17:36:19 +00:00
Andre Oppermann
bb7c5b3055 Make a comment that IP source routing is not SMP and PREEMPTION safe. 2004-08-09 16:17:37 +00:00
Andre Oppermann
a5053398d4 Make a comment that "ipfw forward" is not SMP and PREEMPTION safe. 2004-08-09 16:16:10 +00:00
Andre Oppermann
5f9541ecbd New ipfw option "antispoof":
For incoming packets, the packet's source address is checked if it
 belongs to a directly connected network.  If the network is directly
 connected, then the interface the packet came on in is compared to
 the interface the network is connected to.  When incoming interface
 and directly connected interface are not the same, the packet does
 not match.

Usage example:

 ipfw add deny ip from any to any not antispoof in

Manpage education by:	ru
2004-08-09 16:12:10 +00:00
Søren Schmidt
ed0c8a7dc7 Fix bad free() usage.
Submitted by:	Pawel Jakub Dawidek
2004-08-09 14:22:58 +00:00
Søren Schmidt
74f492f9bf Close a race in ata_reinit(). 2004-08-09 12:02:32 +00:00
Pawel Jakub Dawidek
6c74f5177c - Introduce option for hardcoding providers' names into metadata.
It allows to fix problems when last provider's sector is shared between few
  providers.
- Bump version number for CONCAT and STRIPE and add code for backward
  compatibility.
- Do not bump version number of MIRROR, as it wasn't officially introduced yet.
  Even if someone started to play with it, there is no big deal, because
  wrong MD5 sum of metadata will deny those providers.
- Update manual pages.
- Add version history to g_(stripe|concat).h files.
2004-08-09 11:29:42 +00:00
Pawel Jakub Dawidek
7e72a70863 Do not use g_wither_geom(9). I doesn't work in the way which is expected
here anymore (after g_wither_washer() was introduced), i.e. geom and consumer
will not be immediately destroyed if possible.
2004-08-09 11:14:25 +00:00
John-Mark Gurney
3633dce05f make sure that ioctl's to ata use the proper cmd IOCATA...
Reviewed by:	sos
2004-08-09 06:47:53 +00:00
John-Mark Gurney
a246f097d6 change the name of the md module, to g_md, introduce a define with the
name MD_MODNAME, and make mdconfig use this new define...
2004-08-09 06:45:20 +00:00
Poul-Henning Kamp
157b106eae Too many versions.
Spotted by:	pjd
2004-08-09 06:04:00 +00:00
Alan Cox
eebf3286a6 Make two changes to vm_fault().
1. Retain the map lock until after the calls to pmap_enter() and
   vm_fault_prefault().
2. Remove a stale comment.  Submitted by: tegge@
2004-08-09 06:01:46 +00:00
John-Mark Gurney
6141e04a7e add option to automaticly mark core dumps with the nodump flag
PR:		57065
Submitted by:	Walter C. Pelissero
2004-08-09 05:46:46 +00:00
David Xu
604be46d1e 1.Add KSE_INTR_DBSUSPEND command for kse_thr_interrupt to suspend a bound
thread, after the bound thread leaves critical region, the thread should
check debug flag may suspend itself by using the command.
2.Schedule upcall after thread is suspended by debugger
3.Wakeup upcall thread after process suspension.

Reviewed by: deischen
2004-08-08 22:32:20 +00:00
David Xu
2b70a83aff Call thread_user_enter for M:N thread, ast() should be treated as another
entrance of kernel.
2004-08-08 22:28:33 +00:00
David Xu
1f2eac6cf3 Add pl_flags to ptrace_lwpinfo, two flags PL_FLAG_SA and PL_FLAG_BOUND
indicate that a thread is in UTS critical region.

Reviewed by: deischen
Approved by: marcel
2004-08-08 22:26:11 +00:00
Sam Leffler
e383b24041 Add missing bit of last if_start workaround: mark scan callout
MPSAFE only debug_mpsafenet is 1 so callbacks to send management
frames hold Giant; this is another bandaid on the path to removing Giant.
2004-08-08 17:10:54 +00:00
Poul-Henning Kamp
7ac439fec4 use bufdone() not biodone(). 2004-08-08 13:23:05 +00:00
Poul-Henning Kamp
a8687125e5 Use bufdone(), not biodone(). 2004-08-08 13:20:43 +00:00
Doug Rabson
cfaf7e60cc Make sure that AT_PHDR has a useful value even for static programs. 2004-08-08 09:48:10 +00:00
MIHIRA Sanpei Yoshiro
92c7375fb6 Add support iRiver iFP MP3 player
PR:		kern/54881, i386/63941, kern/66124
Submitted by:	Magnus <bsdhead.at.spray.dot.se@FreeBSD.org>,
		Dmitry Dyomin <old@old.com.ua>,
		Dmitry Sivachenko <mitya@demos.su>
MFC after:	1 week
2004-08-08 09:08:37 +00:00
Poul-Henning Kamp
07f076fe7a OK, now check geom class version numbers. 2004-08-08 08:34:46 +00:00
Poul-Henning Kamp
5721c9c76a Tag all geom classes in the tree with a version number. 2004-08-08 07:57:53 +00:00
Poul-Henning Kamp
e232f70a75 OOps, that check was a bit premature. Allow zero versions as well. 2004-08-08 07:30:47 +00:00
MIHIRA Sanpei Yoshiro
d41f8399cd Add support Sony Handycam TRV-30 memory stick slot
PR:		kern/69915
Submitted by:	Christian Gusenbauer <c47g@gmx.at>
MFC after:	1 week
2004-08-08 07:09:43 +00:00
Poul-Henning Kamp
650ee351b3 Use default method initialization on geoms. 2004-08-08 06:49:07 +00:00
Poul-Henning Kamp
199456973f Use a ->fini() from the geom class to destroy the control device.
Use default initialization of geom methods.
2004-08-08 06:47:43 +00:00
Poul-Henning Kamp
dd66958e28 Give classes a version number and refuse to touch classes which are not
understood.  This makes room for additional binary compatibility in the
future.

Put fields in the class for the geom's methods and initialize the methods
of a new geom from these fields.  This saves some code in all classes.
2004-08-08 06:46:27 +00:00
MIHIRA Sanpei Yoshiro
2de562f7a1 Add support to Sony Ericsson USB Cable(Susteen USB Data Cable)
PR:		kern/66416
Submitted by:	Fredrik Lindberg <fliREMOVEME@shapeshifter.se>
MFC after:	1 week
2004-08-08 05:21:56 +00:00
Alfred Perlstein
fdaba3df74 Bump __FreeBSD_version for vfs_mount signature change. 2004-08-08 03:21:37 +00:00
John-Mark Gurney
227559d11f rearange some code that handles the thread taskqueue so that it is more
generic.  Introduce a new define TASKQUEUE_DEFINE_THREAD that takes a
single arg, which is the name of the queue.

Document these changes.
2004-08-08 02:37:22 +00:00
Philip Paeps
c4dbfe3893 Assume a finger of regular width when no width value is reported by
the touchpad (which happens when it has no extended capabilities).

Spotted by:	dhw
Forgotten by:	philip
2004-08-08 01:26:00 +00:00
MIHIRA Sanpei Yoshiro
e314368afd Add support AOpen VA1000 video capture card
PR:		kern/62146
Submitted by:	HASHI Hiroaki <hasi@cskk-sv.co.jp>
MFC after:	1 week
2004-08-08 01:23:39 +00:00
Philip Paeps
1b5dd3aee5 Update support for Synaptics Touchpads (Volume IV)
o Change the motion calculation to result in
   a more reasonable speed of motion

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

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

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

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

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

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

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

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

Tested by:	many subscribers to -current
Approved by:	njl
2004-08-08 00:52:11 +00:00
Alan Cox
a9cb79ba4e With the advent of pmap locking it makes sense for pmap_copy() to be less
forgiving about inconsistencies in the source pmap.  Also, remove a new-
line character terminating a nearby panic string.
2004-08-08 00:31:58 +00:00
Marcel Moolenaar
47a86e3cd4 Implement single stepping when we leave the kernel through the EPC syscall
path. The basic problem is that we cannot set the single stepping flag
directly, because we don't leave the kernel via an interrupt return. So,
we need another way to set the single stepping flag.
The way we do this is by enabling the lower-privilege transfer trap, which
gets raised when we drop the privilege level. However, since we're still
running in kernel space (sec), we're not yet done. We clear the lower-
privilege transfer trap, enable the taken-branch trap and continue exiting
the kernel until we branch into user space.
Given the current code, there's a total of two traps this way before
we can raise SIGTRAP.
2004-08-08 00:28:07 +00:00
MIHIRA Sanpei Yoshiro
9caf2e9831 Add support for Belkin F5U409 serial-usb adapter
PR:              kern/69804
Submitted by:    Dan Nelson <dnelson@allantgroup.com>
2004-08-07 23:45:04 +00:00
Poul-Henning Kamp
e83f142353 Push all changes to disk before downgrading a mount from rw to ro. 2004-08-07 22:05:12 +00:00
Marcel Moolenaar
6aa84a056a Slightly move labels around to make sure we call ast() on our way out
after a fork(2) in fork_trampoline(). By moving the epc_syscall_return
label immediately before the call to do_ast() in epc_syscall(), we not
only achieve that but also handle the detour through exception_return
when the frame corresponds to an asynchronous kernel entry. Hence, we
simplified fork_trampoline() as a side-effect.
2004-08-07 21:55:15 +00:00
Marcel Moolenaar
7d9a8b1cd5 De-inline gdb_cpu_signal() because we need to convert the trap vectors
related to breakpoints and single stepping into SIGTRAP so gdb(1) knows
why the remote target has stopped. In particular, gdb(1) needs to know
if the reason is something of its own doing.
2004-08-07 21:40:52 +00:00
Dag-Erling Smørgrav
27de24a734 The whitespace crusader strikes! 2004-08-07 20:55:53 +00:00
Robert Watson
0dab4d146c Acquire vr lock before entering vr_setcfg() in vr_miibus_statchg(),
since vr_setcfg() expects it.

Reported by:	Mike Bristow <mike@urgle.com>
2004-08-07 19:40:19 +00:00
Lukas Ertl
dbf29ccf9c Due to popular demand, hook up geom_vinum to the build. 2004-08-07 16:16:59 +00:00
Robert Watson
b223d06425 We're not yet ready to assert !Giant in kern_fcntl(), as it's called
with Giant from ABI wrappers such as Linux emulation.

Foot shoot off:	phk
2004-08-07 14:09:02 +00:00
Søren Schmidt
ba0b5c1c3b Correct the last commit so it works in error situations as well. 2004-08-07 12:49:28 +00:00
Max Laier
de0332d4fa Add a "void *if_carp" placeholder to struct ifnet with prospect to bring in
the "Common address redundancy protocol" (CARP) during the 5-STABLE cycle.
Hence doing the ABI break now.

Approved by:	re (scottl)
2004-08-07 09:32:04 +00:00
Scott Long
066853b70e Move the definition of M_MEMDESC to a non-optional file. This allows
kernels configurations without the 'mem' device to compile.
2004-08-07 06:21:37 +00:00
Alan Cox
e0b47a134b Remove dead code. A vm_map's first_free is never NULL (even if the map is
full).

(This is preparation for an O(log n) implementation of vm_map_findspace().)

Submitted by:	Mark W. Krentel
2004-08-07 05:58:31 +00:00
Alan Cox
606ae16f13 Eliminate a variable that became unused in the i386 to amd64 conversion. 2004-08-07 04:31:26 +00:00
Sam Leffler
b5f4adb32e Pickup Giant in ath_rx_proc and when handling a beacon miss in order to
satisfy the assertion in if_start.
2004-08-07 00:45:05 +00:00
Peter Grehan
1a6f777efe Always isync after a mtmsr. While perhaps not strictly necessary for PSL_EE
bit banging according to the OEA, it's better to be conservative than
having to continually audit uses of this inline.
2004-08-07 00:20:00 +00:00
Robert Watson
ebcd28e669 As SLIP directly accesses the tty code from its if_start() routine,
mark if_sl as IFF_NEEDSGIANT.
2004-08-06 22:41:13 +00:00
Olivier Houchard
0f1f0c5d75 Use the new prototype for the zone constructor. 2004-08-06 22:32:53 +00:00
Robert Watson
db532b63c2 Flag a broad range of VFS operations as GIANT_REQUIRED in order to
catch leaking into VFS without Giant.

Inch Giant a little lower in several file descriptor operations on
vnodes to cover only VFS operations that need it, rather than file
flag reading, etc.
2004-08-06 22:25:35 +00:00
Nate Lawson
c68afc9d21 Fix a panic in ata_generic_transaction(). The DMA pointer of the channel
was being unconditionally dereferenced but was NULL for PIO requests.
Check the request flags for a DMA transaction before dereferencing.

Reported by:	ceri
Tested by:	Radek Kozlowski <radek -at- raadradd.com>
2004-08-06 22:23:53 +00:00
Robert Watson
cc701b73b8 In thread_exit(), include more information about the thread/process
context in the KTR trace record.  In particular, include the same
information as passed for mi_switch() and fork_exit() KTR trace
records.
2004-08-06 22:06:14 +00:00
Robert Watson
5dd3a4ed6c Push UIDINFO_UNLOCK() slightly earlier in chgsbize(), as it's not
needed if we print the local variable version of the limit rather
than the shared version.
2004-08-06 22:04:33 +00:00
Robert Watson
a0a819747c Avoid acquiring Giant for some common light-weight or already MPSAFE
fcntl() operations, including:

  F_DUPFD          dup() alias
  F_GETFD          retrieve close-on-exec flag
  F_SETFD          set close-on-exec flag
  F_GETFL          retrieve file descriptor flags

For the remaining fcntl() operations, do acquire Giant, especially
where we call into fo_ioctl() as a result.  We're not yet ready to
push Giant into fo_ioctl().  Once we do, this can all become quite a
bit prettier.
2004-08-06 22:00:55 +00:00
Robert Watson
f6b61a6442 Generate KTR trace records for syscall enter and exit in i386 system
calls.  Note that the information included is a bit different from the
existing KTR traces generated on powerpc, as I'm primarily interested
in kernel context (thread, syscall #, proc, etc), not the user
arguments to the system call.  Some convergence would be useful here.
2004-08-06 21:56:26 +00:00
Robert Watson
3659f747f1 Generate KTR trace records for uma_zalloc_arg() and uma_zfree_arg().
This doesn't trace every event of interest in UMA, but provides
enough basic information to explain lock traces and sleep patterns.
2004-08-06 21:52:38 +00:00
Robert Watson
ff7ec58af8 Cut a KTR record whenever a callout is invoked. Mark whether it runs
with Giant or not, and include the function point so it can be looked
up against the kernel symbol table during trace analysis.
2004-08-06 21:49:00 +00:00
Robert Watson
41563689f8 Assign KTR flag constants for UMA events and callouts. 2004-08-06 21:46:51 +00:00
Dag-Erling Smørgrav
c930712a51 While we're revisiting old sins, try to clean up the code a little and
make it more style(9)ish.
2004-08-06 21:35:51 +00:00
Dag-Erling Smørgrav
cddc8ed9c7 Move the source code for these two modules out of src/sys/modules. 2004-08-06 20:37:08 +00:00
Marcel Moolenaar
dc70e792a6 Do not use hardware flow control for the moment. There are some issues
with it that need to be understood better before they can be resolved.
This takes time and time is already in short supply.

Reported & tested by: glebius@
2004-08-06 15:51:31 +00:00
John Baldwin
44fe3c1ff0 Don't scare users with a warning about preemption being off when it isn't
yet safe to have on by default.
2004-08-06 15:49:44 +00:00
John-Mark Gurney
bd8fc733cb remove /boot/kernel from the default path.. There is already code that
will prepend the current kernel booting...  This prevents a problem of
loading /boot/kernel's modules when a different kernel has no modules,
but you left your module_load="YES" in loader.conf...

Reviewed by:	dcs (minus the help part)
2004-08-06 15:06:06 +00:00
Pawel Jakub Dawidek
cea363682f Add and document kern.geom.stripe.fast_failed sysctl, which shows how
many times "fast" mode failed.
2004-08-06 10:19:34 +00:00
Pawel Jakub Dawidek
ec70430134 Fields bio_caller[12] should be used by the consumer and fields
bio_driver[12] should be used by the provider!
2004-08-06 10:07:03 +00:00
Pawel Jakub Dawidek
37abacd4ff Fix I/O leakage. We're cloning bios in g_stripe_start_fast(), but when
something goes wrong while running in "fast" mode, we free all bios and
falling back to "economic" mode. Freeing bios, doesn't mean decrease
bio_children, so bio_inbed couldn't be equal to bio_children and request
was never finished.
Decrease bio_children manually when destroying bios.

Reported by:	Sam Lawrance <boris@brooknet.com.au>, simon
2004-08-06 09:55:40 +00:00
Peter Pentchev
3f35d5150b Do not attempt to clean up data that has not been initialized yet.
This fixes two kernel panics on boot when the xl driver fails to
allocate bus/port/memory resources.

Reviewed by:	silence on -net
2004-08-06 09:08:33 +00:00
Mark Murray
1e10d9c135 MFi386: Fix mem device. Grrr. 2004-08-06 07:22:36 +00:00
Mark Murray
b1b7862b7b MFi386: sort out the mem device. Grrrr. 2004-08-06 07:20:32 +00:00
Nate Lawson
85524256ea Refine updates to PCI irq routing. Check _STA and _CRS but only print a
message if they are incorrect.  Also, remove the hack of allowing the
initial irq setting to not be in _PRS.  As before, the old behavior can be
regained by defining ACPI_OLD_PCI_LINK.
2004-08-06 04:50:56 +00:00
Robert Watson
f31f65a708 Pass pcbinfo structures to in6_pcbnotify() rather than pcbhead
structures, allowing in6_pcbnotify() to lock the pcbinfo and each
inpcb that it notifies of ICMPv6 events.  This prevents inpcb
assertions from firing when IPv6 generates and delievers event
notifications for inpcbs.

Reported by:	kuriyama
Tested by:	kuriyama
2004-08-06 03:45:45 +00:00
Robert Watson
6f40c417ca In ithread_schedule(), when we plan to go harvest some entropy as
a result of scheduling an ithread, cut a KTR_INTR trace record so
that it's clear in tracing interrupt activity where and when the
entropy harvesting code is invoked.
2004-08-06 03:39:28 +00:00
Colin Percival
0413bacd09 When reseting a pending callout, perform the deregistration in
callout_reset rather than calling callout_stop.  This results in a few
lines of code duplication, but it provides a significant performance
improvement because it avoids recursing on callout_lock.

Requested by:	rwatson
2004-08-06 02:44:58 +00:00
Robert Watson
9c1df6951f When iterating the UDP inpcb list processing an inbound broadcast
or multicast packet, we don't need to acquire the inpcb mutex
unless we are actually using inpcb fields other than the bound port
and address.  Since we hold the pcbinfo lock already, these can't
change.  Defer acquiring the inpcb mutex until we have a high
chance of a match.  This avoids about 120 mutex operations per UDP
broadcast packet received on one of my work systems.

Reviewed by:	sam
2004-08-06 02:08:31 +00:00
Nate Lawson
17dbe0f79f Add flags for _STA (status) methods and convenience macros for checking
the presence of batteries and devices.
2004-08-06 00:38:50 +00:00
Dag-Erling Smørgrav
7ba04507e6 Just because we have a serial console attached does not mean we don't
want a splash screen.

There seems to be some confusion in the syscons code as to the meaning of
the SC_KERNEL_CONSOLE flag.  Its absence is sometimes interpreted to mean
"I am not the system console", and sometimes to mean "I am not the only
VGA console" (see the font loading code for an example of the latter).
Someone with better syscons fu than myself should take a closer look.
2004-08-05 23:54:04 +00:00
Brian Feldman
28775a6130 Turn on the new contigmalloc(9) by default. There should not actually
be a reason to use the old contigmalloc(9), but if desired, it the
vm.old_contigmalloc setting can be tuned/sysctld back to 0 for now.
2004-08-05 21:54:11 +00:00
Søren Schmidt
7e6d75884f Try to narrow down the race window on HW that does not have ways to
poll for which channel actually pulled the irq line.
2004-08-05 21:13:41 +00:00
Søren Schmidt
d5a9dcbf23 Add firmware revision to probe printf. 2004-08-05 21:11:33 +00:00
Max Laier
8de5b6f306 Use in_cksum_skip() to calculate in4_cksum instead of doing handrolled magic
(that does not compile with !gcc). Moreover we get the benefit for all archs
that have a hand optimized in_cksum_skip().

Submitted by:	yongari
Tested by:	me (i386, extensivly), pf4freebsd ML (various)
2004-08-05 20:41:38 +00:00
John Baldwin
5cc00cfc67 Fix the code in rman that merges adjacent unallocated resources to use a
better check for 'adjacent'.  The old code assumed that if two resources
were adjacent in the linked list that they were also adjacent range wise.
This is not true when a resource manager has to manage disparate regions.
For example, the current interrupt code on i386/amd64 will instruct
irq_rman to manage two disjoint regions: 0-1 and 3-15 for the non-APIC
case.  If IRQs 1 and 3 were allocated and then released, the old code
would coalesce across the 1 to 3 boundary because the resources were
adjacent in the linked list thus adding 2 to the area of resources that
irq_rman managed as a side effect.  The fix adds extra checks so that
adjacent unallocated resources are only merged with the resource being
freed if the start and end values of the resources also match up.  The
patch also consolidates the checks for adjacent resources being allocated.
2004-08-05 15:48:18 +00:00
Pawel Jakub Dawidek
db332970e7 Don't use 'bp' after its destruction! 2004-08-05 14:07:21 +00:00
Pawel Jakub Dawidek
a4fa09ec93 Simplify a bit - we could use 'sc' here as it was initialized properly. 2004-08-05 13:22:17 +00:00
Yoshihiro Takahashi
265d793d52 MFi386: revision 1.597. 2004-08-05 13:01:29 +00:00
Yoshihiro Takahashi
42f74b8558 MFi386: revision 1.502. 2004-08-05 13:00:11 +00:00
Yoshihiro Takahashi
710f2673ba MFi386: revision 1.410. 2004-08-05 12:58:52 +00:00
Peter Grehan
2184ddd1f7 In pmap_page_protect, clear the vm page's PG_WRITEABLE flag if
downgrading to read-only. Found by triggering the KASSERT in
vm_pageout_flush().
2004-08-05 12:44:12 +00:00
Maxim Sobolev
97c4cd9853 Set ip_v field properly.
PR:	kern/69957
2004-08-05 08:12:46 +00:00
Maxime Henrion
1af8a68c46 Now that mem(4) is a kernel module, we need to add a dependency on
it in drm(4) for mem_range_attr_set().  This fixes loading a DRM
driver as a module.

Reviewed by:	anholt
2004-08-05 07:20:24 +00:00
Colin Percival
08e062ff1e Finish the PRISON_ROOT -> SUSER_ALLOWJAIL renaming by removing
the definition of the old name.
2004-08-05 07:15:35 +00:00
Poul-Henning Kamp
23fc1a90ea Remove a product specific workaround for wrong modes when mmap(2)'ing
devices.  They have had plenty of time to adjust now.
2004-08-05 07:04:33 +00:00
Nate Lawson
298e3d15d7 Work around non-compliant BIOS PCI link devices. Some systems have the
following behavior:

* Link devices return invalid status (_STA) values.  The results are very
  unreliable -- sometimes never present.  Just ignore the status and pick
  the best configuration from _PRS.

* Link devices return invalid current settings (_CRS).  Even after setting
  the link value, many systems still return a different setting for _CRS.
  When setting an IRQ, don't bother to check _CRS to see if we succeeded.
  Note that we still check _CRS before routing and this should be addressed
  as well.

Since this is a sensitive area, leave the old behavior accessible via
uncommenting the define for ACPI_OLD_PCI_LINK at the top of the file.  Once
this has been thoroughly tested, this option and the code it covers will
be removed.

Thanks to Len Brown at Intel for informing us of these issues as he worked
around them in Linux.
2004-08-05 06:54:16 +00:00
Nate Lawson
0cafadacae Remove the attempt to cache the previous page mapped at our identity
location (for the wake code).  It should not be needed since we don't
map other pages at the same location and if there was an old mapping, it
would be restored by a fault.  The old code had serious problems, namely
that it was restoring the new page it had just removed (not opage) and
it could only guess at the right protection (since there's no
pmap_extract_protect function).  Thanks to Alan Cox for explaining much
of this to me.

Also, remove a commented-out initializecpu() call since it is not needed.
Restoring the cpu context is better than attempting to init from scratch.

Reviewed by:	alc (earlier version)
2004-08-05 06:29:12 +00:00
Alexander Kabaev
2939c8a0b9 Move boot2 BSS zeroing into btx startup code out of boot1. boot1 does not
have clear idea on boot2 BSS size and leaves portion of it not zeroed out.
btxcsu.s is in much better position for this job.

Obtained from: DragonflyBSD (with minor adjustments)
2004-08-05 06:00:05 +00:00
Pyun YongHyeon
74d554ae00 Implement TCP/UDP Transmit/Receive checksum offload.
Since HME doesn't compensate the checksum for UDP datagram which
can yield to 0x0, UDP transmit checksum offload is disabled by
default. The UDP Transmit checksum offload can be reactivated
by setting special link option link0 with ifconfig(8).

Approved by:	jake (mentor)
Reviewed by:	tmm
Tested by:	Herve Boulouis <amon@sockar.homeip.net>
2004-08-05 02:52:33 +00:00
Robert Watson
46691dd8d7 Do a lockless read of the BPF interface structure descriptor list head
before grabbing BPF locks to see if there are any entries in order to
avoid the cost of locking if there aren't any.  Avoids a mutex lock/
unlock for each packet received if there are no BPF listeners.
2004-08-05 02:37:36 +00:00
Robert Watson
5fb2253e10 Move definition of mem_range_softc from mp_machdep.c to machdep.c so
that it is defined for non-SMP builds, not just SMP ones.
2004-08-05 00:32:08 +00:00
Alan Cox
684a62b7bf - Push down the acquisition and release of Giant into pmap_enter_quick()
on those architectures without pmap locking.
 - Eliminate the acquisition and release of Giant in vm_map_pmap_enter().
2004-08-04 22:03:16 +00:00
Pawel Jakub Dawidek
51385a3c00 - Add two fields to bio structure: 'bio_cflags' which can be used by
consumer and 'bio_pflags' which can be used by provider.
- Remove BIO_FLAG1 and BIO_FLAG2 flags. From now on new fields should be
  used for internal flags.
- Update g_bio(9) manual page.
- Update some comments.
- Update GEOM_MIRROR, which was the only one using BIO_FLAGs.

Idea from:	phk
Reviewed by:	phk
2004-08-04 21:35:05 +00:00
Mark Murray
29fe871dae Oops. Didn't commit this as part of the mem module fix. 2004-08-04 20:49:43 +00:00
John Baldwin
0e5a07e533 Remove a potential deadlock on i386 SMP by changing the lazypmap ipi and
spin-wait code to use the same spin mutex (smp_tlb_mtx) as the TLB ipi
and spin-wait code snippets so that you can't get into the situation of
one CPU doing a TLB shootdown to another CPU that is doing a lazy pmap
shootdown each of which are waiting on each other.  With this change, only
one of the CPUs would do an IPI and spin-wait at a time.
2004-08-04 20:31:19 +00:00
John Baldwin
c950c15c76 Workaround a possible deadlock on SMP due to a spin lock LOR by disabling
the immediate awakening of proc0 (scheduler kproc, controls swapping
processes in and out).  The scheduler process periodically awakens already,
so this will not result in processes not being swapped in, there will just
be more latency in between a thread being made runnable and the scheduler
waking up to swap the affected process back in.
2004-08-04 20:24:40 +00:00
John Baldwin
bdcfcf5bc4 Cache the value of curthread in the _get_sleep_lock() and _get_spin_lock()
macros and pass the value to the associated _mtx_*() functions to avoid
more curthread dereferences in the function implementations.  This provided
a very modest perf improvement in some benchmarks.

Suggested by:	rwatson
Tested by:	scottl
2004-08-04 20:18:45 +00:00
John Baldwin
4dd70299b7 Whitspace fix. 2004-08-04 20:16:17 +00:00
Arun Sharma
d7cf64c9a1 Use a 256MB TR instead of a 64MB TR to make sure that the kernel
text/data are covered on APs. This enables the kernel to boot on
a 4 way Intel Itanium-2 platform. This has a secondary effect of
keeping the TRs identical on BP and the APs.

reviewed by: marcel@
2004-08-04 20:09:41 +00:00
Maxim Konovalov
f9b3b0e6d4 o Fix a typo in the comment. 2004-08-04 18:57:41 +00:00
Robert Watson
7a36e1d6c7 Assert Giant in namei(). Bugs have been reported in which, following
a sleep() call waking up in namei(), a later assertion triggers that
Giant is not held.  By asserting Giant at the start of namei(), we can
know that if that assertion triggers, Giant is lost during the call to
namei(), and not before.
2004-08-04 18:39:07 +00:00
Robert Watson
0be8ad5fbc Assert Giant in the following file descriptor-related functions:
Function             Reason
--------             ------
fdfree()             VFS
setugidsafety()      KQueue
fdcheckstd()         VFS
_fgetvp()            VFS
fgetsock()           Conditional assertion based on debug.mpsafenet
2004-08-04 18:35:33 +00:00
Mark Murray
a20ad05beb Fix module builds for i386 and amd64. 2004-08-04 18:30:31 +00:00
Robert Watson
98aed8ca56 Now that IPv6 performs basic in6pcb and inpcb locking, enable inpcb
lock assertions even if IPv6 is compiled into the kernel.  Previously,
inclusion of IPv6 and locking assertions would result in a rapid
assertion failure as IPv6 was not properly locking inpcbs.
2004-08-04 18:27:55 +00:00
Bill Paul
6f4481422e More minor cleanups and one small bug fix:
- In ntoskrnl_var.h, I had defined compat macros for
  ntoskrnl_acquire_spinlock() and ntoskrnl_release_spinlock() but
  never used them. This is fortunate since they were stale. Fix them
  to work properly. (In Windows/x86 KeAcquireSpinLock() is a macro that
  calls KefAcquireSpinLock(), which lives in HAL.dll. To imitate this,
  ntoskrnl_acquire_spinlock() is just a macro that calls hal_lock(),
  which lives in subr_hal.o.)

- Add macros for ntoskrnl_raise_irql() and ntoskrnl_lower_irql() that
  call hal_raise_irql() and hal_lower_irql().

- Use these macros in kern_ndis.c, subr_ndis.c and subr_ntoskrnl.c.

- Along the way, I realised subr_ndis.c:ndis_lock() was not calling
  hal_lock() correctly (it was using the FASTCALL2() wrapper when
  in reality this routine is FASTCALL1()). Using the
  ntoskrnl_acquire_spinlock() fixes this. Not sure if this actually
  caused any bugs since hal_lock() would have just ignored what
  was in %edx, but it was still bogus.

This hides many of the uses of the FASTCALLx() macros which makes the
code a little cleaner. Should not have any effect on generated object
code, other than the one fix in ndis_lock().
2004-08-04 18:22:50 +00:00
Robert Watson
1b93405c7c Remove spl's from kern_resource.c. 2004-08-04 18:19:09 +00:00
Robert Watson
e3a64610bf Annotate locking strategy for 'struct uidinfo'. 2004-08-04 18:14:19 +00:00
Alan Cox
1b3b9cfe1d Post-locking clean up/simplification, particularly, the elimination of
vm_page_sleep_if_busy() and the page table page's busy flag as a
synchronization mechanism on page table pages.

Also, relocate the inline pmap_unwire_pte_hold() so that it can be used
to shorten _pmap_unwire_pte_hold() on alpha and amd64.  This places
pmap_unwire_pte_hold() next to a comment that more accurately describes
it than _pmap_unwire_pte_hold().
2004-08-04 18:04:44 +00:00
Justin T. Gibbs
789902c3ae Correct a very rare case where command ordering could be compromised
by a transaction performing a driver handled message sequence (an
scb with the MK_MESSAGE flag set).

SCBs that perform host managed messaging must always be
at the head of their per-target selection queue so that
the firmware knows to manually assert ATN if the current
negotiation agreement is packetized.  In the past we
guaranteed this by queuing these SCBs separarately in
the execution queue.  This exposes the system to potential
command reordering in two cases:

1) Another SCB for the same ITL nexus is queued that does
   not have the MK_MESSAGE flag set.  This SCB will be
   queued to the per-target list which can be serviced
   before the MK_MESSAGE scb that preceeded it.

2) If the target cannot accept all of the commands in the
   per-target selection queue in one selection, the remainder
   is queued to the tail of the selection queues so as to
   effect round-robin scheduling.  This could allow the
   MK_MESSAGE scb to be sent to the target before the
   requeued commands.

This commit changes the firmware policy to defer queuing
MK_MESSAGE SCBs into the selection queues until this can
be done without affecting order.  This means that the
target's selection queue is either empty, or the last
SCB on the execution queue is also a MK_MESSAGE SCB.
During any wait, the firmware halts the download of new
SCBs so only a single "holding location" is required.

Luckily, MK_MESSAGE SCBs are rare and typically occur only
during CAM's bus probe where only one command is outstanding
at a time.  However, during some recovery scenarios, the
reordering *could* occur.

aic79xx.c:
	Update ahd_search_qinfifo() and helper routines to
	search for pending MK_MESSAGE scbs and properly
	restitch the execution queue if either the MK_MESSAGE
	SCB is being aborted, or the MK_MESSAGE SCB can be
	queued due to the execution queue draining due to
	aborts.

	Enable LQOBUSFREE status to assert an interrupt.
	This should be redundant since a BUSFREE interrupt
	should always occur along with an LQOBUSFREE event,
	but on the Rev A, this doesn't seem to be guaranteed.

	When a PPR request is rejected when a previously
	existing packetized agreement is in place, assume
	that the target has been reset without our knowledge
	and revert to async/narrow transfers.  This corrects
	two issues: the stale ENATNO setting that was used
	to send the PPR is cleared so the firmware is not
	confused by a future packetized selection with
	ATN asserted but no MK_MESSAGE flag in the SCB and
	it speeds up recovery by aborting any pending
	packetized transactions that by definition are now
	dead.

	When re-queueing SCBs after a failed negotiation
	attempt, ensure command ordering by freezing the
	device queue first.

	Traverse the list of pending SCBs rather than the
	whole SCB array on the controller when pushing
	MK_MESSAGE flag changes out to the controller.
	The original code was optimized for the aic7xxx
	controllers where there are fewer controller slots
	then pending SCBs and the firmware picks SCB
	slots.  For the U320 controller, the hope is
	that we have fewer pending SCBs then the 512
	slots on the controller.

	Enhance some diagnostics.

	Factor out some common code.

aic79xx.h:
	Add prototype for new ahd_done_with_status() that is
	used to factor out some commone code.

aic79xx.reg:
	Add definisions for the pending MK_MESSAGE SCB.

aic79xx.seq:
	Defer MK_MESSAGE SCB queing to the execution queue
	so as to preserve command ordering.  Re-arrange some
	of the selection processing code so the above change
	had no performance impact on the common code path.

	Close a few critical section holes.

	When entering a non-packetized phase, manually enable
	busfree interrupts, since the controller hardware
	does not do this automatically.

aic79xx_inline.h:
	Enhance logging for queued SCBs.

aic79xx_osm.c:
	Add new a new DDB ahd command, ahd_dump, which
	invokes the ahd_dump_card_state() routine on the
	unit specified with the ahd_sunit DDB command.

aic79xx_pci.c:
	Turn on the BUSFREEREV bug for the Rev B. controller.
	This is required to close the busfree during non-packetized
	phase hole.
2004-08-04 17:55:34 +00:00
Joe Marcus Clarke
5c7e7e80cc Fix Skinny and PPTP NAT'ing after the introduction of the {ip,tcp,udp}_next
functions.  Basically, the ip_next() function was used to get the PPTP and
Skinny headers when tcp_next() should have been used instead.  Symptoms of
this included a segfault in natd when trying to process a PPTP or Skinny
packet.

Approved by:	des
2004-08-04 15:17:08 +00:00
Philip Paeps
09003ac33f Unbreak LINT by making sure that method is always defined.
Submitted by:	roam
Pointy hat to:	philip
2004-08-04 14:29:22 +00:00
Hidetoshi Shimokawa
433dd56b71 Fix and add deivce ID's.
Obtained from: DragonFly BSD
2004-08-04 12:18:39 +00:00
Pawel Jakub Dawidek
fe7c3780c8 - Add "prefer" balance algorithm. When used, only disk with the biggest
priority will be used for reading.
- Bump version number.
2004-08-04 12:09:53 +00:00
Pawel Jakub Dawidek
e1efe7edcd MFp4: We don't really need g_mirror_free_disk() function. 2004-08-04 10:02:06 +00:00
Doug Rabson
c413d99c4e In dev_pager_updatefake, m->valid is typically 0 on entry. It
should be set to VM_PAGE_BITS_ALL before returning, to ensure that
neither vm_pager_get_pages nor vm_fault calls vm_page_zero_invalid
after dev_pager_getpages has returned.

Submitted by: tegge
2004-08-04 08:58:58 +00:00
Garance A Drosehn
b11ef345eb Fix problems with the OFW console which happen when the system goes
into single-user mode (as seen on sparc64 and PPC).  Problems were due
to a minor oversight in the changes committed in revision 1.25.

Submitted by:	grehan
Tested by:	gad & yongari
2004-08-04 00:21:19 +00:00
Philip Paeps
f5296c9302 Further cleanup: merge the three led toggling functions
into a single general function to handle all leds.

Approved by:	njl
2004-08-03 22:37:09 +00:00
Nate Lawson
fdae98ecd6 Bump WARNS to 2 for all other ACPI drivers and minor cleanup. 2004-08-03 21:27:43 +00:00
Nate Lawson
8390cfe8a6 Use the acpi_{Get,Set}Integer functions instead of rolling custom ones.
Clean up return path of each function to have a single exit point.  This
reduces diffs against the MPSAFE tree.
2004-08-03 21:17:36 +00:00
Mark Murray
d23a262fc5 Making a loadable null.ko for /dev/(null|zero) proved rather
unpopular, so remove this (mis)feature.

Encouragement provided by:	jhb (and others)
2004-08-03 19:24:54 +00:00
Maxime Henrion
9f1b87f106 Instead of calling ia32_pause() conditionally on __i386__ or __amd64__
being defined, define and use a new MD macro, cpu_spinwait().  It only
expands to something on i386 and amd64, so the compiled code should be
identical.

Name of the macro found by:	jhb
Reviewed by:	jhb
2004-08-03 18:44:27 +00:00
Nate Lawson
02a680b8f5 Fix the ACPI_DEBUG case by removing a now unused variable. 2004-08-03 17:16:30 +00:00
Bill Paul
64823e73c5 Minor cleanups:
- Fix typo in comment
- Remember to free() sc->ndis_txarray on detach
- Remember to do an ifmedia_removeall() for ethernet devices
2004-08-03 17:00:39 +00:00
Pawel Jakub Dawidek
7d01f1820a Fix comment. 2004-08-03 15:41:33 +00:00
Pawel Jakub Dawidek
24b2151f4d Don't skip permission checks when sending signals to zombie processes.
Pointed out by:	bde
Reviewed by:	rwatson
2004-08-03 15:39:23 +00:00
David E. O'Brien
a2e358988f Initialize variables to fix kernel build on AMD64. 2004-08-03 14:14:53 +00:00
Andre Oppermann
81007fd4eb o Delayed checksums are now calculated in divert_packet() for diverted packets
Remove the XXX-escaped code that did it in ip_output()'s IPHACK section.
2004-08-03 14:13:36 +00:00
Andre Oppermann
24a098ea9b o Move the inflight sysctls to their own sub-tree under net.inet.tcp to be
more consistent with the other sysctls around it.
2004-08-03 13:54:11 +00:00
Andre Oppermann
f0cada84b1 o Move all parts of the IP reassembly process into the function ip_reass() to
make it fully self-contained.
o ip_reass() now returns a new mbuf with the reassembled packet and ip->ip_len
  including the IP header.
o Computation of the delayed checksum is moved into divert_packet().

Reviewed by:	silby
2004-08-03 12:31:38 +00:00
Doug Rabson
595a88c6af Add style(9) foolishness. 2004-08-03 08:21:48 +00:00
Bjoern A. Zeeb
4807330cff Implement minimalistic L2TP sessions statistics and correct man page
for L2TP tunnel statistics (which do not take an argument sessionID).

Reviewed by:	archie
Approved by:	pjd (mentor)
2004-08-03 06:52:55 +00:00
Nate Lawson
2c8509577d Use the slot, not an otherwise unused index variable as the probe offset.
This passed testing because the variable happened to be 0 in most cases.

Compile warning found by: David Syphers <dsyphers AT u.washington.edu>
2004-08-03 06:48:36 +00:00
Bjoern A. Zeeb
1e0313242d add a new control message to set sequence numbers on an uninitialized node.
Reviewed by:	archie
Approved by:	pjd (mentor)
2004-08-03 06:45:38 +00:00
Bjoern A. Zeeb
ddb7229415 Correct L2TP header offset handling:
- according to RFC2661 an offset size of 0 is allowed.
- when skipping offset padding do not forget to also skip
  the 2 octets of the offset size field.

Reviewed by:	archie
Approved by:	pjd (mentor)
2004-08-03 06:37:46 +00:00
Bjoern A. Zeeb
49728ffc2f Do not change link[n].conf.latency for internal usage but have
link[n].latency calculated from user supplied value.
This prevents repeated NGM_PPP_SET_CONFIG/NGM_PPP_GET_CONFIG
from failing because of link[n].conf.latency being out of range.

Reviewed by:	archie
Approved by:	pjd (mentor)
2004-08-03 06:34:55 +00:00
Nate Lawson
bee4aa4ae5 /tmp/m 2004-08-03 05:13:56 +00:00
Peter Grehan
e796443d47 Remove race condition between reading of MSR, setting md_savecrit,
and setting MSR. This was most evident with the idle proc running
with interrupts disabled and causing a lockup. Switch over to the
i386 style which does things in the right order.

debug assisted by:  gallatin, and the invaluable KTR option.
2004-08-03 04:14:55 +00:00
Mike Silbersack
e10ecdea88 Standardize pipe locking, ensuring that everything is locked via
pipelock(), not via a mixture of mutexes and pipelock().  Additionally,
add a few KASSERTS, and change some statements that should have been
KASSERTS into KASSERTS.

As a result of these cleanups, some segments of code have become
significantly shorter and/or easier to read.
2004-08-03 02:59:15 +00:00
David Xu
7926672ea5 Remove redundant definition. 2004-08-03 02:39:24 +00:00
David Xu
4513fb36aa s/TMDF_DONOTRUNUSER/TMDF_SUSPEND/g
Dicussed with: deischen
2004-08-03 02:23:06 +00:00
Jeffrey Hsu
2ff39e1543 Fix bug with tracking the previous element in a list.
Found by:	edrt@citiz.net
Submitted by:	pavlin@icir.org
2004-08-03 02:01:44 +00:00
Julian Elischer
4fd54632b0 Repeat after me:
"Do not apply your tested patches to your commit tree by hand"
2004-08-03 01:43:29 +00:00
Nate Lawson
37e783a63e Change EISA probing to be less invasive. Instead of probing all slots
unconditionally, stop after the first one (system board) if no EISA hardware
is detected.  This fixes a boot hang (i.e. Thinkpad) when ACPI is disabled.
Also, split the probe code into a separate function and do some style cleanup.

Note that the Adaptec 2842 VLB controller probe is broken by this change
and will fail to probe.  It should be fixed separately.
2004-08-03 00:41:47 +00:00
Julian Elischer
c94b38af46 Remove an argument that is never used. 2004-08-02 23:48:43 +00:00
Marius Strobl
72aca14cfb - Set the CAM status to CAM_SCSI_STATUS_ERROR rather than CAM_REQ_CMP
in case of a CHECK CONDITION.
- Make this driver return SCSI status information.
- While here, factor out the clearing of the CAM status from every
  element of the switch statement to only once before the switch.

This fixes burning CDs with recent cdrecord 2.01 alpha versions and
burners attached to asr(4) controllers but there could have been
other applications and da(4) etc. also affected.

Reviewed by:	gibbs, scottl
MFC after:	2 weeks
2004-08-02 23:32:23 +00:00
Tom Rhodes
8be373eedd Add some style(9) touch ups; style(9) states that new code should follow
these conventions and, well, this is a new driver.

Tested on:	i386, sparc64
Reviewed by:	scottl
2004-08-02 22:55:23 +00:00
David E. O'Brien
64298d52cc Put a cap on the auto-tuning of kern.maxvnodes.
Cap value chosen by:	scottl
2004-08-02 21:52:43 +00:00
Ian Dowse
bff05e31bb Reinstate a usb_transfer_complete() call that got lost in the
previous revision.
2004-08-02 20:53:31 +00:00
Mark Murray
ce46e2059e Add module versions. 2004-08-02 20:42:28 +00:00
Mark Murray
ae17d056a1 Diff reduction WRT i386 version. 2004-08-02 20:36:47 +00:00
Mark Murray
47eb78a768 Sort includes; minor whitespace. 2004-08-02 20:32:56 +00:00
Mark Murray
4ec450cefd Go back to the historical minor numbers. Add a module version while
I'm here.

Asked for minor numbers by:	jhb
2004-08-02 19:59:41 +00:00
David E. O'Brien
9004f894b7 Really back out rev 1.388. 2004-08-02 19:21:51 +00:00
Doug Rabson
4d84a58d1d Add definitions for TLS relocations. 2004-08-02 19:12:17 +00:00
Marcel Moolenaar
4f72649f48 Remove GPT_ENT_TYPE_FREEBSD_UFS2. It was speculatively added before
UFS2 was here. It so happened that UFS2 did not need a seperate
partition type. Keep the definition as a comment for documentation
purposes. If there is a benefit for UFS2 file systems to have a
seperate partition type under GPT, then this definition should be
restored as that was the intention of the definition.
2004-08-02 18:46:52 +00:00
Marcel Moolenaar
78b9765bee Fix 2 typos in previous commit: both s/strct/struct/ 2004-08-02 18:37:55 +00:00
David E. O'Brien
c658f76300 Don't build and install a mem.ko module.
Currently one cannot load the mem.ko module without panicing if mem is
compiled into the kernel and one cannot build a kernel w/o "device mem"
right now either.  Thus it is too dangerous to install mem.ko right now
because if one puts 'mem_load="YES"' in /etc/loader.conf they cannot
boot an "old" kernel (at the time that a kernel doesn't have to be built
with "device mem).
2004-08-02 18:14:06 +00:00
Marcel Moolenaar
cb1d0dd340 Add the mem and null devices now that they are optional. 2004-08-02 17:53:06 +00:00
Marcel Moolenaar
6d28b03026 Sort the miscellaneous devices to restore ordering after the insertion
of the mem and null devices.
2004-08-02 17:50:39 +00:00
Ian Dowse
f50033ff2e Make the USB subsystem unloadable and detachable, though currently
a significant amount of memory may be leaked each time a host
controller is detached.
2004-08-02 15:37:35 +00:00
Scott Long
5ba0615c03 Optimize intr_execute_handlers() by combining the pic_disable_source() and
pic_eoi_source() into one call.  This halves the number of spinlock operations
and indirect function calls in the normal case of handling a normal (ithread)
interrupt.  Optimize the atpic and ioapic drivers to use inlines where
appropriate in supporting the intr_execute_handlers() change.

This knocks 900ns, or roughly 1350 cycles, off of the time spent servicing an
interrupt in the common case on my 1.5GHz P4 uniprocessor system.  SMP systems
likely won't see as much of a gain due to the ioapic being more efficient than
the atpic.  I'll investigate porting this to amd64 soon.

Reviewed by:	jhb
2004-08-02 15:31:10 +00:00
Ian Dowse
67dab3d6c9 When searching for a suitable block of memory on the free list,
skip blocks that are too big by a factor of two or greater. This
avoids some cases of extremely inefficient memory use that can occur
when large (e.g. 64k) blocks on the free list get used when allocating
a 4k chunk of 64-byte fragments. Because fragments have their own
free list, the 60k difference got lost forever every time.
2004-08-02 13:59:02 +00:00
Ian Dowse
da37d6ad41 Attempt to follow the correct procedure for synchronising with the
system BIOS to disable legacy device emulation as per the "EHCI
Extended Capability: Pre-OS to OS Handoff Synchronisation" section
of the EHCI spec. BIOSes that implement legacy emulation using SMIs
are supposed to disable the emulation when this procedure is performed.
2004-08-02 12:56:01 +00:00
Olivier Houchard
9b60f79d2a *blush*
Fix htonl and htons.
2004-08-02 12:24:18 +00:00
Olivier Houchard
5b17d1f95a Fix comments.
Spotted out by:	mux
2004-08-02 12:23:53 +00:00
Suleiman Souhlal
09e7619917 Remove 'device mem' from GENERIC, which markm@ mistakingly added.
We don't have mem/kmem yet.

Approved by:	grehan (mentor)
2004-08-02 11:08:48 +00:00
Max Laier
e3dbc2ddcd Unbreak DEVICE_POLLING build / LINT. Sorry!
Submitted by:	roam
2004-08-02 10:08:28 +00:00
Alan Cox
21c125453c Eliminate the acquisition and release of Giant around the call to
pmap_mincore() in mincore(2).  Either pmap locking exists (alpha, amd64,
i386, ia64) or pmap_mincore() is unimplemented (arm, powerpc, sparc64).
2004-08-02 03:31:05 +00:00
Peter Grehan
1f302e5357 Add PowerPC bridge instruction flag to the assembler to help out
with test code written in the loader.
2004-08-02 03:06:21 +00:00
Peter Grehan
d4a57a3131 G5 support: handle the case where the OpenFirmware memory array uses
64 bits for the phys address, but only 32 for the virtual address.
2004-08-02 03:05:09 +00:00
Peter Grehan
016927054b Kernel traps were not being passed to trap_fatal in some
circumstances.

Spotted by:  gallatin
2004-08-02 02:37:29 +00:00
Scott Long
76c31ef98f Document machdep.enable_panic_key.
Submitted by: Craig Rodrigues
2004-08-02 02:07:56 +00:00
David E. O'Brien
b4adaf5679 Fix the build by providing 'PHYS_TO_DMAP' and 'M_MEMDESC'. 2004-08-02 02:07:20 +00:00
Brian Feldman
f0a4dd3152 Bump __FreeBSD_version to designate uma_zone functions changing type. 2004-08-02 01:49:22 +00:00
Robert Watson
3d3f5f6057 Add what appears to be a missing '*/' at the end of a comment. 2004-08-02 01:38:27 +00:00
Pawel Jakub Dawidek
969ff54d70 - Fix unloading by the same way it is done in my other classes:
set gp->softc to NULL and return ENXIO when it is NULL, so GEOM
  will not panic or hang, but unload one device on every 'unload'.
  This make 'unload' command usable, but it have to be executed
  <number of devices> + 1 times.
- Made use of 'pp' variable.
2004-08-02 00:37:40 +00:00
Brian Feldman
b23f72e98a * Add a "how" argument to uma_zone constructors and initialization functions
so that they know whether the allocation is supposed to be able to sleep
  or not.
* Allow uma_zone constructors and initialation functions to return either
  success or error.  Almost all of the ones in the tree currently return
  success unconditionally, but mbuf is a notable exception: the packet
  zone constructor wants to be able to fail if it cannot suballocate an
  mbuf cluster, and the mbuf allocators want to be able to fail in general
  in a MAC kernel if the MAC mbuf initializer fails.  This fixes the
  panics people are seeing when they run out of memory for mbuf clusters.
* Allow debug.nosleepwithlocks on WITNESS to be disabled, without changing
  the default.

Both bmilekic and jeff have reviewed the changes made to make failable
zone allocations work.
2004-08-02 00:18:36 +00:00
Max Laier
154b8df2ed Second part of ALTQ driver modifications, covering:
an(4), ath(4), hme(4), ndis(4), vr(4) and wi(4)

Please help testing: http://people.freebsd.org/~mlaier/ALTQ_driver/

Tested by:	Vaidas Damosevicius (an, ath, wi)
		Roman Divacky (vr)
Submitted by:	yongari (hme)
2004-08-01 23:58:04 +00:00
Julian Elischer
6e0fbb01c5 Comment kse_create() and make a few minor code cleanups
Reviewed by:	davidxu
2004-08-01 23:02:00 +00:00
Bill Paul
8ea534a9c0 The watchdog callout executes with the (non-sleepable) ifnet lock held
now, but it's possible for ndis_reset_nic() to sleep (sometimes the
MiniportReset() method returns NDIS_STATUS_PENDING and we have
to wait for completion). To get around this, execute the ndis_reset_nic()
routine in the NDIS_TASKQUEUE thread.
2004-08-01 22:25:12 +00:00
Bill Paul
20b03f4992 In ndis_alloc_bufpool() and ndis_alloc_packetpool(), the test to see if
allocating pool memory succeeded was checking the wrong pointer (should
have been looking at *pool, not pool). Corrected this.
2004-08-01 21:15:29 +00:00
Pawel Jakub Dawidek
6b1c71eef8 Typo. 2004-08-01 20:41:58 +00:00
Gleb Smirnoff
c0451ac3d9 Another stupid error from my side. PPPOE_NONSTANDARD was first defined
in enum {}, and then redefined with #define.
No warnings from compiler, though.

Submitted by:	bz
Pointy hat to:	glebius
2004-08-01 20:39:33 +00:00
Bill Paul
f13b900a9e Big mess 'o changes:
- Give ndiscvt(8) the ability to process a .SYS file directly into
  a .o file so that we don't have to emit big messy char arrays into
  the ndis_driver_data.h file. This behavior is currently optional, but
  may become the default some day.

- Give ndiscvt(8) the ability to turn arbitrary files into .ko files
  so that they can be pre-loaded or kldloaded. (Both this and the
  previous change involve using objcopy(1)).

- Give NdisOpenFile() the ability to 'read' files out of kernel memory
  that have been kldloaded or pre-loaded, and disallow the use of
  the normal vn_open() file opening method during bootstrap (when no
  filesystems have been mounted yet). Some people have reported that
  kldloading if_ndis.ko works fine when the system is running multiuser
  but causes a panic when the modile is pre-loaded by /boot/loader. This
  happens with drivers that need to use NdisOpenFile() to access
  external files (i.e. firmware images). NdisOpenFile() won't work
  during kernel bootstrapping because no filesystems have been mounted.
  To get around this, you can now do the following:

        o Say you have a firmware file called firmware.img
        o Do: ndiscvt -f firmware.img -- this creates firmware.img.ko
        o Put the firmware.img.ko in /boot/kernel
        o add firmware.img_load="YES" in /boot/loader.conf
        o add if_ndis_load="YES" and ndis_load="YES" as well

  Now the loader will suck the additional file into memory as a .ko. The
  phony .ko has two symbols in it: filename_start and filename_end, which
  are generated by objcopy(1). ndis_open_file() will traverse each module
  in the module list looking for these symbols and, if it finds them, it'll
  use them to generate the file mapping address and length values that
  the caller of NdisOpenFile() wants.

  As a bonus, this will even work if the file has been statically linked
  into the kernel itself, since the "kernel" module is searched too.
  (ndiscvt(8) will generate both filename.o and filename.ko for you).

- Modify the mechanism used to provide make-pretend FASTCALL support.
  Rather than using inline assembly to yank the first two arguments
  out of %ecx and %edx, we now use the __regparm__(3) attribute (and
  the __stdcall__ attribute) and use some macro magic to re-order
  the arguments and provide dummy arguments as needed so that the
  arguments passed in registers end up in the right place. Change
  taken from DragonflyBSD version of the NDISulator.
2004-08-01 20:04:31 +00:00
Mark Murray
b6527a3667 Add the I/O device for those architectures that have it. 2004-08-01 19:37:34 +00:00
Mark Murray
a5ed4a0ad5 Remove extraneous ';'. 2004-08-01 18:51:44 +00:00
Ian Dowse
2dacb7cc04 Implement basic support for EHCI interrupt pipes. This is unlikely
to be particularly correct or optimal, but it seems to be enough
to allow the attachment of USB2 hubs and USB2 devices connected via
USB2 hubs. None of the split transaction support is implemented in
our USB stack, so USB1 peripherals will definitely not work when
connected via USB2 hubs.
2004-08-01 18:47:42 +00:00
Mark Murray
228a86bf7d YA oops. Remove code that was being tested locally. 2004-08-01 18:22:44 +00:00
Mark Murray
e54788c73d Remove local hack that was not supposed to be committed.
Spotted by:	Antoine Brodin - antoine dot brodin at laposte dot net
2004-08-01 18:12:25 +00:00
Scott Long
9352fe30a0 Turn off PREEMPTION by default while it gets debugged. It's been causing
4 weeks of problems including deadlocks and instant panics.  Note that the
real bugs are likely in the scheduler.
2004-08-01 14:31:45 +00:00
Yoshihiro Takahashi
dc50f89c91 MFi386: revision 1.1167 2004-08-01 13:01:36 +00:00
Yoshihiro Takahashi
42e11e4098 MFi386: revision 1.501. 2004-08-01 13:00:04 +00:00
Søren Schmidt
601d3a344e Change the default to switch on DMA on ATAPI devices if they can
do UDMA2 (ATA33) mode and beyond.
2004-08-01 12:31:38 +00:00
Mark Murray
8ab2f5ecc5 Break out the MI part of the /dev/[k]mem and /dev/io drivers into
their own directory and module, leaving the MD parts in the MD
area (the MD parts _are_ part of the modules). /dev/mem and /dev/io
are now loadable modules, thus taking us one step further towards
a kernel created entirely out of modules. Of course, there is nothing
preventing the kernel from having these statically compiled.
2004-08-01 11:40:54 +00:00
Pawel Jakub Dawidek
4084e6aad2 - Launch main provider when there are no more disks in NEW state.
- Log syncid bump at debug level 1.
2004-08-01 09:01:50 +00:00
Bill Paul
dde913e3ca Add some minor changes related to PCMCIA attribute memory mapping
(which I apparently forgot to commit earlier).

Acquire NDIS_LOCK() in ndis_linksts_done().
2004-08-01 06:42:44 +00:00
Julian Elischer
cd78d8bd02 Specify the locking for some proc fields 2004-07-31 23:51:04 +00:00
Pawel Jakub Dawidek
959521ff1f If there are no valid components after the timeout, just destroy device.
There is probably nothing to wait for.
2004-07-31 22:10:51 +00:00
Lukas Ertl
4b017d0d93 Propagate size changes upwards. 2004-07-31 21:34:21 +00:00
Gleb Smirnoff
6c97c0e45e Fix a stupid error in my previous commit, which broke operation
of many nodes.

Pointy hat to:	glebius
2004-07-31 21:32:55 +00:00
Pawel Jakub Dawidek
4b2e596e38 Handle spoil event in dedicated function: g_mirror_spoiled().
The different between the new function and g_mirror_orphan() (which was
used previously) is that syncid is bumped immediately, instead of on
first write, because when consumer was spoiled, it means, that its
provider was opened for writing, so we can't trust that its data
will be valid when it will be connected again.
2004-07-31 21:08:17 +00:00
Max Khon
8fc406a664 Add copyright notices.
Prodded by:	imp
2004-07-31 20:47:57 +00:00
David Xu
e3086a21e8 Turn on PCB_FULLCTX for set_mcontext, functions like kse_switchin
needs to fully restore asynchronous context which did not come
from fast syscall.
2004-07-31 14:02:29 +00:00
Pawel Jakub Dawidek
484405eb8d Remove unused field. 2004-07-31 13:03:38 +00:00
Pawel Jakub Dawidek
2d53f42307 Destroy synchronization geom immediately. This should fix unloading without
stopping all mirrors.
2004-07-31 11:22:03 +00:00
Søren Schmidt
eaf8d2de9e Fix the panic (""memory modified after free") when ata_getparam() fails
and retries.

Found by:	Nate Lawson
2004-07-31 10:29:29 +00:00
Alan Cox
c6bf9f0455 Add pmap locking to pmap_object_init_pt(). 2004-07-31 06:42:05 +00:00
Alan Cox
73be74169a Bump __FreeBSD_version to reflect the removal of kmem_alloc_pageable().
Requested by: pjd@
2004-07-31 03:44:46 +00:00
Pawel Jakub Dawidek
c9d3021a92 Allow slice creation on providers from MIRROR class.
This should allow mounting root file system from a mirror.
2004-07-31 01:17:20 +00:00
Pawel Jakub Dawidek
55d6eb9fef Add '-p' option for 'insert' command which allows to specify priority
of the new component.
Version number wasn't bumped (it should be), because I think there are
no geom_mirror users yet.
2004-07-31 00:54:44 +00:00
Pawel Jakub Dawidek
ff9160f5f3 - Check if 'slice' argument was given.
- Check if disk isn't already the mirror component.
2004-07-31 00:51:33 +00:00
Pawel Jakub Dawidek
f251dfbf5d Dump correct field. 2004-07-31 00:37:14 +00:00