Commit Graph

28303 Commits

Author SHA1 Message Date
Tijl Coosemans
0de6ac2e3c - agp_generic_unbind_memory: flush AGP TLB before unwiring pages
- agp_bind_pages: assert that pages have been wired down

MFC after:	1 month
2014-11-02 11:47:40 +00:00
Tijl Coosemans
a8ac51bbb6 In agp_amd_bind_page don't flush the AGP TLB. It's done by the calling
function.
2014-11-02 11:28:15 +00:00
Tijl Coosemans
4e612cddb9 In agp(4) avoid the need to flush all cpu caches with wbinvd between
updating the GTT and flushing the AGP TLB by storing the GTT in
write-combining memory.

On x86 flushing the AGP TLB is done by an I/O operation or a store to a
MMIO register in uncacheable memory.  Both cases imply that WC buffers are
flushed so no memory barriers are needed.

On powerpc there is no WC memory type.  It maps to uncacheable memory and
two stores to uncacheable memory, such as to the GTT and then to an MMIO
register, are strongly ordered, so no memory barriers are needed either.

MFC after:	1 month
2014-11-02 11:26:37 +00:00
Jean-Sébastien Pédron
6e2c3e8562 drm: Lower priority of two messages related to invalid EDID
Like in r259717, the prority goes from "error" to "debug" to avoid
spamming logs when the connectors are polled.

MFC after:	1 week
2014-11-02 09:52:22 +00:00
Dag-Erling Smørgrav
8c9ba8414c Restore the auto-reseed logic, but move it to a much later point,
immediately before kick_init.

Approved by:	so (self)
2014-11-02 02:01:55 +00:00
Mateusz Guzik
cdcf242896 Fix up module unload for syscall_module_handler consumers.
After r273707 it was registering syscalls as static.

This fixes hwpmc module unload.

Reported by: markj
2014-11-01 22:36:40 +00:00
Jean-Sébastien Pédron
da49f6bcc3 vt(4): Adjust the cursor position after changing the window size
A new terminal_set_cursor() is added: it wraps the existing
teken_set_cursor() function.

In vtbuf_grow(), the cursor position is adjusted at the end of the
function. In vt_change_font(), we call terminal_set_cursor() just after
terminal_set_winsize_blank(), while the terminal is mute.

This fixes a bug where, after loading a kernel video driver which
increases the terminal window size, the cursor remains at its old
position, in other words, in the middle of the display content.

PR:		194421
MFC after:	1 week
2014-11-01 17:05:15 +00:00
Luiz Otavio O Souza
409c183904 Fix the build of non-FDT systems by moving the gpiobusvar.h header outside
the FDT #ifdef.

While here remove a few unused headers.
2014-11-01 10:40:29 +00:00
Luiz Otavio O Souza
9d35acacd3 Fix the gpiobus locking by using a more sane model where it isn't necessary
hold the gpiobus lock between the gpio calls.

gpiobus_acquire_lock() now accepts a third parameter which tells gpiobus
what to do when the bus is already busy.

When GPIOBUS_WAIT wait is used, the calling thread will be put to sleep
until the bus became free.

With GPIOBUS_DONTWAIT the calling thread will receive EWOULDBLOCK right
away and then it can act upon.

This fixes the gpioiic(4) locking issues that arises when doing multiple
concurrent access on the bus.
2014-10-31 19:15:14 +00:00
Mark Murray
10cb24248a This is the much-discussed major upgrade to the random(4) device, known to you all as /dev/random.
This code has had an extensive rewrite and a good series of reviews, both by the author and other parties. This means a lot of code has been simplified. Pluggable structures for high-rate entropy generators are available, and it is most definitely not the case that /dev/random can be driven by only a hardware souce any more. This has been designed out of the device. Hardware sources are stirred into the CSPRNG (Yarrow, Fortuna) like any other entropy source. Pluggable modules may be written by third parties for additional sources.

The harvesting structures and consequently the locking have been simplified. Entropy harvesting is done in a more general way (the documentation for this will follow). There is some GREAT entropy to be had in the UMA allocator, but it is disabled for now as messing with that is likely to annoy many people.

The venerable (but effective) Yarrow algorithm, which is no longer supported by its authors now has an alternative, Fortuna. For now, Yarrow is retained as the default algorithm, but this may be changed using a kernel option. It is intended to make Fortuna the default algorithm for 11.0. Interested parties are encouraged to read ISBN 978-0-470-47424-2 "Cryptography Engineering" By Ferguson, Schneier and Kohno for Fortuna's gory details. Heck, read it anyway.

Many thanks to Arthur Mesh who did early grunt work, and who got caught in the crossfire rather more than he deserved to.

My thanks also to folks who helped me thresh this out on whiteboards and in the odd "Hallway track", or otherwise.

My Nomex pants are on. Let the feedback commence!

Reviewed by:	trasz,des(partial),imp(partial?),rwatson(partial?)
Approved by:	so(des)
2014-10-30 21:21:53 +00:00
Tijl Coosemans
cf99ea5d13 Avoid possible overflow in agp_generic_alloc_memory.
MFC after:	1 week
2014-10-30 14:36:27 +00:00
Tijl Coosemans
1f733a5646 Port the TTM AGP backend to the FreeBSD agp driver and enable AGP support
in the radeonkms driver.

Note: In PCI mode virtual addresses on the graphics card that map to system
RAM are translated to physical addresses by the graphics card itself.   In
AGP mode address translation is done by the AGP chipset so fictitious
addresses appear on the system bus.  For the CPU cache management to work
correctly when the CPU accesses this memory it needs to use the same
fictitious addresses (and let the chipset translate them) instead of using
the physical addresses directly.

Reviewed by:	kib
MFC after:	1 month
2014-10-30 14:26:36 +00:00
Tijl Coosemans
903fb143cf Add two new functions to the AGP driver KPI to bind/unbind arbitrary sets
of pages into the GTT.

Reviewed by:	kib
MFC after:	1 month
2014-10-30 11:27:03 +00:00
John-Mark Gurney
d14c434667 make this compile on arm... bus_size_t is not size_t, and it has
different sizes on different arches...
2014-10-29 02:23:50 +00:00
Navdeep Parhar
527e4e62ac Always request a completion for every work request for iWARP. The
initial MPA exchange must be tracked this way so that t4_tom's state for
the tid is all clean at the time the tid transitions to RDMA mode.  Once
it does, t4_tom is out of the way and iw_cxgbe uses the qp endpoints
directly.

Sponsored by:	Chelsio Communications
2014-10-28 18:10:57 +00:00
Hans Petter Selasky
0e1152fcc2 The SYSCTL data pointers can come from userspace and must not be
directly accessed. Although this will work on some platforms, it can
throw an exception if the pointer is invalid and then panic the kernel.

Add a missing SYSCTL_IN() of "SCTP_BASE_STATS" structure.

MFC after:	3 days
Sponsored by:	Mellanox Technologies
2014-10-28 12:00:39 +00:00
Marcelo Araujo
3bde81092c Drop __DECONST as well as few fixes of style(9).
Phabric:	D1012
Suggested by:	mjg, jhb
Reviewed by:	mjg, jhb
Sponsored by:	QNAP Systems Inc.
2014-10-28 03:42:09 +00:00
Navdeep Parhar
3030c8bce9 iwcm_event status needs to be populated for close_complete_upcall
Submitted by:	Hariprasad at Chelsio dot com
Sponsored by:	Chelsio Communications
2014-10-27 23:11:48 +00:00
Navdeep Parhar
d25d06afc0 Some cxgbe/iw_cxgbe fixes:
- Free rt in c4iw_connect only if it is allocated.
- Call soclose instead of so_shutdown if there is an abort from the peer.
- Close socket and return failure if TOE is not enabled.

Submitted by:	Hariprasad at Chelsio dot com
Sponsored by:	Chelsio Communications
2014-10-27 22:22:46 +00:00
Konstantin Belousov
9247911a58 Add a method to iicbus to request IIC_M_NOSTOP behaviour for multibyte
transfers to be default.  It simplifies porting code which assumes
such settings.

Discussed with:	avg, llos, nwhitehorn
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2014-10-27 07:51:26 +00:00
Konstantin Belousov
3f6732e8e0 Set the caching mode for the usermode mapping of the HPET registers
page to uncached.

Reviewed by:	rpaulo
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2014-10-25 21:01:50 +00:00
Navdeep Parhar
1284501329 cxgbe(4): bump up PF4's share of some global resources.
This increases the size of the per-port RSS slice and also allows the
driver to use a larger number of tx and rx queues.

MFC after:	2 weeks
2014-10-25 00:14:44 +00:00
Rui Paulo
f53389946d Add a sysctl to control the HPET allow_write behaviour.
Requested by:	kib
2014-10-24 21:08:36 +00:00
Rui Paulo
86b19a6984 HPET: avoid handling the multiple file-descriptor case.
It had two bugs: one where mmap was still allowed and another where
D_TRACKCLOSE doesn't handle all cases.

