Commit Graph

50136 Commits

Author SHA1 Message Date
Robert Watson
a4bde6f695 Rebuild from FreeBSD32 syscalls.master:1.42. 2004-10-23 20:05:42 +00:00
Robert Watson
8e36528346 32-bit FreeBSD ABI compatibility stubs from syscalls.master:1.178. 2004-10-23 20:04:56 +00:00
Robert Watson
299b4e7fa6 Rebuild from syscalls.master:1.178. 2004-10-23 20:01:32 +00:00
Robert Watson
3e8c244949 Add system call place-holders for the following system calls
implementing Sun's BSM Audit API on FreeBSD:

  audit()
  auditon()
  getauid()
  setauid()
  getaudit()
  setaudit()
  getaudit_addr()
  setaudit_addr()
  auditctl()

Submitted by:	Wayne Salamon <wsalamon at computer dot org>
Obtained from:	TrustedBSD Project
2004-10-23 20:00:43 +00:00
Andre Oppermann
3a82a5451c socreate() does an early abort if either the protocol cannot be found,
or pru_attach is NULL.  With loadable protocols the SPACER dummy protocols
have valid function pointers for all methods to functions returning just
EOPNOTSUPP.  Thus the early abort check would not detect immediately that
attach is not supported for this protocol.  Instead it would correctly
get the EOPNOTSUPP error later on when it calls the protocol specific
attach function.

Add testing against the pru_attach_notsupp() function pointer to the
early abort check as well.
2004-10-23 19:06:43 +00:00
Andre Oppermann
480fa3f985 Aquire GIANT in pf_proto_[un]register() before manipulating the protosw. 2004-10-23 18:52:06 +00:00
Robert Watson
6c5ecfd7f2 /%x/%s/ -- mismerged DEBUGGER() printf() format stirng from the
TrustedBSD branch.

Submitted by:	bde
2004-10-23 15:12:34 +00:00
Poul-Henning Kamp
1ec1f41575 use bioq_takefirst() 2004-10-23 12:45:39 +00:00
Poul-Henning Kamp
32204b9721 Use bioq_takefirst() 2004-10-23 12:44:19 +00:00
David Xu
c283653201 Remove P_STOPPED_TRACE bit if debugger dies without a chance to
detach debugged process.
2004-10-23 11:20:26 +00:00
Robert Watson
16aebf571f Add some basic KTR tracing to busdma on i386. This is likely not
the final set of traces -- someone with more busdma background
will probably want to review and expand this, as well as port to
other platforms.  This tracing is sufficient to identify key
busdma events on i386, and in particular to draw attention to
bounce buffering events that may have a substantial performance
impact.
2004-10-23 10:34:27 +00:00
Mike Makonnen
f16b4811d2 Locking cleanups to remove the need for a recursive mutex
o Instead of locking and unlocking all over the place, use
	  lock assertions to make certain that the bfe lock is held
	  where necessary.
	o Create locked and unlocked versions of bfe_init and bfe_start. These
	  functions can be called from outside the module and by functions
	  within the bfe module. The calls from outside the module don't
	  hold the bfe lock so the unlocked versions called by these functions
	  simple obtain the bfe lock and call the locked version.

- Fix a typo (scp) in the locking macros that only worked because in all the
  instances in which it was called the softc pointer happened to be named 'sc'.

- Mark the interrupt MPSAFE

Tested by: matusita, Dario Freni <saturnero@gufi.org>
Silence from: -net, wpaul
2004-10-23 08:33:10 +00:00
Andrew R. Reiter
f96c8ef18a - Turn KASSERT()s into warning printf()'s in the g_class_load() routine.
This removes a panic that will occur if you build with GENERIC and
  attempt to kldload a GEOM module that is already in the kernel.

Reviewed by: phk
2004-10-22 22:16:24 +00:00
Andre Oppermann
cd109b0d82 Shave 40 unused bytes from struct tcpcb. 2004-10-22 19:55:04 +00:00
Andre Oppermann
21dcc96f4a When printing the initialization string and IPDIVERT is not compiled into the
kernel refer to it as "loadable" instead of "disabled".
2004-10-22 19:18:06 +00:00
Andre Oppermann
24fc79b0a4 Refuse to unload the ipdivert module unless the 'force' flag is given to kldunload.
Reflect the fact that IPDIVERT is a loadable module in the divert(4) and ipfw(8)
man pages.
2004-10-22 19:12:01 +00:00
Poul-Henning Kamp
1ef0fd8224 Properly handle failure to allocate isadma bounce buffer 2004-10-22 19:01:10 +00:00
Nate Lawson
cc62efa527 Remove a "needs Giant" flag from the /dev/apm compat device.
MFC after:	2 weeks
2004-10-22 17:17:12 +00:00
Hidetoshi Shimokawa
fcbe55a58d Respect _BOOT flag. 2004-10-22 15:39:39 +00:00
Hidetoshi Shimokawa
8ffa2e7954 Check _BOOT flag. 2004-10-22 15:03:22 +00:00
Hidetoshi Shimokawa
6ee737aae3 Respect RB_MULTIPLE flag. 2004-10-22 14:57:28 +00:00
Hidetoshi Shimokawa
167938e1e7 - Add FireWire subclass and OHCI interface.
- Add some PCI BIOS function calls.
	(find_devclass, read_config, write_config)
2004-10-22 14:56:23 +00:00
Robert Watson
857a600580 Add an annotation to the comment for sysv_ipc.c to indicate that the
MAC Framework doesn't require checks in ipcperm() because checks
relating to System V IPC will be performed in individual IPC
implementations.
2004-10-22 12:12:40 +00:00
Robert Watson
397b3428eb In osethostname(), don't need to call suser() directly as
userland_sysctl() will perform all necessary privilege checks for
the caller.
2004-10-22 12:10:50 +00:00
Robert Watson
3459e1d2e9 Expand comments on various sections of the MAC Framework Policy API,
as well as document the properties of the mac_policy_conf structure.
Warn about the ABI risks in changing the structure without careful
consideration.

