Commit graph

78482 commits

Author SHA1 Message Date
Konstantin Belousov a29af74b70 One more use for _SIG_VALID.
Submitted by:	Garrett Cooper <yanegomi gmail com>
MFC after:	1 week
2010-07-12 10:18:10 +00:00
Jayachandran C. 160f3477ee Merge jmallett@'s n64 work into HEAD.
Merge changes for initial n64 support in pmap.c. Use direct mapped (XKPHYS)
access for a lot of operations that earlier needed temporary mapping. Add
support for using XKSEG for kernel mappings.

Reviewed by:	imp
Obtained from:	jmallett (http://svn.freebsd.org/base/user/jmallett/octeon)
2010-07-12 09:38:44 +00:00
Jayachandran C. d204450e8d Merge jmallett@'s n64 work into HEAD
64 bit TLB definitions in pte.h

Reviewed by:	imp
Obtained from:	jmallett (http://svn.freebsd.org/base/user/jmallett/octeon)
2010-07-12 07:42:42 +00:00
Jayachandran C. c15f697768 Move KSEG address definitions from cpu.h to cpuregs.h with the other
definitions, add some  XKPHYS related definitions for n64.

Reviewed by:	imp
2010-07-12 07:24:40 +00:00
Alexander Motin 91751b1a86 Instead of deleting existing IRQ resource, which is not really working for
ACPI bus, find wanted IRQ rid or spare one. This should fix panic during
boot on systems reporting fancy IRQ numbers for attimer and atrtc.
2010-07-12 06:46:17 +00:00
Nathan Whitehorn 67167531f0 Provide support in loader for booting 64-bit PowerPC kernels. Like amd64,
64-bit PowerPC kernels are loaded by a 32-bit loader, since nearly all
powerpc64 firmwares execute in 32-bit mode.
2010-07-12 00:49:22 +00:00
Andrew Thompson 6bce5ae1c5 Use more compact deviceid table.
Submitted by:	Akinori Furukoshi
2010-07-11 23:54:44 +00:00
Andrew Thompson 75c7615952 Update for style(9).
Submitted by:	Akinori Furukoshi (author)
2010-07-11 23:52:12 +00:00
Rafal Jaworowski 98bb3177b4 Sort platform options. 2010-07-11 21:12:42 +00:00
Rafal Jaworowski 6031d0b167 Get rid of bootinfo for good in loader (U-Boot-based) and ARM.
For FDT-enabled platforms the device tree is a modern replacement for bootinfo
config data.
2010-07-11 21:11:23 +00:00
Rafal Jaworowski d1d3233ebd Convert Freescale PowerPC platforms to FDT convention.
The following systems are affected:

  - MPC8555CDS
  - MPC8572DS

This overhaul covers the following major changes:

  - All integrated peripherals drivers for Freescale MPC85XX SoC, which are
    currently in the FreeBSD source tree are reworked and adjusted so they
    derive config data out of the device tree blob (instead of hard coded /
    tabelarized values).

  - This includes: LBC, PCI / PCI-Express, I2C, DS1553, OpenPIC, TSEC, SEC,
    QUICC, UART, CFI.

  - Thanks to the common FDT infrastrucutre (fdtbus, simplebus) we retire
    ocpbus(4) driver, which was based on hard-coded config data.

Note that world for these platforms has to be built WITH_FDT.

Reviewed by:	imp
Sponsored by:	The FreeBSD Foundation
2010-07-11 21:08:29 +00:00
Rafal Jaworowski c5a514a756 Provide more defines for PCI-Express device ctrl. 2010-07-11 20:55:39 +00:00
Rafal Jaworowski da6bc8989d Introduce PowerPC-specific helper routines for FDT.
Reviewed by:	imp
Sponsored by:	The FreeBSD Foundation
2010-07-11 20:49:36 +00:00
Rafal Jaworowski caaa3c62d4 Save fdtbus trigger / polarity data at their correct index. 2010-07-11 20:33:39 +00:00
Rafal Jaworowski a22cd1e668 Let simplebus(4) diagnostics be a bit more descriptive. 2010-07-11 20:30:59 +00:00
Rafal Jaworowski b0ddbe8776 Provide a missing interrupt-parent for the CPM / QUICC node in the DTS. 2010-07-11 20:29:34 +00:00
Alan Cox 2882388376 Change the implementation of vm_hold_free_pages() so that it performs at
most one call to pmap_qremove(), and thus one TLB shootdown, instead of one
call and TLB shootdown per page.

Simplify the interface to vm_hold_free_pages().

MFC after:	3 weeks
2010-07-11 20:11:44 +00:00
Alexander Motin a2d81f6d1f Make kernel panic with reasonable message if no usable event timer found. 2010-07-11 17:08:37 +00:00
Alexander Motin 3bc5958c0e Remove interval validation from cpu_tick_calibrate(). As I found, check
was needed at preliminary version of the patch, where number of CPU ticks
was divided strictly on 16 seconds. Final code instead uses real interval
duration, so precise interval should not be important. Same time aliasing
issues around second boundary causes false positives, periodically logging
useless "t_delta ... too long/short" messages when HZ set below 256.
2010-07-11 16:47:45 +00:00
Weongyo Jeong e7c6c10e16 Fixes a page fault in bwi_pci_probe() because the array isn't terminated
with NULL.

PR:		kern/148473
Submitted by:	Grzegorz Dabrowski <grzegorz.dabrowski at gmail dot com>
MFC after:	1 week
2010-07-10 22:37:23 +00:00
Weongyo Jeong 6dcc706bc5 Fixes a bug for LP PHY that some frames have 2 padding bytes at the
start so we should adjust the mbuf if the driver is running in PIO mode.
Now it should work well with WPA authentication and association for LP
PHY devices.

Tested by:	Warren Block <wblock at wonkity.com>
MFC after:	1 month
2010-07-10 21:39:03 +00:00
Alan Cox 8155e5d561 Reduce the number of global TLB shootdowns generated by pmap_qenter().
Specifically, teach pmap_qenter() to recognize the case when it is being
asked to replace a mapping with the very same mapping and not generate
a shootdown.  Unfortunately, the buffer cache commonly passes an entire
buffer to pmap_qenter() when only a subset of the mappings are changing.
For the extension of buffers in allocbuf() this was resulting in
unnecessary shootdowns.  The addition of new pages to the end of the
buffer need not and did not trigger a shootdown, but overwriting the
initial mappings with the very same mappings was seen as a change that
necessitated a shootdown.  With this change, that is no longer so.

For a "buildworld" on amd64, this change eliminates 14-15% of the
pmap_invalidate_range() shootdowns, and about 4% of the overall
shootdowns.

MFC after:	3 weeks
2010-07-10 18:22:44 +00:00
Alexander Motin aecfe194a9 If ata_sata_phy_reset() failed and ata_generic_reset() is not called, mark
channel as having no devices connected. This improves hot-unplug operation
on legacy-emulating SATA controllers.
2010-07-10 15:36:27 +00:00
Alexander Motin 663c22a27d On attach, grab channel lock before setting up interrupt. This fixes crash
in ATA_CAM mode if phy connect event arrive before CAM bus initialization
completed.
2010-07-10 15:27:27 +00:00
Nathan Whitehorn 8869de5e55 The 64-bit PowerPC ABI implemented in binutils 2.15 requires some special
quirks for weak-symbol handling. Text symbols require also marking weak
the special dot-symbol associated with the function, and data symbols
require that you not do that. To fix this, provide a hacked
__weak_reference for powerpc64, and define a new __weak_reference_data
for the single weak data symbol in base.

Revert after:	binutils 2.17 import
Obtained from:	projects/ppc64
2010-07-10 14:39:08 +00:00
Nathan Whitehorn 03d07f4e24 32-bit sysctl emulation is also interesting on powerpc64. 2010-07-10 14:34:37 +00:00
Nathan Whitehorn dbe25130a0 Add definitions for powerpc64 ELF relocation types. Some 64-bit relocations
are identical to 32-bit relocations in meaning, name, and number, and I
have chosen not to duplicate those here.
2010-07-10 14:33:57 +00:00
Alexander Motin 9a9bce34f1 Make hw.ata.ata_dma_check_80pin tunable affect not only device side, but
also controller side cable checks. Make respective sysctl writable.

PR:		kern/143462
2010-07-10 13:46:14 +00:00
Konstantin Belousov b543e91ba5 Fix spacing.
Noted by:	pgollucci
MFC after:	3 weeks
2010-07-09 21:27:42 +00:00
Pyun YongHyeon 2610dbf59b Some revision of Yukon controller generates corrupted frame when TX
checksum offloading is enabled.  The frame has a valid checksum
value so payload might be modified during TX checksum calculation.
Disable TX checksum offloading but give users chance to enable it
when they know their controller works without problems with TX
checksum offloading.

Reported by:	Andrzej Tobola <ato <> iem dot pw dot edu dot pl>
2010-07-09 21:21:08 +00:00
Konstantin Belousov 2680dac9e1 For both i386 and amd64 pmap,
- change the type of pm_active to cpumask_t, which it is;
- in pmap_remove_pages(), compare with PCPU(curpmap), instead of
  dereferencing the long chain of pointers [1].
For amd64 pmap, remove the unneeded checks for validity of curpmap
in pmap_activate(), since curpmap should be always valid after
r209789.

Submitted by:	alc [1]
Reviewed by:	alc
MFC after:	3 weeks
2010-07-09 20:05:56 +00:00
Alan Cox b99348e5ea Add support for the VM_ALLOC_COUNT() hint to vm_page_alloc(). Consequently,
the maintenance of vm_pageout_deficit can be localized to just two places:
vm_page_alloc() and vm_pageout_scan().

This change also corrects an off-by-one error in the maintenance of
vm_pageout_deficit.  Historically, the buffer cache functions, allocbuf()
and vm_hold_load_pages(), have not taken into account that vm_page_alloc()
already increments vm_pageout_deficit by one.

Reviewed by:	kib
2010-07-09 19:38:30 +00:00
Xin LI c8ed14e2d8 Don't use pack() for structures that is used purely for software state.
Otherwise the resulting, unaligned mutex structure would trigger panic.

Submitted by:		Tom Cough <tom.couch lsi.com>
Reported/Tested by:	jhb
MFC after:		3 days
2010-07-09 17:38:15 +00:00
Jack F Vogel d6ff3d4d13 Fix of a VLAN problem by jhb, the checksum capability
got lost along the way.

MFC: asap
2010-07-09 17:11:29 +00:00
Nathan Whitehorn 932773c882 The number after 2 is 3, not 4.
MFC after:	3 days
2010-07-09 14:04:16 +00:00
Nathan Whitehorn ce0df83f13 Remove an unnecessary include of opt_psim.h, which is not present on
powerpc64.
2010-07-09 14:02:57 +00:00
Nathan Whitehorn 945c08644e MFppc64:
Minor 64-bit-cleanliness upgrades and support for platform detection on
subtly-broken OF implementations like in the Mambo simulator.
2010-07-09 14:02:24 +00:00
Nathan Whitehorn 53c30f7e96 MFppc64:
Use longs instead of ints as the native word type in bcopy(). This will
expand nicely on 64-bit systems.
2010-07-09 14:01:18 +00:00
Nathan Whitehorn 0e8792a1cb MFppc64:
Check if devices are direct-mapped individually instead of just checking
the value of hw_direct_map.
2010-07-09 14:00:22 +00:00
John Baldwin e113db82af Accidentally committed an older version of this comment rather than the
final one.
2010-07-09 13:59:53 +00:00
John Baldwin 07b183388a Refine a comment.
Reviewed by:	bde
2010-07-09 13:53:25 +00:00
Gleb Smirnoff 281b584e8e Improve last commit: use bpf_mtap2() to avoiding stack usage.
Prodded by:	julian
2010-07-09 11:27:33 +00:00
Jaakko Heinonen 831aa555de Remove redundant high >= 0.
Reported by:	rstone
2010-07-09 10:57:55 +00:00
Navdeep Parhar bd1a9fbad6 Improve cxgb(4)'s behaviour when faced with temporarily "bouncy" links:
- Run the adapter's tick at 1Hz and remove link state checks from it.
  Instead, have each port check its link state.  Delay the check so that
  it takes place slightly after the driver is notified of a change in
  link state.  This is a cheap way to debounce these notifications if
  many are received in rapid succession.  POLL_LINK_1ST_TIME flag can
  also be eliminated as a side effect of these changes.
- Do not reset the PHY when link goes down.
- Clear port's link_fault flag if the PHY indicates link is down.
- get_link_status_r should leave speed and duplex alone when link is down.

MFC after:	1 month
2010-07-09 00:38:00 +00:00
Navdeep Parhar 2c32b50248 Eliminate ext_intr_task. The "slow" interrupt handler is already
running on the adapter's task queue.  Just do what the task does
instead of enqueueing it.

MFC after:	3 days
2010-07-09 00:36:35 +00:00
Navdeep Parhar 29c54b85f9 Fix bufsize calculation so that cxgbtool can display information for the
last I/O queue too.

MFC after:	3 days
2010-07-09 00:35:09 +00:00
Jung-uk Kim 4624e08a59 Implement optional 'precision' for numbers. Previously, it was parsed but
ignored.  Some third-party modules (e.g., APCICA) prefer this format over
zero padding flag '0'.
2010-07-08 22:13:23 +00:00
John Baldwin fc8cca02c7 - Various style and whitespace fixes.
- Make sugid_coredump and kern_logsigexit private to kern_sig.c.

Submitted by:	bde (partially)
MFC after:	1 month
2010-07-08 19:15:26 +00:00
Pyun YongHyeon 78b1140644 Remove enabling RX checksum offloading in RX filter setup. RX
checksum is enabled in sge_init_locked().
While I'm here do not set RX checksum bits in RX descriptor
initialization. It is controller's job to set these bits.

Tested by:	xclin <xclin <> cs dot nctu dot edu dot tw >
2010-07-08 18:22:49 +00:00
Nathan Whitehorn a26209a43a Missed a file in r209803: this header contains a definition of
OFW_STD_32BIT.

Pointy hat to:	me
2010-07-08 18:15:06 +00:00
Jaakko Heinonen 501812f2c5 Assert that low and high are >= 0. The allocator doesn't support the
negative range.
2010-07-08 16:53:19 +00:00
Jayachandran C. 9132d3f5b0 Fix XLR64, the previous version had the contents of file duplicated. 2010-07-08 16:11:06 +00:00
Jayachandran C. d580a6708b 64 bit ld script for mips, and configuration file for 64 bit compilation
on XLR

Approved by:	rrs
2010-07-08 16:06:58 +00:00
Nathan Whitehorn f6421f31e3 Replace the existing PowerPC busdma implementation with the one from
amd64 (with slight modifications). This provides support for bounce
buffers, which are required on systems with RAM above 4 GB.
2010-07-08 15:38:55 +00:00
Jayachandran C. 35a69e02a4 Use 64 bit type for rqb_word_t in n64 kernel.
Reviewed by:	imp
Approved by:	rrs
2010-07-08 15:37:16 +00:00
Jayachandran C. 1f13150705 Enable KX bit, which is needed for 64 bit access, in status register
for XLR. Update exception handlers and other functions which set/change
status registers to preserve this.

Approved by:	rrs
2010-07-08 15:22:46 +00:00
Adrian Chadd ff97a64735 Add TX-path aligned/unaligned stats for if_arge. 2010-07-08 15:20:57 +00:00
Jayachandran C. 5574a166c9 64 bit compilation support XLR platform code.
Mostly changes to make casting between int and pointer and printing
64bit values safe for 32 and 64 bit compile.

Approved by:	rrs
2010-07-08 15:05:23 +00:00
Adrian Chadd ef54d27641 Address PR kern/148307 - fix if_ath TX mbuf alignment/size constraint checks
The existing code only checked the alignment of the first mbuf and
didn't enforce the size constraints.

This commit introduces a simple function to check the alignment and
size of all mbufs in the list. This fixes the initial issue in the
PR.

PR: kern/148307
Reviewed by: gonzo@
2010-07-08 14:59:32 +00:00
Jayachandran C. 76780f208c Fix minor issue in sys/mips/mips/cache_mipsNN.c, using int type for
virtual addr will break on 64 bit, change to vm_offset_t.

Reviewed by:	imp@
Approved by:	rrs (mentor)
2010-07-08 14:56:42 +00:00
Jayachandran C. 44fa0bf256 Merge jmallett@'s n64 work into HEAD - changeset 8
Updated PTE/PDE macros from http://svn.freebsd.org/base/user/jmallett/octeon
Introduce pmap_segshift() macro, use pmap_segmap() in place of pmap_pde, and
remove pmap_pde().

Approved by:	rrs (mentor)
Obtained from:	jmallett@
2010-07-08 14:49:55 +00:00
Nathan Whitehorn 900d6c6a00 Make ofw_syscons work on 64-bit systems. 2010-07-08 14:40:46 +00:00
Nathan Whitehorn 70d75337eb Fix several bugs in the real-mode Open Firmware implementation and provide
a virtual-mode version for use on 64-bit systems, which have 32-bit
firmware implementations and require similar constraints on addressing
to the real-mode implementation.
2010-07-08 14:35:35 +00:00
Adrian Chadd d06458f7f7 Introduce a sysctl block for if_arge and, for now, a blank debug sysctl
placeholder for later.

Add in a missing FreeBSD ID string.
2010-07-08 14:34:15 +00:00
Nathan Whitehorn 054e5dcbe4 Change the argument type to OF_call_method to take an array of cell_t
instead of unsigned longs to prepare for platforms where they are not
the same.
2010-07-08 14:29:23 +00:00
Nathan Whitehorn 517524ec87 Fix iicbus_get_addr() on 64-bit big-endian systems. The bus accessor
passes a uintptr_t, not a uint32_t.
2010-07-08 14:19:52 +00:00
Adrian Chadd d273f00076 Extend the ath debugging a little to log the interface name.
Some devices have >1 atheros card and the current debug prints
make it impossible to tell which interface is being unhappy.
2010-07-08 14:08:03 +00:00
Gleb Smirnoff a5f9fc17c2 Since r209216 bpf(4) searches for mbuf_tags(9) and thus will not work with
a stub m_hdr instead of a full mbuf.

PR:		kern/148050
2010-07-08 13:07:40 +00:00
Konstantin Belousov 83d5d2963e Do not mention VM_ALLOC_RETRY in comment, and normalize the terminology
(blocking -> sleeping).

Reviewed by:	alc
MFC after:	3 days
2010-07-08 08:39:02 +00:00
Konstantin Belousov 1d9e77f6bf Make VM_ALLOC_RETRY flag mandatory for vm_page_grab(). Assert that the
flag is always provided, and unconditionally retry after sleep for the
busy page or failed allocation.

The intent is to remove VM_ALLOC_RETRY eventually.

Proposed and reviewed by:	alc
2010-07-08 08:37:51 +00:00
Alan Cox 77cb6e6f8d Correctly maintain the per-cpu field "curpmap" on amd64 just like we
do on i386.  The consequences of not doing so on amd64 became apparent
with the introduction of the COUNT_IPIS and COUNT_XINVLTLB_HITS
options.  Specifically, single-threaded applications were generating
unnecessary IPIs to shoot-down the TLB on other processors.  However,
this is clearly nonsensical because a single-threaded application is
only running on the current processor.  The reason that this happens
is that pmap_activate() is unable to properly update the old pmap's
field "pm_active" without the correct "curpmap".  So, in effect, stale
bits in "pm_active" were leading pmap_protect(), pmap_remove(),
pmap_remove_pages(), etc. to flush the TLB contents on some arbitrary
processor that wasn't even running the same application.

Reviewed by:	kib
MFC after:	3 weeks
2010-07-08 03:35:00 +00:00
Marcel Moolenaar 092b5c88c5 Add acpi_find_table() -- a convenience function for looking up an
ACPI table given the signature.
2010-07-07 20:07:33 +00:00
Marcel Moolenaar 1a6c2ccd5e Remove pointless BOOTP conditional. 2010-07-07 19:34:48 +00:00
Marcel Moolenaar 58bf34c327 Use the kernel's start address to determine what to map. This allows
us to link the kernel at different addresses without needing to build
a corresponding loader.
2010-07-07 19:06:53 +00:00
Adrian Chadd ac35b90587 Fix the CS line definitions. These bits are for the CS2/CS1 lines
rather than CS1/CS0.

This has been tested on the Ubiqiti Routerstation Pro board.
2010-07-07 15:05:44 +00:00
Rui Paulo 80599de862 Fix style issues with the previous commit, namely
use-tab-instead-of-space and don't use underscores in macro variables.

Pointed out by:	bde
2010-07-07 12:08:58 +00:00
Attilio Rao 631cb86f11 - Simplify logic in handling ticks wrap-up
- Fix a bug where thread may be in sleeping state but the wchan won't
  be set, leading to an empty container for sleepq_type(). [0]

Sponsored by:		Sandvine Incorporated
[0] Submitted by:	Bryan Venteicher
			<bryanv at daemoninthecloset dot org>
MFC after:		3 days
X-MFC:			209577
2010-07-07 12:00:11 +00:00
Kevin Lo 054d87d697 Add the u3g(4) driver. I can't find any reason why it's not here. 2010-07-07 09:23:46 +00:00
Marcel Moolenaar b1b6c03e3d Provide more examples for error injection. 2010-07-06 23:13:21 +00:00
Jung-uk Kim 3664686221 Fix mis-merges in the previous commit. 2010-07-06 21:41:08 +00:00
Jung-uk Kim a88e22b7ad Merge ACPICA 20100702. 2010-07-06 20:57:28 +00:00
Alexander Motin 25a519a918 ATA device reset starts probe sequence from the beginning. If reset caused
by timeout/error of one of probe commands, process may continue infinitely.
Make CAM ATA more robust to faulty devices and false positive detections,
abort probe after two restarts on timeouts or ten on other errors.
2010-07-06 19:05:41 +00:00
Konstantin Belousov d12fc952b7 Calculate nshift only once.
Also noted by:	avg
MFC after:	1 week
2010-07-06 18:22:57 +00:00
Konstantin Belousov aa81ae08e9 In revoke(), verify that VCHR vnode indeed belongs to devfs.
Found and tested by:	pho
MFC after:	1 week
2010-07-06 18:20:49 +00:00
Pyun YongHyeon 864104fe59 Zero entire status block and add missing bus_dmamap_sync(9). 2010-07-06 18:17:31 +00:00
Jung-uk Kim 061b7e5463 Plug a possible memory leak.
Submitted by:	Yamagi Burmeister (lists at yamagi dot org)
2010-07-06 18:08:55 +00:00
Jung-uk Kim c3cbd4125e Fix a possible null pointer dereference. A patch for -STABLE was
Submitted by:	Yamagi Burmeister (lists at yamagi dot org)
2010-07-06 18:05:05 +00:00
Rui Paulo 8923c96ee1 Introduce USD_{SET,GET}{BASE,LIMIT}. These help setting up the user
segment descriptor hi and lo values. Idea from Solaris.

Reviewed by:	kib
2010-07-06 16:56:27 +00:00
Ed Maste 67d187beb1 Remove defunct email address from header as well. 2010-07-06 16:55:39 +00:00
Ed Maste d11f4f5dea Remove email address that no longer exists. 2010-07-06 16:42:11 +00:00
Nathan Whitehorn 928f33197d It does not actually make sense to provide an IPI facility on non-root
PICs, so replace cpuid logic with an assert.
2010-07-06 15:38:38 +00:00
Nathan Whitehorn 4dc2f910ee Fix interrupt distribution to multiple CPUs on systems with cascaded PICs.
Because slave PICs send all interrupts to their CPU 0 output line (which
is routed to a pin on the master PIC), changes to per-CPU register banks
like EOI on the slave PIC must be accessed for CPU 0, instead of the
CPU actually processing the interrupt.

Submitted by:	Andreas Tobler
2010-07-06 15:31:58 +00:00
Nathan Whitehorn 0870f0be13 Move the EOI logic when starting ithreads into intr_machdep instead of
relying on it as a side effect of PIC_MASK() in the PIC drivers, and add
an inmplementation of assign_cpu() for the kernel interrupt layer.
2010-07-06 15:27:05 +00:00
Marko Zec c9840b23d5 Fix a double-free bug which can occur if both bit error rate and packet
duplication probability are configured on a ng_pipe node.

Submitted by:	Jeffrey Ahrenholtz
MFC after:	3 days
2010-07-06 12:13:15 +00:00
Gleb Smirnoff 7418c6e1a9 Avoid double-free. In error cases ipfw(4) frees the mbuf(4), we don't
need to.

PR:		kern/145462
2010-07-06 10:45:38 +00:00
Rui Paulo 6e19f4de12 Merge from vendor-sys/opensolaris:
* add fasttrap files
2010-07-06 10:28:19 +00:00
Ed Schouten 822eb2b050 Fix a race condition, where a TTY could be destroyed twice.
There are special cases where tty_rel_free() can be called twice in a
row, namely when closing and revoking the TTY at the same moment. Only
call destroy_dev_sched_cb() once.

Reported by:	Jeremie Le Hen
MFC after:	1 week
2010-07-06 08:56:34 +00:00
Jeff Roberson 9f9c8c59ae - Handle the truncation of an inode with an effective link count of 0 in
the context of the process that reduced the effective count.  Previously
   all truncation as a result of unlink happened in the softdep flush
   thread.  This had the effect of being impossible to rate limit properly
   with the journal code.  Now the process issuing unlinks is suspended
   when the journal files.  This has a side-effect of improving rm
   performance by allowing more concurrent work.
 - Handle two cases in inactive, one for effnlink == 0 and another when
   nlink finally reaches 0.
 - Eliminate the SPACECOUNTED related code since the truncation is no
   longer delayed.

Discussed with:	mckusick
2010-07-06 07:11:04 +00:00
Pyun YongHyeon 55a24a0597 It seems read DMA mode register requires both IPv4 TSO and IPv6 TSO
configuration to get IPv4 TSO work on BCM57780. While I'm here
apply the same fix to BCM5785 which shares similar hardware feature
of BCM57780. This change makes TSO work on BCM57780.

Tested by:	Tong Liu <nemoliu <> gmail dot com>
2010-07-06 02:07:59 +00:00
Konstantin Belousov 5f195aa32e Add the ability for the allocflag argument of the vm_page_grab() to
specify the increment of vm_pageout_deficit when sleeping due to page
shortage. Then, in allocbuf(), the code to allocate pages when extending
vmio buffer can be replaced by a call to vm_page_grab().

Suggested and reviewed by:	alc
MFC after:	2 weeks
2010-07-05 21:13:32 +00:00
Jaakko Heinonen 13c02cbb18 Extend the kernel unit number allocator for allocating specific unit
numbers. This change adds a new function alloc_unr_specific() which
returns the requested unit number if it is free. If the number is
already allocated or out of the range, -1 is returned.

Update alloc_unr(9) manual page accordingly and add a MLINK for
alloc_unr_specific(9).

Discussed on:	freebsd-hackers
2010-07-05 16:23:55 +00:00
Konstantin Belousov 757216f3a5 Several cleanups for the r209686:
- remove unused defines;
- remove unused curgeneration argument for vm_object_page_collect_flush();
- always assert that vm_object_page_clean() is called for OBJT_VNODE;
- move vm_page_find_least() into for() statement initial clause.

Submitted by:	alc
2010-07-04 19:02:32 +00:00
Konstantin Belousov 34a39b7b1f Obey sv_syscallnames bounds in syscallname().
Reported and tested by:	pho
2010-07-04 18:16:17 +00:00
Marius Strobl 9f7666cebe - Pin the IPI cache and TLB demap functions in order to prevent migration
between determining the other CPUs and calling cpu_ipi_selected(), which
  apart from generally doing the wrong thing can lead to a panic when a
  CPU is told to IPI itself (which sun4u doesn't support).
  Reported and tested by: Nathaniel W Filardo
- Add __unused where appropriate.

MFC after:	3 days
2010-07-04 12:43:12 +00:00
Konstantin Belousov 8a26007903 Extend ptrace(PT_LWPINFO) to report siginfo for the signal that caused
debugee stop. The change should keep the ABI. Take care of compat32.

Discussed with:	davidxu, jhb
MFC after:	2 weeks
2010-07-04 11:48:30 +00:00
Konstantin Belousov 67322a4cd2 Constify source argument for siginfo_to_siginfo32().
MFC after:	1 week
2010-07-04 11:43:53 +00:00
Konstantin Belousov e239bb9730 Reimplement vm_object_page_clean(), using the fact that vm object memq
is ordered by page index. This greatly simplifies the implementation,
since we no longer need to mark the pages with VPO_CLEANCHK to denote
the progress. It is enough to remember the current position by index
before dropping the object lock.

Remove VPO_CLEANCHK and VM_PAGER_IGNORE_CLEANCHK as unused.
Garbage-collect vm.msync_flush_flags sysctl.

Suggested and reviewed by:	alc
Tested by:	pho
2010-07-04 11:26:56 +00:00
Konstantin Belousov b382c10a57 Introduce a helper function vm_page_find_least(). Use it in several places,
which inline the function.

Reviewed by:	alc
Tested by:	pho
MFC after:	1 week
2010-07-04 11:13:33 +00:00
Warner Losh 2a08b0b7a1 Add a safety-belt. If the identified disk has 0 blocks, don't attach
it.  This can happen in some cases when plugging in SD/SmartCard PC
Cards with empty slots.  It is better to detect this bogosity, and
refuse to attach rather than panic with a division by zero (in one of
many places) down stream.
2010-07-04 07:42:52 +00:00
Warner Losh 907659f0dc Minor formatting nits. 2010-07-04 05:58:17 +00:00
Marcel Moolenaar e987ee58d9 Allocate and setup an interrupt vector for corrected machine checks.
For now, just print when we get the interrupt, but eventually we need
to collect the details and provide a more useful report.
2010-07-03 20:19:20 +00:00
Nathan Whitehorn c7c4bc64f2 Add a missing conditional. We should not bind the PIC interrupt unless
the interrupt's PIC (a) exists and (b) is the root PIC.

Reported by:	Andreas Tobler
2010-07-03 20:11:04 +00:00
Alan Cox b64400a03f Improve the comment and man page for vm_page_alloc(). Specifically,
document one of the optional flags; clarify which of the flags are
optional (and which are not), and remove mention of a restriction on
the reclamation of cached pages that no longer holds since version 7.

MFC after:	1 week
2010-07-03 18:25:37 +00:00
Alexander Motin 7ce1f3e580 Add ata(4) ability to limit initial ATA mode for devices via device hints.
After boot this mode can be changed with atacontrol/camcontrol as usual.
It works for both legacy and ATA_CAM wrapper mode.

PR:		kern/123980
2010-07-03 14:14:42 +00:00
Randall Stewart 478fbccb67 This fixes a crash in SCTP. It was possible to have a
large number of packets queued to a crashing process.
In a specific case you may get 2 ABORT's back (from
say two packets in flight). If the aborts happened to
be processed at the same time its possible to have
one free the association while the other is trying
to report all the outbound packets. When this occured
it could lead to a crash.

MFC after:	3 days
2010-07-03 14:03:31 +00:00
Lawrence Stewart a5548bf685 Import the Statistical Information For TCP Research (SIFTR) kernel module into
FreeBSD. SIFTR logs a range of statistics on active TCP connections to a log
file, providing the ability to make highly granular measurements of TCP
connection state. The tool is aimed at system administrators, developers and
researchers alike. Please take it for a spin and test it out - the man page
should have all the information required to get you going.

Many thanks go to the Cisco University Research Program Fund at Community
Foundation Silicon Valley and the FreeBSD Foundation. Their support of our work
at the Centre for Advanced Internet Architectures, Swinburne University of
Technology is greatly appreciated.

Sponsored by:	Cisco URP, FreeBSD Foundation
Reviewed by:	dwmalone, gnn, rpaulo
Tested by:	Many on freebsd-current@ and elsewhere over the years
MFC after:	1 month
2010-07-03 13:32:39 +00:00
Alan Cox cdaba1f2be Push down the acquisition of the page queues lock into
vm_pageout_page_stats().  In particular, avoid acquiring the page
queues lock unless iterating over the active queue.
2010-07-02 20:56:22 +00:00
Alan Cox 4b0640310a Use vm_page_prev() instead of vm_page_lookup() in the implementation of
vm_fault()'s automatic delete-behind heuristic.
vm_page_prev() is typically faster.
2010-07-02 19:59:18 +00:00
Alexander Motin af565edaaa Revert r209638. After commit, there appeared to be more people who liked
previous name of stray interrupt counters, then responded to the list.
2010-07-02 17:22:15 +00:00
Alan Cox 41890423b6 Use vm_page_next() instead of vm_page_lookup() in exec_map_first_page()
because vm_page_next() is faster.
2010-07-02 15:50:30 +00:00
Alan Cox 9cf5198832 With the demise of page coloring, the page queue macros no longer serve any
useful purpose.  Eliminate them.

Reviewed by:	kib
2010-07-02 15:02:51 +00:00
Jayachandran C. 70b0d39bbc Add support for XLS 108 chips - update board.c/board.h to setup GMAC
driver parameters correctly.

Approved by:	rrs (mentor)
Obtained from:	Sriram Gorti <srgorti@netlogicmicro.com>
2010-07-02 13:30:26 +00:00
Jayachandran C. 2972a649c6 Remove save/restore of PageMask in tlb.c functions introduced in r209243.
If we save/restore the PageMask, the value set by the bootloader will
persist, and will cause problems later in TLB exception handler.
This caused a crash in AR71xx boards.

Also fixes the EntryHi mask in pte.h

Reported by: Luiz Otavio O Souza <lists.br@gmail.com>
Tested by:   Luiz Otavio O Souza <lists.br@gmail.com>

Approved by:	rrs (mentor)
2010-07-02 12:01:46 +00:00
Randall Stewart 606c58db25 Fix a bug that WILL cause a panic. Basically
a read-lock is being called to check the vtag-timewait cache.
Then in two cases (where a vtag is bad i.e. in the time-wait
state) the write-unlock is called NOT the read-unlock. Under
conditions where lots of associations are coming and going
this will cause the system to panic at some point.

MFC after:	3 days
2010-07-02 09:53:26 +00:00
Marcel Moolenaar 8a35d194f2 Remove the unneeded header <machine/intr.h>. 2010-07-02 02:17:39 +00:00
Alexander Motin b7bc6aa726 Make stray irq counters have format alike to other counters. Unified format
makes string processing (for example by `systat -vm`) easier.
2010-07-01 21:58:46 +00:00
Jack F Vogel cb18cb4d7c Add new source to the loadable em build, thought
it wasnt needed but it is.
2010-07-01 21:03:30 +00:00
Bernhard Schmidt 5d766a09da - Introduce IEEE80211_KEY_NOREPLAY, a per-key flag to ignore replay
violations.
- Use SIOCGIFMEDIA to determine VAP's opmode, cache it and set
  IEEE80211_KEY_NOREPLAY for AHDEMO and IBSS.

Approved by:	rpaulo (mentor)
2010-07-01 20:50:12 +00:00
Alexander Motin a7d6757c3e Allow attimer to be hinted at ISA if not reported by ISA PNP or ACPI.
Rephrase respective atrtc code same way to be more readable.
2010-07-01 18:59:05 +00:00
Alexander Motin 6019ba4e4b Rework r209456:
Instead of using fake rid (which ISA doesn't like), delete untrusted
IRQ resource and let it be recreated.
2010-07-01 18:51:18 +00:00
Gleb Smirnoff 956000b838 The struct ipfw_rule_ref follows the struct m_tag. Deal with this
correctly. This fixes breakage of ng_ipfw(4) in r201527.

Submitted by:	Alexander Zagrebin <alexz visp.ru>
2010-07-01 17:46:12 +00:00
Kevin Lo a02f351b57 Fix build 2010-07-01 05:03:24 +00:00
Marcel Moolenaar dc54fa1d55 MFia64:
When compiling with profiling, we define PROF for userspace and GPROF
for the kernel.
2010-07-01 03:48:45 +00:00
Marcel Moolenaar 57764700bc When compiling with profiling, we define PROF for userspace and GPROF
for the kernel.
2010-07-01 00:30:35 +00:00
Marcel Moolenaar 2c9459d167 While functions are ideally aligned to a 32-byte boundary, don't
assume this to be the case.
2010-06-30 22:29:02 +00:00
Jack F Vogel b827058579 OK, I was a bit sleep this morning and checked in
the core changes but left out the shared code, lol.
Well, and a couple fixes to the core... hopefully
this will all be complete now.

Happy happy joy joy :)
2010-06-30 21:05:51 +00:00
John Baldwin fc0de8f0b6 Move prototypes for kern_sigtimedwait() and kern_sigprocmask() to
<sys/syscallsubr.h> where all other kern_<syscall> prototypes live.
2010-06-30 18:03:42 +00:00
John Baldwin 418a27e99e Update comment for tdsignal() -> tdsendsignal() rename. Forgot to include
this in 209592.
2010-06-30 18:00:45 +00:00
Jack F Vogel 911fddbcb5 SR-IOV support added to igb
What this provides is support for the 'virtual function'
interface that a FreeBSD VM may be assigned from a host
like KVM on Linux, or newer versions of Xen with such
support.

When the guest is set up with the capability, a special
limited function 82576 PCI device is present in its virtual
PCI space, so with this driver installed in the guest that
device will be detected and function nearly like the bare
metal, as it were.

The interface is only allowed a single queue in this configuration
however initial performance tests have looked very good.

Enjoy!!
2010-06-30 17:26:47 +00:00
Alan Cox 95976f3f38 Simplify entry to vm_pageout_clean(). Expect the page to be locked.
Previously, the caller unlocked the page, and vm_pageout_clean()
immediately reacquired the page lock.  Also, assert rather than test
that the page is neither busy nor held.  Since vm_pageout_clean() is
called with the object and page locked, the page can't have changed
state since the caller verified that the page is neither busy nor
held.
2010-06-30 17:20:33 +00:00
Jack F Vogel 17d2646b7c Left out header change in last delta - new member
in adapter so that advertise changes can be done
to one port without the other changing.
2010-06-30 16:28:28 +00:00
Gleb Smirnoff 3da2cea421 Fix build. 2010-06-30 11:17:55 +00:00
Alan Cox f4b9ace4f8 Improve bufdone_finish()'s handling of the bogus page. Specifically, if
one or more mappings to the bogus page must be replaced, call pmap_qenter()
just once.  Previously, pmap_qenter() was called for each mapping to the
bogus page.

MFC after:	3 weeks
2010-06-30 04:52:42 +00:00
Jack F Vogel 1fa9ef23cc BAH, I apologize, the wrong version of the code got
fat fingered in place, this is the correct version
that actually works... <sheepish grin>

MFC: in a week
2010-06-30 01:10:08 +00:00
Jack F Vogel 5f46ec799a Add a new sysctl option, this will allow one to
limit the advertised speed of an SFP+ to 1G, effectively
"forcing" link at that lower speed. It is off by default
and is enabled by sysctl dev.ix.0.force_gig=1, 0 will
set it back to the norm.
2010-06-30 01:01:06 +00:00
Kenneth D. Merry 4201341ff7 Change the mpt driver to allow larger I/O sizes.
The mpt driver previously didn't report a 'maxio' size to CAM, and so the
da(4) driver limited I/O sizes to DFLTPHYS (64K) by default.  The number
of scatter gather segments allowed, as reported to busdma, was
(128K / PAGE_SIZE) + 1, or 33 on architectures with 4K pages.

Change things around so that we wait until we've determined how many
segments the adapter can support before creating the busdma tag used for
buffers, so we can potentially support more S/G segments and therefore
larger I/O sizes.

Also, fix some things that were broken about the module unload path.  It
still gets hung up inside CAM, though.

mpt.c:		Move some busdma initialization calls in here, and call
		them just after we've gotten the IOCFacts, and know how
		many S/G segments this adapter can support.

mpt.h:		Get rid of MPT_MAXPHYS, it is no longer used.

		Add max_cam_seg_cnt, which is used to report our maximum
		I/O size up to CAM.

mpt_cam.c:	Use max_cam_seg_cnt to report our maximum I/O size to CAM.

		Fix the locking in mpt_cam_detach().

mpt_pci.c:	Pull some busdma initialization and teardown out and put
		it in mpt.c.  We now delay it until we know many scatter
		gather segments the adapter can support, and therefore
		how to setup our busdma tags.

mpt_raid.c:	Make sure we wake up the right wait channel to get the
		raid thread to wake up when we're trying to shut it down.

Reviewed by:	gibbs, mjacob
MFC after:	2 weeks
2010-06-29 22:07:53 +00:00
Weongyo Jeong 03286b3576 Initializes the ratectl for a node when the state is changed to RUN.
This prevents a kernel fault by dividing with zero because the initial
rate was 0 and didn't be initialized.

Tested by:	Warren Block <wblock at wonkity.com>
MFC after:	3 days
2010-06-29 21:56:42 +00:00
Weongyo Jeong 68cd814a8a Fixes NULL pointer reference that it's occurred when the state is
changed to RUN because ic->ic_newassoc isn't set anywhere now.  In the
previous bwi_newassoc() is used to initialize AMRR rate routines.

Tested by:	Warren Block <wblock at wonkity.com>
MFC after:	3 days
2010-06-29 21:52:40 +00:00
John Baldwin fab216aaa0 Sort function prototypes (since I didn't manage to insert tdksignal()
correctly).
2010-06-29 20:55:12 +00:00
John Baldwin 7a6f3d7890 Send SIGPIPE to the thread that issued the offending system call
rather than to the entire process.

Reported by:	Anit Chakraborty
Reviewed by:	kib, deischen (concept)
MFC after:	1 week
2010-06-29 20:44:19 +00:00
John Baldwin ad6eec7b9e Tweak the in-kernel API for sending signals to threads:
- Rename tdsignal() to tdsendsignal() and make it private to kern_sig.c.
- Add tdsignal() and tdksignal() routines that mirror psignal() and
  pksignal() except that they accept a thread as an argument instead of
  a process.  They send a signal to a specific thread rather than to an
  individual process.

Reviewed by:	kib
2010-06-29 20:41:52 +00:00
Marcel Moolenaar cfbcffa248 Fix profiling (part 1):
o   Functions are 4-byte aligned for Book-E.
o   We get compiled with -DPROF and not -DGPROF if profiling
    is enabled.
2010-06-29 19:07:44 +00:00
Matt Jacob 6e4b813833 Don't lock buses around a call to xptperiphlistmatch- the buses will be
locked at appropriate places.

MFC after:	1 week
X-MFC:		208752
2010-06-29 17:10:55 +00:00
Gleb Smirnoff 24536f92c5 After processing the O_SKIPTO opcode our cmd points to the next rule, and
"match" processing at the end of inner loop would look ahead into the next
rule, which is incorrect. Particularly, in the case when the next rule
started with F_NOT opcode it was skipped blindly.

To fix this, exit the inner loop with the continue operator forcibly and
explicitly.

PR:		kern/147798
2010-06-29 16:57:30 +00:00
Konstantin Belousov 5ed35ba97a Revert r209578:
Use C99 initializers for the struct sysent generated by MAKE_SYSENT().
C++ does not have designator-initializer facility of C99, not using this
in the header makes us friendly to C++ kernel modules, whoever wants
such schism.

Requested by:	mdf
MFC after:	6 days (not really)
2010-06-29 14:31:49 +00:00
Doug Barton d748aee076 If i is going to be used in the loop unconditionally the declaration
has to be unconditional as well.

Conical head covering to:	kib
2010-06-29 01:04:24 +00:00
Konstantin Belousov 13cedde2cb Regenerate 2010-06-28 18:17:21 +00:00
Konstantin Belousov 0d9d996d39 Despite system call deregistration drains the threads executing System V
shm syscalls, and initial check for the number of allocated segments
in the module deinitialization code, the following might happen:
   after the check for active segment, while waiting for threads to
   leave some other syscall, shmget(2) is called. Then, we can end
   up with the shared segment that cannot be detached since sysvshm
   module is unloaded.

Prevent the leak by rechecking and disclaiming a reference to the vm
object owned by sysvshm module, that might have grown during the drain.

Tested by:	pho
Reviewed by:	jhb
MFC after:	1 month
2010-06-28 18:12:42 +00:00
Konstantin Belousov 153ac44cf6 Count number of threads that enter and leave dynamically registered
syscalls. On the dynamic syscall deregistration, wait until all
threads leave the syscall code. This somewhat increases the safety
of the loadable modules unloading.

Reviewed by:	jhb
Tested by:	pho
MFC after:	1 month
2010-06-28 18:06:46 +00:00
Konstantin Belousov dc2db34f42 Use C99 initializers for the struct sysent generated by MAKE_SYSENT().
MFC after:	1 week
2010-06-28 17:59:45 +00:00
Attilio Rao b2488fc159 Fix a lock leak in the deadlock resolver in case the ticks counter
wrapped up.

Sponsored by:	Sandvine Incorporated
Submitted by:	pluknet <pluknet at gmail dot com>
Reported by:	Anton Yuzhaninov <citrin at citrin dot ru>
Reviewed by:	jhb
MFC after:	3 days
2010-06-28 17:45:00 +00:00
Jaakko Heinonen bc96d3d17a Correct a comment typo. 2010-06-27 12:19:09 +00:00
Rui Paulo cb3fbd1b92 Fix typo introduced in previous revision. 2010-06-27 10:17:11 +00:00
Pawel Jakub Dawidek 3297cdd096 Correct arguments order. 2010-06-26 21:44:45 +00:00
Rui Paulo fcfe3ad480 Fix the AR_SREV_MERLIN_20_OR_LATER() check.
Submitted by:	Alex Kozlov <spam at rm-rf.kiev.ua>
MFC after:	2 weeks
2010-06-26 20:59:10 +00:00
Michael Tuexen e1c97831ec * Do not dereference a NULL pointer when calling an SCTP send syscall
not providing a destination address and using ktrace.
* Do not copy out kernel memory when providing sinfo for sctp_recvmsg().
Both bug where reported by Valentin Nechayev.
The first bug results in a kernel panic.
MFC after: 3 days.
2010-06-26 19:26:20 +00:00
Rui Paulo c6b2b6fce6 Add NTFS partition type to GEOM_MBR. 2010-06-26 13:20:40 +00:00
Rui Paulo bbe4a97d41 Import the acpi_aibs(4) driver written by Constantine A. Murenin.
It has more features than acpi_aiboost(4) and it will eventually replace
acpi_aiboost(4).

Submitted by:	Constantine A. Murenin <cnst at FreeBSD.org>
Reviewed by:	freebsd-acpi, imp
MFC after:	1 month
2010-06-25 15:32:46 +00:00
George V. Neville-Neil 5ea4d522bb Make sure that all the exposed counters and variables are actually
being updated.

Pointed out by:	jfv
2010-06-24 21:17:58 +00:00
Jayachandran C. 4fddb8ed6f Add linker script and configuration file for n32 kernel.
Approved by:	rrs (mentor)
2010-06-24 10:14:31 +00:00
Jayachandran C. 9fa0972cf9 Merge jmallett@'s n64 work into HEAD - changeset 7
Initial support for n32 and n64 ABIs from
http://svn.freebsd.org/base/user/jmallett/octeon

Changes are:
 - syscall, exception and trap support for n32/n64 ABIs
 - 64-bit address space defines
 - _jmp_buf for n32/n64
 - casts between registers and ptr/int updated to work on n32/n64

Approved by:	rrs(mentor), jmallett
2010-06-24 08:08:43 +00:00
Michael Tuexen 370d524f00 Fix a bug I introduced in r209470.
MFC after: 3 days
2010-06-24 07:43:25 +00:00
Marcel Moolenaar bcec9ed0f1 Assign PCI intline values for ISA interrupts using the new INTR_VEC()
macro.
2010-06-24 05:49:58 +00:00
Marcel Moolenaar ed571bca9f Remove debugging printf() -- that is, I assume it was for debugging :-) 2010-06-24 05:47:00 +00:00
Adrian Chadd 7107f92fd6 Comment about the shared pins I know about. 2010-06-24 05:17:21 +00:00
Marcel Moolenaar ec120b9476 Pass the device_t of the AT PIC driver to atpic_intr() so that
we don't have to use a global variable. Pass a NULL frame pointer
to the dispatch function just like openpic(4).
2010-06-24 05:05:18 +00:00
Nathan Whitehorn bcebf6a165 Reverse the logic of the if statement that sets the default value of
HZ; the list of 1000 Hz platforms was getting unwieldy.

Suggested by:	marcel
2010-06-24 00:27:20 +00:00
Jung-uk Kim 28ef508f86 Use M_WAITOK for VESA BIOS initialization consistently. 2010-06-23 23:34:56 +00:00
Nathan Whitehorn e864acd42f Move default HZ from 100 to 1000 on powerpc.
Reviewed by:	marcel
MFC after:	2 weeks
2010-06-23 23:26:14 +00:00
Marcel Moolenaar 79312a0b25 With openpic(4) using active-low as the default polarity, reconfigure
the internal interrupt sources as active-high. The internal interrupt
sources are disabled when programmed as active-low.

Note that the internal interrupts have no sense bit like the external
interrupts. We program them as edge-triggered to make sure we write a
0 value to a reserved register. It does not in any way say anything
about the sense of internal interrupt.
2010-06-23 23:16:27 +00:00
Nathan Whitehorn 08393b3efa Configure interrupts on SMP systems to be distributed among all online
CPUs by default, and provide a functional version of BUS_BIND_INTR().
While here, fix some potential concurrency problems in the interrupt
handling code.
2010-06-23 22:33:03 +00:00
Marcel Moolenaar bd077006c0 In the attach method, refactor to take into account that
BUS_GET_RESOURCE_LIST() can return a NULL pointer -- and
will for MPC85xx kernels.
2010-06-23 22:25:52 +00:00
Konstantin Belousov 595473a587 Clear DF bit in eflags/rflags on the kernel entry. The i386 and amd64
ABI specifies the DF should be zero, and newer compilers do not clear
DF before using DF-sensitive instructions.

The DF clearing for signal handlers was done some time ago.

MFC after:	1 week
2010-06-23 20:44:07 +00:00
Jayachandran C. 78fe0672b6 Merge jmallett@'s n64 work into HEAD - changeset 6
PTE flag cleanup from http://svn.freebsd.org/base/user/jmallett/octeon
- Rename PTE_xx flags to match their MIPS names
- Use the new pte_set/test/clear macros uniformly, instead of a mixture
  of mips_pg_xxx(), pmap_pte_x() macros and direct access.
- Remove unused macros and defines from pte.h and pmap.c

Discussed on freebsd-mips@

Approved by:	rrs(mentor), jmallett
2010-06-23 19:42:01 +00:00
Jung-uk Kim 362487c0ba Let x86bios_alloc() pass contigmalloc(9) flags. Use it to set M_WAITOK
from VESA BIOS initialization.  All other malloc(9) uses in the function is
blocking any way.
2010-06-23 17:20:51 +00:00
Michael Tuexen 749c49ac62 * Implement sctp_does_stcb_own_this_addr() correclty. It was taking the
wrong side into account.
* sctp_findassociation_ep_addr() must check the local address if available.
This fixes a bug where ABORT chunks were accepted even in the case where
the local was not owned by the endpoint.
Thanks to brucec for pointing out a bug in my first version of the fix.
MFC after: 3 days
2010-06-23 15:19:07 +00:00
Rebecca Cran 10eee561f4 Add some more modules to loader.conf. Remove if_awi since support for it
was removed 2 years ago.

PR: conf/147126
PR: conf/116071
Approved by: rrs (mentor)
2010-06-23 14:06:05 +00:00
Konstantin Belousov 692add74d8 Fix bugs on pc98, use npxgetuserregs() instead of npxgetregs() for
get_fpcontext(), and npxsetuserregs() for set_fpcontext). Also,
note that usercontext is not initialized anymore in fpstate_drop().

