Commit Graph

54294 Commits

Author SHA1 Message Date
Kirk McKusick
6a52a06851 Allow removal of empty directories with high link counts. These can
occur on a filesystem running with soft updates after a crash and
before a background fsck has been run. To prevent discrepancies
from arising in a background fsck that may already be running,
the directory is removed but its inode is not freed and is left
with the residual reference count. When encountered by the
background fsck it will be reclaimed.
2005-05-18 22:18:21 +00:00
Alan Cox
cf51adc0a1 Update some comments to reflect the change from spl-based to lock-based
synchronization.
2005-05-18 22:08:52 +00:00
Pawel Jakub Dawidek
b578b0bdd3 devfs_first() return value isn't used, remove it. 2005-05-18 22:05:12 +00:00
Pawel Jakub Dawidek
d246aa55e7 Correct typo. 2005-05-18 21:53:08 +00:00
Alan Cox
ab973359d5 Remove calls to spl*(). 2005-05-18 20:45:33 +00:00
Alan Cox
2e2a6fa28a Revert revision 1.270: swp_pager_async_iodone() need not perform
VM_LOCK_GIANT().

Discussed with: jeff
2005-05-18 17:48:04 +00:00
Bjoern A. Zeeb
f3aad9a6bb Correct 32 vs 64 bit signedness issues.
Approved by:	pjd (mentor)
MFC after:	2 weeks
2005-05-18 08:57:31 +00:00
Alan Cox
66f27aca69 Convert to the faster bus_dmamap_load_mbuf_sg() interface.
MFC after: 1 week
2005-05-18 07:45:08 +00:00
Paul Saab
7caeec6a13 Support passthru ioctl commands from 32bit binaries. 2005-05-18 05:31:34 +00:00
Dag-Erling Smørgrav
3f54cc0505 Ugh. Previous commit got the logic exactly backward.
Submitted by:	bland
Pointy hat to:	des
2005-05-17 18:23:03 +00:00
Lukas Ertl
0164489c96 When a drive dies, don't call g_wither_geom() directly, but instead
post an event to the geom event queue that will take care of it,
letting outstanding bios finish, and closing the consumers.

Plus some cosmetic clean ups.
2005-05-17 16:38:30 +00:00
Søren Schmidt
d78c6e89ae Make certain the the 48bit flag is reset if we dont translate LBA. 2005-05-17 12:31:54 +00:00
Gleb Smirnoff
24ac2f1c5e - Unwind NG_SEND_MSG_PATH() macro and merge it with already unwinded
version under TRACE_MESSAGES.
- Pass NG_WAITOK flag to ng_package_data() in unwinded macro.
2005-05-17 12:18:13 +00:00
Dag-Erling Smørgrav
ff17c7a727 Revision 1.173 broke updating a mount from ro to rw. Fix that by clearing
the MNT_RDONLY flag if MNT_UPDATE is set and "ro" was not specified.

Suggested by:	cognet
2005-05-17 12:00:43 +00:00
Gleb Smirnoff
45b719ae22 Use NG_QUEUE instead of constant. 2005-05-16 19:52:42 +00:00
Paul Saab
4fc5324557 Introduce routines to alloc/free sack holes. This cleans up the code
considerably.

Submitted by:   Noritoshi Demizu.
Reviewed by:    Raja Mukerji, Mohan Srinivasan.
2005-05-16 19:26:46 +00:00
Gleb Smirnoff
d0784b4740 Refactor places where ng_package_data() failed.
Suggested & reviewed by:	archie
2005-05-16 19:12:57 +00:00
Gleb Smirnoff
ae76957d25 - Fix build with TRACE_MESSAGES on.
- Reformat code under TRACE_MESSAGES to make it more readable.
- Move linker hackery out of #ifdef.
- Break long lines in linker hackery block.
2005-05-16 18:50:26 +00:00
Gleb Smirnoff
94b73ad3a9 Close race between node being shutdown and socket being detached. To
do this, obtain netgraph locking in detach method via ng_send_fn1().

Reviewed by:	julian
MFC after:	2 weeks
2005-05-16 17:25:49 +00:00
Maksim Yevmenkin
b4b485a5d8 Dont clear all flags in vkbd_clear_state_locked(). Clear only COMPOSE flag.
MFC after:	3 days
2005-05-16 17:21:10 +00:00
Gleb Smirnoff
336b3f1e51 Catch up with new ng_package_data(). 2005-05-16 17:10:08 +00:00
Gleb Smirnoff
3033e8026a Catch up with new ng_package_data(). Use NG_WAITOK on userland
path.
2005-05-16 17:09:35 +00:00
Gleb Smirnoff
74eafa88cf - Catch up with new interface to ng_package_data().
- Handle errors from ng_package_data().
2005-05-16 17:08:53 +00:00
Gleb Smirnoff
f6c9d18d2f Catch up with new ng_send_fn1() interface. 2005-05-16 17:07:39 +00:00
Gleb Smirnoff
42282202ee - Extend interface of ng_getqblk(), so that malloc wait flags are
specified by caller.
- Change ng_send_item() interface - use 'flags' argument instead of
  boolean 'queue'.
- Extend ng_send_fn(), ng_package_data() and ng_package_msg()
  interface - add possibility to pass flags. Rename ng_send_fn() to
  ng_send_fn1(). Create macro for ng_send_fn().
- Update all macros, that use ng_package_data() and ng_package_msg().

Reviewed by:	julian
2005-05-16 17:07:03 +00:00
Bill Paul
02fa4220cd Correct type for workitem routines. 2005-05-16 16:50:52 +00:00
Darren Reed
051adc35a2 Enable building /sbin/ipf (but not the rescue version) with the ability to
parse bpf strings for filter rules in ipf.conf
2005-05-16 16:22:55 +00:00
Bill Paul
5b5687f6ba Remove harmless bit of leftover debug code. 2005-05-16 15:44:41 +00:00
Bill Paul
d9ccba1ac4 Correct some problems with workitem usage. NdisScheduleWorkItem() does
not use exactly the same workitem sturcture as ExQueueWorkItem() like
I originally thought it did.
2005-05-16 15:29:21 +00:00
Søren Schmidt
ae337d1ee5 longer used (contents added to sys/ata.h) 2005-05-16 13:39:49 +00:00
Søren Schmidt
6667b30d15 Change the way ioctls are issue to ATA.
The most prominent part is that its now possible to issue ata_requests
directly to say acd0, instead of going through the cumbersome /dev/ata
device.
2005-05-16 13:07:27 +00:00
David E. O'Brien
b0c77ed9fb Add the 2nd word of IA32 feature flags. This includes things such as SSE3.
Obtained from:	sys/amd64/amd64/identcpu.
2005-05-16 09:47:53 +00:00
Gleb Smirnoff
85efd7165f Correct format is 'options<space><tab>'.
Submitted by:	ru
2005-05-16 09:05:46 +00:00
Gleb Smirnoff
73e872668d Make NETGRAPH_DEBUG a kernel option, so that it can't be turned off
without hacking source.

In collaboration with:	ru, julian
2005-05-16 08:25:55 +00:00
Warner Losh
ce86397a98 Add convenience functions to get port and interface. 2005-05-16 06:58:43 +00:00
Warner Losh
6b1fe67d59 Print a warning once when trying to bring up interface before firmware load. 2005-05-15 21:02:51 +00:00
Yoshihiro Takahashi
f4acf7e936 Remove old epson note support. 2005-05-15 09:07:42 +00:00
Yoshihiro Takahashi
6959aa373c - Add color tables for 16 colors mode and 8 colors mode, use a different
table on the pc98 console.
- Remove old epson note support.
2005-05-15 09:07:04 +00:00
Yoshihiro Takahashi
8763b97d37 - Mask an underline attribute on the pc98 console. It enables to use the same
color on the pc98 and the others.
- Remove old epson note support.
2005-05-15 08:59:00 +00:00
Yoshihiro Takahashi
b4d6f74dce Remove the ADJUST_CLOCK ioctl on pc98. It's not used at all. 2005-05-15 07:35:49 +00:00
Bill Paul
433d61bb56 Add support for NdisMEthIndicateReceive() and MiniportTransferData().
The Ralink RT2500 driver uses this API instead of NdisMIndicateReceivePacket().

Drivers use NdisMEthIndicateReceive() when they know they support
802.3 media and expect to hand their packets only protocols that want
to deal with that particular media type. With this API, the driver does
not manage its own NDIS_PACKET/NDIS_BUFFER structures. Instead, it
lets bound protocols have a peek at the data, and then they supply
an NDIS_PACKET/NDIS_BUFFER combo to the miniport driver, into which
it copies the packet data.

Drivers use NdisMIndicateReceivePacket() to allow their packets to
be read by any protocol, not just those bound to 802.3 media devices.

To make this work, we need an internal pool of NDIS_PACKETS for
receives. Currently, we check to see if the driver exports a
MiniportTransferData() method in its characteristics structure,
and only allocate the pool for drivers that have this method.

This should allow the RT2500 driver to work correctly, though I
still have to fix ndiscvt(8) to parse its .inf file properly.

Also, change kern_ndis.c:ndis_halt_nic() to reap timers before
acquiring NDIS_LOCK(), since the reaping process might entail sleeping
briefly (and we can't sleep with a lock held).
2005-05-15 04:27:59 +00:00
Darren Reed
05793fcbf0 Enable IPFilter to correctly determine if BPF has been optioned into the
kernel it is being compiled against and subsequently enable using BPF for
packet matching in ipf rules.
2005-05-15 03:34:17 +00:00
George V. Neville-Neil
403cbcf59f Fixes for various nits found by the Coverity tool.
In particular 2 missed return values and an inappropriate bcopy from
a possibly NULL pointer.

Reviewed by:	jake
Approved by:	rwatson
MFC after:	1 week
2005-05-15 02:28:30 +00:00
Gleb Smirnoff
32247f8629 - When carp interface is destroyed, and it affects global preemption
suppresion counter, decrease the latter. [1]
- Add sysctl to monitor preemption suppression.

PR:		kern/80972 [1]
Submitted by:	Frank Volf [1]
MFC after:	1 week
2005-05-15 01:44:26 +00:00
Yoshihiro Takahashi
914ee8ba4b Fix my copyright. 2005-05-14 10:51:16 +00:00
Yoshihiro Takahashi
dfe1941a9c cosmetic change. 2005-05-14 10:26:31 +00:00
Yoshihiro Takahashi
b22bf66063 - Move bus dependent defines to {isa,cbus}_dmareg.h.
- Use isa/isareg.h rather than <arch>/isa/isa.h.

Tested on: i386, pc98
2005-05-14 10:14:56 +00:00
Gleb Smirnoff
8253c060cf Move queue element routines upper, so that all related
declarations are in one place, to improve readability.
No functional changes.
2005-05-14 10:07:17 +00:00
Gleb Smirnoff
1489164f6b Use uma(9) for allocating netgraph items:
- ng_getqblk() simply runs uma_zalloc().
  - ng_free_item() simply frees.
  - ngq_mtx is pushed down under NETGRAPH_DEBUG.
  - NGQF_FREE is removed.

Increase default maxalloc to 512.

Reviewed by:	julian
2005-05-14 09:25:18 +00:00
Yoshihiro Takahashi
24072ca35b - Move timerreg.h to <arch>/include and split i8253 specific defines into
i8253reg.h, and add some defines to control a speaker.
- Move PPI related defines from i386/isa/spkr.c into ppireg.h and use them.
- Move IO_{PPI,TIMER} defines into ppireg.h and timerreg.h respectively.
- Use isa/isareg.h rather than <arch>/isa/isa.h.

Tested on: i386, pc98
2005-05-14 09:10:02 +00:00
Yoshihiro Takahashi
bc3729b63f MFi386: revision 1.614. 2005-05-14 08:52:04 +00:00
Alan Cox
7daa3570e4 Revert revision 1.164: pmap_qremove() does not require protection by
VM_LOCK_GIANT.

Discussed with: jeff
2005-05-14 05:09:11 +00:00
Peter Grehan
edaccfc8bb Remove incorrect configuration setting that limited the Kauai ATA controller
to be master-only. The slave ATAPI drive on the Mac-Mini is now recognised.
2005-05-14 02:11:45 +00:00
Paul Saab
fdace17f81 Fix for a bug where the "nexthole" sack hint is out of sync with the
real next hole to retransmit from the scoreboard, caused by a bug
which did not update the "nexthole" hint in one case in
tcp_sack_option().

Reported by:    Daniel Eriksson
Submitted by:   Mohan Srinivasan
2005-05-13 18:02:02 +00:00
Xin LI
9242b38b0d Bump __FreeBSD_version for POSIX ttyname_r(3) changes.
Forgotten by:	me
Reminded by:	mezz
2005-05-13 17:31:32 +00:00
Gleb Smirnoff
b3cf6808ce In div_output() explicitly set m->m_nextpkt to NULL. If divert socket
is not userland, but ng_ksocket, then m->m_nextpkt may be non-NULL. In
this case we would panic in sbappend.
2005-05-13 11:44:37 +00:00
Gleb Smirnoff
0f4a3524dd When used as divert socket we need to decouple stack when node is entered
from socket side. Use ng_queue_fn() instead of ng_send_fn().
2005-05-13 11:40:08 +00:00
Gleb Smirnoff
aacdb11479 Since there is no way to queue a function call to node, create
ng_queue_fn() - a queue version of ng_send_fn().
2005-05-13 11:35:02 +00:00
Peter Edwards
34ddec12b1 lockmgr(...,LK_DRAIN,...) requires a balancing LK_RELEASE: recent
INVARIANTS dependent checks in userret() pinpointed a missing
invocation here.

Remove an unused variable while here.

Reviewed By: bp@
Reported By: yongari@
MFC After: 3 days
2005-05-13 11:27:48 +00:00
Søren Schmidt
265da99ce9 Cleanup comments 2005-05-13 10:25:19 +00:00
Søren Schmidt
bb8a0cf2cf Fix more ATAPI breakage.
Apparently some devices are very picky on details :)
2005-05-13 07:58:05 +00:00
Jacques Vidrine
032e56ae9b Default hyperthreading on in -CURRENT. No seatbelts in CURRENT (^_^)
Requested by:	peter, jhb
2005-05-13 00:57:04 +00:00
Jacques Vidrine
f6108b6158 Add a knob for disabling/enabling HTT, "machdep.hyperthreading_allowed".
Default off due to information disclosure on multi-user systems.

