Commit Graph

26487 Commits

Author SHA1 Message Date
Pawel Jakub Dawidek
ab568de789 Handle cases where capability rights are not provided.
Reported by:	kib
2013-09-05 11:58:12 +00:00
Ruslan Bukin
c7e4729da4 Add support for DLINK DWA-127 Wireless Adapter
Approved by:	cognet (mentor)
2013-09-05 10:09:24 +00:00
Justin Hibbits
995df27c66 Fix the build. 2013-09-05 01:13:26 +00:00
Pawel Jakub Dawidek
7008be5bd7 Change the cap_rights_t type from uint64_t to a structure that we can extend
in the future in a backward compatible (API and ABI) way.

The cap_rights_t represents capability rights. We used to use one bit to
represent one right, but we are running out of spare bits. Currently the new
structure provides place for 114 rights (so 50 more than the previous
cap_rights_t), but it is possible to grow the structure to hold at least 285
rights, although we can make it even larger if 285 rights won't be enough.

The structure definition looks like this:

	struct cap_rights {
		uint64_t	cr_rights[CAP_RIGHTS_VERSION + 2];
	};

The initial CAP_RIGHTS_VERSION is 0.

The top two bits in the first element of the cr_rights[] array contain total
number of elements in the array - 2. This means if those two bits are equal to
0, we have 2 array elements.

The top two bits in all remaining array elements should be 0.
The next five bits in all array elements contain array index. Only one bit is
used and bit position in this five-bits range defines array index. This means
there can be at most five array elements in the future.

To define new right the CAPRIGHT() macro must be used. The macro takes two
arguments - an array index and a bit to set, eg.

	#define	CAP_PDKILL	CAPRIGHT(1, 0x0000000000000800ULL)

We still support aliases that combine few rights, but the rights have to belong
to the same array element, eg:

	#define	CAP_LOOKUP	CAPRIGHT(0, 0x0000000000000400ULL)
	#define	CAP_FCHMOD	CAPRIGHT(0, 0x0000000000002000ULL)

	#define	CAP_FCHMODAT	(CAP_FCHMOD | CAP_LOOKUP)

There is new API to manage the new cap_rights_t structure:

	cap_rights_t *cap_rights_init(cap_rights_t *rights, ...);
	void cap_rights_set(cap_rights_t *rights, ...);
	void cap_rights_clear(cap_rights_t *rights, ...);
	bool cap_rights_is_set(const cap_rights_t *rights, ...);

	bool cap_rights_is_valid(const cap_rights_t *rights);
	void cap_rights_merge(cap_rights_t *dst, const cap_rights_t *src);
	void cap_rights_remove(cap_rights_t *dst, const cap_rights_t *src);
	bool cap_rights_contains(const cap_rights_t *big, const cap_rights_t *little);

Capability rights to the cap_rights_init(), cap_rights_set(),
cap_rights_clear() and cap_rights_is_set() functions are provided by
separating them with commas, eg:

	cap_rights_t rights;

	cap_rights_init(&rights, CAP_READ, CAP_WRITE, CAP_FSTAT);

There is no need to terminate the list of rights, as those functions are
actually macros that take care of the termination, eg:

	#define	cap_rights_set(rights, ...)				\
		__cap_rights_set((rights), __VA_ARGS__, 0ULL)
	void __cap_rights_set(cap_rights_t *rights, ...);

Thanks to using one bit as an array index we can assert in those functions that
there are no two rights belonging to different array elements provided
together. For example this is illegal and will be detected, because CAP_LOOKUP
belongs to element 0 and CAP_PDKILL to element 1:

	cap_rights_init(&rights, CAP_LOOKUP | CAP_PDKILL);

Providing several rights that belongs to the same array's element this way is
correct, but is not advised. It should only be used for aliases definition.

This commit also breaks compatibility with some existing Capsicum system calls,
but I see no other way to do that. This should be fine as Capsicum is still
experimental and this change is not going to 9.x.

Sponsored by:	The FreeBSD Foundation
2013-09-05 00:09:56 +00:00
Justin T. Gibbs
c70fe93ad8 Correct blkback handling of the BLKIF_OP_FLUSH_DISKCACHE opcode.
Properly round-trip the "operation code" for client requests.

sys/dev/xen/blkback/blkback.c:
	In xbb_dispatch_dev() when processing a flush request,
	correctly set bio->bio_caller1 to the request list (not
	bare request) for the operation, as is expected by the
	completion handler xbb_bio_done().

	In xbb_get_resources(), initialize "operation" in the
	driver's internal request object from the client's "ring
	request", so it is correct when used to populate the reply
	when this operation completes.

Submitted by:	Roger Pau Monné
Sponsored by:	Citrix Systems R&D
Reviewed by:	gibbs
2013-09-04 23:32:49 +00:00
Peter Grehan
46ed9e4908 IFC @ r255209 2013-09-04 20:55:56 +00:00
Oleksandr Tymoshenko
3b15395e04 Add 32-bit support for Gxemul's oldtestmips machine emulation
Original work by: kan@
2013-09-04 20:34:36 +00:00
Eitan Adler
4c8d7275a4 Revert r255152:
It turns out that synaptics_support was turned off by default
because its probing method is too intrusive not because it was unstable.

Once this is fixed it should be enabled once again.

Reported by:	delphij, jkim
2013-09-04 18:42:05 +00:00
Brooks Davis
f43581345b MFP4 217312, 222008, 222052, 222053, 222673, 231484, 231491, 231565, 570643
Rework the timeout code to use actual time rather than a DELAY() loop and
to use both typical and maximum to allow logging of timeout failures.
Also correct the erase timeout, it is specified in milliseconds not
microseconds like the other timeouts.  Do not invoke DELAY() between
status queries as this adds significant latency which in turn reduced
write performance substantially.

Sanity check timeout values from the hardware.

Implement support for buffered writes (only enabled on Intel/Sharp parts
for now).  This yields an order of magnitude speedup on the 64MB Intel
StrataFlash parts we use.

When making a copy of the block to modify, also keep a clean copy around
until we are ready to commit the block and use it to avoid unnecessary
erases.  In the non-buffer write case, also use it to avoid
unnecessary writes when the block has not been erased.  This yields a
significant speedup when doing things like zeroing a block.

Sponsored by:	DARPA, AFRL
Reviewed by:	imp (previous version)
2013-09-04 17:19:21 +00:00
Justin Hibbits
177f0102f4 Fix hwpmc(4) for 32-bit PowerPC. 2013-09-04 04:11:38 +00:00
Navdeep Parhar
4f641559c7 For TOE connections, the window scale factor in CPL_PASS_ACCEPT_REQ is
set to 15 to indicate that the peer did not send a window scale option
with its SYN.  Do not send a window scale option in the SYN|ACK reply
in that case.
2013-09-03 23:34:04 +00:00
Justin T. Gibbs
b72c9b0afd sys/dev/xen/blkback/blkback.c:
Initialize the request id for requests in xbb_get_resources()
	instead of its previous location in xbb_dispatch_io().  This
	guarantees that all request types (e.g. BLKIF_OP_FLUSH_DISKCACHE)
	have the front-end specified id recorded.

Submitted by:	Roger Pau Monné
Sponsored by:	Citrix Systems R&D
2013-09-03 13:49:00 +00:00
Bryan Venteicher
6e03f31982 Complete any pending Tx frames before attempting the next transmit
Also complete pending frames in the watchdog function when the
EVENT_IDX feature was negotiated just in case the completion
interrupt was postponed.
2013-09-03 02:28:31 +00:00
Bryan Venteicher
4142b1cbe5 Fix unintended compiler constant folding
Pointed out by:	dim@
2013-09-03 02:26:57 +00:00
Justin Hibbits
b2fb58a11d Refactor PowerPC hwpmc(4) driver into generic and specific. More refactoring
will likely be done as more drivers are added, since AIM-compatible processors
have similar PMC configuration logic.
2013-09-03 00:34:18 +00:00
Jean-Sébastien Pédron
79d98ecd19 psm: Add support for middle and extended buttons on Synaptics touchpads
PR:		kern/170834
Submitted by:	Brandon Gooch <jamesbrandongooch@gmail.com>
Tested by:	Artyom Mirgorodskiy <artyom.mirgorodsky@gmail.com>
MFC after:	1 month
2013-09-02 19:15:20 +00:00
Eitan Adler
abcdcce124 synaptics and trackpoint support are stable enough to be on by default.
Eventually both options should be removed.

