Commit Graph

68285 Commits

Author SHA1 Message Date
Warner Losh
1b146a73ee After some intial testing, there are even slower cards than the ones
that I have.  Wait up to 1.1s for the card to become ready.  Document
what the standards say, and use that to justify the behavior in the
code: PCI standard says that a card must respond to configuration
cycles within 2^25 cycles after reset goes high, which is
approximately 1s.  Therefore, give cards a little break and wait for
up to 1.1s for VENDOR to become valid.  Only look at the vendor part
of the ID, since only it can't be 0xffff (although in practice
vendor/device will always be != 0xfffffffff).  Include detailed
pointers to standards so epople understand why we're doing what we're
doing and why it just might be OK.  Make it clear in the timeout
message that it is just a warning, sinc we try to soldier on as best
we can anyway.

This should eliminate an error message that r181453 produced on
certain Atheros cards.
2008-08-09 07:41:18 +00:00
Alan Cox
b09485a336 Intel describes the behavior of their processors as "undefined" if two or
more mappings to the same physical page have different memory types, i.e.,
PAT settings.  Consequently, if pmap_change_attr() is applied to a virtual
address range within the kernel map, then the corresponding ranges of the
direct map also need to be changed.  Enhance pmap_change_attr() to handle
this case automatically.

Add a comment describing what pmap_change_attr() does.

Discussed with:	jhb
2008-08-09 05:46:13 +00:00
Warner Losh
3dfff737f3 Verify that the WPA flags set are actually compatible with the
driver's set of valid flags.  Otherwise, wpa_supplicant wouldn't
report an error for old wi cards that can't do WPA.

Reviewed by:	sam@
2008-08-09 05:46:01 +00:00
Warner Losh
bfd58cce84 Rather than waiting a fixed amount of time, which might not be enough
and also holds things up, check every 20ms to see if we can read the
vendor of device 0.0.  It will be 0xffffffff until the card is out of
reset.  Always wait at least 20ms, for safety.

I think this is a better fix to the reset problem.  However, I did it
as a separate commit in case something bad happens, people can roll
back to the commit before this one to see if that gives them reliable
behavior.  I don't have FreeBSD up on enough machines to do exhaustive
testing on all known bridges...
2008-08-09 04:08:36 +00:00
Warner Losh
e33abcc50c Change -1 to 0xfffffffful since the interface returns uint32_t. 2008-08-09 03:54:12 +00:00
Warner Losh
ae438af62d While most bridges can bring a card out of reset in 20ms, there are
some bridge + card combinations that take longer for reasons unknown.
Adjust the timeout to be 100ms on all !RICOH bridges, but leave RICOH
at 400ms.  The 400ms is "lore" from other open source projects, and
I've never see my ricoh bridge chips take this long.  Maybe it is the
same thing?  Maybe a bit should be read instead of a hard-wired pause?

After this adjustment, a few cards that I'd insert and get only:
	cbb0: card_power: 3V
	cbb0: card_power: 0V
with full debugging enabled would actually try to attach.

Reported by:	sam@ (I think)
MFC after:	3 days
2008-08-09 03:37:12 +00:00
Xin LI
cb752f1da5 Add prototype defination for setfib(2) to sys/socket.h. 2008-08-08 22:40:04 +00:00
Stanislav Sedov
d7a70ce7d4 - Bump __FreeBSD_version for cpuctl(4) added.
Approved by:	kib
2008-08-08 21:36:49 +00:00
John Baldwin
c22616ec0b - Initialize the vm86 structure to a known-good state. Specifically, always
set the %eflags used during a BIOS call via BTX to 0x202.  Previously
  the flags field was uninitialized garbage, and thus it was "random" if
  interrupts were enabled or not during BIOS calls.
- Use constants from <machine/psl.h> for fields in %eflags.

MFC after:	3 days
2008-08-08 19:41:20 +00:00
John Baldwin
beb5dae355 Fix the hangs reported with the real mode BTX:
- I had errantly assumed that all user requests should run with interrupts
  enabled.  User requests for software interrupts, however, need to disable
  interrupts (and tracing) just like hardware interrupts.
- Disable alignment checking when emulating a hardware interrupt as well
  (based on the description of the real mode operation of the 'INT'
  instruction in the IA-32 manuals).
- Use constants for fields in %eflags.

Tested by:	bz
MFC after:	3 days
2008-08-08 19:39:11 +00:00
Philip Paeps
ae289dcbac Add a "glimpse" target to the kernel Makefile.
Glimpse is a powerful "grep on an index".
Especially addictive on slow laptop hard disks.

MFC after:	2 days
2008-08-08 18:00:33 +00:00
Stanislav Sedov
e085f869d5 - Add cpuctl(4) pseudo-device driver to provide access to some low-level
features of CPUs like reading/writing machine-specific registers,
  retrieving cpuid data, and updating microcode.
- Add cpucontrol(8) utility, that provides userland access to
  the features of cpuctl(4).
- Add subsequent manpages.

The cpuctl(4) device operates as follows. The pseudo-device node cpuctlX
is created for each cpu present in the systems. The pseudo-device minor
number corresponds to the cpu number in the system. The cpuctl(4) pseudo-
device allows a number of ioctl to be preformed, namely RDMSR/WRMSR/CPUID
and UPDATE. The first pair alows the caller to read/write machine-specific
registers from the correspondent CPU. cpuid data could be retrieved using
the CPUID call, and microcode updates are applied via UPDATE.

The permissions are inforced based on the pseudo-device file permissions.
RDMSR/CPUID will be allowed when the caller has read access to the device
node, while WRMSR/UPDATE will be granted only when the node is opened
for writing. There're also a number of priv(9) checks.

The cpucontrol(8) utility is intened to provide userland access to
the cpuctl(4) device features. The utility also allows one to apply
cpu microcode updates.

Currently only Intel and AMD cpus are supported and were tested.

Approved by:	kib
Reviewed by:	rpaulo, cokane, Peter Jeremy
MFC after:	1 month
2008-08-08 16:26:53 +00:00
Ed Schouten
cacdd70cc7 Remove D_NEEDGIANT from io(4).
There is no need to mark this device node to use Giant. The only
architectures that use io(4) (i386 and amd64) only change a flag in
td->td_frame, which is only accessed by curthread.

Apart from this change, I think some fishy things may happen when using
/dev/io in multithreaded applications. I haven't tested, but looking at
the code, the flag doesn't get cleared when close() is called from
another thread, but this may not be this important.

I'm not removing D_NEEDGIANT from mem(4), because this driver isn't
Giant safe at all (it calls GIANT_REQUIRED).
2008-08-08 13:43:56 +00:00
Marius Strobl
a91a964c74 Allow 53C1010 without NVRAM to negotiate Ultra-3.
MFC after:	3 days
2008-08-07 23:41:17 +00:00
Marius Strobl
0b1bfc4986 - Reimplement {d,i}tlb_enter() and {d,i}tlb_va_to_pa() in C. There's
no particular reason for them to be implemented in assembler and
  having them in C allows easier extension as well as using more C
  macros and {d,i}tlb_slot_max rather than hard-coding magic (and
  actually spitfire-only) values.
- Fix the compilation of pmap_print_tte().
- Change pmap_print_tlb() to use ldxa() rather than re-rolling it
  inline as well as TLB_DAR_SLOT and {d,i}tlb_slot_max rather than
  hardcoding magic (and actually spitfire-only) values.
- While at it, suffix the above mentioned functions with "_sun4u" to
  underline they're architecture-specific.
- Use __FBSDID and macros instead of magic values in locore.S.
- Remove unused includes and smp_stack in locore.S.
2008-08-07 22:46:25 +00:00
Warner Losh
0e66b169d6 Fix a small problem in the comment about departure from NetBSD.
Also, r181392 fixed a small problem with multifunction cards that would
cause the card not to power down when the last driver detached from it.
2008-08-07 21:16:14 +00:00
John Baldwin
414e7679cb Permit Giant to be passed as the explicit interlock either to
msleep/mtx_sleep or the various cv_*wait*() routines.  Currently, the
"unlock" behavior of PDROP and cv_wait_unlock() with Giant is not
permitted as it is will be confusing since Giant is fully unrecursed and
unlocked during a thread sleep.

This is handy for subsystems which wish to allow unlocked drivers to
continue to use Giant such as CAM, the new TTY layer, and the new USB
stack.  CAM currently uses a hack that I told Scott to use because I
really didn't want to permit this behavior, and the TTY and USB patches
both have various patches to permit this.

MFC after:	2 weeks
2008-08-07 21:00:13 +00:00
Warner Losh
95469daac8 Convert to new style PC Card front end driver. Add support for the
NEC PC-9801N-J02 and PC-9801N-J02R.  I can't test the former because
it requires resources that conflict with my laptop.  I can't test the
latter because my dog chewed up my -J02R card and it didn't survive
well enough for me to test.
2008-08-07 20:55:20 +00:00
Warner Losh
431b127e40 Add NEC PC-9802N-J02 (confirmed) and NEC PC-9202N-J02R (speculative)
to the list of devices.
2008-08-07 20:52:54 +00:00
Warner Losh
25c3d78377 Add card_if.h and pccarddevs.h 2008-08-07 20:51:51 +00:00
John Baldwin
2cdcea5ed8 Document the new return values for sleepq_abort(), sleepq_broadcast(), and
sleepq_signal().