Submitted by:	cperciva
Reviewed by:	jhb
2005-05-13 00:10:56 +00:00
Nate Lawson
a6761eb377 If there is a problem during probe, be sure to free up any resources
allocated for it.  The normal exit case handles this correctly so we
use it as well for errors.

Submitted by:	pjd
Obtained from:	Coverity Prevent
2005-05-12 22:35:08 +00:00
Robert Watson
83ae2ce161 Remove unimplemented ACL types.
Reported by:	Hervé Kergourlay <herve dot kergourlay at atempo dot com>
2005-05-12 22:01:18 +00:00
John Baldwin
a4c24c66bc Actually use the iterating variable in the for loop when trying to avoid
overflow.

Reported by:	Vladislav Shabanov vs at rambler-co dot ru
MFC after:	1 week
Glanced at:	alfred
2005-05-12 20:04:48 +00:00
Gleb Smirnoff
35fd572dcb - Gather statistics about failed mbuf+cluster+ng_item allocations.
- Adjust comments and variables names in nfinfo.
2005-05-12 13:52:49 +00:00
Yoshihiro Takahashi
77bcc9ce35 Move the pc98 keymap define into pckbdtables.h because it should be used
only on the pckbd driver.
2005-05-12 13:39:31 +00:00
Yoshihiro Takahashi
164e09ddb4 - Move the NPX_DEBUG option to options.{i386,pc98} and use opt_npx.h.
- Move npx related defines to {i386,pc98}/include/npx.h to remove #include
  {isa,cbus}.h.
2005-05-12 12:47:41 +00:00
Yoshihiro Takahashi
d6c331a30d Remove unused IO_NPX* defines. 2005-05-12 12:36:31 +00:00
Peter Grehan
10b00dd4f3 The final test in unlock_and_deallocate() to determine if GIANT needs to be
unlocked wasn't updated to check for OBJ_NEEDGIANT. This caused a WITNESS
panic when debug_mpsafevm was set to 0.

Approved by:	jeffr
2005-05-12 04:09:41 +00:00
Pawel Jakub Dawidek
07ebf8c8c3 We don't use 'mp' variable, but we do want to mount devfs, ehh. 2005-05-12 01:49:51 +00:00
Paul Saab
0077b0163f When looking for the next hole to retransmit from the scoreboard,
or to compute the total retransmitted bytes in this sack recovery
episode, the scoreboard is traversed. While in sack recovery, this
traversal occurs on every call to tcp_output(), every dupack and
every partial ack. The scoreboard could potentially get quite large,
making this traversal expensive.

This change optimizes this by storing hints (for the next hole to
retransmit and the total retransmitted bytes in this sack recovery
episode) reducing the complexity to find these values from O(n) to
constant time.

The debug code that sanity checks the hints against the computed
value will be removed eventually.

Submitted by:   Mohan Srinivasan, Noritoshi Demizu, Raja Mukerji.
2005-05-11 21:37:42 +00:00
Olivier Houchard
e85d3fc3c8 Don't forget to copy the TP when forking, or bad things will happen to the
child process if it tries to use threads.
2005-05-11 21:20:42 +00:00
Christian Brueffer
befb7f333f Fix three typos in comments. Two of them obtained from OpenBSD.
MFC after:	3 days
2005-05-11 21:10:35 +00:00
Pawel Jakub Dawidek
b8bc5373e1 Remove unised variable introduced by accident in rev 1.168.
Found by:	Coverity Prevent analysis tool
2005-05-11 19:50:34 +00:00
Pawel Jakub Dawidek
3ac6c13bd4 cp can't be NULL.
Noticed by:	Coverity Prevent analysis tool
2005-05-11 19:36:56 +00:00
Pawel Jakub Dawidek
b957751627 gp can't be NULL.
Noticed by:	Coverity Prevent analysis tool
2005-05-11 19:35:43 +00:00
Pawel Jakub Dawidek
f850b2781f Plug memory leaks.
Found by:		Coverity Prevent analysis tool
2005-05-11 19:27:38 +00:00
Alexander Kabaev
42e1d99cc8 Do not dereference dvp pointer before doing a NULL check.
Noticed by: Coverity Prevent analysis tool.
2005-05-11 19:08:38 +00:00
Alexander Kabaev
59195c3a3d Plug a potential memory leak.
Noticed by: Coverity Prevent analysis tool.
2005-05-11 18:53:14 +00:00
Søren Schmidt
c46e1f5333 Add new Intel PCI ID's for the ICH7 chips (untested). 2005-05-11 18:29:15 +00:00
Alexander Kabaev
0ca9ed8674 Handle theoretical case of vfs_export being called with both MNT_DELEXPORT and
MNT_EXPORT flags set. Do not reuse the memory that has just been freed.
2005-05-11 18:25:42 +00:00
Pawel Jakub Dawidek
862f5624ea Add KASSERT() to be sure there is an active component.
Suggested by:	Coverity Prevent analysis tool
2005-05-11 18:13:51 +00:00
Pawel Jakub Dawidek
0a3384a8f8 Check return value.
Found by:	Coverity Prevent analysis tool
2005-05-11 18:07:39 +00:00
Alexander Kabaev
693937214b Do not initialize path variable with useless value just before
xpt_create_path overwrites it anyway.

Noticed by:     Coverity Prevent analysis tool
2005-05-11 17:39:33 +00:00
Søren Schmidt
d81c813f10 Add support for AHCI compliant ATA devices.
For now just support the Intel ICH6 as that the HW at hand.

Sponsored by:	pair.com
2005-05-11 16:10:08 +00:00
Warner Losh
3ecc7feefc Take out Giant in uhub_child_* in giant. There's one place where we
could sleep which I think can lead to races.  However, there are fewer
with this code than without it.

Submitted by: Hans Petter Selasky
2005-05-11 15:21:22 +00:00
Søren Schmidt
d0968d7845 Add back one line that got deleted in the last commit.
Change the comment there so it better describes whats going on.

This should fix the boot problems of late.
2005-05-11 14:36:26 +00:00
Søren Schmidt
faca873f76 Fix ATAPI DMA. We need to set the proper flags for DMA modes. 2005-05-11 12:41:35 +00:00
Gleb Smirnoff
494e177ada A new version of NetFlow node.
The most significant changes are:
- Use UMA zone instead of own chunk of memory.
- Lock each hash entry separately.
- Expire items "actively" - interrupt method can expire flows
  from hash slot, when it searches through it.
- Remove global tailqueue. Make callout thread search through
  every hash slot.
- Export datagram is detached from private data and filled. If
  it is incomplete, it is attached back. Another thread will
  continue working with it.

Lesser, but also important speedups:
- Flows in hash slot are stored in tailqueue. Whenever a flow is
  hit, it is moved to the begging, so it can be located quicker.
- When callout thread works with hash slot it bails out if
  slot mutex is contested.
2005-05-11 11:26:24 +00:00
Gleb Smirnoff
cc8c6970fd Move assertion below initializer.
Submitted by:	Noritoshi Demizu
Pointy hat to: 	glebius
2005-05-11 08:28:09 +00:00
Matt Jacob
b49c46747a Fix some incorrectly swapped fields in an ICB.
Access a PCI register with correct width.

Obtained from:	Dmitry Valeryevich Trikoz
2005-05-11 03:00:50 +00:00
Matt Jacob
547725be50 Refactor isp_prt declaration so that platform
requirements can stay in platform files.
2005-05-11 00:22:17 +00:00
Maksim Yevmenkin
c18a1440f0 Mark AVM USB Bluetooth-Adapter BlueFritz! as "broken". This device is not
supported by ng_ubt(4) driver and needs its own driver.

PR:		kern/76205
Submitted by:	Tim Hemel < bsd AT timit DOT nl >
MFC after:	1 week
2005-05-10 16:25:58 +00:00
Jim Rees
3785bdbe7f set R_MUSTRESEND flag in mark_for_reconnect so re-connected requests get
re-sent instead of timing out.

don't log an error message on reconnection, which is not an error.

remove unused nfs_mrep_before_tsleep.

Reviewed by:	Mohan Srinivasan
Approved by:	alfred
2005-05-10 14:25:14 +00:00
Gleb Smirnoff
2046fd5f68 - Assert that mbuf length equals packet length.
- Tell libalias, that we have MCLBYTES to play with.
- Obtain length of data in mbuf from updated IP header.
2005-05-10 14:19:10 +00:00
Yoshihiro Takahashi
257d63789e - Move lptreg.h into pc98/cbus and rename to olptreg.h.
- Remove ifdef pc98.
2005-05-10 12:30:30 +00:00
Yoshihiro Takahashi
d1725ef7ff Change a directory layout for pc98.
- Move MD files into <arch>/<arch>.
  - Move bus dependent files into <arch>/<bus>.
Rename some files to more suitable names.

Repo-copied by:	peter
Discussed with:	imp
2005-05-10 12:02:18 +00:00
Marcel Moolenaar
6fab4fece2 Don't define _MACHINE_BUS_MEMIO_H_ nor _MACHINE_BUS_PIO_H_. 2005-05-10 02:59:24 +00:00
Philip Paeps
18d92cd86c Sync with Linux acpi4asus, adding support for loads of new models.
MFC after:	3 days
2005-05-09 12:51:48 +00:00
Philip Paeps
caac49960b Add support for Asus V6V[1] and W1N notebooks.
Submitted by:	Jean-Sébastien Pédron <jspedron@club-internet.fr> [1]
MFC after:	3 days
2005-05-09 08:43:49 +00:00
Mark Santcroos
8518ed9ecd Simplify the ACPI taskqueue implementation. Use a thread queue type instead
of swi. This allows us to use the taskqueue_thread_* functions instead of
rolling our own. It also avoids a double trip through the queue.