Systematically replace references to npxgetregs() and npxsetregs()
by npxgetuserregs() and npxsetuserregs() in comments.

Noted by:	bde
2010-06-23 12:17:13 +00:00
Konstantin Belousov 1060a94fb5 After the FPU use requires #MF working due to INT13 FPU exception handling
removal, MFi386 r209198:
    Use critical sections instead of disabling local interrupts to ensure
    the consistency between PCPU fpcurthread and the state of FPU.

Reviewed by:	bde
Tested by:	pho
2010-06-23 11:21:19 +00:00
Konstantin Belousov 699d648aab Remove the support for int13 FPU exception reporting on i386. It is
believed that all 486-class CPUs FreeBSD is capable to run on, either
have no FPU and cannot use external coprocessor, or have FPU on the
package and can use #MF.

Reviewed by:	bde
Tested by:	pho (previous version)
2010-06-23 11:12:58 +00:00
Konstantin Belousov 95882b9865 Remove unused i586 optimized bcopy/bzero/etc implementations that utilize
FPU registers for copying. Remove the switch table and jumps from
bcopy/bzero/... to the actual implementation.
As a side-effect, i486-optimized bzero is removed.

Reviewed by:	bde
Tested by:	pho (previous version)
2010-06-23 10:40:28 +00:00
Alexander Motin 926911c8ff Do not trust IRQ reported by ACPI. There are cases when it is wrong. 2010-06-23 05:43:21 +00:00
Adrian Chadd e3ded4845c AR71XX GPIO register definitions.
Reviewed by:	gonzo@
2010-06-23 03:59:26 +00:00
Andrew Thompson e3e05e50d9 - fix for USB audio devices which use the 7-byte endpoint descriptor instead of
the 9-byte one.
- remove sync-endpoint code, which is currently unused.

