Commit Graph

41009 Commits

Author SHA1 Message Date
Maxime Henrion
02681c8bc2 Sync bounce pages support with the alpha backend. More precisely:
o use a mutex to protect the bounce pages structure.
	o use a SYSINIT function to initialize the bounce pages structures
	  and thus avoid a race condition in alloc_bounce_pages().
	o add support for the BUS_DMA_NOWAIT flag in bus_dmamap_load().
	o remove obsolete splhigh()/splx() calls.
	o remove printf() about incorrect locking in busdma_swi() and sync
	  busdma_swi() with the one of the alpha backend.
	o use __FBSDID.
2003-07-01 18:08:05 +00:00
Ian Dowse
318f2fb4bf Add a new mount flag MNT_BYFSID that can be used to unmount a file
system by specifying the file system ID instead of a path. Use this
by default in umount(8). This avoids the need to perform any vnode
operations to look up the mount point, so it makes it possible to
unmount a file system whose root vnode cannot be looked up (e.g.
due to a dead NFS server, or a file system that has become detached
from the hierarchy because an underlying file system was unmounted).
It also provides an unambiguous way to specify which file system is
to be unmunted.

Since the ability to unmount using a path name is retained only for
compatibility, that case now just uses a simple string comparison
of the supplied path against f_mntonname of each mounted file system.

Discussed on:	freebsd-arch
mdoc help from:	ru
2003-07-01 17:40:23 +00:00
Maxime Henrion
4813f72a9b Honor the boundary of the busdma tag when allocating bounce pages.
This was fixed in revision 1.5 of alpha/alpha/busdma_machdep.c and
was never fixed in other busdma backends using bounce pages.
2003-07-01 16:54:54 +00:00
Scott Long
79501b66a7 Make swi_vm be INTR_MPSAFE. On all platforms, it is only used to activate
busdma_swi().  Now that busdma_swi() uses driver-provided locking, this
should be safe.
2003-07-01 16:00:38 +00:00
Scott Long
f6b1c44d1f Mega busdma API commit.
Add two new arguments to bus_dma_tag_create(): lockfunc and lockfuncarg.
Lockfunc allows a driver to provide a function for managing its locking
semantics while using busdma.  At the moment, this is used for the
asynchronous busdma_swi and callback mechanism.  Two lockfunc implementations
are provided: busdma_lock_mutex() performs standard mutex operations on the
mutex that is specified from lockfuncarg.  dftl_lock() is a panic
implementation and is defaulted to when NULL, NULL are passed to
bus_dma_tag_create().  The only time that NULL, NULL should ever be used is
when the driver ensures that bus_dmamap_load() will not be deferred.
Drivers that do not provide their own locking can pass
busdma_lock_mutex,&Giant args in order to preserve the former behaviour.

sparc64 and powerpc do not provide real busdma_swi functions, so this is
largely a noop on those platforms.  The busdma_swi on is64 is not properly
locked yet, so warnings will be emitted on this platform when busdma
callback deferrals happen.

If anyone gets panics or warnings from dflt_lock() being called, please
let me know right away.

Reviewed by:	tmm, gibbs
2003-07-01 15:52:06 +00:00
Thomas Moestl
cb33c884cd Add a commented-out entry for OFW_NEWPCI to GENERIC and NOTES, along
with a comment describing it's advantages and the implication of
changing it. While being there, fix a typo in NOTES.

The option is not enabled in NOTES for now since large portions of code
are conditional on it being disabled, too.
2003-07-01 15:13:07 +00:00
Thomas Moestl
1d80cb1b37 Add the new sparc64 OFW PCI framework, conditional on options OFW_NEWPCI
for now. It introduces a OFW PCI bus driver and a generic OFW PCI-PCI
bridge driver. By utilizing these, the PCI handling is much more elegant
now.

The advantages of the new approach are:
- Device enumeration should hopefully be more like on Solaris now,
  so unit numbers should match what's printed on the box more
  closely.
- Real interrupt routing is implemented now, so cardbus bridges
  etc. have at least a chance to work.
- The quirk tables are gone and have been replaced by (hopefully
  sufficient) heuristics.
- Much cleaner code.

There was also a report that previously bogus interrupt assignments
are fixed now, which can be attributed to the new heuristics.

A pitfall, and the reason why this is not the default yet, is that
it changes device enumeration, as mentioned above, which can make
it necessary to change the system configuration if more than one
unit of a device type is present (on a system with two hme cars,
for example, it is possible that hme0 becomes hme1 and vice versa
after enabling the option). Systems with multiple disk controllers
may need to be booted into single user (and require manual specification
of the root file system on boot) to adjust the fstab.
Nevertheless, I would like to encourage users to use this option,
so that it can be made the default soon.

In detail, the changes are:
- Introduce an OFW PCI bus driver; it inherits most methods from the
  generic PCI bus driver, but uses the firmware for enumeration,
  performs additional initialization for devices and firmware-specific
  interrupt routing. It also implements an OFW-specific method to allow
  child devices to get their firmware nodes.
- Introduce an OFW PCI-PCI bridge driver; again, it inherits most
  of the generic PCI-PCI bridge driver; it has it's own method for
  interrupt routing, as well as some sparc64-specific methods (one to
  get the node again, and one to adjust the bridge bus range, since
  we need to reenumerate all PCI buses).
- Convert the apb driver to the new way of handling things.
- Provide a common framework for OFW bridge drivers, used be the two
  drivers above.
- Provide a small common framework for interrupt routing (for all
  bridge types).
- Convert the psycho driver to the new framework; this gets rid of a
  bunch of old kludges in pci_read_config(), and the whole
  preinitialization  (ofw_pci_init()).
- Convert the ISA MD part and the EBus driver to the new way
  interrupts and nodes are handled.
- Introduce types for firmware interrupt properties.
- Rename the old sparcbus_if to ofw_pci_if by repo copy (it is only
  required for PCI), and move it to a more correct location (new
  support methodsx were also added, and an old one was deprecated).
- Fix a bunch of minor bugs, perform some cleanups.

In some cases, I introduced some minor code duplication to keep the
new code clean, in hopes that the old code will be unifdef'ed soon.

Reviewed in part by:	imp
Tested by:	jake, Marius Strobl <marius@alchemy.franken.de>,
		Sergey Mokryshev <mokr@mokr.net>,
		Chris Jackman <cjackNOSPAM@klatsch.org>
Info on u30 firmware provided by:	kris
2003-07-01 14:52:47 +00:00
Mike Heffner
6d1c16554d Add PnP PS/2 id for Dell Latitude X200.
PR:		48516
MFC after:	2 weeks
2003-07-01 14:41:16 +00:00
Thomas Moestl
5905e65b56 Some gem and hme hardware bogusly has the intpin register hardwired to
0; detect this case and correct it. While being there, clean up nearby
comments.
2003-07-01 14:11:04 +00:00
Thomas Moestl
3920999db7 Add a new PCI interface method, assign_interrupt, to determine the
interrupt to be used for a device. This is intended solely for internal
use of PCI bus implementations, and exists so that PCI bus drivers
implementing special interrupt assignment methods which require
additional work at the bus level to work right can be easily derived
from the generic driver (or any other one) without resorting to hacks.

It will be used in the sparc64 ofw_pcibus driver, which will be
committed shortly.

Make use of this method in the generic implementation, and add it to
the method table of bus drivers derived from the PCI one.

Reviewed by:	imp, -hackers
2003-07-01 14:08:33 +00:00
Thomas Moestl
036c2cfbfa Allow to write the intpin ivar using the pci_set_intpin() accessor. There
are some Sun PCI devices around which bogusly set intpin to 0, although
they use the intline mechanism; this allows the device driver to correct
that.

