Commit Graph

84954 Commits

Author SHA1 Message Date
Konstantin Belousov
6db9cf559f Add definitions for the FPU extended state header, legacy extended
state and AVX state.

MFC after:	1 week
2012-01-17 17:07:13 +00:00
Konstantin Belousov
e568229f50 Modernize the fpusave structures definitions by using uint*_t types.
MFC after:	1 week
2012-01-17 16:53:41 +00:00
Alan Cox
1dfab8025e Explain why it is safe to unlock the vnode.
Requested by:	kib
2012-01-17 16:20:50 +00:00
Gleb Smirnoff
3a8c7fa008 Allocate our mbuf with m_get2(). 2012-01-17 12:14:26 +00:00
Gleb Smirnoff
0adbaa2b80 Provide a function m_get2() that allocates a minimal mbuf that
would fit specified size. Returned mbuf may be a single mbuf,
an mbuf with a cluster from packet zone, or an mbuf with jumbo
cluster of sufficient size.
2012-01-17 12:13:36 +00:00
Konstantin Belousov
dd4f5d2437 Implement xsetbv(), xsave() and xrstor() providing C access to the
similarly named CPU instructions.

Since our in-tree binutils gas is not aware of the instructions, and
I have to use the byte-sequence to encode them, hardcode the r/m operand
as (%rdi). This way, first argument of the pseudo-function is already
placed into proper register.

MFC after:	1 week
2012-01-17 07:30:36 +00:00
Konstantin Belousov
79937651ef Add definitions related to XCR0.
MFC after:	1 week
2012-01-17 07:23:43 +00:00
Konstantin Belousov
5ba2a4998c Add macro IS_BSP() to check whether the current CPU is BSP.
MFC after:	1 week
2012-01-17 07:21:23 +00:00
Sergey Kandaurov
37c2842272 Fix the "lock &zrl->zr_mtx already initialized" assertion by initializing
the allocated memory before calling mtx_init(9) on mtx pointing to it.
Otherwize, random contents of uninitialized memory might occasionally
trigger the assertion.

Reported by:	Pavel Polyakov <bsd kobyla org>
Reviewed by:	pjd
MFC after:	1 week
2012-01-17 06:23:25 +00:00
Kevin Lo
e0d3195bd6 Return EOPNOTSUPP since we only support update mounts for NFS export.
Spotted by:	trociny
2012-01-17 01:25:53 +00:00
Kirk McKusick
86b571509a There are several bugs/hangs when trying to take a snapshot on a UFS/FFS
filesystem running with journaled soft updates. Until these problems
have been tracked down, return ENOTSUPP when an attempt is made to
take a snapshot on a filesystem running with journaled soft updates.

MFC after: 2 weeks
2012-01-17 01:14:56 +00:00
Kirk McKusick
cc672d3599 Make sure all intermediate variables holding mount flags (mnt_flag)
and that all internal kernel calls passing mount flags are declared
as uint64_t so that flags in the top 32-bits are not lost.

MFC after: 2 weeks
2012-01-17 01:08:01 +00:00
Nathan Whitehorn
8d01a3b281 Revert r212360 now that PowerPC can handle large sparse arguments to
pmap_remove() (changed in r228412).

MFC after:	2 weeks
2012-01-17 00:31:09 +00:00
Alan Cox
292177e67a Improve abstraction. Eliminate direct access by elf*_load_section()
to an OBJT_VNODE-specific field of the vm object.  The same
information can be just as easily obtained from the struct vattr that
is in struct image_params if the latter is passed to
elf*_load_section().  Moreover, by replacing the vmspace and vm
object parameters to elf*_load_section() with a struct image_params
parameter, we actually reduce the size of the object code.