Thanks to jhb and kib for pointing them out.
MFC after:	1 week
2014-10-24 19:58:00 +00:00
Rui Paulo
3149cc9df6 HPET: create /dev/hpetN as a way to access HPET from userland.
In some cases, TSC is broken and special applications might benefit
from memory mapping HPET and reading the registers to count time.
Most often the main HPET counter is 32-bit only[1], so this only gives
the application a 300 second window based on the default HPET
interval.
Other applications, such as Intel's DPDK, expect /dev/hpet to be
present and use it to count time as well.

Although we have an almost userland version of gettimeofday() which
uses rdtsc in userland, it's not always possible to use it, depending
on how broken the multi-socket hardware is.

Install the acpi_hpet.h so that applications can use the HPET register
definitions.

[1] I haven't found a system where HPET's main counter uses more than
32 bit.  There seems to be a discrepancy in the Intel documentation
(claiming it's a 64-bit counter) and the actual implementation (a
32-bit counter in a 64-bit memory area).

MFC after:	1 week
Relnotes:	yes
2014-10-24 18:39:15 +00:00
Kevin Lo
66fef59616 Add D-Link DWA-123 rev D1 and Elecom WDC-150SU2M. 2014-10-24 15:36:30 +00:00
Xin LI
20e27addbf Return BUS_PROBE_DEFAULT instead of BUS_PROBE_VENDOR or 0 for in-tree
driver.  This change was verified by Microsoft.
2014-10-24 06:27:45 +00:00
Marcelo Araujo
f695e0468c Fix a leaked Storage Variable.
Phabric:	D981
Submitted by:	myself
Reported by:	Coverity
CID:		1248848
Reworked by:	kevlo
Reviewed by:	marcel, davide, ray, kevlo
Approved by:	marcel, kevlo
2014-10-24 05:39:32 +00:00
Luiz Otavio O Souza
88516632a7 Move the duplicated code to a single function.
No functional changes.
2014-10-23 23:20:04 +00:00
Luiz Otavio O Souza
b09d4398fa Provide a working GPIOBUS_IVAR() macro for FDT systems. 2014-10-23 23:12:30 +00:00
Rui Paulo
bdb4291f89 puc(4): add an entry for the Oxford Semiconductor OXPCIe952 1S1P card.
Submitted by:	Alex Burlyga <alex.burlyga.ietf at gmail.com>
MFC after:	1 week
2014-10-23 18:03:27 +00:00
Luiz Otavio O Souza
381fd7619b Fix a bug where some DTS layouts could cause the premature ending of the
search (i.e. without returning any result) and you would end up with a
random MAC address.

Change the search algorithm to a recursive one to ensure that all the nodes
on DTS will be verified.

The previous algorithm could not keep up if the DTS has too many sub-nodes.

While here, fix the punctuation on comments.
2014-10-23 13:47:19 +00:00
Jean-Sébastien Pédron
069f1c256a vt(4): Add PIO_VFONT_DEFAULT ioctl to restore the default builtin font
To restore the default font using vidcontrol(1), use the "-f" flag
without an argument:
    vidcontrol -f < /dev/ttyv0

PR:		193910
Differential Revision:	https://reviews.freebsd.org/D971
Submitted by:	Marcin Cieslak <saper@saper.info>
Reviewed by:	ray@, emaste@
Approved by:	ray@
MFC after:	1 week
2014-10-23 12:38:05 +00:00
Bryan Venteicher
6f744ddee4 Add VirtIO console driver
Support for the multiport feature is mostly implemented, but currently
disabled due to some potential races in the hot plug code paths.

Requested by:	marcel
MFC after:	1 month
Relnotes:	yes
2014-10-23 04:47:32 +00:00
Navdeep Parhar
53f49a7bd8 cxgbe/iw_cxgbe: wake up waiters after flushing the qp.
Obtained from:	Chelsio
2014-10-22 18:55:44 +00:00
Roger Pau Monné
ddcc16cf2f netback: change xnb naming convention
Current FreeBSD netback names the interface with xnb<device unit>, but
this is not suitable for usage with the Xen toolstack, which expects
something similar to <prefix><domid><handle>. In order to solve this,
change the netback naming convention to use xnb<domid>.<handle>.

Sponsored by: Citrix Systems R&D

dev/xen/netback/netback.c:
 - Change netback to use the nomenclature stated above.
2014-10-22 17:09:12 +00:00
Roger Pau Monné
bf7313e3b7 xen: implement the privcmd user-space device
This device is only attached to priviledged domains, and allows the
toolstack to interact with Xen. The two functions of the privcmd
interface is to allow the execution of hypercalls from user-space, and
the mapping of foreign domain memory.

Sponsored by: Citrix Systems R&D

i386/include/xen/hypercall.h:
amd64/include/xen/hypercall.h:
 - Introduce a function to make generic hypercalls into Xen.

xen/interface/xen.h:
xen/interface/memory.h:
 - Import the new hypercall XENMEM_add_to_physmap_range used by
   auto-translated guests to map memory from foreign domains.

dev/xen/privcmd/privcmd.c:
 - This device has the following functions:
   - Allow user-space applications to make hypercalls into Xen.
   - Allow user-space applications to map memory from foreign domains,
     this is accomplished using the newly introduced hypercall
     (XENMEM_add_to_physmap_range).

xen/privcmd.h:
 - Public ioctl interface for the privcmd device.

x86/xen/hvm.c:
 - Remove declaration of hypercall_page, now it's declared in
   hypercall.h.

conf/files:
 - Add the privcmd device to the build process.
2014-10-22 17:07:20 +00:00
Roger Pau Monné
5779d8ad57 xen: import a proper event channel user-space device
The user-space event channel device is used by applications to receive
and send event channel interrupts. This device is based on the Linux
evtchn device.

Sponsored by: Citrix Systems R&D

xen/evtchn/evtchn_dev.c:
 - Remove the old event channel device, which was already disabled in
   the build system.

dev/xen/evtchn/evtchn_dev.c:
 - Import a new event channel device based on the one present in
   Linux.
 - This device allows the following operations:
   - Bind VIRQ event channels (ioctl).
   - Bind regular event channels (ioctl).
   - Create and bind new event channels (ioctl).
   - Unbind event channels (ioctl).
   - Send notifications to event channels (ioctl).
   - Reset the device shared memory ring (ioctl).
   - Unmask event channels (write).
   - Receive event channel upcalls (read).
 - The new code is MP safe, and can be used concurrently.

conf/files:
 - Add the new device to the build system.
2014-10-22 16:57:11 +00:00
Ruslan Bukin
2d3f1b38a9 Provide a character device allowing us to access BERI memory regions.
Sponsored by:	DARPA, AFRL
2014-10-22 11:30:03 +00:00
Hans Petter Selasky
c61ee529ff Actually change the USB_PORT_ROOT_RESET_DELAY definition as stated in
the r241987 commit message, instead of having users locally overriding
the value using tunables in /boot/loader.conf .

Found by:	Adam Parco
Discussed with:	Nick Hibma
2014-10-22 07:50:19 +00:00
Kevin Lo
b1c5d8f7c3 Fix the kernel panic in hostap mode.
rvp->beacon_mbuf was NULL in run_update_beacon().

PR:	189405
Submitted by:	Gabor Simon <gabor.simon75 at gmail.com>
MFC after:	3 days
2014-10-22 03:32:27 +00:00
Glen Barber
c379cfaf3c Fix an issue where a FreeBSD virtual machine provisioned in
the Microsoft Azure service does not recognize the second
attached disk on the system.

Submitted by:	kyliel@Microsoft
Patched by:	weh@Microsoft
PR:		194376
MFC after:	3 days
X-MFC-10.1:	yes, ASAP
Sponsored by:	The FreeBSD Foundation
2014-10-21 19:36:20 +00:00
Jim Harris
83a4c3f99e ixl: remove i40e_register_x710_int.h
This file is not used by the FreeBSD ixl driver.

Submitted by:	Eric Joyner <eric.joyner@intel.com>
MFC after:	3 days
2014-10-21 18:00:56 +00:00
Ruslan Bukin
8b62915e24 Add driver for Micrel KSZ9021 Gigabit Ethernet Transceiver (PHY).
Sponsored by:	DARPA, AFRL
2014-10-21 09:14:16 +00:00
Hans Petter Selasky
f0188618f2 Fix multiple incorrect SYSCTL arguments in the kernel:
- Wrong integer type was specified.

- Wrong or missing "access" specifier. The "access" specifier
sometimes included the SYSCTL type, which it should not, except for
procedural SYSCTL nodes.

- Logical OR where binary OR was expected.

- Properly assert the "access" argument passed to all SYSCTL macros,
using the CTASSERT macro. This applies to both static- and dynamically
created SYSCTLs.