Reviewed by:	dumbbell
2013-09-02 18:25:18 +00:00
Davide Italiano
89f6b7baf4 Complete r250105. Do not zero fields if M_ZERO flag is specified to
malloc(9).

Reported by:	pluknet, glebius
2013-09-01 21:44:43 +00:00
Eitan Adler
72d9611d24 Fix build with gcc
Reported by:	Michael Butler <imb@protected-networks.net>
Reviewed by:	jilles
2013-09-01 20:22:52 +00:00
Ian Lepore
e5efecdbeb Add the device ID for a new flavor of FTDI serial adapter (model 232EX). 2013-09-01 14:15:31 +00:00
Mark Murray
b881742f2e MFC 2013-09-01 13:33:05 +00:00
Bryan Venteicher
8f3600b108 Import multiqueue VirtIO net driver from my user/bryanv/vtnetmq branch
This is a significant rewrite of much of the previous driver; lots of
misc. cleanup was also performed, and support for a few other minor
features was also added.
2013-09-01 04:33:47 +00:00
Bryan Venteicher
cfc28a5bf7 Sync VirtIO net device header file from recent Linux 2013-09-01 04:23:54 +00:00
Bryan Venteicher
49a4385d69 Add optional VirtIO device method for post-attach notifications
This is called after the parent device (ie virito_pci) has
completed the device attachment/initialization.
2013-09-01 04:20:23 +00:00
Bryan Venteicher
b619f40aec Add support for postponing VirtIO virtqueue interrupts
Partial support for the EVENT_IDX feature was added a while ago,
but this commit adds an interface for the device driver to hint
how long (in terms of descriptors) the next interrupt should be
delayed.

The first user of this will be used to reduce VirtIO net's Tx
completion interrupts.
2013-09-01 04:16:43 +00:00
Mark Murray
f43c467a4f MFC 2013-08-31 13:41:20 +00:00
Hans Petter Selasky
33f4aa115d Sync USB bluetooth product list with Linux.
MFC after:	1 week
2013-08-31 06:47:53 +00:00
Konstantin Belousov
1a42d14a80 Give the page allocations initiated by the swap-backed md(4) a higher
priority.  If the write is requested by a system daemon, sleeping
there would starve resources and cause deadlock.

Reported and tested by:	pho
Sponsored by:	The FreeBSD Foundation
2013-08-30 20:12:23 +00:00
Jean-Sébastien Pédron
b8833944fd acpi_thermal: Warn about insane _TMP temperature only once
A warning is emitted again if the temperature became briefly valid
meanwhile. This avoids spamming the user when the sensor is broken.

Other values (ie. not _TMP) always raise a warning.
2013-08-30 19:21:12 +00:00
Mark Murray
7737ec4198 Remove short-lived idea; thread to harvest (eg) RDRAND enropy into the usual harvest queues. It was a nifty idea, but too heavyweight.
Submitted by:	Arthur Mesh <arthurmesh@gmail.com>
2013-08-30 17:47:53 +00:00
Marcel Moolenaar
40a827b6f0 A final test with unmodified code has shown that a delay of 150ms
is not giving us a 100% success rate. Bump the delay to 200ms as
that seems to do the trick.

Note that during testing the delay was added to uart_bus_attach()
in uart_core.c. While having the delay in a different place can
change the behaviour, it was not expected. Having to bump the
delay with another 50ms could therefore be an indication that
the problem can not be solved with delays.

Reported by: kevlo@
Tested by: kevlo@
2013-08-30 15:26:45 +00:00
Mark Murray
77de2c3f58 Separate out the Software RNG entropy harvesting queue and thread into its own files.
Submitted by:	 Arthur Mesh <arthurmesh@gmail.com>
2013-08-30 11:42:57 +00:00
Mark Murray
f27c28dc6e MFC 2013-08-30 11:38:34 +00:00
Bryan Venteicher
3c5dfe892d Few more minor if_vmx tweaks
- Allow the Rx/Tx queue sizes to be configured by tunables
 - Bail out earlier if the Tx queue unlikely has enough free
   descriptors to hold the frame
 - Cleanup some of the offloading capabilities handling
2013-08-30 05:53:00 +00:00
Navdeep Parhar
32e9219012 Fix the sysctl that displays whether buffer packing is enabled
or not.
2013-08-30 02:13:36 +00:00
Colin Percival
48a1ceed53 If reading a virtual-device value fails, attempt to read a virtual-device-ext
value.  Some hosts do not publish "extended" disk IDs via virtual-device in
an attempt to avoid confusing old blkfront drivers, and without this change
we failed to attach such disks.

In particular, this commit allows all 24 ephemeral disks on EC2 hs1.8xlarge
instances to be used, instead of only the first 15.

MFC after:	3 days
2013-08-30 01:46:56 +00:00
Navdeep Parhar
1458bff9a4 Implement support for rx buffer packing. Enable it by default for T5
cards.

This is a T4 and T5 chip feature which lets the chip deliver multiple
Ethernet frames in a single buffer.  This is more efficient within the
chip, in the driver, and reduces wastage of space in rx buffers.

- Always allocate rx buffers from the jumbop zone, no matter what the
  MTU is.  Do not use the normal cluster refcounting mechanism.
- Reserve space for an mbuf and a refcount in the cluster itself and let
  the chip DMA multiple frames in the rest.
- Use the embedded mbuf for the first frame and allocate mbufs on the
  fly for any additional frames delivered in the cluster.  Each of these
  mbufs has a reference on the underlying cluster.
2013-08-30 01:45:36 +00:00
Justin T. Gibbs
9f40021f28 Introduce a new, HVM compatible, paravirtualized timer driver for Xen.
Use this new driver for both PV and HVM instances.

This driver requires a Xen hypervisor that supports vector callbacks,
VCPUOP hypercalls, and reports that it has a "safe PV clock".

New timer driver:
Submitted by: will
Sponsored by: Spectra Logic Corporation

PV port to new driver, and bug fixes:
Submitted by: Roger Pau Monné
Sponsored by: Citrix Systems R&D

sys/dev/xen/timer/timer.c:
	- Register a PV timer device driver which (currently)
	  implements device_{identify,probe,attach} and stubs
	  device_detach.  The detach routine requires functionality
	  not provided by timecounters(4).  The suspend and resume
	  routines need additional work (due to Xen requiring that
	  the hypercalls be executed on the target VCPU), and aren't
	  needed for our purposes.

	- Make sure there can only be one device instance of this
	  driver, and that it only registers one eventtimers(4) and
	  one timecounters(4) device interface.  Make both interfaces
	  use PCPU data as needed.

	- Match, with a few style cleanups & API differences, the
	  Xen versions of the "fetch time" functions.

	- Document the magic scale_delta() better for the i386 version.

	- When registering the event timer, bind a separate event
	  channel for the timer VIRQ to the device's event timer
	  interrupt handler for each active VCPU.  Describe each
	  interrupt as "xen_et:c%d", so they can be identified per
	  CPU in "vmstat -i" or "show intrcnt" in KDB.

	- When scheduling a timer into the hypervisor, try up to
	  60 times if the hypervisor rejects the time as being in
	  the past.  In the common case, this retry shouldn't happen,
	  and if it does, it should only happen once.  This is
	  because the event timer advertises a minimum period of
	  100usec, which is only less than the usual hypercall round
	  trip time about 1 out of every 100 tries.  (Unlike other
	  similar drivers, this one actually checks whether the
	  hypervisor accepted the singleshot timer set hypercall.)

	- Implement a RTC PV clock based on the hypervisor wallclock.

sys/conf/files:
	- Add dev/xen/timer/timer.c if the kernel configuration
	  includes either the XEN or XENHVM options.

sys/conf/files.i386:
sys/i386/include/xen/xen_clock_util.h:
sys/i386/xen/clock.c:
sys/i386/xen/xen_clock_util.c:
sys/i386/xen/mp_machdep.c:
sys/i386/xen/xen_rtc.c:
	- Remove previous PV timer used in i386 XEN PV kernels, the
	  new timer introduced in this change is used instead (so
	  we share the same code between PVHVM and PV).