Obtained from:	TrustedBSD Project
Sponsored by:	SPAWAR
2004-10-22 11:29:30 +00:00
Robert Watson
b2e3811c5f Replace direct reference to kdb_enter() with a DEBUGGER() macro that
will call printf() if KDB isn't compiled into the kernel.

Obtained from:	TrustedBSD Project
Sponsored by:	SPAWAR
2004-10-22 11:24:50 +00:00
Robert Watson
46e23372a0 Minor white space synchronization and line wrapping. 2004-10-22 11:15:47 +00:00
Robert Watson
39cfa59162 In the MAC label zone destructor, assert that the label is only
destroyed in an initialized state.
2004-10-22 11:08:52 +00:00
Robert Watson
17eba37380 Remove extern declaration of mac_enforce_sysv, as it's not present in
the CVS version of the MAC Framework.
2004-10-22 11:07:18 +00:00
Robert Watson
b0e86f6ac2 When MAC is enabled, warn if getnewvnode() is asked to produce a vnode
without a mountpoint.  In this scenario, there's no useful source for
a label on the vnode, since we can't query the mountpoint for the
labeling strategy or default label.
2004-10-22 11:04:58 +00:00
Poul-Henning Kamp
ff7c5a4880 Alas, poor SPECFS! -- I knew him, Horatio; A filesystem of infinite
jest, of most excellent fancy: he hath taught me lessons a thousand
times; and now, how abhorred in my imagination it is! my gorge rises
at it.  Here were those hacks that I have curs'd I know not how
oft.  Where be your kludges now? your workarounds? your layering
violations, that were wont to set the table on a roar?

Move the skeleton of specfs into devfs where it now belongs and
bury the rest.
2004-10-22 09:59:37 +00:00
Poul-Henning Kamp
494eb176e7 Add b_bufobj to struct buf which eventually will eliminate the need for b_vp.
Initialize b_bufobj for all buffers.

Make incore() and gbincore() take a bufobj instead of a vnode.

Make inmem() local to vfs_bio.c

Change a lot of VI_[UN]LOCK(bp->b_vp) to BO_[UN]LOCK(bp->b_bufobj)
also VI_MTX() to BO_MTX(),

Make buf_vlist_add() take a bufobj instead of a vnode.

Eliminate other uses of bp->b_vp where bp->b_bufobj will do.

Various minor polishing: remove "register", turn panic into KASSERT,
use new function declarations, TAILQ_FOREACH_SAFE() etc.
2004-10-22 08:47:20 +00:00
Poul-Henning Kamp
c2ec6cc809 Use bioq_takefirst() 2004-10-22 08:12:49 +00:00
Scott Long
b1e56e58c5 Add support for the 21610SA 16-channel SATA card. Thanks to Adaptec for
providing hardware for testing.
2004-10-21 19:14:32 +00:00
Robert Watson
49dbb61dfc Add KTR_GEOM, which allows tracing of basic GEOM I/O events occuring
in the g_up and g_down threads.  Each time a bio is propelled up and
down the stack, an event is generating showing the provider, offset,
and length, as well as thread wakeup and work status information.
2004-10-21 18:35:24 +00:00
Poul-Henning Kamp
a76d8f4ec9 Move the VI_BWAIT flag into no bo_flag element of bufobj and call it BO_WWAIT
Add bufobj_wref(), bufobj_wdrop() and bufobj_wwait() to handle the write
count on a bufobj.  Bufobj_wdrop() replaces vwakeup().

Use these functions all relevant places except in ffs_softdep.c where
the use if interlocked_sleep() makes this impossible.

Rename b_vnbufs to b_bobufs now that we touch all the relevant files anyway.
2004-10-21 15:53:54 +00:00
Poul-Henning Kamp
1bca607b9f Add BO_* macros parallel to VI_* macros for manipulating the bo_mtx.
Initialize the bo_mtx when we allocate a vnode i getnewvnode() For
now we point to the vnodes interlock mutex, that retains the exact
same locking sematics.

Move v_numoutput from vnode to bufobj.  Add renaming macro to
postpone code sweep.
2004-10-21 14:42:31 +00:00
Poul-Henning Kamp
67647b2312 Polish vtruncbuf() to improve readability and style a bit. 2004-10-21 14:13:54 +00:00
Poul-Henning Kamp
e163395619 Simplify buf_vlist_remove().
Now that we have encapsulated the splaytree related information
into a structure we can eliminate the half of this function.
2004-10-21 13:48:50 +00:00
Poul-Henning Kamp
0bf874246b Add new function ttyinitmode() which sets our systemwide default
modes on a tty structure.  Both the ".init" and the current settings
are initialized allowing the function to be used both at attach and
open time.

The function takes an argument to decide if echoing should be enabled
by default.  Echoing should not be enabled for regular physical
serial ports unless they are consoles, in which case they should
be configured by ttyconsolemode() instead.

Use the new function throughout.
2004-10-21 12:24:38 +00:00
Olivier Houchard
99cf590376 We want to ignore BUS_DMASYNC_POSTWRITE, not BUS_DMASYNC_POSTREAD.
Spotted out by:	mux
Pointy hat to:	cognet
2004-10-21 11:59:33 +00:00
Robert Watson
bda3709718 Bump copyright dates for NETA on these files. 2004-10-21 11:29:56 +00:00
Robert Watson
2e74bca132 Modify mac_bsdextended policy so that it defines its own vnode access
right bits rather than piggy-backing on the V* rights defined in
vnode.h.  The mac_bsdextended bits are given the same values as the V*
bits to make the new kernel module binary compatible with the old
version of libugidfw that uses V* bits.  This avoids leaking kernel
API/ABI to user management tools, and in particular should remove the
need for libugidfw to include vnode.h.