Prodded by:	attilio
2008-08-07 20:47:01 +00:00
Jung-uk Kim
874bd08821 Update SCSI opcodes and ASCs from t10.org.
http://www.t10.org/lists/1spc-lst.htm

Note opcodes for scanner and communication devices are taken from the previous
revision because they are not listed in the files any more.
Also, note newly added ASCs are all marked with 'XXX TBD' and take SS_RDEF action
for now.  Some ASCs need SS_TUR for error recovery or SS_FATAL to prevent further
retrials.  We should deal with them later.

Reviewed by:	scottl, ken
2008-08-07 17:25:05 +00:00
Robert Watson
5cb2685a59 Minor white space tweaks.
MFC after:	1 week
2008-08-07 09:06:04 +00:00
Robert Watson
72bed08287 Correct comment typo.
MFC after:	1 week (after inpcb rwlocking)
2008-08-07 09:03:51 +00:00
Alan Cox
517abd0e4e Introduce pmap_change_attr_locked(). 2008-08-07 04:56:29 +00:00
Warner Losh
188ddb1837 When the miibus for the AX88x90 or TC5299J cards fails to attach, we
would call ed_release_resources() when we should have called
ed_detach() to properly undo the effects of prior calls to
ed_attach().  This would leave a stray ed interface ifnet alive in the
system, which was, well, bad, since we called if_free() on the
underlying memory...  Fix the ed_detach routine to cope being called
in this context now.

This should never come up because the miibus is always there.  Except
for now when it seems to be failing for reasons unknown...  That's a
different bug that hits at least ed, xl, dc and fxp...
2008-08-06 22:22:27 +00:00
Sam Leffler
ba0c757772 add WPS oui
Submitted by:	"Chuck Tuffli" <chuck@tuffli.net>
MFC after:	3 days
2008-08-06 15:54:59 +00:00
Konstantin Belousov
a1a917e029 User may do "mount -o snapshot ...", that causes new FFS mount to be
performed with snapshot option, while the mp->mnt_opt is NULL.
Protect against NULL pointer dereference.

Noted by:	Mateusz Guzik <mjguzik gmail com>
MFC after:	3 days
2008-08-06 14:47:19 +00:00
Kevin Lo
503765e486 Fix a copy/paste error 2008-08-06 07:52:59 +00:00
Warner Losh
69e401fe28 Unify the initial card probe/attach procedure with the kldload
procedure.  There were some subtle differences before that could lead
to a variety of bugs, including resources being lost (in one case
forever).  pccard_probe_and_attach_card does this now, and includes
comments about what's going on and why, since it isn't obvious from
the code.  Please let me know if I've missed anything...

Provide a new function called pccard_select_cfe that allows drivers to
select which configuration entry to use.  This is needed for some
older pre-MFC standard cards with many functions that want to activate
all their functions by selecting alternative entries, or to work
around broken ones.  pccard_select_cfe will migrate into the
pccard_if.m interface as its interface stabilizes to keep all the
pccard drivers from referencing any symbols in the pccard.ko module
directly.

Fix a printf to refer to the right function name.
2008-08-06 07:34:35 +00:00
John Baldwin
aa91bee2dc Minor style tweaks. 2008-08-05 21:59:20 +00:00
John Baldwin
73492bc0b1 Remove the second check for a 64-bit BAR value on a 32-bit system in
pci_add_map().  First, this condition is already handled earlier in
the function.  Second, as written the check would never fire as the
'start' value was overwritten with a long value (rman_get_start() returns
long) before the comparison was done.

Discussed with:	imp
MFC after:	2 weeks
2008-08-05 21:04:00 +00:00
John Baldwin
da7bbd2c08 If a thread that is swapped out is made runnable, then the setrunnable()
routine wakes up proc0 so that proc0 can swap the thread back in.
Historically, this has been done by waking up proc0 directly from
setrunnable() itself via a wakeup().  When waking up a sleeping thread
that was swapped out (the usual case when waking proc0 since only sleeping
threads are eligible to be swapped out), this resulted in a bit of
recursion (e.g. wakeup() -> setrunnable() -> wakeup()).

With sleep queues having separate locks in 6.x and later, this caused a
spin lock LOR (sleepq lock -> sched_lock/thread lock -> sleepq lock).
An attempt was made to fix this in 7.0 by making the proc0 wakeup use
the ithread mechanism for doing the wakeup.  However, this required
grabbing proc0's thread lock to perform the wakeup.  If proc0 was asleep
elsewhere in the kernel (e.g. waiting for disk I/O), then this degenerated
into the same LOR since the thread lock would be some other sleepq lock.

Fix this by deferring the wakeup of the swapper until after the sleepq
lock held by the upper layer has been locked.  The setrunnable() routine
now returns a boolean value to indicate whether or not proc0 needs to be
woken up.  The end result is that consumers of the sleepq API such as
*sleep/wakeup, condition variables, sx locks, and lockmgr, have to wakeup
proc0 if they get a non-zero return value from sleepq_abort(),
sleepq_broadcast(), or sleepq_signal().

Discussed with:	jeff
Glanced at by:	sam
Tested by:	Jurgen Weber  jurgen - ish com au
MFC after:	2 weeks
2008-08-05 20:02:31 +00:00
John Baldwin
e29bfa9ed9 If the kernel fails to allocate resources for the initial value of a BAR
for a PCI device during the boot-time probe of the parent PCI bus, then
zero the BAR and clear the resource list entry for that BAR.  This forces
the PCI bus driver to request a valid resource range from the parent bridge
driver when the device driver tries to allocate the BAR.  Similarly, if the
initial value of a BAR is a valid range but it is > 4GB and the current OS
only has 32-bit longs, then do a full teardown of the initial value of the
BAR to force a reallocation.

Reviewed by:	imp
MFC after:	1 week
2008-08-05 18:24:41 +00:00
John Baldwin
9e58d59f41 - Consolidate module version for the pcf module into just pcf.c instead
of having duplicate versions in each bus attachment.
- Add a DRIVER_MODULE() instance so that the iicbus(4) driver will
  actually attach to pcf(4) driver instances.
- Fix compile of envctrl.c.

Pointy hat:	jhb (3)
2008-08-05 17:39:37 +00:00
VANHULLEBUS Yvan
b78813061c Add lifetime informations to generated SPD entries when SPDDUMP
Approved by: gnn (mentor)
MFC after:	4 weeks
2008-08-05 15:36:50 +00:00
Dag-Erling Smørgrav
20ed1beeb5 ufsmount.h uses "struct\tfoo *bar;", except where it doesn't.
quota.h uses "struct foo\t*bar;", except where it doesn't.
Try to make them both agree with themselves (though not with eachother)
2008-08-05 15:24:07 +00:00
Dag-Erling Smørgrav
1ac541a69a Whitespace, prototypes 2008-08-05 10:25:55 +00:00
Stanislav Sedov
4bdfea0f50 - Reflect the iicbus infrastructure changes.
Approved by:	raj
2008-08-05 08:38:33 +00:00
Stanislav Sedov
ea73ef7478 - Reflect changes in iic infrastructure. 2008-08-05 08:20:58 +00:00
John Baldwin
225f9723dc Lock the consumers of the iicbus(4) infrastructure:
- ad7418(4) uses an sx lock instead of a mtx since the iicbus(4) stuff it
  calls can sleep (request_bus()).  Also, I expanded the locking slightly
  to serialize writes to data stored in the softc.
- Similarly, the icee(4) driver now uses an sx lock instead of a mutex.
  I also removed the pointless OPENED flag and flags field from the softc.
- The locking for the ic(4) driver was a bit trickier:
  - Add a mutex to the softc to protect softc data.
  - The driver uses malloc'd buffers that are the size of the interface
    MTU to send and receive packets.  Previously, these were allocated
    every time the interface was brought up and anytime the MTU was
    changed, with various races that could result in memory leaks.  I
    changed this to be a bit simpler and more like other NIC drivers in
    that we allocate buffers during attach for the default MTU size and
    only reallocate them on MTU changes.  The reallocation procedure
    goes to some lengths with various flags to not replace either the
    the receive or transmit buffers while the driver is busy receiving
    or transmitting a packet.
  - Store the device_t of the driver in the softc instead of detours into
    new-bus using if_dunit from the ifnet and an even more bizarre detour
    to get the softc instead of using if_softc.
  - Drop the driver mutex when invoking netisr_dispatch() to pass the
    packet up to IP.
  - Use if_printf().
2008-08-04 21:14:24 +00:00
John Baldwin
313f8941e1 Add locking to the core iicbus(4) drivers:
- Add an sx lock to the iic(4) driver to serialize open(), close(), read(),
  and write and to protect sc_addr and sc_count in the softc.
- Use cdev->si_drv1 instead of using the minor number of the cdev to
  lookup the softc via newbus in iic(4).