MFC after: 2 weeks
2013-08-29 23:11:58 +00:00
Jung-uk Kim
7311dad7ee 'u_long' is consistently spelled 'unsigned long' in this file. Fix it. 2013-08-29 23:09:34 +00:00
Jung-uk Kim
346c9ecee8 Partially revert r254880. The bitmap operations actually use long type now. 2013-08-29 22:46:21 +00:00
Jung-uk Kim
33e00c6789 Fix the incomplete conversion from atomic_t to long for test_bit(). 2013-08-29 20:51:12 +00:00
Jung-uk Kim
9dcd4b1293 Clarify confusions between atomic_t and bitmap. Fix bitmap operations
accordingly.
2013-08-29 20:40:45 +00:00
Justin T. Gibbs
76acc41fb7 Implement vector callback for PVHVM and unify event channel implementations
Re-structure Xen HVM support so that:
	- Xen is detected and hypercalls can be performed very
	  early in system startup.
	- Xen interrupt services are implemented using FreeBSD's native
	  interrupt delivery infrastructure.
	- the Xen interrupt service implementation is shared between PV
	  and HVM guests.
	- Xen interrupt handlers can optionally use a filter handler
	  in order to avoid the overhead of dispatch to an interrupt
	  thread.
	- interrupt load can be distributed among all available CPUs.
	- the overhead of accessing the emulated local and I/O apics
	  on HVM is removed for event channel port events.
	- a similar optimization can eventually, and fairly easily,
	  be used to optimize MSI.

Early Xen detection, HVM refactoring, PVHVM interrupt infrastructure,
and misc Xen cleanups:

Sponsored by: Spectra Logic Corporation

Unification of PV & HVM interrupt infrastructure, bug fixes,
and misc Xen cleanups:

Submitted by: Roger Pau Monné
Sponsored by: Citrix Systems R&D

sys/x86/x86/local_apic.c:
sys/amd64/include/apicvar.h:
sys/i386/include/apicvar.h:
sys/amd64/amd64/apic_vector.S:
sys/i386/i386/apic_vector.s:
sys/amd64/amd64/machdep.c:
sys/i386/i386/machdep.c:
sys/i386/xen/exception.s:
sys/x86/include/segments.h:
	Reserve IDT vector 0x93 for the Xen event channel upcall
	interrupt handler.  On Hypervisors that support the direct
	vector callback feature, we can request that this vector be
	called directly by an injected HVM interrupt event, instead
	of a simulated PCI interrupt on the Xen platform PCI device.
	This avoids all of the overhead of dealing with the emulated
	I/O APIC and local APIC.  It also means that the Hypervisor
	can inject these events on any CPU, allowing upcalls for
	different ports to be handled in parallel.

sys/amd64/amd64/mp_machdep.c:
sys/i386/i386/mp_machdep.c:
	Map Xen per-vcpu area during AP startup.

sys/amd64/include/intr_machdep.h:
sys/i386/include/intr_machdep.h:
	Increase the FreeBSD IRQ vector table to include space
	for event channel interrupt sources.

sys/amd64/include/pcpu.h:
sys/i386/include/pcpu.h:
	Remove Xen HVM per-cpu variable data.  These fields are now
	allocated via the dynamic per-cpu scheme.  See xen_intr.c
	for details.

sys/amd64/include/xen/hypercall.h:
sys/dev/xen/blkback/blkback.c:
sys/i386/include/xen/xenvar.h:
sys/i386/xen/clock.c:
sys/i386/xen/xen_machdep.c:
sys/xen/gnttab.c:
	Prefer FreeBSD primatives to Linux ones in Xen support code.

sys/amd64/include/xen/xen-os.h:
sys/i386/include/xen/xen-os.h:
sys/xen/xen-os.h:
sys/dev/xen/balloon/balloon.c:
sys/dev/xen/blkback/blkback.c:
sys/dev/xen/blkfront/blkfront.c:
sys/dev/xen/console/xencons_ring.c:
sys/dev/xen/control/control.c:
sys/dev/xen/netback/netback.c:
sys/dev/xen/netfront/netfront.c:
sys/dev/xen/xenpci/xenpci.c:
sys/i386/i386/machdep.c:
sys/i386/include/pmap.h:
sys/i386/include/xen/xenfunc.h:
sys/i386/isa/npx.c:
sys/i386/xen/clock.c:
sys/i386/xen/mp_machdep.c:
sys/i386/xen/mptable.c:
sys/i386/xen/xen_clock_util.c:
sys/i386/xen/xen_machdep.c:
sys/i386/xen/xen_rtc.c:
sys/xen/evtchn/evtchn_dev.c:
sys/xen/features.c:
sys/xen/gnttab.c:
sys/xen/gnttab.h:
sys/xen/hvm.h:
sys/xen/xenbus/xenbus.c:
sys/xen/xenbus/xenbus_if.m:
sys/xen/xenbus/xenbusb_front.c:
sys/xen/xenbus/xenbusvar.h:
sys/xen/xenstore/xenstore.c:
sys/xen/xenstore/xenstore_dev.c:
sys/xen/xenstore/xenstorevar.h:
	Pull common Xen OS support functions/settings into xen/xen-os.h.

sys/amd64/include/xen/xen-os.h:
sys/i386/include/xen/xen-os.h:
sys/xen/xen-os.h:
	Remove constants, macros, and functions unused in FreeBSD's Xen
	support.

sys/xen/xen-os.h:
sys/i386/xen/xen_machdep.c:
sys/x86/xen/hvm.c:
	Introduce new functions xen_domain(), xen_pv_domain(), and
	xen_hvm_domain().  These are used in favor of #ifdefs so that
	FreeBSD can dynamically detect and adapt to the presence of
	a hypervisor.  The goal is to have an HVM optimized GENERIC,
	but more is necessary before this is possible.

sys/amd64/amd64/machdep.c:
sys/dev/xen/xenpci/xenpcivar.h:
sys/dev/xen/xenpci/xenpci.c:
sys/x86/xen/hvm.c:
sys/sys/kernel.h:
	Refactor magic ioport, Hypercall table and Hypervisor shared
	information page setup, and move it to a dedicated HVM support
	module.

	HVM mode initialization is now triggered during the
	SI_SUB_HYPERVISOR phase of system startup.  This currently
	occurs just after the kernel VM is fully setup which is
	just enough infrastructure to allow the hypercall table
	and shared info page to be properly mapped.

sys/xen/hvm.h:
sys/x86/xen/hvm.c:
	Add definitions and a method for configuring Hypervisor event
	delievery via a direct vector callback.

sys/amd64/include/xen/xen-os.h:
sys/x86/xen/hvm.c:

sys/conf/files:
sys/conf/files.amd64:
sys/conf/files.i386:
	Adjust kernel build to reflect the refactoring of early
	Xen startup code and Xen interrupt services.

sys/dev/xen/blkback/blkback.c:
sys/dev/xen/blkfront/blkfront.c:
sys/dev/xen/blkfront/block.h:
sys/dev/xen/control/control.c:
sys/dev/xen/evtchn/evtchn_dev.c:
sys/dev/xen/netback/netback.c:
sys/dev/xen/netfront/netfront.c:
sys/xen/xenstore/xenstore.c:
sys/xen/evtchn/evtchn_dev.c:
sys/dev/xen/console/console.c:
sys/dev/xen/console/xencons_ring.c
	Adjust drivers to use new xen_intr_*() API.

sys/dev/xen/blkback/blkback.c:
	Since blkback defers all event handling to a taskqueue,
	convert this task queue to a "fast" taskqueue, and schedule
	it via an interrupt filter.  This avoids an unnecessary
	ithread context switch.

sys/xen/xenstore/xenstore.c:
	The xenstore driver is MPSAFE.  Indicate as much when
	registering its interrupt handler.

sys/xen/xenbus/xenbus.c:
sys/xen/xenbus/xenbusvar.h:
	Remove unused event channel APIs.

sys/xen/evtchn.h:
	Remove all kernel Xen interrupt service API definitions
	from this file.  It is now only used for structure and
	ioctl definitions related to the event channel userland
	device driver.

	Update the definitions in this file to match those from
	NetBSD.  Implementing this interface will be necessary for
	Dom0 support.

sys/xen/evtchn/evtchnvar.h:
	Add a header file for implemenation internal APIs related
	to managing event channels event delivery.  This is used
	to allow, for example, the event channel userland device
	driver to access low-level routines that typical kernel
	consumers of event channel services should never access.

sys/xen/interface/event_channel.h:
sys/xen/xen_intr.h:
	Standardize on the evtchn_port_t type for referring to
	an event channel port id.  In order to prevent low-level
	event channel APIs from leaking to kernel consumers who
	should not have access to this data, the type is defined
	twice: Once in the Xen provided event_channel.h, and again
	in xen/xen_intr.h.  The double declaration is protected by
	__XEN_EVTCHN_PORT_DEFINED__ to ensure it is never declared
	twice within a given compilation unit.

