Thomas Moestl [Sat, 28 Jun 2003 21:52:16 +0000 (21:52 +0000)]
Small fixes for the IOMMU code:
1.) Handle maximum segment sizes which are smaller than the IOMMU page
size by splitting up pages across multiple segments if needed; this case
was previously unimplemented, and would cause panics.
2.) KASSERT that the physical address is in range; remove a KASSERT that
has become pointless.
3.) Add a comment describing what remains to be fixed in the IOMMU code;
I plan to address these issues soon.
Marcel Moolenaar [Sat, 28 Jun 2003 19:45:15 +0000 (19:45 +0000)]
Don't use fuword() and suword() on struct members of type int. This
happens to work on 32-bit platforms as sizeof(long)=sizeof(int), but
wrecks all kinds of havoc (garbage reads, corrupting writes and
misaligned loads/stores) on 64-bit architectures.
The fix for now is to use fuword32() and suword32() and change the
type of the applicable int fields to int32. This is to make it
explicit that we depend on these fields being 32-bit. We may want
to revisit this later.
Marcel Moolenaar [Sat, 28 Jun 2003 19:32:07 +0000 (19:32 +0000)]
Don't map LINUX_POSIX_VDISABLE to _POSIX_VDISABLE and vice versa for
the VMIN and VTIME members of the c_cc array. These members are not
special control characters. By not excluding these members we
changed the noncanonical mode input processing when both members
were 0 on entry (=LINUX_POSIX_VDISABLE) as we would remap them to 255
(=_POSIX_VDISABLE). See termios(4) case A for how that screws up
your terminal I/O.
PR: 23173
Originator: Bjarne Blichfeldt <bbl@dk.damgaard.com>
Patch by: Boris Nikolaus <bn@dali.tellique.de> (original submission)
Philipp Mergenthaler <philipp.mergenthaler@stud.uni-karlsruhe.de>
Reminders by: Joseph Holland King <gte743n@cad.gatech.edu>
MFC after: 5 days
Fix several problems related to resume:
- Initialize fc->status to process bus reset correctly after resume.
- Initialize AT ring buffer pointer.
- Requeue stdma to stfree for active IR buffer.
- Stop DMA before suspend for safe.
- Set powerstate after resume.
David Xu [Sat, 28 Jun 2003 09:55:02 +0000 (09:55 +0000)]
o Use a daemon thread to monitor signal events in kernel, if pending
signals were changed in kernel, it will retrieve the pending set and
try to find a thread to dispatch the signal. The dispatching process
can be rolled back if the signal is no longer in kernel.
o Create two functions _thr_signal_init() and _thr_signal_deinit(),
all signal action settings are retrieved from kernel when threading
mode is turned on, after a fork(), child process will reset them to
user settings by calling _thr_signal_deinit(). when threading mode
is not turned on, all signal operations are direct past to kernel.
o When a thread generated a synchoronous signals and its context returned
from completed list, UTS will retrieve the signal from its mailbox and try
to deliver the signal to thread.
o Context signal mask is now only used when delivering signals, thread's
current signal mask is always the one in pthread structure.
o Remove have_signals field in pthread structure, replace it with
psf_valid in pthread_signal_frame. when psf_valid is true, in context
switch time, thread will backout itself from some mutex/condition
internal queues, then begin to process signals. when a thread is not
at blocked state and running, check_pending indicates there are signals
for the thread, after preempted and then resumed time, UTS will try to
deliver signals to the thread.
o At signal delivering time, not only pending signals in thread will be
scanned, process's pending signals will be scanned too.
o Change sigwait code a bit, remove field sigwait in pthread_wait_data,
replace it with oldsigmask in pthread structure, when a thread calls
sigwait(), its current signal mask is backuped to oldsigmask, and waitset
is copied to its signal mask and when the thread gets a signal in the
waitset range, its current signal mask is restored from oldsigmask,
these are done in atomic fashion.
o Two additional POSIX APIs are implemented, sigwaitinfo() and sigtimedwait().
o Signal code locking is better than previous, there is fewer race conditions.
o Temporary disable most of code in _kse_single_thread as it is not safe
after fork().
David Xu [Sat, 28 Jun 2003 09:47:22 +0000 (09:47 +0000)]
Temporary disable rwlock based code, replace it with low level KSE locking
code until rtld-elf and libkse can cooperate better, those code can be
restored.
David Xu [Sat, 28 Jun 2003 09:39:35 +0000 (09:39 +0000)]
if thread is exiting, just returns. kse_thr_interrupt interface
was changed, it needs signal parameter, pass -1 to it, it indicates to
interrupt syscall.
Marcel Moolenaar [Sat, 28 Jun 2003 09:22:25 +0000 (09:22 +0000)]
Implement cpu_set_upcall_kse(). Elementary testing shows that this
function behaves correctly in principle, but is not expected to be
100% complete. In any case, with this commit we have KSE ported
enough to start runtime testing with threaded applications and fix
whatever bugs or omissions we encounter. Yay!
David Schultz [Sat, 28 Jun 2003 09:03:25 +0000 (09:03 +0000)]
Update to reflect changes in vfscanf.c,v 1.32. Remove bogus
documentation for %a, and document it correctly instead.
s/one of aefg/one of a, e, f, or g/
David Schultz [Sat, 28 Jun 2003 09:03:05 +0000 (09:03 +0000)]
Revamp scanf's floating-point-parsing algorithm to support
[+|-]Inf, [+|-]NaN, nan(...), and hexidecimal FP constants.
While here, add %a and %A, which are aliases for %e, and
add support for long doubles.
David Xu [Sat, 28 Jun 2003 08:29:05 +0000 (08:29 +0000)]
o Change kse_thr_interrupt to allow send a signal to a specified thread,
or unblock a thread in kernel, and allow UTS to specify whether syscall
should be restarted.
o Add ability for UTS to monitor signal comes in and removed from process,
the flag PS_SIGEVENT is used to indicate the events.
o Add a KMF_WAITSIGEVENT for KSE mailbox flag, UTS call kse_release with
this flag set to wait for above signal event.
o For SA based thread, kernel masks all signal in its signal mask, let
UTS to use kse_thr_interrupt interrupt a thread, and install a signal
frame in userland for the thread.
o Add a tm_syncsig in thread mailbox, when a hardware trap occurs,
it is used to deliver synchronous signal to userland, and upcall
is schedule, so UTS can process the synchronous signal for the thread.
David Xu [Sat, 28 Jun 2003 08:03:28 +0000 (08:03 +0000)]
Fix POSIX compatible bug for sigwaitinfo and sigtimedwait.
POSIX says siginfo pointer parameter can be NULL and if the
function success, it should return signal number but not zero.
The waitset it past should be negatived before it can be
used as thread signal mask.
Alan Cox [Sat, 28 Jun 2003 07:58:10 +0000 (07:58 +0000)]
- Use an int rather than a vm_pindex_t to represent the desired page
color in vm_page_alloc(). (This also has small performance benefits.)
- Eliminate vm_page_select_free(); vm_page_alloc() might as well
call vm_pageq_find() directly.
David Xu [Sat, 28 Jun 2003 06:34:08 +0000 (06:34 +0000)]
Add a machine depended function thread_siginfo, SA signal code
will use the function to construct a siginfo structure and use
the result to export to userland.
Sam Leffler [Sat, 28 Jun 2003 06:22:23 +0000 (06:22 +0000)]
o update for new 802.11 support
o relax some error handling so other drivers (e.g. ath) are usable
o revert ap scanning logic to old scheme
o add to capability info printing for 11a and 11g
Jeff Roberson [Sat, 28 Jun 2003 06:19:56 +0000 (06:19 +0000)]
- Throttle the inherited sleep and run time in sched_fork_kseg(). This
allows us to learn the behavior of a thread much more quickly after it
starts up.
Scott Long [Sat, 28 Jun 2003 06:07:06 +0000 (06:07 +0000)]
Catch amd64 up with the pending busdma async callback locking. Though this
mechanism might change in the near future, it's best to keep everything in
sync right now.
Jeff Roberson [Sat, 28 Jun 2003 06:04:47 +0000 (06:04 +0000)]
- Adjust the default maximum slice value to ~140ms. This has improved the
nice distribution without significantly impacting interactive response.
As a side effect it should also allow batch processes to run for a
slightly longer period which will positively impact their performance.
Scott Long [Sat, 28 Jun 2003 05:45:55 +0000 (05:45 +0000)]
Add 'umct', a driver for MCT Corp. and Belkin F5U109 USB-Serial adapters.
This is based on the ubsa driver by Alexander Kabaev along with documentation
gleaned from the Linux mct_u232 driver. I've had this driver sitting in my
tree for almost 6 months, and several others have found it useful.
Justin T. Gibbs [Sat, 28 Jun 2003 04:46:54 +0000 (04:46 +0000)]
Fix a race condition in the flushing of commands that
have completed across the bus but not to the host before
processing of an exception condition (busfree, bus reset,
etc.). When flushing the controller of completed commands,
we also look for packetized commands that have completed
with good status and are stored in the "good status fifo".
The hardware will post to the good status fifo even if
data for that command is still active in a FIFO. In
one particular failure case, a command outstanding on the
bus reconnected, transferred data into a FIFO, and provided
good status while the host driver was processing an expected
busfree event (PPR message negotiation). This resulted in
an entry in the good status fifo that we completed, but
since the sequencer was paused, the data in the data FIFO
for this command had never been transferred to the host.
Once the busfree processing was complete, the sequencer
was unpaused, and the data completed its transfer to the
host. In some instances, the client for the data was notified
of the completion and attempted to view the data before
it arrived. This case only occurred during FreeBSD's
multi-target probe of the SCSI bus while some devices are
negotiating to go packetized and some devices are already
running in packetized.
The fix is to run and FIFOs active with a context in the
good status fifo to completion before completing the command
to the SCSI layer. This requies duplicating the FIFO rundown
operations in the host driver that would usually be handled
by the firmware, but there is no other alternative.
Don't blindly shutdown the SCB dma engine when restarting
the sequencer. We may be killing an operation that is
not supposed to be cancelled. The cases where we need to
shutdown these dma engines are already handled elsewhere in
the driver.
Fix a few more ahd_in?() -> ahd_in?_scbram() instances.
Justin T. Gibbs [Sat, 28 Jun 2003 04:45:25 +0000 (04:45 +0000)]
aic79xx.h:
Add softc flag to indicate that we have seen at
least one selection since the last bus reset or
SE/LVD bus change.
aic79xx.c:
Fix a few style nits.
In ahd_update_pending_scbs(), only touch card registers
once we have found an SCB that needs to be updated.
This removes lots of clutter from PCI traces taken of
error recovery performed by the driver.
Short circuit the first selection iocell workaround handler
if we've run once since the last bus reset or iocell change.
This also removes clutter from PCI traces.
Note if completions are pending in the qoutfifo when we dump
card state.
Justin T. Gibbs [Sat, 28 Jun 2003 04:42:11 +0000 (04:42 +0000)]
Correct a typo in a comment.
Add a comment in ahd_clear_critical_sections() about
our need to leave ENBUSFREE set in SIMODE1 while single
stepping.
Re-arrange some delay loops so that we always perform
a read after any register write and before the delay.
This should make the delay loop more accurate.
When completing message processing for a packetized
commention, return the controller to a state where
invalid non-packetized phases will still cause protocol
violations. These are the same operations as those
performed in the clear_target_state routine in the
firmware.
Now that we have a chip with working ABORTPENDING
support (the 7901B), comment out the automatic use
of this feature until we can adequately test it.
The previous checkin updated the bug mask for the
7901B so this code was exercised.
When resetting the bus, perform an ahd_flush_device_writes()
call so that our reset assertion delay is acurately
timed from when the reset bit is written to the controller.
Justin T. Gibbs [Sat, 28 Jun 2003 04:40:46 +0000 (04:40 +0000)]
aic79xx.seq:
Remove an old comment that no longer applies.
Fix a jump in our unexpected non-packetized phase
handler to use an explicit lable. The old code
had a hardcoded jump offset that was off by one
instruction.
Justin T. Gibbs [Sat, 28 Jun 2003 04:39:49 +0000 (04:39 +0000)]
aic79xx.h:
Add a 7901A specific feature definition.
aic79xx_pci.c:
Split out the general aic790X setup into it's own
setup handler that works on single and dual controllers.
Adjust all other PCI setup handlers to initialize the
chips basic features and type before calling the generic
handler.
Turn off a few Rev B workarounds that are not required
on the 7901B.
Peter Wemm [Fri, 27 Jun 2003 23:10:58 +0000 (23:10 +0000)]
Fix pointer/int warnings so this compiles on amd64. The driver wants
to store an int in the bio->bio_driver1 (a void *). It is big enough,
but you have to match the int sizes first before doing the cast.
Nate Lawson [Fri, 27 Jun 2003 21:57:42 +0000 (21:57 +0000)]
Whitespace cleanups (verified with MD5 1832ce5ede6c58c844dfb53fd48f0eea).
Also clarify a macro expansion with an XXX. I will be fixing access to
Acpi Global Lock in a subsequent commit.
Sam Leffler [Fri, 27 Jun 2003 20:10:03 +0000 (20:10 +0000)]
Check crypto driver capabilities and if the driver operates synchronously
mark crypto requests with ``callback immediately'' to avoid doing a context
switch to return crypto results. This completes the work to eliminate
context switches for using software crypto via the crypto subsystem (with
symmetric crypto ops).
Sam Leffler [Fri, 27 Jun 2003 20:07:10 +0000 (20:07 +0000)]
Add support to eliminate a context switch per crypto op when using the
software crypto device:
o record crypto device capabilities in each session id
o add a capability that indicates if the crypto driver operates synchronously
o tag the software crypto driver as operating synchronously
This commit also introduces crypto session id macros that cleanup their
construction and querying.
Alan Cox [Fri, 27 Jun 2003 18:52:49 +0000 (18:52 +0000)]
Simple read-modify-write operations on a vm object's flags, ref_count, and
shadow_count can now rely on its mutex for synchronization. Remove one use
of Giant from vm_map_insert().
Marcel Moolenaar [Fri, 27 Jun 2003 18:07:47 +0000 (18:07 +0000)]
Create compatibility links for libc_r on ia64 to prevent build-time
breakages. Note that runtime compatibility is not guaranteed. Future
changes to setjmp/longjmp in libc will break threaded applications
linked against libc_r.so.5 on ia64. We pull our "tier 2" card once
more...
Tom Rhodes [Fri, 27 Jun 2003 15:46:38 +0000 (15:46 +0000)]
Fix a bug where a truncate operation involving truncate() or ftruncate() on
an MSDOSFS file system either failed, silently corrupted the file, or
sometimes corrupted the neighboring file.
PR: 53695
Submitted by: Ariff Abdullah <skywizard@MyBSD.org.my> (original version)
MFC: 3 days
Peter Grehan [Fri, 27 Jun 2003 10:11:54 +0000 (10:11 +0000)]
Prevent probing the secondary channel on CMD646 controllers if the
channel has been disabled by BIOS. This prevents a bus timeout
machine check on B&W G3 PowerMacs, which have a primary-only CMD646
on the motherboard.
Scott Long [Fri, 27 Jun 2003 08:31:48 +0000 (08:31 +0000)]
Do the first and mostly mechanical step of adding mutex support to the
bus_dma async callback scheme. Note that sparc64 does not seem to do
async callbacks. Note that ia64 callbacks might not be MPSAFE at the
moment. Note that powerpc doesn't seem to do async callbacks due to
the implementation being incomplete.
Marcel Moolenaar [Fri, 27 Jun 2003 07:41:51 +0000 (07:41 +0000)]
o disconnect libc_r from the build on ia64. The library is now
obsolete. The intend is to add glue to either libthr or
libpthread to create the necessary compat links.
o Hook libpthread to the build on ia64. This is slightly out of
order, because the kernel still doesn't have all the support,
but that's not a problem in this case.
Marcel Moolenaar [Fri, 27 Jun 2003 06:15:13 +0000 (06:15 +0000)]
Implement _ia64_save_context() and _ia64_restore_context(). Both
functions are derived from the swapctx() and restorectx() (resp)
from sys/ia64/ia64/context.s. The code is expected to be 99%
correct, but has not yet been tested.
Note that with these functions operating on mcontext_t, we also
created the foundation upon which we can implement getcontext(2)
and setcontext(2) replacements. It's not guaranteed that the use
of these syscalls and _ia64_{save|restore}_context() on the same
uicontext_t is actually going to work. Replacing the syscalls is
now trivially achieved.
This commit completes the ia64 port of libpthread itself (modulo
testing and bugfixes).
Bruce A. Mah [Fri, 27 Jun 2003 03:50:36 +0000 (03:50 +0000)]
Commit amd64 MD release documentation stubs and hook up to the build.
Content will be filled in later as needed, but this should unbreak
the doc part of an amd64 release build.
Warner Losh [Fri, 27 Jun 2003 03:25:43 +0000 (03:25 +0000)]
Remove check to see if the get resource for the second resource
succeeds. There is a difference between how OLDCARD and NEWCARD deal
with their resources, and this code exposes that difference. I'm not
sure which behavior is correct, and will need to look into that in
more detail. However, it appears that we go ahead and allocate the
right thing in both cases that I have access to (CF cards, CDROM, and
external ata enclosures), so go ahead and ignore the failure to get
the resource for the other rid. There's already another check to make
sure that the actual allocation works correctly, and that should be
sufficient to catch cases that don't work.
Sam Leffler [Fri, 27 Jun 2003 00:49:04 +0000 (00:49 +0000)]
Return support needed by dstumbler:
o add back rx monitor support
o make WI_RID_SCAN_RES DTRT
o fix a bug handling zero-length RID requests (used by dstumbler to set
a zero-length SSID)
o make RID_SCAN_REQ DTRT
o add back WI_RID_OWN_SSID
o fix wi_scan_ap to take a channel mask and txrate (for prism cards)
These changes fix dstumbler -o (monitor mode). A minor change to dstumbler
is needed to get normal AP scanning mode to work right; this is preferred to
modifying the driver.
PR: kern/53187
Reviewed by: Bruce M Simpson <bms@spc.org>