- Store the device_t in the softc to avoid a similar detour via minor
  numbers in iic(4).
- Only add at most one instance of iic(4) and iicsmb(4) to each iicbus(4)
  instance, and do it in the child driver.
- Add a mutex to the iicbus(4) softc to synchronize the request/release bus
  stuff.
- Use __BUS_ACCESSOR() for IICBUS_ACCESSOR() instead of rolling our own.
- Add a mutex to the iicsmb(4) softc to protect softc state updated in the
  interrupt handler.
- Remove Giant from all the smbus methods in iicsmb(4) now that all the
  iicbus(4) backend is locked.
2008-08-04 21:03:06 +00:00
John Baldwin
13e3657b7b Add locking to the various iicbus(4) bridge drivers:
- Just grab Giant in the ixp425_iic(4) driver since this driver uses
  a shared address/data register window pair to access the actual
  I2C registers.  None of the other ixp425 drivers lock access to these
  shared address/data registers yet and that would need to be done before
  this could use any meaningful locking.
- Add locking to the interrupt handler and 'iicbus_reset' methods of the
  at91_twi(4) driver.
- Add locking to the pcf(4) driver.  Other pcf(4) fixes include:
  - Don't needlessly zero the softc.
  - Use bus_foo rather than bus_space_foo and remove bus space tag and
    handle from softc.
- The lpbb(4) driver just grabs Giant for now.  This will be refined later
  when ppbus(4) is locked.
- As was done with smbus earlier, move the DRIVER_MODULE() lines to match
  the bus driver (either iicbus or iicbb) to the bridge driver into the
  bridge drivers.

Tested by:	sam (arm/ixp425)
2008-08-04 20:46:15 +00:00
Olivier Houchard
c611e0d78c Do not modify td->td_intr_nesting_level, it is now done in the MI code.
This fixes the cpu time being falsely reported as interrupt time.

MFC after:	3 days
2008-08-04 20:29:39 +00:00
John Baldwin
0f3dd6ff0d Close two different races with concurrent opens of pty master devices
that could result in leaked ttys or a leaked pty + tty pair.

MFC after:	1 week
2008-08-04 19:51:23 +00:00
John Baldwin
0bc7bc0ec8 - Close a race with concurrent open's of a pts master device which could
result in leaked tty structures.
- When constructing a new pty, allocate it's tty structure before adding
  it to the list.

MFC after:	1 week
2008-08-04 19:49:05 +00:00
John Baldwin
8c0879b6f6 Fix a typo. 2008-08-04 19:45:15 +00:00
John Baldwin
9f9b77e713 Add locking to snc(4) so it is MPSAFE:
- Add a mutex to the softc to protect the softc and device hardware.
- Use a private timer routine to drive the transmit watchdog timer instead
  of using if_watchdog/if_timer.
- If if_alloc() fails during attach, fail the attach with an error rather
  than panic'ing.
- Clear RUNNING and OACTIVE only in sncstop().
- Don't mess with IFF_UP.
- Don't leak 'struct ifnet' on detach.
- Setup interrupt handler after ether_ifattach().
- Call ether_ifdetach() rather than if_detach() in the pccard detach
  routine.

Tested by:	no one despite repeated requests
2008-08-04 19:19:18 +00:00
Rui Paulo
750cd2f486 Add coretemp(4) and k8temp(4).
MFC after:	1 day
2008-08-04 16:13:42 +00:00
Rafal Jaworowski
1cba14c456 Fix ARM nocache allocator:
- let the loop iterate every page (as intended), and not some multiplies
  (which led to a fake exhaustion of the ARM_NOCACHE_KVA_SIZE)

- eliminate using MIN(): it compared number of pages vs. address
  (ARM_TP_ADDRESS), which was bogus

Reviewed by:	cognet, imp
Obtained from:	Piotr Ziecik kosmo ! semihalf dot com
MFC after:	3 days
2008-08-04 14:47:49 +00:00
Max Laier
9f21c07f14 Merge state reuse for tcp.
PR:		kern/125261
Obtained from:	OpenBSD
MFC after:	1 week
2008-08-04 14:42:09 +00:00
Olivier Houchard
ae33434c7f We need -I$S to compile the elf trampoline.
MFC after:	3 days
2008-08-04 14:38:38 +00:00
Olivier Houchard
cf1f6a4da0 Remove unneeded #include <stdlib.h> (?)
MFC after:	3 days
2008-08-04 14:37:32 +00:00
Max Laier
898dc49201 Flatten out dist and all "live" tag directories. 2008-08-04 13:30:44 +00:00
Konstantin Belousov
66548e0a2f Lower the priority of the sleep in the syscons for "waitvt" wchan to
PZERO + 1. The sleeping process at the priority <= PZERO is counted as
blocked, or, as comment states, 'disk wait'. PZERO + 1 works as well,
and does not cause user confusion.

Reported by:	sam <samflanker at gmail com>
MFC after:	1 week
2008-08-04 12:22:33 +00:00
Alan Cox
494c177e81 Make pmap_kenter_attr() static. 2008-08-04 08:04:09 +00:00
Colin Percival
ff1782127a Dereferencing uninitialized pointers considered harmful. Prior to this
commit, calling i386_parsedev(..., X, ...) where X is "ad", "bge", or
any other disk or network device name without a unit number, would
result in dereferencing whatever happened to be on the stack where the
variable "cp" is stored.

Found by:	LLVM/Clang Static Checker
2008-08-04 07:01:42 +00:00
Colin Percival
5fe69bb518 Setting a variable to the same value twice doesn't actually make it
more likely to have the right value.  Remove superfluous assignments.

Found by:	LLVM/Clang Static Checker
2008-08-04 06:39:52 +00:00
Pyun YongHyeon
3d85c23dc6 Rearrange conditional compilation directives. This makes syntax
highlighting work in vim.
2008-08-04 04:00:10 +00:00
Pyun YongHyeon
3199b0c42c Remove return keyword at the end of functions that return void. 2008-08-04 03:51:20 +00:00
Pyun YongHyeon
0ce0868acd Remove register keyword. 2008-08-04 03:47:29 +00:00
Pyun YongHyeon
7b5ffebfe2 Use ANSI C declarations for all functions. 2008-08-04 03:45:07 +00:00
Pyun YongHyeon
a2a8420cfd Don't enable TSO by default. Users of RTL8169/8110 reported
watchdog timeout issues and the root cause seems to stem from
silicon bug of controller. Personally I couldn't reproduce it on
RTL8169 controller but it seems it's dependent on usage pattern.
For newer PCIe based controllers I have no TSO complaints but
turning off TSO would be more safe. Users who are sure that
their controller works with TSO can still reenable the TSO with
ifconfig(8).

Reported by:	Oliver Lehmann (lehmann at ans-netz dot de), Eugene Butusov (ebutusov at gmail dot com)
2008-08-04 02:34:40 +00:00
Pyun YongHyeon
ae64408754 The number of bits reserved for MSS in RealTek controllers is
11bits. This limits the maximum interface MTU size in TSO case
as upper stack should not generate TCP segments with MSS greater
than the limit. Armed with this information, disable TSO if
interface MTU is greater than the limit.
2008-08-04 02:05:09 +00:00
Antoine Brodin
f8062a0b0f Kill a dead variable
PR:		126223
Submitted by:	Mateusz Guzik
2008-08-03 21:07:19 +00:00
Robert Watson
1d986c5ff1 Remove broken code to replace st_mode value with ACCESSPERMS when
lstat(2) is called on symlinks -- this code appears never to have
worked.  The PR this addresses suggests that the intended
original behavior is the right one, but as bde points out in the
PR comments, we do actually support storing a mode on symlinks,
so returning it seems reasonable.

This is consistent with Mac OS X, which despite documentation to
the contrary does return the mode set on a symlink, but not some
other platforms.  The Single Unix Spec requires only that the
returned bits be "meaningful", which seems at best unhelpful as
advice goes.

PR:		25018
MFC after:	3 days
2008-08-03 15:44:56 +00:00
Olivier Houchard
f0fe5e9127 Add "add pc, whatever" as a branch instruction, we use it in memcpy().
MFC after:	3 days
2008-08-03 15:35:32 +00:00
Tom Rhodes
6bd9cb1c81 Fill in a few sysctl descriptions.
Reviewed by:	alc, Matt Dillon <dillon@apollo.backplane.com>
Approved by:	alc
2008-08-03 14:26:15 +00:00
Tom Rhodes
942df7e765 Document a few sysctls.
Approved by:	imp
2008-08-03 14:11:06 +00:00
Konstantin Belousov
4f7afc20e0 Calling linker_load_dependencies() while holding the module'
vnode lock may cause a LOR between kld_sx lock and vnode lock.
linker_load_dependencies() drops kld_sx, and another thread may attempt
to load the same kld.

Reported and tested by:	pjd
MFC after:	1 week
2008-08-03 13:33:45 +00:00
Ed Schouten
200d80cd74 Disconnect drivers that haven't been ported to MPSAFE TTY yet.
As clearly mentioned on the mailing lists, there is a list of drivers
that have not been ported to the MPSAFE TTY layer yet. Remove them from
the kernel configuration files. This means people can now still use
these drivers if they explicitly put them in their kernel configuration
file, which is good.