Reviewed by:	imp
2003-07-01 13:54:10 +00:00
Josef Karthauser
5d37567d73 Regen. 2003-07-01 12:17:18 +00:00
Josef Karthauser
4f1e4d55e7 USB scanner support for Mustek BearPaw scanner.
Submitted by:	netchild
2003-07-01 12:16:46 +00:00
Hidetoshi Shimokawa
2c56e6e419 Fix tsleep/wakup race on FreeBSD-4. 2003-07-01 12:03:54 +00:00
Josef Karthauser
6b38550512 Regen. 2003-07-01 08:46:55 +00:00
Josef Karthauser
702966f238 Support the Epson GT-9300UF usb scanner.
PR:		kern/53929
2003-07-01 08:46:01 +00:00
Greg Lehey
8517ec8be1 free_drive: Free the drive even if it's referenced. I don't know what
I was smoking when I wrote this stuff, but another fix resulted in
every partition in the system being entered as a "referenced" drive.
2003-07-01 07:53:54 +00:00
Alan Cox
c53e8c5654 Modify vm_page_alloc() and vm_page_select_cache() to allow the page that
is returned by vm_page_select_cache() to belong to the object that is
already locked by the caller to vm_page_alloc().
2003-07-01 07:33:41 +00:00
Alan Cox
8526ce9b64 Check the address provided to vm_map_stack() against the vm map's maximum,
returning an error if the address is too high.
2003-07-01 03:57:25 +00:00
Christian Brueffer
89a14234bd Add the beastie_disable variable which allows to turn the beastie
boot menu on and off.

Reviewed by:	scottl
2003-07-01 01:03:32 +00:00
Ruslan Ermilov
bc80c08e61 bsd.lib.mk,v 1.143 no longer uses ld(1) directly to strip
symbols from intermediate object files, so these hacks to
get AMD64 compile are no longer needed.

Tested on:	sledge.FreeBSD.org
2003-06-30 19:08:49 +00:00
Ruslan Ermilov
6c874d4fa8 Switch to using bsd.prog.mk; this gives us back the standard
.s.o transformation rule.
2003-06-30 14:10:58 +00:00
David Xu
df9c6cda37 Fix typo. 2003-06-30 10:04:04 +00:00
Hidetoshi Shimokawa
170e7a20d0 Include file clean up. 2003-06-30 06:33:18 +00:00
Sam Leffler
3d238d9e98 nitpicking
Submitted by:	Ruslan Ermilov <ru@FreeBSD.org>
2003-06-30 05:25:36 +00:00
Sam Leffler
d8409aaf6e consolidate callback optimization check in one location by adding a flag
for crypto operations that indicates the crypto code should do the check
in crypto_done

MFC after:	1 day
2003-06-30 05:09:32 +00:00
Sam Leffler
5d1dbc0e55 correct transfer statistics
Submitted by:	Larry Baird <lab@gta.com>
MFC after:	1 day
2003-06-30 05:05:19 +00:00
Sam Leffler
5f3721d5ca acknowledge the contribution of Atsushi Onoe 2003-06-30 04:51:11 +00:00
Ruslan Ermilov
c173771625 MFi386: revision 1.16. 2003-06-30 00:20:28 +00:00
Ruslan Ermilov
40205a0623 Revision 1.13, besides its useful part, replaced bsd.prog.mk by
bsd.lib.mk and thus broke the build since AFLAGS were not taken
into considered anymore, as bsd.lib.mk currently has wrong .s.o
rule that uses cc(1) instead of as(1).

Revision 1.14 reverted to using as(1), and revision 1.15 brought
AFLAGS back to the business, but revision 1.14 also broke "make
clean".

To fix this, but not break anything that was fixed in revisions
1.13-1.15, we revert mostly to revision 1.13 except for switching
back to using bsd.prog.mk.  This gives us back the default .s.o
rule from sys.mk that uses as(1), and fixes "make clean" by
restoring the full contents of OBJS.

Also fixed LDFLAGS.
2003-06-30 00:15:38 +00:00
Sam Leffler
82a6d6aca5 plug xform memory leaks:
o add missing zeroize op when deleting an SA
o don't re-initialize an xform for an SA that already has one

Submitted by:	Doug Ambrisko <ambrisko@verniernetworks.com>
MFC after:	1 day
2003-06-29 23:58:38 +00:00
Alan Cox
0551c08dee Introduce vm_map_pmap_enter(). Presently, this is a stub calling the MD
pmap_object_init_pt().
2003-06-29 23:32:55 +00:00
Alan Cox
dca96f1adc - Export pmap_enter_quick() to the MI VM. This will permit the
implementation of a largely MI pmap_object_init_pt() for vnode-backed
   objects.  pmap_enter_quick() is implemented via pmap_enter() on sparc64
   and powerpc.
 - Correct a mismatch between pmap_object_init_pt()'s prototype and its
   various implementations.  (I plan to keep pmap_object_init_pt() as
   the MD hook for device-backed objects on i386 and amd64.)
 - Correct an error in ia64's pmap_enter_quick() and adjust its interface
   to match the other versions.  Discussed with: marcel
2003-06-29 21:20:04 +00:00
Christian Brueffer
3db879acd2 Capitalize an occurrence of 'ficl' for consistency.
Submitted by:	Andre Guibert de Bruet <andy@siliconlandmark.com>
MFC after:	3 days
2003-06-29 20:57:55 +00:00
Sam Leffler
91f243876f catch failure to fetch the card's "own channel"; this should not happen 2003-06-29 20:14:35 +00:00
Sam Leffler
58f40303c4 insure ic_bss always has a "valid" channel; avoids problems where users could
query the state of a card and find a null channel since allocating the node
left ni_chan zero
2003-06-29 20:13:38 +00:00
Sam Leffler
b9ee58c4af use proper length to copy data for WI_RID_DESIRED_SSID (was smashing
ic_des_chan that immediately follows)
2003-06-29 20:12:17 +00:00
Sam Leffler
8be0d57010 add safeguard against (bogus) null channel parameter 2003-06-29 20:10:54 +00:00
Alan Cox
0774dfb376 Add vm object locking to vm_pageout_map_deactivate_pages(). 2003-06-29 19:51:24 +00:00
Bill Paul
2e7c2f97aa In order to set the MAC address on RealTek NICs, you must flip WRITECFG
bit in the EEPROM mode register on. Also, the address must be written
in two 32-bit register accesses instead of 6 8-bit accesses.

Tested with my 8139B cardbus NIC.

PR:	kern/35900
Submitted by:	Mark Kettenis <kettenis@chello.nl>
2003-06-29 17:33:33 +00:00
Marcel Moolenaar
25ae78c736 Implement fuword32() and suword32(). These functions are used in
kern_thread.c. This is a best effort implementation.
2003-06-29 17:14:42 +00:00
John Polstra
602c788942 Bump __FreeBSD_version because the semantics of sigtimedwait and
sigwaitinfo have been corrected.  Some existing code relied on the
original broken semantics.
2003-06-29 15:51:38 +00:00
Alan Cox
269acda954 - Remove the calls to pmap_install() from pmap_object_init_pt(); they are
redundant.  Discussed with: marcel
 - MFi386: Add vm object locking to pmap_object_init_pt().
2003-06-29 06:10:32 +00:00
Tim J. Robbins
ae620d4480 XXX Copy workaround from UFS: open device for write access even if
the user requests a read-only mount. This is necessary because we
don't do the VOP_OPEN again if they upgrade a read-only mount to
read-write.

Fixes lockup when creating files on msdosfs mounts that have been
mounted read-only then upgraded to read-write. The exact cause of
the lockup is not known, but it is likely to be the kernel getting
stuck in an infinite loop trying to write dirty buffers to a device
without write permission.