In collaboration with:	kib
2012-01-17 00:27:32 +00:00
Stanislav Sedov
f6d505ea58 - Add ID for the BeagleBone FTDI serial over usb port.
MFC after:	3 days
2012-01-16 23:14:23 +00:00
Hans Petter Selasky
36dc69c414 Add support for more USB devices.
Submitted by:	pav @
MFC after:	1 week
2012-01-16 22:26:25 +00:00
Sergey Kandaurov
037f43d3ef Be pedantic and change // comment to C-style one.
Noticed by:		Bruce Evans
2012-01-16 20:42:56 +00:00
David Schultz
a7eaecefba Generate a warning if the kernel's arc4random() is seeded with bogus entropy. 2012-01-16 20:18:10 +00:00
David Schultz
cb659153f9 Fix the value of float_t to match what is implied by FLT_EVAL_METHOD. 2012-01-16 20:17:51 +00:00
David Schultz
b3088c8315 Change the definition of FLT_EVAL_METHOD from 1 to 0. A value of 1 implies
that the compiler promotes floats to double precision in computations, but
inspection of the output of a cross-compiler indicates that this isn't the
case on powerpc.
2012-01-16 20:17:29 +00:00
Ivan Voras
d83064751a Add a bit of verbosity to the comment. 2012-01-16 15:47:42 +00:00
Kevin Lo
575cabed9e Fix a style bug
Spotted by:	avg
2012-01-16 14:54:48 +00:00
Gleb Smirnoff
15d2f18763 Make panic strings in m_gettype(), m_getzone(), m_cljset()
consistent.
2012-01-16 13:23:19 +00:00
Gleb Smirnoff
fe4ead276d Add missing static. 2012-01-16 12:33:55 +00:00
Gleb Smirnoff
abe5a2ce52 Remove some disabled NOTYET code. Probability of enabling it is low,
if anyone wants, he/she can take it from svn.
2012-01-16 12:31:33 +00:00
Gleb Smirnoff
b4240b64aa m_getzone() should return only cluster zones. 2012-01-16 10:58:14 +00:00
Hans Petter Selasky
96d87d2b69 Export ttyname instead of ttyunit via the sysctl interface.
Submitted by:	Mykhaylo Yehorov
PR:		usb/164090
MFC after:	1 week
2012-01-16 10:42:43 +00:00
Kevin Lo
57eb5548c9 Add nfs export support to tmpfs(5)
Reviewed by:	kib
2012-01-16 10:25:22 +00:00
Gleb Smirnoff
56cf9dc1f6 Drop support for SIOCSIFADDR, SIOCSIFNETMASK, SIOCSIFBRDADDR, SIOCSIFDSTADDR
ioctl commands.

PR:		163524
Reviewed by:	net
2012-01-16 09:53:24 +00:00
Hans Petter Selasky
3a4a1a7f8a Export information about USB serial port unit and port numbers
directly via the sysctl interface.

Submitted by:	Mykhaylo Yehorov
PR:		usb/164090
MFC after:	1 week
2012-01-16 08:13:25 +00:00
Xin LI
b834944105 Match surrounding style.
Noticed by:	avg
2012-01-16 06:00:44 +00:00
David Schultz
89c570d28d Remove a confused comment and fix some minor bugs. 2012-01-16 05:23:27 +00:00
David Schultz
9c955049b4 Fix the definition of FLT_EVAL_METHOD and some minor bugs. 2012-01-16 05:23:13 +00:00
Adrian Chadd
a2d4a78a47 Stop overloading opt_global.h. 2012-01-16 05:07:32 +00:00
David Xu
29a06690ca Eliminate branch and insert an explicit reader memory barrier to ensure
that waiter bit is set before reading semaphore count.
2012-01-16 04:39:10 +00:00
David Schultz
86d131a04a Implement FLT_ROUNDS for arm. Some (all?) arm FPUs lack support for
dynamic rounding modes, but FPUless chips that use softfloat can support it
because everything is emulated anyway.  (We presently have incomplete
support for hardware FPUs.)

Submitted by:	Ian Lepore
2012-01-16 04:08:29 +00:00
Colin Percival
e69346d668 s/amd64/i386/ in comment. 2012-01-16 02:42:41 +00:00
Colin Percival
1934cbcc1a Copy XENHVM config file from amd64, now that i386+XENHVM works. 2012-01-16 02:42:16 +00:00
Colin Percival
206d503b92 Make XENHVM work on i386. The __ffs() function counts bits starting from
zero, unlike ffs(3), which starts counting from 1.
2012-01-16 02:38:45 +00:00
Alexander Motin
20332cc2b2 Add check to avoid assertion panic on duplicate stop.
Reported by:	Yuri Pankov <yuri.pankov@gmail.com>
MFC after:	2 months
2012-01-16 00:26:52 +00:00
Alan Cox
0b05cac3d2 When tmpfs_write() resets an extended file to its original size after an
error, we want tmpfs_reg_resize() to ignore I/O errors and unconditionally
update the file's size.

Reviewed by:	kib
MFC after:	3 weeks
2012-01-16 00:26:49 +00:00
Tim Kientzle
79ca35f323 BeagleBone uses an FTDI chip with
an altered Product ID.
2012-01-15 23:00:33 +00:00
Andriy Gapon
996775de4b dadump: don't leak the periph lock on i/o error
Reported by:	az
MFC after:	1 week
2012-01-15 20:43:39 +00:00
Adrian Chadd
4aecc339cf Fix the situation where net80211 is built with IEEE80211_SUPPORT_TDMA but a module
is used.

Although the module _builds_, it fails to load because of a missing symbol from
ieee80211_tdma.c.

Specifics:

* Always build ieee80211_tdma.c in the module;
* only compile in the code if IEEE80211_SUPPORT_TDMA is defined.
2012-01-15 19:45:23 +00:00
Adrian Chadd
46efd63a5b Build some more things (random, bridge/gif/gre, gpio, USB) as modules as well
so some embedded platform builds can use these instead of a fully monolithic
kernel.
2012-01-15 19:43:56 +00:00
Adrian Chadd
20926a13f1 Begin breaking out the AR71xx specific functional drivers into modules.
The USB code as it stands includes the bus glue along _with_ the controller
code. So the ohci/ehci modules actually build the USB controller code and
the PCI bus glue.