sys/xen/xen_intr.h:
sys/xen/evtchn/evtchn.c:
sys/x86/xen/xen_intr.c:
sys/dev/xen/xenpci/evtchn.c:
sys/dev/xen/xenpci/xenpcivar.h:
	New implementation of Xen interrupt services.  This is
	similar in many respects to the i386 PV implementation with
	the exception that events for bound to event channel ports
	(i.e. not IPI, virtual IRQ, or physical IRQ) are further
	optimized to avoid mask/unmask operations that aren't
	necessary for these edge triggered events.

	Stubs exist for supporting physical IRQ binding, but will
	need additional work before this implementation can be
	fully shared between PV and HVM.

sys/amd64/amd64/mp_machdep.c:
sys/i386/i386/mp_machdep.c:
sys/i386/xen/mp_machdep.c
sys/x86/xen/hvm.c:
	Add support for placing vcpu_info into an arbritary memory
	page instead of using HYPERVISOR_shared_info->vcpu_info.
	This allows the creation of domains with more than 32 vcpus.

sys/i386/i386/machdep.c:
sys/i386/xen/clock.c:
sys/i386/xen/xen_machdep.c:
sys/i386/xen/exception.s:
	Add support for new event channle implementation.
2013-08-29 19:52:18 +00:00
Jung-uk Kim
ea4447500d - Remove test_and_set_bit() macro. It is unused since r255037.
- Relax atomic_read() and atomic_set() macros.  Linux does not require any
memory barrier.  Also, these macros may be even reordered or optimized away
according to the API documentation:

https://www.kernel.org/doc/Documentation/atomic_ops.txt
2013-08-29 19:47:52 +00:00
Jung-uk Kim
0289d87d9c Fix atomic operations on context_flag without altering semantics. 2013-08-29 18:36:47 +00:00
Marcel Moolenaar
4fc4997535 Work-around a timing problem with the ITE IT8513E now that the core
calls ns8250_bus_ipend() almost immediately after ns8250_bus_attach().
As it appears, a line break condition is being signalled for almost
all received characters due to this. A delay of 150ms seems enough
to allow the H/W to settle and to avoid the problem.
More analysis is needed, but for now a regression has been addressed.

Reported by: kevlo@
Tested by: kevlo@
2013-08-29 16:26:04 +00:00
Adrian Chadd
e733e239ee Migrate iwn(4) to use the new ieee80211_tx_complete() API.
Tested:

* Intel 5100, STA mode
2013-08-29 13:56:44 +00:00
Adrian Chadd
808d6d430f Remove the duplicate LLC_MISS event and put it in the right order. 2013-08-29 13:52:51 +00:00
Navdeep Parhar
480e603c79 Merge r254386 from user/np/cxl_tuning. Add an INET|INET6 check missing
in said revision.

r254386:
Flush inactive LRO entries periodically.
2013-08-29 06:26:22 +00:00
Jung-uk Kim
8e0caa60f2 Correct atomic operations in i915. 2013-08-28 23:59:38 +00:00
Jung-uk Kim
6ac96a7e7e Fix a compiler warning and add couple of VM map types. 2013-08-28 23:43:28 +00:00
Navdeep Parhar
c93d567412 Whitespace nit. 2013-08-28 23:15:05 +00:00
Jung-uk Kim
2d0196c405 Fix a compiler warning. With this fix, a negative time can be converted to
a struct timeval and back to the original nanoseconds correctly.
2013-08-28 22:57:49 +00:00
Navdeep Parhar
319a31ea18 Change t4_list_lock and t4_uld_list_lock from mutexes to sx'es.
- tom_uninit had to be reworked not to hold the adapter lock (a mutex)
  around t4_deactivate_uld, which acquires the uld_list_lock.
- the ifc_match for the interface cloner that creates the tracer ifnet
  had to be reworked as the kernel calls ifc_match with the global
  if_cloners_mtx held.
2013-08-28 20:59:22 +00:00
Navdeep Parhar
9800517691 Add hooks in base cxgbe(4) for the iWARP upper-layer driver. Update a
couple of assertions in the TOE driver as well.
2013-08-28 20:45:45 +00:00
Jung-uk Kim
10f1472e41 Reduce diff against stable/9 slightly. 2013-08-28 20:10:56 +00:00
David C Somayajulu
67ffef6b9e ql_minidump() should be performed only by port 0.
Submitted by: David C Somayajulu
2013-08-28 20:07:00 +00:00
Jung-uk Kim
663593f19f Do not save/restore video memory if we are not using linear frame buffer.
Note this partially revert r233896.
2013-08-28 19:06:22 +00:00
Jung-uk Kim
b1bba126f0 Make sure to free stale buffer before allocating new one for safety. 2013-08-28 18:13:37 +00:00
Jung-uk Kim
7afb475f63 Avoid unnecessary signedness conversion. 2013-08-28 17:58:30 +00:00
Luiz Otavio O Souza
c6905524b4 Fix a few typos for s25fl types.
Approved by:	adrian (mentor)
2013-08-28 14:49:36 +00:00
Luiz Otavio O Souza
72405c6be0 Properly free gpiobus ivars when gpiobus_parse_pins() fails and also on
gpiobus detachment.

Suggested by:	imp
Approved by:	adrian (mentor)
2013-08-28 14:39:24 +00:00
Gavin Atkinson
0d9bc65de7 Support the PCI-Express SSD in the new MacBook Air (model A1465)
Submitted by:	Johannes Lundberg <johannes brilliantservice.co.jp>
MFC after:	3 days
2013-08-28 14:29:33 +00:00
David C Somayajulu
e43ab9b98e Fix bug in Flash access code
Submitted by: David C Somayajulu
2013-08-27 21:29:21 +00:00
Colin Percival
d1688fc3f1 Remove duplicate dev.xbd.*.max_requests sysctl added in r252260.
Approved by:	gibbs
2013-08-27 19:10:36 +00:00
Adrian Chadd
e95f34242c Use the new ieee80211_tx_complete() function. 2013-08-27 14:39:37 +00:00
Bryan Venteicher
3c9657753e Couple minor if_vmx tweaks
- Use queue size fields from the Tx/Rx queues in various places
    instead of (currently the same values) from the softc.
  - Fix potential crash in detach if the attached failed to alloc
    queue memory.
  - Move the VMXNET3_MAX_RX_SEGS define to a better spot.
  - Tweak frame size calculation w.r.t. ETHER_ALIGN. This could be
    tweaked some more, or removed since it probably doesn't matter
    much for x86 (and the x86 class of machines this driver will
    be used on).
2013-08-27 04:05:18 +00:00
Joerg Wunsch
acb3b5d2fe Reimplement the FDOPT_NOERROR feature that was kicked out in r134081.
It is needed for fdread(1) in order to be able to recover from CRC
errors in the data field of a floppy sector (by returning the sector
data that failed CRC, rather than inventing dummy data).

When closing the device, clear all transient device options.

MFC after:	1 week
2013-08-26 21:15:50 +00:00
Mark Murray
111e60c2ad Remove the short-lived namei experiment. 2013-08-26 19:07:03 +00:00
Navdeep Parhar
8a59745fca Use correct mailbox and PCIe PF number when querying RDMA parameters. 2013-08-26 19:02:52 +00:00
Mark Murray
f8530155da Snapshot of current work;
1) Clean up namespace; only use "Yarrow" where it is Yarrow-specific
or close enough to the Yarrow algorithm. For the rest use a neutral
name.

2) Tidy up headers; put private stuff in private places. More could
be done here.

3) Streamline the hashing/encryption; no need for a 256-bit counter;
128 bits will last for long enough.

There are bits of debug code lying around; these will be removed
at a later stage.
2013-08-26 18:29:51 +00:00
Mark Murray
a8343c86d2 MFC 2013-08-26 18:21:04 +00:00
John-Mark Gurney
534b11a131 Add support for my:
CPU: AMD A10-5700 APU with Radeon(tm) HD Graphics    (3393.89-MHz K8-class CPU)
2013-08-26 17:38:36 +00:00
Andre Oppermann
b072bdc119 Fix mbuf debugging printf()'s after the recent mbuf header changes. 2013-08-26 13:17:37 +00:00
Mark Murray
12278dbb57 MFC 2013-08-26 10:40:25 +00:00
Jean-Sébastien Pédron
f171f214dc drm/radeon: Rename the (S)DEBUG macros in atom.c to avoid conflicts
For instance, DEBUG is already defined in the LINT kernel configuration.
This fixes the build of LINT.
2013-08-26 06:31:57 +00:00
Jean-Sébastien Pédron
0adf4921fb drm/radeon: Import the Radeon KMS driver
This driver is based on Linux 3.8 and a previous effort by kan@.