People should keep in mind that after August 10, these drivers will not
work anymore. Even though owners of the hardware are capable of getting
these drivers working again, I will see if I can at least get them to a
compilable state (if time permits).
2008-08-03 10:32:17 +00:00
Warner Losh
93757e6b48 Kernel config for the Linksys NSLU2. This is just a basic configuration,
with no support for the LED, buttons, realtime clock or flash support.
2008-08-03 07:10:25 +00:00
Olivier Houchard
fcfc49979c Handle ldr pc, [reg] in branch_taken().
Obtained from:	NetBSD
MFC after:	3 days
2008-08-03 01:53:14 +00:00
Olivier Houchard
697292d902 Add blx as a branch instruction.
MFC after:	3 days
2008-08-03 01:51:30 +00:00
Warner Losh
c65b00d158 Minor style nit. 2008-08-02 22:53:43 +00:00
Robert Watson
95b85ca3a9 Minor style tweaks. 2008-08-02 22:30:51 +00:00
Robert Watson
f7c4bd95ba Rename mac_partition_enabled to partition_enabled to synchronize with
other policies that similarly now avoid the additional mac_ prefix on
variables.

MFC after:	soon
2008-08-02 20:53:59 +00:00
Warner Losh
24b934392e Add an altnerative Siemens SpeedStream ID. This one is for a Prism 3
card.  I got a pair of these at a garage sale for US$1.00 today...
2008-08-02 20:50:13 +00:00
Warner Losh
15820ef70c Report what kind of chip only under bootverbose since that's now
exported via a sysctl.
2008-08-02 20:49:01 +00:00
Warner Losh
f043f9621e Minor tweaks to names and comments now that I understand what's going
on better.
2008-08-02 20:45:28 +00:00
Warner Losh
96edbc847e Add an alternative ID for the Siemens SpeedStream SS1021: 0x3021. 2008-08-02 20:36:25 +00:00
Sam Leffler
d3d6c95298 add missing lock for htinfo update
Submitted by:	Chris Zimmermann
2008-08-02 18:04:09 +00:00
Sam Leffler
6bbdc70146 correct decap of of AppleTalk and IPX frames; don't strip the SNAP
header as they have one natively

Submitted by:	Chris Zimmermann
2008-08-02 18:02:57 +00:00
Sam Leffler
ac5ae6986f add a sysctl to deliver a radar event for testing 2008-08-02 18:00:33 +00:00
Sam Leffler
5c9b0f1d07 schedule the correct timer when receiving a radar event during CAC 2008-08-02 17:58:39 +00:00
Sam Leffler
6e0186d5ee add callout_schedule; besides being useful it also improves
compatibility with other systems

Reviewed by:	ed, battlez
2008-08-02 17:42:38 +00:00
Scott Long
8792c6abd8 Correctly set the interrupt enable and disable bits. The previous
code interfered with Performant mode and legacy interrupts.  Also
remove a register read operation on the Simplq code that was
effectively a time-wasting no-op.
2008-08-02 13:04:26 +00:00
Olivier Houchard
08cfba5d14 Fix software single-stepping: we need to check if the instruction is a
return instruction as well, or we'll stop single-stepping as soon as we'll
return from a function.