- Properly assert the the data type for both static and dynamic
SYSCTLs. In the case of static SYSCTLs we only assert that the data
pointed to by the SYSCTL data pointer has the correct size, hence
there is no easy way to assert types in the C language outside a
C-function.

- Rewrote some code which doesn't pass a constant "access" specifier
when creating dynamic SYSCTL nodes, which is now a requirement.

- Updated "EXAMPLES" section in SYSCTL manual page.

MFC after:	3 days
Sponsored by:	Mellanox Technologies
2014-10-21 07:31:21 +00:00
Kevin Lo
7eb884645c Add the Intel BayTrail USB device which needs port routing for USB 3.0.
Tested on the BayTrail E3845 platform.
Reviewed by:	hselasky
2014-10-21 07:24:58 +00:00
Pyun YongHyeon
b8333e4546 It seems multicast filtering of RTL8168F does not work. Workaround
the silicon bug by accepting any multicast packets.

PR:	193488
MFC After:	1 week
2014-10-21 01:31:24 +00:00
Jean-Sébastien Pédron
2113857ae0 vt(4): Refuse to load a font if hw.vga.textmode is selected
Before, the font was loaded and the window size recalculated, giving an
unusable terminal, even if the actual font didn't change.

Reported by:	beeessdee@ruggedinbox.com
MFC after:	3 days
2014-10-20 14:25:23 +00:00
Alexander Motin
7bac11c78c Add another PCI ID for JMB368 PATA controller.
MFC after:	1 week
2014-10-20 13:18:52 +00:00
Ian Lepore
2a74fe2c96 Fail to probe on simplebus nodes that lack a "ranges" property.
Increasingly, FDT data has the "simple-bus" compatible string on nodes
that have children, but we wouldn't consider them to be busses.  If the
node lacks a ranges property then we will fail to attach successfully,
so fail to probe as well.
2014-10-19 18:31:11 +00:00
Navdeep Parhar
bb1800f1fa cxgb(4): reset the PHY if it generates an interrupt for no apparent reason.
MFC after:	1 week
2014-10-19 17:29:44 +00:00
Ruslan Bukin
b0da449e60 Add driver for BERI soft processor 'ring buffer' device.
Ring device provides a way for communicate to BERI
peripherals such as BERI debug unit and console.

Sponsored by:	DARPA, AFRL
2014-10-19 16:26:49 +00:00
Hans Petter Selasky
e17bdf9f1b Add support for new USB 3G device.
Submitted by:	gabor@zahemszky.hu
MFC after:	1 week
2014-10-18 15:11:13 +00:00
Mark Johnston
06796b6791 Use pmc_destroy_pmc_descriptor() to actually free the pmc, which is
consistent with pmc_destroy_owner_descriptor(). Also be sure to destroy
PMCs if a process exits or execs without explicitly releasing them.

Reviewed by:	bz, gnn
MFC after:	2 weeks
Sponsored by:	EMC / Isilon Storage Division
Differential Revision: https://reviews.freebsd.org/D958
2014-10-17 19:04:24 +00:00
Davide Italiano
d9ca757cea Convert remaining {g,s}etenv->kern_{g,s}etenv
left over from r273174.

Reported by:    bz
2014-10-17 17:34:05 +00:00
Ed Maste
0e53ac55b7 Do nothing in vt_upgrade if there is no vt driver
Previously, if no drivers attached at boot we would panic with
"vtbuf_fill_locked begin.tp_row 0 must be < screen height 0".

PR:		192248
Reviewed by:	ray
MFC after:	3 days
Sponsored by:	DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D954
2014-10-17 13:55:45 +00:00
Hans Petter Selasky
d60bfba9d6 Add support for new USB 3G device.
Submitted by:	gabor@zahemszky.hu
MFC after:	1 week
2014-10-17 13:40:17 +00:00
Joerg Wunsch
374e43f2e3 Add the Dresden Elektronik deRFnode device to uftdi(4).
MFC after:	1 week
2014-10-16 19:53:32 +00:00
Warner Losh
a5928b20d5 fwsectors and fwheads used to be somehwat arbitrary. However, they are
used to align partitions in gpart. We also try to align partitions by
stripe size when creating new media. Align these two concepts by
making fwsectors the same as the stripe size. Select a sensible number
of heads so we wind up with about 20 cylinders. This number was
selected to keep the rounding effects to a few percent while keeping
the number of cylinder groups low.

Sadly, it is not possible to make these numbers match the numbers used
by SD card readers. There apperas to be much variation between brands
so there's no one universal number. These numbers are also not aligned
to the stripe size, so some performance problems may still be present
when SD cards are created this way.

Also, these numbers will differ from the far less common SD to ATA
adapters, which present a different, but more uniform, set of numbers
that also happened to match the old defaults.

Nothing should change for current users. Any suboptimal performance
caused by misalignment will still be there. gpart will honor the
partitions that aren't on proper boudnaries, but editing the partition
tables may result in different alignments being used than before when
editing things natively.

Ideally, there'd be some way to override these values in the disk
subsystem by the user for the USB adapter use case where all "native"
notions of geometry disappear. This does not implement that.
2014-10-16 19:52:12 +00:00
Davide Italiano
2be111bf7d Follow up to r225617. In order to maximize the re-usability of kernel code
in userland rename in-kernel getenv()/setenv() to kern_setenv()/kern_getenv().
This fixes a namespace collision with libc symbols.

Submitted by:   kmacy
Tested by:      make universe
2014-10-16 18:04:43 +00:00
Edward Tomasz Napierala
6cc1e267f3 When removing an iSCSI session, check whether all conditions match,
not if any of them matches.  This fixes "iscsictl -Rn" removing
unrelated sessions.

PR:		194034
MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
2014-10-16 09:09:43 +00:00
Justin Hibbits
e9152038d3 Move the adm1030 driver to the proper location, and rename it.
For compatibility, 'device windtunnel' is still supported, but one should use
'device adm1030' instead, and this has been updated in GENERIC and NOTES.
2014-10-16 01:32:22 +00:00
Hans Petter Selasky
2c6eb461a7 Update the OFED Linux compatibility layer and
Mellanox hardware driver(s):

- Properly name an inclusion guard
- Fix compile warnings regarding unsigned enums
- Add two new sysctl nodes
- Remove all empty linux header files
- Make an error printout more verbose
- Use "mod_delayed_work()" instead of
  cancelling and starting a timeout.
- Implement more Linux scatterlist
  functions.

MFC after:	3 days
Sponsored by:	Mellanox Technologies
2014-10-15 13:40:29 +00:00
Adrian Chadd
bba61d1a89 Set the DROP_EN bit before the RX queue is brought up and active.
He noticed issues setting this bit in SRRCTL after the queue was up,
so doing it from the sysctl handler isn't enough and may not actually
work correctly.

This commit doesn't remove the sysctl path or try to change its
behaviour.  I'll talk with others about how to finish fixing that
before I tackle that.

PR:		kern/194311
Submitted by:	luigi
MFC after:	3 days
Sponsored by:	Norse Corp, Inc
2014-10-15 01:22:56 +00:00
Warner Losh
756906b40e Use the C99 flexible array construct to denote a variable amount of
data rather than the old-school [1] construct. We have required c99
compilers for some time.
2014-10-13 16:23:58 +00:00
Warner Losh
5df0ffc762 class, subclass and progif were never used, so don't bother setting
them.
2014-10-13 16:23:51 +00:00
Kashyap D Desai
f5fb223710 Fix for build issue on i386.xen and amd64.xen.
This is a duplicate variable reference in mrsas, so now this patch isolate atomic_ variable and relavent
function call using prefix mrsas_xx.

Issue was introduced in r272737.

MFC after:	2 weeks
Sponsored by:	Avago Technology
2014-10-13 15:33:27 +00:00
Christian Brueffer
9bfafa1055 Add one more AMD Kaveri APU device ID.
Submitted by:	Remy Nonnenmacher <remy.nonnenmacher@activnetworks.com>
MFC after:	1 week
2014-10-13 13:13:42 +00:00
Robert Watson
6ad1954bcb Eliminate unnecessary checking for M_EXT on mbufs returned by m_getjcl().
Reviewed by:	bz, glebius, yongari
MFC after:	3 days
Sponsored by:	EMC / Isilon Storage Division
Differential Revision:	https://reviews.freebsd.org/D938
2014-10-13 06:51:40 +00:00
Navdeep Parhar
3f52cae506 Make sure correct object code is generated at -O0.
Submitted by:	grehan@
Approved by:	so@ (des)
MFC after:	1 month
2014-10-13 06:50:08 +00:00
Pyun YongHyeon
416f6852e3 Remove ALC_LOCK_ASSERT in alc_stop_queue(). This function is now
called in device attach without holding a driver lock so it
resulted in panic.

Reported by:	markj
2014-10-13 01:06:40 +00:00
Justin Hibbits
6ab4d70393 Check error return from reading integer part of temperature.
There's a very remote, but possible, chance that the integer part read will
fail, but the fraction read succeeds, at which point the reported temperature is
invalid.