Reported/tested by andreas, discussed with phk.
2003-06-29 03:05:59 +00:00
Peter Grehan
fd05df3205 Allow the interrupt controller to be probed - this picks up the
Heathrow PIC, while not affecting the OpenPIC.
2003-06-29 02:05:19 +00:00
Bill Paul
ac8824dbea Modify the xl_reset() routine slightly so that, if we're using memory
mapped I/O mode, we pause for .1 seconds after issuing the reset command
before trying to poll the 'command busy' bit in the status register.
With my 3c575C cardbus NIC, my Sony Picturebook locks up when it tries
to read the status register immediately after the reset. This appears
to be a problem only with certain NICs on certain hardware, but the
added delay should not hurt cards that already work.

This bug seems to have been brought to light by the fact that the xl
driver now defaults to memory mapped I/O mode instead of programmed
I/O mode like it used to. With PIO mode, the delay isn't needed and
everything works (which is why this NIC worked with 5.0-RELEASE but
not 5.1). I suspect that what's happening is that when the chip is
reset, it takes a little while for the memory-mapped decoding logic
to recover. Trying to access the chip's registers during this period
causes an error condition of some kind that wedges the system.
2003-06-29 01:38:57 +00:00
Jeff Roberson
ab875ef896 - Construct a cpu topology map for Hyper Threading systems so that ULE may
take advantage of them.
2003-06-28 22:07:42 +00:00
Jeff Roberson
107902b895 - Add structures for defining cpu topologies more complex than SMP.
smp_topology may be left NULL by architectures which have vanilla SMP
   setups.
2003-06-28 22:06:19 +00:00
Alan Cox
8e1e7b93b3 Remove GIANT_REQUIRED from kmem_malloc(). 2003-06-28 22:04:52 +00:00
Thomas Moestl
d462b4f058 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.

Desired by:	dwhite (1)
2003-06-28 21:52:16 +00:00
Alan Cox
4a309ab44c MFi386
Add vm object locking to pmap_object_init_pt().
2003-06-28 21:21:04 +00:00
Alan Cox
5163584c7e - Add vm object locking to vm_pageout_clean(). 2003-06-28 20:07:54 +00:00
Marcel Moolenaar
4e4422d4d4 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.

Reviewed by: deischen
2003-06-28 19:45:15 +00:00
Marcel Moolenaar
19acf030a2 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
2003-06-28 19:32:07 +00:00
Sam Leffler
d7648a8288 update to new 802.11 support 2003-06-28 17:57:30 +00:00
Luigi Rizzo
5d3b4c2480 Remove a stale comment, fix indentation. 2003-06-28 14:23:22 +00:00
Luigi Rizzo
b5f3c4cff3 whitespace fix 2003-06-28 14:16:53 +00:00
Bernd Walter
7d83324cdc enable interrupt routing for mcpcia based systems
Reviewed by:	mjacob, gallatin
2003-06-28 13:47:23 +00:00
Yoshihiro Takahashi
1824eaaff5 MFi386: revision 1.566. 2003-06-28 12:35:46 +00:00
Hidetoshi Shimokawa
630529ad1e 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.
2003-06-28 11:11:36 +00:00
Marcel Moolenaar
d9a4740f18 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!
2003-06-28 09:22:25 +00:00
Jeff Roberson
7a20304f84 - Don't migrate to stopped cpus. 2003-06-28 09:09:33 +00:00
Peter Grehan
c8718f79da Hook grackle system controller/heathrow interrupt controller to PPC build. 2003-06-28 08:53:49 +00:00
Peter Grehan
bd687ebf3b A module to handle the interrupt controller on Heathrow/Paddington
MacIO chips, found on older Mac G3's.
2003-06-28 08:52:49 +00:00
Peter Grehan
4b7624a5f7 A module for the Motorola MPC106 system controller aka 'Grackle'
found on older Mac G3's.
2003-06-28 08:51:22 +00:00
David Xu
9dde3bc999 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.

Reviewed by: julian (mentor)
2003-06-28 08:29:05 +00:00
Jeff Roberson
86f8ae9663 - If smp is not started yet don't try to load balance or we'll put threads
on cpus that aren't running yet.
2003-06-28 08:24:42 +00:00
David Xu
418228df24 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.
2003-06-28 08:03:28 +00:00
Ruslan Ermilov
cf8603ce44 Attach the amd(4) module to the i386 and pc98 builds only;
untested on other platforms.

Not objected to by:	scottl
2003-06-28 08:01:27 +00:00
Alan Cox
baaaadf125 - 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.
2003-06-28 07:58:10 +00:00
David Xu
b8f480ab94 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.

Reviewed by: julian
2003-06-28 06:34:08 +00:00
Jeff Roberson
a91172ade1 - 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.
2003-06-28 06:19:56 +00:00
Sam Leffler
0ba9760820 switch to new 802.11 support 2003-06-28 06:19:01 +00:00
Sam Leffler
81e151e45f hookup ath and ath_hal to the build 2003-06-28 06:18:37 +00:00
Sam Leffler
2c71d3c795 update for new 802.11 support 2003-06-28 06:17:26 +00:00
Sam Leffler
e889f37ea3 switch to new 802.11 support 2003-06-28 06:12:41 +00:00
Sam Leffler
77882f20ef remove old 802.11 support; replaced by new code in sys/net80211 2003-06-28 06:09:39 +00:00
Scott Long
7f95801188 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.

Reminded by:	peter
2003-06-28 06:07:06 +00:00
Jeff Roberson
e493a5d90c - 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.
2003-06-28 06:04:47 +00:00
Scott Long
ce17576a80 Announce umct to kernel build. 2003-06-28 05:47:34 +00:00
Scott Long
c31c852372 Hook umct up to the module tree. 2003-06-28 05:46:16 +00:00
Scott Long
871f5c8c2d 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.
2003-06-28 05:45:55 +00:00
Justin T. Gibbs
dcc9985adf 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.
2003-06-28 04:46:54 +00:00
Justin T. Gibbs
4294c2dc56 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.
2003-06-28 04:45:25 +00:00
Justin T. Gibbs
83441ad3bb Use clr instead of an explicit mov from ALLZEROS
to clear SCB_FIFO_USE_COUNT.  This is just a
syntactic change.
2003-06-28 04:44:10 +00:00
Justin T. Gibbs
1220a072a6 Implement ahd_inq_scbram() and change the implemention
of ahd_inl_scbram to use ahd_inw_scbram instead of
ahd_inb_scbram().
2003-06-28 04:43:19 +00:00
Justin T. Gibbs
b598de8f92 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.
2003-06-28 04:42:11 +00:00
Justin T. Gibbs
e46bab9aea 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.
2003-06-28 04:40:46 +00:00
Justin T. Gibbs
c8ee71777e 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.
2003-06-28 04:39:49 +00:00
Peter Wemm
b6a5f89b4d Turn ips back on. 2003-06-27 23:11:22 +00:00
Peter Wemm
f472527c95 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.

Glanced at by:  scottl
2003-06-27 23:10:58 +00:00
Peter Wemm
eabd19726f Tidy up leftover lazy_switch instrumentation that is no longer needed.
This cleans up some #ifdef hell.
2003-06-27 22:39:14 +00:00
Peter Wemm
813b1b3df7 *groan*. I can't win today. Fix manual transcription error so that the
PAE ifdef is correct.