MFC after:	3 days
2008-08-02 12:49:43 +00:00
Olivier Houchard
4ed897041f Add yet another branch instruction.
Obtained from:	NetBSD
MFC after:	3 days
2008-08-02 12:48:30 +00:00
Remko Lodder
a2a9fbb490 Add support for the ASUS P535 PDA
PR:		kern/126097
Submitted by:	Anton Kartashev <amokk@seb.org.ua>
Approved by:	imp (mentor, implicit)
MFC after:	3 days
2008-08-02 12:15:18 +00:00
Ed Schouten
6d09e4f1a8 Make the at91 uart(4) driver compile again.
As of r178766 this driver didn't compile anymore, because it missed a
switch()-statement. I'm getting tired of seeing this driver being broken
for two months already. When I run `make universe', everything passes,
except the BWCT kernel configuration file.
2008-08-02 08:01:56 +00:00
Warner Losh
504ff11df7 ixp425 parts aren't multicore, so remove the SMP option. They also
don't support the ioapic either, so remove that option too.  These
were commented out, but could never be enabled, unlike the other
options in the file that are commented out.
2008-08-02 07:20:30 +00:00
Warner Losh
319150067f Conform to the options<space><tab> convention everywhere in this file.
This is just a white space change, no functional change.
2008-08-02 07:18:12 +00:00
Alan Cox
75accfd97d Enhance pmap_mapdev_attr(). Take advantage of recent enhancements to
pmap_change_attr() in order to use the direct map for any cache mode, not
just write-back mode.

It is worth noting that this change also eliminates a situation in which we
have two mappings to the same physical memory with different cache modes.

Submitted by:	Magesh Dhasayyan (with some changes by me)
Discussed with:	jhb
2008-08-02 03:43:54 +00:00
Warner Losh
2f6a79342a Add ELF relocation types for mips.
Obtained from:	mips/include/elf.h
2008-08-02 01:20:10 +00:00
Olivier Houchard
939e434def Store the PC while context switching, for the benefits of DDB. 2008-08-02 00:10:38 +00:00
Julian Elischer
711ca7efbb The IPFW code accepts the use of the tablearg keyword along with the skipto
keyword. But it doesn't work. Two options.. make it no longer accept it,
or actually make it work.. I chose the 2nd..

Allow the tablearg to be used to specify a skipto destination.

This is actually a very powerful construct if used correctly, or a sink
of cpu cycles if used badly.

changes t teh man page will follow.
2008-08-01 22:21:03 +00:00
Antoine Brodin
69237b102d Make "1000baseT" the description and "1000baseTX" the alias for
IFM_1000_T instead of the reverse.  It is possible FreeBSD doesn't
even support 1000baseTX.
This changes ifconfig(8) output.

Requested by:	gavin@ and bms@
See also:	http://docs.freebsd.org/cgi/mid.cgi?20050307191901.H32508
2008-08-01 22:13:39 +00:00
Antoine Brodin
7b4f6e7b9f Remove trailing ';' in BPFD_LOCK_ASSERT macro.
MFC after:	1 month
X-MFC-to:	stable/7, stable/6 has it right
2008-08-01 22:08:14 +00:00
Christian S.J. Peron
a05cf8c6db Annotate why we do not call BPF_CHECK_DIRECTION() in this tapping routine.
There is no way for the caller to tell us which direction this packet is
going.  With the bpf_mtap{2} routines, we can check the interface pointer.

MFC after:	2 weeks
2008-08-01 21:38:46 +00:00
John Baldwin
9b1db80125 Use the new bus device_shutdown hook for performing the shutdown action
on the ee16 parts rather than explicitly registering an event handler
that wasn't being torn down on detach.
2008-08-01 21:33:07 +00:00
John Baldwin
08649f593c - Use an sx lock to serialize writes since they update the checksum.
- Remove D_NEEDGIANT as the rtc drivers already have their own locks, so
  this doesn't need Giant.

MFC after:	1 week
2008-08-01 20:39:18 +00:00
John Baldwin
d428508ca6 Adjust comment. This stack is only used for booting now and not as an
idle stack.
2008-08-01 20:10:47 +00:00
Ed Maste
879afbd55a Fix whitespace. 2008-08-01 15:13:56 +00:00
John Baldwin
7b030859af Enable the support for G33/Q35/Q33 now that both the G33 and Q35 have been
tested:

PR:		amd64/126090
MFC after:	1 week
2008-08-01 13:11:23 +00:00
Robert Watson
7ec3a88b94 Remove further trailing white space. 2008-08-01 09:41:45 +00:00
Alan Cox
67cbc11594 Enhance pmap_change_attr() with the ability to demote 1GB page mappings. 2008-08-01 04:55:38 +00:00
Maksim Yevmenkin
4fa708ef20 Implement ratelimiting for debug messages. For now, allow at most
one message per second. In the future might add a sysctl knob for
each socket family to fine tune this.

MFC after:	1 week
2008-08-01 00:36:43 +00:00
Maksim Yevmenkin
93f9b5b4aa Increase maximum input queue size limit for raw Bluetooth HCI sockets.
MFC after:	3 days
2008-08-01 00:16:40 +00:00
Maksim Yevmenkin
9b5b51671c Fix locking bug, i.e. lock "wildcard" matched pcb before return. 2008-08-01 00:13:32 +00:00
Alan Cox
ba65f767c0 Enhance pmap_change_attr(). Specifically, avoid 2MB page demotions, cache
mode changes, and cache and TLB invalidation when some or all of the
specified range is already mapped with the specified cache mode.

Submitted by:	Magesh Dhasayyan
2008-07-31 22:45:28 +00:00
Robert Watson
80794edc05 In mac_bsdextended's auditctl and acct policy access control checks,
return success if the passed vnode pointer is NULL (rather than
panicking).  This can occur if either audit or accounting are
disabled while the policy is running.

Since the swapoff control has no real relevance to this policy,
which is concerned about intent to write rather than water under the
bridge, remove it.

PR:             kern/126100
Reported by:    Alan Amesbury <amesbury at umn dot edu>
MFC after:      3 days
2008-07-31 20:49:12 +00:00
Kip Macy
006c3d2eb6 remove socketvar.h, add more selective includes 2008-07-31 20:28:58 +00:00
Kip Macy
849cca9b8e move sockbuf locking macros in to sockbuf.h 2008-07-31 20:27:50 +00:00
Christian S.J. Peron
dfc714fba1 Currently, BSM audit pathname token generation for chrooted or jailed
processes are not producing absolute pathname tokens.  It is required
that audited pathnames are generated relative to the global root mount
point.  This modification changes our implementation of audit_canon_path(9)
and introduces a new function: vn_fullpath_global(9) which performs a
vnode -> pathname translation relative to the global mount point based
on the contents of the name cache.  Much like vn_fullpath,
vn_fullpath_global is a wrapper function which called vn_fullpath1.

Further, the string parsing routines have been converted to use the
sbuf(9) framework.  This change also removes the conditional acquisition
of Giant, since the vn_fullpath1 method will not dip into file system
dependent code.

The vnode locking was modified to use vhold()/vdrop() instead the vref()
and vrele().  This will modify the hold count instead of modifying the
user count.  This makes more sense since it's the kernel that requires
the reference to the vnode.  This also makes sure that the vnode does not
get recycled we hold the reference to it. [1]

Discussed with:	rwatson
Reviewed by:	kib [1]
MFC after:	2 weeks
2008-07-31 16:57:41 +00:00
Rui Paulo
f2512ba12a MFp4 (//depot/projects/tcpecn/):
TCP ECN support. Merge of my GSoC 2006 work for NetBSD.
  TCP ECN is defined in RFC 3168.

Partly reviewed by:	dwmalone, silby
Obtained from:		NetBSD
2008-07-31 15:10:09 +00:00
Randall Stewart
6d9e8f2b3a Adds support for the SCTP_PORT_REUSE option
Fixes a refcount bug found in the process

Obtained from:	With the help of Michael Tuexen
2008-07-31 11:08:30 +00:00
Robert Watson
f6d4a8a77b Further synchronization of copyrights, licenses, white space, etc from
Apple and from the OpenBSM vendor tree.

Obtained from:	Apple Inc., TrustedBSD Project
MFC after:	3 days
2008-07-31 09:54:35 +00:00
Alan Cox
c1695335d1 Eliminate recomputation of the PDE by pmap_pde_attr(). 2008-07-31 04:42:42 +00:00
Maksim Yevmenkin
a0bac9cc1b Fix LINT
MFC after:	3 months
2008-07-31 03:51:53 +00:00
Jack F Vogel
339cd27eec Data type fix 2008-07-31 02:22:53 +00:00
Paul Saab
a5469167c1 Unbreak the build by creating opt_nfs.h 2008-07-31 02:13:36 +00:00
Paul Saab
721c409daf Unbreak the build by including sys/socketvar.h 2008-07-31 01:52:04 +00:00
Paul Saab
f4779b9d6e Include netinet/tcp_lro.h, unbreak the build 2008-07-30 23:54:23 +00:00
Maksim Yevmenkin
ecfcbb9f03 Hook up Bluetooth SCO sockets code to the build
MFC after:	3 months
2008-07-30 22:42:17 +00:00
Maksim Yevmenkin
48698a834c Introduce support for Bluetooth SCO sockets. This is based on older
code that was revisted.

MFC after:	3 months
2008-07-30 22:41:23 +00:00
Jack F Vogel
20976c5bc7 Add igb driver to the default kernel 2008-07-30 22:30:49 +00:00
Jack F Vogel
859ff640f3 Add igb to the default kernel
MFC after:ASAP
2008-07-30 22:27:38 +00:00
Jack F Vogel
1a8a2aa55b Change Makefile to reflect new directory structure
MFC after:ASAP
2008-07-30 22:06:38 +00:00
Jack F Vogel
d7b1367463 Change to build module with new directory tree
MFC after:ASAP
2008-07-30 22:05:06 +00:00
Jack F Vogel
06248ffcc6 Alter kernel build to work with new dev/e1000 structure.
This makes both em and igb, or either alone build and
work in the static kernel.

MFC after:ASAP
2008-07-30 22:01:32 +00:00
Jack F Vogel
8cfa0ad266 Merge of the source for igb and em into dev/e1000, this
proved to be necessary to make the static drivers work
in EITHER/OR or BOTH configurations. Modules will still
build in sys/modules/igb or em as before.

This also updates the igb driver for support for the 82576
adapter, adds shared code fixes, and etc....

MFC after:	ASAP
2008-07-30 21:56:53 +00:00
John Baldwin
2c3b410b3a One more whitespace nit. 2008-07-30 21:23:32 +00:00
John Baldwin
3cca4b6fe8 A few more whitespace fixes. 2008-07-30 21:18:08 +00:00
John Baldwin
3677ad363b If the kernel has run out of metadata for swap, then explicitly panic()
instead of emitting a warning before deadlocking.

MFC after:	1 month
2008-07-30 21:12:15 +00:00
John Baldwin
4a67a0d994 Whitespace tweak. 2008-07-30 21:07:56 +00:00
John Baldwin
feaed6c57e Trim some noise from some #ifdef's. This had leaked into the compat32
support for bpf(4) due to hacks in the Y! tree for a truss32 binary
(since superseded by native support for 32-bit binaries in truss itself).

MFC after:	1 week
2008-07-30 21:01:51 +00:00
Kip Macy
c316a7ab32 fix includes for post sockbuf re-factor 2008-07-30 20:08:34 +00:00
John Baldwin
c9fe67dd7e Use single byte read and write operations to toggle the BIOS and OS
semaphores rather than 4 byte operations.

MFC after:	1 month
2008-07-30 19:16:53 +00:00
Konstantin Belousov
24bbc85bf6 The behaviour of the lockmgr going back at least to the 4.4BSD-Lite2 was
to downgrade the exclusive lock to shared one when exclusive lock owner
requested shared lock. New lockmgr panics instead.

The vnode_pager_lock function requests shared lock on the vnode backing
the OBJT_VNODE, and can be called when the current thread already holds
an exlcusive lock on the vnode. For instance, it happens when handling
page fault from the VOP_WRITE() uiomove that writes to the file, with
the faulted in page fetched from the vm object backed by the same file.
We then get the situation described above.

Verify whether the vnode is already exclusively locked by the curthread
and request recursed exclusive vnode lock instead of shared, if true.

Reported by:	gallatin
Discussed with:	attilio
2008-07-30 18:16:06 +00:00
Jack F Vogel
5b7f4ced65 This updates the ixgbe driver to Intel internal version 1.4.7
Shared code changes, core driver fixes, vlan event/filter support

Also Kip Macy's fix to allow any number of queues, thanks Kip!
2008-07-30 18:15:18 +00:00
John Baldwin
a6c4b9deb4 Set all of the "optimum performance" PHY registers for the 15D parts as
well as the 15C since it seems to be required in practice.  The Linux
natsemi.c driver mostly does this as well.

PR:		kern/112179
Submitted by:	Mark Willson  mark - hydrus org uk
MFC after:	1 week
2008-07-30 17:28:49 +00:00
John Baldwin
f5698581ca SIS_SETBIT() already does a read/modify/write operation, so there isn't
a reason to read the register twice.

MFC after:	1 week
2008-07-30 17:21:32 +00:00
Ed Schouten
e7ea30e404 Remove the use of lbolt from the VFS syncer.
It seems we only use `lbolt' inside the VFS syncer and the TTY layer
now.  Because I'm planning to replace the TTY layer next month, there's
no reason to keep `lbolt' if it's only used in a single thread inside
the kernel.

Because the syncer code wanted to wake up the syncer thread before the
timeout, it called sleepq_remove(). Because we now just use a condvar(9)
with a timeout value of `hz', we can wake it up using cv_broadcast()
without waking up any unrelated threads.

Reviewed by:	phk
2008-07-30 12:39:18 +00:00
Ed Schouten
911d490140 Don't make subr_clist.c depend on the TTY layer.
After the import of the new TTY layer, the TTY_QUOTE definition will not
be present anymore. To make sure clists will still work as expected,
introduce an internal definition called QUOTEMASK.

Maybe we can decide to remove the quote bits entirely, but we still have
to look into this. There may be drivers that still use the quote bits.

Obtained from:	//depot/projects/mpsafetty
2008-07-30 12:32:42 +00:00
Konstantin Belousov
8f4a1f3a83 Bring back the save/restore of the %ds, %es, %fs and %gs registers for
the 32bit images on amd64.

Change the semantic of the PCB_32BIT pcb flag to request the context
switch code to operate on the segment registers. Its previous meaning
of saving or restoring the %gs base offset is assigned to the new
PCB_GS32BIT flag.

FreeBSD 32bit image activator sets the PCB_32BIT flag, while Linux 32bit
emulation sets PCB_32BIT | PCB_GS32BIT.