It'd be nice to ship separate modules for the PCI glue and the USB
controller (so for example if there were a USB controller hanging off
the internal SoC bus as well as an external PCI device) it could be done.

This is primarily done to save a few bytes here and there on embedded
systems with limited flash space for kernels - a very limited (sub-1MB)
space may be available for the kernel and may only support gzip encoding.
The rootfs can be LZMA compressed.
2012-01-15 19:42:55 +00:00
Adrian Chadd
3cf391a131 Allow building the GPIO bus and associated bits as modules.
This is primarily done to save a few bytes here and there on embedded
systems with limited flash space for kernels - a very limited (sub-1MB)
space may be available for the kernel and may only support gzip encoding.
The rootfs can be LZMA compressed.
2012-01-15 19:40:59 +00:00
Adrian Chadd
e33eb65865 Add the new option introduced in the previous commit. 2012-01-15 19:30:32 +00:00
Adrian Chadd
7fb4a4be07 Some of the atheros based embedded devices use one or more PCI NICs
on-board, glued to the AR71xx CPU.  These may forgo separate WMAC EEPROMs
(which store configuration and calibration data) and instead store
it in the main board SPI flash.

Normally the NIC reads the EEPROM attached to it to setup various PCI
configuration registers.  If this isn't done, the device will probe as
something different (eg 0x168c:abcd, or 0x168c:ff??.)  Other setup registers
are also written to which may control important functions.

This introduces a new compile option, AR71XX_ATH_EEPROM, which enables the
use of this particular code.  The ART offset in the SPI flash can be
specified as a hint against the relevant slot/device number, for example:

hint.pcib.0.bus.0.17.0.ath_fixup_addr=0x1fff1000
hint.pcib.0.bus.0.18.0.ath_fixup_addr=0x1fff5000

TODO:

* Think of a better name;
* Make the PCIe version of this fixup code also use this option;
* Maybe also check slot 19;
* This has to happen _before_ the SPI flash is set from memory-mapped
  to SPI-IO - so document that somewhere.
2012-01-15 19:29:33 +00:00
Adrian Chadd
a86e181b4c Break out the "memory" EEPROM data read method from being AR9130 specific
to being more generic.

Other embedded SoCs also throw the configuration/PCI register
info into flash.

For now I'm just hard-coding the AR9280 option (for on-board AR9220's on
AP94 and commercial designs (eg D-Link DIR-825.))

TODO:

* Figure out how to support it for all 11n SoC NICs by doing it in
  ar5416InitState();
* Don't hard-code the EEPROM size - add another field which is set
  by the relevant chip initialisation code.
* 'owl_eep_start_loc' may need to be overridden in some cases to 0x0.
  I need to do some further digging.
2012-01-15 19:22:34 +00:00
Mikolaj Golub
fe7f89b71a Abrogate nchr argument in proc_getargv() and proc_getenvv(): we always want
to read strings completely to know the actual size.

As a side effect it fixes the issue with kern.proc.args and kern.proc.env
sysctls, which didn't return the size of available data when calling
sysctl(3) with the NULL argument for oldp.

Note, in get_ps_strings(), which does actual work for proc_getargv() and
proc_getenvv(), we still have a safety limit on the size of data read in
case of a corrupted procces stack.

Suggested by:	kib
MFC after:	3 days
2012-01-15 18:47:24 +00:00
Nathan Whitehorn
f7952747f6 Pick a constant high IRQ value for the PS3 IPI, which lets PS3 devices be
usefully loaded and unloaded as modules.

Submitted by:	geoffrey dot levand at mail dot ru
MFC after:	2 weeks
2012-01-15 18:26:43 +00:00
Martin Matuska
9cbe30e1d5 Fix missing in r230129:
kern_jail.c: initialize fullpath_disabled to zero
vfs_cache.c: add missing dot in comment

