Commit Graph

28718 Commits

Author SHA1 Message Date
Xin LI
9049b13f8f Use unsigned int for index value.
Without this change a local attacker could trigger a panic by
tricking the kernel into accessing undefined kernel memory.

We would like to acknowledge Francisco Falcon from CORE Security
Technologies who discovered the issue and reported to the
FreeBSD Security Team.

More information can be found at CORE Security's advisory at:
http://www.coresecurity.com/content/freebsd-kernel-multiple-vulnerabilities

This is an errata candidate for releng/10.1 and releng/9.3.  Earlier
releases are not affected.

Reported by:	Francisco Falcon from CORE Security Technologies
Security:	CVE-2014-0998
Reviewed by:	dumbbell
MFC after:	3 days
2015-01-27 19:35:41 +00:00
Andriy Gapon
85f95fffd7 hook userland threads suspend + resume into acpi suspend code
Also, split power_suspend into power_suspend and power_suspend_early.

power_suspend_early is called before the userland is frozen.
power_suspend is called after the userland is frozen.

Currently only VT switching is hooked to power_suspend_early.
This is needed because switching away from X server requires its
cooperation, so obviously X server must not be frozen when that happens.

Freezing userland during ACPI suspend is useful because not all drivers
correctly handle suspension concurrent with other activity.  This is
especially applicable to drivers ported from other operating systems
that suspend all software activity between placing drivers and hardware
into suspended state.
In particular drm2/radeon (radeonkms) depends on the described
procedure.  The driver does not have any internal synchronization
between suspension activities and processing of userland requests.

Many thanks to kib for the code that allows to freeze and thaw all
userland threads.

Note that ideally we also need to park / inhibit (non-special) kernel
threads as well to ensure that they do not call into drivers.

MFC after:	17 days
2015-01-27 17:33:18 +00:00
Andriy Gapon
6dfa4578d6 vt(4): Use power_{suspend,resume} event handlers to implement
suspend/resume

The goal is to avoid that the vt(4) resume happens before the video
display is resumed. The original patch was provided by Andriy Gapon.

This new patch registers the handlers in vt_upgrade(). This is done
once, thanks to the VDF_ASYNC flag. I abused this flag because it was
already abused by the keyboard allocation. The event handlers then call
the backend if it provides callbacks for suspend/resume.

Differential Revision:	https://reviews.freebsd.org/D1004
On behalf of:	dumbbell
MFC after:	2 weeks
2015-01-27 15:28:46 +00:00
Bryan Venteicher
6b0e9233e4 Rework vtblk dump handling of in flight requests
Previously, the driver resets the device and abandon the requests that
are caught in flight when the dump was initiated. This was problematic
if the system is resumed after the dump is completed.

While that is probably not the typical action, it is simple to rework
the driver to very likely have the device usable after the dump without
making it more likely for the dump to fail. The in flight requests are
simply queued for completion once the dump is finished.

Requested by:	markj
MFC after:	1 month
2015-01-27 05:34:46 +00:00
John Baldwin
86f05ea6cf Lock the socket buffer before jumping to the 'out' label if sblock()
fails in t4_soreceive_ddp().
2015-01-26 16:32:41 +00:00
John Baldwin
de5a10ecbc - Update a disabled KASSERT() to use sbused() instead of accessing
the no-longer existant sb_cc sockbuf member.
- Use sbavail() instead of sbused() in t4_soreceive_ddp() to match the
  usage in soreceive_stream() on which it is based.

Discussed with:	glebius (2)
2015-01-26 16:29:14 +00:00
John Baldwin
4f621933a5 Fix a couple of panics when detaching from a cxgbe/cxl interface that was
never brought up:
- Allow NULL to be passed to sglist_free().
- Don't try to stop an interface that was never fully initialized.

Reviewed by:	np
2015-01-26 16:26:28 +00:00
Scott Long
fcafcbcb6f Fix the ioctl interface to properly support fetching the header of regular
and extended config pages.

Obtained from:	Netflix, Inc.
MFC after:	3 days
2015-01-25 22:29:23 +00:00
John Baldwin
0e521c9a26 Pass a valid Dx state variable to PCIB_POWER_FOR_SLEEP() in pcib_resume()
instead of NULL.

Submitted by:	dchagin
MFC after:	2 weeks
2015-01-25 19:53:09 +00:00
Ian Lepore
50878a7bbd Reimplement fdt_clock_register_provider() correctly. It turns out you
can't use OF_xref_from_device() to implement the function that registers
the xref association with the device.

Pointy hat:	     ian
Submitted by:	     loos
2015-01-24 20:18:37 +00:00
Adrian Chadd
11c0b69c08 Change the permissions from 0660 to 0600.
Otherwise people in wheel can do things with netmap, including
but not limited to promisc transmit/receive.

Approved by:	luigi
MFC after:	1 week
2015-01-24 19:49:27 +00:00
Konstantin Belousov
8f4548ff25 Remove Giant from /dev/mem and /dev/kmem. It is definitely not needed
for i386, and from the code inspection, nothing in the
arm/mips/sparc64 implementations depends on it.

Discussed with:	imp, nwhitehorn
Sponsored by:	The FreeBSD Foundation
MFC after:	3 weeks
2015-01-24 12:51:15 +00:00
Jung-uk Kim
ae1ef64fe4 Simplify retry loops. No functional change. 2015-01-23 18:55:04 +00:00
Jung-uk Kim
4552fccb4b Revert r216942. This commit was premature and caused too many complaints.
PR:		162859
MFC after:	3 days
2015-01-23 18:12:44 +00:00
Kevin Lo
128236c022 Remove break after return. 2015-01-23 15:14:30 +00:00
Ryan Stone
6a429fa5d7 style(9) cleanup 2015-01-22 03:56:23 +00:00
Will Andrews
35d002dc8f Fix SCSI status byte reporting on 4Gb and 8Gb Qlogic boards.
The newer boards don't have the response field that indicates
whether the SCSI status byte is present.  You have to just look to
see whether it is non-zero.

The code was looking to see whether the sense length was valid
before propagating the SCSI status byte (and sense information) up
the stack.  With a status like Reservation Conflict, there is no
sense information, only the SCSI status byte.  So it wasn't getting
correctly returned.

isp.c:
	In isp_intr(), if we are on a 2400 or 2500 type board and
	get a response, look at the actual contents of the
	SCSI status value and set the RQSF_GOT_STATUS flag
	accordingly so that return any SCSI status value we get.  The
	RQSF_GOT_SENSE flag will get set later on if there is
	actual sense information returned.

Submitted by:	ken
MFC after:	1 week
Sponsored by:	Spectra Logic
MFSpectraBSD:	1112791 on 2015/01/15
2015-01-21 20:32:36 +00:00
Will Andrews
5b14cb4136 Force commit to record the correct log for r277513.
If the user sends an XPT_RESET_DEV CCB, make sure to reset the
Fibre Channel Command Reference Number if we're running on a FC
controller.

We send a SCSI Target Reset when we get this CCB, and as a result
need to reset the CRN to 1 on the next command.

isp_freebsd.c:
	In the XPT_RESET_DEV implementation in isp_action(), reset
	the CRN if we're on a FC controller.

Submitted by:	ken
MFC after:	1 week
Sponsored by:	Spectra Logic
MFSpectraBSD:	1112787 on 2015/01/15
2015-01-21 20:27:11 +00:00
Will Andrews
b44e442e50 Change 1112791 by kenm@ken.spectrabsd8 on 2015/01/15 16:45:13
Fix SCSI status byte reporting on 4Gb and 8Gb Qlogic boards.

The newer boards don't have the response field that indicates
whether the SCSI status byte is present.  You have to just look to
see whether it is non-zero.

The code was looking to see whether the sense length was valid
before propagating the SCSI status byte (and sense information) up
the stack.  With a status like Reservation Conflict, there is no
sense information, only the SCSI status byte.  So it wasn't getting
correctly returned.

isp.c:
	In isp_intr(), if we are on a 2400 or 2500 type board and
	get a response, look at the actual contents of the
	SCSI status value and set the RQSF_GOT_STATUS flag
	accordingly so that return any SCSI status value we get.  The
	RQSF_GOT_SENSE flag will get set later on if there is
	actual sense information returned.

Submitted by:	ken
MFC after:	1 week
Sponsored by:	Spectra Logic
MFSpectraBSD:	1112791 on 2015/01/15
2015-01-21 20:22:53 +00:00
Will Andrews
9129104227 Fix remote DMA based firewire debugging when targeting
systems with more than 4GB of physical memory.