Reviewed by:	peter
MFC after:	2 weeks
2008-07-30 11:30:55 +00:00
Robert Watson
2209e8f159 Adopt the slightly weaker consistency locking approach used in IPv4 raw
sockets for IPv6 raw sockets: separately lock the inpcb for determining
the destination address for a connect()'d raw socket at the rip6_send()
layer, and then re-acquire the inpcb lock in the rip6_output() layer to
query other options on the socket.  Previously, the global raw IP socket
lock was used, which while correct and marginally more consistent, could
add significantly to global raw IP socket lock contention.

MFC after:	1 week
2008-07-30 09:26:27 +00:00
Marcel Moolenaar
16b0c20c82 Change the type of psaddr_t from void* to uintptr_t. A pointer
type cannot be made wider to allow ILP32 platforms to target
LP64 platforms.
2008-07-30 00:59:19 +00:00
Pyun YongHyeon
1f8287f868 Unbreak build.
Remove nfe(4). The driver applies to i386/amd64 only.
2008-07-30 00:39:25 +00:00
Andrew Thompson
c42c172256 Free the correct buffer list on failure. 2008-07-30 00:38:10 +00:00
Kip Macy
d7ec7db225 remove redundant ifdef ... lol 2008-07-29 23:00:54 +00:00
Kip Macy
57ca0572b1 fix build by forward declaring thread and hiding socket buffer definitions from user code 2008-07-29 23:00:00 +00:00
Olivier Houchard
8cad15c8fe Unbreak the build by protecting kernel-only functions with #ifdef _KERNEL. 2008-07-29 21:48:01 +00:00
Robert Watson
ae89d5a389 When copying in and out current ICMPv6 filters on a raw IPv6 socket,
lock the inpcb and use a local stack variable to copy to/from userspace
so that sooptcopyin()/sooptcopyout() aren't called while holding an
rwlock.

While here, fix a bug in which a failed sooptcopyin() might lead to
partially consistent ICMPv6 filters on the socket by not ignoring the
error returned by sooptcopyin().

MFC after:	2 weeks
2008-07-29 19:37:16 +00:00
Robert Watson
2f1ff0cd80 Since we fail IPv6 raw socket allocation if inp->in6p_icmp6filt can't
be allocated, there's no need to conditionize use and freeing of it
later.

MFC after:	1 week
2008-07-29 18:09:46 +00:00
Robert Watson
cc29ac7d22 Marginally decomplicate set/getsockopt code in ip6_output.c by simply
using the passed arguments explicitly and unconditionally rather than
testing them and calling panic().  The result is the same but easier
to read.

MFC after:	3 days
2008-07-29 09:31:03 +00:00
Randall Stewart
52baa64a19 Fix build breakage - kthread_exit() in 8 now has no arguments
MFC after:	1 week
2008-07-29 09:30:50 +00:00
Randall Stewart
d6af161a34 - Out with some printfs.
- Fix a initialization of last_tsn_used
- Fix handling of mapped IPv4 addresses
Obtained from:	Michael Tuexen and I :-)
MFC after:	1 week
2008-07-29 09:06:35 +00:00
Pyun YongHyeon
cde2511802 style(9) - space after keywords, don't indent case. 2008-07-29 09:02:00 +00:00
Pyun YongHyeon
2229ae4a5e Cache PCI vendor/device ids to avoid unnecessary PCI configuration
space access in device probe.
Also nuke referencing softc in device probe.
2008-07-29 08:49:36 +00:00
Pyun YongHyeon
be280562a1 s/printf/device_printf/g
Don't hard code function name in device_printf() and use __func__.
While I'm here nuke bfe_unit in softc as it's not needed anymore.
2008-07-29 08:32:29 +00:00
Kip Macy
66a4ba6246 Factor sockbuf, sockopt, and sockstate out of socketvar.h in to separate headers.
Reviewed by:	rwatson
MFC after:	3 days
2008-07-29 07:45:05 +00:00
Pyun YongHyeon
0587cad886 Add missing jme(4), msk(4), nfe(4), re(4) and stge(4) in NOTES and
ensure that LINT builds include these devices.

Reported by:	Peter Jeremy
2008-07-29 01:15:11 +00:00
Maksim Yevmenkin
a4d05859e7 Simplify ubt_isoc_in_complete2(). Also should fix off by 1 bug.
MFC after:	3 months
2008-07-29 00:17:53 +00:00
Alexander Motin
280d6bd758 Don't use memcpy() to copy several bytes.
Store IDs is host order. It is not so important to bloat code for it.
Combine m_adj() and M_PREPEND() into single M_PREPEND().
2008-07-28 22:22:38 +00:00
John Baldwin
02f3c16fa5 Re-enable em(4) and igb(4) in NOTES.
PR:		conf/112081
2008-07-28 22:16:58 +00:00
John Baldwin
12d3da872c Remove a stale reference to sys/dev/ixgbe/tcp_lro.c. 2008-07-28 21:47:04 +00:00
John Baldwin
c3ea337801 When choosing a CPU for a thread in a cpuset, prefer the last CPU that the
thread ran on if there are no other CPUs in the set with a shorter per-CPU
runqueue.
2008-07-28 20:39:21 +00:00
Alexander Motin
6c5bbf5ce1 Move inpcb lock higher to protect some nonbinding fields reading.
It fixes nothing at this time, but decided to be more correct.
2008-07-28 19:32:18 +00:00
John Baldwin
f7f1cc1518 Really fix this. 2008-07-28 18:33:43 +00:00
Pawel Jakub Dawidek
7224dd4dad Properly check if td_name is empty and if it is, print process name,
instead of empty thread name.

Reviewed by:	jhb
2008-07-28 18:10:26 +00:00
Antoine Brodin
e8c6b2d8ca Remove a file that is not used and does not exist. 2008-07-28 17:56:37 +00:00
John Baldwin
f200843b72 Implement support for cpusets in the 4BSD scheduler.
- When a cpuset is applied to a thread, walk the cpuset to see if it is a
  "full" cpuset (includes all available CPUs).  If not, set a new
  TDS_AFFINITY flag to indicate that this thread can't run on all CPUs.
  When inheriting a cpuset from another thread during thread creation, the
  new thread also inherits this flag.  It is in a new ts_flags field in
  td_sched rather than using one of the TDF_SCHEDx flags because fork()
  clears td_flags after invoking sched_fork().
- When placing a thread on a runqueue via sched_add(), if the thread is not
  pinned or bound but has the TDS_AFFINITY flag set, then invoke a new
  routine (sched_pickcpu()) to pick a CPU for the thread to run on next.
  sched_pickcpu() walks the cpuset and picks the CPU with the shortest
  per-CPU runqueue length.  Note that the reason for the TDS_AFFINITY flag
  is to avoid having to walk the cpuset and examine runq lengths in the
  common case.
- To avoid walking the per-CPU runqueues in sched_pickcpu(), add an array
  of counters to hold the length of the per-CPU runqueues and update them
  when adding and removing threads to per-CPU runqueues.

MFC after:	2 weeks
2008-07-28 17:25:24 +00:00
Warner Losh
0c5544bb64 Export the hardware type (as number and name), the secondary firmware
revision and (on Prism cards) the primary firmware revision via
sysctl.  Move the printing of this information under bootverbose,
since it is relatively easy to get to it now.
2008-07-28 17:00:37 +00:00
John Baldwin
8aa3d7ffc0 Various and sundry style and whitespace fixes. 2008-07-28 15:52:02 +00:00
Alexander Motin
18f401c664 Some style and assertion fixes to the previous commits hinted by rwatson.
There is no functional changes.
2008-07-28 06:57:28 +00:00
Alan Cox
e79980e1f7 Correct an off-by-one error in the previous change to pmap_change_attr().
Change the nearby comment to mention the recursive map.
2008-07-28 05:41:35 +00:00
Alan Cox
b0c139d336 Don't allow pmap_change_attr() to be applied to the recursive mapping. 2008-07-28 04:59:48 +00:00
Alan Cox
cc1ec88f72 Don't allow pmap_change_attr() to be applied to the recursive mapping. 2008-07-28 04:13:49 +00:00
Alan Cox
a8bb29e5d2 Add a check for 1GB page mappings to pmap_change_attr() so that it fails
gracefully.  (On K10 family processors the direct map is implemented using
1GB page mappings.)
2008-07-28 03:58:49 +00:00
Pyun YongHyeon
43742818e3 Fix buffer discard index.
While I'm here dicard all buffers if errored frame is part of
multi-segmented frames.

Pointed out by:	sephe
Reviewd by:	sephe
MFC after:	3 days
2008-07-28 02:37:15 +00:00
Kip Macy
947265b6bd - track maximum wait time
- resize columns based on actual observed numerical values