Reported by: Matthew Rezny
MFC after:	3 weeks
2014-10-12 23:48:55 +00:00
Ian Lepore
0dc54d18b2 Use the FIFOs in the imx5/imx6 uart hardware instead of interrupting on
each byte sent or received.
2014-10-12 17:56:02 +00:00
John Baldwin
d0d8c133c7 Add locking and mark MPSAFE.
- Add a mutex to protect the softc.
- Use callout(9) instead of timeout(9).
- Consolidate duplicated detach routines into a bus-independent detach
  routine.
- Add an extra sleep lock flag (MSESC_READING) to prevent other readers
  from reading while the first reader is copying data out of sc_bytes[]
  via uiomove().
- Use bus_*() instead of bus_space_*().

Tested by:	nyan
2014-10-11 19:36:59 +00:00
Alexander Motin
bb829be508 Fix r272936 build with old GCC.
MFC after:	1 week
2014-10-11 08:50:19 +00:00
Alexander Motin
829485ba7e Update isp_tgt_map and send new arrival notification if target that departed
earlier has returned.  Previously that code worked only once, confusing CTL.

MFC after:	1 month
2014-10-11 07:59:15 +00:00
John Baldwin
97dc3d98cb Don't pass RF_ALLOCATED to bus_alloc_resource(). 2014-10-10 19:12:04 +00:00
John Baldwin
8423f42aa8 Various fixes to stats:
- Read the counts of received, dropped, and transmitted management
  packets and add sysctl nodes for them.
- Fix the total octets received/transmitted to read all 64 bits of
  the counters.
- Add missing sysctl nodes for rlec, tncrs, fcruc, tor, and tot.
- Remove spurious spaces.

Reviewed by:	Eric Joyner @ Intel
MFC after:	1 week
2014-10-10 16:36:25 +00:00
Baptiste Daroussin
277c7d7b98 Use FreeBSD-bit-checking-style
This appease gcc 4.9 issuing warnings about parentheses

Differential Revision:	https://reviews.freebsd.org/D933
Reviewed by:	marius
2014-10-10 14:17:42 +00:00
Hans Petter Selasky
77d68af5df Add sysctl knob to disable port power on a specific USB HUB. You need
to reset the USB HUB using "usbconfig -d X.Y reset" or boot having the
setting in /boot/loader.conf before it activates.
2014-10-09 14:43:43 +00:00
Alexander Motin
259f12da87 Make iSCSI connection close somewhat less aggressive.
It allows to push out some final data from the send queue to the socket
before its close.  In particular, it increases chances for logout response
to be delivered to the initiator.
2014-10-09 09:12:08 +00:00
Hans Petter Selasky
f80ccb40c7 Refine support for disabling USB enumeration to allow device detach
and suspend and resume of existing devices.

MFC after:	2 weeks
2014-10-09 06:24:06 +00:00
Adrian Chadd
ffcf962dab Add a bus method to fetch the VM domain for the given device/bus.
* Add a bus_if.m method - get_domain() - returning the VM domain or
  ENOENT if the device isn't in a VM domain;
* Add bus methods to print out the domain of the device if appropriate;
* Add code in srat.c to save the PXM -> VM domain mapping that's done and
  expose a function to translate VM domain -> PXM;
* Add ACPI and ACPI PCI methods to check if the bus has a _PXM attribute
  and if so map it to the VM domain;
* (.. yes, this works recursively.)
* Have the pci bus glue print out the device VM domain if present.

Note: this is just the plumbing to start enumerating information -
it doesn't at all modify behaviour.

Differential Revision:	D906
Reviewed by:	jhb
Sponsored by:	Norse Corp
2014-10-09 05:33:25 +00:00
Alexander Motin
3b4ae4621f Remove one second wait for threads exit from icl_conn_close().
Switch it from polling with pause() to using cv_wait()/cv_signal().
2014-10-08 19:54:42 +00:00
Gavin Atkinson
c5dcd62615 It looks like an entry for the R215 is not required in cdce(4) after all. 2014-10-08 19:49:10 +00:00
Konstantin Belousov
07a92f34d6 Add an argument to the x86 pmap_invalidate_cache_range() to request
forced invalidation of the cache range regardless of the presence of
self-snoop feature.  Some recent Intel GPUs in some modes are not
coherent, and dirty lines in CPU cache must be flushed before the
pages are transferred to GPU domain.

Reviewed by:	alc (previous version)
Tested by:	pho (amd64)
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2014-10-08 16:48:03 +00:00
Alexander Motin
82315915e0 Properly report 12Gbps connection rate.
Reviewed by:	kadesai, slm
MFC after:	1 week
2014-10-08 16:22:26 +00:00
Kashyap D Desai
8e72737119 No logical code change in this pathc.
Only Style 9 changes for mrsas driver.

Reviewed by:	ambrisko
MFC after:	2 weeks
Sponsored by:	AVAGO Technologies
2014-10-08 10:14:37 +00:00
Kashyap D Desai
7efff25b10 Driver version upgrade.
Bring head mrsas same as internal Phase 6.5.

Reviewed by:	ambrisko
MFC after:	2 weeks
Sponsored by:	AVAGO Technologies
2014-10-08 09:39:18 +00:00
Kashyap D Desai
839ee02531 In the passthru IOCTL path, the mfi command pool was freely accessible N times
where as there are limited number(32) of mfi commands in the pool.
The mfi command pool is now restricted to 27 simultaneous accesses by using
a counting semaphore while calling the passthru function.

In the mrsas_cam.c source file there was a same function name mrsas_poll(),
which was same as the mrsas_poll() implemented in the mrsas.c file for the
polling interface.
To clearly distinguish the functionality by usage we have renamed the former
as mrsas_cam_poll().

In the passthru function let's say it has got an mfi command from the pool
but it has failed in one of the DMA function call which will lead to leak
an mfi command because in the ERROR case it directly returns and not freeing up
the occupied mfi command.

Reviewed by:	ambrisko
MFC after:	2 weeks
Sponsored by:	AVAGO Technologies
2014-10-08 09:37:47 +00:00
Kashyap D Desai
da01111344 d_poll() callback function is the entry point for poll system call for the application.
It is meant to notify the applications which will be waiting for some
controller events to be occured.

Reviewed by:	ambrisko
MFC after:	2 weeks
Sponsored by:	AVAGO Technologies
2014-10-08 09:35:52 +00:00
Kashyap D Desai
d18d1b472d Extended MSI-x vectors support for Invader and Fury(12Gb/s HBA).
This Driver will create multiple MSI-x vector depending upon what FW expose.
As of now 12 Gbp/s MR controller (Invader and Fury) expose 96 msix vector.
As of now 6 Gbp/s MR controller (Thunderbolt) expose 16 msix vector.

Reviewed by:	ambrisko
MFC after:		2 weeks
Sponsored by:	AVAGO Technologies
2014-10-08 09:34:25 +00:00
Kashyap D Desai
90012054d6 Fix the minor svn add issue. $FreeBSD$ expands at the time of
snv add, so I have added $FreeBSD$ as comment.

This commit is contininous of last mrsas commit, so that compilation
does not break.

Obtained from:	AVAGO Technologies
MFC after: 2 weeks
2014-10-08 09:30:35 +00:00
Kashyap D Desai
536094dc79 This is a feature provided to run 32-bit linux binaries on FreeBSD 64bit
machine, for which 32bit compatibilty code has been added.
As in linux there is only one device entry that is used to fire IOCTL commands,
a new device entry megaraid_sas_ioctl_node is added for solely this
purpose.

From one dev node i.e mrgaraid_sa_ioctl_node we have to find out the
controller instance in case of multicontroller, for which one management info
structure has been added.

Reviewed by:	ambrisko
MFC after:		2 weeks
Sponsored by:	AVAGO Technologies
2014-10-08 09:19:35 +00:00
Ruslan Bukin
fdbf76c383 Always wait 'command done' interrupt status bit before proceeding next command.
Sponsored by:	DARPA, AFRL
2014-10-08 08:51:05 +00:00
Kashyap D Desai
4799d48568 Current MegaRAID firmware and hence the driver only supported 64VDs.
E.g: If the user wants to create more than 64VD on a controller,
    it is not possible on current firmware/driver.

New feature and requirement to support upto 256VD, firmware/driver/apps need changes.
In addition to that, there must be a backward compatibility of the new driver with the
older firmware and vice versa.

RAID map is the interface between Driver and FW to fetch all required
fields(attributes) for each Virtual Drives.
In the earlier design driver was using the FW copy of RAID map where as
in the new design the Driver will keep the RAID map copy of its own; on which
it will operate for any raid map access in fast path.

Local driver raid map copy will provide ease of access through out the code
and provide generic interface for future FW raid map changes.