To remotely debug the system 'stealthy' which has a kernel
with this change installed and firewire properly configured:

	% fwcontrol -m stealthy (or stealthy's firewire EUI64)
	% kgdb kernel /dev/fwmem0.0

sys/dev/firewire/fwohci.c:
	Rather than hard code the upper limit for hw based
	automatic responses to remote DMA requests at 4GB,
	program the hardware using Maxmem, the page number
	one higher than the highest physical page detected
	in the system.

	While here, garbage collect more useless splfw()
	calls.

Submitted by:	gibbs
MFC after:	1 week
Sponsored by:	Spectra Logic
MFSpectraBSD:	1110994 on 2015/01/06
2015-01-21 20:08:24 +00:00
Will Andrews
4dd896995c Fix firewire panic when issuing a reply to an unhandled
asynchronous remote dma request (DMA request that the
hardware cannot automatically handle).

sys/dev/firewire/firewire.c
	In fw_rcv(), add missing early return in the error
	path for DMA requests to unregistered regions.

Submitted by:	gibbs
MFC after:	1 week
Sponsored by:	Spectra Logic
MFSpectraBSD:	1110993 on 2015/01/06
2015-01-21 20:06:25 +00:00
Will Andrews
ed80123329 Properly lock accesss to the firewire_comm->devices list.
sys/dev/firewire/firewire.c:
	Add missing FW_GLOCK/UNLOCK() usage to fw_noderesolve_nodeid().

sys/dev/firewire/firewire.c:
sys/dev/firewire/fwmem.c:
	Remove no-op splfw() calls from functions that have been
	audited for proper lock usage.

Submitted by:	gibbs
MFC after:	1 week
Sponsored by:	Spectra Logic
MFSpectraBSD:	1110992 on 2015/01/06
2015-01-21 20:05:10 +00:00
Will Andrews
7eaab60d36 Fix panic in firewire and creation of invalid config ROM.
sys/boot/i386/libfirewire/firewire.c:
sys/dev/firewire/firewire.c:
	Fix configuration ROM generation count wrapping logic
	so that the generation count is never outside of
	allowed limits (0x2 -> 0xF).

sys/dev/firewire/firewire.c:
	In fw_xfer_unload(), xfer->fc may be NULL.  Protect
	against this before taking the fc lock.

Submitted by:	gibbs
MFC after:	1 week
Sponsored by:	Spectra Logic
MFSpectraBSD:	1110685 on 2015/01/05
2015-01-21 20:03:46 +00:00
Will Andrews
ff9ae2210b Fix a FWXF_INQ race in the firewire driver.
sys/dev/firewire/firewire.c:
	In fw_xfer_unload() expand lock coverage so that
	the test for FWXF_INQ doesn't race with it being
	cleared in another thread.

Submitted by:	gibbs
MFC after:	1 week
Sponsored by:	Spectra Logic
MFSpectraBSD:	1110207 on 2015/01/02
2015-01-21 20:02:16 +00:00
Will Andrews
26f1289e49 Fix one cause of firewire panics.
sys/dev/firewire/firewire.c:
	In fw_xfer_unload(), clear the FWXF_INQ flag on the
	xfer under protection of the FW_GMTX, after the
	xfer is removeed from the tx/rx queue.  Otherwise
	it is possible for the xfer to be removed again
	(corrupting the list or immediately panicing) from
	another thread that has found this xfer in the
	transaction label table.

Submitted by:	gibbs
MFC after:	1 week
Sponsored by:	Spectra Logic
MFSpectraBSD:	1110200 on 2015/01/02
2015-01-21 19:59:09 +00:00
Will Andrews
49f159beef Garbage collect dragonfly and legacy FreeBSD system support from dcons(4).
Submitted by:	gibbs
MFC after:	1 week
Sponsored by:	Spectra Logic
MFSpectraBSD:	1110990 on 2015/01/06
2015-01-21 19:53:52 +00:00
Andrew Turner
5b86b0eaba Update the parsing of the cpu node. We are unable to use the reg property
as the cpu id on arm64 as it may use two cells. In it's place we can use
the device id.

It is expected we will use the reg data on arm64 to enable cores so we
still need to read and store it even if it is not yet used.

Differential Revision:	https://reviews.freebsd.org/D1555
Reviewed by:	nwhitehorn
Sponsored by:	The FreeBSD Foundation
2015-01-21 16:52:24 +00:00
Konstantin Belousov
47671d1bab An update for the i915 GPU driver, which brings the code up to Linux
commit 4d93914ae3db4a897ead4b.  Some related drm infrastructure
changes are imported as needed.

Biggest update is the rewrite of the i915 gem io to more closely
follow Linux model, althought the mechanism used by FreeBSD port is
different.

Sponsored by:	The FreeBSD Foundation
MFC after:	2 month
2015-01-21 16:10:37 +00:00
Kevin Lo
b1d634e627 Typo: ivalid -> invalid. 2015-01-21 09:01:48 +00:00
Ian Lepore
4098ccafa4 Revise the arm bus_space implementation to avoid dereferencing the tag on
every operation to retrieve the bs_cookie value almost nothing actually uses.

The bus_space struct contains a private data pointer (poorly named bs_cookie,
now renamed to bs_privdata) which is used only by a few old armv4 xscale
implementations.  The bus_space functions were all defined to take this
value as the first parameter instead of the bus_space_tag_t, requiring all
the inline macro and function expansions to dereference the tag to pass it
to another function, which never uses it.  Now all the functions take the tag
as the first parameter and retrieve the privdata if they need it.

Also fix a couple bus_space_unmap() implementations that were calling
kva_free() instead of pmap_unmapdev().

Discussed with:	   cognet
2015-01-21 01:06:08 +00:00
Ruslan Bukin
d69eefebd2 o Restore 'goto tr_setup;' when operating in host mode mistakenly
removed in r277414.
o Remove extra parentheses around cases.
2015-01-20 16:30:02 +00:00
Ruslan Bukin
7d502f3285 o Do notify USB host each time we receive 'set packet filter' request.
This makes Mac OS X happy when it returns back from suspending.
o Switch notify state after data is transferred, but not before.
o Consider there is also Super Speed mode.
o Do not set stall bit on any pipes in device mode as Mac OS X seems
  don't support it.

In collaboration with:	hselasky@
2015-01-20 15:45:09 +00:00
Hans Petter Selasky
84e3f97e6d Fix returned data for the USB_GET_DEV_PORT_PATH IOCTL in particular
the value returned in the "udp_port_level" field.

Reported by:	Uffe Jakobsen <uffe@uffe.org>
MFC after:	1 week
2015-01-20 11:43:16 +00:00
Ganbold Tsagaankhuu
e2763dca83 Enable Synopsys DesignWare Mobile Storage Host Controller
driver on Rockchip boards. It currently supports PIO mode
and dma mode needs external dma controller to be used.

Submitted by:   jmcneill
Approved by:    stas (mentor)
2015-01-20 09:07:28 +00:00
Hans Petter Selasky
d39d7c8636 Add missing linuxapi module dependencies and always use the FreeBSD
"MODULE_VERSION" macro definition. Remove the redefinition of the
"MODULE_VERSION" macro from the Linux kernel compatibility API.

MFC after:	1 month
Reported by:	np@
Sponsored by:	Mellanox Technologies
2015-01-19 21:53:00 +00:00
Andrew Turner
09eb425a04 Make the clock-frequency property optional as it may not be present on FDT
systems.

Sponsored by:	The FreeBSD Foundation
2015-01-19 11:06:56 +00:00
Adrian Chadd
b2bdc62a95 Refactor / restructure the RSS code into generic, IPv4 and IPv6 specific
bits.

The motivation here is to eventually teach netisr and potentially
other networking subsystems a bit more about how RSS work queues / buckets
are configured so things have a hope of auto-configuring in the future.

* net/rss_config.[ch] takes care of the generic bits for doing
  configuration, hash function selection, etc;
* topelitz.[ch] is now in net/ rather than netinet/;
* (and would be in libkern if it didn't directly include RSS_KEYSIZE;
  that's a later thing to fix up.)
* netinet/in_rss.[ch] now just contains the IPv4 specific methods;
* and netinet/in6_rss.[ch] now just contains the IPv6 specific methods.

This should have no functional impact on anyone currently using
the RSS support.

Differential Revision:	D1383
Reviewed by:	gnn, jfv (intel driver bits)
2015-01-18 18:06:40 +00:00
Colin Percival
633a28478c When disabling C3+ CPU states due to the CPU_QUIRK_NO_C3 quirk, don't
accidentally enable non-existent states.

This bug was triggered if ACPI advertises the presence of a C2 state
which we fail to parse via acpi_PkgGas due to our lack of support for
FFixedHW resources, and causes an immediate panic when an attempt is
made to enter the (NULL) state.

One affected platform is the EC2 c4.8xlarge VM instance type; there
may be others.

MFC after:	1 week
Thanks to:	jkim, @_msw_
2015-01-18 12:45:26 +00:00
Justin Hibbits
59bb84753c Use proper signed types. The ADT746x uses signed 8-bit numbers for the
temperature.

MFC after:	2 weeks
2015-01-18 07:08:06 +00:00
Ian Lepore
bba987dc50 Add a new SDHCI quirk, SDHCI_QUIRK_DONT_SET_HISPD_BIT. Apparently some
sdhci controllers, such as the one on a Raspberry Pi, mishandle the signal
timing in high speed signaling mode, but run just fine in standard mode
with the bus running at frequencies between 25-50MHz (which shouldn't work).

This is the solution adopted by U-Boot and other OSes (linux and *BSD)
for the timeouts on Raspberry Pi boards with certain SD cards.  Some
research shows that this quirk is also used on a few other boards, so the
fix is a generic quirk instead of being in the RPi-specific driver code.

This change is based on information discovered by Michal Meloun.
2015-01-17 19:57:03 +00:00
Ian Lepore
cf5bb7ca1c Add defines for SDHCI 3.0 controllers.
Submitted by:	Michal Meloun <meloun@miracle.cz>
2015-01-17 18:56:22 +00:00
Ruslan Bukin
b0b74fb366 o Notify USB host about connection when operating in device mode.
Required when communicating to Mac OS X USB host stack.
o Also don't set stall bit to TX pipe in device mode as seems Mac OS X
  don't clears it as it should.

Discussed with:	hselasky@
2015-01-17 12:31:26 +00:00
Adrian Chadd
30696562d3 Oops; correctly reload the CCA registers with the uncapped value
in prep for the next NF calibration pass.

Totally missing braces.  Damn you C.

Submitted by:	Sascha Wildner <swildner@dragonflybsd.org>
MFC after:	1 week
2015-01-17 07:33:02 +00:00
Nathan Whitehorn
d2d3e9b818 Return an appropriate error code in the case of a missing property rather
than random numbers.

MFC after:	1 week
2015-01-17 07:01:51 +00:00
Adrian Chadd
e21928d3c3 Until there's a full MCI implementation - just implement a placeholder
MCI bluetooth coexistence method for WB222.

The rest of MCI requires a bunch more work, including adding a DMA buffer
for the MCI hardware to bounce messages in/out of and handling MCI
interrupts.  But the more important part here is telling the HAL
the btcoex is enabled and MCI is in use so it configures the correct
initial bluetooth parameters in the wireless NIC and configures
things like bluetooth traffic weights and such.

So, this at least gets the HAL to do some of the right things in
configuring the inital bluetooth coexistence stuff, but doesn't
actually do full btcoex.  That'll take.. some effort.

Tested:

* AR9462 (WB222), STA mode
2015-01-17 00:02:18 +00:00
Adrian Chadd
335b1a6beb Add bluetooth MCI coexistence HAL methods - used for AR9462 and AR9565 NICs.
It's found, amongst other things, in the Acer Chromebook (Intel)
devices.

Tested:

* AR9462 (WB222)

Obtained from:	Qualcomm Atheros
2015-01-16 23:47:42 +00:00
Jack F Vogel
dcd7b3b269 Some RSS issues discovered by Adrian, missing header, variable
names fat fingered, incorrect hash config setup. Thanks :)

MFC after: 1 week
2015-01-16 19:11:58 +00:00
Nathan Whitehorn
c884d31122 Add two fake properties ("fdtbootcpu" and "fdtmemreserv") to the device
tree's /chosen node to provide out-of-band header fields of the FDT. This
emulation is not perfect without corresponding changes to ofw_fdt_nextprop(),
but is enough to enable lookup by memory-map-parsing code.

MFC after:	1 week
2015-01-16 18:47:20 +00:00
Hans Petter Selasky
c8563d530c Add more USB device IDs.
Submitted by:	max.n.boyarov@gmail.com
PR:		196362
MFC after:	1 week
2015-01-16 12:16:21 +00:00
Warner Losh
966e729842 Always enable I/O, memory and dma cycles. Some BIOSes don't enable
them, sometimes they are reset for power state transitions or during
whatever happens while suspended. Also, it is good practice to always
do this.
2015-01-16 06:19:52 +00:00
Warner Losh
53d673996b Move the suspsned and resume functions to the bus attachment. They
were accessing PCI config registers, which won't work for the ISA
version.
2015-01-16 06:19:39 +00:00
Warner Losh
47a66ea835 Suspend and resume were the only two functions not to follow the brdev
convention here, so fix that.
2015-01-16 06:19:24 +00:00
Warner Losh
b45c7d14d0 Back out the refactor. It turns out to cause interrupt storms on
resume sometimes (but not others). On powerup, other wierd issues show
up (sometimes the card comes up, but with really bogus pci config
space stuff. There may be more, but given my experience of historical
fussiness, stick to what works and make more minimal changes to that.
2015-01-16 06:19:08 +00:00
Adrian Chadd
3b48f36ef6 Check the right value correctly.
Thanks to clang for pointing out this silliness.
2015-01-16 01:52:26 +00:00
Navdeep Parhar
88d7f6bddf Allow cxgbe(4) to be built on i386. Driver attach will succeed only on a subset
of i386 systems.
2015-01-16 01:32:40 +00:00
Baptiste Daroussin
6455cdfb29 Sound: fix typos in user visible messages etc.
Submitted by:	Sascha Wildner <saw@online.de>
Obtained from:	DragonFly
MFC after:	3 days
2015-01-15 16:09:35 +00:00
Hans Petter Selasky
07dbde6777 Add a kernel function to delist our kernel character devices, so that
the device name can be re-used right away in case we are destroying
the character devices in the background.

MFC after:	4 days
Reported by:	dchagin@
2015-01-14 14:04:29 +00:00
Randall Stewart
d95b3509e1 Update the hwpmc driver to have the new type HASWELL_XEON. Also
go back through HASWELL, IVY_BRIDGE, IVY_BRIDGE_XEON and SANDY_BRIDGE
to straighten out all the missing PMCs. We also add a new pmc tool
pmcstudy, this allows one to run the various formulas from
the documents "Using Intel Vtune Amplifier XE on XXX Generation platforms" for
IB/SB and Haswell. The tool also allows one to postulate your own
formulas with any of the various PMC's. At some point I will enahance
this to work with Brendan Gregg's flame-graphs so we can flamegraph
various PMC interactions. Note the manual page also needs some
work (lots of work) but gnn has committed to help me with that ;-)
Reviewed by: gnn
MFC after:1 month
Sponsored by:	Netflix Inc.
2015-01-14 12:46:58 +00:00
Gleb Smirnoff
501b391d56 Clean some dead code. 2015-01-14 12:46:38 +00:00
Warner Losh
8b91d5b008 Various interrelated fixes to make suspend / resume work better. We now
can suspend / resume and unload / load cbb and cardbus without errors
on my Lenovo T400, which wasn't possible before. Cards suspending
and resuming in the CardBus slot not yet tested.
o Enable memory cycles to the bridge early (as part of the new
  cbb_pci_bridge_init). This fixes the Bad VCC errors which were
  caused by the code accessing the device registers with this
  cleared. The suspend / resume process clears it.
o Refactor suspend / resume into bus specific code (though the ISA
  code is just stubbed). This isn't strictly necessary, but makes
  the initializaiton code more uniform and should be more bullet
  proof in the face of variant behavior among cardbus bridges.
o Fixup comments in the power-up sequence to reflect reality. These
  comments were written for one regime of power-up, but not updated
  as things were revised.
o Add a paranoid small delay (100ms) to cover noisy cards powering
  down.
o Fix some debugging prints to be easier to grep from dmesg.

Sponsored by: Netflix
2015-01-14 05:41:33 +00:00
Warner Losh
8bf007e1e6 Add a rather obnoxious warning if you don't have NEW_PCIB defined
since it's a total crap shoot if things will work.
2015-01-14 05:41:31 +00:00
Jack F Vogel
df1d7a71d4 Cleanup some bogus code in the RSS config, and add the include
for the rss option file. And bump the version.

MFC after:	1 week
2015-01-13 22:13:30 +00:00
Jack F Vogel
6b30e6ae6c Complete the RX side RSS code: parse the encoded portion of the RX
descriptor to determine the correct hash type.

MFC after:1 week
2015-01-13 18:56:29 +00:00
Hans Petter Selasky
b78e84d132 Resolve a special case deadlock: When two or more threads are
simultaneously detaching kernel drivers on the same USB device we can
get stuck in the "usb_wait_pending_ref_locked()" function because the
conditions needed for allowing detach are not met. The "destroy_dev()"
function waits for all system calls involving the given character
device to return. Character device system calls may lock the USB
enumeration lock, which is also held when "destroy_dev()" is
called. This can sometimes lead to a deadlock not noticed by
WITNESS. The current solution is to ensure the calling thread is the
only one holding the USB enumeration lock and prevent other threads
from getting refs while a USB device detach is ongoing. This turned
out not to be sufficient. To solve this deadlock we could use
"destroy_dev_sched()" to schedule the device destruction in the
background, but then we don't know when it is safe to free() the
private data of the character device. Instead a callback function is
executed by the USB explore process to kill off any leftover USB
character devices synchronously after the USB device explore code is
finished and the USB enumeration lock is no longer locked. This makes
porting easier and also ensures us that character devices must
eventually go away after a USB device detach.

While at it ensure that "flag_iserror" is only written when "priv_mtx"
is locked, which is protecting it.

MFC after:	5 days
2015-01-13 16:37:43 +00:00
Navdeep Parhar
e503548810 cxgbe/iw_cxgbe: fix whitespace nit in r277102.
Reported by:	stefanf@
2015-01-13 16:18:31 +00:00
Ruslan Bukin
eff43c7467 Rename Exynos UART driver. No functional change.
Submitted by:	Michal Meloun <meloun@miracle.cz>
2015-01-13 15:04:28 +00:00
Bjoern A. Zeeb
a2cf30b916 Move the vsi variable outside of the #ifdef block to unbreak NOIP kernels
after r277084.

MFC after:	6 days
X-MFC with:	r277084
2015-01-13 14:15:00 +00:00
Ruslan Bukin
3e420a3e12 Add usb template SERIALNET allowing us to have both USB CDC Ethernet
and USB CDC Modem same time by single cable.

Reviewed by:	hselasky@
2015-01-13 14:03:56 +00:00
Konstantin Belousov
43d5c9f65a Complete r277100: add AHCI_Q_ABAR0 tp AHCI_Q_BIT_STRING.
Noted and reviewed by:	smh
MFC after:	6 days
2015-01-13 09:50:15 +00:00
Gleb Smirnoff
9ff0137ec1 Remove unused variables.
CID:	1262431
CID:	1262430
2015-01-13 06:56:04 +00:00
Gleb Smirnoff
01f3b262c4 - Remove unused variable.
- Wrap long line.
2015-01-13 06:22:55 +00:00
Gleb Smirnoff
22064c8f39 Remove unused fields. 2015-01-13 06:22:24 +00:00
Xin LI
25baf019f1 Use the common codepath to handle SIOCGIFADDR.
Before this change, the current code handles SIOCGIFADDR the same
way with SIOCSIFADDR, which involves full arp_ifinit, et al.  They
should be unnecessary for SIOCGIFADDR case.

Differential Revision: https://reviews.freebsd.org/D1508
Reviewed by:	glebius
MFC after:	2 weeks
2015-01-13 05:32:51 +00:00
Navdeep Parhar
b3e112f962 cxgbe/iw_cxgbe: allow any size during the initial MPA exchange.
MFC after:	1 month
2015-01-13 01:40:12 +00:00
Konstantin Belousov
378c532c1f Add quirk to override default BAR(5) rid for AHCI.
Use it for Cavium AHCI.

Submitted by:	Michaе┌ Stanek
Reviewed by:	imp (previous version)
MFC after:	1 week
2015-01-13 00:11:56 +00:00
Zbigniew Bodek
4b3d916086 Introduce ofw_bus_reg_to_rl() to replace part of common bus code
Instead of reusing the same reg parsing code, create one, common function
that puts reg contents to the resource list. Address cells and size cells
are passed rather than acquired here so that any bus can have different
default values.

Obtained from:   Semihalf
Reviewed by:     andrew, ian, nwhitehorn
Sponsored by:    The FreeBSD Foundation
2015-01-13 00:00:09 +00:00
Gleb Smirnoff
7e310d2d50 In miibus(4) drivers provide functions that allow to get NIC
driver name and NIC driver softc via the device(9) tree,
instead of going dirty through the ifnet(9) layer.

Differential Revision:	D1506
Reviewed by:		imp, jhb
2015-01-12 22:27:38 +00:00
Jack F Vogel
845a028fa3 Missing RSS support added, this fixes the build, but the code
in the RX side was complicated by recent changes and will need
some further tweaking.
2015-01-12 20:59:07 +00:00
Jack F Vogel
393c4bb1ba Intel I40E driver updates:
if_ixl to version 1.3.0, if_ixlv to version 1.2.0
	- Major change in both drivers is to add RSS support
	- In ixl fix some interface speed related issues, dual
	  speed was not changing correctly, KR/X media was not
	  displaying correctly (this has a workaround until a
	  more robust media handling is in place)
	- Add a warning when using Dell NPAR and the speed is
	  less than 10G
	- Wrap a queue hung message in IXL_DEBUG, as it is non-fatal,
	  and without tuning can display excessively

MFC after: 1 week
2015-01-12 18:43:34 +00:00
Jack F Vogel
f247dc2523 Update to the shared code for Intel I40E drivers in preparation
for the ixl 1.3.0 and ixlv 1.2.0 revisions.

MFC after:	1 week
2015-01-12 18:32:45 +00:00
Pyun YongHyeon
a2621dd29b Receive filter configuration is done in nge_rxfilter(). Remove
unnecessary filter configuration code in nge_init_locked().
While I'm here add a check for driver running state for multicast
filter handling.  Also remove unnecessary assignment to error
variable since it is cleared in the function entry.

Suggested by:	brad@OpenBSD.org
2015-01-12 07:43:19 +00:00
Pyun YongHyeon
8e5e237669 Enable receive filter in sis_rxfilter().
While I'm here add a check for driver running state for multicast
filter handling.

Suggested by:	brad@OpenBSD.org
2015-01-12 07:37:06 +00:00
Hans Petter Selasky
9f21f476bf Increase the maximum number of dynamic USB quirks. USB memory stick
devices which don't support the synchronize cache SCSI command are
likely to also not support the prevent-allow medium removal SCSI
command.

PR:		185747
MFC after:	1 week
2015-01-12 06:34:23 +00:00
Peter Grehan
7e47312c46 Add PCI ID for the Oxford Semiconductor OXPCIe952 device.
Seen on the StarTech "1 Port Native ExpressCard RS232 Serial AdapterCard
 with 16950 UART"

Reported and tested by:	Michael Dexter
MFC after:	1 week
2015-01-12 03:39:56 +00:00
Ian Lepore
a98788edff Handle the possibility that SDHCI_PLATFORM_START_TRANSFER() can fail, by
moving the handling of curcmd->error != 0 to the end of the interrupt
handler.  Also make sdhci_finish_data() idempotent by moving the setting
of slot->data_done = 1 down past the point where the busdma buffer is
unmapped.  This allows for the possibility that the finish routine can
get called from multiple places when handling errors.
2015-01-11 21:25:03 +00:00
Ian Lepore
5e3dbf8b9f Rate-limit error logging to 5 lines per second, so that when an sdcard
goes bad it doesn't lock up the console with continuous output.
2015-01-11 20:55:16 +00:00
Navdeep Parhar
a5eb009b49 cxgb: replace r273280 with a more comprehensive fix.
Poll for link state when the link is down, even for interrupt capable
PHYs.

Allow PHYs to report a dubious "partial" link.  If this state is seen 3
consecutive times (each check is ~1s apart) then reset the PHY.  This is
a workaround for a situation where repeatedly toggling the link from the
peer gets the AEL2005 PHY into a state where it never establishes a PCS
block lock even when everything is in order.

MFC after:	1 week
2015-01-11 07:51:58 +00:00
Hans Petter Selasky
27aae1967d Add support for USB device side mode to the USB modem driver.
MFC after:	1 week
Submitted by:	br@
2015-01-09 18:40:12 +00:00
Gleb Smirnoff
40c1416a62 Use nitems(). 2015-01-09 12:26:08 +00:00
Kenneth D. Merry
5704e6f06c Close a race in the isp(4) driver that caused devices to disappear
and not automatically come back if they were gone for a short
period of time.

The isp(4) driver has a 30 second gone device timer that gets
activated whenever a device goes away.  If the device comes back
before the timer expires, we don't send a notification to CAM that
it has gone away.  If, however, there is a command sent to the
device while it is gone and before it comes back, the isp(4) driver
sends the command back with CAM_SEL_TIMEOUT status.

CAM responds to the CAM_SEL_TIMEOUT status by removing the device.
In the case where a device comes back within the 30 second gone
device timer window, though, we weren't telling CAM the device
came back.

So, fix this by tracking whether we have told CAM the device is
gone, and if we have, send a rescan if it comes back within the 30
second window.

ispvar.h:
	In the fcportdb_t structure, add a new bitfield,
	reported_gone.  This gets set whenever we return a command
	with CAM_SEL_TIMEOUT status on a Fibre Channel device.

isp_freebsd.c:
	In isp_done(), if we're sending CAM_SEL_TIMEOUT for for a
	command sent to a FC device, set the reported_gone bit.

	In isp_async(), in the ISPASYNC_DEV_STAYED case, rescan the
	device in question if it is mapped to a target ID and has
	been reported gone.

	In isp_make_here(), take a port database entry argument,
	and clear the reported_gone bit when we send a rescan to
	CAM.

	In isp_make_gone(), take a port database entry as an
	argument, and set the reported_gone bit when we send an
	async event telling CAM consumers that the device is gone.

Sponsored by:	Spectra Logic
MFC after:	1 week
2015-01-08 17:51:12 +00:00
Kenneth D. Merry
fb4a43562a Fix Fibre Channel Command Reference Number handling in the isp(4) driver.
The Command Reference Number is used for precise delivery of
commands, and is part of the FC-Tape functionality set.  (This is
only enabled for devices that support precise delivery of commands.)
It is an 8-bit unsigned number that increments from 1 to 255.  The
commands sent by the initiator must be processed by the target in
CRN order if the CRN is non-zero.

There are certain scenarios where the Command Reference Number
sequence needs to be reset.  When the target is power cycled, for
instance, the initiator needs to reset the CRN to 1.  The initiator
will know this because it will see a LIP (when directly connected)
or get a logout/login event (when connected to a switch).

The isp(4) driver was not resetting the CRN when a target
went away and came back.  When it saw the target again after a
power cycle, it would continue the CRN sequence where it left off.
The target would ignore the command because the CRN sequence is
supposed to be reset to 1 after a power cycle or other similar
event.

The symptom that the user would see is that there would be lots of
aborted INQUIRY commands after a tape library was power cycled, and
the library would fail to probe.  The INQUIRY commands were being
ignored by the tape drive due to the CRN issue mentioned above.

isp_freebsd.c:
	Add a new function, isp_fcp_reset_crn().  This will reset
	all of the CRNs for a given port, or the CRNs for all LUNs
	on a target.

	Reset the CRNs for all targets on a port when we get a LIP,
	loop reset, or loop down event.

	Reset the CRN for a particular target when it arrives, is changed
	or departs.  This is less precise behavior than the
	clearing behavior specified in the FCP-4 spec (which says
	that it should be reset for PRLI, PRLO, PLOGI and LOGO),
	but this is the level of information we have here.  If this
	is insufficient, then we will need to add more precise
	notification from the lower level isp(4) code.

isp_freebsd.h:
	Add a prototype for isp_fcp_reset_crn().

Sponsored by:	Spectra Logic
MFC after:	1 week
2015-01-08 17:41:28 +00:00
Hans Petter Selasky
f880872647 Fix misleading comment.
MFC after:	1 week
Reported by:	rpaulo@
2015-01-08 00:12:54 +00:00
Hans Petter Selasky
8086e9f493 Fix handling of an error case when the MUSB driver is operating in USB
device side mode.

MFC after:	1 week
Reported by:	br@
2015-01-08 00:11:11 +00:00
Xin LI
a1ff3f20f9 Fix sos@'s name.
MFC after:	2 weeks
2015-01-07 21:44:57 +00:00
Navdeep Parhar
db8bcd1b21 cxgbe/tom: allocate page pod addresses instead of ppod#.
MFC after:	2 weeks
2015-01-07 06:20:33 +00:00
John Baldwin
d17591488e Remove compat shims for FreeBSD versions older than 6 (really early 5).
The only diffs in the disassembly were different line numbers passed to
lock functions.
2015-01-06 15:48:20 +00:00
John Baldwin
7fc5f32950 Use struct thread directly instead of d_thread_t. This driver is not
likely to be backported to 4.x.

Reviewed by:	kadesai
2015-01-06 15:41:23 +00:00
Robert Watson
2a8c860fe3 In order to reduce use of M_EXT outside of the mbuf allocator and
socket-buffer implementations, introduce a return value for MCLGET()
(and m_cljget() that underlies it) to allow the caller to avoid testing
M_EXT itself.  Update all callers to use the return value.

With this change, very few network device drivers remain aware of
M_EXT; the primary exceptions lie in mbuf-chain pretty printers for
debugging, and in a few cases, custom mbuf and cluster allocation
implementations.

NB: This is a difficult-to-test change as it touches many drivers for
which I don't have physical devices.  Instead we've gone for intensive
review, but further post-commit review would definitely be appreciated
to spot errors where changes could not easily be made mechanically,
but were largely mechanical in nature.

Differential Revision:	https://reviews.freebsd.org/D1440
Reviewed by:	adrian, bz, gnn
Sponsored by:	EMC / Isilon Storage Division
2015-01-06 12:59:37 +00:00
Navdeep Parhar
f8c479085f cxgbe/tom: use vmem(9) as the DDP page pod allocator.
MFC after:	1 month
2015-01-06 01:30:32 +00:00
Navdeep Parhar
008015d2f4 cxgbe(4): fix the description of a strange bunch of counters.
MFC after:	1 week
2015-01-05 23:43:24 +00:00
Nathan Whitehorn
08b96b9ff5 Restore use of ofw_bus_intr_to_rl() in the pseries vdevice driver after fixing
ofw_bus_intr_to_rl() to match the spec for unspecified interrupt-parent
properties.
2015-01-05 21:39:35 +00:00
John Baldwin
92597e064b On some Intel CPUs with a P-state but not C-state invariant TSC the TSC
may also halt in C2 and not just C3 (it seems that in some cases the BIOS
advertises its C3 state as a C2 state in _CST).  Just play it safe and
disable both C2 and C3 states if a user forces the use of the TSC as the
timecounter on such CPUs.

PR:		192316
Differential Revision:	https://reviews.freebsd.org/D1441
No objection from:	jkim
MFC after:	1 week
2015-01-05 20:44:44 +00:00
Hans Petter Selasky
b217d18412 Add 64-bit DMA support in the XHCI controller driver.
- Fix some comments and whitespace while at it.

MFC after:	1 month
Submitted by:	marius@
2015-01-05 20:22:18 +00:00
John Baldwin
f045564dbb Use struct thread * directly instead of d_thread_t. This driver is not
likely to be merged back to stable/4.

Reviewed by:	delphij
2015-01-05 19:49:20 +00:00
Ruslan Bukin
1aac28e753 o Switch to use non-mergeable RX buffers to avoid mbuf adjustment needs
o Operate with copy of iov as we expect later it was not modified
2015-01-05 16:43:22 +00:00
Hans Petter Selasky
ece4b0bd43 Make a bunch of USB debug SYSCTLs tunable, so that their value(s) can
be set before the USB device(s) are probed.
2015-01-05 15:04:17 +00:00
Robert Watson
ed6a66ca6c To ease changes to underlying mbuf structure and the mbuf allocator, reduce
the knowledge of mbuf layout, and in particular constants such as M_EXT,
MLEN, MHLEN, and so on, in mbuf consumers by unifying various alignment
utility functions (M_ALIGN(), MH_ALIGN(), MEXT_ALIGN() in a single
M_ALIGN() macro, implemented by a now-inlined m_align() function:

- Move m_align() from uipc_mbuf.c to mbuf.h; mark as __inline.
- Reimplement M_ALIGN(), MH_ALIGN(), and MEXT_ALIGN() using m_align().
- Update consumers around the tree to simply use M_ALIGN().

This change eliminates a number of cases where mbuf consumers must be aware
of whether or not mbufs returned by the allocator use external storage, but
also assumptions about the size of the returned mbuf. This will make it
easier to introduce changes in how we use external storage, as well as
features such as variable-size mbufs.

Differential Revision:	https://reviews.freebsd.org/D1436
Reviewed by:	glebius, trasz, gnn, bz
Sponsored by:	EMC / Isilon Storage Division
2015-01-05 09:58:32 +00:00
Nathan Whitehorn
f1d2752f31 Make PS3 work with the userspace kboot loader. loader.ps3 will disappear
from the tree in the near future.

Done at:	Hackathon
2015-01-05 00:50:16 +00:00
Ruslan Bukin
2499610b9a Do not configure Altera PIO device on ARM startup.
PIO is a device implemented in soft-core and becomes
available after flashing FPGA only.
2015-01-04 23:14:04 +00:00
Hans Petter Selasky
abfa11d612 Make sure an error case exits unlocked.
Submitted by:	Dmitry Luhtionov <dmitryluhtionov@gmail.com>
MFC after:	1 week
2015-01-03 11:04:17 +00:00
Navdeep Parhar
79b93bf6a3 cxgbe/tom: do not engage the TOE's payload chopper for payload < 2 MSS
or for 10Gbps ports.

MFC after:	2 weeks
2015-01-03 00:09:21 +00:00
Luiz Otavio O Souza
7eae632303 puc(4): Add an entry for the Feasso PCI FPP-02 2S1P card.
MFC after:	1 week
2015-01-02 22:45:55 +00:00
Navdeep Parhar
402873f32a cxgbe/tom: fix the MSS calculation for IPv6 connections handled by the TOE.
MFC after:	1 week
2015-01-02 21:13:24 +00:00
Navdeep Parhar
dd1be4d418 cxgbe/tom: log some more details in send_flowc_wr.
MFC after:	1 week
2015-01-02 20:52:51 +00:00
Robert Watson
fe522dc9e3 In mbuf_to_synq_entry(), use M_START() and M_SIZE() to calculate an offset
into mbuf storage, to reduce knowledge about mbuf/cluster layout in the
cxgb device driver.

Reviewed by:	np
Sponsored by:	EMC / Isilon Storage Division
2015-01-02 19:06:27 +00:00
Hans Petter Selasky
110cd60a28 The "vt_suspend_flush_timer()" function is sometimes called locked
which prevents us from doing a "callout_drain()" call. The callout in
question has a lock associated with it and we are not freeing the
callout. That means we can use the "callout_stop()" function to
atomically stop the callback iff the "callout_stop()" function is
called locked. This patch applies proper locking to "callout_stop()"
and replaces a "callout_drain()" with a "callout_stop()".

MFC after:    1 week
2015-01-02 13:35:10 +00:00
Hans Petter Selasky
f515135ff9 Remove duplicate pci_driver class declaration. 2015-01-02 08:57:36 +00:00
Scott Long
2089f5380f Garbage collect the asr driver. Hardware for it has not been produced in
roughly 10 years, and the driver has not enjoyed any significant maintenance
since long before that.  Despite well-meaning efforts from a number of
people, myself included, it never made the jump to 64-bit and was relegated
to the back-corners of i386.  Now its frailty is hampering forward progress
with Clang.  Any renewed engineering efforts are of course welcome and can
happen outside of the tree.  No MFC of this is planned.
2015-01-02 05:34:14 +00:00
Nathan Whitehorn
5499037c63 The path entry for a device tree node and its name property are usually,
but not always, identical. In particular, the path entry may contain a
unit address that the name does not. If the FDT node does have an explicit
name property, treat that as an override of the FDT path rather than
ignoring it.

MFC after:	2 weeks
2015-01-01 22:20:19 +00:00
Navdeep Parhar
255155fc91 cxgbe(4): remove buf_ring specific restriction on the txq size.
MFC after:	2 months
2015-01-01 09:33:46 +00:00
Bryan Venteicher
ab4c2818f2 Add softc flag for when the indirect descriptor feature was negotiated
MFC after:	2 weeks
2015-01-01 02:06:00 +00:00
Bryan Venteicher
5b32b2faaa Use the appropriate IPv4 or IPv6 TSO HW assist flag
MFC after:	2 weeks
2015-01-01 02:03:09 +00:00
Navdeep Parhar
7951040f8a cxgbe(4): major tx rework.
a) Front load as much work as possible in if_transmit, before any driver
lock or software queue has to get involved.

b) Replace buf_ring with a brand new mp_ring (multiproducer ring).  This
is specifically for the tx multiqueue model where one of the if_transmit
producer threads becomes the consumer and other producers carry on as
usual.  mp_ring is implemented as standalone code and it should be
possible to use it in any driver with tx multiqueue.  It also has:
- the ability to enqueue/dequeue multiple items.  This might become
  significant if packet batching is ever implemented.
- an abdication mechanism to allow a thread to give up writing tx
  descriptors and have another if_transmit thread take over.  A thread
  that's writing tx descriptors can end up doing so for an unbounded
  time period if a) there are other if_transmit threads continuously
  feeding the sofware queue, and b) the chip keeps up with whatever the
  thread is throwing at it.