Reported by:	kib
MFC after:	1 month
2012-01-15 18:08:15 +00:00
Nathan Whitehorn
d4a7df2e65 Fix some unreliability problems related to MSR bits inherited from kboot by
setting an absolute MSR when during on the MMU. This prevents delay(), in
particular, from intermittently malfunctioning.
2012-01-15 16:58:44 +00:00
Nathan Whitehorn
6e3a3fe377 Now that we can tolerate LPAR context switches on the PS3 hypervisor, going
to hypervisor-idle on both threads will not hang the kernel.
2012-01-15 16:57:18 +00:00
Michael Tuexen
f7f2907a7e Small cleanup, no functional change. 2012-01-15 14:03:05 +00:00
Joel Dahl
2fc8344891 Fix a few comment typos. 2012-01-15 13:36:47 +00:00
Michael Tuexen
86eef6072b Two cleanups. No functional change. 2012-01-15 13:35:55 +00:00
Ulrich Spörlein
1eb6fc2b27 Remove spurious 8bit chars, turning files into plain ASCII. 2012-01-15 13:23:54 +00:00
Ulrich Spörlein
62355ca27f Convert files to UTF-8 2012-01-15 13:23:43 +00:00
Ulrich Spörlein
004a39cd57 Remove spurious 8bit chars, turning files into plain ASCII. 2012-01-15 13:23:33 +00:00
Ulrich Spörlein
9a14aa017b Convert files to UTF-8 2012-01-15 13:23:18 +00:00
Alexander Motin
7c6b05d280 Major snd_hda driver rewrite:
- Huge old hdac driver was split into three independent pieces: HDA
controller driver (hdac), HDA CODEC driver (hdacc) and HDA sudio function
driver (hdaa).
 - Support for multichannel recording was added. Now, as specification
defines, driver checks input associations for pins with sequence numbers
14 and 15, and if found (usually) -- works as before, mixing signals
together. If it doesn't, it configures input association as multichannel.
 - Signal tracer was improved to look for cases where several DACs/ADCs in
CODEC can work with the same audio signal. If such case found, driver
registers additional playback/record stream (channel) for the pcm device.
 - New controller streams reservation mechanism was implemented. That
allows to have more pcm devices then streams supported by the controller
(usually 4 in each direction). Now it limits only number of simultaneously
transferred audio streams, that is rarely reachable and properly reported
if happens.
 - Codec pins and GPIO signals configuration was exported via set of
writable sysctls. Another sysctl dev.hdaa.X.reconfig allows to trigger
driver reconfiguration in run-time.
 - Driver now decodes pins location and connector type names. In some cases
it allows to hint user where on the system case connectors, related to the
pcm device, are located. Number of channels supported by pcm device,
reported now (if it is not 2), should also make search easier.
 - Added workaround for digital mic on some Asus laptops/netbooks.

MFC after:	2 months
Sponsored by:	iXsystems, Inc.
2012-01-15 13:21:36 +00:00
Martin Matuska
f6e633a9e1 Introduce vn_path_to_global_path()
This function updates path string to vnode's full global path and checks
the size of the new path string against the pathlen argument.

In vfs_domount(), sys_unmount() and kern_jail_set() this new function
is used to update the supplied path argument to the respective global path.

Unbreaks jailed zfs(8) with enforce_statfs set to 1.

Reviewed by:	kib
MFC after:	1 month
2012-01-15 12:08:20 +00:00
Eitan Adler
886e862866 - Fix undefined behavior when device_get_name is null
- Make error message more informative

PR:		kern/149800
Submitted by:	olgeni
Approved by:	cperciva
MFC after:	1 week
2012-01-15 07:09:18 +00:00
Nathan Whitehorn
ae09ab8f63 Rework SLB trap handling so that double-faults into an SLB trap handler are
possible, and double faults within an SLB trap handler are not. The result
is that it possible to take an SLB fault at any time, on any address, for
any reason, at any point in the kernel.

This lets us do two important things. First, it removes the (soft) 16 GB RAM
ceiling on PPC64 as well as any architectural limitations on KVA space.
Second, it lets the kernel tolerate poorly designed hypervisors that
have a tendency to fail to restore the SLB properly after a hypervisor
context switch.

MFC after:	6 weeks
2012-01-15 00:08:14 +00:00
Alan Cox
93431cb74c Neither tmpfs_nocacheread() nor tmpfs_mappedwrite() needs to call
vm_object_pip_{add,subtract}() on the swap object because the swap
object can't be destroyed while the vnode is exclusively locked.
Moreover, even if the swap object could have been destroyed during
tmpfs_nocacheread() and tmpfs_mappedwrite() this code is broken
because vm_object_pip_subtract() does not wake up the sleeping thread
that is trying to destroy the swap object.

Free invalid pages after an I/O error.  There is no virtue in keeping
them around in the swap object creating more work for the page daemon.
(I believe that any non-busy page in the swap object will now always
be valid.)

vm_pager_get_pages() does not return a standard errno, so its return
value should not be returned by tmpfs without translation to an errno
value.

There is no reason for the wakeup on vpg in tmpfs_mappedwrite() to
occur with the swap object locked.

Eliminate printf()s from tmpfs_nocacheread() and tmpfs_mappedwrite().
(The swap pager already spam your console if data corruption is
imminent.)

Reviewed by:	kib
MFC after:	3 weeks
2012-01-14 23:04:27 +00:00
Christian S.J. Peron
5646ad6d27 Revert to the old behavior of allocating table/table entries using
M_NOWAIT.  Currently, the code allows for sleeping in the ioctl path
to guarantee allocation.  However code also handles ENOMEM gracefully, so
propagate this error back to user-space, rather than sleeping while
holding the global pf mutex.