More informations about this project can be found on the FreeBSD wiki:
    https://wiki.freebsd.org/AMD_GPU

The driver is split into:

  sys/dev/drm2:
    The driver sources.

  sys/modules/drm2/radeonkmw:
    The driver main kernel module's Makefile.

  sys/modules/drm2/radeonkmsfw:
    All firmware kernel module Makefiles. There's one directory and one
    Makefile for each firmware.

  sys/contrib/dev/drm2/radeonkmsfw:
    All firmware binary sources.

  tools/tools/drm/radeon
    Tools to update firmwares or regenerate some headers.

Merging the driver to FreeBSD 9.x may be possible but not a priority for
now.

Help from:	kib@, kan@
Tested by:	avg@, kwm@, ray@,
		Alexander Yerenkow <yerenkow@gmail.com>,
		Anders Bolt-Evensen <andersbo87@me.com>,
		Denis Djubajlo <stdedjub@googlemail.com>,
		J.R. Oldroyd <fbsd@opal.com>,
		Mikaël Urankar <mikael.urankar@gmail.com>,
		Pierre-Emmanuel Pédron <pepcitron@gmail.com>,
		Sam Fourman Jr. <sfourman@gmail.com>,
		Wade <wade-is-great@live.com>,
		(probably other I forgot...)
HW donations:	kyzh, Yakaz
2013-08-25 19:37:15 +00:00
Jean-Sébastien Pédron
6537c655e3 vga_pci: Remove left-over debugging printf()'s 2013-08-25 18:23:15 +00:00
Jean-Sébastien Pédron
509a8ff67a vga_pci: Add API to map the Video BIOS
Here are two new functions to map and unmap the Video BIOS:
    void * vga_pci_map_bios(device_t dev, size_t *size);
    void   vga_pci_unmap_bios(device_t dev, void *bios);

The BIOS is either taken from the shadow copy made by the System BIOS at
boot time if the given device was used for the default display (i386,
amd64 and ia64 only), or from the PCI expansion ROM.

Additionally, one can determine if a given device was the default
display at boot time using the following new function:
    void   vga_pci_unmap_bios(device_t dev, void *bios);
2013-08-25 18:09:11 +00:00
Jean-Sébastien Pédron
e558c87be3 drm: Use the new drm_atomic.h, following the merge of projects/atomic64
Submitted by:	jkim@
2013-08-25 15:38:16 +00:00
Jean-Sébastien Pédron
a18d713ab7 drm/ttm: Remove unused VM_ALLOC_DMA32 define 2013-08-25 15:33:17 +00:00
Jean-Sébastien Pédron
4360c0bb20 drm/ttm: Fix a reversed condition and add missing locks
This allows to run OpenGL applications on at least two test machines
with the Radeon driver.

Approved by:	kib@
2013-08-25 15:29:23 +00:00
Jean-Sébastien Pédron
be562465c9 drm/ttm: Fix style in ttm_bo_release_mmap() 2013-08-25 15:26:45 +00:00
Jean-Sébastien Pédron
970c941acb drm/ttm: Fix unmap of buffer object
Add a new ttm_bo_release_mmap() function to unmap pages in a
vm_object_t. Pages are freed when the buffer object is later released.

This function is called in ttm_bo_unmap_virtual_locked(), replacing
Linux' unmap_mapping_range(). In particular this is called when a buffer
object is about to be moved, so that its mapping is invalidated.

However, we don't use this function in ttm_bo_vm_dtor(), because the
vm_object_t is already marked as OBJ_DEAD and the pages will be
unmapped.

Approved by:	kib@
2013-08-25 15:15:55 +00:00
Jean-Sébastien Pédron
39db4184ec ttm: "to_page->valid = VM_PAGE_BITS_ALL" before vm_page_dirty(to_page)
Approved by;	kib@
2013-08-25 15:12:26 +00:00
Jean-Sébastien Pédron
fbe1da288c drm/ttm: Improve comment in ttm_bo_vm_ctor() about lack of ref acquisition
Approved by:	kib@
2013-08-25 15:06:48 +00:00
Jean-Sébastien Pédron
df58787aad drm/ttm: When removing a range of pages from a pool, remove all of them
Submitted by:	Mark Kettenis and Jonathan Gray from OpenBSD
Approved by:	kib@
2013-08-25 15:05:22 +00:00
Jean-Sébastien Pédron
9ba6f1ae72 drm/ttm: Fix style errors 2013-08-25 15:01:35 +00:00
Jean-Sébastien Pédron
098cced799 drm/ttm: Make ttm_bo_wait() call uninterruptible in page fault handler
This fixes a crash where a SIGLALRM, heavily used by X.Org, would
interrupt the wait, causing the page fault to fail and the "Xorg"
process to receive a SIGSEGV.

Approved by:	kib@
2013-08-25 15:00:48 +00:00
Jean-Sébastien Pédron
a7fa1c7cc3 drm/ttm: Import Linux commit ff7c60c580d9722f820d85c9c58ca55ecc1ee7c4
Author: Daniel Vetter <daniel.vetter@ffwll.ch>
Date:   Mon Jan 14 15:08:14 2013 +0100

    drm/ttm: fix fence locking in ttm_buffer_object_transfer, 2nd try

    This fixes up

    commit e8e89622ed361c46bf90ba4828e685a8b603f7e5
    Author: Daniel Vetter <daniel.vetter@ffwll.ch>
    Date:   Tue Dec 18 22:25:11 2012 +0100

        drm/ttm: fix fence locking in ttm_buffer_object_transfer

    which leaves behind a might_sleep in atomic context, since the
    fence_lock spinlock is held over a kmalloc(GFP_KERNEL) call. The fix
    is to revert the above commit and only take the lock where we need it,
    around the call to ->sync_obj_ref.

    v2: Fixup things noticed by Maarten Lankhorst:
    - Brown paper bag locking bug.
    - No need for kzalloc if we clear the entire thing on the next line.
    - check for bo->sync_obj (totally unlikely race, but still someone
      else could have snuck in) and clear fbo->sync_obj if it's cleared
      already.

    Reported-by: Dave Airlie <airlied@gmail.com>
    Cc: Jerome Glisse <jglisse@redhat.com>
    Cc: Maarten Lankhorst <maarten.lankhorst@canonical.com>
    Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
    Signed-off-by: Dave Airlie <airlied@redhat.com>

Approved by:	kib@
2013-08-25 14:58:44 +00:00
Jean-Sébastien Pédron
6ee96714c8 drm/ttm: Import Linux commit 014b34409fb2015f63663b6cafdf557fdf289628
Author: Dave Airlie <airlied@gmail.com>
Date:   Wed Jan 16 15:58:34 2013 +1000

    ttm: on move memory failure don't leave a node dangling

    if we have a move notify callback, when moving fails, we call move notify
    the opposite way around, however this ends up with *mem containing the mm_node
    from the bo, which means we double free it. This is a follow on to the previous
    fix.

    Reviewed-by: Jerome Glisse <jglisse@redhat.com>
    Signed-off-by: Dave Airlie <airlied@redhat.com>

Approved by:	kib@
2013-08-25 14:56:14 +00:00
Jean-Sébastien Pédron
6f65d975ed drm/ttm: Import Linux commit 630541863b29f88c7ab34e647758344e4cd1eafd
Author: Dave Airlie <airlied@gmail.com>
Date:   Wed Jan 16 14:25:44 2013 +1000

    ttm: don't destroy old mm_node on memcpy failure

    When we are using memcpy to move objects around, and we fail to memcpy
    due to lack of memory to populate or failure to finish the copy, we don't
    want to destroy the mm_node that has been copied into old_copy.

    While working on a new kms driver that uses memcpy, if I overallocated bo's
    up to the memory limits, and eviction failed, then machine would oops soon
    after due to having an active bo with an already freed drm_mm embedded in it,
    freeing it a second time didn't end well.

    Reviewed-by: Jerome Glisse <jglisse@redhat.com>
    Signed-off-by: Dave Airlie <airlied@redhat.com>