Requested by:	phk
2004-10-21 11:19:02 +00:00
Stephan Uphoff
f742a1edcd Zero terminate empty sting in kdb_sysctl_available.
Approved by:    sam (mentor)
MFC after: 1 week
2004-10-21 01:11:25 +00:00
Alan Cox
0f777d7d9b Modify the vm object locking in do_sendfile() so that the containing object
is locked when vm_page_io_finish() is called on a page.  This is to satisfy
a new, post-RELENG_5 assertion in vm_page_io_finish().  (I am in the
process of transitioning the responsibility for synchronizing access to
various fields/flags on the page from the global page queues lock to the
per-object lock.)

Tripped over by: obrien@
2004-10-20 17:44:40 +00:00
John Baldwin
c05c4140e1 Fix a typo so that this compiles. 2004-10-20 16:22:53 +00:00
John Baldwin
9b94662d59 Fix a typo so that this compiles again. 2004-10-20 16:22:00 +00:00
Søren Schmidt
208a8dc227 Do not retry on requests that has lost thier device during reinit.
Should fix hangs on IBM's etc with the fake slave problem.

MFC:
	asap
2004-10-20 10:11:05 +00:00
Robert Watson
60c9762920 Explicitly break out NETA license from Berkeley license to clearly
indicate license grant, as well as to indicate that NETA is asserting
only two clauses, not four clauses.

Requested by:	imp
2004-10-20 08:05:02 +00:00
Warner Losh
54df531327 Rumor has it that ACCTON EN2216 is also an ne2000 compatible. Make it so. 2004-10-20 04:54:50 +00:00
Maxime Henrion
2534c4f99c Add missing bus_dmamap_sync() calls. If you are using an architecture
with a weak memory model or x86 + PAE (or more specifically, your
driver is using bounce pages) and you have had problems with em(4),
this may fix it.  At least this is needed to have em(4) work properly
on FreeBSD/arm.

Original version by:	cognet
Reviewed by:		tackerman
Tested by:		cognet
2004-10-19 23:31:44 +00:00
Andre Oppermann
57bbe2e1ab Destroy the UMA zone on unload. 2004-10-19 22:51:20 +00:00
Andre Oppermann
2de1a9eb6e Slightly extend the locking during unload to fully cover the protocol
deregistration.  This does not entirely close the race but narrows the
even previously extremely small chance of a race some more.
2004-10-19 22:08:13 +00:00
Robert Watson
279128e295 Annotate a newly introduced race present due to the unloading of
protocols: it is possible for sockets to be created and attached
to the divert protocol between the test for sockets present and
successful unload of the registration handler.  We will need to
explore more mature APIs for unregistering the protocol and then
draining consumers, or an atomic test-and-unregister mechanism.
2004-10-19 21:35:42 +00:00
Andre Oppermann
72584fd2c0 Convert IPDIVERT into a loadable module. This makes use of the dynamic loadability
of protocols.  The call to divert_packet() is done through a function pointer.  All
semantics of IPDIVERT remain intact.  If IPDIVERT is not loaded ipfw will refuse to
install divert rules and  natd will complain about 'protocol not supported'.  Once
it is loaded both will work and accept rules and open the divert socket.  The module
can only be unloaded if no divert sockets are open.  It does not close any divert
sockets when an unload is requested but will return EBUSY instead.
2004-10-19 21:14:57 +00:00
Andre Oppermann
969bb53e80 Properly declare the "net.inet" sysctl subtree. 2004-10-19 21:06:14 +00:00
Andre Oppermann
539be79a9d Pre-emptively define IPPROTO_SPACER to 32767, the same value as PROTO_SPACER
to document that this value is globally assigned for a special purpose and
may not be reused within the IPPROTO number space.
2004-10-19 20:59:01 +00:00
Justin T. Gibbs
a9c6886af6 aic7xxx.h:
Add constants for SPI protocol delays that are needed for
	target mode.

aic7xxx.c:
	Correct a target mode issue that caused an occassional
	spurious REQ to be seen on the bus when performing manual
	message processing (e.g. transfer rate negotiation).

	Enforce phase change bus settle rules with explicit
	delays when performing manual message processing in
	target mode.  The sequencer already did this for
	"fast-path", target mode message processing.
2004-10-19 20:48:06 +00:00
Søren Schmidt
61efd2a8b3 Idle the channel earlier in reinit().
Cosmetic change to suspend, dont call tsleep an extra time at exit.
2004-10-19 20:13:38 +00:00
Søren Schmidt
53f19be8fd Cosmetics 2004-10-19 20:11:23 +00:00
Bruce M Simpson
9a3b0b8cdf Really really fix typo this time. 2004-10-19 20:02:07 +00:00
Robert Watson
31302ebf9d Define IFF_LOCKGIANT() and IFF_UNLOCKGIANT() macros, which conditionally
acquire Giant if the passed interface has IFF_NEEDSGIANT set on it.
Modify calls into (ifp)->if_ioctl() in if.c to use these macros in order
to ensure that Giant is held.

MFC after:	3 days
Bumped into by:	jmg
2004-10-19 18:11:55 +00:00
Bruce M Simpson
80f7b487a1 Fix typo sc -> dev. 2004-10-19 16:47:53 +00:00
Andre Oppermann
dff3237ee5 Make use of the PROTO_SPACER functionality for dynamically loadable
protocols in inetsw[] and define initially eight spacer slots.

Remove conflicting declaration 'struct pr_usrreqs nousrreqs'.  It is
now declared and initialized in kern/uipc_domain.c.
2004-10-19 15:58:22 +00:00
Andre Oppermann
de38924dc0 Support for dynamically loadable and unloadable IP protocols in the ipmux.
With pr_proto_register() it has become possible to dynamically load protocols
within the PF_INET domain.  However the PF_INET domain has a second important
structure called ip_protox[] that is derived from the 'struct protosw inetsw[]'
and takes care of the de-multiplexing of the various protocols that ride on
top of IP packets.