Reported by:	Antun Matanovi
Submitted by:	Hans Petter Selasky
2010-06-22 21:16:18 +00:00
Andrew Thompson 3851442c61 Reduce MIDI input buffer size to one USB packet, hence some USB devices don't
properly short terminate their transfers. This fixes a problem where input
appears several seconds late.

Reported by:	Alexander Yerenkow
Submitted by:	Hans Petter Selasky
2010-06-22 21:13:36 +00:00
Andrew Thompson 33ba3721c9 Add new device id.
PR:		usb/147190
2010-06-22 21:08:45 +00:00
Andrew Thompson 0f66567792 Add a mass storage quirk.
PR:		usb/147196
2010-06-22 21:03:13 +00:00
Andrew Thompson 8f55d259c2 Add new device id.
PR:		usb/146907
2010-06-22 21:01:40 +00:00
Andrew Thompson a4cadedb58 Add support for LOW speed BULK transfers. This mode is not recommended by the
USB 2.0 standard, though some USB devices use it anyway.

Submitted by:	Hans Petter Selasky
2010-06-22 20:57:48 +00:00
Andrew Thompson ca9d2489c6 Add missing opt_compat.h dependency.
Found by:	Garrett Cooper
2010-06-22 20:52:35 +00:00
Alexander Motin 49ed68bbf3 Add "legacy route" support to HPET driver. When enabled, this mode makes
HPET to steal IRQ0 from i8254 and IRQ8 from RTC timers. It can be suitable
for HPETs without FSB interrupts support, as it gives them two unshared
IRQs. It allows them to provide one per-CPU event timer on dual-CPU system,
that should be suitable for further tickless kernels.