Approved by:	kib@
2013-08-25 14:55:08 +00:00
Jean-Sébastien Pédron
aacce5b681 drm/ttm: Import Linux commit cc4c0c4de3c775be22072ec3251f2e581b63d9a0
Author: Maarten Lankhorst <maarten.lankhorst@canonical.com>
Date:   Tue Jan 15 14:57:28 2013 +0100

    drm/ttm: unexport ttm_bo_wait_unreserved

    All legitimate users of this function outside ttm_bo.c are gone, now
    it's only an implementation detail.

    Signed-off-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>
    Reviewed-by: Jerome Glisse <jglisse@redhat.com>

Approved by:	kib@
2013-08-25 14:53:39 +00:00
Jean-Sébastien Pédron
fb61ac33be drm/ttm: Import Linux commit f2d476a110bc24fde008698ae9018c99e803e25c
Author: Maarten Lankhorst <maarten.lankhorst@canonical.com>
Date:   Tue Jan 15 14:57:10 2013 +0100

    drm/ttm: use ttm_bo_reserve_slowpath_nolru in ttm_eu_reserve_buffers, v2

    This requires re-use of the seqno, which increases fairness slightly.
    Instead of spinning with a new seqno every time we keep the current one,
    but still drop all other reservations we hold. Only when we succeed,
    we try to get back our other reservations again.

    This should increase fairness slightly as well.

    Changes since v1:
     - Increase val_seq before calling ttm_bo_reserve_slowpath_nolru and
       retrying to take all entries to prevent a race.

    Signed-off-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>
    Reviewed-by: Jerome Glisse <jglisse@redhat.com>

Approved by:	kib@
2013-08-25 14:52:20 +00:00
Jean-Sébastien Pédron
8aa5d01931 drm/ttm: Import Linux commit 5e45d7dfd74100d622f9cdc70bfd1f9fae1671de
Author: Maarten Lankhorst <maarten.lankhorst@canonical.com>
Date:   Tue Jan 15 14:57:05 2013 +0100

    drm/ttm: add ttm_bo_reserve_slowpath

    Instead of dropping everything, waiting for the bo to be unreserved
    and trying over, a better strategy would be to do a blocking wait.

    This can be mapped a lot better to a mutex_lock-like call.

    Signed-off-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>
    Reviewed-by: Jerome Glisse <jglisse@redhat.com>

Approved by:	kib@
2013-08-25 14:47:22 +00:00
Jean-Sébastien Pédron
aa675725db drm/ttm: Import Linux commit 7a1863084c9d90ce4b67d645bf9b0f1612e68f62
Author: Maarten Lankhorst <maarten.lankhorst@canonical.com>
Date:   Tue Jan 15 14:56:48 2013 +0100

    drm/ttm: cleanup ttm_eu_reserve_buffers handling

    With the lru lock no longer required for protecting reservations we
    can just do a ttm_bo_reserve_nolru on -EBUSY, and handle all errors
    in a single path.

    Signed-off-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>
    Reviewed-by: Jerome Glisse <jglisse@redhat.com>
2013-08-25 14:41:22 +00:00
Jean-Sébastien Pédron
f25ca89630 drm/ttm: Import Linux commit 63d0a4195560362e2e00a3ad38fc331d34e1da9b
Author: Maarten Lankhorst <maarten.lankhorst@canonical.com>
Date:   Tue Jan 15 14:56:37 2013 +0100

    drm/ttm: remove lru_lock around ttm_bo_reserve

    There should no longer be assumptions that reserve will always succeed
    with the lru lock held, so we can safely break the whole atomic
    reserve/lru thing. As a bonus this fixes most lockdep annotations for
    reservations.

    Signed-off-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>
    Reviewed-by: Jerome Glisse <jglisse@redhat.com>
2013-08-25 14:39:51 +00:00
Jean-Sébastien Pédron
0277f749a3 drm: Update drm_atomic.h, now that projects/atomic64 is in HEAD
Submitted by:	jkim@
2013-08-25 14:33:49 +00:00
Jean-Sébastien Pédron
01655b8522 drm: Add missing bits to drmP.h, required by the Radeon driver
Some of the FreeBSD-specific definitions are moved to drm_os_freebsd.h.
But there's still work to do to clean it up and reduce the diff with
Linux' drmP.h.
2013-08-25 14:27:14 +00:00
Adrian Chadd
81c4f79f18 Update the mis-predicted branch PMC names (for sandy bridge) to not clash.
The SDM (June 2013) tables on these are rather confusing.  Yes, they
assign the same name (BR_MISP_RETIRED.ALL_BRANCHES) to two codes
(C5H/00H and C5H/04H.) The latter however is the PEBS version.

So, to make it easier to see the difference - and yes, we can use
both without having to actually enable the PEBS specific bits! -
just rename the PEBS one to _PS so there's no clashing.

Tested:

* Sandy bridge
2013-08-25 12:58:34 +00:00
Jean-Sébastien Pédron
bd5c482a8c drm: Import drm_fixed.h from Linux 3.8 2013-08-25 12:27:15 +00:00
Jean-Sébastien Pédron
a435cf5cd5 drm: Update drm_pciids.h based on Linux 3.8
This header can be easily updated using the new "gen-drm_pciids" script,
available in tools/tools/drm. The script uses the Linux' drm_pciids.h
header for new IDs, the FreeBSD's one because we add the name of the
device to each IDs, and the PCI IDs database (misc/pciids port) to fill
this name automatically for new IDS.

To call the script:
  tools/tools/drm/gen-drm_pciids					\
    /path/to/linux/drm_pciids.h						\
    /path/to/freebsd/drm_pciids.h					\
    /path/to/pciids/pci.ids
2013-08-25 12:20:57 +00:00
Adrian Chadd
cb42cde6ec Fix a >80 character long line, introduced in my previous commit.
Noticed by: hiren
2013-08-25 12:02:20 +00:00
Jean-Sébastien Pédron
e27c6c9fa2 drm: Import drm_pcie_get_speed_cap_mask() in drm_pci.c
This comes with several PCI_VENDOR_ID_* defines which should go in a
more central place.
2013-08-25 11:34:37 +00:00
Andre Oppermann
bb25e5ab00 Give (*ext_free) an int return value allowing for very sophisticated
external mbuf buffer management capabilities in the future.

For now only EXT_FREE_OK is defined with current legacy behavior.

Sponsored by:	The FreeBSD Foundation
2013-08-25 10:57:09 +00:00
Jean-Sébastien Pédron
adeff39cd4 drm: Import list_for_each_entry_safe_from() macro 2013-08-25 10:28:02 +00:00
Jean-Sébastien Pédron
9f2e0f5d19 drm: Use DRM_IF_MAJOR & DRM_IF_MINOR from drm_core.h 2013-08-25 10:13:23 +00:00
Mark Murray
6871a82d32 MFC 2013-08-25 10:08:58 +00:00
Jean-Sébastien Pédron
735f427563 drm: In drm_gem_name_create(), verify argument before acquiring lock
Submitted by:	J.R. Oldroyd <jr@opal.com>
2013-08-25 10:04:10 +00:00
Jean-Sébastien Pédron
10548903da drm: Call "gem_close_object" driver callback from drm_gem_object_release_handle()
This fixes leakage of "bo_va" for Cayman and following card generations.
2013-08-25 10:01:59 +00:00
Jean-Sébastien Pédron
1eeccc8f4c drm: Support gem_open_object() and gem_close_object() callbacks
... in struct drm_driver_info.
2013-08-25 09:58:31 +00:00
Jean-Sébastien Pédron
b5185a8933 drm: Fix typo in KASSERT message: s/Dandling/Dangling/ 2013-08-25 09:53:00 +00:00
Jean-Sébastien Pédron
8479311ef0 drm: Import Linux commit cd004b3f4cd4169815c82bf9e424fda06978898a
Author: Shirish S <s.shirish@samsung.com>
Date:   Thu Aug 30 07:04:06 2012 +0000

    drm: edid: add support for E-DDC

    The current logic for probing ddc is limited to
    2 blocks (256 bytes), this patch adds support
    for the 4 block (512) data.

    To do this, a single 8-bit segment index is
    passed to the display via the I2C address 30h.
    Data from the selected segment is then immediately
    read via the regular DDC2 address using a repeated
    I2C 'START' signal.

    Signed-off-by: Shirish S <s.shirish@samsung.com>
    Reviewed-by: Jean Delvare <jdelvare@suse.de>
    Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
    Reviewed-by: Ville Syrjala <ville.syrjala@linux.intel.com>
    Signed-off-by: Dave Airlie <airlied@redhat.com>