The functions ipproto_[un]register() allow to dynamically adjust the ip_protox[]
array mux in a consistent and easy way.  To register a protocol within
ip_protox[] the existence of a corresponding and matching protocol definition
in inetsw[] is required.  The function does not allow to overwrite an already
registered protocol.  The unregister function simply replaces the mux slot with
the default index pointer to IPPROTO_RAW as it was previously.
2004-10-19 15:45:57 +00:00
Bruce M Simpson
33bab57d1e Detach the Rhine completely on shutdown, rather than merely stopping it
as the original logic did. This fixes a race with vr_intr() which was
masked on UP systems and manifested on SMP systems.

PR:		kern/62889
MFC after:	1 day
2004-10-19 15:30:47 +00:00
Andre Oppermann
312c75c362 Support for dynamically loadable and unloadable protocols within existing protocol
families.

The protosw[] array of any particular protocol family ("domain") is of fixed size
defined at compile time.  This made it impossible to dynamically add or remove any
protocols to or from it.  We work around this by introducing so called SPACER's
which are embedded into the protosw[] array at compile time.  The SPACER's have
a special protocol number (32767) to indicate the fact that they are SPACER's but
are otherwise NULL.  Only as many protocols can be dynamically loaded as SPACER's
are provided in the protosw[] structure.

The pr_usrreqs structure is treated more special and contains pointers to dummy
functions only returning EOPNOTSUPP.  This is needed because the use of those
functions pointers is usually not checked within the kernel because until now it
was assumed to be a valid function pointer.  Instead of fixing all potential
callers we just return a proper error code.

Two new functions provide a clean API to register and unregister a protocol.  The
register function expects a pointer to a valid and complete struct protosw including
a pointer to struct pru_usrreqs provided by the caller.  Upon successful registration
the pr_init() function will be called to finish initialization of the protocol.  The
unregister function restores the SPACER in place of the protocol again.  It is the
responseability of the caller to ensure proper closing of all sockets and freeing
of memory allocation by the unloading protocol.

 sys/protosw.h

  o Define generic PROTO_SPACER to be 32767
  o Prototypes for all pru_*_notsupp() functions
  o Prototypes for pf_proto_[un]register() functions

 kern/uipc_domain.c

  o Global struct pr_usrreqs nousrreqs containing valid pointers to the
    pru_*_notsupp() functions
  o New functions pf_proto_[un]register()

 kern/uipc_socket2.c

  o New functions bodies for all pru_*_notsupp() functions
2004-10-19 15:13:30 +00:00
Andre Oppermann
1cf15713ed Add a macro for the destruction of INP_INFO_LOCK's used by loadable modules. 2004-10-19 14:34:13 +00:00
Andre Oppermann
de1c2ac4bf Make comments more clear. Change the order of one if() statement to check the
more likely variable first.
2004-10-19 14:31:56 +00:00
Andre Oppermann
f45cd79a03 Be more careful to only index valid IP protocols and be more verbose with
comments.
2004-10-19 14:26:44 +00:00
Lukas Ertl
dc6b9c2d6e Return the unit number of a channel instead of a hardcoded '1' from
the ATA pccard locking function.  This makes pccard devices like
Compact Flash cards work again.

PR:             kern/72805
Submitted by:   James E. Flemer <jflemer@alum.rpi.edu>
MFC in:         2 days
2004-10-19 10:29:00 +00:00
Scott Long
8a2e22dec0 Use and alignment of 1 instead of ETHER_ALIGN for rx and tx buffers and jumbo
frames.  BGE hardware with the rx alignment bug will still be handled by the
calls to m_adj() that already exist.  m_adj() is probably better suited for
this task anyways.  Just as with if_em, this saves a malloc + several locks
per packet and prevents unneeded data copying within busdma.
2004-10-19 02:42:49 +00:00
Scott Long
25ba7fd287 Use an alignment of 1 instead of PAGE_SIZE for the rx and tx buffer tags.
Since the e1000 DMA engines hava no constraints on the alignment of buffer
transfers, there is no reason to tell busdma that there is.  This save a
minimum of 1 malloc call per packet, which translates to eliminating 4 locks.
It also means that buffers are not needlessly bounced when transfered.  The
end result is a 38% improvement in pps in a 4 way bridging environment.

Obtained from: Sandvine, Inc.
2004-10-19 02:39:27 +00:00
John-Mark Gurney
7a099cc936 fix (for me) the problems where if_de gets really slow after time
(usually taking 20 seconds to transmit a packet).. no longer fall back
to only transmitting one packet (instead of the entire queue) after we
have processed the entire send queue...  I have no idea why we didn't
start seeing this problem ~6 years ago when this code was introduced...
2004-10-18 23:06:12 +00:00
Robert Watson
81158452be Push acquisition of the accept mutex out of sofree() into the caller
(sorele()/sotryfree()):

- This permits the caller to acquire the accept mutex before the socket
  mutex, avoiding sofree() having to drop the socket mutex and re-order,
  which could lead to races permitting more than one thread to enter
  sofree() after a socket is ready to be free'd.

- This also covers clearing of the so_pcb weak socket reference from
  the protocol to the socket, preventing races in clearing and
  evaluation of the reference such that sofree() might be called more
  than once on the same socket.

This appears to close a race I was able to easily trigger by repeatedly
opening and resetting TCP connections to a host, in which the
tcp_close() code called as a result of the RST raced with the close()
of the accepted socket in the user process resulting in simultaneous
attempts to de-allocate the same socket.  The new locking increases
the overhead for operations that may potentially free the socket, so we
will want to revise the synchronization strategy here as we normalize
the reference counting model for sockets.  The use of the accept mutex
in freeing of sockets that are not listen sockets is primarily
motivated by the potential need to remove the socket from the
incomplete connection queue on its parent (listen) socket, so cleaning
up the reference model here may allow us to substantially weaken the
synchronization requirements.