- accurate statistics about interesting events even when the stats come
  at the expense of additional branches/conditional code.

The NIC txq lock is uncontested on the fast path at this point.  I've
left it there for synchronization with the control events (interface
up/down, modload/unload).

c) Add support for "type 1" coalescing work request in the normal NIC tx
path.  This work request is optimized for frames with a single item in
the DMA gather list.  These are very common when forwarding packets.
Note that netmap tx in cxgbe already uses these "type 1" work requests.

d) Do not request automatic cidx updates every 32 descriptors.  Instead,
request updates via bits in individual work requests (still every 32
descriptors approximately).  Also, request an automatic final update
when the queue idles after activity.  This means NIC tx reclaim is still
performed lazily but it will catch up quickly as soon as the queue
idles.  This seems to be the best middle ground and I'll probably do
something similar for netmap tx as well.

e) Implement a faster tx path for WRQs (used by TOE tx and control
queues, _not_ by the normal NIC tx).  Allow work requests to be written
directly to the hardware descriptor ring if room is available.  I will
convert t4_tom and iw_cxgbe modules to this faster style gradually.

MFC after:	2 months
2014-12-31 23:19:16 +00:00
Marius Strobl
c22626471e - Switching the mode of Ricoh R5CE823 to SD2.0 causes their PCI device ID
to change to 0xe822, which may be persistent across reboots and, thus,
  confuse other OSes. Therefore, restore the original mode and frequency
  setting on detach and shutdown.