2013-08-25 09:46:03 +00:00
Hans Petter Selasky
8f39f442c9 Bugfix: The endpoint profile should only be checked in device mode when
allocating USB transfers and not in host mode.

Reported by:	George Mitchell <george+freebsd@m5p.com>
2013-08-25 08:42:50 +00:00
Adrian Chadd
c55e621eed Update the MEM_UOP_RETIRED PMC operation for sandy bridge and sandy
bridge Xeon.

Summary: These are PEBS events but they're also available as normal
counter/sample events.  The source table (Table 19-2) lists the
base versions (LOAD, STLB_MISS, SPLIT, ALL) but it says they must
be qualified with other values.  This particular commit fleshes
out those umask values.

Source:

* Linux; SDM June 2013, Volume 3B, Table 19-2 and 18-21.

Tested:

* Sandy Bridge (non-Xeon)
2013-08-25 02:07:28 +00:00
Jean-Sébastien Pédron
92cf4f8de0 drm: In drm_mmap_single, try ttm_bo_mmap_single() before drm_gem_mmap_single()
In drivers such as the Radeon driver, the DRIVER_GEM features flag is
set but TTM is used to mmap buffer object.
2013-08-25 00:34:44 +00:00
Jean-Sébastien Pédron
5eaeb54990 drm: Fix cleanup if device initialization fails
This plugs some memory leaks.
2013-08-25 00:22:34 +00:00
Jean-Sébastien Pédron
22f61fe5d4 drm: Use driver-provided "use_msi" callback to determine if MSI is blacklisted
For now, keep the static array for i915. But eventually, it should be
moved to a callback in the driver itself.
2013-08-25 00:13:53 +00:00
Jean-Sébastien Pédron
f7eda40d0e drm: Don't delete already deleted iicbus child from drm_iic_dp_aux
The iic_dp_aux_detach callback is therefore useless: it's replaced by
bus_generic_detach. This fixes a "General protection fault" panic during
second (incorrect) deletion of the child.

Tested by:	kwm@
Reviewed by:	ray@
2013-08-24 23:54:06 +00:00
Jean-Sébastien Pédron
285be846af drm: Move definition of EREMOTEIO to drmP.h
It will be used by both i915 and radeon drivers.

Add ERESTARTSYS definition at the same time.
2013-08-24 23:47:31 +00:00
Jean-Sébastien Pédron
74eb6a63ca drm: Import drm_dp_helper.c from Linux 3.8-rc3
While here, update drm_dp_helper.h to better match Linux one.
2013-08-24 23:38:57 +00:00
Mark Johnston
29f4e216f2 Rename the kld_unload event handler to kld_unload_try, and add a new
kld_unload event handler which gets invoked after a linker file has been
successfully unloaded. The kld_unload and kld_load event handlers are now
invoked with the shared linker lock held, while kld_unload_try is invoked
with the lock exclusively held.

Convert hwpmc(4) to use these event handlers instead of having
kern_kldload() and kern_kldunload() invoke hwpmc(4) hooks whenever files are
loaded or unloaded. This has no functional effect, but simplifes the linker
code somewhat.

Reviewed by:	jhb
2013-08-24 21:13:38 +00:00
Joerg Wunsch
1f97b64cbb Do not use "Enable Implied Seek" on enhanced floppy controllers. This
breaks the "2step" feature of the driver, e.g. in order to read 360
KiB media on a 1200 KiB drive.

As the only potential advantage of implied (vs. explicit) seeks is to
minimize the software effort, yet our driver always contained the
logic needed for explicit seeks, simply dropping implied seeks is the
best solution without introducing risks for new bugs.  There is no
performance penalty, reading a 1440 KiB medium takes exactly the same
time with both, implied or explicit seeks.

MFC after:	1 week
2013-08-24 21:04:54 +00:00
Andre Oppermann
1b4381afbb Restructure the mbuf pkthdr to make it fit for upcoming capabilities and
features.  The changes in particular are:

o Remove rarely used "header" pointer and replace it with a 64bit protocol/
  layer specific union PH_loc for local use.  Protocols can flexibly overlay
  their own 8 to 64 bit fields to store information while the packet is
  worked on.

o Mechanically convert IP reassembly, IGMP/MLD and ATM to use pkthdr.PH_loc
  instead of pkthdr.header.

o Extend csum_flags to 64bits to allow for additional future offload
  information to be carried (e.g. iSCSI, IPsec offload, and others).

o Move the RSS hash type enumerator from abusing m_flags to its own 8bit
  rsstype field.  Adjust accessor macros.

o Add cosqos field to store Class of Service / Quality of Service information
  with the packet.  It is not yet supported in any drivers but allows us to
  get on par with Cisco/Juniper in routing applications (plus MPLS QoS) with
  a modernized ALTQ.

o Add four 8 bit fields l[2-5]hlen to store the relative header offsets
  from the start of the packet.  This is important for various offload
  capabilities and to relieve the drivers from having to parse the packet
  and protocol headers to find out location of checksums and other
  information.  Header parsing in drivers is a lot of copy-paste and
  unhandled corner cases which we want to avoid.

o Add another flexible 64bit union to map various additional persistent
  packet information, like ether_vtag, tso_segsz and csum fields.
  Depending on the csum_flags settings some fields may have different usage
  making it very flexible and adaptable to future capabilities.

o Restructure the CSUM flags to better signify their outbound (down the
  stack) and inbound (up the stack) use.  The CSUM flags used to be a bit
  chaotic and rather poorly documented leading to incorrect use in many
  places.  Bring clarity into their use through better naming.
  Compatibility mappings are provided to preserve the API.  The drivers
  can be corrected one by one and MFC'd without issue.

o The size of pkthdr stays the same at 48/56bytes (32/64bit architectures).

Sponsored by:	The FreeBSD Foundation
2013-08-24 19:51:18 +00:00
Andre Oppermann
edd26b66ce Change local variable tso_segsz to tsosegsz to avoid mbuf.h macro conflicts.
Sponsored by:	The FreeBSD Foundation
2013-08-24 19:38:36 +00:00
Andre Oppermann
3b460852c4 Remove unnecessary setup of the m->pkthdr.header pointer.
Sponsored by:	The FreeBSD Foundation
2013-08-24 17:14:14 +00:00
Andre Oppermann
9a73687609 Add an mbuf pointer parameter to (*ext_free) to give the external
free function access to the mbuf the external memory was attached
to.

Mechanically adjust all users to include the mbuf parameter.

This fixes a long standing annoyance for external free functions.
Before one had to sacrifice one of the argument pointers for this.

Sponsored by:	The FreeBSD Foundation
2013-08-24 16:57:44 +00:00
Jean-Sébastien Pédron
06b77ec36d drm: Fix leak of connector->edid_blob_ptr 2013-08-24 16:55:53 +00:00
Jean-Sébastien Pédron
0bf283a517 drm: Const'ify the 1st "drm_display_mode" passed to "mode_fixup" callbacks
This will be needed by the Radeon KMS driver.
2013-08-24 16:50:47 +00:00
Jean-Sébastien Pédron
d08e4108f6 drm/i915: Import Linux commit 71244653a8fb0f46bc12ae421f1d5f72af6a75da
Author: Daniel Vetter <daniel.vetter@ffwll.ch>
Date:   Mon Jun 4 18:39:20 2012 +0200

    drm/i915: adjusted_mode->clock in the dp mode_fixup

    ... instead of changing mode->clock, which we should leave as-is.

    After the previous patch we only touch that if it's a panel, and then
    adjusted mode->clock equals adjusted_mode->clock. Outside of
    intel_dp.c we only use ajusted_mode->clock in the mode_set functions.

    Within intel_dp.c we only use it to calculate the dp dithering
    and link bw parameters, so that's the only thing we need to fix
    up.

    As a temporary ugliness (until the cleanup in the next patch) we
    pass the adjusted_mode into dp_dither for both parameters (because
    that one still looks at mode->clock).

    Note that we do overwrite adjusted_mode->clock with the selected dp
    link clock, but that only happens after we've calculated everything we
    need based on the dotclock of the adjusted output configuration.

    Outside of intel_dp.c only intel_display.c uses adjusted_mode->clock,
    and that stays the same after this patch (still equals the selected dp
    link clock). intel_display.c also needs the actual dotclock (as
    target_clock), but that has been fixed up in the previous patch.

    v2: Adjust the debug message to also use adjusted_mode->clock.

    Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
    Reviewed-by: Jesse Barnes <jbarnes@virtuousgeek.org>
    Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2013-08-24 16:41:14 +00:00