Reviewed by:	glebius
Discussed with:	bz
2012-01-14 22:51:34 +00:00
Eitan Adler
bae93530a7 - Document TheDraw splash screens in the default loader.conf
Submitted by:	Jason Hellenthal
Approved by:	glebius
MFC after:	3 days
2012-01-14 17:34:32 +00:00
Eitan Adler
dde153da49 - Fix trivial typo
Approved by:	nwhitehorn
MFC after:	3 days
2012-01-14 17:07:52 +00:00
Michael Tuexen
8de4bcc1f7 Fix two bugs, which result in a panic when calling getsockopt()
using SCTP_RECVINFO or SCTP_NXTINFO.
Reported by Clement Lecigne and forwarded to us by zi@.

MFC after: 3 days.
2012-01-14 09:10:20 +00:00
Kirk McKusick
b60ee81e3d Convert FFS mount error messages from kernel printf's to using the
vfs_mount_error error message facility provided by the nmount
interface.

Clean up formatting of mount warnings which still need to use
kernel printf's since they do not return errors.

Requested by: Craig Rodrigues <rodrigc@crodrigues.org>
MFC after: 2 weeks
2012-01-14 07:26:16 +00:00
Rick Macklem
5b79362b47 Tai Horgan reported via email that there were two places in
the new NFSv4 server where the code follows the wrong list.
Fortunately, for these fairly rare cases, the lc_stateid[]
lists are normally empty. This patch fixes the code to
follow the correct list.

Reported by:	tai.horgan at isilon.com
Discussed with:	zack
MFC after:	2 weeks
2012-01-14 04:04:58 +00:00
Oleksandr Tymoshenko
4104e83567 Fix kernel modules loading for MIPS64 kernel:
On amd64, link_elf_obj.c must specify KERNBASE rather than
    VM_MIN_KERNEL_ADDRESS to vm_map_find() because kernel loadable
    modules must be mapped for execution in the same upper region
    of the kernel map as the kernel code and data segments.

    For MIPS32 KERNBASE lies below KVA area (it's less than
    VM_MIN_KERNEL_ADDRESS) so basically vm_map_find got whole
    KVA to look through. On MIPS64 it's not the case because
    KERNBASE is set to the very end of XKSEG, well out of KVA
    bounds, so vm_map_find always fails. We should use
    VM_MIN_KERNEL_ADDRESS as a base for vm_map_find.

Details obtained from: alc@
2012-01-14 00:36:07 +00:00
Oleksandr Tymoshenko
547cfad16d Fix backtrace for MIPS64:
- Properly print 64-bit addresses
    - Get whole 64 bits of address using kdbpeekd
    - Make check for kernel address compatible with MIPS64
2012-01-13 23:31:36 +00:00
Hans Petter Selasky
93ee6e858b Improve support for USB 3.0 HUBs. In certain states we
should do a warm reset instead of the default reset.

MFC after:	5 days
2012-01-13 22:26:13 +00:00
Hans Petter Selasky
e02f894bbe Bugfix: Make sure the XHCI driver doesn't clear
the route string field. Else USB 3.0 HUBs
won't work.

MFC after:	5 days
2012-01-13 22:19:14 +00:00
Don Lewis
b5bad28182 Allow an MBR primary or extended Linux swap partition to be specified
as the system dump device.  This was already allowed for GPT.  The Linux
swap metadata at the beginning of the partition should not be disturbed
because the crash dump is written at the end.

Reviewed by:	alfred, pjd, marcel
MFC after:	2 weeks
2012-01-13 18:32:56 +00:00
George V. Neville-Neil
ad71f089ab Clean up a switch statement for uncore events on Westmere processors.
Submitted by:	Davide Italiano
Reviewed by:	gnn
MFC after:	1 week
2012-01-13 17:13:46 +00:00
Luigi Rizzo
bcda432e01 indentation and whitespace fixes 2012-01-13 11:58:06 +00:00
Luigi Rizzo
38b4948b5e fix indentation 2012-01-13 11:01:23 +00:00
Alexander Motin
9e259819a6 Add BIO_DELETE support for SCSI Direct Access devices (da).
Depending on device capabilities use different methods to implement it.
Currently used method can be read/set via kern.cam.da.X.delete_method
sysctls. Possible values are:
 NONE - no provisioning support reported by the device;
 DISABLE - provisioning support was disabled because of errors;
 ZERO - use WRITE SAME (10) command to write zeroes;
 WS10 - use WRITE SAME (10) command with UNMAP bit set;
 WS16 - use WRITE SAME (16) command with UNMAP bit set;
 UNMAP - use UNMAP command (equivalent of the ATA DSM TRIM command).
The last two methods (UNMAP and WS16) are defined by SBC specification and
the UNMAP method is the most advanced one. The rest of methods I've found
supported in Linux, and as soon as they were trivial to implement, then
why not? Hope they will be useful in some cases.