- Report Ricoh R5CE822 as such.
- According to Linux, Ricoh R5CE822 also need SDHCI_QUIRK_LOWER_FREQUENCY.
- Nuke an unused softc member.

MFC after:	3 days
2014-12-31 16:06:26 +00:00
Andrew Turner
7c5c5b97fe Set the page size in the virtio-mmio driver. Some backends, e.g QEMU, assume
a 1 byte page size until told otherwise.

Sponsored by:	The FreeBSD Foundation
2014-12-30 12:47:44 +00:00
Hans Petter Selasky
454035ba1b Allow systems having a page size greater than 4K to use fewer
scatter-gather XHCI TRB entries for its payload data. The XHCI
controller can handle at least 65536 bytes per scatter-gather list
entry.

MFC after:	1 week
Suggested by:	Kohji Okuno <okuno.kohji@jp.panasonic.com>
2014-12-30 09:20:29 +00:00
Roger Pau Monné
bc59086c88 vt_vga: fix an off-by-one error
This correctly sets the end of the memory region registered by vt_vga.

Reported by:	marius
2014-12-30 08:50:50 +00:00
Roger Pau Monné
3761128490 Partially revert "vt: register the memory regions used by the vt drivers"
Revert the EFI part of r276064 until I can test it properly on a real EFI
system. This was causing problems to people booting using UEFI and vt.

Reported by:	O. Hartmann <ohartman@zedat.fu-berlin.de>
2014-12-30 08:50:07 +00:00
Hans Petter Selasky
91cccb29c1 Add missed flushing of data which can happen when "xhci_configure_mask()"
is called from "xhci_configure_reset_endpoint()". Ensure the 3-strikes
error feature is always enabled except for ISOCHRONOUS transfers.

MFC after:	1 week
Suggested by:	marius@
2014-12-30 08:33:51 +00:00
Andrew Turner
e51f2e72db Attach vtnet to virtio_mmio. Qemu provides this as an option with AArch64.
Sponsored by:	The FreeBSD Foundation
2014-12-29 17:17:01 +00:00
Andrew Turner
82ba170c6e Allow virtio_mmio to attach to ofwbus. Qemu places these here on at least
the AArch64 virtual platform with the Linaro UEFI.

Sponsored by:	The FreeBSD Foundation
2014-12-29 11:02:18 +00:00
Bryan Venteicher
f83577167c Remove dev/virtio/virtio.h include from BERI VirtIO
This header file contains prototypes and defines that only make
sense to the guest VirtIO device drivers.

Reviewed by:	br
2014-12-29 00:35:44 +00:00
Marius Strobl
393677427c Don't use a sub-device/-vendor wildcard for probing MCS9922 as other
chips with the same device and vendor IDs actually may provide different
functionality. While at it, canonicalize the description to match other
MosChip UARTs.

PR:		186891
MFC after:	3 days
2014-12-28 21:36:20 +00:00
Marius Strobl
21190895ab - Const'ify the ahci_ids table.
- Use DEVMETHOD_END.
- Use NULL instead of 0 for pointers.

MFC after:	3 days
2014-12-28 20:42:28 +00:00
Marius Strobl
dcf83ff0e9 Improve/fix interrupt allocation/setup/release:
- Simplify MSI allocation to what is actually needed for a single one.
- Release the MSI and the corresponding bus resource as appropriate when
  either the interrupt resource cannot be allocated or setting up the
  interrupt fails.
- Error out when interrupt allocation or setup fails and polling is
  disabled.
- Release the MSI after the corresponding bus resource so the former is
  not leaked on detach.
- Remove a redundant softc member.

MFC after:	3 days
2014-12-27 21:50:47 +00:00
Marius Strobl
535508f74a Const'ify a firmware image missed in r251142.
MFC after:	3 days
2014-12-27 18:24:15 +00:00
Marius Strobl
40438c4761 - Make PCI_QUIRK_MSI_INTX_BUG work by using the ID of the actual PCI device
for the lookup.
- For devices affected by PCI_QUIRK_MSI_INTX_BUG, ensure PCIM_CMD_INTxDIS
  is cleared when using MSI/MSI-X.
- Employ PCI_QUIRK_MSI_INTX_BUG for BCM5714(S)/BCM5715(S)/BCM5780(S) rather
  than clearing PCIM_CMD_INTxDIS unconditionally for all devices in bge(4).

MFC after:	3 days
2014-12-27 14:26:18 +00:00
Ed Maste
a09a539f06 Support ALT_BREAK_TO_DEBUGGER in vt(4)
Submitted by:	Andre Albsmeier on -hackers
2014-12-27 04:21:24 +00:00
Hans Petter Selasky
f0442cf2e0 Add more USB devices.
MFC after:	1 day
Submitted by:	Dmitry Luhtionov <dmitryluhtionov@gmail.com>
2014-12-26 10:57:39 +00:00
Hans Petter Selasky
7e19194edf Add more quirks.
PR:		180617
MFC after:	1 day
2014-12-26 10:53:22 +00:00
Poul-Henning Kamp
c05bafc566 Deorbit the IEEE-488/GPIB support. 2014-12-25 20:15:13 +00:00
Scott Long
23059fc77f Fix tunable and sysctl handling of the fail_on_task_timeout knob.
Reviewed by:	emax
Obtained from:	Netflix, Inc.
MFC after:	3 days
2014-12-24 07:04:04 +00:00
Warner Losh
aa6b24dc9a Add Intel vendor ID to the device table to make it more uniform so
that all the pnp info to match the device is in the fxp_ident_table.
2014-12-24 03:49:33 +00:00
Luiz Otavio O Souza
0bac52c1cc Improves the GPIO API description a little bit.
gpio_pin_max must return the maximum supported pin number and not the total
number of pins on the system.

PR:		157070
Submitted by:	brix
2014-12-24 03:24:50 +00:00
Ian Lepore
cbe686f709 Don't assume required FDT properties are present. 2014-12-24 01:19:11 +00:00
Adrian Chadd
70bd9518f1 Bump the valid GPIO range for rfkill up from 8 to 16.
AR5416 and later NICs have more than 8 (Well, more than 6) GPIO pins.
So to support rfkill on these NICs we need to bump this up or the
rfkill GPIO pin may get reset to the wrong value.