To enable it, such lines may be added to /boot/loader.conf:
hint.atrtc.0.clock=0
hint.attimer.0.clock=0
hint.hpet.0.legacy_route=1
2010-06-22 19:42:27 +00:00
Alexander Motin 25eb1b8c15 Some style fixes for r209371.
Submitted by:	jhb@
2010-06-22 16:20:10 +00:00
Alexander Motin e723056a58 Do not set level-triggered interrupt mode if we are not going to use it.
This fixes QEMU crash due to unsupported level-triggered HPET interrupts.

Reported by:	kib@
2010-06-22 16:10:48 +00:00
Andriy Gapon 12b3a08d09 udf_vnops: cosmetic followup to r208671 - better looking code
Suggested by:	jhb
MFC after:	3 days
2010-06-22 08:22:25 +00:00
Alan Cox 91b4f42767 Introduce vm_page_next() and vm_page_prev(), and use them in
vm_pageout_clean().  When iterating over a range of pages, these functions
can be cheaper than vm_page_lookup() because their implementation takes
advantage of the vm_object's memq being ordered.

Reviewed by:	kib@
MFC after:	3 weeks
2010-06-21 23:27:24 +00:00
Alexander Motin 6519968e59 "time lock" is no longer a spin-lock since r209371.
Reported by:	kib@
2010-06-21 21:15:51 +00:00
Alexander Motin 7ea5021353 Fix ia64 build broken by r209371.
ia64, same as amd64 has ACPI and always has APIC.