Jean-Sébastien Pédron
943c0e86fe drm: Import drm_buffer.[ch] from Linux 3.8-rc3
This will be used by the Radeon KMS driver.
2013-08-24 16:14:20 +00:00
Jean-Sébastien Pédron
e3b7062fce drm: Call drm_global_init() & drm_global_release() at module load/unload 2013-08-24 15:47:15 +00:00
Mark Murray
ddbfa6b19e 1) example (partially humorous random_adaptor, that I call "EXAMPLE")
* It's not meant to be used in a real system, it's there to show how
   the basics of how to create interfaces for random_adaptors. Perhaps
   it should belong in a manual page

2) Move probe.c's functionality in to random_adaptors.c
 * rename random_ident_hardware() to random_adaptor_choose()

3) Introduce a new way to choose (or select) random_adaptors via tunable
"rngs_want" It's a list of comma separated names of adaptors, ordered
by preferences. I.e.:
rngs_want="yarrow,rdrand"

Such setting would cause yarrow to be preferred to rdrand. If neither of
them are available (or registered), then system will default to
something reasonable (currently yarrow). If yarrow is not present, then
we fall back to the adaptor that's first on the list of registered
adaptors.

4) Introduce a way where RNGs can play a role of entropy source. This is
mostly useful for HW rngs.

The way I envision this is that every HW RNG will use this
functionality by default. Functionality to disable this is also present.
I have an example of how to use this in random_adaptor_example.c (see
modload event, and init function)

5) fix kern.random.adaptors from
kern.random.adaptors: yarrowpanicblock
to
kern.random.adaptors: yarrow,panic,block

6) add kern.random.active_adaptor to indicate currently selected
adaptor:
root@freebsd04:~ # sysctl kern.random.active_adaptor
kern.random.active_adaptor: yarrow

Submitted by:	Arthur Mesh <arthurmesh@gmail.com>
2013-08-24 13:54:56 +00:00
Mark Johnston
30e71983d0 Hold mfi_io_lock across calls to xpt_rescan() and xpt_alloc_ccb_nowait().
xpt_rescan() expects the SIM lock to be held, and we trip a mtx_assert if
the driver initiates multiple rescans in quick succession.

Reported by:	sbruno
Tested by:	sbruno
MFC after:	1 week
2013-08-23 22:55:52 +00:00
Bryan Venteicher
e3c97c2cc2 Add vmx(4), a VMware VMXNET3 ethernet driver ported from OpenBSD 2013-08-23 20:47:16 +00:00
Navdeep Parhar
bb6a76ed22 Whitespace cleanup. 2013-08-23 18:45:39 +00:00
Navdeep Parhar
aa9a5cc05a There is no need to hold the freelist lock around alloc/free of
software descriptors.  This also silences WITNESS warnings when
the software descriptors are allocated with M_WAITOK.

MFC after:	1 week
2013-08-23 18:03:18 +00:00
Ian Lepore
a6e2415cc4 Don't give up so easily on failure of CMD55 to put the card into app-cmd
mode.  We don't know why it failed, so we can't know that a retry will
also fail (the low-level driver might have reset the controller state
machine or something similar that would allow a retry to work).
2013-08-23 15:07:54 +00:00
Edward Tomasz Napierala
9732e4fd92 Move the old iSCSI initiator source to a more appropriate place
(sys/dev/iscsi_initiator/ instead of sys/dev/iscsi/initiator/), to make
room for the new one.  This is also more logical location (kernel module
being named iscsi_initiator.ko, for example).  There is no ongoing work
on this I know of, so it shouldn't make life harder for anyone.

There are no functional changes, apart from "svn mv" and adjusting paths.
2013-08-22 14:02:34 +00:00
Konstantin Belousov
5944de8ecd Remove the deprecated VM_ALLOC_RETRY flag for the vm_page_grab(9).
The flag was mandatory since r209792, where vm_page_grab(9) was
changed to only support the alloc retry semantic.

Suggested and reviewed by:	alc
Sponsored by:	The FreeBSD Foundation
2013-08-22 07:39:53 +00:00
Adrian Chadd
8e0cf70b5d Change the name of this particular event to reflect the name used in
Linux and Intel examples.

Sourced:

* https://github.com/andikleen/pmu-tools/blob/master/snb-client.csv
* http://software.intel.com/en-us/comment/1747932#comment-1747932

Note:

* It's not currently in the Intel SDM; I need to chase down what's
  going on.

Tested:

* Sandy Bridge
2013-08-21 21:47:56 +00:00
Kenneth D. Merry
ec99409e7e Fix mps(4) driver breakage that came in in change 253550 that
manifested itself in out of chain frame conditions.

When the driver ran out of chain frames, the request in question
would get completed early, and go through mpssas_scsiio_complete().

In mpssas_scsiio_complete(), the negation of the CAM status values
(CAM_STATUS_MASK | CAM_SIM_QUEUED) was ORed in instead of being
ANDed in.  This resulted in a bogus CAM CCB status value.  This
didn't show up in the non-error case, because the status was reset
to something valid (e.g. CAM_REQ_CMP) later on in the function.

But in the error case, such as when the driver ran out of chain
frames, the CAM_REQUEUE_REQ status was ORed in to the bogus status
value.  This led to the CAM transport layer repeatedly releasing
the SIM queue, because it though that the CAM_RELEASE_SIMQ flag had
been set.  The symptom was messages like this on the console when
INVARIANTS were enabled:

xpt_release_simq: requested 1 > present 0
xpt_release_simq: requested 1 > present 0
xpt_release_simq: requested 1 > present 0

mps_sas.c:	In mpssas_scsiio_complete(), use &= to take status
		bits out.  |= adds them in.

		In the error case in mpssas_scsiio_complete(), set
		the status to CAM_REQUEUE_REQ, don't OR it in.

MFC after:	3 days
Sponsored by:	Spectra Logic
2013-08-21 21:30:56 +00:00
Ian Lepore
aef60d8c4a Add support for uarts other than the serial console in TI OMAP SoCs.
The TI uart hardware is ns16550-compatible, except that before it can
be used the clocks and power have to be enabled and a non-standard
mode control register has to be set to put the device in uart mode
(as opposed to irDa or other serial protocols).  This adds the extra
code in an extension to the standard ns8250 probe routine, and the
rest of the driver is just the standard ns8250 code.
2013-08-21 14:33:02 +00:00
Ian Lepore
167cb33f85 Make the uart ns8250 high-level interface public rather than static.
This makes it easier to implement new drivers which are "mostly ns8250"
but with some small difference such as needing to enable clocks or poke
a non-standard register at probe or attach time.
2013-08-21 14:26:15 +00:00
Ian Lepore
6fd28cd9ff Use an if/else sequence rather than unrelated if statements, so that a
device compatible with multiple drivers matches the more specific driver
first and doesn't overwrite it later with the more generic.  Move the
generic ns16550 to the end of the list.
2013-08-21 04:08:58 +00:00
Ian Lepore
d081029a4f Check for generic ns16550 after all other types. A device may be compatible
with 16550 but also have a more specific/capable driver earlier in the list.
2013-08-21 04:05:06 +00:00
Navdeep Parhar
2485eeee37 Display P/N information in the description.
Submitted by:	gnn
MFC after:	3 days
2013-08-20 18:22:04 +00:00
Hans Petter Selasky
3a8f0c444a Force keyboards which don't have the required
HID fields to use the USB BOOT protocol for now.

PR:		usb/181425
Submitted by:	Andrey Zholos <aaz@q-fu.com>
MFC after:	4 weeks
2013-08-20 16:21:05 +00:00
Bjoern A. Zeeb
a66b2c65c3 Correct a typo in the event mask mnemonic.
Reviewed by:	gnn
MFC after:	3 days
2013-08-20 14:59:31 +00:00
Ian Lepore
59769a581f Make the standard sdhci(4) driver work for the TI OMAP family SoCs.
The MMCHS hardware is pretty much a standard SDHCI v2.0 controller with a
couple quirks, which are now supported by sdhci(4) as of r254507.

This should work for all TI SoCs that use the MMCHS hardware, but it has
only been tested on AM335x right now, so this enables it on those platforms
but leaves the existing ti_mmchs driver in place for other OMAP variants
until they can be tested.

This initial incarnation lacks DMA support (coming soon).  Even without it
this improves performance pretty noticibly over the ti_mmchs driver,
primarily because it now does multiblock IO.
2013-08-20 12:33:35 +00:00