Unluckily I have no devices properly reporting parameters of the logical
block provisioning support via respective VPD pages (0xB0 and 0xB2). So
all info I have/use now is the flag telling whether logical block
provisioning is supported or not. As result, specific methods chosen now
by trying different ones in order (UNMAP, WS16, DISABLE) and checking
completion status to fallback if needed. I don't expect problems from this,
as if something go wrong, it should just disable itself. It may disable
even too aggressively if only some command parameter misfit.

Unlike Linux, which executes each delete with separate request, I've
implemented here the same request aggregation as implemented in ada driver.
Tests on SSDs I have show much better results doing it this way: above
8GB/s of the linear delete on Intel SATA SSD on LSI SAS HBA (mps).

Reviewed by:	silence on scsi@
MFC after:	2 month
Sponsored by:	iXsystems, Inc.
2012-01-13 10:21:17 +00:00
Luigi Rizzo
6dba29a285 Two performance-related fixes:
1. as reported by Alexander Fiveg, the allocator was reporting
   half of the allocated memory. Fix this by exiting from the
   loop earlier (not too critical because this code is going
   away soon).

2. following a discussion on freebsd-current
    http://lists.freebsd.org/pipermail/freebsd-current/2012-January/031144.html
   turns out that (re)loading the dmamap was expensive and not optimized.
   This operation is in the critical path when doing zero-copy forwarding
   between interfaces.
   At least on netmap and i386/amd64, the bus_dmamap_load can be
   completely bypassed if the map is NULL, so we do it.

The latter change gives an almost 3x improvement in forwarding
performance, from the previous 9.5Mpps at 2.9GHz to the current
line rate (14.2Mpps) at 1.733GHz. (this is for 64+4 byte packets,
in other configurations the PCIe bus is a bottleneck).
2012-01-13 10:21:15 +00:00
Hans Petter Selasky
99b0e60766 Correct use of USB 3.0 POWER bit in the port status register,
hence it was overlapping the USB 3.0 root HUB's speed bits.

Reported by:	Kohji Okuno
MFC after:	1 week
2012-01-13 07:28:34 +00:00
Oleksandr Tymoshenko
33b570d348 - Fix .rela case of R_MIPS_26 relocation. Addednds save diferently for
.rel and .rela sections. It's shifted right two bits for former
   but saved as-is for latter.
2012-01-13 07:00:47 +00:00
Oleksandr Tymoshenko
234f7fd5a3 - Do not enumerate PCIe bus on CN56XX Pass 1 devices to avoid hard hang.
There is known issue with this hardware.

Submitted by:	Andrew Duane <aduane@juniper.net>
2012-01-13 02:33:55 +00:00
Justin Hibbits
82b6bd7d0e Add PWM monitoring sysctl to G4 MDD (Windtunnel) fan driver. While there, clean
up some style nits.

Approved by:	nwhitehorn (mentor)
MFC after:	3 days
2012-01-12 22:21:20 +00:00
Kenneth D. Merry
b87c6ae04b Silence some unnecessary verbosity.
Reported by:	mav
MFC after:	1 month
2012-01-12 22:08:33 +00:00
Hans Petter Selasky
4131f6fb60 - Try to fix support for USB 3.0 HUBs.
- Try to fix support for USB 3.0 suspend and resume.

MFC after:	1 week
2012-01-12 21:21:20 +00:00
Robert Watson
7983103ae6 Clarify throughout the vlan(4) code the difference between a "tag" (the
802.1q-defined 16-bit VID, CFI, and PCP field in host by order) and a
VLAN ID (VID).  Tags go in packets.  VIDs identify VLANs.

No functional change is intended, so this should be safe to MFC.  Further
cleanup with functional changes will be committed separately (for example,
renaming vlan_tag/vlan_tag_p, which modify the KPI and KBI).

Reviewed by:	bz
Sponsored by:	ADARA Networks, Inc.
MFC after:	3 days
2012-01-12 18:39:37 +00:00
Luigi Rizzo
ce9f43b467 clear the pointer after freeing the mbuf. Without that, we
risk a double free if the subsequent mbuf allocation fails.
This bug is not netmap-related and was introduced in  rev. 228387
2012-01-12 17:30:44 +00:00
Luigi Rizzo
467bd5c2cb fix the initialization of the rings when netmap is used,
to adapt it to the changes in  228387 .
Now the code is similar to the one used in other drivers.
Not applicable to stable/9 and stable/8
2012-01-12 17:28:00 +00:00
Kenneth D. Merry
8900f4b872 Fix a race condition in CAM peripheral free handling, locking
in the CAM XPT bus traversal code, and a number of other periph level
issues.