RELENG_5_3 candidate.

MFC after:	3 days
Reviewed by:	dwhite
Discussed with:	gnn, dwhite, green
Reported by:	Marc UBM Bocklet <ubm at u-boot-man dot de>
Reported by:	Vlad <marchenko at gmail dot com>
2004-10-18 22:19:43 +00:00
Poul-Henning Kamp
95bc568977 Add new function ttyinitmode() which sets our systemwide default
modes on a tty structure.

Both the ".init" and the current settings are initialized allowing
the function to be used both at attach and open time.

The function takes an argument to decide if echoing should be enabled.
Echoing should not be enabled for regular physical serial ports
unless they are consoles, in which case they should be configured
by ttyconsolemode() instead.

Use the new function throughout.
2004-10-18 21:51:27 +00:00
Lukas Ertl
60110adc64 Drop the NDIS lock before returning from ndis_start().
PR:             i386/72795
Submitted by:   Frank Mayhar <frank@exit.com>
MFC in:         3 days
2004-10-18 21:33:56 +00:00
Gleb Smirnoff
547d34736b Major overhaul.
List of functional changes:
   - Make a single device per single node with a single hook.
     This gives us parrallelizm, which can't be achieved on a single
     node with many devices/hooks. This also gives us flexibility - we
     can play with a particular device node, not affecting others.
   - Remove read queue as it is. Use struct ifqueue instead. This change
     removes a lot of extra memcpy()ing, m_devget()ting and m_copymem()ming.
     In ng_device_receivedata() we enqueue an mbuf and wake readers.
     In ngdread() we take one mbuf from qeueue and uiomove() it to
     userspace. If no mbuf is present we optionally block. [1]
   - In ngdwrite() we create an mbuf from uio using m_uiotombuf().
     This is faster then uiomove() into buffer, and then m_copydata(),
     and this is much better than huge m_pullup().
   - Perform locking of device
   - Perform locking of connection list.
   - Clear out _rcvmsg method, since it does nothing good yet.
   - Implement NGM_DEVICE_GET_DEVNAME message.
   - #if 0 ioctl method, while nothing is done here yet.
   - Return immediately from ngdwrite() if uio_resid == 0.

 List of tidyness changes:
   - Introduce device2priv(), to remove cut'n'paste.
   - Use MALLOC/FREE, instead of malloc/free.
   - Use unit2minor().
   - Use UID_ROOT/GID_WHEEL instead of 0/0.
   - Define NGD_DEVICE_DEVNAME, use it.
   - Use more nice macros for debugging. [2]
   - Return Exxx, not -1.

 style(9) changes:
   - No "#endif" after short block.
   - Break long lines.
   - Remove extra spaces, add needed spaces.

[1] Obtained from:      if_tun.c
[2] Obtained from:      ng_pppoe.c
Reviewed by:		marks
Approved by:		julian (mentor)
MFC after:		1 month
2004-10-18 20:13:57 +00:00
Robert Watson
8f30dde5fe Annotate that get_cyclecount() can be expensive on some platforms,
which juxtaposes nicely with the comment just above on how the
harvest function must be cheap.
2004-10-18 19:29:13 +00:00
Robert Watson
ae8c2fa228 Correct several instances where calls to vfs_getvfs() resulting in
failure in the NFS server would result in a leaked instance of the NFS
server subsystem lock.  Liberally sprinkle assertions in all target
labels for error unwinding to assert the desired locking state.

RELENG_5_3 candidate.

MFC after:	3 days
Reported by:	Wilkinson, Alex <alex dot wilkinson at dsto dot defence dot gov dot au>
2004-10-18 11:23:11 +00:00
Alan Cox
1e96d2a217 Correct two errors in PG_BUSY management by vm_page_cowfault(). Both
errors are in rarely executed paths.
1. Each time the retry_alloc path is taken, the PG_BUSY must be set again.
   Otherwise vm_page_remove() panics.
2. There is no need to set PG_BUSY on the newly allocated page before
   freeing it.  The page already has PG_BUSY set by vm_page_alloc().
   Setting it again could cause an assertion failure.

MFC after: 2 weeks
2004-10-18 08:11:59 +00:00
Alan Cox
36aeb90e34 Assert that the containing object is locked in vm_page_io_start() and
vm_page_io_finish().  The motivation being to transition synchronization of
the vm_page's busy field from the global page queues lock to the per-object
lock.
2004-10-17 22:33:40 +00:00
Gleb Smirnoff
498f7f552e Use cluster if data >= MINCLSIZE.
Reviewed by:	mdodd
Approved by:	julian (mentor)
MFC after:	1 month
2004-10-17 21:44:11 +00:00
Alan Cox
950d5f7a99 Remove unnecessary check for curthread == NULL. 2004-10-17 20:29:28 +00:00
Alan Cox
20351faf18 When sf_buf_alloc() replaces a virtual-to-physical mapping, it needn't
invalidate the TLB(s) if the old mapping wasn't used by the CPU.  With
network interfaces that implement checksum off-loading, the old mapping is
almost never used by the CPU, only by the device driver for setting up the
DMA operation.

Reviewed by: tegge@
2004-10-16 22:32:50 +00:00
Lukas Ertl
fb88672937 Add support for the Vodafone Mobile Connect 3G datacard. 2004-10-16 21:27:28 +00:00
Scott Long
b96741f410 If a process needs to be swapped in, wakeup the swapper from within
critical_exit as the process is getting scheduled to run.  This is subotimal
but for now avoid the LOR between the scheduler and the sleepq systems.
This is a 5.3 candidate.

