Commit Graph

28303 Commits

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

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

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

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

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

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

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

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

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

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

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

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

This fixes at least two bugs:

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Sponsored by: Citrix Systems R&D

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

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

Sponsored by: Citrix Systems R&D

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

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

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

Sponsored by: Citrix Systems R&D

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

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

Sponsored by: Citrix Systems R&D

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

Sponsored by: Citrix Systems R&D

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

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

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

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

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

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

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

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

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

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

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

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

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

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

To make this possible:

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

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

Tested:

* AR9380 (STA)
* AR9485 CUS198 (STA)

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Reviewers: jhb

Reviewed By: jhb

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

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

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

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

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

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

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

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

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

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

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

So:

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

Tested:

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

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

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

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

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

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

Sponsored by:	Netflix
Sponsored by:	Nginx, Inc.
2014-09-19 09:01:19 +00:00
Gleb Smirnoff
9d204116ad Fix typo.
Submitted by:	jkim
2014-09-19 03:55:19 +00:00
Gleb Smirnoff
c8dfaf382f Mechanically convert to if_inc_counter(). 2014-09-19 03:51:26 +00:00
Bjoern A. Zeeb
94b0d1ae8d Fx a type from r271817; it's IFCOUNTER_* not IFNET_*. 2014-09-18 22:10:49 +00:00
Gleb Smirnoff
4df50c3ae3 Mechanically convert to if_inc_counter(). 2014-09-18 21:19:21 +00:00
Gleb Smirnoff
d5002dd19f Mechanically convert to if_inc_counter(). 2014-09-18 21:16:05 +00:00
Gleb Smirnoff
590a9de587 Mechanically convert to if_inc_counter(). 2014-09-18 21:14:46 +00:00
Gleb Smirnoff
499986541b Mechanically convert to if_inc_counter(). 2014-09-18 21:13:12 +00:00
Bjoern A. Zeeb
d94ca7cf07 Revert r270808, which were changes to common code (i40e_alloc.h).
Rather than #define-ing common code function calls to OS-dependent
ones, make the osdep versions match the common code expectations,
adjust the FreeBSD specific code to use those, and remove the
#defines.

In the FreeBSD specific code, use "i40e_mem_reserved" for the
now expected but unused argument to i40e_allocate_dma_mem().

Reviewed by:	gnn, eric.joyner intel.com
MFC after:	3 days
2014-09-18 21:13:03 +00:00
Gleb Smirnoff
9bce9009cd Mechanically convert to if_inc_counter(). 2014-09-18 21:11:42 +00:00
Gleb Smirnoff
ecc70d3f9e Mechanically convert to if_inc_counter(). 2014-09-18 21:09:22 +00:00
Gleb Smirnoff
f98131f881 Mechanically convert to if_inc_counter(). 2014-09-18 21:07:05 +00:00
Gleb Smirnoff
b821756ba2 Mechanically convert to if_inc_counter(). 2014-09-18 21:05:59 +00:00
Gleb Smirnoff
10b77d668c Mechanically convert to if_inc_counter(). 2014-09-18 21:03:13 +00:00
Gleb Smirnoff
1209989c6a Mechanically convert to if_inc_counter(). 2014-09-18 21:01:41 +00:00
Gleb Smirnoff
dde47b5589 Mechanically convert to if_inc_counter(). 2014-09-18 20:59:59 +00:00
Gleb Smirnoff
eed9bc6a5b Mechanically convert to if_inc_counter(). 2014-09-18 20:58:04 +00:00
Gleb Smirnoff
884c5b4544 Mechanically convert to if_inc_counter(). 2014-09-18 20:53:02 +00:00
Gleb Smirnoff
2127b2e232 Mechanically convert to if_inc_counter(). 2014-09-18 20:47:39 +00:00
Gleb Smirnoff
8c32392208 Mechanically convert to if_inc_counter(). 2014-09-18 20:44:53 +00:00
Gleb Smirnoff
f02c95526e Mechanically convert to if_inc_counter(). 2014-09-18 20:43:17 +00:00
Gleb Smirnoff
482dbe35e5 - Mechanically convert to if_inc_counter().
- Cut code that runs a counter backwards.
2014-09-18 20:39:23 +00:00
Gleb Smirnoff
ec4a897719 Mechanically convert to if_inc_counter(). 2014-09-18 20:35:22 +00:00
Gleb Smirnoff
c0973d1f22 Mechanically convert to if_inc_counter(). 2014-09-18 20:33:25 +00:00
Gleb Smirnoff
41acb7e12c Mechanically convert to if_inc_counter(). 2014-09-18 20:30:47 +00:00
Gleb Smirnoff
b1ed3d645b Mechanically convert to if_inc_counter(). 2014-09-18 20:24:47 +00:00
Gleb Smirnoff
e09fdb0282 Mechanically convert to if_inc_counter(). 2014-09-18 20:23:34 +00:00
Gleb Smirnoff
8da56a6fec Mechanically convert to if_inc_counter(). 2014-09-18 20:21:46 +00:00
Gleb Smirnoff
2c705cad05 Mechanically convert to if_inc_counter(). 2014-09-18 20:18:55 +00:00
Gleb Smirnoff
908c14ce55 Mechanically convert to if_inc_counter(). 2014-09-18 20:17:27 +00:00
Gleb Smirnoff
621d4f2a50 Mechanically convert to if_inc_counter(). 2014-09-18 20:15:53 +00:00
Gleb Smirnoff
11d48ff157 Mechanically convert to if_inc_counter(). 2014-09-18 20:11:28 +00:00
Gleb Smirnoff
e1ed7fe8b1 Mechanically convert to if_inc_counter(). 2014-09-18 20:09:35 +00:00
Gleb Smirnoff
006b95da09 Mechanically convert to if_inc_counter(). 2014-09-18 20:06:10 +00:00
Gleb Smirnoff
5941b6d120 Mechanically convert to if_inc_counter(). 2014-09-18 20:03:45 +00:00
Gleb Smirnoff
1162f06501 Mechanically convert to if_inc_counter(). 2014-09-18 19:57:13 +00:00
Gleb Smirnoff
84047b19df - Provide if_get_counter() method for vtnet(4).
- Do not accumulate statistics on every tick.
- Accumulate statistics in vtnet_setup_stat_sysctl()
  and in vtnet_get_counter().

Sponsored by:	Netflix
Sponsored by:	Nginx, Inc.
2014-09-18 19:15:40 +00:00
Will Andrews
138ebd1b64 Start the process of cleaning up FreeBSD's firewire driver.
sys/dev/firewire/firewire.c:
sys/dev/firewire/firewire.h:
sys/dev/firewire/firewirereg.h:
sys/dev/firewire/fwcrom.c:
sys/dev/firewire/fwdev.c:
sys/dev/firewire/fwdma.c:
sys/dev/firewire/fwmem.c:
sys/dev/firewire/fwohci.c:
sys/dev/firewire/fwohci_pci.c:
sys/dev/firewire/fwohcivar.h:
sys/dev/firewire/if_fwe.c:
sys/dev/firewire/if_fwip.c:
sys/dev/firewire/sbp.c:
sys/dev/firewire/sbp_targ.c:
	Unifdef the code, removing support for DragonflyBSD
	and FreeBSD prior to version 5.

Submitted by:	gibbs
MFC after:	1 month
Sponsored by:	Spectra Logic
MFSpectraBSD:	1081188 on 2014/08/01
2014-09-18 17:28:21 +00:00
Will Andrews
6ad82d5feb Silence noisy firewire logging.
MFC after:	1 month
Sponsored by:	Spectra Logic
MFSpectraBSD:	974594 on 2013/08/02
2014-09-18 17:22:42 +00:00
Adrian Chadd
0936a8208b Fix the handling of EOP in status descriptors for if_igb(4) and don't
double-free mbufs.

Like ixgbe(4) chipsets, EOP is only set on the final descriptor
in a chain of descriptors.  So, to free the whole list of descriptors,
we should free the current slot _and_ the assembled list of descriptors
that make up the fragment list.

The existing code was setting discard once it saw EOP + an error status;
it then freed all the subsequent descriptors until the next EOP. That's
totally the wrong order.
2014-09-18 16:20:17 +00:00
Gleb Smirnoff
df3601781d - Use if_inc_counter() to increment various counters.
- Do not ever set a counter to a value. For those counters
  that we don't increment, but return directly from hardware
  create cases in if_get_counter() method.

Sponsored by:	Netflix
Sponsored by:	Nginx, Inc.
2014-09-18 15:56:14 +00:00
Jean-Sébastien Pédron
18b21af2d2 vt(4): Use strncpy() to copy into a fixed-size buffer
CID:		1230007
MFC after:	3 days
2014-09-18 13:24:06 +00:00
Jean-Sébastien Pédron
46867de5dd vt(4): Fix out-of-bounds array access in VT_ACTIVATE ioctl handling
CID:		1229964
MFC after:	3 days
2014-09-18 12:20:19 +00:00
Bjoern A. Zeeb
ea022094f2 For consistency with the shared header file (and to avoid confusion
with mbufs normally called *m in one place), rename the function
arguments to "mem".