cam_periph.h,
cam_periph.c:	Modify cam_periph_acquire() to test the CAM_PERIPH_INVALID
		flag prior to allowing a reference count to be gained
		on a peripheral.  Callers of this function will receive
		CAM_REQ_CMP_ERR status in the situation of attempting to
		reference an invalidated periph.  This guarantees that
		a peripheral scheduled for a deferred free will not
		be accessed during its wait for destruction.

		Panic during attempts to drop a reference count on
		a peripheral that already has a zero reference count.

		In cam_periph_list(), use a local sbuf with SBUF_FIXEDLEN
		set so that mallocs do not occur while the xpt topology
		lock is held, regardless of the allocation policy of the
		passed in sbuf.

		Add a new routine, cam_periph_release_locked_buses(),
		that can be called when the caller already holds
		the CAM topology lock.

		Add some extra debugging for duplicate peripheral
		allocations in cam_periph_alloc().

		Treat CAM_DEV_NOT_THERE much the same as a selection
		timeout (AC_LOST_DEVICE is emitted), but forgo retries.

cam_xpt.c:      Revamp the way the EDT traversal code does locking
		and reference counting.  This was broken, since it
		assumed that the EDT would not change during
		traversal, but that assumption is no longer valid.

		So, to prevent devices from going away while we
		traverse the EDT, make sure we properly lock
		everything and hold references on devices that
		we are using.

		The two peripheral driver traversal routines should
		be examined.  xptpdperiphtraverse() holds the
		topology lock for the entire time it runs.
		xptperiphtraverse() is now locked properly, but
		only holds the topology lock while it is traversing
		the list, and not while the traversal function is
		running.

		The bus locking code in xptbustraverse() should
		also be revisited at a later time, since it is
		complex and should probably be simplified.

scsi_da.c:	Pay attention to the return value from cam_periph_acquire().

		Return 0 always from daclose() even if the disk is now gone.

		Add some rudimentary error injection support.

scsi_sg.c:	Fix reference counting in the sg(4) driver.

		The sg driver was calling cam_periph_release() on close,
		but never called cam_periph_acquire() (which increments
		the reference count) on open.

		The periph code correctly complained that the sg(4)
		driver was trying to decrement the refcount when it
		was already 0.

Sponsored by:	Spectra Logic
MFC after:	2 weeks
2012-01-12 00:41:48 +00:00
Kenneth D. Merry
130f4520cb Add the CAM Target Layer (CTL).
CTL is a disk and processor device emulation subsystem originally written
for Copan Systems under Linux starting in 2003.  It has been shipping in
Copan (now SGI) products since 2005.