MFC after:	3 days
2008-07-27 21:45:20 +00:00
Alexander Motin
d185578a78 According to in_pcb.h protocol binding information has double locking.
It allows access it while list travercing holding only global pcbinfo lock.
2008-07-27 20:48:22 +00:00
Alexander Motin
b11e21ae80 According to in_pcb.h protocol binding information has double locking.
It allows access it while list travercing holding only global pcbinfo lock.
2008-07-27 20:30:34 +00:00
Alan Cox
35db2ce0dc Style fixes to several function definitions. 2008-07-27 18:18:50 +00:00
Alan Cox
91842e53a9 Enhance pmap_change_attr(). Use pmap_demote_pde() to demote a 2MB page
mapping to 4KB page mappings when the specified attribute change only
applies to a portion of the 2MB page.  Previously, in such cases,
pmap_change_attr() gave up and returned an error.

Submitted by:	Magesh Dhasayyan
2008-07-27 17:32:36 +00:00
Pawel Jakub Dawidek
5573021d78 Assert for exclusive vnode lock in vinactive(), vrecycle() and vgonel()
functions.

Reviewed by:	kib
2008-07-27 11:48:15 +00:00
Pawel Jakub Dawidek
610507ae00 - Move vp test for beeing NULL under IGNORE_LOCK().
- Check if panicstr isn't set, if it is ignore the lock. This helps to avoid
  confusion, because lockmgr is a no-op when panicstr isn't NULL, so
  asserting anything at this point doesn't make sense and can just race with
  other panic.

Discussed with:	kib
2008-07-27 11:46:42 +00:00
Julian Elischer
66e8505f4c Add the ability to add new addresses for interfacesto just one FIB
(Other more specific related options will follow)
This allows one to set multiple p2p links to the same place
and select which to use by having each in different FIBS.
2008-07-27 01:29:28 +00:00
Sam Leffler
693e312235 don't deauth a station because it sends a ps-poll w/ a bogus aid in it;
turns out some devices do this and since we otherwise validate the station
is associated and don't use the aid for anything being lenient here allows
them to function

Submitted by:	Chris Zimmermann
MFC after:	2 weeks
2008-07-26 23:50:27 +00:00
Alexander Motin
e2ed8f3514 Increase UDBHASHSIZE from 16 to 128 items.
Previous value was chosen 10 years ago and not very effective now.
This change gives several percents speedup on 1000 L2TP mpd links.
2008-07-26 23:07:34 +00:00
Alexander Motin
0ca3b0967b According to in_pcb.h protocol binding information has double locking.
It allows access it while list travercing holding only global pcbinfo lock.
This relaxed locking noticably increses receive socket lookup performance.
2008-07-26 21:12:00 +00:00
Darren Reed
14fbef0c79 2020447 IPFilter's NAT can undo name server random port selection
(fix output port range, was a random number in [0,max-min]
	 (byteswapped on litle endian), instead of [min,max])

Submitted by:	darrenr
2008-07-26 19:46:00 +00:00
Alexander Motin
9ed324c9a5 Add hash table lookup for a fully connected raw sockets.
This gives significant performance improvements when many raw sockets used.
Benchmarks of mpd handeling 1000 simultaneous PPTP connections show up to 50%
performance boost. With higher number of connections benefit becomes even
bigger. PopTop snd others should also get some benefits.
2008-07-26 17:32:15 +00:00
Warner Losh
febcff0a3b Register the interrupt handler at the end of wi_attach rather than at
the beginning.  There's a race in the shared interrutp case.  If
another interrupt happens after the interrupt is setup, then we'd try
to lock an uninitialized mutex.  In addition, if we bailed out due to
a too old version of firmware, we'd leave the interrupt enabled with
all the fun that ensues....
2008-07-26 17:04:30 +00:00
Andrey A. Chernov
b834665cd5 Return arc4_i = arc4_j = 0; line from previous backing out since
just found it in OpenBSD, see their sys/crypto/arc4.c, function
rc4_keysetup, line ctx->x = ctx->y = 0;

Obtained from:  OpenBSD
2008-07-26 16:42:45 +00:00
Tom Rhodes
be6b130476 Fill in a few sysctl descriptions.
Approved by:	rwatson
2008-07-26 00:55:35 +00:00
Tom Rhodes
ad291f81da Fill in sysctl descriptions.
Approved by:	philip
2008-07-26 00:01:19 +00:00
Tom Rhodes
c9fac982af Fill in BPF sysctl descriptions.
Reviewed by:	csjp
2008-07-25 23:58:09 +00:00
Tom Rhodes
7521cd74f6 Begin the sysctl descriptions with a capital letter.
Make some slight wording tweaks.
2008-07-25 23:54:07 +00:00
Stanislav Sedov
32c5ce374b - Connect ds1339 to the build infrastructure.
Reviewed by:	raj
Approved by:	imp
2008-07-25 19:35:40 +00:00
Stanislav Sedov
8e3b2aab49 - Add driver for Dallas Semiconductor DS1339 RTC sitting
on I2C bus.

Reviewed by:	raj
Approved by:	imp
MFC after:	2 week
2008-07-25 19:34:44 +00:00
Andrey A. Chernov
fff6495ea6 Per rwatson's request:
"If you don't get a review within a day or two, I would firmly recommend
backing out the changes"

back out all my changes as unreviewed by secteam@ yet.
2008-07-25 15:53:32 +00:00
Ed Schouten
bea45cdda3 Move ttyinfo() into its own C file.
The ttyinfo() routine generates the fancy output when pressing ^T. Right
now it is stored in tty.c. In the MPSAFE TTY code it is already stored
in tty_info.c. To make integration of the MPSAFE TTY code a little
easier, take the same approach.

This makes the TTY code a little bit more readable, because having the
proc_*/thread_* routines in tty.c is very distractful.

Approved by:	philip (mentor)
2008-07-25 14:31:00 +00:00
Konstantin Belousov
58e8af1bf5 Call pargs_drop() unconditionally in do_execve(), the function correctly
handles the NULL argument.
Make pargs_free() static.

MFC after:	1 week
2008-07-25 11:55:32 +00:00
Konstantin Belousov
96f1567fa7 s/alredy/already/ in the comments and the log message. 2008-07-25 11:22:25 +00:00
Jeff Roberson
d67023a155 - Provide kernelname as the name for process with P_KTHREAD set as
otherwise their textvp is NULL.

Reviewed by:	jkoshy
Sponsored by:	Nokia
2008-07-25 05:49:48 +00:00
Ivan Voras
c7317f5bb0 Add tweak for AMD Geode "companion" chip, AMD CS5536, which is apparently
USB 2.0 capable but is shy and doesn't adwertise it much.

PR:		120017
Reviewed by:	imp
Approved by:	gnn (mentor)
MFC after:	2 weeks
2008-07-24 23:22:19 +00:00
Julian Elischer
7e4e65ffb3 Fix spelling error in comment 2008-07-24 19:05:58 +00:00
Marius Strobl
85f57c4d48 Prefer the opt_global.h from KERNBUILDDIR if existent so we obtain all
macros that might be relevant.
2008-07-24 14:07:52 +00:00
Doug Rabson
d3508f91ee Try again not to use a userspace pointer in the kernel when trying to record
the hostname which we need for NLM requests. The previous patch was incomplete.

PR:		125849
Pointy hat:	dfr
2008-07-24 14:02:03 +00:00
Doug Rabson
db428b786c Don't use a userspace pointer in the kernel when trying to record the hostname
which we need for NLM requests.

PR:		125849
2008-07-24 13:42:28 +00:00
Darren Reed
52c7653383 2020447 IPFilter's NAT can undo name server random port selection
Approved by:	darrenr
MFC after:	1 week
Security:	CERT VU#521769
2008-07-24 12:35:05 +00:00
Ed Schouten
75ec42320d Don't include <sys/tty.h> in non-TTY drivers.
The kbd, kbdmux, ugen and uhid drivers included <sys/tty.h>, because
they needed clists, which have been moved to <sys/clist.h> some time
ago. In the MPSAFE TTY branch, <sys/tty.h> does not include
<sys/clist.h>, which means we have to teach these drivers to include
this header file directly.

Approved by:	philip (mentor, implicit)
2008-07-24 09:54:10 +00:00
Ed Schouten
b377be43a5 Add TIOCPKT and TIOCSPTLCK to the Linuxolator.
We're very lucky, because the flags used by our TIOCPKT implementation
are the same as flags used by Linux. We can safely enable TIOCPKT,
assuming EXTPROC is not used.

TIOCSPTLCK is used by unlockpt(). Because we don't need unlockpt() in
our implementation, make this ioctl a no-op.