Noticed by: Anthony Jenkins <scoobi_doo@yahoo.com>
2014-12-23 18:48:45 +00:00
Warner Losh
3e834dd35d Always select the card before we do the 4.x specific stuff and
deselect it after setting the block size. This is a similar bug that
was fixed elsewhere, but not here. This makes sure that we leave the
card deselected at the end of the loop, and we don't send any commands
to the card without it selected.

Reviewed by: ian@
2014-12-23 05:50:53 +00:00
John Baldwin
51f2504057 Explicitly treat timeouts when waiting for IBF or OBF to change state as an
error.  This fixes occasional hangs in the IPMI kcs thread when using
ipmitool locally.

MFC after:	1 week
2014-12-22 16:53:04 +00:00
Roger Pau Monné
acb332a8a1 vt: register the memory regions used by the vt drivers
Current VT drivers don't register the memory regions they use with the
nexus. This patch makes vt_vga and vt_efifb register the memory regions they
use.

This is needed (at least) for Xen support, since the FreeBSD kernel will try
to use the holes in the memory map to map memory from other domains and
setup it's grant table.

Sponsored by:		Citrix Systems R&D
Reported by:		sbruno
Tested by:		emaste
Reviewed by:		ray
PR:			195537
Differential Revision:	https://reviews.freebsd.org/D1291
2014-12-22 16:46:07 +00:00
Ian Lepore
734ba86366 Eliminate a "cast discards qualifiers" warning when building with gcc. 2014-12-21 21:24:19 +00:00
Steven Hartland
e4a8f2e2ec style (9) nits
Use return (val); instead of return val;

Differential Revision:	D838
MFC after:	2 weeks
Sponsored by:	Multiplay
2014-12-21 16:38:29 +00:00
Steven Hartland
5f59ea478e Return the error from ahci_setup_interrupt in ahci_attach
Previously ahci_attach returned a hard coded ENXIO instead of the value
from ahci_setup_interrupt. This is effectively a NOOP change as currently
ahci_setup_interrupt only ever returns 0 or ENXIO, so just there to protect
against any future changes to that.

Differential Revision:	D838
MFC after:	2 weeks
Sponsored by:	Multiplay
2014-12-21 16:32:57 +00:00
Steven Hartland
a12f5777df Clamp ahci max irq's to AHCI_MAX_IRQS
This prevents the possiblity of any overruns on the statically allocated
struct irqs field.

Differential Revision:	D838
MFC after:	2 weeks
X-MFC-With:	r276012
Sponsored by:	Multiplay
2014-12-21 16:15:29 +00:00
Steven Hartland
55972826f2 Add a constant AHCI_MAX_IRQS removing magic number
Sponsored by:	Multiplay
2014-12-21 16:07:46 +00:00
Adrian Chadd
e54c8bda3e Remove some hard-coded IE assembly over to use net80211 methods.
PR:		kern/196069
Submitted by:	 Andriy Voskoboinyk <s3erios@gmail.com>
2014-12-20 20:07:48 +00:00
Konstantin Belousov
77b14d8df1 Increase allowed size of the microcode blob to 32KB. Some Intel CPU's
updates weight 28KB.

PR:	179523
MFC after:	1 week
2014-12-20 16:40:49 +00:00
Ian Lepore
dc47198f50 Log mmc and sd command failures. Reporting of routine expected errors,
such as timeouts while probing a bus or testing for a feature, is
squelched.  Also, error reporting is limited to 5 events per second,
because when an sdcard goes bad on a low-end embedded board, flooding
the console at high speed isn't helpful.

Original logging code contributed by Michal Meloun, but then I fancied
it up with squelching and ppsratecheck.
2014-12-20 04:24:40 +00:00
Ian Lepore
61bc42f782 Add a new sdhci quirk, SDHCI_QUIRK_WAITFOR_RESET_ASSERTED, to work around
TI OMAP controllers which will return the reset-in-progress bit as zero if
you read the status register too fast after setting the reset bit.

The zero is apparently from a stale snapshot of the internal state presented
in the interface register, and leads to a false indication that the reset
is complete when it either hasn't started yet or is in-progress.  The
workaround is to first loop until the bit is seen as asserted, then do the
normal loop waiting to see it de-asserted.

Submitted by:	Michal Meloun <meloun@miracle.cz>
2014-12-20 01:13:13 +00:00
Ian Lepore
7e5866432f When command and data interrupts have been aggregated together, don't do
the data-completed processing if a command-error interrupt is also asserted.

Reviewed by:	Michal Meloun <meloun@miracle.cz>
2014-12-20 00:37:56 +00:00
Andrew Turner
30ef1a05c2 Add support for empty ranges properties within the tree, some vendor
device trees have these, for example the ARM AArch64 Foundation Model.

Sponsored by:	The FreeBSD Foundation
2014-12-19 13:07:36 +00:00
Adrian Chadd
bbd01a4100 Remove a private copy of ieee80211_add_ssid().
PR:		kern/196116
Submitted by:	Andriy Voskoboinyk <s3erios@gmail.com>
2014-12-19 01:41:51 +00:00
Alexander Motin
3f9e1172b7 Slightly polish iSCSI parameters negotiation.
MFC after:	1 week
2014-12-19 01:12:22 +00:00
Warner Losh
b9a2a3f1cf Don't deselect the card too soon. To set the block size or switch the
function parameters, the card has to be in transfer state. If it is in
the idle state, the commands are ignored. This caused us not to set
the proper parameters that we later assume to be present, leading to
downstream failures of the card / interface as our state machine
mismatches the card's.

Submitted by: Svatopluk Kraus <onwahe at gmail.com>, Michal Meloun
<meloun at miracle.cz>
2014-12-18 16:57:22 +00:00
Adrian Chadd
d13ccc6ac2 Update the use of bus space macros to be more correct.
This was a problem on i386 PAE builds.
2014-12-17 21:27:27 +00:00
Adrian Chadd
e03905177a Use the correct macro for listing the maximum bus space size.
Without this, it fails to compile on i386 PAE builds.
2014-12-17 21:26:25 +00:00
Alexander Motin
2124e3b07f Make sequence numbers checks more strict.
While we don't support MCS, hole in received sequence numbers may mean
only PDU loss.  While we don't support lost PDU recovery, terminate the
connection to avoid stuck commands.

While there, improve handling of sequence numbers wrap after 2^32 PDUs.

MFC after:	2 weeks
2014-12-17 15:13:21 +00:00
Gleb Kurtsou
dde58752db Adjust printf format specifiers for dev_t and ino_t in kernel.
ino_t and dev_t are about to become uint64_t.

Reviewed by:	kib, mckusick
2014-12-17 07:27:19 +00:00
Pyun YongHyeon
e01343ccd7 Fix a bug introdiced in r217548. According to NS DP83815 data
sheet, RX filter should be disabled before programming.
Previously it was clearing wrong bits so RX filter was not
disabled in RX filter configuration.

Reported by:	brad@OpenBSD.org
2014-12-16 06:13:30 +00:00
Ed Maste
55629a87ab Use standard BSD license disclaimer text
Approved by:	benno, nwhitehorn
2014-12-15 22:20:14 +00:00
John Baldwin
5ad25ceb41 Check for SS_NBIO in so->so_state instead of sb->sb_flags in
soreceive_stream().

Differential Revision:	https://reviews.freebsd.org/D1299
Reviewed by:	bz, gnn
MFC after:	1 week
2014-12-15 17:52:08 +00:00
Ruslan Bukin
ba2ea14a6a Eliminate fdt_data_verify(). The verification it proceed is wrong
disallowing us to encode 64-bit register numbers.

Discussed with:	nwhitehorn, andrew
2014-12-15 09:40:25 +00:00
Hans Petter Selasky
3d9b56b045 Resolve USB driver identification conflict.
Reported by:	Anish Mistry <amistry@am-productions.biz>
MFC after:	1 week
2014-12-15 09:23:40 +00:00
Rui Paulo
5cead939e9 Move ofw_cpu.c to sys/dev/ofw so that it can be used by other
architectures.

Differential Revision:	https://reviews.freebsd.org/D1307
Reviewed by:	jhibbits
2014-12-14 22:41:08 +00:00
Navdeep Parhar
a7570ee305 Move KTR_CXGBE from t4_tom.h to adapter.h so that the base if_cxgbe
code can use it too.

MFC after:	1 week
2014-12-12 21:54:59 +00:00
Ruslan Bukin
156b97fa1f Add virtio bus 'poll' method allowing us to inform backend we are
going to poll virtqueue.

Use on BERI soft-core to invalidate cpu caches.

Reviewed by:	bryanv
Sponsored by:	DARPA, AFRL
2014-12-12 11:19:10 +00:00
Roger Pau Monné
1093cd82e0 xen: convert the Grant-table code to a NewBus device
This allows the Grant-table code to attach directly to the xenpv bus,
allowing us to remove the grant-table initialization done in xenpv.

Sponsored by: Citrix Systems R&D
2014-12-10 11:35:41 +00:00
Ruslan Bukin
74953fa3ca o Put () for p to avoid unexpected macro expansion
o style(9) fix

Submitted by:	Yonghyeon PYUN <pyunyh@gmail.com>
2014-12-10 11:35:10 +00:00
Roger Pau Monné
0767e98a2d xen: move grant table code
Mave the grant table code into the dev/xen folder in preparation for turning
it into a device using the newbus interface. This is just code motion, no
functional changes.

Sponsored by: Citrix Systems R&D
2014-12-10 11:21:52 +00:00
Roger Pau Monné
f35b3592e6 xen: create a new PCI bus override
When running as a Xen PVH Dom0 we need to add custom buses that override
some of the functionality present in the ACPI PCI Bus and the PCI Bus. We
currently override the ACPI PCI Bus, but not the PCI Bus, so add a new
override for the PCI Bus and share the generic functions between them.

Reported by: David P. Discher <dpd@dpdtech.com>
Sponsored by: Citrix Systems R&D

conf/files.amd64:
 - Add the new files.

x86/xen/xen_pci_bus.c:
 - Generic file that contains the PCI overrides so they can be used by the
   several PCI specific buses.

xen/xen_pci.h:
 - Prototypes for the generic overried functions.

dev/xen/pci/xen_pci.c:
 - Xen specific override for the PCI bus.

dev/xen/pci/xen_acpi_pci.c:
 - Xen specific override for the ACPI PCI bus.
2014-12-09 18:03:25 +00:00
Ruslan Bukin
a8098016f1 o Add BERI Virtio Networking Frontend (if_vtbe)
o Move similar block/networking methods to common file
o Follow r275640 and correct MMIO registers width
o Pass value to MMIO platform_note method.

Sponsored by:	DARPA, AFRL
2014-12-09 16:39:21 +00:00
Mark Peek
8723d2f43c Rename NETGEAR WG111V2_2 to WG111V1_2 to reflect external naming.
Reviewed by:	kevlo
2014-12-09 15:26:04 +00:00
Andrew Turner
4dbff2397e Update the virtio driver to work on the ARM AArch64 Foundation Model.
There are two main parts to get it to work, 1) most of the register
accesses need to be word sized, other than the config register which
needs to be byte aligned, and 2) we don't need the platform driver
for this to work on the Foundation Model, allow it to be NULL.

Differential Revision:	https://reviews.freebsd.org/D1240
Reviewed by:	bryanv
Sponsored by:	The FreeBSD Foundation
2014-12-09 10:31:35 +00:00
Hans Petter Selasky
979d0afa7c Add port routing support for Wildcat Point.
PR:		195793
MFC after:	1 week
2014-12-08 21:14:13 +00:00
Hans Petter Selasky
431088e693 Add more U3G USB IDs.
Submitted by:	Benediktus Anindito <bennybroz105@gmail.com>
MFC after:	1 week
2014-12-08 10:49:23 +00:00
Hans Petter Selasky
cfb1395111 Add more USB quirks for Western Digital external USB HDD
enclosures. Rename an incorrectly named device. Increase
limit for maximum number of quirks.

PR:	    178771, 180617
MFC after:  2 weeks
2014-12-08 10:41:34 +00:00
Navdeep Parhar
b741402c40 cxgbe(4): allow the driver to use rx buffers that do not end on a pack
boundary.

MFC after:	2 weeks
2014-12-06 01:47:38 +00:00
Navdeep Parhar
e3207e1973 cxgbe(4): Allow for different pad and pack boundaries for different
adapters.  Set the pack boundary for T5 cards to be the same as the
PCIe max payload size.  The chip likes it this way.

In this revision the driver allocate rx buffers that align on both
boundaries.  This is not a strict requirement and a followup commit
will switch the driver to a more relaxed allocation strategy.