Pointy hat assigned by:  kan
2003-06-27 22:20:18 +00:00
Peter Wemm
48eceb6213 Make LAZY_SWITCH work with PAE 2003-06-27 22:13:30 +00:00
Nate Lawson
464c662efa 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.
2003-06-27 21:57:42 +00:00
Peter Wemm
b50953ccfa Fix the false IPIs on smp when using LAZY_SWITCH caused by pmap_activate()
not releasing the pm_active bit in the old pmap.
2003-06-27 21:50:52 +00:00
Sam Leffler
1bb98f3b7b 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).
2003-06-27 20:10:03 +00:00
Sam Leffler
07d0c94a46 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.
2003-06-27 20:07:10 +00:00
Alan Cox
23252eeabe 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().
2003-06-27 18:52:49 +00:00
John Baldwin
fcccbacd7e Sort the list of PCI ID's in numerical order and fix a whitespace bogon. 2003-06-27 18:17:06 +00:00
Tom Rhodes
c2f95f6688 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
2003-06-27 15:46:38 +00:00
Peter Grehan
09bf574a28 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.

Approved by: sos
Obtained from: NetBSD
2003-06-27 10:11:54 +00:00
Sean Kelly
6cda41555b Fix this to build on alpha. Build test successful.
Suggested fix from:	tjr
2003-06-27 08:35:05 +00:00
Scott Long
3eaffdf7e0 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.

Reviewed by:	mostly silence on arch@
2003-06-27 08:31:48 +00:00
Sam Leffler
7535e66acd revise copyright notices per discussion with Atsushi Onoe <onoe@sm.sony.co.jp> 2003-06-27 05:13:52 +00:00
Warner Losh
60c64b939b 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.

Submitted by: wpaul and iedowse
2003-06-27 03:25:43 +00:00
Sam Leffler
c032abb595 fix typo
Submitted by:	"Norman Diamond \(ITS\)" <n_diamond@its.jp>
2003-06-27 02:53:00 +00:00
Sam Leffler
3cd0b4fd09 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>
2003-06-27 00:49:04 +00:00
Hidetoshi Shimokawa
740b10aaa9 - Use fwohci_poll() instead of fwohci_intr() to process the first bus reest.
- Wait 2 cycles before starting the process for fast machines.
2003-06-27 00:27:33 +00:00
Sam Leffler
a296d8af2f add comment 2003-06-26 22:11:19 +00:00
Maxime Henrion
e542f156cc Other minor style nits I missed in ep_if_start() in my previous
commit.
2003-06-26 17:02:52 +00:00
Alan Cox
9f2b1758c3 vm_page_select_cache() enforces a number of conditions on the returned
page.  Add the ability to lock the containing object to those conditions.
2003-06-26 15:44:03 +00:00
Maxime Henrion
52eec71b80 Make if_ep_start() look a bit more like other if_start() functions,
by calling the first mbuf in the chain m0 and fixing a few nearby
style bugs, mostly s/0/NULL/.
2003-06-26 14:28:35 +00:00
Maxime Henrion
c7d24cc1a2 Fix a race condition that was introduced since pccbb interrupts are
flag'ed INTR_MPSAFE.  In ep_if_start(), use the IF_DEQUEUE macro to
grab the next mbuf to send, and use IF_PREPEND if the card is busy
and we actually can't handle it right now.

The old code was first getting the mbuf by taking it from the queue
without using the macros, thus without locking, and without removing
it from the queue either.  It was later assuming that IF_DEQUEUE would
give him this same mbuf.

Tested by:	mich
2003-06-26 13:27:44 +00:00
Matthew N. Dodd
f1e875be01 Set a lower bound on fragment size rather than returning a failure
when the user specifies a maximum fragment size < 2.

This is the behavior that Linux provides and fixes the problem I've
observed in Tribes2 where sounds effects are delayed by 1/2 a second.
2003-06-26 13:13:18 +00:00
Sean Kelly
370c3cb57c - Add a software watchdog facility.
This commit has two pieces. One half is the watchdog kernel code which lives
primarily in hardclock() in sys/kern/kern_clock.c. The other half is a userland
daemon which, when run, will keep the watchdog from firing while the userland
is intact and functioning.

Approved by:	jeff (mentor)
2003-06-26 09:50:52 +00:00
Ruslan Ermilov
61340e72c4 Attach the "null" module to the LINT build.
Reviewed by:	markm
2003-06-26 08:06:31 +00:00
Peter Wemm
1e5d8b3b66 Oops, I only added a comment about why ips doesn't compile. Actually
comment it out for real.
2003-06-26 04:01:59 +00:00
Paul Saab
be241f79bb Give the correct size for the command map to busdma. 2003-06-26 04:01:34 +00:00
Peter Wemm
6833c6add5 Revert exclusion for amd64 that stopped boot/ being built. 2003-06-26 03:52:48 +00:00
Peter Wemm
062b3e0c77 Build on amd64. Yes, I know this isn't particularly nice. 2003-06-26 03:51:57 +00:00
Peter Wemm
ba1cabf4b9 Sync with i386 - add everything that compiles. There are a few drivers
that are trivially easy to fix (eg: ips) that I've not committed fixes for.
2003-06-26 03:49:54 +00:00
Alan Cox
2099bdfded Modify vm_pageq_requeue() to handle a PQ_NONE page without dereferencing
a NULL pointer; remove some now unused code.
2003-06-26 03:14:40 +00:00
Peter Wemm
098f057be8 Add amd64 support. 2003-06-26 01:10:24 +00:00
Peter Wemm
2d29639ebb Add back in the ability for pmap_mapdev() to use KVM if the region
being requested is outside of the range of the direct map region.  eg:
for pci windows.  While here, increase the minimum size of the direct
map region to be 4GB instead of 1GB.
2003-06-26 01:04:31 +00:00
Scott Long
dea4622d59 - Zero the buffers used to hold configuration data from the card. Not doing
so can leave stale data in the buffer and confuse the driver.
- enable the ability to set the 'disable' hint for the driver to keep it
  from attaching.  i.e. 'hw.ips.0.disable=1' will prevent the driver from
  attaching.
- Only detach if attach suceeded.

Submitted by: mjacob
2003-06-26 00:03:59 +00:00
Josef Karthauser
3305fa5359 Regen. 2003-06-25 22:56:13 +00:00
Josef Karthauser
59f2899384 Added some new devices and made slight changes to some existing ones.
Submitted by:	Andre Guibert de Bruet <andy@siliconlandmark.com>
2003-06-25 22:50:57 +00:00
Warner Losh
4f2073fb4c Fix leap second processing by the kernel time keeping routines.
Before, we would add/subtract the leap second when the system had been
up for an even multiple of days, rather than at the end of the day, as
a leap second is defined (at least wrt ntp).  We do this by
calculating the notion of UTC earlier in the loop, and passing that to
get it adjusted.  Any adjustments that ntp_update_second makes to this
time are then transferred to boot time.  We can't pass it either the
boot time or the uptime because their sum is what determines when a
leap second is needed.  This code adds an extra assignment and two
extra compare in the typical case, which is as cheap as I could made
it.

I have confirmed with this code the kernel time does the correct thing
for both positive and negative leap seconds.  Since the ntp interface
doesn't allow for +2 or -2, those cases can't be tested (and the folks
in the know here say there will never be a +2s or -2s leap event, but
rather two +1s or -1s leap events).

There will very likely be no leap seconds for a while, given how the
earth is speeding up and slowing down, so there will be plenty of time
for this fix to propigate.  UT1-UTC is currently at "about -0.4s" and
decrementing by .1s every 8 months or so.  6 * 8 is 48 months, or 4
years.

-stable has different code, but a similar bug that was introduced
about the time of the last leap second, which is why nobody has
noticed until now.

MFC After: 3 weeks
Reviewed by: phk