Approved by:	philip (mentor, implicit), rdivacky
Obtained from:	P4 (//depot/projects/mpsafetty/...)
2008-07-23 17:47:44 +00:00
Roman Divacky
0864e2a4f1 Fix linux_alarm, the linux behaviour is to limit the
secs to INT_MAX when the passed in parameter is bigger
than INT_MAX.

Submitted by:	Dmitry Chagin <chagin.dmitry gmail com>
Approved by:	kib (mentor)
2008-07-23 17:19:02 +00:00
Dag-Erling Smørgrav
b39cb07cbc Remove debugging cruft. 2008-07-23 16:44:20 +00:00
Dag-Erling Smørgrav
75f31a5fe4 pjd@'s r180759 was intended to revert r180755 due to ipfilter breakage,
but removed too much, breaking the build in other places instead.  Now
that the ipfilter issue has been fixed (or hacked around), address the
second issue by restoring r180755, with one small change.  I don't feel
comfortable using assert(3) in a header that will be included in userland
code that may or may not already have an assertion mechanism in place,
so KASSERT() evaluates to a no-op in the !_KERNEL case.
2008-07-23 16:40:07 +00:00
John Baldwin
b661868711 Further refine the probe order of devices to more closely match the previous
behavior.  Specifically, probe Host-PCI bridges in the order they are
encountered in the tree.  For CPUs, just use an order of 100000 and assume
that no Host-PCI bridges will be more than 10000 levels deep in the
namespace.  This fixes an issue on some boxes where the HPET timer stopped
attaching.
2008-07-23 15:13:06 +00:00
Pawel Jakub Dawidek
72b60ff82c Back out this change, as it breaks the build and I don't have time for
a better fix today.
2008-07-23 15:12:45 +00:00
Konstantin Belousov
89672c6337 The ffs_balloc_ufs{1,2} functions call bdwrite() while having several
vnode buffers locked at once. In particular, there are indirect buffers
among locked ones. The bdwrite() may start the flushing to keep dirty
buffer list at the bounds. If any buffer on the dirty list requires
translation from logical to physical block number, code may ends up
trying to lock an indirect buffer already locked in ffs_balloc_ufsX.

Prevent the bdflush() activity when several buffers are locked at once
by setting the TDP_INBDFUSH for the problematic code blocks.

Reported and tested by:	pho, Josef Buchsteiner at Juniper
In collaboration with:	kan
MFC after:	1 month
2008-07-23 14:32:44 +00:00
Luoqi Chen
e8f00dec4b Unbreak cc -pg support on i386. In gcc 4.2, %ecx is used as the arg pointer
when stack realignment is turned on (it is ALWAYS on for main), however
in a profiling build %ecx would be clobbered by mcount(), this would lead
to a segmentation fault when the code tries to reference any argument.
This fix changes mcount() to preserve %ecx.

PR:		bin/119709
Reviewed by:	bde
MFC after:	1 week
2008-07-23 11:37:20 +00:00
Pawel Jakub Dawidek
a16ab3b093 Check for negative reference count.
Reviewed by:	des
2008-07-23 11:17:46 +00:00
Weongyo Jeong
138ddff935 when NDIS framework try to query/set informations NDIS drivers can
return NDIS_STATUS_PENDING.  In this case, it's waiting for 5 secs to
get the response from drivers now.  However, some NDIS drivers can send
the response before NDIS framework gets ready to receive it so we might
always be blocked for 5 secs in current implementation.  NDIS framework
should reset the event before calling NDIS driver's callback not after.

MFC after:	1 month
2008-07-23 10:49:27 +00:00
Luoqi Chen
4522ac77de SATA device on some nForce based boards could get confused if MSI is not
used but MSI to HyperTransport IRQ mapping is enabled, and would act as
if MSI is turned on, resulting in interrupt loss.

This commit will,
1. enable MSI mapping on a device only when MSI is enabled for that
   device and the MSI address matches the HT mapping window.
2. enable MSI mapping on a bridge only when a downstream device is
   allocated an MSI address in the mapping window

PR:		kern/118842
Reviewed by:	jhb
MFC after:	1 week
2008-07-23 09:44:36 +00:00
Doug Rabson
6dc0afa896 Re-work the code slightly to avoid a possible livelock.
MFC after:	2 weeks
2008-07-23 09:18:08 +00:00
Konstantin Belousov
8b4a2800de Do the pargs_hold() on the copy of the pointer to the p_args of the
child process immediately after bulk bcopy() without dropping the
process lock.

Since process is not single-threaded when forking, dropping and
reacquiring the lock allows an other thread to change the process title
of the parent in between, and results in hold being done on the invalid
pointer. The problem manifested itself as the double free of the old
p_args.

Reported by:	kris
Reviewed by:	jhb
MFC after:	1 week
2008-07-23 08:45:25 +00:00
Robert Watson
33f0efe6b0 Minor white space tweak.
Obtained from:	Apple Inc.
MFC after:	3 days
2008-07-23 07:42:31 +00:00
Warner Losh
b3f1e9378b Only descend into the boot directory for the architecture if it
actually exists and is a directory or symlink to a directory.
2008-07-23 07:23:33 +00:00
Warner Losh
a30c29f9f5 Disable SSP for mips until support is added to the base architecture. 2008-07-23 06:16:34 +00:00
Ed Schouten
8c2ceafebf Move the NFS/RPC code away from lbolt.
The kernel has a special wchan called `lbolt', which is triggered each
second. It doesn't seem to be used a lot and it seems pretty redundant,
because we can specify a timeout value to the *sleep() routines. In an
attempt to eventually remove lbolt, make the NFS/RPC code use a timeout
of `hz' when trying to reconnect.

Only the TTY code (not MPSAFE TTY) and the VFS syncer seem to use lbolt
now.

Reviewed by:	attilio, jhb
Approved by:	philip (mentor), alfred, dfr
2008-07-22 21:27:22 +00:00
Peter Wemm
fbbc785240 Trivial commit to attempt to diagnose a svn problem. Add
comment that Tivo disks are APM, but do not have a DDR record.
2008-07-22 18:05:50 +00:00
Robert Watson
93536b495d If an AUE_SYSCTL_NONADMIN audit event is selected, generate a record
with equivilent content to AUE_SYSCTL.

Obtained from:	Apple Inc.
MFC after:	3 days
2008-07-22 17:54:32 +00:00
Robert Watson
30d0721b59 Further minor style fixes to audit.
Obtained from:	Apple Inc.
MFC after:	3 days
2008-07-22 17:49:30 +00:00
Robert Watson
1814e5b748 Remove unneeded \ at the end of a macro.
Obtained from:	Apple Inc.
MFC after:	3 days
2008-07-22 17:08:27 +00:00
Robert Watson
3c4636a7d4 Further minor white space tweaks.
Obtained from:	Apple Inc.
MFC after:	3 days
2008-07-22 17:06:49 +00:00
Robert Watson
fc1286c81d Generally avoid <space><tab> as a white space anomoly.
Obtained from:	Apple Inc.
MFC after:	3 days
2008-07-22 16:44:48 +00:00
Robert Watson
0c0a142a52 Use #define<tab> rather than #define<space>.
Obtained from:	Apple Inc.
MFC after:	3 days
2008-07-22 16:21:59 +00:00
Andrey A. Chernov
d16863efa6 1) Initialize arc4_i and arc4_j to 0 after key mixing as recommended in
draft-kaukonen-cipher-arcfour-03.txt (3.1.5)

2) Drop first 768 bytes as standard RC4-drop(768)
2008-07-22 16:16:51 +00:00
Robert Watson
f1cb603072 Comment fix.
Obtained from:	Apple Inc.
MFC after:	3 days
2008-07-22 16:02:21 +00:00
Robert Watson
98ee1b30aa Comment typo fix.
Obtained from:	Apple Inc.
MFC after:	3 days
2008-07-22 15:54:10 +00:00
Robert Watson
c2f027ffb8 Minor white space synchronization to Apple version of security audit.
Obtained from:	Apple Inc.
MFC after:	3 days
2008-07-22 15:49:19 +00:00
Robert Watson
bc9a43d698 In preparation to sync Apple and FreeBSD versions of security audit,
pick up the Apple Computer -> Apple change in their copyright and
license templates.

Obtained from:	Apple Inc.
MFC after:	3 days
2008-07-22 15:29:48 +00:00
Robert Watson
59b622e6b3 Use unsigned int when iterating over groupsets in audit_arg_groupset().
Obtained from:	Apple Inc.
MFC after:	3 days
2008-07-22 15:17:21 +00:00
Stanislav Sedov
cde9cd82fe - Whitespace fixes.
Approved by:	gonzo
MFC after:	1 week
2008-07-22 14:04:06 +00:00
Marius Strobl
93060c6c1b o Fix style(9) bugs and similar nits.
o Merge ncr53c9x.c from NetBSD:
  1.115: fix variable shadowing
  1.118: __inline -> inline
  1.121: fix empty if
2008-07-22 13:51:21 +00:00
Andrey A. Chernov
9b78febf8e Bump __FreeBSD_version for arc4random_buf() and arc4random_uniform()
added.
2008-07-22 13:38:17 +00:00
Marius Strobl
109c391928 For sun4v ensure there is an opt_global.h with SUN4V defined included,
even for the stand-alone build.
2008-07-22 09:56:45 +00:00
Olivier Houchard
7cff8ceafb Disable SSP for the kernel on arm as well (see rev 180605).
I overlooked this because a SSP kernel booted for me.

Apologises to:	ticso
2008-07-22 09:38:12 +00:00
Tai-hwa Liang
df9cf830d1 Trying to fix compilation bustage:
- removing 'const' qualifier from an input parameter to conform to the type
  required by rw_assert();
- using in_addr->s_addr to retrive 32 bits address value.

Observed by:	tinderbox
2008-07-22 04:23:57 +00:00