Submitted by:	jhb@
2010-06-21 20:27:32 +00:00
Alexander Motin df471e067f Fix i386 LINT build broken by r209371.
There appeared such legacy thing as APM, that somehow breaking RTC.
2010-06-21 19:53:47 +00:00
Ed Schouten 60ae52f785 Use ISO C99 integer types in sys/kern where possible.
There are only about 100 occurences of the BSD-specific u_int*_t
datatypes in sys/kern. The ISO C99 integer types are used here more
often.
2010-06-21 09:55:56 +00:00
Konstantin Belousov c51050129f Do not report a stack garbage as the old value for debug.ncores sysctl.
Reported by:	brucec
2010-06-21 09:51:25 +00:00
Alexander Motin 875b8844be Implement new event timers infrastructure. It provides unified APIs for
writing event timer drivers, for choosing best possible drivers by machine
independent code and for operating them to supply kernel with hardclock(),
statclock() and profclock() events in unified fashion on various hardware.

Infrastructure provides support for both per-CPU (independent for every CPU
core) and global timers in periodic and one-shot modes. MI management code
at this moment uses only periodic mode, but one-shot mode use planned for
later, as part of tickless kernel project.

For this moment infrastructure used on i386 and amd64 architectures. Other
archs are welcome to follow, while their current operation should not be
affected.