Submitted by: davidxu
MFC After: 3 days
2004-10-16 06:38:22 +00:00
Justin T. Gibbs
a1a3da9b38 Skip probe attempts for ISA PnP devices.
Pointed out by: imp
2004-10-15 23:39:52 +00:00
Poul-Henning Kamp
33da4e5bd8 Make pty's always come up in echo mode. 2004-10-15 09:03:07 +00:00
Yoshihiro Takahashi
9e6b875495 Merged from sys/dev/sio/sio.c (Use generic tty code). 2004-10-15 08:22:37 +00:00
Warner Losh
99e085d9a8 document host_start_mem.
# feel free to wordsmith.

Suggested by: ru@
2004-10-15 06:59:07 +00:00
Ruslan Ermilov
7a49c8b37d Polish the last change. 2004-10-15 06:44:13 +00:00
Nate Lawson
ecb7c87d1c Re-add an acpi attachment for the legacy probe that was inadvertently
removed.
2004-10-15 05:13:25 +00:00
Nate Lawson
3805720c53 Remove unused variable. 2004-10-15 04:59:21 +00:00
Nate Lawson
926660271c Remove unused variable. Pointy hat candidate. 2004-10-15 04:54:16 +00:00
Sam Leffler
1ab4eff43b add missing ';' that didn't show up with INVARIANTS enabled 2004-10-15 03:54:56 +00:00
Pyun YongHyeon
cea54ee291 Plug possible memory leak in sound DMA buffer handling. It also
changes return code to ENOMEM in case of allocation failure.

Approved by:	jake (mentor), scottl (co-mentor)
Reviewed by:	truckman, matk
2004-10-15 03:50:04 +00:00
Alexander Kabaev
95cb3d1a6b Use a taskqueue rather than an swi to handle deferred notifications.
Obtained from:	same change for umct(4) driver.
2004-10-15 03:44:56 +00:00
Sam Leffler
fe9b390b9d Move session state from on-card memory to host memory so we no longer are
constrained to a small number of sessions by the small on-card memories found
in newer devices.  This is really a stopgap solution as having session state
in main memory incurs a (small but noticeable) performance penalty. The better
solution is to manage session state so that it's cached on chip.

Obtained from:	openbsd
2004-10-15 00:36:07 +00:00
Warner Losh
71a77eda7d Document hw.{pci,acpi}.host_start_mem
Requested by: ru@
2004-10-15 00:15:07 +00:00
Nate Lawson
ccd582b0fd Let nexus print our flags for us. Also, clean up an obfuscated if stmt. 2004-10-14 22:37:51 +00:00
Nate Lawson
8f528832e5 Print flags in the nexus for child devices. 2004-10-14 22:36:47 +00:00
Nate Lawson
e5979322ba Remove local hacks to set flags now that the device probe does this for us.
Tested on every device except sio_pci and the pc98 fd.c.  Perhaps something
similar should be done for the "disabled" hints also.

MFC after:	2 weeks
2004-10-14 22:21:59 +00:00
Pawel Jakub Dawidek
1a32dca7a3 Add a missing newline character. 2004-10-14 19:00:44 +00:00
Poul-Henning Kamp
1919daf339 Remove unused ttys field.
Spotted by:	Peter Jeremy <PeterJeremy@optushome.com.au>
2004-10-14 18:37:59 +00:00
Poul-Henning Kamp
fffc55152b Add missing chunk of code to enforce the lock-bits of termios.
This solves the problem where serial consoles suddenly required
DCD to be asserted.

Reported by:	Randy Bush <randy@psg.com>
2004-10-14 18:30:24 +00:00
Nate Lawson
66ae9f6384 Update flags patch for the !ISA case.
* Get flags first, in case there is no devclass.
* Reset flags after each probe in case the next driver has no hints so it
  doesn't inherit the old ones.
* Set them again before the winning probe.

Tested ok both with and without ACPI for ISA device flags.