This is a non-functional change.

Reviewed by:	gnn, eric.joyner intel.com
MFC after:	3 days
2014-09-18 08:56:25 +00:00
Will Andrews
1d0a1de2aa Fix a kernel panic when unloading isp(4).
In the current implementation, the isp_kthread() threads never exit.

The target threads do have an exit mode from isp_attach(), but it is
not invoked from isp_detach().

Ensure isp_detach() notifies threads started for each channel, such
that they exit before their parent device softc detaches, and thus
before the module does.  Otherwise, a page fault panic occurs later in:

sysctl_kern_proc
  sysctl_out_proc
    kern_proc_out
      fill_kinfo_proc
        fill_kinfo_thread
          strlcpy(kp->ki_wmesg, td->td_wmesg, sizeof(kp->ki_wmesg));

For isp_kthread() (and isp(4) target threads), td->td_wmesg references
now-unmapped memory after the module has been unloaded.  These threads
are typically msleep()ing at the time of unload, but they could also
attempt to execute now-unmapped code segments.

MFC after:	1 month
Sponsored by:	Spectra Logic
MFSpectraBSD:	r1070921 on 2014/06/22 13:01:17
2014-09-18 02:01:36 +00:00
David C Somayajulu
41b18fab96 For ECORE_DBG_BREAK_IF() ECORE_BUG() ECORE_BUG_ON() check bxe_debug flag before
printing error message.

MFC after:5 days
2014-09-17 22:49:29 +00:00
John Baldwin
1f895058e4 Revert unrelated changes accidentally committed in r271192. 2014-09-17 18:55:39 +00:00
Jean-Sébastien Pédron
73547eeae9 drm/i915: Add HW context support
This feature is required by Mesa 9.2+. Without this, a GL application
crashes with the following message:
    # glxinfo
    name of display: :0.0
    Gen6+ requires Kernel 3.6 or later.
    Assertion failed: (ctx->Version > 0), function handle_first_current,
      file ../../src/mesa/main/context.c, line 1498.
    Abort (core dumped)

Now, Mesa 10.2.4 and 10.3-rc3 works fine:
    # glxinfo
    name of display: :0
    display: :0  screen: 0
    direct rendering: Yes
    ...
    OpenGL renderer string: Mesa DRI Intel(R) 965GM
    OpenGL version string: 2.1 Mesa 10.2.4
    ...

The code was imported from Linux 3.8.13.

Reviewed by:	kib@
Tested by:	kwm@, danfe@, Henry Hu,
		Lundberg, Johannes <johannes@brilliantservice.co.jp>,
		Johannes Dieterich <dieterich.joh@gmail.com>,
		Lutz Bichler <lutz.bichler@gmail.com>,
MFC after:	3 days
Relnotes:	yes
2014-09-17 08:28:50 +00:00
Edward Tomasz Napierala
17cf3eb152 Fix LUN discovery for targets that don't support REPORT_LUNS, broken
in r263741.  At least with CTL (slightly modified to report SPC2) there
is still some problem: it doesn't seem to find LUNs higher than 7.

Sponsored by:	The FreeBSD Foundation
2014-09-17 07:55:23 +00:00
Jean-Sébastien Pédron
1365d0770d vt(4): Use vt_fb_drawrect() and vt_fb_setpixel() in all vt_fb-derivative
Review:		https://reviews.freebsd.org/D789
Reviewed by:	nwhitehorn
Approved by:	nwhitehorn
MFC after:	2 days
2014-09-16 18:02:24 +00:00
Jean-Sébastien Pédron
1952f0b519 vt(4): Fix a LOR which occurs during a call to vt_upgrade()
Reported by:	kib@
Review:		https://reviews.freebsd.org/D785
Reviewed by:	ray@
Approved by:	ray@
MFC after:	2 days
2014-09-16 17:42:37 +00:00
Brooks Davis
58ab5b0a13 Fix some extra whitespace noticed when reviewing git diffs. 2014-09-16 17:07:32 +00:00
Bjoern A. Zeeb
dcceaf9f3c Merge atse(4) interrupt handling and race condition fixes from cheribsd:
commit 8bd88585ed

    Rework atse_rx_cycles handling: count packets instead of fills, and use the
    limit only when polling, not when in interrupt mode.  Otherwise, we may
    stop reading the FIFO midpacket and clear the event mask even though the
    FIFO still has data to read, which could stall receive when a large packet
    arrives.  Add a comment about races in the Altera FIFO interface: we may
    need to do a little more work to handle races than we are.

commit 20b39086cc

    Use 'sizeof(data)' rather than '4' when checking an mbuf bound, as is the
    case for adjusting length/etc.

commit e18953174a

    Break out atse_intr() into two separate routines, one for each of the two
    interrupt sources: receive and transmit.

commit 6deedb4324

    For the RX interrupt, take interest only in ALMOSTEMPTY and OVERFLOW.
    For the TX interrupt, take interest only in ALMOSTFULL and UNDERFLOW.

    Perform TX atse_start_locked() once rather than twice in TX interrupt
    handling -- and only if !FULL, rather than unconditionally.

commit 12601972ba

    Experimentation suggests that the Altera Triple-Speed Ethernet documentation
    is incorrect and bits in the event and interrupt-enable registers are not
    irrationally rearranged relative to the status register.

commit 3cff2ffad7

    Substantially rework interrupt handling in the atse(4) driver:

    - Introduce a new macro ATSE_TX_PENDING() which checks whether there is
      any pending data to transmit, either in an in-progress packet or in
      the TX queue.
    - Introduce new ATSE_RX_STATUS_READ() and ATSE_TX_STAUTS_WRITE() macros
      that query the FIFO status registers rather than event registers,
      offering level- rather than edge-triggered FIFO conditions.
    - For RX, interrupt only on full/overflow/underflow; for TX, interrupt
      only on empty/overflow/underflow.
    - Add new ATSE_RX_INTR_READ() and ATSE_RX_INTR_WRITE() macros useful for
      debugging interrupt behaviour.
    - Add a debug.atse_intr_debug_enable sysctl that causes various pieces
      of FIFO state to be printed out on each RX or TX interrupt.  This is
      disabled by default but good to turn on if the interface appears to
      wedge.  Also print debugging information when polling.
    - In the watchdog handler, do receive, not just transmit, processing, to
      ensure that the rx, not just tx, queue is being handled -- and, in
      particular, will be drained such that interrupts can resume.
    - Rework both atse_rx_intr() and atse_tx_intr() to eliminate many race
      conditions, and add comments on why various things are in various
      orders.  Interactions between modifications to the event and interrupt
      masks are quite subtle indeed, and we must actively check for a number
      of races (e.g., event mask cleared; packet arrives; interrupts enabled).
      We also now use the status registers rather than event registers for
      FIFO status checks to avoid other races; we continue to use event
      registers for underflow/overflow.

    With this change, interrupt-driven operation of atse appears (for the
    time being) robust.

commit 3393bbff5c

    atse: Fix build after 3cff2ffa

Obtained from:	cheribsd
Submitted by:	rwatson, emaste
Sponsored by:	DARPA/AFRL
MFC after:	3 days
2014-09-16 15:45:53 +00:00
Adrian Chadd
e45d876dd7 The error bits are not valid with EOP=0; so intermediary fragments should
not be discarded.

Submitted by:	Marc De La Gueronniere <mdelagueronniere@verisign.com>
MFC after:	1 week
Sponsored by:	Verisign, Inc.
2014-09-15 20:54:12 +00:00
Adrian Chadd
5894690d0d Fix a double-free of mbufs in rx_ixgbe_discard().
fmp->buf at the free point is already part of the chain being freed,
so double-freeing is counter-productive.

Submitted by:	Marc De La Gueronniere <mdelagueronniere@verisign.com>
MFC after:	1 week
Sponsored by:	Verisign, Inc.
2014-09-15 20:50:26 +00:00
Adrian Chadd
1c2427605c Set DROP_EN on each RX queue if transmit flow-control is disabled.
This allows the NIC to drop frames on the receive queue and not
cause the MAC to block on receiving to _any_ queue.

Tested:

igb0@pci0:5:0:0:        class=0x020000 card=0x152115d9 chip=0x15218086 rev=0x01 hdr=0x00
    vendor     = 'Intel Corporation'
    device     = 'I350 Gigabit Network Connection'
    class      = network
    subclass   = ethernet

Discussed with: Eric Joyner <eric.joyner@intel.com>