This patch updates existing drivers (i8254, RTC and LAPIC) for the new
order, and adds event timers support into the HPET driver. These drivers
have different capabilities:
 LAPIC - per-CPU timer, supports periodic and one-shot operation, may
freeze in C3 state, calibrated on first use, so may be not exactly precise.
 HPET - depending on hardware can work as per-CPU or global, supports
periodic and one-shot operation, usually provides several event timers.
 i8254 - global, limited to periodic mode, because same hardware used also
as time counter.
 RTC - global, supports only periodic mode, set of frequencies in Hz
limited by powers of 2.

Depending on hardware capabilities, drivers preferred in following orders,
either LAPIC, HPETs, i8254, RTC or HPETs, LAPIC, i8254, RTC.
User may explicitly specify wanted timers via loader tunables or sysctls:
kern.eventtimer.timer1 and kern.eventtimer.timer2.
If requested driver is unavailable or unoperational, system will try to
replace it. If no more timers available or "NONE" specified for second,
system will operate using only one timer, multiplying it's frequency by few
times and uing respective dividers to honor hz, stathz and profhz values,
set during initial setup.
2010-06-20 21:33:29 +00:00
Nathan Whitehorn 976cc6975b Temporarily disable instruction relocation while setting up the kernel's
IBAT entry in early boot in order to prevent possible faults from races
between the instruction cache and the MMU.