For the backward compatibility driver will notify FW that it supports 256VD
to the FW in driver capability field.
Based on the controller properly returned by the FW, the Driver will know
whether it supports 256VD or not and will copy the RAID map accordingly.

At any given time, driver will always have old or new Raid map.

Reviewed by	:	ambrisko
MFC after	:	2 weeks
Sponsored by:	AVAGO Technologies
2014-10-08 08:48:18 +00:00
Hans Petter Selasky
c38aa2537b Add support for disabling USB enumeration in general or on selected
USB HUBs.

MFC after:	2 weeks
2014-10-08 07:00:50 +00:00
Pyun YongHyeon
dd6d49aad2 Oops, fix typo made in r272729. 2014-10-08 05:53:04 +00:00
Pyun YongHyeon
b624ef0a8e Add support for QAC AR816x/AR817x Gigabit/Fast Ethernet controllers.
These controllers seem to have the same feature of AR813x/AR815x and
improved RSS support(4 TX queues and 8 RX queues).  alc(4) supports
all hardware features except RSS.  I didn't implement RX checksum
offloading for AR816x/AR817x just because I couldn't get
confirmation from the Vendor whether AR816x/AR817x corrected its
predecessor's RX checksum offloading bug on fragmented packets.
This change adds supports for the following controllers.
 o AR8161 PCIe Gigabit Ethernet controller
 o AR8162 PCIe Fast Ethernet controller
 o AR8171 PCIe Gigabit Ethernet controller
 o AR8172 PCIe Fast Ethernet controller
 o Killer E2200 Gigabit Ethernet controller

Tested by:	Many
Relnotes:	yes
MFC after:	2 weeks
HW donated by:	Qualcomm Atheros Communications, Inc.
2014-10-08 05:47:01 +00:00
Pyun YongHyeon
b19487dff8 Add new quirk PCI_QUIRK_MSI_INTX_BUG to pci(4).
QAC AR816x/E2200 controller has a silicon bug that MSI interrupt
does not assert if PCIM_CMD_INTxDIS bit of command register is set.

Reviewed by:	jhb
2014-10-08 05:34:39 +00:00
Pyun YongHyeon
0999f75a2f Fix a long standing bug in MAC statistics register access. One
additional register was erroneously added in the MAC register set
such that 7 TX statistics counters were wrong.
2014-10-08 01:03:32 +00:00
Navdeep Parhar
19abdd0654 cxgbe/tom: don't leak resources tied to an active open request that
cannot be sent to the chip because a prerequisite L2 resolution
failed.

Submitted by:	Hariprasad at chelsio dot com (original version)
MFC after:	2 weeks.
2014-10-07 21:26:22 +00:00
Gavin Atkinson
4c62148d7b Support the Vodafone R215 LET USB dongle, which is apparently a rebadged
E5372 with different product IDs.

Interestingly, the standard E5372 IDs (12d1:1506) are currently listed in
u3g.c and are the same as the E3131.  However, the R215/E5372 is an NCM
device and works well with cdce(4) whereas the E3131 isn't.  More work
may be needed to better identify the other device IDs.

MFC after:	1 week
2014-10-07 19:07:50 +00:00
Aleksandr Rybalko
c32f462f28 Allow vt(4) to disable terminal bell with sysctl kern.vt.bell_enable=0,
similar as syscons(4) do.

Submitted by:	Tiwei Bie <btw@mail.ustc.edu.cn>
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
2014-10-07 18:47:53 +00:00
Bjoern A. Zeeb
c896236487 Since introducing the extra mapping in r250103 for architectural performance
events we have actually counted 'Branch Instruction Retired' when people
asked for 'Unhalted core cycles' using the 'unhalted-core-cycles' event mask
mnemonic.

Reviewed by:	jimharris
Discussed with:	gnn, rwatson
MFC after:	3 days
Sponsored by:	DARPA/AFRL
2014-10-07 18:00:34 +00:00
Ruslan Bukin
41709d23c4 Add driver for Synopsys DesignWare Mobile Storage Host Controller.
Sponsored by:	DARPA, AFRL
2014-10-07 17:39:30 +00:00
Alexander Motin
88971a900d Use r271207 optimization only for MSI-enabled HBAs.
It was found that VirtualBox' AHCI does not allow nterrupt to be cleared
before the interrupt status register is read, causing interrupt storm.

AHCI specification allows to skip this register use when multi-vector MSI
is enabled and so interrupting port is known.  For single-vector MSI that
is not stated explicitly, but if the port is only one, it is obviously
known too.
2014-10-06 10:58:54 +00:00
Ganbold Tsagaankhuu
7f29c69aee Use documented compat string for msm uart.
Whilst here use tab instead of spaces.

Approved by:    stas (mentor)
2014-10-06 09:00:53 +00:00
Jean-Sébastien Pédron
0d06446812 vt(4): Don't recalculate buffer size if we don't know screen size
When the screen size is unknown, it's set to 0x0. We can't use that as
the buffer size, otherwise, functions such as vtbuf_fill() will fail.

This fixes a panic on RaspberryPi, where there's no vt(4) backend
configured early in boot.

PR:		193981
Tested by:	danilo@
MFC after:	3 days
2014-10-04 18:40:40 +00:00
Hans Petter Selasky
b06d477b3c When we fail to get a USB reference we should just return, because
there are no more references held.

MFC after:	3 days
2014-10-03 16:09:46 +00:00
Hans Petter Selasky
30c6f4bac5 Fix XHCI driver for devices which have more than 15 physical root HUB
ports. The current bitmap array was too small to hold more than 16
bits and would at some point toggle the context size, which then would
trigger an enumeration fault and cause a fallback to the EHCI
companion controller, if any.

MFC after:	3 days
2014-10-03 15:58:04 +00:00
George V. Neville-Neil
974577b5cd Fixup the setting of the baud rate. 2014-10-02 22:05:48 +00:00
Jung-uk Kim
313a0c13ef Merge ACPICA 20140926. 2014-10-02 19:11:18 +00:00
Hans Petter Selasky
8b0569ba8f Make sure we always set the maximum number of valid contexts.
MFC after:	3 days
2014-10-02 16:56:00 +00:00
Jean-Sébastien Pédron
61220c0d64 vt(4): Save/restore keyboard mode & LED states when switching window
Add new functions to manipulate these mode & state, instead of calling
kbdd_ioctl() everyhere.

This fixes at least two bugs:

    1. The state of the Scroll Lock LED and the state of scroll mode
       could be out-of-sync. For instance, if one enables scroll mode on
       window #1 and switches to window #2, the LED would remain on, but
       the window wouldn't be in scroll mode.

       Similarily, when switching between a console and an X.Org
       session, the LED states could be inconsistent with the real
       state.

    2. When exiting from an X.Org session, the user could be unable to
       type anything. The workaround was to switch to another console
       window and come back.

Differential Revision:	https://reviews.freebsd.org/D821
Reviewed by:	ray@
Approved by:	ray@
Tested by:	kwm@
MFC after:	3 days
2014-10-02 16:36:37 +00:00
George V. Neville-Neil
f857a2b4a0 Properly handle a case that should never happen (the bus_dma
callback being called with error set to non-zero).
2014-10-02 15:03:51 +00:00
Hans Petter Selasky
e8fa59aa5e Add new USB ID.
PR:		194091
MFC after:	3 days
2014-10-02 12:27:41 +00:00
Ganbold Tsagaankhuu
dc7717a863 Add uart driver for Qualcomm MSM 7000/8000 series chips.
It is working on IFC6410 board which has Qualcomm Snapdragon SoC.

Approved by:    stas (mentor)
2014-10-02 08:12:42 +00:00
Will Andrews
bb6b32dd81 Add sysctl to track the resource consumption of ACPI interrupts.
Submitted by:	gibbs
MFC after:	1 month
Sponsored by:	Spectra Logic
MFSpectraBSD:	636827 on 2012/09/28
2014-10-01 14:35:52 +00:00
Hans Petter Selasky
a4a51f054d Set default cycle state in case of early interrupts.
MFC after:	3 days
2014-10-01 07:34:49 +00:00
Ian Lepore
c3f0f2847f Return the actual baud rate programmed in the hardware rather than 115200.
This allows the "3wire" entry in /etc/ttys (with no speed specified) to work.
2014-09-30 23:01:11 +00:00
George V. Neville-Neil
060a95ef01 Support tunable to control Tx deferred packet list limits
Also increase default for Tx queue get-list limit.
Too small limit results in TCP packets drops especiall when many
streams are running simultaneously.
Put list may be kept small enough since it is just a temporary
location if transmit function can't get Tx queue lock.

Submitted by:   Andrew Rybchenko <arybchenko at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
2014-09-30 20:57:25 +00:00
George V. Neville-Neil
bc85c897c7 The patch allows to check state of the software Tx queues at run time.
Submitted by:   Andrew Rybchenko <arybchenko at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
2014-09-30 20:43:21 +00:00
George V. Neville-Neil
385b1d8e67 Make size of Tx and Rx rings configurable
Required size of event queue is calculated now.