It was ported to FreeBSD in 2008, and thanks to an agreement between SGI
(who acquired Copan's assets in 2010) and Spectra Logic in 2010, CTL is
available under a BSD-style license.  The intent behind the agreement was
that Spectra would work to get CTL into the FreeBSD tree.

Some CTL features:

 - Disk and processor device emulation.
 - Tagged queueing
 - SCSI task attribute support (ordered, head of queue, simple tags)
 - SCSI implicit command ordering support.  (e.g. if a read follows a mode
   select, the read will be blocked until the mode select completes.)
 - Full task management support (abort, LUN reset, target reset, etc.)
 - Support for multiple ports
 - Support for multiple simultaneous initiators
 - Support for multiple simultaneous backing stores
 - Persistent reservation support
 - Mode sense/select support
 - Error injection support
 - High Availability support (1)
 - All I/O handled in-kernel, no userland context switch overhead.

(1) HA Support is just an API stub, and needs much more to be fully
    functional.

ctl.c:			The core of CTL.  Command handlers and processing,
			character driver, and HA support are here.

ctl.h:			Basic function declarations and data structures.

ctl_backend.c,
ctl_backend.h:		The basic CTL backend API.

ctl_backend_block.c,
ctl_backend_block.h:	The block and file backend.  This allows for using
			a disk or a file as the backing store for a LUN.
			Multiple threads are started to do I/O to the
			backing device, primarily because the VFS API
			requires that to get any concurrency.

ctl_backend_ramdisk.c:	A "fake" ramdisk backend.  It only allocates a
			small amount of memory to act as a source and sink
			for reads and writes from an initiator.  Therefore
			it cannot be used for any real data, but it can be
			used to test for throughput.  It can also be used
			to test initiators' support for extremely large LUNs.

ctl_cmd_table.c:	This is a table with all 256 possible SCSI opcodes,
			and command handler functions defined for supported
			opcodes.

ctl_debug.h:		Debugging support.

ctl_error.c,
ctl_error.h:		CTL-specific wrappers around the CAM sense building
			functions.

ctl_frontend.c,
ctl_frontend.h:		These files define the basic CTL frontend port API.

ctl_frontend_cam_sim.c:	This is a CTL frontend port that is also a CAM SIM.
			This frontend allows for using CTL without any
			target-capable hardware.  So any LUNs you create in
			CTL are visible in CAM via this port.

ctl_frontend_internal.c,
ctl_frontend_internal.h:
			This is a frontend port written for Copan to do
			some system-specific tasks that required sending
			commands into CTL from inside the kernel.  This
			isn't entirely relevant to FreeBSD in general,
			but can perhaps be repurposed.

ctl_ha.h:		This is a stubbed-out High Availability API.  Much
			more is needed for full HA support.  See the
			comments in the header and the description of what
			is needed in the README.ctl.txt file for more
			details.

ctl_io.h:		This defines most of the core CTL I/O structures.
			union ctl_io is conceptually very similar to CAM's
			union ccb.

ctl_ioctl.h:		This defines all ioctls available through the CTL
			character device, and the data structures needed
			for those ioctls.

ctl_mem_pool.c,
ctl_mem_pool.h:		Generic memory pool implementation used by the
			internal frontend.

ctl_private.h:		Private data structres (e.g. CTL softc) and
			function prototypes.  This also includes the SCSI
			vendor and product names used by CTL.

ctl_scsi_all.c,
ctl_scsi_all.h:		CTL wrappers around CAM sense printing functions.

ctl_ser_table.c:	Command serialization table.  This defines what
			happens when one type of command is followed by
			another type of command.

ctl_util.c,
ctl_util.h:		CTL utility functions, primarily designed to be
			used from userland.  See ctladm for the primary
			consumer of these functions.  These include CDB
			building functions.

scsi_ctl.c:		CAM target peripheral driver and CTL frontend port.
			This is the path into CTL for commands from
			target-capable hardware/SIMs.

README.ctl.txt:		CTL code features, roadmap, to-do list.

usr.sbin/Makefile:	Add ctladm.

ctladm/Makefile,
ctladm/ctladm.8,
ctladm/ctladm.c,
ctladm/ctladm.h,
ctladm/util.c:		ctladm(8) is the CTL management utility.
			It fills a role similar to camcontrol(8).
			It allow configuring LUNs, issuing commands,
			injecting errors and various other control
			functions.

usr.bin/Makefile:	Add ctlstat.

ctlstat/Makefile
ctlstat/ctlstat.8,
ctlstat/ctlstat.c:	ctlstat(8) fills a role similar to iostat(8).
			It reports I/O statistics for CTL.

sys/conf/files:		Add CTL files.

sys/conf/NOTES:		Add device ctl.

sys/cam/scsi_all.h:	To conform to more recent specs, the inquiry CDB
			length field is now 2 bytes long.

			Add several mode page definitions for CTL.

sys/cam/scsi_all.c:	Handle the new 2 byte inquiry length.

sys/dev/ciss/ciss.c,
sys/dev/ata/atapi-cam.c,
sys/cam/scsi/scsi_targ_bh.c,
scsi_target/scsi_cmds.c,
mlxcontrol/interface.c:	Update for 2 byte inquiry length field.

scsi_da.h:		Add versions of the format and rigid disk pages
			that are in a more reasonable format for CTL.

amd64/conf/GENERIC,
i386/conf/GENERIC,
ia64/conf/GENERIC,
sparc64/conf/GENERIC:	Add device ctl.

i386/conf/PAE:		The CTL frontend SIM at least does not compile
			cleanly on PAE.

Sponsored by:	Copan Systems, SGI and Spectra Logic
MFC after:	1 month
2012-01-12 00:34:33 +00:00
Jung-uk Kim
ec3fc72f94 Merge ACPICA 20120111. 2012-01-11 23:06:37 +00:00
Don Lewis
930a96e4fa Pass the arguments to mtx_init() in the correct order. There should be
no change to the binary because the value of MTX_DEF is zero and there
is a visible function prototype.

MFC after:	1 week
2012-01-11 21:38:05 +00:00
Pedro F. Giffuni
70e0bbedef Replace GPL'd headers in the emu10kx snd driver code.
This uses the emuxkireg.h already used in the emu10k1
snd driver. Special thanks go to Alexander Motin as
he was able to find some errors and reverse engineer
some wrong values in the emuxkireg header.

The emu10kx driver is now free from the GPL.

PR:		153901
Tested by:	mav, joel
Approved by:	jhb (mentor)
MFC after:	2 weeks
2012-01-11 21:17:14 +00:00
Pedro F. Giffuni
7523592f91 Fix an inconsistency that crept in while replacing constants
from the new header.

Approved by:	jhb (mentor)
MFC after:	3 days
2012-01-11 21:03:54 +00:00
Gleb Smirnoff
b4f66a1781 Redo r226660:
- Define schednetisr() to swi_sched.
 - In the swi handler check if there is some data prepared,
   and if true, then call pfsync_sendout(), however tell it
   not to schedule swi again.
 - Since now we don't obtain the pfsync lock in the swi handler,
   don't use ifqueue mutex to synchronize queue access.
2012-01-11 18:34:57 +00:00
Konstantin Belousov
f5793e6f84 Add PCI Id for the AMT SOL UART on 5 series Intel chipsets.
MFC after:	1 week
2012-01-11 17:46:08 +00:00