PR:		powerpc/148003
MFC after:	3 days
2010-06-20 16:56:48 +00:00
Konstantin Belousov 427ef27ec7 Ensure that VOP_ACCESSX is called with exclusively locked vnode for
the kernel compiled with QUOTA option. ufs_accessx() upgrades the vdp
vnode lock from shared to exclusive to assign the dquot structure to
the vnode, and ufs_delete_denied() is called when tvp is locked. Since
upgrade drops shared lock when non-blocked upgrade failed, LOR is there.

Reported and tested by:	Dmitry Pryanishnikov <lynx.ripe gmail com>
Tested by:	pho
PR:	kern/147890
MFC after:	1 week
2010-06-20 13:35:16 +00:00
Brian Somers 7100efb738 Add a missing prototype
PR:		145232
Submitted by:	gcooper
MFC after:	1 week
2010-06-20 08:03:06 +00:00
Alexander Motin 9085ea5054 Report transport type in XPT_PATH_INQ.
MFC after:	3 days
2010-06-19 13:42:14 +00:00
Alexander Motin 33827b8428 Report transport type in XPT_PATH_INQ.
PR:		i386/147929
MFC after:	3 days
2010-06-19 13:41:17 +00:00
Alexander Motin 5ec55931d6 Core i5, same as previously Core2Duo, found to not set P-state for single
core lower then set on other cores. Do not try to test P-states on attach
on SMP systems. It is hopeless now and will just pollute verbose logs.
If needed, check still can be forced via loader tunable.
2010-06-19 13:09:42 +00:00
Adrian Chadd 7bc1af9566 Extend the AR71XX watchdog debugging and data.
* Add some per-device sysctl entries which record the watchdog state -
  whether it is armed; whether the last reboot was due to the watchdog.