Submitted by:   Andrew Rybchenko <arybchenko at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
2014-09-30 20:36:07 +00:00
George V. Neville-Neil
b7b0edd17c cleanup: code style fixes
Remove trailing whitespaces and tabs.
Enclose value in return statements in parentheses.
Use tabs after #define.
Do not skip comparison with 0/NULL in boolean expressions.

Submitted by:   Andrew Rybchenko <arybchenko at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
2014-09-30 20:18:10 +00:00
Roger Pau Monné
59adbba20f xen: fix blkback pushing responses before releasing internal resources
Fix a problem where the blockback driver could run out of requests,
despite the fact that we allocate enough request and reqlist
structures to satisfy the maximum possible number of requests.

The problem was that we were sending responses back to the other
end (blockfront) before freeing resources. The Citrix Windows
driver is pretty agressive about queueing, and would queue more I/O
to us immediately after we sent responses to it. We would run into
a resource shortage and stall out I/O until we freed resources.

It isn't clear whether the request shortage condition was an
indirect cause of the I/O hangs we've been seeing between Windows
with the Citrix PV drivers and FreeBSD's blockback, but the above
problem is certainly a bug.

Sponsored by: Spectra Logic
Submitted by: ken
Reviewed by: royger

dev/xen/blkback/blkback.c:
 - Break xbb_send_response() into two sub-functions,
   xbb_queue_response() and xbb_push_responses().
   Remove xbb_send_response(), because it is no longer
   used.

 - Adjust xbb_complete_reqlist() so that it calls the
   two new functions, and holds the mutex around both
   calls.  The mutex insures that another context
   can't come along and push responses before we've
   freed our resources.

 - Change xbb_release_reqlist() so that it requires
   the mutex to be held instead of acquiring the mutex
   itself.  Both callers could easily hold the mutex
   while calling it, and one really needs to hold the
   mutex during the call.

 - Add two new counters, accessible via sysctl
   variables.  The first one counts the number of
   I/Os that are queued and waiting to be pushed
   (reqs_queued_for_completion).  The second one
   (reqs_completed_with_error) counts the number of
   requests we've completed with an error status.
2014-09-30 17:41:16 +00:00
Roger Pau Monné
22c1633270 xen/balloon: fix accounting of current memory pages on PVH
Using realmem on PVH is not realiable, since in this case the realmem value
is computed from Maxmem, which contains the higher memory address found. Use
HYPERVISOR_start_info->nr_pages instead, which is set by the hypervisor and
contains the exact number of memory pages assigned to the domain.

Sponsored by: Citrix Systems R&D
2014-09-30 17:38:21 +00:00
Roger Pau Monné
557077b5fc xen: add xenstored user-space device
This device is used by the user-space daemon that runs xenstore
(xenstored). It allows xenstored to map the xenstore memory page, and
reports the event channel xenstore is using.

Sponsored by: Citrix Systems R&D

dev/xen/xenstore/xenstored_dev.c:
 - Add the xenstored character device that's used to map the xenstore
   memory into user-space, and to report the event channel used by
   xenstore.

conf/files:
 - Add the device to the build process.
2014-09-30 17:37:26 +00:00
Roger Pau Monné
45ce037de2 xen: convert the xenstore user-space char device to a newbus device
Convert the xenstore user-space device (/dev/xen/xenstore) to a device
using the newbus interface. This allows us to make the device
initialization dependant on the initialization of xenstore itself in
the kernel.

Sponsored by: Citrix Systems R&D

dev/xen/xenstore/xenstore.c:
 - Convert to a newbus device, this removes the xs_dev_init function.

xen/xenstore/xenstore_internal.h:
 - Remove xs_dev_init prototype.

dev/xen/xenstore/xenstore.c:
 - Don't call xs_dev_init anymore, the device will attach itself when
   xenstore is started.
2014-09-30 17:31:04 +00:00
Roger Pau Monné
1d84e2b3c8 xen: defer xenstore initialization until xenstored is started
The xenstore related devices in the kernel cannot be started until
xenstored is running, which will happen later in the Dom0 case. If
start_info_t doesn't contain a valid xenstore event channel, defer all
xenstore related devices attachment to later.

Sponsored by: Citrix Systems R&D

dev/xen/xenstore/xenstore.c:
 - Prevent xenstore from trying to attach it's descendant devices if
   xenstore is not initialized.
 - Add a callback in the xenstore interrupt filter that will trigger
   the plug of xenstore descendant devices on the first received
   interrupt. This interrupt is generated when xenstored attaches to
   the event channel, and serves as a notification that xenstored is
   running.
2014-09-30 17:27:56 +00:00
Roger Pau Monné
a6aedc5d49 xen: move xenstore devices
Move xenstore related devices (xenstore.c and xenstore_dev.c) from
xen/xenstore to dev/xen/xenstore. This is just code motion, no
functional changes.

Sponsored by: Citrix Systems R&D
2014-09-30 17:14:11 +00:00
Roger Pau Monné
ae3078d9e4 xen: make xen balloon a driver that depends on xenstore
This is done so we can prevent the Xen Balloon driver from attaching
before xenstore is setup.

Sponsored by: Citrix Systems R&D

dev/xen/balloon/balloon.c:
 - Make xen balloon a driver that depends on xenstore.
2014-09-30 16:53:08 +00:00
Roger Pau Monné
44e06d158a msi: add Xen MSI implementation
This patch adds support for MSI interrupts when running on Xen. Apart
from adding the Xen related code needed in order to register MSI
interrupts this patch also makes the msi_init function a hook in
init_ops, so different MSI implementations can have different
initialization functions.

Sponsored by: Citrix Systems R&D

xen/interface/physdev.h:
 - Add the MAP_PIRQ_TYPE_MULTI_MSI to map multi-vector MSI to the Xen
   public interface.

x86/include/init.h:
 - Add a hook for setting custom msi_init methods.

amd64/amd64/machdep.c:
i386/i386/machdep.c:
 - Set the default msi_init hook to point to the native MSI
   initialization method.

x86/xen/pv.c:
 - Set the Xen MSI init hook when running as a Xen guest.

x86/x86/local_apic.c:
 - Call the msi_init hook instead of directly calling msi_init.

xen/xen_intr.h:
x86/xen/xen_intr.c:
 - Introduce support for registering/releasing MSI interrupts with
   Xen.
 - The MSI interrupts will use the same PIC as the IO APIC interrupts.

xen/xen_msi.h:
x86/xen/xen_msi.c:
 - Introduce a Xen MSI implementation.

x86/xen/xen_nexus.c:
 - Overwrite the default MSI hooks in the Xen Nexus to use the Xen MSI
   implementation.

x86/xen/xen_pci.c:
 - Introduce a Xen specific PCI bus that inherits from the ACPI PCI
   bus and overwrites the native MSI methods.
 - This is needed because when running under Xen the MSI messages used
   to configure MSI interrupts on PCI devices are written by Xen
   itself.

dev/acpica/acpi_pci.c:
 - Lower the quality of the ACPI PCI bus so the newly introduced Xen
   PCI bus can take over when needed.

conf/files.i386:
conf/files.amd64:
 - Add the newly created files to the build process.
2014-09-30 16:46:45 +00:00
Alexander Motin
c8dbed028f Fix old iSCSI initiator to work with new CAM locking.
This switches code to using xpt_scan() routine, irrelevant to locking.
Using xpt_action() directly requires knowledge about higher level locks,
that SIM does not need to have.

This code is obsoleted, but that is not a reason to crash.

MFC after:	3 days
2014-09-30 16:17:12 +00:00
Adrian Chadd
1b65908ea7 Add a missing file from the last commit.
Noticed by: jhibbits
2014-09-30 05:50:34 +00:00
Adrian Chadd
9389d5a95e Add initial support for the AR9485 CUS198 / CUS230 variants.
These variants have a few differences from the default AR9485 NIC,
namely:

* a non-default antenna switch config;
* slightly different RX gain table setup;
* an external XLNA hooked up to a GPIO pin;
* (and not yet done) RSSI threshold differences when
  doing slow diversity.

To make this possible:

* Add the PCI device list from Linux ath9k, complete with vendor and
  sub-vendor IDs for various things to be enabled;
* .. and until FreeBSD learns about a PCI device list like this,
  write a search function inspired by the USB device enumeration code;
* add HAL_OPS_CONFIG to the HAL attach methods; the HAL can use this
  to initialise its local driver parameters upon attach;
* copy these parameters over in the AR9300 HAL;
* don't default to override the antenna switch - only do it for
  the chips that require it;
* I brought over ar9300_attenuation_apply() from ath9k which is cleaner
  and easier to read for this particular NIC.

