dougb [Sun, 8 Jan 2006 10:15:31 +0000 (10:15 +0000)]
Add a mechanism to include files added by ports which contain
the names of directories to include in the base ldconfig script.
This will eliminate the need for each port to install its own
boot script which does nothing but ldocnfig a given directory.
This code was developed by flz (ports committer), discussed on
freebsd-rc@, and modified slightly by me.
krion [Sat, 7 Jan 2006 22:10:58 +0000 (22:10 +0000)]
When using @cwd %%FOO%%, we must ensure to return in the original
prefix later, but doing so with @cwd %%OLDPREFIX%% (having
PLIST_SUB+="OLDPREFIX=${PREFIX}") hardcodes the value in the packing
list. That's not really a problem when dealing with ports but that's
a problem with packages since pkg_add -p option only overrides the
first @cwd occurrence.
This patch allow us to use @cwd without any argument. If no
directory argument is given, it will set current working directory
to the first prefix given by the @cwd command.
imp [Sat, 7 Jan 2006 19:29:25 +0000 (19:29 +0000)]
While reviewing if_sn in an attempt to understand network drivers
better, I discovered sn doing too many pointer dereferences. This
driver would do silly things like:
sn_foo(struct ifnet *ifp)
{
struct sn_softc *sc = ifp->if_softc;
sc->ifp->mumble
/* Other stuff */
}
while /* other stuff */ usually needed sc, the extra deref isn't
needed. Eliminate a few dozen of them.
jhb [Sat, 7 Jan 2006 14:03:15 +0000 (14:03 +0000)]
Revert an untested local change that crept in with the lo_class changes
and subsequently broke the build. This change is supposed to fix the
case where doing a mtx_destroy() off a spin mutex while you hold it fails.
If it had been tested I would just leave it in, but it hasn't been tested
yet, so it will have to wait until later.
grehan [Sat, 7 Jan 2006 01:55:12 +0000 (01:55 +0000)]
Set the siginfo si_addr field, and also the mysterious 3rd parameter
to old-style signals, to be the DAR register for DSI miss exceptions.
This gives the address of the access rather than the instruction
address. The behaviour is now the same as on i386.
marcel [Fri, 6 Jan 2006 22:12:46 +0000 (22:12 +0000)]
Fix FD_ISSET() on LP64 platforms. The FD_ISSET() function/macro is
defined to return an int, but on LP64 platforms the return value of
FD_ISSET() for file descriptors with a bit-index larger than 31 would
not fit an int (due to __fd_mask being defined as an unsigned long).
The fix is to explicitly test against 0.
jhb [Fri, 6 Jan 2006 20:17:48 +0000 (20:17 +0000)]
- Update copyright years from the Specialix SDK.
- Update comment as this firmware is not used for the SX cards, they use
the si3_t225 firmware instead.
jhb [Fri, 6 Jan 2006 19:58:08 +0000 (19:58 +0000)]
Update the firmware image used for the SIJET cards to the latest available
in the SDK from Specialix/Perle. The prior version was
JET.BIN Version 3.0.6 Beta I and the new version is JET__.BIN Version 4.0.1.
jhb [Fri, 6 Jan 2006 19:56:12 +0000 (19:56 +0000)]
- Fix cards with multiple modules. Prior to this, the ports on the various
modules would have overlapping names.
- Only create /dev/si_control for unit 0.
Tested by: Joerg Lehners Joerg dot Lehners at informatik dot
uni-oldenburg dot de (on 6.x)
MFC after: 1 week
ceri [Fri, 6 Jan 2006 19:39:16 +0000 (19:39 +0000)]
o Document the possibility of putting 'b' in the flag field.
While we don't use the NC_BROADCAST value of nc_flag anywhere in the
RPC code, it is parseable by getnetconfigent(3) from /etc/netconfig.
o Clean up some "see below"'s that were cut and pasted from netconfig.h.
jhb [Fri, 6 Jan 2006 19:22:19 +0000 (19:22 +0000)]
- Make pcib_devclass private to sys/dev/pci/pci_pci.c and change all the
various pcib drivers to use their own private devclass_t variables for
their modules.
- Use the DEFINE_CLASS_0() macro to declare drivers for the various pcib
drivers while I'm here.
jhb [Fri, 6 Jan 2006 18:07:32 +0000 (18:07 +0000)]
Trim another pointer from struct lock_object (and thus from struct mtx and
struct sx). Instead of storing a direct pointer to a our lock_class
struct in lock_object, reserve 4 bits in the lo_flags field to serve as an
index into a global lock_classes array that contains pointers to the lock
classes. Only debugging code such as WITNESS or INVARIANTS checks and KTR
logging need to access the lock_class member, so this shouldn't add any
overhead to production kernels. It might add some slight overhead to
kernels using those debug options however.
As with the previous set of changes to lock_object, this is going to
completely obliterate the kernel ABI, so be sure to recompile all your
modules.
jhb [Fri, 6 Jan 2006 18:03:45 +0000 (18:03 +0000)]
Reduce the scope of one #ifdef to avoid duplicating a SYSCTL_INT() macro
and trim another unneeded #ifdef (it was just around a macro that is
already conditionally defined).
jhb [Fri, 6 Jan 2006 18:02:12 +0000 (18:02 +0000)]
Fix various places that were testing td_critnest to see if interrupts
should remain disabled during a trap or not to check
td_md.md_spinlock_count instead.
jhb [Fri, 6 Jan 2006 16:14:32 +0000 (16:14 +0000)]
Be a little more forgiving of lame BIOS writers. If a link device that
doesn't have any actual interrupts is listed in a _PRT entry, only print
a warning rather than panic'ing when we walk the _PRT's to build up count
of entries that reference a given link (the counts are used as weights so
that we can attempt to balance the load across IRQs used by link devices).
Instead, only panic if we attempt to use the _PRT entry to route an
interrupt for a device.
ariff [Fri, 6 Jan 2006 05:04:18 +0000 (05:04 +0000)]
Another major fixes and enhancements:
- MPSAFE
- Fix / reorganize attach routine. Device specific initialization must
be done after generic bus / DMA setup. At last, Virtual Channels
(vchan) works as expected.
Note: Recent commit / fix against this driver proves that major enhancements
on the generic sound layer does indeed help to expose flaw within
device specific code. There are probably other drivers that need to
be addressed as well.
imp [Fri, 6 Jan 2006 04:44:09 +0000 (04:44 +0000)]
New option: NO_FFS_SNAPSHOT. I did this in p4 about the same time
that NetBSD implemented it independently of them (don't know which one
was actually first). This saves about 24k for those times you don't
need snapshot support (like when running off a ram disk, or in an
embedded environment where size matters).
jhb [Thu, 5 Jan 2006 22:20:31 +0000 (22:20 +0000)]
Remove XXX comments complaining that write(2) on a read-only descriptor
returns EBADF. That errno is correct and is mandated by POSIX. It also
goes back to revision 1.1 of our CVS history (i.e. 4.4BSD).
The _fget() function should probably also be upated as it currently returns
EINVAL in that case rather than EBADF. (It does return EBADF for reads
on a write-only descriptor without any XXX comments oddly enough.)
davidxu [Thu, 5 Jan 2006 13:51:22 +0000 (13:51 +0000)]
Refine thread suspension code, now thread suspension is a blockable
operation, the caller is blocked util target threads are really
suspended, also avoid suspending a thread when it is holding a
critical lock.
Fix a bug in _thr_ref_delete which tests a never set flag.
bde [Thu, 5 Jan 2006 09:18:48 +0000 (09:18 +0000)]
Oops, on amd64 (and probably on all non-i386 systems), the previous
commit broke the 2**24 cases where |x| > DBL_MAX/2. There are exponent
range problems not just for denormals (underflow) but for large values
(overflow). Doubles have more than enough exponent range to avoid the
problems, but I forgot to convert enough terms to double, so there was
an x+x term which was sometimes evaluated in float precision.
Unfortunately, this is a pessimization with some combinations of systems
and compilers (it makes no difference on Athlon XP's, but on Athlon64's
it gives a 5% pessimization with gcc-3.4 but not with gcc-3.3).
bde [Thu, 5 Jan 2006 07:57:31 +0000 (07:57 +0000)]
Use double precision internally to optimize cbrtf(), and change the
algorithm for the second step significantly to also get a perfectly
rounded result in round-to-nearest mode. The resulting optimization
is about 25% on Athlon64's and 30% on Athlon XP's (about 25 cycles
out of 100 on the former).
Using extra precision, we don't need to do anything special to avoid
large rounding errors in the third step (Newton's method), so we can
regroup terms to avoid a division, increase clarity, and increase
opportunities for parallelism. Rearrangement for parallelism loses
the increase in clarity. We end up with the same number of operations
but with a division reduced to a multiplication.
Using specifically double precision, there is enough extra precision
for the third step to give enough precision for perfect rounding to
float precision provided the previous steps are accurate to 16 bits.
(They were accurate to 12 bits, which was almost minimal for imperfect
rounding in the old version but would be more than enough for imperfect
rounding in this version (9 bits would be enough now).) I couldn't
find any significant time optimizations from optimizing the previous
steps, so I decided to optimize for accuracy instead. The second step
needed a division although a previous commit optimized it to use a
polynomial approximation for its main detail, and this division dominated
the time for the second step. Use the same Newton's method for the
second step as for the third step since this is insignificantly slower
than the division plus the polynomial (now that Newton's method only
needs 1 division), significantly more accurate, and simpler. Single
precision would be precise enough for the second step, but doesn't
have enough exponent range to handle denormals without the special
grouping of terms (as in previous versions) that requires another
division, so we use double precision for both the second and third
steps.
kan [Wed, 4 Jan 2006 23:17:52 +0000 (23:17 +0000)]
Add -w parameter which tells kgdb to open kmem-based targets in read-write
mode. This allows one to use kgdb on /dev/mem and be able to patch memory
on a live system. This is identical to what -wcore used to do in previous
gdb versions for FreeBSD.
imp [Wed, 4 Jan 2006 23:00:01 +0000 (23:00 +0000)]
Check for 10BaseT media correctly. Before we were confusing
ifm_status and ifm_active. IFM_10_T gets set in the ifm_active field,
not in the ifm_status field, as far as I can tell.
Note: this was to enable a workaround that's rarely enabled. I don't know
how to corrupt my eeprom to test it, and would rather not know...
netchild [Wed, 4 Jan 2006 20:11:04 +0000 (20:11 +0000)]
We don't support I386_CPU in 6.0 and later. This file can be cleaned
up some to assume that '#if defined(I486_CPU) || defined(I586_CPU) ||
defined(I686_CPU)' is true.
dougb [Wed, 4 Jan 2006 19:18:43 +0000 (19:18 +0000)]
After some discussion with the folks at ISC, it turns out that the _ai_pad
part of the structure was a hack to maintain binary compatibility with
Sun binaries, and my understanding is that it's not needed generally
on sparc systems running other operating systems. Therefore, hide this
code behind the same set of tests as in lib/bind/include/netdb.h.
This file is being imported on the vendor branch because a similar change
(or change with similar effect) will be in the next version of BIND 9.
This change will not affect other platforms in any way.
harti [Wed, 4 Jan 2006 12:57:09 +0000 (12:57 +0000)]
Add a new leaf to the net.link.generic.ifdata.%d sysctl to retrieve
the name and unit number assigned by the driver. This is needed by
SNMP to find interfaces after they have been renamed.
netchild [Wed, 4 Jan 2006 12:57:02 +0000 (12:57 +0000)]
- Make sure the cpu_exthigh variable is initialized (page coloring case). [1]
- Remove a conditional in the AMD cache detection, it's always false. [2]
- Don't try to detect a cache if only compiled for i386.
Analyzed by: Antoine Brodin <antoine.brodin@laposte.net> [1]
Submitted by: Antoine Brodin <antoine.brodin@laposte.net> [2]
dds [Wed, 4 Jan 2006 00:47:13 +0000 (00:47 +0000)]
Replace tv_usec normalization with the return of EINVAL.
This addresses two objections to the previous behavior,
and unbreaks the alpha tinderbox build.
dds [Tue, 3 Jan 2006 21:58:21 +0000 (21:58 +0000)]
Normalize the tv_usec part of the utimes(2) arguments to ensure
that a file's atime and mtime are only set to correct fractional
second values (0-999999000ns with the current interface).
Prior to this change users could create files with values outside
that range. Moreover, on 32-bit machines tv_usec offsets larger than
4.3s would result in an unnormalized AND wrong timestamp value,
due to overflow.
jhb [Tue, 3 Jan 2006 20:39:38 +0000 (20:39 +0000)]
Fix a couple of issues with the ibcs2 module event handler. First, return
success instead of EOPNOTSUPP when being loaded. Secondly, if there are no
ibcs2 processes running when a MOD_UNLOAD request is made, break out to
return success instead of falling through into the default case which
returns EOPNOTSUPP. With these fixes, I can now kldload and subsequently
kldunload the ibcs2 module.
PR: kern/82026 (and several duplicates)
Reported by: lots of folks
MFC after: 1 week
brian [Tue, 3 Jan 2006 17:01:43 +0000 (17:01 +0000)]
This signal handling code is worse than a no-op. If a
signal is received during the msleep, the msleep is retried
indefinitely as it just keeps returning ERESTART because of
the pending signal.
jhb [Tue, 3 Jan 2006 17:00:38 +0000 (17:00 +0000)]
- Don't list sleep() in the NAME section as we haven't had a sleep()
function in years.
- Change the 'ident' paramters to 'wchan' to match <sys/systm.h>.
- Use 'otherwise' in place of 'else' in one place so that this reads like
English rather than C.
- Document the new msleep_spin() function.
- Add history notes for msleep() and msleep_spin().
brian [Tue, 3 Jan 2006 15:34:27 +0000 (15:34 +0000)]
For the ``#ifdef NOTYET'' code that allows calling non-async-safe
functions in the child after a fork() from a threaded process,
use __sys_setprocmask() rather than setprocmask() to keep our
signal handling sane. Without this fix, signals are essentially
ignored in said child and things such as protection violations
result in an endless busy loop.
rwatson [Tue, 3 Jan 2006 14:00:22 +0000 (14:00 +0000)]
Back out VFS_LOCK_GIANT.9:1.4, due to losing a race in change/update
against revision 1.3. No need to include mount.h twice, once will be
quite enough.
brian [Tue, 3 Jan 2006 09:17:04 +0000 (09:17 +0000)]
Fix the other su bug reintroduced two commits ago, namely
$ su
% kill -STOP $$
where su is executing (t)csh. csh's job handling is a little more
special than that of (a)sh, bash and even zsh and blows up a little
more spectacularly. This modification restores the original mucking
about with the tty pgrp, but is careful to only do it when su (or
su's child) is the foreground process.
While I'm here, fix a STDERR_FILENO spelling as suggested by bde.
yongari [Tue, 3 Jan 2006 06:14:07 +0000 (06:14 +0000)]
- Tx side bus_dmamap_load_mbuf_sg(9) support. This reduces bookkeeping
requiried to keep consistent softc state before/after callback function
invocation and supposed to be sligntly faster than previous one as it
wouldn't incur callback overhead. With this change callback function
was gone.
- Decrease TI_MAXTXSEGS to 32 from 128. It seems that most mbuf chain
length is less than 32 and it would be re-packed with m_defrag(9) if
its chain length is larger than TI_MAXTXSEGS. This would protect ti(4)
against possible kernel stack overflow when txsegs[] is put on stack.
Alternatively, we can embed the txsegs[] into softc. However, that
would waste memory and make Tx/Rx speration hard when we want to
sperate Tx/Rx handlers to optimize locking.
- Fix dma map tracking used in Tx path. Previously it used the dma map
of the last mbuf chain in ti_txeof() which was incorrect as ti(4)
used dma map of the first mbuf chain when it loads a mbuf chain with
bus_dmamap_load_mbuf(9). Correct the bug by introducing queues that
keep track of active/inactive dma maps/mbuf chain.
- Use ti_txcnt to check whether driver need to set watchdog timer instead
of blidnly clearing the timer in ti_txeof().
- Remove the 3rd arg. of ti_encap(). Since ti(4) now caches the last
descriptor index(ti_tx_saved_prodidx) used in Tx there is no need to
pass it as a fuction arg.
- Change data type of producer/consumer index to int from u_int16_t in
order to remove implicit type conversions in Tx/Rx handlers.
- Check interface queue before getting a mbuf chain to reduce locking
overhead.
- Check number of available Tx descriptores to be 16 or higher in
ti_start(). This wouldn't protect Tx descriptor shortage but it would
reduce number of bus_dmamap_unload(9) calls in ti_encap() when we are
about to running out of Tx descriptors.
- Command NIC to send packets ony when the driver really has packets
enqueued. Previously it always set TI_MB_SENDPROD_IDX which would
command NIC to DMA Tx descriptors into NIC local memory regardless
of Tx descriptor changes.