Submitted by:	njl
Reviewed by:	sam
2005-05-09 07:34:04 +00:00
Mark Santcroos
95be34abba Fix separate module build.
Submitted by:	njl
2005-05-09 07:26:16 +00:00
Yoshihiro Takahashi
b416ebde05 Move if_wl_i82586.h into sys/dev/wl. 2005-05-09 04:47:58 +00:00
Marcel Moolenaar
23110bedcd Enable debug_mpsafevm on ia64 due to the severe functional regression
caused by recent locking changes when it's off. Revert the logic to
trim down the conditional.

Clued-in by: alc@
2005-05-08 23:56:16 +00:00
Bill Paul
239a676456 More fixes for multibus drivers. When calling out to the match
function in if_ndis_pci.c and if_ndis_pccard.c, provide the bustype
too so the stubs can ignore devlists that don't concern them.
2005-05-08 23:19:20 +00:00
Bill Paul
6169e4d097 Fix support for Windows drivers that support both PCI and PCMCIA devices at
the same time.

Fix if_ndis_pccard.c so that it sets sc->ndis_dobj and sc->ndis_regvals.

Correct IMPORT_SFUNC() macros for the READ_PORT_BUFFER_xxx() routines,
which take 3 arguments, not 2.

This fixes it so that the Windows driver for my Cisco Aironet 340 PCMCIA
card works again. (Yes, I know the an(4) driver supports this card natively,
but it's the only PCMCIA device I have with a Windows XP driver.)
2005-05-08 23:07:51 +00:00
Marcel Moolenaar
9f0974f96d In uart_cnprobe(), fill in the cn_name field of the consdev structure.
The core console code checks this field when a console is added and
emits a warning if it's empty. In practice the warning is harmless for
uart(4), because the cn_name is filled in as soon as the device name is
known; which is when the device is enumerated.
To avoid the warning, to avoid possible complications caused by emitting
the warning without there (possibly) being a console selected yet and to
avoid complications when the UART isn't found during bus enumeration, we
just preset the cn_name field here to the name of the driver.
2005-05-08 20:25:09 +00:00
Yoshihiro Takahashi
769f92857b Remove ifdef PC98. 2005-05-08 14:17:28 +00:00
Yoshihiro Takahashi
d03f4aa4fe Merged from libi386/biosdisk.c revisions 1.37 and 1.41. 2005-05-08 13:30:14 +00:00
Yoshihiro Takahashi
57e2f8c439 Change DOSPTYP_386BSD to 0xc494. 2005-05-08 11:30:26 +00:00
Yoshihiro Takahashi
ad42c2a5fd Use DOSMID_386BSD rather than DOSPTYP_386BSD. 2005-05-08 11:15:38 +00:00
Bill Paul
971aba5809 Avoid trying to queue up an interrupt handler DPC if the driver
hasn't called NdisMRegisterInterrupt() yet.
2005-05-08 09:36:16 +00:00
Bill Paul
0ad8336bc5 Correct the patch table entries for the 64-bit intrinsic math
routines (_alldiv(), _allmul(), _alludiv(), _aullmul(), etc...)
that use the _stdcall calling convention.

These routines all take two arguments, but the arguments are 64 bits wide.
On the i386 this means they each consume two 32-bit slots on the stack.
Consequently, when we specify the argument count in the IMPORT_SFUNC()
macro, we have to lie and claim there are 4 arguments instead of two.
This will cause the resulting i386 assembly wrapper to push the right
number of longwords onto the stack.

This fixes a crash I discovered with the RealTek 8180 driver, which
uses these routines a lot during initialization.
2005-05-08 09:16:33 +00:00
Christian Brueffer
162bc322c8 Fix typo in a comment. 2005-05-08 08:54:23 +00:00
Maxim Konovalov
15e343060c Capitalize at the start of sentence. 2005-05-08 02:20:10 +00:00
Bill Paul
a6e6c501af Minor correction to the logic for selecting the proper device index. 2005-05-08 02:06:57 +00:00
Maxim Konovalov
60dc30aacf o N_SETMAGIC/N_GET{MAGIC,MID,FLAG} macros live in imgact_aout.h
not in a.out.h.  Update the comment accordingly.

PR:		kern/80741
Submitted by:	Wojciech A. Koszek
MFC after:	3 days
2005-05-08 01:48:04 +00:00
Colin Percival
fe2eee8231 Fix two issues which were missed in FreeBSD-SA-05:08.kmem.
Reported by:	Uwe Doering
2005-05-07 00:41:36 +00:00
Eric Anholt
172c411091 Staticize some symbols that are each only used in one corresponding .c file.
PR:		kern/43610
Submitted by:	Matt Emmerton, matt at gsicomp dot on dot ca
2005-05-06 20:53:34 +00:00
Eric Anholt
1493ed4108 Staticize a symbol used only in this file.
PR:		kern/43613
Submitted by:	Matt Emmerton, matt at gsicomp dot on dot ca
2005-05-06 20:47:09 +00:00
Gleb Smirnoff
e8fc249f36 Bump __FreeBSD_version for libalias and ng_nat. 2005-05-06 15:04:18 +00:00
Gleb Smirnoff
6cd047a0bb Attach ng_nat and libalias to build. 2005-05-06 14:47:54 +00:00
Gleb Smirnoff
cbfbc555e0 Add a workaround for 64-bit archs: store unsigned long return value in
temporary variable, check it and then cast to in_addr_t.
2005-05-06 13:01:31 +00:00
Gleb Smirnoff
6293e003c9 s/DEBUG/LIBALIAS_DEBUG/, since DEBUG is defined in LINT and
not supported for kernel build.
2005-05-06 11:07:49 +00:00
Colin Percival
fd94099ec2 If we are going to
1. Copy a NULL-terminated string into a fixed-length buffer, and
2. copyout that buffer to userland,
we really ought to
0. Zero the entire buffer
first.

Security: FreeBSD-SA-05:08.kmem
2005-05-06 02:50:00 +00:00
Colin Percival
9b2dc15ca0 Correctly validate inputs to the i386_get_ldt syscall.
Security: FreeBSD-SA-05:07.ldt
2005-05-06 02:40:18 +00:00
Colin Percival
c340af03a0 Correct improper permissions on /dev/iir. The earlier permissions
of 0644 allowed for people to do Evil Things via ioctl(2).

Security: FreeBSD-SA-05:06.iir
2005-05-06 02:33:46 +00:00
Robert Drehmel
9c0c1ab87d The printf(9) `%p' conversion specifier puts an "0x" in
front of the pointer value.  Therefore, remove the "0x"
from the format string.
2005-05-06 00:15:57 +00:00
Robert Drehmel
e7aabf96a4 Fix our NTFS readdir function.
To check a directory's in-use bitmap bit by bit, we use
a pointer to an 8 bit wide unsigned value.

The index used to dereference this pointer is calculated
by shifting the bit index right 3 bits.  Then we do a
logical AND with the bit# represented by the lower 3
bits of the bit index.

This is an idiomatic way of iterating through a bit map
with simple bitwise operations.

This commit fixes the bug that we only checked bits
3:0 of each 8 bit chunk, because we only used bits 1:0
of the bit index for the bit# in the current 8 bit value.
This resulted in files not being returned by getdirentries(2).

Change the type of the bit map pointer from `char *' to
`u_int8_t *'.
2005-05-06 00:06:06 +00:00
Gleb Smirnoff
c4c9b52b87 ng_nat - a netgraph(4) node, which does NAT 2005-05-05 23:41:21 +00:00
Gleb Smirnoff
376ea9726b libalias is now buildable as kernel module 2005-05-05 22:43:04 +00:00
Bill Paul
2f60d4f83f Cast 64 bit quantity to uintmax_t to print it with %jx. This is
technically a no-op since uintmax_t is uint64_t on all currently
supported architectures, but we should use an explicit cast instead
of depending on this obscure coincidence.
2005-05-05 22:33:06 +00:00
Gleb Smirnoff
e9d5db2888 More bits for kernel version:
- copy inet_aton() from libc
- disable getservbyname() lookup and accept only numeric port
2005-05-05 22:00:32 +00:00
Gleb Smirnoff
75bc262006 Always include alias.h before alias_local.h 2005-05-05 21:55:17 +00:00
Gleb Smirnoff
f87fe393ce When used in kernel define NO_FW_PUNCH, NO_LOGGING, NO_USE_SOCKETS. 2005-05-05 21:53:17 +00:00
Gleb Smirnoff
c8d3ca728f Fix argument order for bcopy() in last commit.
Noticed by:	njl
Pointy hat to:	glebius
2005-05-05 21:40:49 +00:00
Gleb Smirnoff
efdc8fbf79 Use bcopy() instead of memmove(). 2005-05-05 21:10:51 +00:00
Gleb Smirnoff
ae0440572f Hide fflush(3) under ifdef DEBUG. 2005-05-05 21:07:34 +00:00
Gleb Smirnoff
c8564bffd2 Things required to build libalias as kernel module:
- kernel module declarations and handler.
- macros to map malloc(3) calls to malloc(9) ones.
- malloc(9) declarations.
- call finishoff() from module handler MOD_UNLOAD case
  instead of atexit(3).
- use panic(9) instead of abort(3)
- take time from time_second instead of gettimeofday(2)
- define INADDR_NONE
2005-05-05 21:05:38 +00:00
Gleb Smirnoff
00fc9a5bb9 Add NO_USE_SOCKETS knob, which cuts off functionality socket binding. 2005-05-05 20:25:12 +00:00
Gleb Smirnoff
40106c140f Add NO_LOGGING knob, which cuts off functionality of debug logging to a file. 2005-05-05 20:22:09 +00:00
Gleb Smirnoff
c649a2e033 Play with includes so that libalias can be compiled both as userland
library and kernel module.
2005-05-05 19:27:32 +00:00
Doug White
2891ace6c8 Add quirk for TEAC USB floppy drives. 2005-05-05 18:48:41 +00:00
Peter Wemm
27d89f4a00 Move the pcb variable initialization earlier. This is cosmetic here, but
in as-yet uncommitted code for 32 bit binary compatability on 64 bit
kernels, some of the 32 bit registers come from the pcb.  Moving the
initialization here means fill_regs32() etc are laid out the same.
2005-05-05 18:26:45 +00:00
Peter Wemm
fa37873521 Remove unused (besides being initialized) variable. 2005-05-05 18:19:53 +00:00
Bill Paul
3a712851ab Use %jx instead of %qx to silence compiler warning on amd64. 2005-05-05 15:56:41 +00:00
Takanori Watanabe
1e8a69609e Fix breakage on alpha.
Pointed out by: hrs via IRC
2005-05-05 07:02:51 +00:00
David Xu
5a2f73e624 Only check signal event, single threading event shouldn't be reported. 2005-05-05 06:42:02 +00:00
Bill Paul
eb31d50cc7 Avoid sleeping with mutex held in kern_ndis.c.
Remove unused fields from ndis_miniport_block.

Fix a bug in KeFlushQueuedDpcs() (we weren't calculating the kq pointer
correctly).

In if_ndis.c, clear the IFF_RUNNING flag before calling ndis_halt_nic().

Add some guards in kern_ndis.c to avoid letting anyone invoke ndis_get_info()
or ndis_set_info() if the NIC isn't fully initialized. Apparently, mdnsd
will sometimes try to invoke the ndis_ioctl() routine at exactly the
wrong moment (to futz with its multicast filters) when the interface
comes up, and can trigger a crash unless we guard against it.
2005-05-05 06:14:59 +00:00
Bill Paul
5514ba90b2 Remove extranaous free() of ASCII filename from NdisOpenFile().
Oh, one additional change I forgot to mention in the last commit:
NdisOpenFile() was broken in the case for firmware files that were
pre-loaded as modules. When searching for the module in NdisOpenFile(),
we would match against a symbol name, which would contain the string
we were looking for, then save a pointer to the linker file handle.
Later, in NdisMapFile(), we would refer to the filename hung off
this handle when trying to find the starting address symbol. Only
problem is, this filename is different from the embedded symbol
name we're searching for, so the mapping would fail. I found this
problem while testing the AirGo driver, which requires a small
firmware file.
2005-05-05 04:16:13 +00:00
Bill Paul
9b307fe2be This commit makes a bunch of changes, some big, some not so big.
- Remove the old task threads from kern_ndis.c and reimplement them in
  subr_ntoskrnl.c, in order to more properly emulate the Windows DPC
  API. Each CPU gets its own DPC queue/thread, and each queue can
  have low, medium and high importance DPCs. New APIs implemented:
  KeSetTargetProcessorDpc(), KeSetImportanceDpc() and KeFlushQueuedDpcs().
  (This is the biggest change.)

- Fix a bug in NdisMInitializeTimer(): the k_dpc pointer in the
  nmt_timer embedded in the ndis_miniport_timer struct must be set
  to point to the DPC, also embedded in the struct. Failing to do
  this breaks dequeueing of DPCs submitted via timers, and in turn
  breaks cancelling timers.

- Fix a bug in KeCancelTimer(): if the timer is interted in the timer
  queue (i.e. the timeout callback is still pending), we have to both
  untimeout() the timer _and_ call KeRemoveQueueDpc() to nuke the DPC
  that might be pending. Failing to do this breaks cancellation of
  periodic timers, which always appear to be inserted in the timer queue.

- Make use of the nmt_nexttimer field in ndis_miniport_timer: keep a
  queue of pending timers and cancel them all in ndis_halt_nic(), prior
  to calling MiniportHalt(). Also call KeFlushQueuedDpcs() to make sure
  any DPCs queued by the timers have expired.

- Modify NdisMAllocateSharedMemory() and NdisMFreeSharedMemory() to keep
  track of both the virtual and physical addresses of the shared memory
  buffers that get handed out. The AirGo MIMO driver appears to have a bug
  in it: for one of the segments is allocates, it returns the wrong
  virtual address. This would confuse NdisMFreeSharedMemory() and cause
  a crash. Why it doesn't crash Windows too I have no idea (from reading
  the documentation for NdisMFreeSharedMemory(), it appears to be a violation
  of the API).

- Implement strstr(), strchr() and MmIsAddressValid().

- Implement IoAllocateWorkItem(), IoFreeWorkItem(), IoQueueWorkItem() and
  ExQueueWorkItem(). (This is the second biggest change.)

- Make NdisScheduleWorkItem() call ExQueueWorkItem(). (Note that the
  ExQueueWorkItem() API is deprecated by Microsoft, but NDIS still uses
  it, since NdisScheduleWorkItem() is incompatible with the IoXXXWorkItem()
  API.)

- Change if_ndis.c to use the NdisScheduleWorkItem() interface for scheduling
  tasks.

With all these changes and fixes, the AirGo MIMO driver for the Belkin
F5D8010 Pre-N card now works. Special thanks to Paul Robinson
(paul dawt robinson at pwermedia dawt net) for the loan of a card
for testing.
2005-05-05 03:56:09 +00:00
Doug White
2eb15b9375 Backout part of rev 1.71, which breaks the interfaces on IBM/Intel blade
servers.

PR:		kern/68445
MFC after:	7 days
2005-05-05 03:37:27 +00:00
David Xu
89af2d4283 Turn on PCB_FULLCTX in set_regs to fully restore context
set by debugger.
2005-05-04 22:26:40 +00:00
Jeff Roberson
b8a0b997fd - We need to inhert the OBJ_NEEDGIANT flag from the original object in
vm_object_split().

Spotted by:	alc
2005-05-04 20:54:16 +00:00
Max Laier
ac9dfc9061 if_mtu not ifp_mtu. 2005-05-04 19:51:06 +00:00
Maksim Yevmenkin
75ae257016 Change m_uiotombuf so it will accept offset at which data should be copied
to the mbuf. Offset cannot exceed MHLEN bytes. This is currently used to
fix Ethernet header alignment problem on alpha and sparc64. Also change all
users of m_uiotombuf to pass proper offset.

Reviewed by:	jmg, sam
Tested by:	Sten Spans "sten AT blinkenlights DOT nl"
MFC after:	1 week
2005-05-04 18:55:03 +00:00
Paul Saab
15ec3fe2f0 Fix a bug in NFS/TCP where retransmissions would not reliably happen
if the server rebooted or tore down the connection for any reason.

Found by:	Jonathan Noack.
Submitted by:	Mohan Srinivasan.
2005-05-04 16:37:31 +00:00
Max Laier
69d9333494 Bring back fix from rev. 1.28 which was lost during the import. 2005-05-04 16:03:01 +00:00
Max Laier
8398e1894d Combine rev. 1.29 and 1.30 to something that will make sense for future
imports.
2005-05-04 15:55:29 +00:00
Max Laier
10ca483be0 Make LINT happy. 2005-05-04 15:29:28 +00:00
Takanori Watanabe
4ebd3ea1f6 Make smbfs capable to use 16bit char set in filenames.
PR:78110
2005-05-04 15:05:46 +00:00
Andre Oppermann
9e4ca6315d If we don't get a suggested MTU during path MTU discovery
look up the packet size of the packet that generated the
response, step down the MTU by one step through ip_next_mtu()
and try again.

Suggested by:	dwmalone
2005-05-04 13:48:44 +00:00
Gleb Smirnoff
1f8f08e1c9 Cleanup IPFW2 ifdefs. 2005-05-04 13:24:37 +00:00
Gleb Smirnoff
c3c2f9a9ba Makefile is not needed here. 2005-05-04 13:24:12 +00:00
Andre Oppermann
4c037f8d6e Add another step of 1280 (gif(4) tunnels) to ip_next_mtu(). 2005-05-04 13:23:54 +00:00
Gleb Smirnoff
a1429ad928 IPFW version 2 is the only option in HEAD and RELENG_5.
Thus, cleanup unnecessary now ifdefs.
2005-05-04 13:12:52 +00:00
Andre Oppermann
c773494edd Pass icmp_error() the MTU argument directly instead of
an interface pointer.  This simplifies a couple of uses
and removes some XXX workarounds.
2005-05-04 13:09:19 +00:00
Robert Watson
5264841183 Introduce MAC Framework and MAC Policy entry points to label and control
access to POSIX Semaphores:

mac_init_posix_sem()            Initialize label for POSIX semaphore
mac_create_posix_sem()          Create POSIX semaphore
mac_destroy_posix_sem()         Destroy POSIX semaphore
mac_check_posix_sem_destroy()   Check whether semaphore may be destroyed
mac_check_posix_sem_getvalue()  Check whether semaphore may be queried
mac_check_possix_sem_open()     Check whether semaphore may be opened
mac_check_posix_sem_post()      Check whether semaphore may be posted to
mac_check_posix_sem_unlink()    Check whether semaphore may be unlinked
mac_check_posix_sem_wait()      Check whether may wait on semaphore

Update Biba, MLS, Stub, and Test policies to implement these entry points.
For information flow policies, most semaphore operations are effectively
read/write.

Submitted by:	Dandekar Hrishikesh <rishi_dandekar at sbcglobal dot net>
Sponsored by:	DARPA, McAfee, SPARTA
Obtained from:	TrustedBSD Project
2005-05-04 10:39:15 +00:00
Christian S.J. Peron
a3272e3ce3 -introduce net.bpf sysctl instead of the less intuitive debug.*
debug.bpf_bufsize is now net.bpf.bufsize
    debug.bpf_maxbufsize is now net.bpf.maxbufsize

-move function prototypes for bpf_drvinit and bpf_clone up to the
 top of the file with the others
-assert bpfd lock in catchpacket() and bpf_wakeup()

MFC after:	2 weeks
2005-05-04 03:09:28 +00:00
Julian Elischer
6efba7ef05 A patch to support Palm Tungsten T via USB-Cradle.
not suer where it comes from but suspect kimoto at ohnolab.org

MFC after:	1 week
2005-05-04 00:46:24 +00:00
Robert Watson
97cce3269c Move definitions of 'struct kuser' and 'struct ksem' from uipc_sem.c
to ksem.h so that they are accessible from the MAC Framework for the
purposes of labeling and enforcing additional protections.  #error
if these are included without _KERNEL, since they are not intended
(nor installed) for user application use.

Submitted by:	Dandekar Hrishikesh <rishi_dandekar at sbcglobal dot net>
Sponsored by:	DARPA, SPARTA
Obtained from:	TrustedBSD Project
2005-05-03 20:21:24 +00:00
Max Laier
6441fe9598 Bump __FreeBSD_version for pf 3.7 and inform about user visible changes. 2005-05-03 17:43:14 +00:00
Max Laier
b01933e6bf Resolve conflicts created during the import of pf 3.7 Some features are
missing and will be implemented in a second step.  This is functional as is.

Tested by:	freebsd-pf, pfsense.org
Obtained from:	OpenBSD
X-MFC after:	never (breaks API/ABI)
2005-05-03 16:43:32 +00:00
Jeff Roberson
532c491b2b - Initialize vfslocked correctly early enough for MAC to compile.
- Fix one place where we explicitly drop Giant!

Pointy hat to:	me
Submitted by:	Max Laier
Warned by:	Tinderbox
2005-05-03 16:24:59 +00:00
Peter Grehan
c2399f7a3f - move to SCHED_4BSD per jeffr's comments on SCHED_ULE's state
- enable MSDOSFS
- ehci is stable on the powerbook
- modules have been working for a long time.
2005-05-03 11:56:05 +00:00
Jeff Roberson
ed4fe4f4f5 - Add a new object flag "OBJ_NEEDSGIANT". We set this flag if the
underlying vnode requires Giant.
 - In vm_fault only acquire Giant if the underlying object has NEEDSGIANT
   set.
 - In vm_object_shadow inherit the NEEDSGIANT flag from the backing object.
2005-05-03 11:11:26 +00:00
Jeff Roberson
d65736a1c0 - Set the v_object pointer after a successful VOP_OPEN(). This isn't a
perfect solution as the lower vm object can change at unpredictable times
   if our lower vp happens to be on another unionfs, etc.

Submitted by:	Oleg Sharoiko <os@rsu.ru>
2005-05-03 11:05:33 +00:00
Jeff Roberson
6c71a2208d - Don't restrict the softdep stats to DEBUG kernels, they cost nothing to
export.  This was happening anyway since this file manually sets DEBUG.
 - Add a sysctl for the number of items on the worklist.
 - Use a more canonical loop restart in softdep_fsync_mountdev, it saves
   some code at the expense of a goto and makes me worry less about
   modifying a variable that should be private to the TAILQ_FOREACH_SAFE
   macro.
2005-05-03 11:03:29 +00:00
Jeff Roberson
279d4d3761 - Remove two mtx_asserts that can incorrectly trigger if
devstat_end_transaction is called from a fast interrupt.  Presently
   there is no way for mtx_assert to determine that we're not executing
   in a real thread context.

Submitted by:	jhusted@isilon.com
2005-05-03 10:58:05 +00:00
Jeff Roberson
059f090fa1 - A vnode may have made its way onto the free list while it was being
vgone'd.  We must remove it from the freelist before returning in
   vtryrecycle() or we may get a duplicate free.

Reported by:	kkenn
2005-05-03 10:56:00 +00:00
Jeff Roberson
269576c82a - Use namei to acquire Giant for VFS if it is necessary. Drop the explicit
Giant acquisition.
 - Remove GIANT_REQUIRED in the few remaining cases; the vm and vfs have
   both been locked.
2005-05-03 10:55:05 +00:00
Jeff Roberson
6de925e58b - Use NAMEI to pickup Giant if we need it in fpcheckstd(). 2005-05-03 10:52:22 +00:00
Jeff Roberson
e11a45c9e5 - Neither of our image formats require Giant now that the vm and vfs have
been locked.
2005-05-03 10:51:38 +00:00
Søren Schmidt
eeda55ce8e Reshape the dma code to be a bit more flexible so it can cope with
new HW that has new and different demands.
Fix a few nits in former commit in this cleanup crusade.

Sponsored by:	pair.com
2005-05-03 07:55:07 +00:00
Scott Long
af06505ae3 Properly mask off the status bits when checking to see if the ccb is still
valid to process.  This was causing deferred commands to be rejected due
to their extra status flag.

MFC After: 3 days
2005-05-03 07:11:19 +00:00
Scott Long
701d9f1f1d The driver looks like it can create valid 64-bit scatter-gather lists, so
don't restrict it to a 32-bit address space.  Also use the correct busdma
flags for the SRB memory area.

MFC After: 3 days
2005-05-03 05:44:42 +00:00
Scott Long
4fd8c0dc7a The kthread is disabled at this time, so don't try to wake it up on
shutdown.  This fixes a panic on reboot.

MFC After: 3 days
2005-05-03 05:42:03 +00:00
Scott Long
cbe4fd54ef Fix some busdma API violations in the dumpsys handler.
MFC After: 3 days
2005-05-02 22:56:52 +00:00
Ian Dowse
2c443c417c Don't copy the NFSMNT_* flags into struct statfs's f_flags field,
as they have no connection with the expected MNT_* flags. This bug
was exposed 18 months ago when the assignments to f_flags in
vfs_syscalls.c were moved to before the VFS_STATFS() call. It was
fixed in the CSRG source 10 years ago, but we never picked up that
change.

PR:		kern/80390
MFC after:	1 week
2005-05-02 15:57:10 +00:00
Søren Schmidt
4156b20c71 Always attach a subdisk even if no valid metadata found.
This allows the disks to be used later in a raid create.
2005-05-02 07:06:50 +00:00
Alan Cox
b7903e65fb Remove GIANT_REQUIRED from vmspace_exec().
Prodded by: jeff
2005-05-02 07:05:20 +00:00
Christian S.J. Peron
02fe1744f1 Since it is not possible for curthread to be NULL in this context,
drop the check+initialization for a straight initialization. Also
assert that curthread will never be NULL just to be sure.

Discussed with:	rwatson, peter
MFC after:	1 week
2005-05-02 02:07:55 +00:00
Joseph Koshy
c5153e190b Add convenience APIs pmc_width() and pmc_capabilities() to -lpmc.
Have pmcstat(8) and pmccontrol(8) use these APIs.

Return PMC class-related constants (PMC widths and capabilities)
with the OP GETCPUINFO call leaving OP PMCINFO to return only the
dynamic information associated with a PMC (i.e., whether enabled,
owner pid, reload count etc.).

Allow pmc_read() (i.e., OPS PMCRW) on active self-attached PMCs to
get upto-date values from hardware since we can guarantee that the
hardware is running the correct PMC at the time of the call.

Bug fixes:
 - (x86 class processors) Fix a bug that prevented an RDPMC
   instruction from being recognized as permitted till after the
   attached process had context switched out and back in again after
   a pmc_start() call.

   Tighten the rules for using RDPMC class instructions: a GETMSR
   OP is now allowed only after an OP ATTACH has been done by the
   PMC's owner to itself.  OP GETMSR is not allowed for PMCs that
   track descendants, for PMCs attached to processes other than
   their owner processes.

 - (P4/HTT processors only) Fix a bug that caused the MI and MD
   layers to get out of sync.  Add a new MD operation 'get_config()'
   as part of this fix.

 - Allow multiple system-mode PMCs at the same row-index but on
   different CPUs to be allocated.

 - Reject allocation of an administratively disabled PMC.

Misc. code cleanups and refactoring.  Improve a few comments.
2005-05-01 14:11:49 +00:00
Robert Watson
b60d26c9b9 Remove now unused inirw variable from previous use of COMMON_END().
Reported by:	csjp
2005-05-01 14:01:38 +00:00
Peter Grehan
6ac8f17ee4 Catch up with latest ATA newbus commits. 2005-05-01 13:11:29 +00:00
Peter Grehan
73fddedac8 Fix typo in last commit.
Approved by:	rwatson
2005-05-01 13:06:05 +00:00
Søren Schmidt
9ec5e87f63 Update on the last commit, the dma* funciton needs to be called with
a channel device, not an ata device, or we'll be out of luck in
reset/timeout where we dont have a device.
2005-05-01 12:24:45 +00:00
Jeff Roberson
b2e2166483 - All buffers should either be clean or dirty. If neither of these flags
are set when we attempt to remove a buffer from a queue we should panic.
   Hopefully this will catch the source of the wrong bufobj panics.

Sponsored by:	Isilon Systems, Inc.
2005-05-01 12:00:36 +00:00
Robert Watson
d1401c9000 Slide unlocking of the tcbinfo lock earlier in tcp_usr_send(), as it's
needed only for implicit connect cases.  Under load, especially on SMP,
this can greatly reduce contention on the tcbinfo lock.

NB: Ambiguities about the state of so_pcb need to be resolved so that
all use of the tcbinfo lock in non-implicit connection cases can be
eliminated.

Submited by:	Kazuaki Oda <kaakun at highway dot ne dot jp>
2005-05-01 11:11:38 +00:00
Yoshihiro Takahashi
9b073f6668 Add some convenience defines. 2005-05-01 09:48:24 +00:00
Yoshihiro Takahashi
16da54931e Fix signed vs unsigned warning. 2005-05-01 09:44:50 +00:00
Søren Schmidt
1191f58127 Go back to the old way of finding the Promise metadata, the new way was
too simple causing older controllers metadata to get lost.
2005-05-01 08:45:12 +00:00
Yoshihiro Takahashi
fb4c2dbf41 MFi386: revision 1.1198 (add KDB_STOP_NMI option). 2005-05-01 04:00:12 +00:00
Yoshihiro Takahashi
3e2900d7e5 MFi386: revision 1.220 (add KDB_STOP_NMI option). 2005-05-01 03:59:25 +00:00
Jeff Roberson
8d46d9c46f - Remove spls and comments relating to them. 2005-05-01 01:01:17 +00:00
Jeff Roberson
194dfed917 - Remove an old splcam hack. 2005-05-01 00:59:55 +00:00
Jeff Roberson
5270a2dbe3 - Remove unnecessary spls. 2005-05-01 00:59:34 +00:00
Jeff Roberson
4d7d299383 - Return EACCES if we're trying to exec on a vp with no object.
Errno supplied by:	cperciva
2005-05-01 00:58:19 +00:00
Jeff Roberson
7b6b7657d2 - In devfs_open() and devfs_close() grab Giant if the driver sets NEEDGIANT.
We still have to DROP_GIANT and PICKUP_GIANT when NEEDGIANT is not set
   because vfs is still sometime entered with Giant held.
2005-05-01 00:56:34 +00:00
Sam Leffler
52bc746a28 o enable shutdown of taskqueue threads; the thread servicing the queue checks
a new entry in the taskqueue struct each time it wakes up to see if it
  should terminate
o adjust TASKQUEUE_DEFINE_THREAD & co. to record the thread/proc identity for
  the shutdown rendezvous
o replace wakeup after adding a task to a queue with wakeup_one; this helps
  queues where multiple threads are used to service tasks (e.g. acpi)
o remove NULL check of tq_enqueue method; it should never be NULL

Reviewed by:	dfr, njl
2005-05-01 00:38:11 +00:00
Doug White
fdc9713bf7 Implement an alternate method to stop CPUs when entering DDB. Normally we use
a regular IPI vector, but this vector is blocked when interrupts are disabled.
With "options KDB_STOP_NMI" and debug.kdb.stop_cpus_with_nmi set, KDB will
send an NMI to each CPU instead. The code also has a context-stuffing
feature which helps ddb extract the state of processes running on the
stopped CPUs.

KDB_STOP_NMI is only useful with SMP and complains if SMP is not defined.
This feature only applies to i386 and amd64 at the moment, but could be
used on other architectures with the appropriate MD bits.

Submitted by:	ups
2005-04-30 20:01:00 +00:00
Dag-Erling Smørgrav
4cd27a97bc Fix an old pasto. 2005-04-30 16:27:20 +00:00
Søren Schmidt
0068f98f88 Take newbusification one step further, ie use the device_t more consequently
all way through the code down the layers, instead of the mix'n'match that
resulted from the conversion done earlier.

Sponsored by:	pair.com
2005-04-30 16:22:07 +00:00
Jeff Roberson
4a723b3604 - Remove long dead splbio() calls and comments relating to the old
synchronization mechanism.
2005-04-30 12:18:50 +00:00
Jeff Roberson
ba4f7c7023 - Don't acquire Giant before calling b_biodone, individual consumers are
now required to do so themselves.

Sponsored by:	Isilon Systems, Inc.
2005-04-30 11:44:22 +00:00
Jeff Roberson
2524c26de8 - Use bdone() directly instead of calling it indirectly through
ffs_rawreaddone().

Sponsored by:	Isilon Systems, Inc.
2005-04-30 11:28:19 +00:00
Jeff Roberson
a230c79b9e - Acquire Giant in AIO's iodone routine. VFS will no longer do it for us
soon.

Sponsored by:	Isilon Systems, Inc.
2005-04-30 11:27:31 +00:00
Jeff Roberson
4e0ed69694 - Call VM_LOCK_GIANT in cluster_callback() to protect some pmap calls. VFS
will not be acquiring Giant before calling this function anymore.

Sponsored by:	Isilon Systems, Inc.
2005-04-30 11:26:58 +00:00
Jeff Roberson
382a601cd7 - VM_LOCK_GIANT in the swap pager's iodone routine as VFS will soon call it
without Giant.

Sponsored by:	Isilon Systems, Inc.
2005-04-30 11:25:49 +00:00
Jeff Roberson
cd360e947b - Mark devfs as MNTK_MPSAFE as I belive it does not require Giant.
Sponsored by:	Isilon Systems, Inc.
Agreed in principle by:		phk
2005-04-30 11:24:17 +00:00
Jeff Roberson
b2183bfe05 - In vnlru_free() remove the vnode from the free list before we call
vtryrecycle().  We could sometimes get into situations where two threads
   could try to recycle the same vnode before this.
 - vtryrecycle() is now responsible for returning the vnode to the free list
   if it fails and someone else hasn't done it.
 - Make a new function vfreehead() which moves a vnode to the head of the
   free list and use it in vgone() to clean up that code a bit.

Sponsored by:	Isilon Systems, Inc.
Reported by:	pho, kkenn
2005-04-30 11:22:40 +00:00
Colin Percival
9249fcc4b9 Add PROC_UNLOCK(p) to PTRACESTOP_SC(p, td, flag). This is necessary
due to a change made in revision 1.284 of sys/kern/kern_sig.c in August
2004 which made ptracestop() return with the process still locked.

Submitted by:	Mauritz Sundell
MFC After:	3 days
2005-04-29 22:38:02 +00:00
Vinod Kashyap
b598979dc9 Make call to tw_cl_deferred_interrupt in twa_poll, not dependent on the
return value from tw_cl_interrupt.
2005-04-29 20:03:20 +00:00
Robert Watson
5d1ae027f0 Modify UMA to use critical sections to protect per-CPU caches, rather than
mutexes, which offers lower overhead on both UP and SMP.  When allocating
from or freeing to the per-cpu cache, without INVARIANTS enabled, we now
no longer perform any mutex operations, which offers a 1%-3% performance
improvement in a variety of micro-benchmarks.  We rely on critical
sections to prevent (a) preemption resulting in reentrant access to UMA on
a single CPU, and (b) migration of the thread during access.  In the event
we need to go back to the zone for a new bucket, we release the critical
section to acquire the global zone mutex, and must re-acquire the critical
section and re-evaluate which cache we are accessing in case migration has
occured, or circumstances have changed in the current cache.

Per-CPU cache statistics are now gathered lock-free by the sysctl, which
can result in small races in statistics reporting for caches.

Reviewed by:	bmilekic, jeff (somewhat)
Tested by:	rwatson, kris, gnn, scottl, mike at sentex dot net, others
2005-04-29 18:56:36 +00:00
David E. O'Brien
97c1144eb2 Enable dc(4) and rl(4) in the PAE kernel.
Both have been busdma'ed for use and tested in the Sparc64 kenrel.
2005-04-29 18:12:22 +00:00
Søren Schmidt
e47099593a Now that probing is working in the new fashion, we need to go back to
having ata_getparm issue an ata_request and not fool around with the HW
on its own.
Needed for new HW support.
2005-04-29 11:30:03 +00:00
Warner Losh
4e30440d7c Add a detach for pci bridge and pci bus drivers. This allows one to
theoretically unload pci bridges or pci drivers.  It will also allow
detach to work if one needed to detach a subtree.

This is inspired by looking at the p4 commits from bms to his 5.4
tree, but I didn't look at the final results.
2005-04-29 06:22:41 +00:00
Ruslan Ermilov
f9067637f7 Fix the following warnings on amd64:
/usr/src/sbin/ipf/ipftest/../../../sys/contrib/ipfilter/netinet/ip_frag.c: In function `fr_ipid_newfrag':
/usr/src/sbin/ipf/ipftest/../../../sys/contrib/ipfilter/netinet/ip_frag.c:397: warning: cast to pointer from integer of different size
/usr/src/sbin/ipf/ipftest/../../../sys/contrib/ipfilter/netinet/ip_frag.c: In function `fr_ipid_knownfrag':
/usr/src/sbin/ipf/ipftest/../../../sys/contrib/ipfilter/netinet/ip_frag.c:582: warning: cast from pointer to integer of different size
2005-04-29 05:57:17 +00:00
Scott Long
a304e92b2b Only create the rdpti alias if the asr device creation succeeds. 2005-04-29 04:47:11 +00:00
Scott Long
a8e6f0b6fa For whatever reason, we don't allow USB on PAE. Since it's a dependency
for EHCI, exclude that driver also.
2005-04-29 02:59:19 +00:00
Scott Long
1c7e93581d Don't bother pretending that CAM will send CAM_DATA_PHYS pointers. It's
a concept that is fundamentally broken with PAE.
2005-04-29 02:58:23 +00:00
Scott Long
9fa98e70b0 Update the file.* entries for the new home of hwpmc 2005-04-29 02:40:16 +00:00
Marcel Moolenaar
d98d9b126b In pcib_alloc_resource() check if the resource allocation request is
for the VGA I/O or memory ranges, when it's not within the default
ranges decoded by the bridge. When allocation for VGA addresses is
attempted, check that the bridge has the VGA Enable bit set before
allowing it.
As such, newbusified VGA drivers can allocate their resources when
the VGA adapter is behind a PCI-to-PCI bridge.

Reviewed by: imp@, jhb@
2005-04-29 02:15:40 +00:00
Marcel Moolenaar
9929ff6b5b Add pci_is_vga_ioport_range() and pci_is_vga_memory_range() as inline
functions. These functions centralize the details of which I/O port
and memory ranges belong to VGA.

Reviewed by: imp@, jhb@
2005-04-29 02:03:11 +00:00
Marcel Moolenaar
d1ee178775 Add defines for the Bridge Control Register bits.
Obtained from: jhb@
2005-04-29 01:58:27 +00:00
Søren Schmidt
ca8c70e9e3 Provide a default setmode method.
This shaves off multiple copies of the same setmode stub.
2005-04-28 22:15:44 +00:00
Søren Schmidt
8dad6b7be5 Rearrange the way the reset code is called.
Prepare for different looking controllers.
2005-04-28 22:08:08 +00:00
Darren Reed
e01de6cda3 Don't use quad_t on FreeBSD (deprecated) so use "long long" instead.
Someday this should be converted to uint64_t and printstate.c changed to
use those horrid PRiud64 things.
2005-04-28 21:36:30 +00:00
Darren Reed
0c3757df94 Patches from Ruslan Ermilov to address problems compiling LINT 2005-04-28 16:33:15 +00:00
Ruslan Ermilov
1afc807b33 Be resistant to DESTDIR being set to some unkosher value, e.g. "/".
Noticed by:	Steve Ames
2005-04-28 14:45:57 +00:00
Paul Saab
4bb10cf193 Add support for the P600 and name the E400. 2005-04-28 14:40:23 +00:00
Lukas Ertl
bc2d4d6784 Only allow RAID5 plexes to be parity checked.
PR:           kern/80427
Submitty by:  Stijn Hoop <stijn@win.tue.nl>
2005-04-28 13:09:00 +00:00
Joseph Koshy
6b8c8cd85f Return the correct register number in the 'get_msr()' MD function.
Only allow a process to use the x86 RDPMC instruction if it has
allocated and attached a PMC to itself.

Inform the MD layer of the "pseudo context switch out" that needs
to be done when the last thread of a process is exiting.
2005-04-28 08:13:19 +00:00
Marcel Moolenaar
61d596a8ff Update comment to direct the reader to libkern.h instead of systm.h.
The functions were moved.

Pointed out by: johan@
2005-04-28 05:50:18 +00:00
Marcel Moolenaar
aa1548fd85 Slightly reformat apb_alloc_resource() to create some horizontal space
for enhancements. Shorten apb_map_checkrange() to apb_checkrange() for
the same reason. No functional change.
2005-04-28 03:33:46 +00:00
Marcel Moolenaar
db302d160b Inline functions belong in <sys/libkern.h>, not in <sys/systm.h>.
Move crc32() and crc32_raw() from the latter to the former. Move
the declaration of crc32_tab[] to <sys/libkern.h> as well.

Pointed out by: bde@
Tested on: ia64, sparc64
2005-04-28 03:19:50 +00:00
Joseph Koshy
ff7120cae1 Delete stale files post their move to "sys/dev/hwpmc/". 2005-04-28 01:32:58 +00:00
Joseph Koshy
c9fb16636c Use the new path (post repo-copy) to our sources. 2005-04-28 00:53:45 +00:00
Marcel Moolenaar
ee6bcf1223 Refactor the CRC-32 code to enhance its usability. Move the actual
CRC logic to a new function: crc32_raw() that obtains the initial
CRC value as well as leaves any post-processing to the caller. As
such, it can be used when the initial CRC value is not ~0U or when
the final CRC value does need to be inverted (bitwise). It also
means that crc32_raw() can be called repeatedly when the data is
not available as a single block, such as for scatter/gather lists
and the likes.

Avoid the additional call overhead incured by the refactoring by
moving the implementation off crc32() to sys/systm.h and making it
inlinable. Since crc32_raw() is itself trivial and since it may
be used in loops that iterate over fragments, having it available
for inlining can be beneficial. Hence, move its implementation
to sys/systm.h as well.

Keep the original implementation of crc32() in libkern/crc32.c for
documentation purposes (as a comment of course).

Triggered by: Jose M Rodriguez (josemi at freebsd dot jazztel dot es)
Discussed on: current@
Tested on: amd64, ia64 (BVO having GPT partitions)
Jargon file candidate: BVO = By Virtue Of :-)
2005-04-27 22:26:45 +00:00
Marcel Moolenaar
ca83142fc3 Make the Z8530 more reliable as low-level console by making use of the
fact that access to RR0 does not need a prior write to the register
index because the index always reverts to 0 after the indexed register
has been accessed.

Typically when a RR or WR is to accessed, one programs the index (which
is a write to the control register), followed by a read or write to the
actual indexed register (a read pr write to the same control register).
When this non-atomic sequence is interrupted after having written the
index and low-level console I/O is done in that situation, the write to
program the index will actually write to the indexed register and nuke
state. This almost always yields a wedge.

By not programming the index register and instead just reading from RR0,
the worst case scenario is non-fatal. For if we don't actually read from
RR0 but some other register we get an invalid status, which may lead us
to conclude that the transit data register is empty when it's not or that
the receive data register contains data when it doesn't. Hence, we may
lose an output character or get a sporadic input character, but given
the situation this is a non-issue.

Full serialization is not possible due to the fact that this code needs
to work from DDB and before mutex initialization has happened.

In collaboration with: kris@, marius@
Tested by: kris@
MFC after: 1 day
X-MFC: 5.4-RELEASE candidate
2005-04-27 21:57:51 +00:00
Julian Elischer
7f05203a38 Add code from Kazuhito HONDA that allows the user to see
the available modes in /dev/sndstat.
e.g.
pcm1: <USB Audio> at addr ? (0p/1r/0v channels duplex)
        mode 1:(input) 1ch, 16/16bit, pcm, 44100Hz
	mode 2:(input) 1ch, 16/16bit, pcm, 22050Hz
	mode 3:(input) 1ch, 16/16bit, pcm, 11025Hz
	mode 4:(input) 1ch, 16/16bit, pcm, 8000Hz
2005-04-27 17:16:27 +00:00
Dag-Erling Smørgrav
4104e6bc1d When NFS was converted to the new mount syscall, code was written that sets
the MNT_RDONLY flag if the "ro" option was passed in from userland, and
clears it otherwise.  In the diskless case, the MNT_RDONLY flag is already
set when this code is reached, but there are no mount options, so it was
incorrectly cleared.  Change the logic so the MNT_RDONLY flag is set if the
"ro" option was specified, and left alone otherwise.

Note that the NFS code will still happily let you mount a filesystem RW
even if the server exports it RO.  I'm not sure how to fix that.
2005-04-27 14:46:02 +00:00
Olivier Houchard
a74efe926c Allocating the memory for the kernel stack one time is enough. 2005-04-27 13:29:54 +00:00
Jeff Roberson
0dd02d67eb - Don't vgonel() via vgone() or vrecycle() if the vnode is already doomed.
This fixes forced unmounts via nullfs.

Reported by:	kkenn
Sponsored by:	Isilon Systems, Inc.
2005-04-27 10:03:21 +00:00
Jeff Roberson
fc8dfa75a7 - Changes to vgone() and related teardown code have meant that the vxthread
pointer is no longer needed.
2005-04-27 09:18:10 +00:00
Jeff Roberson
6c317bc4cf - Stop setting vxthread, we've asserted that it was useless for several
weeks now.
2005-04-27 09:17:33 +00:00
Jeff Roberson
549817334a - Stop checking vxthread, we've asserted that it was useless for several
weeks.
2005-04-27 09:17:11 +00:00
Jeff Roberson
568556d720 - Fix several locking problems in unionfs_mount so that it will come
closer to passing DEBUG_VFS_LOCKS.
2005-04-27 09:07:13 +00:00
Jeff Roberson
189dd72df3 - Pass the ISOPEN flag down to our lower filesystems.
- Remove an erroneous VOP lock assert.
2005-04-27 09:06:06 +00:00
Jeff Roberson
7625cbf3cc - Pass the ISOPEN flag to namei so filesystems will know we're about to
open them or otherwise access the data.
2005-04-27 09:05:19 +00:00
Jeff Roberson
53c34859a7 - Add an ISOPEN flag that filesystems can use to determine if a namei()
caller will be interested in the actual data contents of a vnode after
   a successful lookup.  This intended to help deal with lifetime issues
   for device cloning and to alert autofs when filesystems need to be
   mounted.
2005-04-27 09:00:47 +00:00
Darren Reed
caec4e7746 The current H.323 proxy source has a license that isn't suitable for inclusion
with FreeBSD so we shouldn't be trying to include it here.
2005-04-27 05:53:12 +00:00
Darren Reed
b1660bb30d - Comment out duplicate rcsid strings in *.c files
- Move SIOCPROXY from ip_nat.h to ip_proxy.h and fix ip_proxy.h so that it
  can be easily compiled into kdump, et al.
2005-04-27 03:48:10 +00:00
Dag-Erling Smørgrav
c6acf6d557 While I'm here, list the new kenv (boot.netif.name) along with the others. 2005-04-26 20:47:59 +00:00
Dag-Erling Smørgrav
8f0aecc01f When netbooting, as soon as we've figured out which interface we booted
from, store its name in a kenv variable.
2005-04-26 20:45:29 +00:00
Brooks Davis
31519b13c8 Introduce a struct icmphdr which contains the type, code, and cksum
fields of an ICMP packet.

Use this to allow ipfw to pullup only these values since it does not use
the rest of the packet and it was failed on ICMP packets because they
were not long enough.

struct icmp should probably be modified to use these at some point, but
that will break a fair bit of code so it can wait for another day.

On the off chance that adding this struct breaks something in ports,
bump __FreeBSD_version.

Reported by:	Randy Bush <randy at psg dot com>
Tested by:	Randy Bush <randy at psg dot com>
2005-04-26 18:10:21 +00:00
Darren Reed
c81e55a2df Add an include for netinet/ip_compat.h directly so that we don't need to
add another special file in the creation of ioctls.c for kdump.
2005-04-26 17:58:05 +00:00
John Baldwin
0e56f395c0 Drop the CURPROC, curkse, and curksegrp aliases as they aren't used
anywhere.
2005-04-26 17:07:40 +00:00
David E. O'Brien
34eea30cf1 I missed a s/nv/nve/.
Submitted by:	Tai-hwa Liang <avatar@mmlab.cse.yzu.edu.tw>
2005-04-26 16:07:50 +00:00
Scott Long
4ef63bad69 Remove an extra mutex unlock in the morpheus interrupt handler.
PR: 80246
Submitted by: Dean Strik
MFC After: 3 days
2005-04-26 13:38:29 +00:00
Robert Watson
7849b49a60 Add 'curcpu', a shortcut to the current CPU ID, similar to curthread,
curproc, et al.  Useful for indexing into per-CPU data structures.

MFC after:	2 weeks
2005-04-26 13:15:49 +00:00
Søren Schmidt
f1be1cdc88 Fix a bug introduced in r1.89 thats caused leak of requests, and possibly
bogus data to be written.
2005-04-26 06:42:33 +00:00
Bill Paul
627e5814bc Remove the extra EEPROM reload step I added before. vge_reset()
already does this anyway.
2005-04-25 23:26:20 +00:00
Scott Long
20fc2576fe Apply a torniquet to the problem of the drive unexpectedly disconnecting
during a data phase.  Before, we would try to recover the autosense, but
the DMA engine would still be active with interrupted transfer, and we'd
quickly spiral out of control and cause massive data corruption.  For now,
just reset the chip and cancel everything.  The better solution is to
cancel the DMA operation, but there is no clear way to do that right now.
The data corruption problem is severe enough to warrant this fix in the
interim.  Thanks to Kris Kenneway to sacrificing countless filesystems to
this bug.

MFC After: 3 days
2005-04-25 22:11:43 +00:00
Scott Long
379ad24369 Remove the ACPI_MAX_THREADS option. 2005-04-25 19:59:09 +00:00
Kris Kennaway
f5fca0d8be Add the vm.exec_map_entries tunable and read-only sysctl, which controls
the number of entries in exec_map (maximum number of simultaneous execs
that can be handled by the kernel).  The default value of 16 is
insufficient on heavily loaded machines (particularly SMP machines), and
if it is exceeded then executing further processes will generate a SIGABRT.

This is a workaround until a better solution can be implemented.

Reviewed by:	alc
MFC after:	3 days
2005-04-25 19:22:05 +00:00
Darren Reed
1033f3c55b new files and compile defines to build new ipfilter 2005-04-25 18:46:00 +00:00
Darren Reed
6eab6ed50f Merge the changes from 3.4.35 to 4.1.8 into the kernel source tree 2005-04-25 18:43:14 +00:00
Bill Paul
42559cd2af Correct the if_link_state_change() logic: when the link went down,
if_link_state_change() reported link up, and when the link went up,
if_link_state_change() reported link down. These should be swapped.
2005-04-25 18:37:27 +00:00
Bill Paul
bb74e5f6f9 Reading the EEPROM to learn the station address doesn't seem to work
on boards with VIA gigE controllers that are embedded in VIA chipsets.
Presumably, they don't have an external EEPROM and store the MAC
address somewhere else. To get around this, force an autoload and
read the station address from the RX filter registers instead.
This has been tested to work on both embedded and standalone
controllers.
2005-04-25 18:29:42 +00:00
Darren Reed
d607092b37 This commit was generated by cvs2svn to compensate for changes in r145516,
which included commits to RCS files with non-trunk default branches.
2005-04-25 18:15:41 +00:00
Darren Reed
8158c4468d import ipfilter 4.1.8 into the kernel source tree 2005-04-25 18:15:41 +00:00
Ruslan Ermilov
e2bc0fb2ea Allow BOOT_BOOT0_COMCONSOLE_SPEED to be derived from BOOT_COMCONSOLE_SPEED
at compile time.
2005-04-25 17:41:35 +00:00
Pawel Jakub Dawidek
3865ca2e13 Fix provider's size check for 'insert' command.
Before this fix one was able to insert one sector too small provider.

MFC after:	3 days
2005-04-25 10:41:26 +00:00
Bjoern A. Zeeb
261a19c1ee Deal with failed malloc calls[1].
While there also check for failed device_add_child calls.

Found by:	Coventry Analysis tool[1].
Submitted by:	sam[1]
Approved by:	pjd (mentor)
MFC after:	1 week
2005-04-25 10:18:24 +00:00
Søren Schmidt
ecd6c15d6a Cosmetics 2005-04-25 07:57:04 +00:00
Søren Schmidt
6257850052 Only try to allocate and use the SATA resource if they are enabled
by the BIOS. It seems some BIOS's doesn't get this right, and that would
result in ATA panic'ing.
2005-04-25 07:50:51 +00:00
Poul-Henning Kamp
e4ee89af6f Retire the musycc E1/T1 driver 2005-04-25 07:08:42 +00:00
Poul-Henning Kamp
c146a15791 retire the musycc E1/T1 driver. 2005-04-25 07:07:50 +00:00
Nate Lawson
d83c213c4f Remove obsolete option.
MFC after:	1 day
2005-04-25 06:24:19 +00:00
Jeff Roberson
3b06a01534 - We want if (mrep != NULL) not if (m_freem != NULL). m_freem will never
be NULL and we will always leak mrep in the error case.

Submitted by:	 Greg Taleck <gtaleck@isilon.com>
2005-04-25 05:11:19 +00:00
Matthew N. Dodd
abb886facb Add missing break.
Found by:	marcus
2005-04-25 00:48:04 +00:00
Bill Paul
96b50ea387 Throw the switch on the new driver generation/loading mechanism. From
here on in, if_ndis.ko will be pre-built as a module, and can be built
into a static kernel (though it's not part of GENERIC). Drivers are
created using the new ndisgen(8) script, which uses ndiscvt(8) under
the covers, along with a few other tools. The result is a driver module
that can be kldloaded into the kernel.

A driver with foo.inf and foo.sys files will be converted into
foo_sys.ko (and foo_sys.o, for those who want/need to make static
kernels). This module contains all of the necessary info from the
.INF file and the driver binary image, converted into an ELF module.
You can kldload this module (or add it to /boot/loader.conf) to have
it loaded automatically. Any required firmware files can be bundled
into the module as well (or converted/loaded separately).

Also, add a workaround for a problem in NdisMSleep(). During system
bootstrap (cold == 1), msleep() always returns 0 without actually
sleeping. The Intel 2200BG driver uses NdisMSleep() to wait for
the NIC's firmware to come to life, and fails to load if NdisMSleep()
doesn't actually delay. As a workaround, if msleep() (and hence
ndis_thsuspend()) returns 0, use a hard DELAY() to sleep instead).
This is not really the right thing to do, but we can't really do much
else. At the very least, this makes the Intel driver happy.

There are probably other drivers that fail in this way during bootstrap.
Unfortunately, the only workaround for those is to avoid pre-loading
them and kldload them once the system is running instead.
2005-04-24 20:21:22 +00:00
Eric Anholt
7c26ccfd22 Fix a panic on X startup for drivers that don't init maps themselves by storing
the return value of drm_ioremap in the right place again.

Submitted by:	tegge
2005-04-24 19:03:32 +00:00
Sam Leffler
f4581151a8 o eliminate modification of task structures after their run to avoid
modify-after-free races when the task structure is malloc'd
o shrink task structure by removing ta_flags (no longer needed with
  avoid fix) and combining ta_pending and ta_priority

Reviewed by:	dwhite, dfr
MFC after:	4 days
2005-04-24 16:52:45 +00:00
Scott Long
2f28b97311 Fix the order of the lowaddr,highaddr arguments in the parent tag. This
coincidentally didn't cause any problems, but was definitely wrong.
2005-04-24 02:45:27 +00:00
Olivier Houchard
42722183bf Don't use fusufault in casuptr(), as it assumes the current PCB will be
stored in r2, which can't be easily done with casuptr(). Introduce
casuptrfault instead.
2005-04-23 16:45:04 +00:00
David Xu
bc247e78c0 Wake up swapper process if needed.
PR: kern/78474
Submitted by: Sam Lawrance <boris at brooknet dot com dot au>
2005-04-23 05:06:44 +00:00
David Xu
40f2d4dafd Regen. 2005-04-23 02:38:17 +00:00
David Xu
c4bd610f58 Add new syscall thr_new to create thread in atomic, it will
inherit signal mask from parent thread, setup TLS and stack, and
user entry address.
Also support POSIX thread's PTHREAD_SCOPE_PROCESS and PTHREAD_SCOPE_SYSTEM,
sysctl is also provided to control the scheduler scope.
2005-04-23 02:36:07 +00:00
David Xu
21fc316430 Change cpu_set_kse_upcall to more generic style, so we can reuse it
in other codes. Add cpu_set_user_tls, use it to tweak user register
and setup user TLS. I ever wanted to merge it into cpu_set_kse_upcall,
but since cpu_set_kse_upcall is also used by M:N threads which may
not need this feature, so I wrote a separated cpu_set_user_tls.
2005-04-23 02:32:32 +00:00
Jeff Roberson
17314e6286 - Define the real lock order with cdev and a few vm/vfs related locks. This
can be removed once cdev no longer calls free() with the cdev lock held.
2005-04-22 22:43:31 +00:00
Jeff Roberson
7fd2deacb4 - As this is presently the one and only place where duplicate acquires of
the vnode interlock are allowed mark it by passing MTX_DUPOK to this
   lock operation only.

Sponsored by:	Isilon Systems, Inc.
2005-04-22 22:42:44 +00:00
Jeff Roberson
ab9707d7e6 - Add a VI_LOCK_FLAGS so we can pass MTX_DUPOK in. This somewhat defeats
the purpose of having macros to hide the lock type as we may now be
   dependent on MTX_ flags.

Sponsored by:	Isilon Systems, Inc.
2005-04-22 22:41:53 +00:00
Jeff Roberson
57f66be038 - Check LO_DUPOK as well as LOP_DUPOK when determining whether we should
warn about duplicate acquires.

Sponsored by:	Isilon Systems, Inc.
2005-04-22 22:39:46 +00:00
Jeff Roberson
951407abad - Define LOP_DUPOK in lock.h so that we may pass it to individual
witness calls rather than as a flag on the lock object.
 - Define MTX_DUPOK in terms of LOP_DUPOK in mutex.h.

Sponsored by:	Isilon Systems, Inc.
2005-04-22 22:37:41 +00:00
Ruslan Ermilov
484060ebae Make aic*_reg_print.o appear in the .depend file, fixing the "make"
failure after "make depend; make clean".

Prodded by:	bde
2005-04-22 20:00:41 +00:00
Ruslan Ermilov
3365523e54 Clean all generated vnode_if* files. 2005-04-22 19:58:22 +00:00
Ruslan Ermilov
108311ba68 Clean generated os+%DIKED-nve.h. 2005-04-22 19:55:52 +00:00
Tom Rhodes
498693053c Get the directory structure correct in a comment.
Submitted by:	Samy Al Bahra
2005-04-22 19:09:12 +00:00
Tom Rhodes
a203d9780b Add locking support to mac_bsdextended:
- Introduce a global mutex, mac_bsdextended_mtx, to protect the rule
   array and hold this mutex over use and modification of the rule array
   and rules.
- Re-order and clean up sysctl_rule so that copyin/copyout/update happen
   in the right order (suggested by: jhb done by rwatson).
2005-04-22 18:49:30 +00:00
Ruslan Ermilov
2bdb87fe2e Revert a mistake borrowed from kern.post.mk that has just been fixed. 2005-04-22 17:39:58 +00:00
Ruslan Ermilov
a13914f600 Fix "make depend" to not redundantly rebuild the .depend file.
Reviewed by:	bde (I think so)
2005-04-22 17:36:25 +00:00
Maxime Henrion
507feeafad Be more conservative when enabling extended features. There are fxp(4)
NICs out there that have an utterly bogus revision ID.

Reported by:	Denis Shaposhnikov <dsh@vlink.ru>
2005-04-22 13:05:53 +00:00
Gleb Smirnoff
2fa088e969 Fix error in synproxy connection completion. Source and
destination windows were confused, one instead of other.
This error was masked, because first segment of just
established connection is usually smaller than initially
announced window, and it was successfully passed. First
window reannouncement corrected erroneous 'seqhi' value.
The error showed up when client connected to synproxy
with zero initial window, and reannounced it after
session establishment.

In collaboration with:	dhartmei [we came to same patch independtly]
Reviewed by:		mlaier
Sponsored by:		Rambler
MFC after:		3 days
2005-04-22 09:53:46 +00:00
Ian Dowse
b8619d3608 Pick up the selectors to use for various kernel segments from assym.s
instead of assuming fixed offsets within the GDT. The hard-coded
values here have been incorrect since Peter's GDT rearranging around
10 days ago, causing ACPI resume problems.

Reviewed by:	peter
2005-04-22 09:53:04 +00:00
Ian Dowse
705d63cd9a Add rules for building assym.s. 2005-04-22 09:45:39 +00:00
Warner Losh
c4bb0466ff Add sio and puc to i386 build.
Remove ray from ia64 build since it hasn't been tested there.
2005-04-22 07:59:50 +00:00
Warner Losh
8343165363 Sort Oxford Semi entires. Add entry for OXCB950, a PCI/CardBus
16C950.  Adding it here doesn't unlock any of the cool 16C950 features
(like the 128 byte fifo, the different prescalor, etc), but it does
seem to get it working for me in light testing.

Card Provided by: Ihsan Dogan
2005-04-22 07:49:35 +00:00
Warner Losh
40c949ffa4 Create a puc module. Not connected to the build until I can test it on
more machines.
2005-04-22 07:43:27 +00:00
Marcel Moolenaar
8773a80baf Sanity the RTC code:
o  Remove the clock interface. Not only does it conflict with the MI
   version when device genclock is added to the kernel, it was also
   not possible to have more than 1 clock device. This of course would
   have been a problem if we actually had more than 1 clock device.
   In short: we don't need a clock interface and if we do eventually,
   we should be using the MI one.
o  Rewrite inittodr() and resettodr() to take into account that:
   1)  We use the EFI interface directly.
   2)  time_t is 64-bit and we do need to make sure we can determine
       leap years from year 2100 and on. Add a nice explanation of
       where leap years come from and why.
   3)  This rewrite happened in 2005 so any date prior to 1/1/2005
       (either M/D/Y or D/M/Y) is bogus. Reprogram the EFI clock with
       1/1/2005 in that case.
   4)  The EFI clock has a high probability of being correct, so
       only (further) correct the EFI clock when the file system time
       is larger. That should never happen in a time-synchronised world.
       Complain when EFI lost 2 days or more.

Replace the copyright notice now that I (pretty much) rewrote all of
this file.
2005-04-22 05:04:58 +00:00
Scott Long
4bd55c43ea If we get interrupted during a data phase and the DMA engine is still
pumping data despite our scsi data counters being at 0, something has
gone massively wrong.  The consequence of happily ignoring this is more
DMA phase errors and a disk full of spammed sectors.  Instead, panic on
the first occurance to hopefully limit the damage.

MFC After: 3 days
2005-04-22 03:37:10 +00:00
Jeff Roberson
7d60dc524b - Disable code which allows getnewvnode() to fail. Many ffs_vget() callers
do not correctly deal with failures.  This presently risks deadlock
   problems if dependency processing is held up by failures to allocate
   a vnode, however, this is better than the situation with the failures.

Sponsored by:	Isilon Systems, Inc.
2005-04-22 00:57:05 +00:00
Jeff Roberson
0d12524bbf - Add two KASSERTs to prevent us from recycling a buf that is still on a
bufobj list.

Sponsored by:	Isilon Systems, Inc.
2005-04-22 00:53:20 +00:00
Alan Cox
c0862430d5 Eliminate an unpredictable branch from bcmp().
Reviewed by: bde
2005-04-21 23:07:20 +00:00
Paul Saab
91232d6ccc Remove some code that snuck in by accident.
Submitted by:	Mohan Srinivasan
2005-04-21 20:29:40 +00:00
Paul Saab
be3f3b5ead Fix for interaction problems between TCP SACK and TCP Signature.
If TCP Signatures are enabled, the maximum allowed sack blocks aren't
going to fit. The fix is to compute how many sack blocks fit and tack
these on last. Also on SYNs, defer padding until after the SACK
PERMITTED option has been added.

Found by:	Mohan Srinivasan.
Submitted by:	Mohan Srinivasan, Noritoshi Demizu.
Reviewed by:	Raja Mukerji.
2005-04-21 20:26:07 +00:00
Paul Saab
97b76190eb Undo rev 1.71 as it is the wrong change. 2005-04-21 20:24:43 +00:00
Paul Saab
a6235da61e - Make the sack scoreboard logic use the TAILQ macros. This improves
code readability and facilitates some anticipated optimizations in
  tcp_sack_option().
- Remove tcp_print_holes() and TCP_SACK_DEBUG.

Submitted by:	Raja Mukerji.
Reviewed by:	Mohan Srinivasan, Noritoshi Demizu.
2005-04-21 20:11:01 +00:00
Paul Saab
a3047bc036 Fix for 2 bugs related to TCP Signatures :
- If the peer sends the Signature option in the SYN, use of Timestamps
  and Window Scaling were disabled (even if the peer supports them).
- The sender must not disable signatures if the option is absent in
  the received SYN. (See comment in syncache_add()).

Found, Submitted by:	Noritoshi Demizu <demizu at dd dot ij4u dot or dot jp>.
Reviewed by:		Mohan Srinivasan <mohans at yahoo-inc dot com>.
2005-04-21 20:09:09 +00:00
Maxime Henrion
de57160389 Add a microcode to implement receive bundling for 82551 chipsets with
a revision ID of 0x0f (D102 E-step).

MFC after:	2 weeks
Tested by:	pav
2005-04-21 19:34:57 +00:00
Andre Oppermann
1aedbd9c80 Move Path MTU discovery ICMP processing from icmp_input() to
tcp_ctlinput() and subject it to active tcpcb and sequence
number checking.  Previously any ICMP unreachable/needfrag
message would cause an update to the TCP hostcache.  Now only
ICMP PMTU messages belonging to an active TCP session with
the correct src/dst/port and sequence number will update the
hostcache and complete the path MTU discovery process.

Note that we don't entirely implement the recommended counter
measures of Section 7.2 of the paper.  However we close down
the possible degradation vector from trivially easy to really
complex and resource intensive.  In addition we have limited
the smallest acceptable MTU with net.inet.tcp.minmss sysctl
for some time already, further reducing the effect of any
degradation due to an attack.

Security:	draft-gont-tcpm-icmp-attacks-03.txt Section 7.2
MFC after:	3 days
2005-04-21 14:29:34 +00:00
Maxime Henrion
647ec60cc7 Enable extended RFDs and TCBs, and thus checksum offloading, for
latest 82550 and 82551 chipsets (revision IDs 0x0e, 0x0f and 0x10).
We were only enabling it for revisions 0x0c and 0x0d, now it's
enabled for any 8255x NIC with a revision ID bigger than 0x0c.  It
should be safe, and this is what Intel does in their open source
driver.

MFC after:	2 weeks
Tested by:	Pavel Lobach lobach_pavel at mail dot ru
2005-04-21 13:27:38 +00:00
Andre Oppermann
1600372b6b Ignore ICMP Source Quench messages for TCP sessions. Source Quench is
ineffective, depreciated and can be abused to degrade the performance
of active TCP sessions if spoofed.

Replace a bogus call to tcp_quench() in tcp_output() with the direct
equivalent tcpcb variable assignment.

Security:	draft-gont-tcpm-icmp-attacks-03.txt Section 7.1
MFC after:	3 days
2005-04-21 12:37:12 +00:00
Søren Schmidt
1d968d225f Rehash the timeout code to make it more simple.
This also removes the warning timeout on the taskqueues stalling as
I'm tired of getting ATA error reports for problems in other parts ;)
Misc cosmetic and comment cleanups now we are here.
2005-04-21 11:13:39 +00:00
Nate Lawson
98cc161947 Add the tunable "debug.acpi.max_threads" to allow users to set the
number of task threads to start on boot.  Go back to a default of 3
threads to work around lost battery state problems.  Users that need
a setting of 1 can set this via the tunable.  I am investigating the
underlying issues and this tunable can be removed once they are solved.

MFC after:	2 days
2005-04-21 06:13:48 +00:00
Marcel Moolenaar
d47cce3ec8 Revert previous commit: The hwpmc(4) driver compiles on all platforms. 2005-04-20 22:19:51 +00:00
Marcel Moolenaar
9c3a12812b Revert previous commit: build hwpmc(4) on all architectures.
Ok'd by: jkoshy@
2005-04-20 22:03:33 +00:00
Paul Saab
8cb038b4b2 Don't enter the debugger if KDB_UNATTENDED is set or if
debug.debugger_on_panic=0.

MFC after:	2 weeks
2005-04-20 20:52:46 +00:00
Marcel Moolenaar
1020bb9756 Do not conditionally compile the contents of this file upon whether
HWPMC_HOOKS is defined. The pmc_cpu_is_*() functions in this file
are referenced unconditionally by hwpmc(4).

This is mostly a stop-gap. The pmc_cpu_is*() function should
probably be declared inline in <sys/pmc.h> or <sys/pmckern.h> and
the function pointers with corresponding SX lock should probably
be moved to another file and compiled conditionally upon HWPMC_HOOKS.

Ok'd by: jkoshy@
2005-04-20 20:30:59 +00:00
Marcel Moolenaar
7ad17ef97e Include <sys/pmc.h> instead of <machine/pmc_mdep.h>. The MI header
includes the MD header for us. Do not include <machine/specialreg.h>
as it is not a header file that can be included from MI files. It
is included from <machine/pmc_mdep.h> if so needed and possible.

Ok'd: jkoshy@
2005-04-20 20:26:39 +00:00
Marcel Moolenaar
76b6d954f0 o Reverse the inclusion chain from MD->MI to MI->MD by removing the
inclusion of <sys/pmc.h> and depending on being included from
   that header file.
o  Include any MD specific header files that otherwise need to be
   included from MI files.

Ok'd: jkoshy@
2005-04-20 20:22:33 +00:00
Marcel Moolenaar
26a38a07e3 o Reverse the inclusion chain from MD->MI to MI->MD by including
<machine/pmc_mdep.h> here.
o  Remove the #error directive. There's no union md_pm referenced
   on (as of yet) unsupported platforms and will not be if there
   are no MD extensions for a particular platform.

Further cleanups can be expected.

Ok'd: jkoshy@
2005-04-20 20:19:24 +00:00
Marcel Moolenaar
ff7125a623 Add empty header (except of the multiple-inclusion protection) to
get hwpmc(4) to compile on this platform.
2005-04-20 18:44:53 +00:00
Gleb Smirnoff
15749e57aa - Initialize interface as UP when hook is connected.
- Call if_link_state_change() when netgraph flow control
  messages are received.

Sponsored by:	Rambler
2005-04-20 14:22:13 +00:00
Gleb Smirnoff
3b1c41c548 When netgraph flow control message comes from downstream, broadcast
it to all vlans.

Sponsored by:	Rambler
2005-04-20 14:19:20 +00:00
Søren Schmidt
46917bb6f4 When a rebuild is done, properly mark the arrays as functional again. 2005-04-20 14:14:08 +00:00
David Xu
3d5c30f7c2 Inherit signal mask for child process in fork1(), RELENG_4 and other
*BSD have this behaviour, also it is required by POSIX.

PR: kern/80130
Submitted by: Kostik Belousov konstantin.belousov at zoral dot com dot ua
2005-04-20 13:14:52 +00:00