"Furthermore, leap seconds must die." -- Cato the Elder
2003-06-25 21:23:51 +00:00
Julian Elischer
722a139cfa Fix a comment
MFC after:	1 day
2003-06-25 20:58:35 +00:00
Warner Losh
eac3c62b51 During a positive leap second, the tai_time offset should be
incremented at the start of the leap second, not after the leap second
has been inserted.  This is because at the start of the leap second,
we set the time back one second.  This setting back one second is the
moment that the offset changes.  The old code set it back after the
leap second, but that's one second too late.  The negative leap second
case is handled correctly.

Reviewed by: phk
2003-06-25 20:56:40 +00:00
Bosko Milekic
d88797c2ba Move the pcpu lock out of the uma_cache and instead have a single set
of pcpu locks.  This makes uma_zone somewhat smaller (by (LOCKNAME_LEN *
sizeof(char) + sizeof(struct mtx) * maxcpu) bytes, to be exact).

No Objections from jeff.
2003-06-25 20:49:48 +00:00
Matthew N. Dodd
17d7127c64 Set pointers to NULL after free() to prevent multiple free().
PR:		 kern/48808
Submitted by:	 Eugene Grosbein <eugen@grosbein.pp.ru>
2003-06-25 19:58:38 +00:00
Sam Leffler
1300bbb70e fix tcpdump -y IEEE802_11; NBPFILTER was a holdover from netbsd compatibility 2003-06-25 17:42:36 +00:00
Bosko Milekic
5c133dfa0e Make sure that the zone destructor doesn't get called twice in
certain free paths.
2003-06-25 17:25:45 +00:00
Yoshihiro Takahashi
3644d2744a MFi386: revision 1.446. 2003-06-25 15:19:04 +00:00
Sam Leffler
2dd59091ae add "autoselect" mode and "auto" alias: these let you reset the
"phy mode" to an auto-selecting mode, as opposed to one where
you're locked to a particular one (e.g. 11a for 802.11)
2003-06-25 15:03:05 +00:00
Sam Leffler
167f409fd6 config+build glue for Atheros support 2003-06-25 14:51:20 +00:00
Sam Leffler
a826874f28 add "no RNG support options" for ubsec and hifn drivers 2003-06-25 14:49:24 +00:00
Sam Leffler
e61a4ae50c o correct mib spelling: reset -> retest
o add #ifdef's needed to share code directly with -stable
2003-06-25 14:46:01 +00:00
Sam Leffler
b52f49a9a0 module for atheros hal 2003-06-25 14:43:50 +00:00
Olivier Houchard
995df2fc9f Fix some style bugs. 2003-06-25 13:33:41 +00:00
Olivier Houchard
7f3bfd6651 At this point targp will always be NULL, so remove the useless if. 2003-06-25 13:28:32 +00:00
Hartmut Brandt
02152e8f90 Make the netgraph ATM node compilable into the kernel. 2003-06-25 13:21:04 +00:00
Hartmut Brandt
cfca62bfac This is a netgraph node to access ATM interfaces. It works with the
hatm(4) and fatm(4) drivers, en(4) will follow soon.
2003-06-25 13:20:19 +00:00
Poul-Henning Kamp
934a35c329 Remove an '_' which was surplus to requirements. 2003-06-25 08:30:45 +00:00
Peter Grehan
f209c40211 Remove unused bootpath[] variable. It conflicted with a declaration
in the sunlabel utility, causing build problems.
2003-06-25 08:11:29 +00:00
Sam Leffler
92b901ac4d This commit was generated by cvs2svn to compensate for changes in r116801,
which included commits to RCS files with non-trunk default branches.
2003-06-25 06:06:52 +00:00
Sam Leffler
d9d1087cff Initial import of Atheros Hardware Access Layer (HAL) 2003-06-25 06:06:52 +00:00
Alan Cox
95018011e5 Remove a GIANT_REQUIRED on the kernel object that we no longer need. 2003-06-25 05:31:02 +00:00
Alan Cox
dd5e55f872 Maintain the lock on a vm object when calling vm_page_grab(). 2003-06-25 04:53:56 +00:00
John-Mark Gurney
4119b6e581 change dev_t to struct cdev * to match ufs. This fixes fstat for cd9660
and msdosfs.

Reviewed by:	bde
2003-06-24 22:11:20 +00:00
John-Mark Gurney
090ef7b377 remove unnecessary comment. We do what the comments says we need to. 2003-06-24 21:37:49 +00:00
Poul-Henning Kamp
85cefd1dc0 /dev/null and /dev/zero does not need Giant 2003-06-24 19:50:48 +00:00
Alan Cox
a8ab48702b Assert that the vm object is locked on entry to dev_pager_getpages(). 2003-06-24 19:48:34 +00:00
Ian Dowse
92daf89227 Fix a bug in nfsrv_read() that caused the replies to certain NFSv3
short read operations at the end of a file to not have the "eof"
flag set as they should. The problem is that the requested read
count was compared against the rounded-up reply data length instead
of the actual reply data length. This bug appears to have been
introduced in revision 1.78 (June 1999). It causes first-time reads
of certain file sizes (e.g 4094 bytes) to fail with EIO on a RedHat
9.0 NFSv3 client.

MFC after:	1 week
2003-06-24 19:04:26 +00:00
Ian Dowse
7a07b896c5 The ext2fs module needs a machine-dependent bitops.h file, so only
build it on the i386 and alpha architectures, where this has been
set up (there is also a sparc64-bitops.h in sys/gnu/ext2fs, but it
appears to be broken and it is not linked up).

This should unbreak the sparc64 LINT build.
2003-06-24 13:35:46 +00:00
Luigi Rizzo
9c1cfc8650 remove unused file (ipfw2 is the default in RELENG_5 and above; the old
ipfw1 has been unused and unmaintained for a long time).
2003-06-24 07:12:11 +00:00
Nate Lawson
05fb8c3f73 Drop locks before calling if_input() since it may re-enter fxp_start()
in the netisr case. This would result in a lock reversal.  This
fixes the net.isr.enable=1 case.  Better performance might be
obtained by chaining all packets received, dropping the lock, and
then calling if_input() on each one.

Reported by:	hmp
2003-06-23 23:23:49 +00:00
Justin T. Gibbs
f5db59f9d6 Add parenthesis so that we get all of the bits all
of the contents of the CCSCBCTL register into our
local varaible.  The other bits are used in later tests.
This avoids a potential deadlock in ahd_run_qoutfifo()
if we happen to catch the DMA engine in just the right
state.
2003-06-23 22:06:34 +00:00
Ian Dowse
ce3ae5c7e3 Include the ufs module if ALL_MODULES is defined so that it gets
built by LINT. Also override a number of knobs for enabling and
disabling various modules in the ALL_MODULES case to further increase
LINT's module coverage.

Submitted by:	ru
2003-06-23 22:01:01 +00:00
Luigi Rizzo
ec4270c021 Fix typo in a (commented out) debugging string.
Spotted by: diff
2003-06-23 21:38:21 +00:00
Luigi Rizzo
67ab48d1ae Remove whitespace at end of line. 2003-06-23 21:18:56 +00:00
Matthew N. Dodd
26a9ce3e36 Hook up scd(4) to the build.
Noticed by:	 ru
2003-06-23 20:52:03 +00:00
Warner Losh
4e82e5f6f1 Use UTC rather than GMT to describe time scale. latter is obsolete. 2003-06-23 20:14:08 +00:00
Ian Dowse
620d309e35 Add a few missing opt_ files to make this module compile again. 2003-06-23 19:41:00 +00:00
Nate Lawson
f47e25c34e Fix a bug in register access. This should fix warning messages of:
ACPI-0340: *** Error: Could not release ACPI Global Lock, AE_BAD_PARAMETER