MFC after:	2 weeks
2014-12-06 00:13:56 +00:00
Hans Petter Selasky
654ea8e767 Optimise bit searching loop by using the ffs() function.
Make some related bit shifts unsigned while at it.
2014-12-05 12:07:53 +00:00
Hans Petter Selasky
157675bd2d Optimise the bit searching loops, by quickly skipping the 16 first set
bits if all the 16 first bits are set. This way the worst case
searching time is reduced from 32 to 16 cycles.
2014-12-03 21:55:44 +00:00
Hans Petter Selasky
e93086d0bf Workaround for possible bug in the SAF1761 chip. Wait 125us before
re-using a hardware propritary transfer descriptor, PTD, in USB host
mode. If the PTD's are recycled too quickly, it has been observed that
the hardware simply fails to schedule the requested job or resets
completely disconnecting all devices.
2014-12-03 21:48:30 +00:00
Warner Losh
86fd88736f Remove unused PCMCIA_CARD* macros.
Always include the card human readable name. We support ~270 cards and
at ~20 bytes each, this bloats things by only ~5k. Retain the
PCMCIA_CARD vs PCMCIA_CARD_D distinction, though, in case this is
intolerable.
2014-12-03 00:47:05 +00:00
Jack F Vogel
4da1bbcda5 Revert r275136, it was not approved, it was sloppy, if a feature
like this is needed please resubmit for Intel's approval.
2014-12-02 23:02:57 +00:00
Hans Petter Selasky
c25290420e Start process of removing the use of the deprecated "M_FLOWID" flag
from the FreeBSD network code. The flag is still kept around in the
"sys/mbuf.h" header file, but does no longer have any users. Instead
the "m_pkthdr.rsstype" field in the mbuf structure is now used to
decide the meaning of the "m_pkthdr.flowid" field. To modify the
"m_pkthdr.rsstype" field please use the existing "M_HASHTYPE_XXX"
macros as defined in the "sys/mbuf.h" header file.

This patch introduces new behaviour in the transmit direction.
Previously network drivers checked if "M_FLOWID" was set in "m_flags"
before using the "m_pkthdr.flowid" field. This check has now now been
replaced by checking if "M_HASHTYPE_GET(m)" is different from
"M_HASHTYPE_NONE". In the future more hashtypes will be added, for
example hashtypes for hardware dedicated flows.

"M_HASHTYPE_OPAQUE" indicates that the "m_pkthdr.flowid" value is
valid and has no particular type. This change removes the need for an
"if" statement in TCP transmit code checking for the presence of a
valid flowid value. The "if" statement mentioned above is now a direct
variable assignment which is then later checked by the respective
network drivers like before.

Additional notes:
- The SCTP code changes will be committed as a separate patch.
- Removal of the "M_FLOWID" flag will also be done separately.
- The FreeBSD version has been bumped.

MFC after:	1 month
Sponsored by:	Mellanox Technologies
2014-12-01 11:45:24 +00:00
Bryan Venteicher
abec64bc76 Cleanup and performance improvement of the virtio_blk driver
- Add support for GEOM direct completion. Depending on the benchmark,
    this tends to give a ~30% improvement w.r.t IOPs and BW.
  - Remove an invariants check in the strategy routine. This assertion
    is caught later on by an existing panic.
  - Rename and resort various related functions to make more sense.

MFC after:	1 month
2014-11-30 16:36:26 +00:00
Gleb Smirnoff
651e4e6a30 Merge from projects/sendfile: extend protocols API to support
sending not ready data:
o Add new flag to pru_send() flags - PRUS_NOTREADY.
o Add new protocol method pru_ready().

Sponsored by:	Nginx, Inc.
Sponsored by:	Netflix
2014-11-30 13:24:21 +00:00
Gleb Smirnoff
0f9d0a73a4 Merge from projects/sendfile:
o Introduce a notion of "not ready" mbufs in socket buffers.  These
mbufs are now being populated by some I/O in background and are
referenced outside.  This forces following implications:
- An mbuf which is "not ready" can't be taken out of the buffer.
- An mbuf that is behind a "not ready" in the queue neither.
- If sockbet buffer is flushed, then "not ready" mbufs shouln't be
  freed.

o In struct sockbuf the sb_cc field is split into sb_ccc and sb_acc.
  The sb_ccc stands for ""claimed character count", or "committed
  character count".  And the sb_acc is "available character count".
  Consumers of socket buffer API shouldn't already access them directly,
  but use sbused() and sbavail() respectively.
o Not ready mbufs are marked with M_NOTREADY, and ready but blocked ones
  with M_BLOCKED.
o New field sb_fnrdy points to the first not ready mbuf, to avoid linear
  search.
o New function sbready() is provided to activate certain amount of mbufs
  in a socket buffer.

A special note on SCTP:
  SCTP has its own sockbufs.  Unfortunately, FreeBSD stack doesn't yet
allow protocol specific sockbufs.  Thus, SCTP does some hacks to make
itself compatible with FreeBSD: it manages sockbufs on its own, but keeps
sb_cc updated to inform the stack of amount of data in them.  The new
notion of "not ready" data isn't supported by SCTP.  Instead, only a
mechanical substitute is done: s/sb_cc/sb_ccc/.
  A proper solution would be to take away struct sockbuf from struct
socket and allow protocols to implement their own socket buffers, like
SCTP already does.  This was discussed with rrs@.

Sponsored by:	Netflix
Sponsored by:	Nginx, Inc.
2014-11-30 12:52:33 +00:00
Eygene Ryabinkin
317d2b1e5c DRM2: fix off-by-one overflow in ioctl processing
Call to the driver-specific ioctl used to process ioctl number
that will lead to the out-of-bounds access to the ioctl handler
array.

PR:		193367
Approved by:	kib
MFC after:	1 week
2014-11-28 12:14:59 +00:00
Justin Hibbits
409062f166 Fix hwpmc sampling for ppc970 (G5-class) processors.
With this, hwpmc sampling now works on these processors.

MFC after:	3 weeks
Relnotes:	yes
2014-11-27 18:41:14 +00:00
Justin Hibbits
bd52e21d55 Fix hwpmc sampling for MPC74xxx (G4) processors.
With this, hwpmc sampling now works correctly on these processors.

MFC after:	3 weeks
Relnotes:	yes
2014-11-27 06:42:34 +00:00
Adrian Chadd
c1a4be0fc0 Add PCI ID for Intel Lynx Point LP controller.
PR:		kern/195398
Submitted by:	grembo
Obtained from:	DragonflyBSD
MFC after:	1 week
2014-11-26 20:34:05 +00:00
Alfred Perlstein
56c14bca7e Make igb and ixgbe check tunables at probe time.
This allows one to make a kernel module to tune the
number of queues before the driver loads.

This is needed so that a module at SI_SUB_CPU can set
tunables for these drivers to take.  Otherwise getenv
is called too early by the TUNABLE macros.

Reviewed by: smh
Phabric: https://reviews.freebsd.org/D1149
2014-11-26 20:19:36 +00:00
Alexander Motin
2731e062b5 Fix WWNN/WWPN generation for virtual channels.
MFC after:	1 week
2014-11-26 16:05:01 +00:00
Alexander Motin
3e92f72cfa Fix incorrect check, blocking MULTIID functionality.
MFC after:	1 week
2014-11-26 15:03:21 +00:00
Alexander Motin
315a4d6fb4 Some microoptimizations.
MFC after:	1 month
2014-11-26 13:56:54 +00:00
Alexander Motin
8592f07464 Make isp_find_pdb_by_*() search for targets in portdb in reverse order.
Records with target_mode == 1 are allocated from the end of portdb, so it
seems logical to start search from the end not traverse whole array.

MFC after:	1 month
2014-11-26 12:25:00 +00:00
Hans Petter Selasky
b2d05a1b26 Add new USB quirk.
MFC after:	1 week
PR:		195372
2014-11-26 10:58:08 +00:00
Alexander Motin
e67f3bec39 Add bunch of PCI IDs of Intel Wildcat Point (9 Series) chipsets.
MFC after:	1 week
2014-11-26 04:23:21 +00:00
Ruslan Bukin
e8cf387c51 o Add PIO and vtblk mmio device info to the tree
o Add FPGA memory window to static dev mappings
o Fix whitespace
2014-11-25 16:06:19 +00:00
Ruslan Bukin
13e19fb323 Add BERI-specific virtio block backend device driver.
This part intended to operate on ARM side in heterogeneous
(ARM/BERI) system on crystal.
2014-11-25 15:58:59 +00:00
Justin Hibbits
4dc3495501 Add Apple Intrepid USB controller ID.
MFC after:	2 weeks
2014-11-25 06:15:00 +00:00
Ian Lepore
e56e554106 Add busdma sync ops before reading and after modifying the descriptor rings.
This was previously working by accident because BUSDMA_COHERENT_MEMORY has
always been set to strongly-ordered on arm.  Now we're moving towards
normal-uncacheable (what might be called write-combining on other platforms)
and using the proper sync ops will be more important.  Of course, that
opens the question of just what is the "proper" sync op for shared
concurrent dma access as opposed to accesses where the handoff of control
of the memory has well-defined sequence points that match the available
busdma sync operations.
2014-11-24 16:12:11 +00:00
Ian Lepore
2b7b77f06b Squelch a (bogus) used before init warning when building with gcc. 2014-11-23 21:37:33 +00:00
Dimitry Andric
d41b89cca5 Fix the following -Werror warning from clang 3.5.0, while building the
ath kernel module:

sys/dev/ath/ath_hal/ar5212/ar5212_reset.c:2642:7: error: taking the absolute value of unsigned type 'unsigned int' has no effect [-Werror,-Wabsolute-value]
                if (abs(lp[0] * EEP_SCALE - target) < EEP_DELTA) {
                    ^
sys/dev/ath/ah_osdep.h:74:18: note: expanded from macro 'abs'
#define abs(_a)         __builtin_abs(_a)
                        ^
sys/dev/ath/ath_hal/ar5212/ar5212_reset.c:2642:7: note: remove the call to '__builtin_abs' since unsigned values cannot be negative
sys/dev/ath/ah_osdep.h:74:18: note: expanded from macro 'abs'
#define abs(_a)         __builtin_abs(_a)
                        ^
1 error generated.

This warning occurs because both lp[0] and target are unsigned, so the
subtraction expression is also unsigned, and calling abs() is a no-op.

However, the intention was to look at the absolute difference between
the two unsigned quantities.  Introduce a small static function to
clarify what we're doing, and call that instead.

Reviewed by:	adrian
MFC after:	3 days
Differential Revision: https://reviews.freebsd.org/D1212
2014-11-23 18:31:55 +00:00
Hans Petter Selasky
26ec349199 Don't use the synchronization endpoint unless referenced by the
isochronous endpoint descriptor used for the data transfers, hence the
synchronization feature might not be supposed to be supported [yet].
This makes seamless playback synced with the USB HOST clock work with
the DN32-USB module for Midas audio systems and possibly other similar
products from Klark Teknik.

MFC after:	1 week
2014-11-23 16:27:31 +00:00
Warner Losh
4c52dc451b There never was a PC Card joystick attachment that worked. Kill the
current stub one until such time as one shows up.
2014-11-22 20:31:20 +00:00
Warner Losh
2f1c4b0c87 Retire old, transition code for managing the FreeBSD 5 -> 6 migration. 2014-11-22 18:40:14 +00:00
Hans Petter Selasky
5ada1acc02 Fix the host mode ISOCHRONOUS transfer interval programming in the
SAF1761 OTG driver. Currently the driver logic is very simple and
double buffering the USB transactions is not done.  Also you need to
use an external USB high speed USB HUB for reliable FULL speed
outgoing ISOCHRONOUS traffic, because the internal one chokes on
so-called split transfers above 188 bytes.
2014-11-22 17:26:43 +00:00
Alexander Motin
8b94b5836c For both iSCSI initiator and target increase socket buffer sizes before
establishing connection.

This is a workaround for Chelsio TOE driver, that does not update socket
buffer size in hardware after connection established, and unless that is
done beforehand, kernel code will stuck, attempting to send/receive full
PDU at once.

MFC after:	1 week
2014-11-22 15:09:18 +00:00
Steven Hartland
14730efd7e Fix build with asr driver
This was broken by r274819 as asr is not in GENERIC because its not 64bit
safe.

MFC after:	1 month
X-MFC-With:	r274819
Sponsored by:	Multiplay
2014-11-22 14:59:50 +00:00
Alexander Motin
73e2e95d94 Fix use-after-free introduced in r274843.
I've missed that iscsi_outstanding_remove() frees the second pointer,
so it should no longer be used.  And in fact we don't really need to.

MFC after:	2 weeks
2014-11-22 09:45:32 +00:00
Alexander Motin
c215ad3aa8 Move icl_pdu_get_data() and xpt_done() out of initiator's session lock.
During heavy reads data copying in icl_pdu_get_data() may consume large
percent of CPU time.  Moving it out of the lock significantly reduces
lock hold time and respectively lock congestion on read operations.

MFC after:	2 weeks
2014-11-22 09:05:54 +00:00
Hans Petter Selasky
4f27ddac0e Use correct length mask for split transactions. The hardware would
sometimes put non-zero values in the upper length bits, which are
available for high-speed-only USB transactions, breaking the reception
of data.
2014-11-22 08:47:04 +00:00
Brooks Davis
a9332fb303 Merge from CheriBSD:
commit 6d3c4c0922
    Add terasic_mtl vt(4) framebuffer driver

    terasic_mtl can be built with syscons(4) and vt(4) attachments, selected
    at compile time.

commit 33240259b4
    Clear terasic_mtl text buffer on attach

commit d188c2d241
    Update terasic vt(4) driver for FreeBSD r269783

commit d1cc54eee8
    Safety belt to ensure vt(4) fb parameters are correct

commit 76e6d468ef
    Improve terasic_mtl_vt fdt parsing

    - Use OF_getencprop to avoid need for explicit endian handling
      (submitted by ray@freebsd.org)
    - Check for expected length and correct pointer type

commit 3e2524b899
    Correct device_printf usage

commit 9e53e3c8e0
    Switch framebuffer to match host endianness

    Xorg and xf86-video-scfb work much better with a native-endian
    framebuffer.

commit 0f49259d59
    Switch DE4 to vt(4) and enable kbdmux

commit 5bc96ebc89
    Add missing \n in device_printf calls

Submitted by:	emaste
Sponsored by:	DARPA, AFRL
2014-11-21 21:34:19 +00:00
Brooks Davis
a1f76946d5 Merge from CheriBSD:
commit d0c7d235c0
    Make the Altera JTAG UART device driver slightly more forgiving of
    the foibles of a sub-par hrdware interface by increasing the timeout
    for spotting JTAG polling from one to two seconds.

commit 19ed45a188
    Update comment.

commit 8edfe803f0
    Add a comment about a device-driver race condition that could cause the BERI
    pipeline to wedge awaiting JTAG in the event that both the low-level console
    and the tty layer decide to write to the JTAG FIFO just before JTAG is
    disconnected.  Resolving this race is a bit tricky as it looks like there
    isn't a way to 'give the character back' to the tty layer when we discover
    the race.  The easy fix is to drop the character, which we don't yet do, but
    perhaps should as that is a better outcome than wedging the pipeline.

commit 2ea26cf579
    Add a comment about an inherent race with hardware in the Altera JTAG
    UART's low-level console code.

Submitted by:	rwatson
MFC after:	1 week
Sponsored by:	DARPA, AFRL
2014-11-21 21:14:05 +00:00
Brooks Davis
9d88fc7ce3 Merge from CheriBSD (2e28d2a309)
Remove initalized, but unused devname variable

MFC after:	1 week
Sponsored by:	DARPA, AFRL
2014-11-21 21:10:02 +00:00
Steven Hartland
85c9dd9d89 Prevent overflow issues in timeout processing
Previously, any timeout value for which (timeout * hz) will overflow the
signed integer, will give weird results, since callout(9) routines will
convert negative values of ticks to '1'. For unsigned integer overflow we
will get sufficiently smaller timeout values than expected.

Switch from callout_reset, which requires conversion to int based ticks
to callout_reset_sbt to avoid this.

Also correct isci to correctly resolve ccb timeout.

This was based on the original work done by Eygene Ryabinkin
<rea@freebsd.org> back in 5 Aug 2011 which used a macro to help avoid
the overlow.

Differential Revision:	https://reviews.freebsd.org/D1157
Reviewed by:	mav, davide
MFC after:	1 month
Sponsored by:	Multiplay
2014-11-21 21:01:24 +00:00
Ed Maste
201b654e38 Clamp too-large hwpmc callchaindepth to the maximum
If the depth requested by the user is too large, it's better to provide
the maximum than the smaller default.

Sponsored by:	The FreeBSD Foundation
2014-11-20 23:16:19 +00:00
John Baldwin
a92cf726f8 Lock the scsi_low code and the drivers which use it along with other
related cleanups:
- Require each driver to initalize a mutex in the scsi_low_softc that
  is shared with the scsi_low code.  This mutex is used for CAM SIMs,
  timers, and interrupt handlers.
- Replace the osdep function switch with direct calls to the relevant
  CAM functions and direct manipulation of timers via callout(9).
- Collapse the CAM-specific scsi_low_osdep_interface substructure
  directly into scsi_low_softc.
- Use bus_*() instead of bus_space_*().
- Return BUS_PROBE_DEFAULT from probe routines instead of 0.
- No need to zero softcs.
- Pass 0ul and ~0ul instead of 0 and ~0 to bus_alloc_resource().
- Spell "dettach" as "detach".
- Remove unused 'dvname' variables.
- De-spl().

Tested by:	no one
2014-11-20 20:50:05 +00:00
John Baldwin
7e88c64c79 Various fixes for wl(4):
- Don't recurse driver mutex.
- Don't hold driver mutex across fubyte/subyte.
- Replace fubyte/subyte loops with copyin/copyout calls.
- Use relatively sane locking in wl_ioctl().
- Use bus space accessors instead of in*()/out*().
- Use callout(9) instead of timeout(9).
- Stop watchdog timer in detach and don't hold mutex across
  bus_teardown_intr().
- Use device_printf() and if_printf().
- De-spl().

Tested by:	no one
2014-11-20 20:09:18 +00:00
Andrew Turner
d455cc0410 The ranges parent bus address may just be a tag to the entry in the parent
node. Take this in to account by searching until we find the range for the
root node.

Differential Revision:	https://reviews.freebsd.org/D1160
Reviewed by:	ian
Obtained from:	ABT Systems Ltd
Sponsored by:	The FreeBSD Foundation
2014-11-20 17:03:40 +00:00
Navdeep Parhar
729fee332b cxgbe(4): figure out the max payload size and save it for later.
MFC after:	1 week
2014-11-19 20:16:56 +00:00
Ruslan Bukin
1230159bc7 Add BERI-specific virtio mmio "platform" device.
This device provides a connector to Altera PIO allowing us
to interrupt software-implemented virtio mmio backend.

Sponsored by:	DARPA, AFRL
2014-11-19 14:49:29 +00:00
Alexander Motin
b3a9e657c3 Fix build without INVARIANTS, broken by r274675. 2014-11-19 13:04:25 +00:00
Dmitry Chagin
34b3339810 Revert r274635 as it's completely wrong.
The parent of a pci dev device is a pciX device which do not
implement the PCIB_POWER_FOR_SLEEP method from pcib_if.m.
2014-11-19 11:05:45 +00:00
Kevin Lo
fa20eb98a8 Add Trendnet TEW-646UBH.
Submitted by:	bolshakov_1 at yahoo dot com
2014-11-19 05:38:45 +00:00
John Baldwin
c1dffb2f08 Add locking to wds(4) and mark MPSAFE.
- Add per-softc mutex.
- Use mutex for CAM SIM lock.
- Use bus_*() instead of inb() and outb().
- Use bus_alloc_resource_any() when reasonable.

Tested by:	no one
2014-11-18 22:12:51 +00:00
John Baldwin
42e8c47b78 Add locking to scd(4) and mark MPSAFE.
- Actually use existing per-softc mutex.
- Use mutex in cdev routines and remove D_NEEDGIANT.
- Use callout(9) instead of timeout(9).
- Don't check for impossible conditions (e.g. SCDINIT being clear).
- Use bus_*() instead of bus_space_*().

Tested by:	no one
2014-11-18 22:02:37 +00:00
John Baldwin
369934d602 Cleanups to pst(4):
- Use callout(9) instead of timeout(9).
- Don't bother zero'ing the softc.
- Destroy mutex on detach.

Tested by:	no one
2014-11-18 21:58:57 +00:00
John Baldwin
caddd60abd Add locking to mly(4) and mark MPSAFE.
- Add a per-softc mutex.
- Use mutex as CAM sim lock.
- Use taskqueue_thread instead of taskqueue_swi_giant.
- Use callout(9) instead of timeout(9).
- Use bus_*() instead of bus_space_*().

Tested by:	no one
2014-11-18 21:55:50 +00:00
John Baldwin
23c31a3c5d Add locking to mcd(4) and mark MPSAFE.
- Actually use existing per-softc mutex.
- Use mutex in cdev routines and remove D_NEEDGIANT.
- Use callout(9) instead of timeout(9).
- Don't check for impossible conditions (e.g. MCDINIT being clear).
- Remove critical_enter/exit when sending a PIO command.
- Use bus_*() instead of bus_space_*().

Tested by:	no one
2014-11-18 21:51:01 +00:00
John Baldwin
2a0db815fe Convert the refire_notify_ack timer from timeout(9) to callout(9).
Tested by:	no one
2014-11-18 21:03:46 +00:00
Luiz Otavio O Souza
edd14576c4 Make gpio_default_map_gpios() static. No functional changes. 2014-11-18 17:37:33 +00:00
Luiz Otavio O Souza
667357dc9b Moves all the duplicate code to a single function.
Verify for invalid modes and unwanted flags before pass the new flags to
driver.
2014-11-18 17:22:08 +00:00
Warner Losh
40e6bdaf1e opt_global.h is included automatically in the build. No need to
explicitly include it in these places.

Sponsored by: Netflix
2014-11-18 17:06:56 +00:00
Warner Losh
260a867f85 Fix typo pointed out by avg@ and Joerg Sonnenberger. Add a clarifying
sentence too.

Sponsored by: Netflix
2014-11-18 17:06:46 +00:00
Ruslan Bukin
707aef95a0 Add Altera Parallel IO (PIO) device driver.
Sponsored by:	DARPA, AFRL
2014-11-18 14:12:19 +00:00
Ruslan Bukin
c141c5c6b6 Add Virtio MMIO bus driver.
Sponsored by:	DARPA, AFRL
2014-11-18 14:11:14 +00:00
Luiz Otavio O Souza
4d7318e076 Fix gpiobus_child_location_str() to return a real string with the mapped
pins.

Make gpiobus_print_pins() static again.
2014-11-18 02:41:35 +00:00
Luiz Otavio O Souza
f3e51f4ba0 Remove unnecessary code.
After r273566, the gpiobus version of bus_print_child() also works on FDT
systems.
2014-11-18 02:11:07 +00:00
Ian Lepore
844aff82a6 Allow i2c bus speed to be configured via hints, FDT data, and sysctl.
The current support for controlling i2c bus speed is an inconsistant mess.
There are 4 symbolic speed values defined, UNKNOWN, SLOW, FAST, FASTEST.
It seems to be universally assumed that SLOW means the standard 100KHz
rate from the original spec.  Nothing ever calls iicbus_reset() with a
speed of FAST, although some drivers would treat it as the 400KHz standard
speed.  Mostly iicbus_reset() is called with the speed set to UNKNOWN or
FASTEST, and there's really no telling what any individual driver will do
with those.

The speed of an i2c bus is limited by the speed of the slowest device on
the bus.  This means that generally the bus speed needs to be configured
based on the board/system and the components within it.  Historically for
i2c we've configured with device hints.  Newer systems use FDT data and it
documents a clock-frequency property for i2c busses.  Hobbyists and
developers are likely to want on the fly changes.  These changes provide
all 3 methods, but do not require any existing drivers to change to use
the new facilities.

This adds an iicbus method, iicbus_get_frequency(dev, speed) that gets the
frequency for the requested symbolic speed.  If the symbolic speed is SLOW
or if there is no speed configured for the bus, the returned value is
100KHz, always.  Otherwise, if bus speed is configured by hints, fdt,
tunable, or sysctl, that speed is returned.  It also adds a helper
function, iicbus_init_frequency() that any bus driver subclassed from
iicbus can initialize the frequency from some other source of info.

Initial driver implementations are provided for Freescale and TI.

Differential Revision:        https://reviews.freebsd.org/D1174
PR:		195009
2014-11-18 01:54:31 +00:00
Warner Losh
7bfa86f62a Modernize comments about BIOSes being lame since in this detail they
aren't lame, the rules changed along the way. Catch up to 1999 or so
with the new rules.
2014-11-18 01:39:21 +00:00
Luiz Otavio O Souza
138bf90953 Add basic interrupt management code to gpiobus and ofw_gpiobus.
This is the general support to allow the use of GPIO pins as interrupt
sources for direct gpiobus children.

The use of GPIO pins as generic interrupt sources (for an ethernet driver
for example) will only be possible when arm/intrng is complete.  Then, most
of this code will need to be rewritten, but it works for now, is better
than what we have and will allow further developments.

Tested on:	ar71xx (RSPRO), am335x (BBB), bcm2835 (Raspberry pi)
Differential Revision:	https://reviews.freebsd.org/D999
Reviewed by:	rpaulo
2014-11-18 01:38:39 +00:00
Dmitry Chagin
91bd62caf5 Use the correct device as the power_for_sleep() method
always pass request up to parent bridge.

Reviewed by:	jhb
MFC after:	1 week
xMFC:		r274386,r274397
2014-11-17 20:25:21 +00:00
Warner Losh
707767a88c Remove stray empty comment. The code is adequately explained in the
block comment above, so there's nothing to add here.
2014-11-17 16:30:51 +00:00
Alexander V. Chernikov
86e10a0c6a Fix r273112: do not turn DROP_EN by default.
Due to adapter->hw.fc.requested_mode is filled with default value
after ixgbe_initialize_receive_units(), this leads to enabling
DROP_EN in most cases.

Tested by:	ae
MFC after:	1 week
2014-11-16 18:08:00 +00:00
Jean-Sébastien Pédron
d591845e63 drm/radeon: Lower priority of a message related to invalid EDID
Like in r259717, the prority goes from "error" to "debug" to avoid
spamming logs when the connectors are polled.

PR:		194770
Submitted by:	Larry Rosenman <ler@lerctr.org>
MFC after:	1 week
2014-11-16 17:53:48 +00:00
Adrian Chadd
adcdc8f290 Convert the callouts back to using mutexes.
I did this wrong - I should've included a state flag for each callout
to see if it was supposed to run or not.  I didn't do that.
Instead, just use mutexes anyway.

Suggested by: jhb
2014-11-15 01:18:49 +00:00
Adrian Chadd
7707f31dc5 Migrate the callouts from using mutex locks to being mpsafe with
the locks being held by the callers.

Kill callout_drain() and use callout_stop().
2014-11-14 04:26:26 +00:00
John Baldwin
352176c8cb - Use the existing driver lock in cdevsw methods and remove D_NEEDGIANT.
- Use callout(9) instead of timeout(9).
- Use bus_*() instead of bus_space_*().
- Don't check for a NULL softc in attach.

Tested by:	no one
2014-11-13 22:06:57 +00:00
John Baldwin
7ff829cb0e Lock iir(4) and mark it MPSAFE.
- Add a per-device mutex to the softc and use it for bus_dma tags,
  CAM SIMs, callouts, and interrupt handler.
- Switch from timeout(9) to callout(9).
- Add a separate global mutex to protect the global event buffer ring.
- Return completed index from iir_intr_locked() and remove the global
  gdt_wait_* variables.
- Remove global list of gdt softcs and replace its use with
  devclass_get_device().
- Use si_drv1 to store softc pointer in the SDEV_PER_HBA case instead
  of minor numbers.
- Do math on osreldate instead of dubious char math on osrelease[]
  that didn't work on 10.0+.
- Use bus_*() instead of bus_space_*().
- Use device_printf() instead of printf() with a unit number.

Tested by:	no one
2014-11-13 22:00:18 +00:00
John Baldwin
61691153bd Remove dpt_isa.c and commented out references to it. It was never connected
to the build in either sys/conf/files* or sys/modules/dpt/Makefile.  Also,
it was denoted as "doesn't quite work yet" when the file was initially added
(which may account for it never having been hooked up to the build).
2014-11-13 20:00:54 +00:00
Konstantin Belousov
6e646651d3 Remove the no-at variants of the kern_xx() syscall helpers. E.g., we
have both kern_open() and kern_openat(); change the callers to use
kern_openat().

This removes one (sometimes two) levels of indirection and
consolidates arguments checks.

Reviewed by:	mckusick
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2014-11-13 18:01:51 +00:00
Navdeep Parhar
aa8d1792d1 iw_cxgbe: don't forget to close the socket in c4iw_connect if soconnect
fails.

Submitted by:	hariprasad at chelsio dot com
2014-11-13 03:59:36 +00:00
Luigi Rizzo
0e73f29ae2 add support for private knote lock (reduces lock contention),
adapting OS_selrecord accordingly.
Problem and fix suggested by adrian and jmg
2014-11-13 00:40:34 +00:00
Luigi Rizzo
ad15cc59e9 we need full barriers here 2014-11-13 00:14:25 +00:00
Navdeep Parhar
05c4567dd9 Fix some bad interaction between cxgbe(4) and lacp lagg(4) that could
leave a port permanently disabled when a copper cable is unplugged and
then plugged right back in.

lacp_linkstate goes looking for the current ifmedia on a link state
change and it could get stale information from cxgbe(4) on a module
unplug followed by replug.  The fix is to process module events before
link-state events within the driver, and to always rebuild the ifmedia
list on a module change event (instead of rebuilding it lazily).

Thanks to asomers@ for the problem report and detailed analysis to go
with it.

MFC after:	1 week
2014-11-12 23:29:22 +00:00
Zbigniew Bodek
bf39c5e8d5 Make uart_bus_fdt a decendant of ofwbus
This will allow to attach UART drivers lying directly on the root node
instead of simple-bus compatible bus only.

Obtained from:   Semihalf
Sponsored by:    The FreeBSD Foundation
2014-11-12 21:41:15 +00:00
Zbigniew Bodek
17d2ee0132 Make PL011 UART to wait on putc only when TX FIFO is full
Instead of waiting for empty TX FIFO it is more reasonable to
block on full FIFO. As soon as FIFO slot is free the character
can be transmitted.
In case of TX FIFO disabled, TXFF bit indicates that transmit
register is not empty.

Obtained from:   Semihalf
Reviewed by:     andrew, emaste
Sponsored by:    The FreeBSD Foundation
2014-11-12 21:38:31 +00:00
Gleb Smirnoff
cfa6009e36 In preparation of merging projects/sendfile, transform bare access to
sb_cc member of struct sockbuf to a couple of inline functions:

sbavail() and sbused()

Right now they are equal, but once notion of "not ready socket buffer data",
will be checked in, they are going to be different.

Sponsored by:	Netflix
Sponsored by:	Nginx, Inc.
2014-11-12 09:57:15 +00:00
Ian Lepore
f088768b98 Remove an #ifdef DEBUG wrapper, and instead use if (bootverbose). 2014-11-12 02:38:25 +00:00
John Baldwin
7bfc98355a Add device ID for the T502-BT (dual-port 1G) adapter.
Reviewed by:	np
MFC after:	1 week
2014-11-11 20:05:50 +00:00
Jung-uk Kim
44aba0f6c2 Use the correct device. Note this commit complements r274386.
PR:		194884
2014-11-11 19:42:10 +00:00
John Baldwin
858b72dbb8 Use the callout(9) API instead of timeout(9). To do this more cleanly,
convert a global timer to a per-controller timer.  This works much better
with locking and removes the need for several global lookup tables.

Tested by:	ambrisko
2014-11-11 18:15:05 +00:00
Adrian Chadd
2da2ade021 Use the correct device (child) when asking the bus layer about which power
state said device should go into.

This was a snafu introduced in the ACPI/PCI awareness separation.

When putting a device into a power state, the bus (and thus firmware,
eg ACPI) should be asked before hand to check whether the device
can indeed go into that power state.

There's a set of nodes in ACPI under each device - the _SxD nodes - which
state which ACPI power state to put the device into when the system is
going into power save state 'x'.  So when going into S3, the existence
of an _S3D node would override whatever the system was trying to do.

By default the PCI code wants to put devices into D3 before suspending.

I have a laptop here (Asus Zenbook - check the PR) whose EHCI controller
really wants to be in D2 during suspend, not D3.  So if we put it into
D3 and then try to enter S3, everything hangs.  The device itself
can go into D3 - it just can't be there when the call to ACPI to enter
S3 occurs.  The PCI patch fixes this.

jkim@ noticed that the same is needed for the ACPI child device
enumeration.

Thankyou to Matt Dillon (the programmer, not the actor) for buying me
this particular laptop so I could debug the issues with the Atheros
AR9485 that is in it.  It's his fault that I ended up with this
laptop and was sufficiently annoyed by the lack of USB suspend
to go down this rabbit hole.

Tested:

* Thinkpad T400
* Thinkpad X230
* Thinkpad T42
* Thinkpad T60
* Asus Zenbook (see PR)
* Asus EEEPC 701
* Asus EEEPC 1001PX

TODO:

* Figure out what we should do about devices we unload drivers for
  that want to be in a specific state when entering S3 / S4 -
  the "put devices into D3 if they're not bound to a driver" option
  may also mess with things.

PR:		kern/194884
Reviewed by:	jhb, jkim
MFC after:	1 week
Relnotes:	yes
Sponsored by:	Matt Dillon <dillon@apollo.backplane.com> (hardware)
2014-11-11 17:14:11 +00:00
Konstantin Belousov
843c718fa7 Update comment.
Noted by:	dim
Approved by:	secteam (des)
MFC after:	4 days
2014-11-11 14:30:35 +00:00
Konstantin Belousov
a537a017e8 Initial attachment of the agp(4) to Haswell IGP. There is no handling
of cacheablility control bits in GTT PTEs yet.

Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2014-11-11 12:56:30 +00:00
Konstantin Belousov
d6fe56e5d7 Based on some BIOS configuration (GGC register in host bridge, bit 1),
IGP may declare subclass as either VGA-compatible, or non-VGA.  The
difference is that in the later case, IGP does not claim VGA cycles.
Other than that, the device functions normally, and agp_i810 should
attach to it.

Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2014-11-11 12:52:45 +00:00
Konstantin Belousov
a41f4046f5 On 965 and higher, map GTT as write-combining.
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2014-11-11 12:37:13 +00:00
Pawel Jakub Dawidek
5ebb15b942 Add missing privilege check when setting the dump device. Before that change it
was possible for a regular user to setup the dump device if he had write access
to the given device. In theory it is a security issue as user might get access
to kernel's memory after provoking kernel crash, but in practise it is not
recommended to give regular users direct access to storage devices.

Rework the code so that we do privileges check within the set_dumper() function
to avoid similar problems in the future.

Discussed with:	secteam
2014-11-11 04:48:09 +00:00
Luigi Rizzo
039dd540f5 in the Linux section, properly define the NMG_LOCK type.
Also import WITH_GENERIC in preparation to adding fine-grained
options to disable specific netmap components.
2014-11-11 00:13:28 +00:00
Luigi Rizzo
204f91dd3a - fix typo: use ring size from the rx ring, not the tx one (they should be
the same, but just in case);
- reuse the previously computed len-1 value
2014-11-11 00:10:44 +00:00
Luigi Rizzo
6435a0dc1b fix a typo 2014-11-10 21:00:23 +00:00
Luigi Rizzo
4e93beff92 initialize *color if passed as an argument 2014-11-10 20:25:33 +00:00
Luigi Rizzo
db5cb21105 sync a comment with our internal repo 2014-11-10 20:19:58 +00:00
Navdeep Parhar
62fc63abfb cxgbe(4): adjust PMRX and PMTX parameters.
MFC after:	1 week
2014-11-10 19:45:28 +00:00
Dag-Erling Smørgrav
133cdd9e13 Constify the AES code and propagate to consumers. This allows us to
update the Fortuna code to use SHAd-256 as defined in FS&K.

Approved by:	so (self)
2014-11-10 09:44:38 +00:00
Bryan Venteicher
9a4dabdc5a Enable LRO by default when available on vtnet interfaces
The prior change to not enable LRO by default has confused several
people. The configurations where LRO is problematic is not the
typical use case for VirtIO, and due to other issues, this often
requires checksum offloading to be disabled anyways.

PR:		185864
MFC after:	2 weeks
2014-11-09 20:04:12 +00:00
Konstantin Belousov
48e279eaa7 Fix random.ko module.
- Remove duplicated sources between standard part of the kernel and
  module.  In particular, it caused duplicated lock initialization and
  sysctl registration, both having bad consequences.
- Add missed source files to module.
- Static part of the kernel provides randomdev module, not
  random_adaptors.  Correct dependencies.
- Use cdev modules declaration macros.

Approved by:	secteam (delphij)
Reviewed by:	markm
2014-11-07 20:23:43 +00:00
Konstantin Belousov
76c16ab94f Simplify assembler in ivy.c. Move the copying of the random bits into
buffer from asm to C, which reduces amount of arguments for inline asm
and simplifies constraints.  Use unsigned types consistently.

Submitted by:	bde
Approved by:	secteam (delphij)
Reviewed by:	markm
MFC after:	1 week
2014-11-07 20:10:09 +00:00
Zbigniew Bodek
76a8ef267d Avoid panic in ofwbus caused by not released resource list entry
After resource allocation and release, resource list entry
stays non-NULL. This causes panic in ofwbus_alloc_resource()
on subsequent resource allocation.
Clean appropriate list entry on release to avoid this.

Obtained from:	Semihalf
Reviewed by:	ian
Sponsored by:	The FreeBSD Foundation
2014-11-07 19:34:10 +00:00
Gleb Smirnoff
833e8dc5ab Remove struct arpcom. It is unused by most interface types, that allocate
it, except Ethernet, where it carried ng_ether(4) pointer.
For now carry the pointer in if_l2com directly.

Sponsored by:	Netflix
Sponsored by:	Nginx, Inc.
2014-11-07 15:14:10 +00:00
Bjoern A. Zeeb
20dc9e1740 After r274205 unbreak NOIP kernels. vsi is now also used outside
address family specific blocks so move it out from under the condition.

MFC after:	6 days
X-MFC with:	r274205
2014-11-07 11:34:06 +00:00
Hans Petter Selasky
e470cd2382 Add new USB IDs.
Submitted by:	G'abor Zahemszky <gabor@zahemszky.hu>
MFC after:	1 week
2014-11-07 11:04:27 +00:00
Jack F Vogel
3fa969c8ac Add header file missing from last commit.
Submitted by: jfv
MFC after: 1 week
2014-11-07 04:47:46 +00:00
Bryan Venteicher
b84b3efdde Several minor changes to hopefully complete the VirtIO console driver
- Support the KDB alt break sequence to enter the debugger,
    panic, reboot, etc. [1]
  - Provide emergency write feature description. Note that QEMU
    does not implement this feature.
  - Make the VTCON_FLAG_* defines sequential once again.
  - When the multiple port feature is not negotiated, query the
    rows and columns of the one console during the device attach
    when the size feature is negotiated.
  - Report failure to the device if hot plugging a port fails.
  - Acknowledge the console port event with an open event. This
    is required by the spec, but QEMU doesn't seem to care.

Submitted by:	Juniper [1]
MFC after:	1 month
2014-11-07 03:36:28 +00:00
Jack F Vogel
e5100ee278 Update the Intel i40e drivers, ixl version 1.2.8, ixlv version 1.1.18
-Improved VF stability, thanks to changes from Ryan Stone,
	 and Juniper.
	- RSS fixes in the ixlv driver
	- link detection in the ixlv driver
	- New sysctl's added in ixl and ixlv
	- reset timeout increased for ixlv
	- stability fixes in detach
	- correct media reporting
	- Coverity warnings fixed
	- Many small bug fixes
	- VF Makefile modified - nvm shared code needed
	- remove unused sleep channels in ixlv_sc struct

Submitted by: Eric Joyner (committed by jfv)
MFC after:	1 week
2014-11-06 23:45:05 +00:00
Ian Lepore
faab4473eb A dma tag alignment should be 1 (not 0) when a device can dma at any address. 2014-11-06 18:15:16 +00:00
Ian Lepore
c2846d2e3f A dma tag alignment should be 1 (not 0) when a device can dma at any address. 2014-11-06 18:14:12 +00:00
Jean-Sébastien Pédron
0d265707aa vt(4): Support syscons' SC_HISTORY_SIZE to configure history size
Therefore, to set histry size to 2000 lines, add the following line to
your kernel configuration file:
    options SC_HISTORY_SIZE=2000

The default history remains at 500 lines.

MFC after:	1 week
2014-11-04 23:51:35 +00:00
Baptiste Daroussin
f669586400 Partially fix indentation issues to improve readability helping cooperation with
Dragonfly folks

PR:		194785
Submitted by:	François Tigeot (ftigeot@wolfpond.org)
2014-11-04 23:10:58 +00:00