MFC after:	1 week
Sponsored by:	Norse Corp, Inc.
2014-09-15 19:53:49 +00:00
Justin Hibbits
cddd0f61e3 Fix PowerPC backtraces. Since kernel and user have completely separate address
spaces, rather than a split address, we actually can't check for being within
the kernel's address range.  Instead, do what other backtraces do, and use
trapexit()/asttrapexit() as the stack sentinel.

MFC after:	3 weeks
2014-09-14 22:03:41 +00:00
Hans Petter Selasky
72f3100047 Revert r271504. A new patch to solve this issue will be made.
Suggested by:	adrian @
2014-09-13 20:52:01 +00:00
Ian Lepore
b8ed20dbc4 Create an interface and support routines for drivers that handle IO pin
multiplexing and configuration based on FDT data.

Reviewed by:	imp
2014-09-13 19:03:32 +00:00
Jean-Sébastien Pédron
87684766b0 vt(4): Enclose vt_mouse_paste() prototype inside #ifndef SC_NO_CUTPASTE/#endif
This fixes the build with sparc64 LINT for instance.

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

MFC after:	1 week
Sponsored by:	Mellanox Technologies
2014-09-13 08:26:09 +00:00
Xin LI
e72055b7fe Import HyperV Key-Value Pair (KVP) driver and daemon code by Microsoft,
many thanks for their continued support of FreeBSD.

While I'm there, also implement a new build knob, WITHOUT_HYPERV to
disable building and installing of the HyperV utilities when necessary.

The HyperV utilities are only built for i386 and amd64 targets.

This is a stable/10 candidate for inclusion with 10.1-RELEASE.

Submitted by:	Wei Hu <weh microsoft com>
MFC after:	1 week
2014-09-13 02:15:31 +00:00
Hans Petter Selasky
b75ac2ba76 Workaround for receiving Voice Calls using the E1750 dongle from
Huawei. It might appear as if the firmware is allocating memory blocks
according to the USB transfer size and if there is initially a lot of
data, like at the answering machine prompt, it simply dies without any
apparent reason. The simple workaround for this is to force a zero
length packet at hardware level after every 512 bytes of data. This
will force the other side to use smaller memory blocks aswell.

MFC after:	1 week
2014-09-12 22:40:12 +00:00
Navdeep Parhar
8374717dc0 cxgbe(4): add support for the SIOCGI2C ioctl. 2014-09-12 21:56:57 +00:00
Aleksandr Rybalko
673279c59b Fix 'function declaration isn't a prototype' warning.
Pointed by:	ian
MFC after:	1 week
2014-09-12 20:55:17 +00:00
Aleksandr Rybalko
44f751a21e Fix stray char on paste.
Tested by:	dumbbell and me
MFC after:	1 week
2014-09-12 14:17:09 +00:00
Aleksandr Rybalko
4f4b93ae98 Switch vt(4) to traditional behaviour with copy-paste same as syscons(4) do.
(forgetted in last commit)

Reviewed by:	dumbbell (as D755)
MFC after:	1 week
2014-09-12 14:16:10 +00:00
Aleksandr Rybalko
dd0de63eab Switch vt(4) to traditional behaviour with copy-paste same as syscons(4) do.
Reviewed by:	dumbbell (as D755)
MFC after:	1 week
2014-09-12 14:14:50 +00:00
Aleksandr Rybalko
2204db863d Remove stray whitespaces. 2014-09-12 14:07:20 +00:00
Alexander Motin
200b4021c6 Initialize variables before resource_int_value().
Submitted by:	Dmitry Luhtionov <dmitryluhtionov@gmail.com>
2014-09-12 12:04:51 +00:00
Alexander Motin
6e88c2c572 Initialize variables before resource_int_value().
Submitted by:	Dmitry Luhtionov <dmitryluhtionov@gmail.com>
2014-09-12 08:37:21 +00:00
Navdeep Parhar
3eb2c201a6 cxgbe(4): knobs to enable/disable PAUSE frame based flow control.
MFC after:	1 week
2014-09-12 05:25:56 +00:00
Robert Watson
7524f39b9f Add new a M_START() mbuf macro that returns a pointer to the start of
an mbuf's storage (internal or external).

Add a new M_SIZE() mbuf macro that returns the size of an mbuf's
storage (internal or external).

These contrast with m_data and m_len, which are with respect to data
in the buffer, rather than the buffer itself.

Rewrite M_LEADINGSPACE() and M_TRAILINGSPACE() in terms of M_START()
and M_SIZE().

This is done as we currently have many instances of using mbuf flags
to generate pointers or lengths for internal storage in header and
regular mbufs, as well as to external storage. Rather than replicate
this logic throughout the network stack, centralising the
implementation will make it easier for us to refine mbuf storage.
This should also help reduce bugs by limiting the amount of
mbuf-type-specific pointer arithmetic.  Followup changes will
propagate use of the macros throughout the stack.

M_SIZE() conflicts with one macro in the Chelsio driver; rename that
macro in a slightly unsatisfying way to eliminate the collision.

MFC after:	3 days
Obtained from:	jeff (with enhancements)
Sponsored by:	EMC / Isilon Storage Division
Reviewed by:	bz, glebius, np
Differential Revision:	https://reviews.freebsd.org/D753
2014-09-11 07:16:15 +00:00
Alexander Motin
03d89c944a Add PCI ID for Promise TX8660 8-port 3Gbps HBA.
This device reports RAID subclass, but appears to be AHCI compatible.

Submitted by:	Yuri Perejilin <yuri@rivera.ru>
MFC after:	1 week
2014-09-10 19:53:31 +00:00
Edward Tomasz Napierala
2c5b89e54b Make sure we handle less than zero timeouts in iSCSI initiator and target
in a reasonable way.

Sponsored by:	The FreeBSD Foundation
2014-09-10 14:04:10 +00:00
Aleksandr Rybalko
f7f6c6024d Fix one more spelling mistake.
Pointed by:	danfe
2014-09-10 11:48:13 +00:00
Aleksandr Rybalko
13c6f8a053 spelling fixes
Submitted by:	"Sam Fourman Jr." <sfourman@gmail.com>
MFC after:	1 week
2014-09-10 11:27:33 +00:00
Aleksandr Rybalko
ab763ff846 o Add sysctls to enable/disable potentially dengerous key combinations, like
reboot/halt/debug.
o Add support for most key combinations supported by syscons(4).

Reviewed by:	dumbbell, emaste (prev revision of D747)
MFC after:	5 days
Sponsored by:	The FreeBSD Foundation
2014-09-10 11:13:13 +00:00
Andrew Turner
9ff96c2346 Move if_smc_fdt.c to live in sys/dev/smc. It's not specific to the ARM
Versatile hardware.
2014-09-10 10:59:17 +00:00
Robert Watson
620dbb4ed1 Replace local copy-and-paste implementations of printmbuf() in several
device drivers with calls to the centralised m_print() implementation.
While the formatting and output details differ a little, the content
is essentially the same, and it is unlikely anyone has used this
debugging output in some time.

This change reduces awareness of mbuf cluster allocation (and,
especially, the M_EXT flag) outside of the mbuf allocator, which will
make it easier to refine the external storage mechanism without
disrupting drivers in the future.

Style bugs are preserved.

Reviewed by:	bz, glebius
MFC after:	3 days
Sponsored by:	EMC / Isilon Storage Division
2014-09-10 09:57:32 +00:00
Peter Grehan
b3f7f76b8a Fix issue with nmdm and leading zeros in device name.
The nmdm code enforces a number between the 'nmdm' and 'A|B' portions
of the device name. This is then used as a unit number, and sprintf'd
back into the tty name. If leading zeros were used in the name,
the created device name is different than the string used for the
clone-open (e.g. /dev/nmdm0001A will result in /dev/nmdm1A).

Since unit numbers are no longer required with the updated tty
code, there seems to be no reason to force the string to be a
number. The fix is to allow an arbitrary string between
'nmdm' and 'A|B', within the constraints of devfs names. This allows
all existing user of numeric strings to continue to work, and also
allows more meaningful names to be used, such as bhyve VM names.

Tested on amd64, i386 and ppc64.

Reported by:	Dave Smith
PR:		192281
Reviewed by:	neel, glebius
Phabric:	D729
MFC after:	3 days
2014-09-10 05:44:15 +00:00
Navdeep Parhar
4309e7b020 Whitespace nit.
MFC after:	1 week
2014-09-09 18:36:00 +00:00
Aleksandr Rybalko
8a6a589219 Revert r269474. Special keyboard combinations should be handled by separate
sysctls.
2014-09-09 14:18:56 +00:00
Kevin Lo
141aa3b93a Drop frames that have larger than MCLBYTES. 2014-09-09 05:21:31 +00:00
Christian Brueffer
380064c8dc Use the right constants in comparisons. This is currently a nop, as
MIN_RXD == MIN_TXD and MAX_RXD == MAX_TXD.