This is a work in progress.  I'm worried that there's some post-AR9380
NIC out there which doesn't work without the antenna override set as
I currently haven't implemented bluetooth coexistence for the AR9380
and later HAL.  But I'd rather have this code in the tree and fix it
up before 11.0-RELEASE happens versus having a set of newer NICs
in laptops be effectively RX deaf.

Tested:

* AR9380 (STA)
* AR9485 CUS198 (STA)

Obtained from:	Qualcomm Atheros, Linux ath9k
2014-09-30 03:19:29 +00:00
Ryan Stone
cf3c0c32d2 Ensure that ixl_flush() uses a defined register on VFs
In some code that is shared between the ixl(4) and ixlv(4) drivers,
a macro hard-coded a register offset that was not valid on ixlv devices.
Fix this by having each driver define a variable that contains the correct
offset.

Reviewed by:	Eric Joyner <ricera10 AT gmail.com>
MFC after:	3 days
Sponsored by:	Sandvine Inc
2014-09-29 17:51:39 +00:00
Alexander V. Chernikov
c6682d5906 Convert most BPF_TAP users to BPF_MTAP.
MFC after:	2 weeks
2014-09-28 19:05:22 +00:00
Gleb Smirnoff
bd071d4d19 - Remove empty wrappers ether_poll_[de]register_drv(). [1]
- Move polling(9) declarations out of ifq.h back to if_var.h
  they are absolutely unrelated to queues.

Submitted by:	Mikhail <mp lenta.ru> [1]
2014-09-28 14:05:18 +00:00
Hans Petter Selasky
8bf51ab563 Instead of creating the full range of possible ports, try to figure
out the actual number of so-called "embedded jacks" which are present
when a USB MIDI device is attaching.

MFC after:	3 days
2014-09-28 12:55:13 +00:00
Gleb Smirnoff
fbc4ef4ca7 Provide ixgb_get_counter(). 2014-09-28 07:40:26 +00:00
Gleb Smirnoff
058a38660e Convert to if_get_counter(). 2014-09-28 07:29:45 +00:00
Gleb Smirnoff
5fe12776aa Mechanically switch ixv(4) to if_inc_counter(). 2014-09-28 07:19:32 +00:00
Gleb Smirnoff
4b443922e0 Convert driver to if_get_counter method.
Submitted by:	rstone
Reviewed by:	Eric Joyner <ricera10 gmail.com>
2014-09-27 20:54:57 +00:00
Gleb Smirnoff
08c95c53d7 Mechanically convert to if_inc_counter(). 2014-09-27 20:43:01 +00:00
Steven Hartland
6e9a599b27 Use a local STAILQ for unlocked done CCB processing in ahci direct mode
Previously it was possible for issues e.g. use after free, to result
from processing the done queue while not holding the channel lock.

While this should never happen in practice, unexpected code flows
which result in two threads processing from the same queue may
be possible.

We now use a local STAILQ to prevent this ever being an issue.

Sponsored by:	Multiplay
2014-09-27 19:14:22 +00:00
Navdeep Parhar
e26e6373c8 cxgb(4): implement if_get_counter. 2014-09-27 18:35:16 +00:00
Alexander Kabaev
1ade5ec79a Do not pass whole descriptor block size as align to fwdma_malloc_multiseg
Do not pass wrong alignment value to fwdma_malloc_multiseg and ultimately
to contigalloc. In addition to being wrong, this causes insta-panic in
certain cases due to safety assertion - the alignment is required to be
the power of two and the value we calculate here seldom is.

MFC after:  1 month
2014-09-27 16:50:24 +00:00
Alexander Kabaev
23667f089d Remove obsolete compatibility glue and improve firewire code readability.
Commit my version of style(9) pass over the firewire code. Now that
other people have started changing the code carrying this is as a
local patch is not longer a viable option.

MFC after:	1 month
2014-09-27 16:50:21 +00:00
Navdeep Parhar
2d8910854b cxgbe(4): implement if_get_counter. 2014-09-27 05:50:31 +00:00
Navdeep Parhar
acc45299f5 cxgbe(4): explicitly set various if_hw_tso* values.
MFC after:	3 days
2014-09-26 22:21:02 +00:00
Navdeep Parhar
db25c97a1a Make sure the adapter's management queue and the event queue are
available before any uppper layer driver (TOE, iWARP, or iSCSI)
registers with the base cxgbe(4) driver.

Submitted by:	Hariprasad at chelsio dot com
Reviewed by:	np@
2014-09-26 18:53:00 +00:00
Gleb Smirnoff
0353415eb6 - Mechanically convert to if_inc_counter() the rest of counters.
- Do not set if_collisions on interrupt, read them in ti_get_counter().
- Add missing bus_dmamap_sync(BUS_DMASYNC_PREREAD) in ti_ioctl2(). [1]

Submitted by:	mav [1]
2014-09-26 10:47:57 +00:00
Gavin Atkinson
cd8d304e79 Add new (untested) device IDs to smsc(4)
MFC after:	1 week
2014-09-26 08:16:26 +00:00
John Baldwin
83e78a7f6e Merge the PC98 fdc(4) driver into the MI driver. While here, replace
the magic numbers used with NE7CMD_SPECIFY with invocations of the
NE7_SPEC_x() macros.

Approved by:	nyan
2014-09-25 20:40:24 +00:00
John Baldwin
9de2fdafa8 Lock ncr(4) and mark it MPSAFE along with various other fixes:
- Use bus_*() instead of bus_space_*().
- Use device_printf().
- Remove unused global variables and the extra warning suppression
  they required.
- Use callout() instead of timeout().

Reviewed by:	se
2014-09-25 18:43:52 +00:00
Ruslan Bukin
5d43fd685b Add driver for Synopsys DesignWare 3504-0 Universal 10/100/1000
Ethernet MAC.

Sponsored by:	DARPA, AFRL
2014-09-25 18:03:14 +00:00
Luigi Rizzo
b3d3758852 fix a panic when passing ifioctl from a netmap file descriptor to
the underlying device. This needs to be merged to 10.1

Reported by: Patrick Kelsey
MFC after:	3 days
2014-09-25 16:22:32 +00:00
Luigi Rizzo
7f154b713a adapt the code to different freebsd versions.
Not necessary to MFC
2014-09-25 15:57:57 +00:00
Ian Lepore
c47d4cde39 Replace multiple nearly-identical copies of code to walk through an FDT
node's interrupts=<...> property creating resource list entries with a
single common implementation.  This change makes ofw_bus_intr_to_rl() the
one true copy of that code and removes the copies of it from other places.

This also adds handling of the interrupts-extended property, which allows
specifying multiple interrupts for a node where each interrupt can have a
separate interrupt-parent.  The bindings for this state that the property
cells contain an xref phandle to the interrupt parent followed by whatever
interrupt info that parent normally expects.  This leads to having a
variable number of icells per interrupt in the property.  For example you
could have <&intc1 1 &intc2 26 9 0 &intc3 9 4>.

Differential Revision: https://reviews.freebsd.org/D803
2014-09-25 15:02:33 +00:00
Gavin Atkinson
265f42be76 Move the ARM Samsung s3c2xx0 support files into the samsung directory, to
match other platforms.

Discussed with:	andrew
2014-09-25 11:38:26 +00:00
Gleb Smirnoff
0d286aa4cb Provide vmxnet3_get_counter() to return counters that are not collected,
but taken from hardware.
2014-09-25 08:36:11 +00:00
Gleb Smirnoff
5af6947046 - Provide bce_get_counter() to return counters that are not collected,
but taken from hardware.
- Mechanically convert to if_inc_counter() the rest of counters.
- While here fix 3 instances of the same bug, when error counter was ++
  in one place and then assigned in other place, losing the increment.
  Achieve that storing soft errors counters in softc.