Submitted by:	jhb
2003-06-23 17:38:38 +00:00
Nate Lawson
121053bff9 This commit was generated by cvs2svn to compensate for changes in r116748,
which included commits to RCS files with non-trunk default branches.
2003-06-23 17:38:38 +00:00
Sam Leffler
ae8afbf2dd module for Atheros 802.11 driver 2003-06-23 17:02:43 +00:00
Sam Leffler
5591b2131a Atheros 802.11 driver. Requires Atheros Hardware Access Lay (HAL).
Supported by:	Atheros Comunications
2003-06-23 17:01:19 +00:00
Sam Leffler
1a1e1d2157 new 802.11 layer:
o code reorg (relative to old netbsd-derived code) for future growth
o drivers now specify available channels and rates and 802.11 layer handles
  almost all ifmedia actions
o multi-mode support for 11a/b/g devices
o 11g protocol additions (incomplete)
o new element id additions (for other than 11g)
o node/station table redone for proper locking and to eliminate driver
  incestuousness
o split device flags and capabilities to reduce confusion and provide room
  for expansion
o incomplete power management infrastructure (need to revisit)
o incomplete hooks for software retry
o more...
2003-06-23 16:55:01 +00:00
Hartmut Brandt
9bdca35df1 Add the hooks for netgraph and HARP to the NATM code. This allows us
to use one set of drivers for all ATM upper layers.
2003-06-23 16:53:28 +00:00
Hartmut Brandt
1232acdba3 Check compatibility partitions on all archs. This makes vinum
work on sparc64 again, because on sparc i386-compatibility
partitions just happen to have the same name as sparc native partitions.

Okay-ed by: grog@
2003-06-23 14:49:57 +00:00
Hartmut Brandt
fb24f088ae This is a driver for Fore PCA200E cards that uses busdma and works on
little endian and big endian and with 32 and 64 bit pointers. It already
has the hooks to be used for HARP, NATM and ngATM.
2003-06-23 14:46:12 +00:00
Matthew N. Dodd
829ecb807f Add a PCI ID for the Apollo Pro 133A.
PR:		 kern/46983
Submitted by:	 David Holm <david@realityrift.com>
2003-06-23 11:15:22 +00:00
Matthew N. Dodd
b02d3a97f8 Add PCI IDs for the i82855 and i82875P AGP bridges.
PR:		 i386/53136, i386/51802
Submitted by:	 Kyunghwan Kim <redjade@atropos.snu.ac.kr>, Norikatsu Shigemura <nork@FreeBSD.org>
2003-06-23 11:09:45 +00:00
Hartmut Brandt
76335e1302 Apply style(9) to this file. I'm going to touch large parts of this file
so make this beforehand.
2003-06-23 10:32:13 +00:00
Alan Cox
f566a0b6ba Assert that the vm object is locked on entry to vm_pager_get_pages(). 2003-06-23 06:15:05 +00:00
Alan Cox
0183359659 MFi386
Add vm object locking to pmap_object_init_pt().
2003-06-23 06:10:52 +00:00
John-Mark Gurney
e3f932de5a prevent the number of patterns from exceeding the number of pci devices.
Submitted by:	rwatson
2003-06-23 03:17:03 +00:00
John-Mark Gurney
d08239c1f7 cleanup /dev/pci code some:
read permision only required for listing, read/write required for
		read/write to registers
	fix a possible memory leak
	clean up error handling a bit

Reviewed by:	silence
2003-06-23 02:11:16 +00:00
Robert Watson
f51e58036e Redesign the externalization APIs from the MAC Framework to
the MAC policy modules to improve robustness against C string
bugs and vulnerabilities.  Following these revisions, all
string construction of labels for export to userspace (or
elsewhere) is performed using the sbuf API, which prevents
the consumer from having to perform laborious and intricate
pointer and buffer checks.  This substantially simplifies
the externalization logic, both at the MAC Framework level,
and in individual policies; this becomes especially useful
when policies export more complex label data, such as with
compartments in Biba and MLS.

Bundled in here are some other minor fixes associated with
externalization: including avoiding malloc while holding the
process mutex in mac_lomac, and hence avoid a failure mode
when printing labels during a downgrade operation due to
the removal of the M_NOWAIT case.

This has been running in the MAC development tree for about
three weeks without problems.

Obtained from:	TrustedBSD Project
Sponsored by: DARPA, Network Associates Laboratories
2003-06-23 01:26:34 +00:00
Robert Watson
6b42f0a2eb Prefer the vop_rmextattr() vnode operation for removing extended
attributes from objects over vop_setextattr() with a NULL uio; if
the file system doesn't support the vop_rmextattr() method, fall
back to the vop_setextattr() method.

Obtained from:	TrustedBSD Project
Sponsored by:	DARPA, Network Associates Laboratories
2003-06-22 23:03:07 +00:00
Robert Watson
77533ed2aa Expose vop_rmextattr as an explicit operation at the vnode operation
interface, rather than relying on a NULL uio for the deletion
operation.

Obtained from:	TrustedBSD Project
Sponsored by:	DARPA, Network Associates Laboratories
2003-06-22 22:45:24 +00:00
Robert Watson
4b090e41ff Add an explicit credential argument to alq_open() to allow the caller to
specify what credential to use when authorizing vn_open() and later
write operations, rather than curthread->td_ucred.

When writing KTR traces to an ALQ, specify the credential of the thread
generating the sysctl request.

Obtained from:	TrustedBSD Project
Sponsored by:	DARPA, Network Associates Laboratories
2003-06-22 22:28:56 +00:00
Alan Cox
f29ba63ec9 Maintain a lock on the vm object of interest throughout vm_fault(),
releasing the lock only if we are about to sleep (e.g., vm_pager_get_pages()
or vm_pager_has_pages()).  If we sleep, we have marked the vm object with
the paging-in-progress flag.
2003-06-22 21:35:41 +00:00
Don Lewis
7144b1d4bd Don't check the state of the vnode interlock if the specification says
that the lock should not be checked.

Skip the lock assertion checks for *vpp or any other pointer to a vnode
pointer if vpp (or equivalent) is NULL.
2003-06-22 21:20:06 +00:00
Ruslan Ermilov
46205431f9 Protect against .depend file somewhere else in the .PATH.
Also consolidate building rules for special files.
2003-06-22 17:57:56 +00:00
Luigi Rizzo
44c884e134 Add support for multiple values and ranges for the "iplen", "ipttl",
"ipid" options. This feature has been requested by several users.
On passing, fix some minor bugs in the parser.  This change is fully
backward compatible so if you have an old /sbin/ipfw and a new
kernel you are not in trouble (but you need to update /sbin/ipfw
if you want to use the new features).

Document the changes in the manpage.

Now you can write things like

	ipfw add skipto 1000 iplen 0-500

which some people were asking to give preferential treatment to
short packets.

The 'MFC after' is just set as a reminder, because I still need
to merge the Alpha/Sparc64 fixes for ipfw2 (which unfortunately
change the size of certain kernel structures; not that it matters
a lot since ipfw2 is entirely optional and not the default...)

PR: bin/48015

MFC after: 1 week
2003-06-22 17:33:19 +00:00
Robert Watson
16fd30bd2a Forward declare a boatload of structures referenced in the MAC
policy definition structure; this permits policies to reduce their
number of gratuitous includes for required for entry points they
don't implement.  This also facilitates building the MAC Framework
on Darwin.

Obtained from:	TrustedBSD Project
Sponsored by:	DARPA, Network Associates Laboratories
2003-06-22 16:36:00 +00:00
Hidetoshi Shimokawa
e07324646e Move KERNBASE to -2GB.
Currently, we cannot increase KVA more than 2GB.
2003-06-22 13:02:45 +00:00
Hidetoshi Shimokawa
bfcd2ec739 - Allow access to direct mapped region via /dev/kmem. This makes
'netstat -r' work.
- Use direct map for /dev/mem.
2003-06-22 12:59:43 +00:00
Hidetoshi Shimokawa
c1c1cc9c19 - Allocate a new PD Table if kernel grows beyond 1GB boundary.
Reviewed by: peter