* Add a per-device sysctl debug flag to enable logging watchdog arming/
  disarming.

Reviewed by:	gonzo@
2010-06-19 12:12:39 +00:00
Alexander Motin 3a18e1b6d7 Oops! Add " / hz" missed in r209328. Assume interrupt rate hz/2, not 1/2. 2010-06-19 08:46:17 +00:00
Brian Somers 5d6d222816 Add a missing linefeed
PR:		147337
Submitted by:	cyberleo at cyberleo dot net
MFC after:	1 week
2010-06-19 08:42:29 +00:00
Alexander Motin 7150e67191 While we indeed can't precisely measure time spent in C1, we can consider
measured interval as upper bound. It should be more precise then just
assuming hz/2. For idle CPU it should be quite precise, for busy - not
worse then before.
2010-06-19 08:36:12 +00:00
Lawrence Stewart cb0bd51d98 - Rename the internal for loop iterator to "_i" to avoid potential shadowing of
external variables named "i". The "_" prefix is reserved for infrastructure
  type code and is therefore not expected to be used by normal code likely to
  call DPCPU_SUM(). [1]

- Change DPCPU_SUM to return the sum rather than calculate and assign it
  internally. Usage is now: "sum = DPCPU_SUM(dpcpu_var, member_to_sum);" [2]

- Fix some style nits. [3]

Sponsored by:	FreeBSD Foundation
Suggested by:	bde [3], mdf [1], kib [1,2], pjd [1,3]
Reviewed by:	kib
MFC after:	1 week (instead of r209119)
2010-06-19 02:30:10 +00:00
Alan Cox 69a990a144 Catch up with the page and page queues locking changes. 2010-06-18 23:14:16 +00:00
Alan Cox 61a2a5dcd2 Eliminate unnecessary page queues locking. 2010-06-18 22:12:12 +00:00
Jayachandran C. eac058828b Add support for newer XLS chips/boards in the GMAC driver.
Improved processor id code in board.h, remove unnecessary macros.

Approved by:	rrs(mentor)
2010-06-18 21:40:32 +00:00
Nathan Whitehorn 755a660df7 Missed commit in r209310: the IRQ number in INTR_VEC() should have
parantheses around it to allow arithmetic expressions to be passed.

Submitted by:	Andreas Tobler
2010-06-18 21:24:17 +00:00
Jayachandran C. 89b6177335 Merge jmallett@'s n64 work into HEAD - changeset 5
Remove unnecessary locking and sched_pin() call while creating a temporary
mapping.

Changes from http://svn.freebsd.org/base/user/jmallett/octeon

Approved by:	rrs (mentor), jmallett
2010-06-18 20:07:30 +00:00
Konstantin Belousov 9e3e64e797 Only enable kdtrace hook in the LINT on the architectures that implement it. 2010-06-18 18:51:09 +00:00
Nathan Whitehorn 8aa8e94d34 Add MSI support for PCI devices attached to the CPC925 and CPC945 bridges
found in Apple and IBM G5 systems.
2010-06-18 17:39:56 +00:00
Nathan Whitehorn 6bb9bbbfd2 Missed change to sun4v while adding iparent lookup to the OFW interrupt
map interface.
2010-06-18 16:29:03 +00:00
Nathan Whitehorn c8812077bf Add support for the Keywest I2C controller in Apple uninorth northbridges.
Although the Keywest registers have only 1 byte of content, they are
secretly 4-byte registers, which became apparent from them moving on the
big-endian Uninorth version of the controller.
2010-06-18 14:28:57 +00:00
Nathan Whitehorn 9f220e4d78 Revert changes accidentally committed as part of r209298. 2010-06-18 14:20:54 +00:00
Nathan Whitehorn 7248ea35ca Following r209299, level interrupts are low by default on PPC, so remove
the hack here to reprogram the interrupt for K2 SATA devices.
2010-06-18 14:17:45 +00:00
Nathan Whitehorn a7a32004a4 Change the default interrupt polarity on PowerPC systems from high to low.
On Apple systems at least, all the level interrupts are wired active low.
Before this change, our PIC programming only worked because Apple hardware
ignores the interrupt polarity bit on all interrupts except IRQ 0.
2010-06-18 14:16:24 +00:00
Nathan Whitehorn eaef5f0af8 Provide for multiple, cascaded PICs on PowerPC systems, and extend the
OFW interrupt map interface to also return the device's interrupt parent.

MFC after:	8.1-RELEASE
2010-06-18 14:06:27 +00:00
Michael Tuexen cd1386ab50 Fix a rece condition in the shutdown handling.
The race condition resulted in a panic.

MFC after: 3 days
2010-06-18 09:01:44 +00:00
Martin Matuska d3cf8f4b68 Import latest ARC change from OpenSolaris:
- large ghost eviction causes high write latency
- arc_adjust might adjust MRU unnecessarily
- arc_adapt can lead to wild arc_p adjustment

OpenSolaris onnv-revision:	12636:13b5d698941e

Submitted by:	avg
Approved by:	pjd, delphij (mentor)
Obtained from:	OpenSolaris (Bug ID 6950219, 6953403, 6951024)
MFC after:	1 month
2010-06-17 22:47:44 +00:00
Xin LI b7a4702bd1 Remove an unused comment. 2010-06-17 19:48:03 +00:00
Pawel Jakub Dawidek 653e034db5 Turn off UMA allocations on all archs by default. It isn't stable even on
amd64.

Reported by:	many
MFC after:	3 days
2010-06-17 17:41:42 +00:00
Pawel Jakub Dawidek d32ef791eb Backout r207970 for now, it can lead to deadlocks.
Reported by:	kan
MFC after:	3 days
2010-06-17 17:39:51 +00:00
Jack F Vogel b7741e7a13 Two stats were duplicated, thanks to Andrew Boyer
for pointing this out.
2010-06-17 17:38:39 +00:00
Rui Paulo f05a947676 Make DTrace syscall provider work again by including opt_kdtrace.h here. 2010-06-17 17:34:45 +00:00
Jaakko Heinonen 24e8eaf191 - Fix compilation of the subr_unit.c user space test program.
- Use %zu for size_t in a few format strings.
2010-06-17 16:12:06 +00:00
Konstantin Belousov b376ebac6b In the ia32_{get,set}_fpcontext(), use fpu{get,set}userregs instead
of fpu{get,set}regs.

Noted by:	bde
MFC after:	1 month
2010-06-17 12:35:17 +00:00
Alexander Motin d364638110 Merge COUNT_XINVLTLB_HITS and COUNT_IPIS kernel options from i386 to amd64.
This information can be very valuable for CPU sleep-time (and respectively
idle power consumption) optimization.

Add counters for timer-related IPIs.

Reviewed by:	jhb@ (previous version)
2010-06-17 11:54:49 +00:00
Andriy Gapon e7154e7ef1 lock_profile_release_lock: do not compare unsigned with zero
Found by:	Coverity Prevent
CID:		3660
Reviewed by:	jhb
MFC after:	2 weeks
2010-06-17 10:15:13 +00:00
Ed Schouten 2e983ace8f Remove the unit argument from the recently added make_dev_p().
New code that creates character devices shouldn't use device unit
numbers, but only si_drv[12] to hold pointer to per-device data. Make
this function more future proof by removing the unit number argument.

Discussed with:	kib
2010-06-17 08:49:31 +00:00
Jayachandran C. 34da911965 Merge jmallett@'s n64 work into HEAD - changeset 4
Re-write tlb operations in C with a simpler API.
Update callers to use the new API.

Changes from http://svn.freebsd.org/base/user/jmallett/octeon

Approved by:	rrs(mentor), jmallett
2010-06-17 05:03:01 +00:00
George V. Neville-Neil fdbf7e3c5e Move statistics into the sysctl tree making it easier to find
and use them.
Add previously hidden statistics, some of which include interrupt
and host/card communication counters.
2010-06-16 20:57:41 +00:00
George V. Neville-Neil 9dc69a1589 Move statistics into the sysctl tree making it easier to find
and use them.
Add previously hidden statistics, some of which include interrupt
and host/card communication counters.
2010-06-16 17:36:53 +00:00