2014-09-25 07:22:24 +00:00
Gleb Smirnoff
d58a49d829 - Provide lmc_get_counter() to return counters that are not collected,
but taken from hardware.
- Mechanically convert to if_inc_counter() the rest of counters.
2014-09-25 07:00:31 +00:00
Gleb Smirnoff
8d864935b6 Run through unifdef(1) with slight hand-editing after. It is obvious,
that the driver is not going to be ever improved in terms of hardware
support, it is going to be only maintained as our kernel APIs change.
Carrying all the compatibility with ancient versions of NetBSD, OpenBSD,
Linux and BSDI, as well as obsoleted FreeBSD versions has no reason.
2014-09-25 06:47:38 +00:00
Gleb Smirnoff
56ec302f3c Whitespace cleanup. 2014-09-25 05:47:33 +00:00
Gleb Smirnoff
f3f040d929 - Provide mxge_get_counter() to return counters that are not collected,
but taken from hardware.
- Mechanically convert to if_inc_counter() the rest of counters.
2014-09-25 05:45:52 +00:00
Navdeep Parhar
3a260c2a19 Update comment (missed this bit in r272079). 2014-09-24 20:08:43 +00:00
Navdeep Parhar
13251b21e1 cxgbe/tom: Catch up with r271119, syncache_add doesn't need tcbinfo lock. 2014-09-24 20:04:11 +00:00
Gleb Smirnoff
ddadcf17a0 - Provide wi_get_counter() to return counters that are not collected,
but taken from hardware.
- Mechanically convert to if_inc_counter() the rest of counters.
2014-09-24 12:19:00 +00:00
Gleb Smirnoff
1fc35e9e38 - Provide txp_get_counter() to return counters that are not collected,
but taken from hardware.
- Mechanically convert to if_inc_counter() the rest of counters.
2014-09-24 11:58:23 +00:00
Gleb Smirnoff
a9af3b705c Mechanically convert to if_inc_counter(). 2014-09-24 11:33:43 +00:00
Gleb Smirnoff
24b83dc67a - Provide vte_get_counter() to return counters that are not collected,
but taken from hardware.
- Mechanically convert to if_inc_counter() the rest of counters.
2014-09-24 11:31:46 +00:00
Gleb Smirnoff
c13dc68743 - Provide igb_get_counter() to return counters that are not collected,
but taken from hardware.
- Mechanically convert to if_inc_counter() the rest of counters.
2014-09-24 11:23:55 +00:00
Navdeep Parhar
1dee8327d4 cxgbe(4): Verify that the addresses in if_multiaddrs really are multicast
addresses.  (The chip doesn't really care, it's just that it needs to be
told explicitly if unicast DMACs are checked for "hits" in the hash that
is used after the TCAM entries are all used up).
2014-09-23 22:57:11 +00:00
Bjoern A. Zeeb
a401d28ee8 Given we are restricting ixl(4) to 64bit platforms now backout the change
r270820 to common (shared) Intel code no longer needed.

MFC after:	3 days
2014-09-23 08:39:08 +00:00
Rui Paulo
f495ec295b Move all the power management (SMBus) drivers to their own directory,
away from sys/pci.
2014-09-23 06:31:15 +00:00
Rui Paulo
271b33a6fd Move amdsmb and nfsmb from dev/pci to their own device directory. 2014-09-23 05:54:18 +00:00
Rui Paulo
3355bd61a0 Move pci/ncr to dev/ncr. 2014-09-23 05:37:17 +00:00
Justin Hibbits
a1c1634858 Stage one of multipass suspend/resume
Summary:
Add the beginnings of multipass suspend/resume, by introducing
BUS_SUSPEND_CHILD/BUS_RESUME_CHILD, and move the PCI driver to this.

Reviewers: jhb

Reviewed By: jhb

Differential Revision: https://reviews.freebsd.org/D590
2014-09-23 02:56:40 +00:00
John Baldwin
166a4e4701 Switch from timeout(9) to callout(9). In addition, do not teardown the
IRQ handler while resetting the controller and add some missing teardown
actions in detach.

Reviewed by:	delphij
2014-09-22 20:38:01 +00:00
Rui Paulo
447666f08b Improvements to asmc(4):
1. changed the code so that 2**16 keys are supported
2. changed the number of possible fans in a system from 2 to 6
3. added write support for some fan sysctls
4. added a new sysctl which shows the ID of the fan
5. added four more apple models with their temperature keys
6. changed the maxnumber of temperature keys from 36 to 80
7. replaced several fixed buf sizes to sizeof buf

Obtained from:	Denis Ahrens denis at h3q.com
MFC after:	4 weeks
2014-09-22 16:20:38 +00:00
John Baldwin
fadf3fb98c Convert from timeout(9) to callout(9). 2014-09-22 14:27:26 +00:00
Hans Petter Selasky
090817577b Some XHCI hardware requires dropping the endpoint context before
adding it again.

MFC after:	3 days
Submitted by:	Kohji Okuno <okuno.kohji@jp.panasonic.com>
2014-09-22 10:21:42 +00:00
Hans Petter Selasky
9fd573c39d Improve transmit sending offload, TSO, algorithm in general.
The current TSO limitation feature only takes the total number of
bytes in an mbuf chain into account and does not limit by the number
of mbufs in a chain. Some kinds of hardware is limited by two
factors. One is the fragment length and the second is the fragment
count. Both of these limits need to be taken into account when doing
TSO. Else some kinds of hardware might have to drop completely valid
mbuf chains because they cannot loaded into the given hardware's DMA
engine. The new way of doing TSO limitation has been made backwards
compatible as input from other FreeBSD developers and will use
defaults for values not set.

Reviewed by:	adrian, rmacklem
Sponsored by:	Mellanox Technologies
MFC after:	1 week
2014-09-22 08:27:27 +00:00
Bjoern A. Zeeb
b3f7259b25 Hide LRO code under #ifdef INET/INET6 to allow NOIP kernel to compile.
While the code comments indicate that LRO is currently only supported
for IPv4/TCP, we'll still compile it in for IPv6.

MFC after:	3 days
2014-09-21 00:05:44 +00:00
Bjoern A. Zeeb
7e0dde7d54 Properly hide calls to ARP under #ifdef INET to allow IPv6-only
kernels to compile.

MFC atfer:	3 days
2014-09-20 08:34:56 +00:00
Bjoern A. Zeeb
a10068fdf5 Make gcc happy by initialising the variable only set in a couple of
case statements without a default.

MFC after:	2 days
X-MFC with:	r271871
2014-09-20 08:18:48 +00:00
Adrian Chadd
9cf5a6aad8 Populate the device info string with _PXM (proximity domain) information.
This is primarily useful for debugging right now - it'll show up in
devinfo.

Reviewed by:	jhb
2014-09-20 04:31:12 +00:00
Adrian Chadd
17bb5fd106 Fix up the EDMA RX setup path to correctly initialise and reset the RX FIFO.
The original code was .. well, slightly more than incorrect.

It showed up as stalled RX queues if the NIC needed to be frequently
reinitialised (eg during scans.)

This is inspired by work done by Matt Dillon over at the DragonflyBSD
project.

So:

* track when EDMA RX has been stopped and when the MAC has been reset;
* re-initialise the ring only after a reset;
* track whether RX has been stopped/started - just for debugging now;
* don't bother with the RX EOL stuff for EDMA - we don't need the
  interrupt at all.  We also don't need to disable/enable the interrupt
  or start DMA - once new frames are pushed into the ring via the
  normal RX path, it'll just restart RX DMA on its own.

Tested:

* AR9380, STA mode
* AR9380, AP mode
* AR9485, STA mode
* AR9462, STA mode
2014-09-20 01:22:17 +00:00
Hans Petter Selasky
9dc2190371 Add new USB IDs.
PR:		193775
MFC after:	1 week
2014-09-19 16:06:54 +00:00
Jean-Sébastien Pédron
09d058d153 vt(4): Remove superfluous word in comment
Submitted by:	brueffer@
MFC after:	3 days
MFC with:	271871
2014-09-19 12:38:43 +00:00
Jean-Sébastien Pédron
1454439c13 vt(4): Rewrite history scrolling
It's now possible to scroll up the 500 hard-coded lines of history, not
just a fraction of them. For instance, one can reach the top of the boot
process.

Sometimes, when scrolling or when changing the screen size (by changing
the font or loading a KMS driver for instance), one could see the
history cycling (old content appeared below latest lines). This is
fixed.

Now, when the resolution changes are more lines can be shown, the
displayed area is adjusted so that, if the screen was filled with
content before, it's filled with content after as well: more history
is visible, instead of having blank lines below the previously visible
content.

MFC after:	3 days
2014-09-19 12:20:43 +00:00
Gleb Smirnoff
5d53210ced - Provide igb_get_counter() to return counters that are not collected,
but taken from hardware.
- Mechanically convert to if_inc_counter() the rest of counters.
2014-09-19 11:49:41 +00:00
Jean-Sébastien Pédron
c3a05e5422 vt(4): Remove vt_buf->vb_dirtymask
This structure and the associated functions were unused since the
implementation of vd_bitblt_text_t callbacks.

MFC after:	3 days
2014-09-19 11:02:44 +00:00
Gleb Smirnoff
a001989d9b Mechanically convert to if_inc_counter(). 2014-09-19 10:35:56 +00:00
Gleb Smirnoff
e3393daf63 Mechanically convert to if_inc_counter(). 2014-09-19 10:33:23 +00:00
Gleb Smirnoff
b2d3d26fa0 Move rl(4) to dev/rl. 2014-09-19 10:32:20 +00:00
Gleb Smirnoff
56b61ca27a Remove ifq_drops from struct ifqueue. Now queue drops are accounted in
struct ifnet if_oqdrops.

Some netgraph modules used ifqueue w/o ifnet. Accounting of queue drops
is simply removed from them. There were no API to read this statistic.

Sponsored by:	Netflix
Sponsored by:	Nginx, Inc.
2014-09-19 09:01:19 +00:00
Gleb Smirnoff
9d204116ad Fix typo.
Submitted by:	jkim
2014-09-19 03:55:19 +00:00