- Use direct map in pmap_mapdev().
2003-06-22 12:55:20 +00:00
Poul-Henning Kamp
8198a1a472 Remove 256 unit limit, there is no evil minor number encoding to
deal with any more.

Spotted by:	"Darren Freestone" <df@cops.org>
2003-06-22 11:31:38 +00:00
Poul-Henning Kamp
3b6d965263 Add a f_vnode field to struct file.
Several of the subtypes have an associated vnode which is used for
stuff like the f*() functions.

By giving the vnode a speparate field, a number of checks for the specific
subtype can be replaced simply with a check for f_vnode != NULL, and
we can later free f_data up to subtype specific use.

At this point in time, f_data still points to the vnode, so any code I
might have overlooked will still work.
2003-06-22 08:41:43 +00:00
Matthew N. Dodd
5e4e521f76 Add ID for VT8233A.
PR:		 i386/38299
Submitted by:	 Rob Schulhof <rrs@there.net>
2003-06-22 06:50:02 +00:00
Yoshihiro Takahashi
403579314a Re-enabled PCI irq routing on pc98. 2003-06-22 06:09:14 +00:00
Alan Cox
c8567c3a77 As vm_fault() descends the chain of backing objects, set paging-in-
progress on the next object before clearing it on the current object.
2003-06-22 05:36:53 +00:00
Matthew N. Dodd
c27e9c5100 Implement a loader tunable/sysctl to allow the user to request that
the APM driver byte-swap battery time values.  (For broken laptops.)