Reviewed by:	imp
MFC after:	1 day
2004-10-14 17:14:56 +00:00
Poul-Henning Kamp
256d6e16b0 Add missing flag to userland_sysctl() 2004-10-14 10:43:47 +00:00
Poul-Henning Kamp
097afe9133 Fix echo in console mode. 2004-10-14 08:58:28 +00:00
Pawel Jakub Dawidek
06697d4f59 Ehh. Introduce a hack: Wait for 3 seconds, so GEOM is able to give us
providers for tasting. Before this hack, race below is possible:
	SI_SUB_RAID (no not-fully-configured geoms, so don't block)
	GEOM tasting (now geoms are created)
	SI_SUB_MOUNT_ROOT (if root file system is placed on a mirror, it is
		possible that this mirror is not fully configured yet)
There is a lot of work to do to avoid such hacks and I need a working
solution before 5.3, sorry.

Reported by:	John Hay <jhay@icomtek.csir.co.za>
2004-10-14 07:55:29 +00:00
Pawel Jakub Dawidek
268111a210 Only allow for unloading when there are no geoms in LABEL GEOM class.
We have to use our own destroy_geom method, because default one, which
is a part of geom_slice is broken.
MT5 candidate.

PR:		kern/72467
Submitted by:	Vladimir Novoseltsev
2004-10-14 07:46:13 +00:00
John-Mark Gurney
583ef6b6d2 /me gets the wrong patch out of the pr :(
/me had the write patch w/o comments on his test system.

Pointed out by:	kuriyama and ache
Pointy hat to:	jmg
2004-10-14 03:26:50 +00:00
Brian Feldman
9b4fab9ef6 Fix a spelling error in a panic string. 2004-10-14 03:05:39 +00:00
Hidetoshi Shimokawa
370f9086a6 Fix warnings on non-i386 arch.
Submitted by: keramida
2004-10-14 00:21:32 +00:00
Stephan Uphoff
7c71b6453a Fix maybe_preempt_in_ksegrp for !SMP.
Tested   by: tegge
Reviewed by: julian
Approved by: sam (mentor)
MFC after: 3 days
2004-10-13 22:07:04 +00:00
John-Mark Gurney
d46316e8f9 fix a bug where signal events didn't set the flags for attach/detach..
PR:		72234
MFC after:	2 days
2004-10-13 20:55:19 +00:00
Søren Schmidt
b2d35a0408 Refine locking so it covers the "running" variable as well.
Adjust comments etc to fit the new locking system.
2004-10-13 15:16:35 +00:00
Lukas Ertl
d533a2843b Add device IDs for Intel ICH6.
PR:             kern/72492
Submitted by:   Florian Le Goff <madflo@beertech.org>
2004-10-13 14:51:42 +00:00
Bruce M Simpson
23e0012d02 Remove references to the second byte of a CCB containing the LUN, as this
is valid only for SCSI-2 and older devices.
Rename the second byte of the VERIFY CCB from 'lun' to 'byte2'.

Submitted by:	ken
MFC after:	2 weeks
2004-10-13 09:31:04 +00:00
Poul-Henning Kamp
6c3f1a47fe Use generic tty code instead of local copy. 2004-10-13 09:27:18 +00:00
Poul-Henning Kamp
9cb9afbd68 Use generic tty code instead of local stuff.
NB:  device names are now consistent:  {cua,tty}d$(port)[.lock,.init]
2004-10-13 08:27:20 +00:00
Nate Lawson
2c8d3b23ed Print before the footer, not after. 2004-10-13 07:29:29 +00:00
Nate Lawson
a91c5fa830 If flags are present, print them like ISA does.
MFC after:	1 day
2004-10-13 07:27:21 +00:00
Nate Lawson
6f857c4b9f Set flags for devices before probing them. In the non-ISA case, flags set
via hints were not getting passed to the child.

PR:		kern/72489
MFC after:	1 day
2004-10-13 07:10:41 +00:00
Poul-Henning Kamp
1acd87a81f First half of tty code rework: unifdef -D__FreeBSD_Version=600000
The changes in the next commit would make the code totally unreadable
if the #ifdef'ing were maintained.

It might make a lot of sense to split if_cx.c in a netgraph related
and in a tty related file but I will not attempt that without hardware.
2004-10-13 07:02:56 +00:00
Pyun YongHyeon
a2f4d2f5b0 Limit DMA address space to 1GB since the trident audio cards can't
handle DMA addresses located above 1GB. The LBA(loop begin address)
register which holds DMA base address is 32bits register. But the
MSB 2bits are used for other purposes. This effectivly limits the
DMA address space up to 1GB.

Approved by:	jake (mentor)
Reviewed by:	truckman, matk
2004-10-13 06:04:01 +00:00
Pyun YongHyeon
eba1cb6e3e Audio drivers failed to detect failure condition and attempted to
assign DMA address to the wrong address. It can cause system lockup
or other mysterious errors. Since most sound cards requires low DMA
address(BUS_SPACE_MAXADDR_24BIT) sndbuf_alloc() would fail when the
audio driver is loaded after long running of operations.

Approved by:	jake (mentor)
Reviewed by:	truckman, matk
2004-10-13 05:45:16 +00:00
Hidetoshi Shimokawa
fdebdf10bc Add dcons_os.{c,h}. 2004-10-13 05:41:09 +00:00
Hidetoshi Shimokawa
31a5877786 - Split dcons core code and OS dependent code.
- Implement dcons_ischar() and dcons_load_buffer().
- If loader passed a dcons buffer address, keep using it.
	(We still need a patch to cheat memory management system.)
2004-10-13 05:38:42 +00:00
Brian Feldman
d363b98e1f Permit fcntl(F_SETFL) to work on a ugen(4) device by not returning failure
for FIOASYNC.
2004-10-13 04:13:05 +00:00
Brian Feldman
601486239c Back out rev.1.91 which implemented bulk read transfers in ugen(4) as
asynchronous.  I realize that this means the custom application will
not work as written, but it is not okay to break most users of ugen(4).

The major problem is that a bulk read transfer is not an interrupt
saying that X bytes are available -- it is a request to be able to
receive up to X bytes, with T timeout, and S short-transfer-okayness.

The timeout is a software mechanism that ugen(4) provides and cannot
be implemented using asynchronous reads -- the timeout must start at
the time a read is done.

The status of up to how many bytes can be received in this transfer
and whether a short transfer returns data or error is also encoded
at least in ohci(4)'s requests to the controller.  Trying to detect
the "maximum width" results in using a single buffer of far too
small when an application requests a large read.

Even if you combat this by replacing all buffers again with the
maximal sized read buffer (1kb) that ugen(4) would allow you to
use before, you don't get the right semantics -- you have to
throw data away or make all the timeouts invalid or make the
short-transfer settings invalid.

There is no way to do this right without extending the ugen(4) API
much further -- it breaks the USB camera interfaces used because
they need a chain of many maximal-width transfers, for example, and
it makes cross-platform support for all the BSDs gratuitously hard.

Instead of trying to do select(2) on a bulk read pipe -- which has
neither the information on desired transfer length nor ability to
implement timeout -- an application can simply use a kernel thread
and pipe to turn that endpoint into something poll-able.

It is unfortunate that bulk endpoints cannot provide the same semantics
that interrupt and isochronous endpoints can, but it is possible to just
use ioctl(USB_GET_ENDPOINT_DESC) to find out when different semantics
must be used without preventing the normal users of the ugen(4) device
from working.
2004-10-13 04:12:20 +00:00
Maksim Yevmenkin
01c5ea585c Get rid of device nodes interface. It is useless and confusing.
The original idea was to use it for firmware upgrading and similar
operations. In real life almost all Bluetooth USB devices do not
need firmware download. If device does require firmware download
then ugen(4) (or specialized driver like ubtbcmfw(8)) should be
used instead.

MFC after:	3 days
2004-10-12 23:33:46 +00:00
Poul-Henning Kamp
d16c35256c Use generic tty code instead of local copies.
New devicename is ttyz{port}

No callout devices created.

Isn't this driver superseeded by uart(4) anyway ?
2004-10-12 22:33:19 +00:00
Poul-Henning Kamp
43c72732aa Don't call driver close unless we have one. 2004-10-12 21:40:41 +00:00
Nate Lawson
9e0dd54fea Attach the device description for ISA devices on the ACPI bus.
MFC after:	1 day
2004-10-12 21:33:08 +00:00
Poul-Henning Kamp
c5c5a2ad8a Add a couple of XXX comments and fix a couple of fine points.
I have not tried to make this a "canonical tty driver".
2004-10-12 21:23:33 +00:00
Poul-Henning Kamp
fbbec42fe4 Remove asserts which are not correct if the port is a tty. 2004-10-12 21:00:19 +00:00
Poul-Henning Kamp
13e7430fde Make !SMP kernels compile, and as far as I can tell, work again. 2004-10-12 20:57:37 +00:00
Gleb Smirnoff
330e667e8a Fix comment: since move from mballoc to mbuma, the allocation functions live
in kern_mbuf.c, not subr_mbuf.c
2004-10-12 20:18:27 +00:00
Poul-Henning Kamp
04e9e86c1f Use ttyconsolemode() to set the console tty modes. 2004-10-12 20:16:02 +00:00
Robert Watson
6b8e5a9862 Don't release the udbinfo lock until after the last use of UDP inpcb
in udp_input(), since the udbinfo lock is used to prevent removal of
the inpcb while in use (i.e., as a form of reference count) in the
in-bound path.

RELENG_5 candidate.
2004-10-12 20:03:56 +00:00
John Baldwin
ebcfea8764 Whitespace fix. 2004-10-12 19:36:00 +00:00
John Baldwin
2ff0e645d1 Refine the turnstile and sleep queue interfaces just a bit:
- Add a new _lock() call to each API that locks the associated chain lock
  for a lock_object pointer or wait channel.  The _lookup() functions now
  require that the chain lock be locked via _lock() when they are called.
- Change sleepq_add(), turnstile_wait() and turnstile_claim() to lookup
  the associated queue structure internally via _lookup() rather than
  accepting a pointer from the caller.  For turnstiles, this means that
  the actual lookup of the turnstile in the hash table is only done when
  the thread actually blocks rather than being done on each loop iteration
  in _mtx_lock_sleep().  For sleep queues, this means that sleepq_lookup()
  is no longer used outside of the sleep queue code except to implement an
  assertion in cv_destroy().
- Change sleepq_broadcast() and sleepq_signal() to require that the chain
  lock is already required.  For condition variables, this lets the
  cv_broadcast() and cv_signal() functions lock the sleep queue chain lock
  while testing the waiters count.  This means that the waiters count
  internal to condition variables is no longer protected by the interlock
  mutex and cv_broadcast() and cv_signal() now no longer require that the
  interlock be held when they are called.  This lets consumers of condition
  variables drop the lock before waking other threads which can result in
  fewer context switches.

MFC after:	1 month
2004-10-12 18:36:20 +00:00
John Baldwin
c7836018ea Add a WITNESS_WARN() to uiomove() to whine if locks are held when this
function is called.

MFC after:	1 month
2004-10-12 18:27:14 +00:00
Robert Watson
00fcf9d12d Modify the thrilling "%D is using my IP address %s!" message so that
it isn't printed if the IP address in question is '0.0.0.0', which is
used by nodes performing DHCP lookup, and so constitute a false
positive as a report of misconfiguration.
2004-10-12 17:10:40 +00:00
Robert Watson
6c67b8b695 When the access control on creating raw sockets was modified so that
processes in jail could create raw sockets, additional access control
checks were added to raw IP sockets to limit the ways in which those
sockets could be used.  Specifically, only the socket option IP_HDRINCL
was permitted in rip_ctloutput().  Other socket options were protected
by a call to suser().  This change was required to prevent processes
in a Jail from modifying system properties such as multicast routing
and firewall rule sets.

However, it also introduced a regression: processes that create a raw
socket with root privilege, but then downgraded credential (i.e., a
daemon giving up root, or a setuid process switching back to the real
uid) could no longer issue other unprivileged generic IP socket option
operations, such as IP_TOS, IP_TTL, and the multicast group membership
options, which prevented multicast routing daemons (and some other
tools) from operating correctly.

This change pushes the access control decision down to the granularity
of individual socket options, rather than all socket options, on raw
IP sockets.  When rip_ctloutput() doesn't implement an option, it will
now pass the request directly to in_control() without an access
control check.  This should restore the functionality of the generic
IP socket options for raw sockets in the above-described scenarios,
which may be confirmed with the ipsockopt regression test.

RELENG_5 candidate.

Reviewed by:	csjp
2004-10-12 16:47:25 +00:00
Stephan Uphoff
c6a08cf2d7 Directly modifying the priority of a thread that may be on the runqueue
can break the sorting order of the ksegp run queue.

Tested   by: pho
Reviewed by: jhb, julian
Approved by: sam (mentor)
MFC: ASAP
2004-10-12 16:31:23 +00:00
Stephan Uphoff
84f9d4b137 Prevent preemption in slot_fill.
Implement preemption between threads in the same ksegp in out of slot
situations to prevent priority inversion.

Tested   by: pho
Reviewed by: jhb, julian
Approved by: sam (mentor)
MFC: ASAP
2004-10-12 16:30:20 +00:00
Stephan Uphoff
b9a80acadb Force MUTEX_WAKE_ALL.
A race condition in single thread wakeup may break priority inheritance.

Tested   by: pho
Reviewed by: jhb,julian
Approved by: sam (mentor)
MFC: ASAP
2004-10-12 16:28:18 +00:00
Ruslan Ermilov
f49f4f366b Back out cumulative changes from revs. 1.92-1.94: "make depend"
followed by "make depend" shouldn't do anything.  It doesn't
seem to be a problem anymore, and if someone finds it to break
again, please contact me so we can work on a real fix.

Reviewed by:	bde
2004-10-12 15:08:24 +00:00