Reviewed by:	Eric Joyner @ Intel
MFC after:	1 week
2014-09-08 19:24:25 +00:00
Alexander Motin
fcd7f38fb0 Bunch of microoptimizations to reduce dereferences and cache collisions. 2014-09-08 12:11:49 +00:00
Jean-Sébastien Pédron
313ef9368f vt(4): Change the terminal and buffer sizes, even without a font
This fixes a bug where scroll lock would not work for tty #0 when using
vt_vga's textmode. The reason was that this window is created with a
static 256x100 buffer, larger than the real size of 80x25.

Now, in vt_change_font() and vt_compute_drawable_area(), we still
perform operations even of the window has no font loaded (this is the
case in textmode here vw->vw_font == NULL). One of these operation
resizes the buffer accordingly.

In vt_compute_drawable_area(), we take the terminal size as is (ie.
80x25) for the drawable area.

The font argument to vt_set_border() is removed (it was never used) and
the code now uses the computed drawable area instead of re-doing its own
calculation.

Reported by:	Harald Schmalzbauer <h.schmalzbauer_omnilan.de>
Tested by:	Harald Schmalzbauer <h.schmalzbauer_omnilan.de>
MFC after:	3 days
2014-09-08 07:37:03 +00:00
Adrian Chadd
9dd099b274 Implement htprotmode handling.
This is separate to 11g protection - the default is to RTS protect
11n frames, including A-MPDU frames.

Tested:

* Intel 5100, STA mode
2014-09-08 07:16:00 +00:00
Adrian Chadd
339503ab41 (more) correctly account TX completion status for A-MPDU session frames.
The rules turn out to be:

* for non-aggregation session TX queues - it's either sent or not sent.
* for aggregation session TX queues - if nframes=1, then the status reflects
  the completed transmission.
* however, for nframes > 1, then this is just a status reflecting what
  the initial transmission did.  The compressed BA (immediate or delayed)
  may not have yet been received, so the actual frame status is in the
  compressed BA updates.

Whilst here, I fiddled with debugging and formatting a bit.

There's also RTS attempts (what the atheros chips call "short retries")
which weren't being logged and they aren't yet being used in the rate
control statistics updates.  For now, at least log them.

TODO:

* This still isn't 100% correct! So I have to tinker with this some more.
  (The failures aren't always failures..)
* Extend the rate control API in net80211 so it can take both short and
  long retry counts.

Tested:

* Intel 5100, STA mode
2014-09-08 03:16:28 +00:00
Adrian Chadd
f7efe7e999 Bring over some more status codes from the Linux iwlwifi driver.
The (eventual) intention is to create MIB counters for transmitted
frame completion to count how many packets with each status are
transmitted.

Note the difference between A-MPDU and non A-MPDU status.

Obtained from:	Linux iwlwifi/dvm driver
2014-09-08 03:12:42 +00:00
Hans Petter Selasky
113336eec2 Update mixer description for FastTrackPro.
MFC after:	3 days
2014-09-07 07:23:33 +00:00
Alexander Motin
c45ff92177 Save one register read (AHCI_IS) for AHCI controllers with only one port.
For controllers with only one port (like PCIe or M.2 SSDs) interrupt can
come from only one source, and skipping read saves few percents of CPU time.

MFC after:	1 month
H/W donated by:	I/O Switch
2014-09-06 19:43:48 +00:00
Ian Lepore
26511eb02e When registering an association between a device and an xref phandle, create
an entry in the xref list if one doesn't already exist for the given handle.

On a system that uses phandle properties, the init-time scan of the tree
which builds the xref list will pre-create entries for every xref handle
that exists in the data.  On systems where the xref and node handles are
synonymous there is no phandle property in referenced nodes, and the xref
list will initialize to an empty state.  In the latter case, we still need
to be able to associate a device_t with an xref handle, so we create list
entries on the fly as needed.  Since the node and xref handles are
synonymous, we have all the info needed to create a list entry at device
registration time.

The downside to this change is that it basically allows on the fly creation
of xref handles as synonyms of node handles, and the association of a
device_t with them.  Whether this is a bug or a feature is in the eye of
the beholder, I guess.
2014-09-06 18:43:17 +00:00
Warner Losh
4acab041dd Restore order of interrupt setup. Minor problems can result by
setting up the interrupts too early:

Reviewed by: mav@
Sponsored by: Netflix
2014-09-06 18:20:50 +00:00
Ian Lepore
f021180bfb Revert rr271190, it was based on a misunderstanding. The problem of
non-existant device<->xref info needs to be handled by creating the info,
which will come in a subsequent commit.
2014-09-06 17:50:59 +00:00
Alexander Motin
985da6db1c Fix typo in comments.
Submitted by:	Benedict Reuschling <bcr@FreeBSD.org>
MFC after:	6 days
2014-09-06 15:37:55 +00:00
John Baldwin
b1d735ba4c Create a separate structure for per-CPU state saved across suspend and
resume that is a superset of a pcb.  Move the FPU state out of the pcb and
into this new structure.  As part of this, move the FPU resume code on
amd64 into a C function.  This allows resumectx() to still operate only on
a pcb and more closely mirrors the i386 code.

Reviewed by:	kib (earlier version)
2014-09-06 15:23:28 +00:00
Ian Lepore
00eea22f11 Add OF_xref_from_node_strict() which returns -1 if there is no xref handle
for the node.  The default routine returns the untranslated handle, which
is sometimes useful, but sometimes you really need to know there's no
entry in the xref<->node<->device translation table.
2014-09-06 15:11:35 +00:00
Jean-Sébastien Pédron
6cbf3f62e0 vt_vga: vd_setpixel_t and vd_drawrect_t are noop in text mode
MFC after:	3 days
2014-09-05 18:11:39 +00:00
Alexander Motin
c6efb4c41d Invert AHCI_Q_NOBSYRES quirk meaning, waiting for readiness by default.
I gave up to update list of Marvell chips that require this quirk.
The final nail was growing number of PCIe/M.2 SSDs where Marvell chips
have PCI IDs of different vendors.

MFC after:	1 week
H/W donated by:	I/O Switch
2014-09-05 13:45:14 +00:00
Kevin Lo
6bd03b20fd The USB LED driver for the Dream Cheeky WebMail Notifier.
Reviewed by:	hselasky
2014-09-05 11:25:58 +00:00
Alexander Motin
4255b98bc1 Add IDs for Intel Patsburg USB 2.0 controller. 2014-09-05 07:42:34 +00:00
Warner Losh
802df3ace6 Separate out PCI attachment from the main AHCI driver. Move checks of
PCI IDs into quirks, which mostly fit (though you'd get no argument
from me that AHCI_Q_SATA1_UNIT0 is oddly specific). Set these quirks
in the PCI attachment. Make some shared functions public so that PCI
and possibly other bus attachments can use them.

The split isn't perfect yet, but it is functional. The split will be
perfected as other bus attachments for AHCI are written.

Sponsored by: Netflix
Reviewed by: kan, mav
Differential Revision: https://reviews.freebsd.org/D699
2014-09-04 22:22:53 +00:00
Roger Pau Monné
77b6916d2e Revert r269814: blkfront: add support for unmapped IO
Current busdma code for unmapped bios will not properly align the segment
size, causing corruption on blkfront devices. Revert the commit until
busdma code is fixed.

Reported by:	mav
MFC after:	1 day
2014-09-04 14:56:24 +00:00
Pyun YongHyeon
1dc616851a Do not blindly announce 1000baseT half-duplex capability in
autonegotiation.  Some controllers like cgem(4) do not support
half-duplex at gigabit speeds.
2014-09-04 01:04:37 +00:00
Ian Lepore
df63a5d236 Fixes and enhancements for the if_cgem driver...
- miibus fixes as suggested by Yonghyeon Pyun.
- enable VLAN MTU support.
- fix a few WITNESS complaints in cgem_attach().
- have cgem_attach() properly init the ifnet struct before calling
  mii_attach() to fix panic when using e1000phy.
- fix ethernet address changing.
- fix transmit queue overflow handling.
- tweak receive queue handling to reduce receive overflows.
- bring out MAC statistic counters to sysctls.
- add e1000phy to config file.
- implement receive hang work-around described in reference guide.
- change device name from if_cgem to cgem to be consistent with other
  interfaces.

Submitted by:	Thomas Skibo <ThomasSkibo@sbcglobal.net>
Reviewed by:	wkoszek, Yonghyeon PYUN <pyunyh@gmail.com>
2014-09-03 17:51:03 +00:00
Hans Petter Selasky
6301574838 Fix spelling.
PR:		193279
MFC after:	1 week
2014-09-03 13:15:16 +00:00
Hans Petter Selasky
7b520cfbc5 Add new quirk.
PR:		193279
MFC after:	1 week
2014-09-03 11:46:43 +00:00
Gleb Smirnoff
6b17688b56 Remove always false comparison.
Sponsored by:	Nginx, Inc.
2014-09-03 09:58:59 +00:00
Gleb Smirnoff
b1f8b58696 Use CSUM_BITS instead of incorrect copy.
Sponsored by:	Nginx, Inc.
2014-09-03 08:28:16 +00:00
Hans Petter Selasky
6084a8c0ec Fix logical error.
MFC after:	3 days
2014-09-03 05:14:50 +00:00
John Baldwin
a272a81370 Use callout(9) instead of timeout(9).
Tested by:	danfe
2014-09-02 18:57:19 +00:00
Kashyap D Desai
49328cc39c Fix for WITNESS warning while doing xpt_rescan.
This happen when converting any JBOD to RAID or creating
any new RAID from Unconfigured Drives.

Without this fix, user may see below call trace if  WITNESS is enabled.

witness_warn() at witness_warn+0x4b5/frame 0xfffffe011f929a00
uma_zalloc_arg() at uma_zalloc_arg+0x3b/frame 0xfffffe011f929a70
malloc() at malloc+0x192/frame 0xfffffe011f929ac0
mrsas_bus_scan_sim() at mrsas_bus_scan_sim+0x32/frame 0xfffffe011f929af0
mrsas_aen_handler() at mrsas_aen_handler+0x11c/frame 0xfffffe011f929b20
taskqueue_run_locked() at taskqueue_run_locked+0xf0/frame 0xfffffe011f929b80
taskqueue_thread_loop() at taskqueue_thread_loop+0x9b/frame 0xfffffe011f929bb0
fork_exit() at fork_exit+0x84/frame 0xfffffe011f929bf0
fork_trampoline() at fork_trampoline+0xe/frame 0xfffffe011f929bf0

Submitted by:   kadesai
Reviewed by:    ambrisko
MFC after:      3 days
2014-09-02 18:32:41 +00:00
Ian Lepore
b9819c95d1 Fix typo.
Pointy hat:	ian
2014-09-02 03:51:12 +00:00
Ian Lepore
b4172e33fd Use OF_xref_from_device(), not OF_xref_from_node(). Also, use bzero()
rather than memset().
2014-09-02 03:46:24 +00:00
Ian Lepore
937f32c079 Add OF_xref_from_device() so that there's no need to have an intermediate
call to ofw_bus_get_node() to lookup info that's already in the xreflist.
2014-09-02 03:45:01 +00:00
Ian Lepore
6b6d6c4437 Create an interface for drivers to enable or disable their clocks as listed
in the clocks=<...> properties of their FDT data.  The clock properties
consist of 2-cell tuples, each containing a clock device node reference and
a clock number.  A clock device driver can register itself as providing
this interface, then other drivers can turn the FDT clock node reference
into the corresponding device_t so that they can use the interface to query
and manipulate their clocks.

This provides convenience functions to enable or disable all the clocks
listed in the properties for a device, so most drivers will be able to
manage their clocks with a single call to fdt_clock_enable_all(dev).
2014-09-02 03:23:05 +00:00
Ian Lepore
274245c881 Create a mechanism for looking up a device_t associated with an ofw/fdt
xref handle, and for registering that association.  Also use the same data
for faster translations between node and xref handles.

Now when fdt properties contain &othernode references, a driver can find
the device instance that corresponds to &othernode, and thus can use
interfaces provided by that instance.

Reviewed by:	nwhitehorn
2014-09-01 22:40:31 +00:00
Ian Lepore
752ba93078 Rename OF_xref_phandle() to OF_node_from_xref() and add a new function
that provides the inverse translation, OF_xref_from_node().

Discussed with:	nwhitehorn
2014-09-01 18:51:01 +00:00
Marius Strobl
f0d2731dd8 - Nuke unused sdhci_softc.
- Static'ize sdhci_debug local to sdhci.c.
- Const'ify PCI device description strings.
- Nuke redundant resource ID members from sdhci_pci_softc.
- Nuke unused hw.sdhci_pci.debug tunable.
- Add support for using MSI instead of INTx, controllable via the tunable
  hw.sdhci.enable_msi (defaulting to on) and tested with a RICOH R5CE823 SD
  controller.
- Use NULL instead of 0 for pointers.

MFC after:	3 days
2014-08-31 17:56:54 +00:00
Gleb Smirnoff
09a8241fc9 It is actually possible to have if_t a typedef to non-void type,
and keep both converted to drvapi and non-converted drivers
compilable.

o Make if_t typedef to struct ifnet *.
o Remove shim functions.

Sponsored by:	Netflix
Sponsored by:	Nginx, Inc.
2014-08-31 12:48:13 +00:00
Gleb Smirnoff
997d2d833f Provide pointer from struct ifnet to struct netmap_adapter,
instead of abusing spare field.
2014-08-31 11:33:19 +00:00
Gleb Smirnoff
1bffa9511f Use define from if_var.h to access a field inside struct if_data,
that resides in struct ifnet.

Sponsored by:	Nginx, Inc.
2014-08-30 19:55:54 +00:00
Gavin Atkinson
dba11782c4 Replace cvsweb link wihg svnweb URL in bktr(4) release notes. 2014-08-30 18:01:45 +00:00
Warner Losh
0375d6f5f9 We were returning 20 bytes as the FIS size to send, but only
initializing 16. Initialize all 20 so we don't send garbage in the
Auxiliary register. The SATA standard mandates a 5 dword length for
the Host to Device FIS.

Sponsored by: Netflix
2014-08-30 02:13:09 +00:00
John Baldwin
d9abd30d22 When anouncing link state changes on an 802.11 interface with a vap,
announce the change on the vap's ifnet instead of the main ifnet.  This
matches the behavior of other wireless drivers in the tree and allows the
default devd configuration to correctly start dhclient automatically after
an ndis wireless device associates.

MFC after:	2 weeks
2014-08-29 22:01:47 +00:00
Alexander V. Chernikov
ea463f2dc0 * Add SIOCGI2C driver ioctl used to retrieve i2c info.
* Convert ixgbe to use this ioctl
* Convert ifconfig to use generic i2c handler for  "ix" interfaces.

Approved by:	Eric Joyner (ixgbe part)
MFC after:	2 weeks
Sponsored by:	Yandex LLC
2014-08-29 18:02:58 +00:00
Bjoern A. Zeeb
452fd26522 Try to also unbreak powerpc complaining about
"cast from pointer to integer of different size".

MFC after:	3 days
X-MFC with:	r270755
2014-08-29 14:38:57 +00:00
Bjoern A. Zeeb
3ad95447c8 These functions are #defined to "osdep" specific names without the "_mem"
extension.  Provide prototypes for the actual implementations.
Correct function arguments to match the implementations.

MFC after:	3 days
X-MFC with:	r270755
2014-08-29 12:48:38 +00:00
Bjoern A. Zeeb
b555c6140d Properly place #ifdef INET and #ifdef INET6 around variable declarations
and code to make the code compile.

Give the function seems to be slightly mixed with csum and tso,
make it non-fatal if we try to setup thing on a kernel without IP
support.  In practise the printf on the console will probably still
make your machine unhappy.

MFC after:	3 days
X-MFC with:	r270755
2014-08-29 12:45:14 +00:00
Bjoern A. Zeeb
f894ad8848 Properly handle prefetch only for amd64 and i386 as we do elsewhere.
In general theraven is right that we should factr this out and provide
a general and per-arch implementation that everything can use.

MFC after:	3 days
X-MFC with:	r270755
2014-08-29 12:40:01 +00:00
Bjoern A. Zeeb
ff21e856ec First try on fixing some more compile errors without actually testing:
- use proper __FreeBSD_version check and more importantly check for __am64__
  to be defined.  Whether the FreeBSD(_version) checks are needed is a
  different question.
- cast uint64_t to uintmax_t and use %jx for printing.

Note: there are more values that could be printed in that status function
	but leave that for the future;  printf doesn't seem to be the right
	way to do it anyway.
Note: there is more breakage related to i40e_allocate_dma*() having
	conflicting declarations, so more fixes to come.

PR:		193112
MFC after:	3 days
X-MFC with:	r270755
2014-08-29 09:37:18 +00:00
Jean-Sébastien Pédron
ba572d1a95 vt(4): Indicate that KDSETRAD case falls through the next case
CID:		1229953
MFC after:	1 week
2014-08-29 08:20:03 +00:00
Jean-Sébastien Pédron
b7fe496196 vt(4): Change vb_history_size from "int" to "unsigned int"
CID:		1230002, 1230003
MFC after:	1 week
2014-08-29 08:16:31 +00:00
Jack F Vogel
2f4959ab6a Fix the NOINET and NOINET6 builds.
MFC after:3 days
2014-08-29 00:33:31 +00:00
Jack F Vogel
1f873f1805 Remove the DEV_NETMAP code from the ixl drivers, it was a placeholder
and not yet ready to be defined, and its causing build errors.

MFC after:	3 days
2014-08-28 22:52:20 +00:00
Jack F Vogel
5c34b900df Some corrections, reformating, and additional info about the VF
driver in the README.

MFC after: 1 day
2014-08-28 21:45:07 +00:00
Steven Hartland
13b408044d Fix build breakage caused by ixl driver
Fix missing includes and invalid vars in ixl / ixlv driver added by r270346
which caused build failures for GENERIC kernel after it was made default
by r270755.

X-MFC-With: r270346 / r270755
Sponsored by:	Multiplay
2014-08-28 18:59:39 +00:00
Jean-Sébastien Pédron
24303da93c drm/radeon: Fix a memory leak when radeonkms is unloaded
MFC after:	1 week
2014-08-28 12:40:31 +00:00
Adrian Chadd
18aabe98d0 Inform the rate control code if a single frame AMPDU transmission succeeds
but has some retries.

Without this, single frame transmission in AMPDU will always look like
it succeeded fine, and thus AMRR will think it's totally fine to just
keep upping the rate upwards.

Now, this is still not quite right!  For multi-frame aggregates the
completion happens in two parts - the TX done and the BA received.
The driver is currently double accounting those a little - there's no
way to say to the rate control code "I completed X frames, Y worked fine,
there were Z retries." And it's a bit odd with iwn, as the firmware
retransmits frames for us so we don't get to see how many retransmits
happened; only that it took longer than normal.  I may have to extend
the rate control API to properly track that.

So this may keep the rate lower than it should be, but that's better
than keeping it higher than it should be.

Tested:

* 5100, STA mode
2014-08-28 07:44:59 +00:00
Adrian Chadd
bc0203e201 Fix antenna configuration, microcode version checks and rate selection
in preparation for the 5300 3x3 NIC.

During this particular adventure, I did indeed discover that a whole
swath of things made little to no sense.

Those included, and are fixed here:

* A lot of the antenna configuration bits assume the NIC has two receive
  chains.  That's blatantly untrue for NICs that don't.
* There was some disconnect between the antenna configuration when
  forming a PLCP rate DWORD (which includes the transmit antenna
  configuration), separate to the link quality antenna configuration.

  So now there's helper functions to return which antenna configurations
  to use and those are used wherever an antenna config is required.

* The 5300 does up to three stream TX/RX (so MCS0->23), however
  the link quality table has only 16 slots.  This means all of the
  rate entries are .. well, dual-stream rates.  If this is the case,
  the "last MIMO" parameter can't be 16 or it panics the firmware.
  Set it to 15.

* .. and since yes it has 16 slots, it only would try retransmitting
  from MCS8->MCS23, which can be quite .. terrible.  Hard-code the last
  two retry slots to be the lowest configured rate.

* I noticed some transmit configuration command stuff is different
  based on firmware API version, so I lifted that code from Linux.

* Add / augment some more logging to make it easier to capture this
  stuff.

Now, 3x3 is still terrible because the link quality configuration is
plainly not good enough.  I'll have to think about that.
However, the original goal of this - 3x3 operation on the Intel
5300 NIC - actually worked.

There are also rate control bugs in the way this driver handles
notifying the net80211 rate control code when AMPDU is enabled.
It always steps the rate up to the maximum rate possible - and
this eventually ends in much sadness.  I'll fix that later.

As a side note - 2GHz HT40 now works on all the NICs I have tested.

As a second side note - this exposed some bad 3x3 behaviour in
the ath(4) rate control code where it starts off at a 3-stream rate
and doesn't downgrade quickly enough.  This makes the initial
dhcp exchange take a long time.  I'll fix the ath(4) rate code
to start at a low fixed 1x1 MCS rate and step up if everything
works out.

Tested:

* Intel 2200
* Intel 2230
* Intel 5300
* Intel 5100
* Intel 6205
* Intel 100

TODO:

* Test the other NICs more thoroughly!

Thank you to Michael Kosarev <russiane39@gmail.com> for donating the
Intel 5300 NIC and pestering me about it since last year to try and
make it all work.
2014-08-28 03:18:27 +00:00
Jean-Sébastien Pédron
fa2694eec8 vt(4): If the terminal shrinks, make sure the mouse is inside the new area
MFC after:	1 week
2014-08-27 17:16:52 +00:00
Jean-Sébastien Pédron
84d623c61e vt(4): Fix mouse cursor handling in vt_fb/creator_vt/ofwfb
There were two issues:
    1. The area given to vt_is_cursor_in_area() was adding the drawable
       area offset, something already handled by this function.
    2. The cursor was shifted on the screen by the offset of this area
       and thus was misplaced or not erased. Furthermore, when reaching
       the bottom or right borders, the cursor was either totally
       removed or not erased correctly.

MFC after:	1 week
2014-08-27 15:10:28 +00:00
Hans Petter Selasky
c7818b48b6 - Update the OFED Linux Emulation layer as a preparation for a
hardware driver update from Mellanox Technologies.
- Remove empty files from the OFED Linux Emulation layer.
- Fix compile warnings related to printf() and the "%lld" and "%llx"
format specifiers.
- Add some missing 2-clause BSD copyrights.
- Add "Mellanox Technologies, Ltd." to list of copyright holders.
- Add some new compatibility files.
- Fix order of uninit in the mlx4ib module to avoid crash at unload
using the new module_exit_order() function.

MFC after:	1 week
Sponsored by:	Mellanox Technologies
2014-08-27 13:21:53 +00:00
Jean-Sébastien Pédron
c0b72c11ea vt(4): Recompute the drawable area when the resolution changes
This was only done when the font changed.

MFC after:	1 week
2014-08-27 11:27:48 +00:00
Jean-Sébastien Pédron
fba582e5f4 vt(4): Pause the vt_flush() timer when the screen is up-to-date
The timer is restarted whenever a window buffer is marked as dirty or
the mouse cursor moves.

There's still room for improvement. For instance, we should not mark a
window buffer as dirty when this window isn't displayed.

Review:		https://reviews.freebsd.org/D683
Reviewed by:	ray@
Approved by:	ray@
MFC after:	1 week
2014-08-27 11:08:09 +00:00
Jean-Sébastien Pédron
1097780459 drm: Don't "taskqueue" vt-switch if under DDB/panic situation
If DDB is active, we can't use a taskqueue thread to switch away from
the X window, because this thread can't run.

Reviewed by:	ray@
Approved by:	ray@
MFC after:	1 week
2014-08-27 10:07:08 +00:00
Jean-Sébastien Pédron
3e206539a1 vt(4): Add cngrab() and cnungrab() callbacks
They are used when a panic occurs or when entering a DDB session for
instance.

cngrab() forces a vt-switch to the console window, no matter if the
original window is another terminal or an X session. However, cnungrab()
doesn't vt-switch back to the original window currently.

MFC after:	1 week
2014-08-27 10:04:10 +00:00
Jean-Sébastien Pédron
d3773c6e8e vt(4): Implement basic support for KDSETMODE ioctl
With the current implementation, this allows an X11 server to tell
the console it switches a particular window in "graphics mode". This
information is used by the mouse handling code to ignore sysmouse events
in the window taken by the X server: only him should receive those
events.

Reported by:	flo@, glebius@, kan@
Tested by:	flo@
Reviewed by:	kan@
MFC after:	1 week
2014-08-27 09:34:41 +00:00
Jean-Sébastien Pédron
cb81897a72 vt(4): When creating a window buffer, fill it entirely
... not just the visible part.

This fixes a bug where, when switching from eg. vt_vga to vt_fb (ie. the
resolution goes up), the originally hidden, uninitialized area of the
buffer is displayed on the screen. This leads to a missing text cursor
when it's over an unitialized area.

This was also visible when selecting text: the uninitialized area was
not highlighted.

Internally, this area was zeroed: characters were all 0x00000000,
meaning the foreground and background color was black. Now, everything
is filled with a space with a gray foreground color, like the visible
area.

While here, remove the check for the mute flag and always use
TERMINAL_NORM_ATTR as the character attribute (ie. gray foreground,
black background).

MFC after:	1 week
2014-08-26 17:48:05 +00:00
Gleb Smirnoff
e86447ca44 - Remove socket file operations declaration from sys/file.h.
- Make them static in sys_socket.c.
- Provide generic invfo_truncate() instead of soo_truncate().

Sponsored by:	Netflix
Sponsored by:	Nginx, Inc.
2014-08-26 14:44:08 +00:00
Kevin Lo
15cb19cd6a Fix typo: s/mac_rev/mac_ver/
Submitted by:	Stefan Sperling <stsp at openbsd dot org>
2014-08-26 02:20:37 +00:00
Jean-Sébastien Pédron
af9f67ea3d vt_vga: Use Write Mode 0 to draw group of 8 pixels using 3 or more colors
This replaces the method based on Write Mode 3, which required reads
from the video memory to load the latches.

MFC after:	1 week
2014-08-25 20:15:19 +00:00
Jean-Sébastien Pédron
a8ca6ae235 vt(4): Intialize drawable area rectangle each time a font is loaded
This also fixes a problem where early in boot, the area was zero,
leading to nothing displayed for a few seconds.

MFC after:	1 week
2014-08-25 19:52:13 +00:00
Jean-Sébastien Pédron
83fbb296a9 vt(4): Store a rectangle for the drawable area, not just the top-left corner
This allows backends to verify they do not draw outside of this area.
This fixes a bug in vt_vga where the text was happily drawn over the
right and bottom margins, when using the Gallant font.

MFC after:	1 week
2014-08-25 19:06:31 +00:00
Jean-Sébastien Pédron
7e802e4968 vt(4): The cursor coordinates are relative to the drawn area
... not the whole screen. Don't use font offsets in
vt_mark_mouse_position_as_dirty().

This fixes a bug where the mouse position wasn't marked as dirty when
approaching the borders of the drawn area.

MFC after:	1 week
2014-08-25 17:08:38 +00:00
Jean-Sébastien Pédron
0878762c5b vt(4): Take font offset into account in vt_is_cursor_in_area()
This fixes a "General protection fault" in vt_vga, where
vt_is_cursor_in_area() erroneously reported that the cursor was over the
text. This led to negative integers stored in "unsigned int" and chaos.

MFC after:	1 week
2014-08-25 16:56:33 +00:00
Adrian Chadd
a39b467a26 i915 driver - enable opregion handle; program CADL.
add opregion handling for drm2 - which exposes some ACPI video configuration
pieces that some Lenovo laptop models use to flesh out which video device
to speak to.  This enables the brightness control in ACPI to work these models.

The CADL bits are also important - it's used to figure out which ACPI
events to hook the brightness buttons into.  It doesn't yet seem to work
for me, but it does for the OP.

Tested:

* Lenovo X230 (mine)
* OP: ASUS UX51VZ

PR:	190186
Submitted by:	Henry Hu <henry.hu.sh@gmail.com>
Reviewed by:	dumbbell
2014-08-25 05:03:10 +00:00
Jean-Sébastien Pédron
7e1770a7bb vt_vga: Fix the display of the splash screen
MFC after:	1 week
2014-08-24 14:39:33 +00:00
Jean-Sébastien Pédron
b0187490a8 vt(4): Fix order of arguments (x <-> y) when showing the splash screen
MFC after:	1 week
2014-08-24 09:47:39 +00:00
Jean-Sébastien Pédron
9de6b2c587 vt(4): Remove vd_bitbltchr_t
It's replaced by vd_bitblt_text_t, which gives more context to the
backend and allows it to perform more efficiently when redrawing a given
area.

MFC after:	1 week
2014-08-24 09:22:03 +00:00
Jean-Sébastien Pédron
631bb572ba vt(4): Add vd_bitblt_bmp_t callback
The code was already there in all backends, we just expose it. This is
used to display the splash screen.

MFC after:	1 week
2014-08-23 20:35:33 +00:00
Adrian Chadd
062cf7d90a Shut down RX before TX - in theory, this should make the chip less likely
to get upset.

The Qualcomm Atheros reference design code goes through significant
hacks to shut down RX before TX.  It doesn't even try do do it in the
driver - it actually makes the DMA stop routines in the HAL shut down
RX before shutting down TX.

So, to make this work for chips that aren't the AR9380 and later, do
it in the driver.  Shuffle the TX stop/drain HAL calls to be called
*after* the RX stop HAL call.

Tested:

* AR5413 (STA)
* AR5212 (STA)
* AR5416 (STA)
* AR9380 (STA)
* AR9331 (AP)
* AR9341 (AP)

TODO:

* test ar92xx series NIC and the AR5210/AR5211, in case there's something
  even odder about those.
2014-08-23 18:55:51 +00:00
Jean-Sébastien Pédron
5a7d2743bf ofwfb: Implement vd_bitblt_text_t
MFC after:	1 week
2014-08-23 15:05:11 +00:00
Jean-Sébastien Pédron
54927e051c creator_fb: Implement vd_bitblt_text_t
MFC after:	1 week
2014-08-23 15:04:20 +00:00
Jean-Sébastien Pédron
c285e4a5e9 vt_fb: Implement vd_bitblt_text_t for vt_fb and derivatives
MFC after:	1 week
2014-08-23 15:00:47 +00:00
Jean-Sébastien Pédron
946d0288f2 vt(4): Fix cursor handling in vt_flush()
There were situations where the cursor was not erased/redrawn or its
position was marked as dirty even though it's not displayed. The code is
now more straightforward.

At the same, add a function to determine if the cursor covers a given
area. This is used by backends to know if they need to draw the cursor.

This new function should be paired with a new state in struct vt_device,
called vd_mshown, which indicates if the cursor should be displayed.
This again simplifies vd_bitblt_text_t callback's API.

MFC after:	1 week
2014-08-23 11:46:52 +00:00
Jean-Sébastien Pédron
835ceac677 vt(4): Fix a crash in vt_mark_mouse_position_as_dirty() when in textmode
In textmode, no font is loaded, thus the page fault in
vt_mark_mouse_position_as_dirty() when it wants the font width/height.

For now, create a fake area for the textmode. This needs to be modified
if vt_vga gains mouse support in textmode.

While here, fix a build failure when SC_NO_CUTPASTE is defined:
vt_mark_mouse_position_as_dirty() must not be included in this case.

MFC after:	1 week
2014-08-23 07:41:08 +00:00
Jean-Sébastien Pédron
81788a2b59 vt_vga: Give only the character part of term_char_t to vga_get_cp437()
This fixes a bug where vga_get_cp437() was called with an invalid
argument. The screen was then filled with '?' instead of the actual
character.

MFC after:	1 week
2014-08-23 07:02:57 +00:00
Xin LI
090234abd3 Update hptnr(4) driver to version 1.0.1 supplied by the vendor.
v1.0.1 2014-8-19
  * Do not retry the command and reset the disk when failed to enable or
    disable spin up feature.
  * Fix up a bug that disk failed to probe if driver failed to access the
    10th LBA.
  * Fix a bug that request timeout but it has been completed in certain
    cases.
  * Support smartmontool for R750.

Many thanks to HighPoint for continued support of FreeBSD!

MFC after:	3 days
2014-08-23 01:52:43 +00:00
Jack F Vogel
61ae650d55 Update to the Intel Base driver for the Intel XL710 Ethernet Controller Family
- It was decided to change the driver name to if_ixl for FreeBSD
	- This release adds the VF Driver to the tree, it can be built into
	  the kernel or as the if_ixlv module
	- The VF driver is independent for the first time, this will be
	  desireable when full SRIOV capability is added to the OS.
	- Thanks to my new coworker Eric Joyner for his superb work in
	  both the core and vf driver code.

Enjoy everyone!

Submitted by:	jack.vogel@intel.com and eric.joyner@intel.com
MFC after:	3 days (hoping to make 10.1)
2014-08-22 18:59:19 +00:00
Jean-Sébastien Pédron
1f9c1db5f5 vt(4): Remove "FIXME" about multiple locking of vt_buf in vt_flush()
After some testing, it appears that acquiring the lock once and keeping
it longer is slower than taking it multiple times.

While here, fix a typo in another comment.

MFC after:	1 week
2014-08-22 17:49:24 +00:00
Jean-Sébastien Pédron
82276bbb00 vt(4): Use the actual size of the mouse when marking its position as dirty
This fixes a bug where part of the cursor was not erased.

MFC after:	1 week
2014-08-22 17:09:31 +00:00
Jean-Sébastien Pédron
523473b8f7 vt_vga: Remove a "FIXME" comment; the issue was solved in r270338
MFC after:	1 week
2014-08-22 17:05:41 +00:00
Jean-Sébastien Pédron
15c6d8f590 vt(4): Don't run vt_set_border() and vt_flush() concurrently
In the case of vt_vga, the two concurrent calls were writing to the same
VGA registers, causing incorrect refresh of the screen.

MFC after:	1 week
2014-08-22 16:30:26 +00:00
Roger Pau Monné
1e218ce964 xen: fix incorrectly accounted free
Fix some frees incorrectly assigned to M_XENBUS when the memory is
allocated with M_XENSTORE.

Sponsored by: Citrix Systems R&D
MFC after:	1 week

dev/xen/blkback/blkback.c:
 - Fix incorrect frees.
2014-08-22 15:38:21 +00:00
Jean-Sébastien Pédron
ccd5615a33 vt(4): The offset to center the text area is per-window now
The previous global offset, based on the last loaded font, had no
meaning for other windows. This caused a shifted text area, often partly
out-of-screen.

MFC after:	1 week
2014-08-22 15:36:57 +00:00
Roger Pau Monné
b740f63f23 netback: remove dead code
Remove the xen_net_read_mac function since it's not used anymore.

Sponsored by: Citrix Systems R&D
2014-08-22 15:34:56 +00:00
Jean-Sébastien Pédron
ab06c77688 vt(4): Give the window to vd_bitblt_text_t callback
... instead of both the buffer and the font. Again, this simplifies the
API.

MFC after:	1 week
2014-08-22 15:16:41 +00:00
Roger Pau Monné
1b386f626f netback: fixes for netback
This patch contains the following fixes for netback:
 - Only unbind the evtchn if it has been bound.
 - Set xnb->bridge to NULL after free to prevent double-freeing it.
 - Set the MAC address for the host-facing interface to a dummy value.

Sponsored by: Citrix Systems R&D

dev/xen/netback/netback.c:
 - Prevent trying to unbind if the evtchn has not been bounded.
 - Prevent double-freeing xnb->bridge.
 - Set the MAC address of the host-facing interface to a dummy value,
   so it can work when the interface is added to a bridge.
2014-08-22 15:10:26 +00:00
Roger Pau Monné
cd407ca216 pci: add a new pci_child_added newbus method.
This is needed so when running under Xen the calls to pci_child_added
can be intercepted and a custom Xen method can be used to register
those devices with Xen. This should not include any functional
change, since the Xen implementation will be added in a following
patch and the native implementation is a noop.

Sponsored by: Citrix Systems R&D
Reviewed by: jhb

dev/pci/pci.c:
dev/pci/pci_if.m:
dev/pci/pci_private.h:
dev/pci/pcivar.h:
 - Add the pci_child_added newbus method.
2014-08-22 15:05:51 +00:00
Jean-Sébastien Pédron
3235c9eb55 vt(4): Store cursor bitmap & colors in struct vt_device
This removes the need to specify them to each call to vd_bitblt_text_t
and, therefore, simplifies the API.

MFC after:	1 week
2014-08-22 14:31:53 +00:00
Jean-Sébastien Pédron
e2eb041785 vt(4): Mark new mouse position as dirty only when it's actually displayed
MFC after:	1 week
2014-08-22 13:48:33 +00:00
Jean-Sébastien Pédron
37fcd2911e vt_vga: Clip the draw area to never draw offscreen
This fixes a bug when two windows use different fonts, but a longer-term
solution is required. The dirty area should be stored as pixels, not
character cells, because such coordinates don't have the same meaning in
all windows, when using different fonts.

MFC after:	1 week
2014-08-22 10:49:51 +00:00
Jean-Sébastien Pédron
bdcaf97c3e vt(4): Add new vd_bitblt_text_t callback, and implement it for vt_vga
Compared to the deprecated vd_bitbltchr_t callback, vd_bitblt_text_t
receives:
    o  the whole text buffer
    o  the dirty area
    o  the mouse cursor (map, position, colors)

This allows the backend to perform optimization on how to draw things.
The goal is to remove vd_bitbltchr_t and vd_putchar_t, once all driver
are converted (only vt_vga is included in this commit).

In vt_vga, this allows to draw the text and the cursor in one pass,
without ever reading from video memory (because it has all the context).
The main benefit is the speed improvement: no more slideshow during
boot!

Other bugs fixed in vt_vga are:
    o  left-most characters are drawn properly (the left-most pixels were
       missing with bold characters and some wide letters such as 'm')
    o  no more black square around the cursor
    o  no cursor flickering when the text is scrolling

There are still many problems to fix: the known issues are marked with
"FIXME" inside the code.

MFC after:	1 week
2014-08-22 08:22:40 +00:00
Jean-Sébastien Pédron
0c1c6af438 vt_vga: When clearing video memory, don't read from it
The goal is to clear the video memory, in case an application drew to
it. So the content shouldn't be loaded in the latches, it can't be
trusted anyway.

This improves a bit the window switch speed.

MFC after:	1 week
2014-08-21 20:10:05 +00:00
Jean-Sébastien Pédron
02ebdd502d vt(4): Rename the "mouse_cursor" structure to "vt_mouse_cursor"
At the same time, "w" and "h" members are now called "width" and
"height". The goal is to have a more "public" structure, because it will
soon be passed as argument to a new callback, replacing vd_bitbltchr_t.

MFC after:	1 week
2014-08-21 19:42:24 +00:00
Jean-Sébastien Pédron
943c702a1b vt(4): Test if the cursor is shown only once
Later, we just see if the "struct mouse_cursor" pointer is set. This
avoids the need to mess with all the conditions several times; this has
been error prone.

While here, rename the variable "m" to a more meaningful "cursor", like
it's done elsewhere in the code.

MFC after:	1 week
2014-08-21 19:15:22 +00:00
Jean-Sébastien Pédron
c6e1a98786 vt(4): Constify vt_buf argument of vtbuf_iscursor()
MFC after:	1 week
2014-08-21 18:26:32 +00:00
Edward Tomasz Napierala
ddc5fd903d Use proper include paths in kernel iSCSI code.
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
2014-08-21 16:08:17 +00:00
Jean-Sébastien Pédron
52ff33d967 vt(4): Pause the flush timer while swithing window
This fixes bad looking refresh when switching window: squares instead
of text, flashing screen, and so on. In the worst case, vt_flush() came
at a very inappropriate timing and the screen was not refreshed at all
(leaving squares all over the place).

This doesn't fix the flickering of the screen with vt_vga, because the
sync signal is temporarily stopped and the video memory is cleared.

MFC after:	1 week
2014-08-21 15:55:18 +00:00
Edward Tomasz Napierala
b7a65e3936 Make the iSCSI stack use __FBSDID() properly.
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
2014-08-21 15:32:38 +00:00
Jean-Sébastien Pédron
353ad09fad vt(4): Mark cursor position as dirty when we enable/disable it
MFC after:	1 week
2014-08-21 15:14:54 +00:00
Jean-Sébastien Pédron
7e6dfdd6e5 vt(4): Mark the current cursor position as dirty
Like r270273, this has no effect for now, because the cursor is always
drawn. This is in preparation of future changes to vd_bitbltchr_t API.

MFC after:	1 week
2014-08-21 15:00:21 +00:00
Jean-Sébastien Pédron
608b7ceace vt(4): If the cursor didn't move, don't mark its position as dirty
Currently, this has no effect, because the cursor is always redrawn
anyway. But this will be useful after improvements to the vd_bitbltchr_t
callback API.

The vt_device structure members used to store the position of the cursor
as of the last redraw are renamed from vd_mdirty{x,y} to vd_mold{x,y}.
The associated comment is fixed too. Also, their value is now expressed
in pixels, not in character columns/row.

MFC after:	1 week
2014-08-21 14:54:37 +00:00
Jean-Sébastien Pédron
e861fb376a vt(4): If the cursor is globally disabled, don't mark its position as dirty
This avoids unnecessary redraw. In particular, during boot, where the
cursor is disabled and its fake position is [0;0], this triggered a
refresh of the whole screen each time vt_flush() is called.

MFC after:	1 week
2014-08-21 14:12:11 +00:00
Jean-Sébastien Pédron
c5dabe0780 vt(4): Mark cursor old position as dirty before reading the dirty area
Otherwise, the redraw is done during the next vt_flush run.

MFC after:	1 week
2014-08-21 13:28:48 +00:00
Jean-Sébastien Pédron
c4ad232a03 vt(4): Handle global and per-window mouse cursor toggle in one place
Before the global flag was set/unset using the CONS_MOUSECTL ioctl, and
the per-window flag through the MOUSE_SETLEVEL or MOUSE_SETMODE ioctls.

Also, if the cursor is already enabled/disabled, return immediatly. This
avoids to reset the cursor's position to the center of the screen.

This matches syscons' behavior.

While here, remove a trailing space and a redundant variable
declaration.
2014-08-21 13:04:34 +00:00
Jean-Sébastien Pédron
a5d099afa9 vt(4): Fix an inconsistency between the mouse cursor bitmap and its mask
MFC after:	1 week
2014-08-21 10:54:39 +00:00
Adrian Chadd
f8cdacdd18 Add missing locking.
Whilst here, assert that the lock is held when calling epstop().

Tested:

ep0: <3com Megahertz 574B>
2014-08-21 00:57:32 +00:00
Navdeep Parhar
9721a22d4a Change netmap's global lock to sx instead of a mutex.
Reviewed by:	luigi@
MFC after:	1 day
2014-08-20 23:37:44 +00:00
John Baldwin
669eac89c5 Fix build of si(4) and enable it in LINT on amd64 and i386. 2014-08-20 16:07:17 +00:00