PR:		i386/42439
Submitted by:	Bruce M Simpson <bms@spc.org>
2003-06-22 05:08:10 +00:00
Ian Dowse
adef9265ef When DDB is active, always send printf() output directly to the
console, even if there is a TIOCCONS console tty. We were already
doing this after a panic, but it's also useful when entering DDB
for some other reason too.
2003-06-22 03:20:24 +00:00
Ian Dowse
d29bf12ff8 Use a new message buffer `consmsgbuf' to forward messages to a
TIOCCONS console (e.g. xconsole) via a timeout routine instead of
calling into the tty code directly from printf(). This fixes a
number of cases where calling printf() at the wrong time (such as
with locks held) would cause a panic if xconsole is running.

The TIOCCONS message buffer is 8k in size by default, but this can
be changed with the kern.consmsgbuf_size sysctl. By default, messages
are checked for 5 times per second. The timer runs and the buffer
memory remains allocated only at times when a TIOCCONS console is
active.

Discussed on:	freebsd-arch
2003-06-22 02:54:33 +00:00
Alan Cox
7ca33ad1e8 Complete the vm object locking in vm_object_backing_scan(); specifically,
deal with the case where we need to sleep on a busy page with two vm object
locks held.
2003-06-22 02:35:06 +00:00
John-Mark Gurney
e3ee6a27a9 use a REG macro that was already defined.
Reorder how the pci probing in handled.  before adding devices, check to
see if the slot is a multi-function device to see if we should probe all
the functions.

Original idea by:	imp
2003-06-22 02:26:17 +00:00
Ian Dowse
4784a46912 Replace the code for reading and writing the kernel message buffer
with a new implementation that has a mostly reentrant "addchar"
routine, supports multiple message buffers in the kernel, and hides
the implementation details from callers.

The new code uses a kind of sequence number to represend the current
read and write positions in the buffer. This approach (suggested
mainly by bde) permits the read and write pointers to be maintained
separately, which reduces the number of atomic operations that are
required. The "mostly reentrant" above refers to the way that while
it is now always safe to have any number of concurrent writers,
readers could see the message buffer after a writer has advanced
the pointers but before it has witten the new character.

Discussed on:	freebsd-arch
2003-06-22 02:18:31 +00:00
John-Mark Gurney
dffca5a624 add support for peeking at pci busses on UltraSparc systems. This prevents
data access errors when trying to read/write to non-existant PCI devices.

fix the psycho bridge to use peek for probing devices.  This no longer
fakes it if the OFW node doesn't exist (and the reg == 0).

Reviewed by:	jake, tmm
2003-06-22 01:26:08 +00:00
Alan Cox
d98ddc4615 Make some style and white-space changes to the copy-on-write path through
vm_fault(); remove a pointless assignment statement from that path.
2003-06-22 00:00:11 +00:00
Kirk McKusick
98530110a2 Increase the size of the NFS server hash table to improve performance
when serving up more than about 32 active files. For details see
section 6.3 (pg 111) of Daniel Ellard and Margo Seltzer, ``NFS
Tricks and Benchmarking Traps'' in the Proceedings of the Usenix
2003 Freenix Track, June 9-14, 2003 pg 101-114.

Obtained from:	Daniel Ellard <ellard@eecs.harvard.edu>
Sponsored by:   DARPA & NAI Labs.
2003-06-21 21:01:44 +00:00
Poul-Henning Kamp
a6af4ff136 Use a do {...} while (0); and a couple of breaks to reduce the level
of indentation a bit.
2003-06-21 08:27:06 +00:00
Alan Cox
ebf7512532 Lock one of the vm objects involved in an optimized copy-on-write fault. 2003-06-21 06:31:42 +00:00
Alan Cox
06ecade7d8 - Increase the scope of the vm object lock in vm_object_collapse().
- Assert that the vm object and its backing vm object are both locked in
   vm_object_qcollapse().
2003-06-21 04:14:48 +00:00
Jeff Roberson
1a7a9d0ec2 - lticks was erroneously being updated in sched_pctcpu(). This was causing
us to skip the pctcpu_update() call which lead to inaccurate cpu usage
   statistics for processes that didn't run often.
2003-06-21 02:31:49 +00:00
Jeff Roberson
665cb285a8 - Don't allow nice to have such a large effect on priority. This was
causing poor interactive performance while unnice processes were running.
   The new scheme still allows nice to have an effect on priority but it is
   not as dramatic as the effect of the interactivity score.
2003-06-21 02:22:47 +00:00
John-Mark Gurney
efe0afa930 fix grammar in comment 2003-06-20 23:29:04 +00:00
Bosko Milekic
b2b417bb41 Fix a divide-by-zero on kern.log_wakeups_per_second tunable.
Submitted by: Christian S.J. Peron <maneo@bsdpro.com>
PR: kern/53557
2003-06-20 22:18:38 +00:00
Alan Cox
5ea4972cd4 Make swap_pager_haspages() static; remove unused function prototypes. 2003-06-20 20:20:06 +00:00
Tim J. Robbins
a222314fe6 Merge from NetBSD src/sys/ntfs/ntfs_subr.c 1.5 & 1.30 (jdolecek):
- Avoid calling bread() with different sizes on the same blkno.
  Although the buffer cache is designed to handle differing size
  buffers, it erroneously tries to write the incorrectly-sized buffer
  buffer back to disk before reading the correctly-sized one, even
  when it's not dirty. This behaviour caused a panic for read-only
  NTFS mounts when INVARIANTS was enabled ("bundirty: buffer x still
  on queue y"), reported by NAKAJI Hiroyuki.
- Fix a bug in the code handling holes: a variable was incremented
  instead of decremented, which could cause an infinite loop.
2003-06-20 14:52:52 +00:00
Hidetoshi Shimokawa
e14720d614 Use direct map in pmap_map().
This saves much KVA for vm_pages and you don't need to increase NKPT
for large physical memory anymore.

Suggested by: dfr
2003-06-20 14:09:33 +00:00
Stefan Eßer
c2ef4dd48a Add comment about **vpp being special-cased in vnode_if.awk (1.38) 2003-06-20 12:24:06 +00:00
Stefan Eßer
86ed89620e The assertions generated to test VFS locking never included checks
for vnodes reached through double indirection (i.e. **vpp). This
is worked-around by special-casing the identifier "vpp" (adding one
level of indirection).

The alternative fix mentioned in the PR had required substantial
changes to this script.

In case there are locking violations that had been hidden without
this patch, they may suddenly show up, now ...

This change does not affect code compiled without DEBUG_VFS_LOCKS.

PR:		kern/46652
2003-06-20 12:15:37 +00:00
David Xu
ab78d4d641 cpu_set_upcall_kse needs to access userspace, release schedule lock
before calling it for bound thread. To avoid this problem, change
thread_schedule_upcall to not put new thread on run queue, let caller
do it, so we can tweak the new thread before setting it to run.

Reported by: pho
2003-06-20 09:12:12 +00:00
Poul-Henning Kamp
166400b7e6 Don't put callout_lock under #ifdef DIAGNOSTIC despite the fact that it
works anyway.
2003-06-20 08:39:04 +00:00
Poul-Henning Kamp
adece6e592 Initialize b_saveaddr when we hand out pbufs 2003-06-20 08:35:28 +00:00
Poul-Henning Kamp
568733688b Initialize b_saveaddr when we hand out buffers 2003-06-20 08:26:38 +00:00
Poul-Henning Kamp
ce6912c420 Crude but efficient:
#ifdef DIAGNOSTIC hold a mutex while calling callout's so that we hear
about it if they sleep.
2003-06-20 08:07:15 +00:00
Poul-Henning Kamp
eaaca5deee Don't (re)initialize f_gcflag to zero.
Move initialization of DTYPE_VNODE specific field f_seqcount into
the DTYPE_VNODE specific code.
2003-06-20 08:02:30 +00:00
Poul-Henning Kamp
c066b8920e Move FMARK and FDEFER til sys/file.h where they belong.
Order the fields in struct file in sections after their scope.
2003-06-20 07:59:59 +00:00
John-Mark Gurney
b9d3718a18 fix another LP64 problem. READ_IVAR takes a pointer to an uintptr_t, not
an int.
2003-06-20 07:22:54 +00:00
Alan Cox
e50346b5e0 The so-called "optimized copy-on-write fault" case should not require
the vm map lock.  What's really needed is vm object locking, which
is (for the moment) provided Giant.

Reviewed by:	tegge
2003-06-20 04:20:36 +00:00
David Xu
062cf543fc When a STOP signal is being sent to a process, it is possible all
threads in the process have already masked the signal, so job control
is delayed. But later a thread unmasking the STOP signal should enable
job control, so in issignal(), scanning all threads in process to see
if we can direct suspend some of them, not just suspend current thread.
2003-06-20 03:36:45 +00:00
David Xu
8b56079e2b Fix typo. td should be td0. 2003-06-20 01:56:28 +00:00
Jake Burkholder
d4c737a952 Avoid using v8 opcodes; use ba instead of b for unconditional branches. 2003-06-19 19:11:21 +00:00
Alfred Perlstein
bab88630ba Unlock the struct file lock before aquiring Giant, otherwise
we can deadlock because of lock order reversals.  This was not
caught because Witness ignores pool mutexes right now.

Diagnosis and help: truckman
Noticed by: pho
2003-06-19 18:13:07 +00:00
Jake Burkholder
d6c28affbd Hook openpromio up to the build. 2003-06-19 18:06:58 +00:00
Alan Cox
a38918cdbd Lock the vm object when freeing a vm page. 2003-06-19 17:56:12 +00:00
Søren Schmidt
d72d63c03e Add support for the HighPoint HPT302 & HPT371
HW sponsored by:	Martin Blapp <mbr@FreeBSD.ORG>
2003-06-19 15:11:04 +00:00
Hidetoshi Shimokawa
d25ac2fa68 Fix direct map page table for 2GB+ physical memory.
You may still need to increase NKPT for larger memory.
I have successfully booted 8GB system with NKPT=256.
2003-06-19 12:14:37 +00:00
Marcel Moolenaar
e2905ce3a0 Add TLS related relocation. 2003-06-19 06:51:43 +00:00
Mike Silbersack
b083ea5114 Add a ratelimited message of the form
"maxproc limit exceeded by uid %i, please see tuning(7) and login.conf(5)."

Which will be triggered whenever a user hits his/her maxproc limit or
the systemwide maxproc limit is reached.

MFC after:	1 week
2003-06-19 05:57:25 +00:00
Jake Burkholder
f96c24256c - Rename the IPI_WAIT macro to IPI_DONE.
- Don't require all receivers of ipis to wait for all other receivers,
  only that the sender wait for all receivers.  This should reduce the
  amount of time spent with interrupts disabled, which may be a cause
  of ipi timeouts.

Discussed with:	tmm
2003-06-19 05:27:04 +00:00
Don Lewis
6084b6c9d5 FILE_LOCK() uses a pool mutex, as does the vnode v_vnlock. Since pool
mutexes are supposed to only be used as leaf mutexes, and what appear
to be separate pool mutexes could be aliased together, it is bad idea
for a thread to attempt to hold two pool mutexes at the same time.

Slightly rearrange the code in kern_open() so that FILE_UNLOCK() is
called before calling VOP_GETVOBJECT(), which will grab the v_vnlock
mutex.
2003-06-19 04:10:56 +00:00
Mike Silbersack
4d7dfc31b8 Add a rate limited message reporting when kern.maxfiles is exceeded,
reporting who did it.

Also, fix a style bug introduced in the previous change.

MFC after:	1 week
2003-06-19 04:07:12 +00:00
Don Lewis
8d5f9131fc VOP_GETVOBJECT() wants to be called with the vnode lock held. 2003-06-19 03:55:01 +00:00
Alan Cox
82b8b18959 Lock the vm object when freeing a vm page. 2003-06-19 03:38:05 +00:00
Alan Cox
95aada383f Lock the vm object when freeing a vm page. 2003-06-19 03:08:10 +00:00
John-Mark Gurney
9c77e81b5d make iicbb_devclass and iicbb_driver globally visible. This will let
drivers that implemnt the i2c bit banging bus interface not have to
recompile iicbb in order to add an attachment for it.

This will mean the bktr and other definitions can go back to their
respective drivers.
2003-06-19 02:50:08 +00:00
Alan Cox
f873ed0327 Add vm object locking. 2003-06-19 02:01:33 +00:00
Alan Cox
37681d8642 Assert that the vm object is locked in vm_page_try_to_free(). 2003-06-19 01:50:14 +00:00
Scott Long
ed3392975b Fixing some glaring problems with aac_disk_dump().
- Mark that it cannot handle greater than 4GB of RAM at this time.  Fixing
   that will come later.  Fail any attempts to dump above thati limit.
 - If a call to aac_disk_dump() needs to be split into multiple i/o's,
   increment the virtual offset after each i/o instead of just dumping the
   same offset over and over again.
 - Bail out if bus_dmamap_load() returns an error.  Error recovery is likely
   not possible.
2003-06-19 01:49:04 +00:00
Alan Cox
d18e8afe99 Fix a vm object reference leak in the page-based copy-on-write mechanism
used by the zero-copy sockets implementation.

Reviewed by:	gallatin
2003-06-19 01:40:44 +00:00
Jake Burkholder
1de46e12a3 Add a solaris compatible ofw interface for third party software that
expects one to use.  Only the functions used by XFree86 are actually
implemented.

Glanced at by:	tmm
2003-06-19 01:40:11 +00:00