Commit Graph

22587 Commits

Author SHA1 Message Date
Attilio Rao
c839b5bbf7 #PROCHOT assertion is sticky after reading the MSR (accordingly with
Intel manuals) it must be cleared by writing a 0.
Fix that.

Sponsored by:	Sandvine Incorporated
Reported by:	rstone
Reviewed by:	delphij, emaste, rstone
Approved by:	re (kib)
MFC after:	1 week
2011-09-19 10:58:30 +00:00
Ryan Stone
11dc48dfde Clear transmit checksum offload context state upon lem(4) interface
initialization.  Prior to this change packets may be transmitted with an
incorrect checksum.

Em(4) already has an equivalent change in r213234.

Obtained From:  Sandvine
MFC After:      1 week
Approved by:    re (bz)
2011-09-17 13:48:09 +00:00
Kip Macy
8451d0dd78 In order to maximize the re-usability of kernel code in user space this
patch modifies makesyscalls.sh to prefix all of the non-compatibility
calls (e.g. not linux_, freebsd32_) with sys_ and updates the kernel
entry points and all places in the code that use them. It also
fixes an additional name space collision between the kernel function
psignal and the libc function of the same name by renaming the kernel
psignal kern_psignal(). By introducing this change now we will ease future
MFCs that change syscalls.

Reviewed by:	rwatson
Approved by:	re (bz)
2011-09-16 13:58:51 +00:00
Hans Petter Selasky
7cd72d8565 Reduce USB memory usage during enumeration.
We are allocating some kilobytes of extra memory during USB device enumeration.
This does not change alot under FreeBSD, but makes sense for various embedded
operating systems using the FreeBSD USB stack, which have less memory
resources available.

Approved by:	re (kib)
MFC after:	1 week
2011-09-14 15:16:53 +00:00
Christian Brueffer
31f301d021 Improve the sleep_delay sysctl description by specifying which unit
the number is in.

PR:		159975
Submitted by:	gcooper
Approved by:	re (kib)
MFC after:	1 week
2011-09-13 15:57:29 +00:00
David Christensen
61b6cf3661 - Fix compiler warning in ADD_64() macro.
Approved by:	re
Obtained from:	dimitry@andic.com
MFC after:	One week
2011-09-13 15:49:28 +00:00
John Baldwin
06c9ee053d Partially revert 222753: If a CardBus card stores its CIS in a BAR, delete
the BAR after parsing the CIS.  This forces the resource range to be
reallocated if the BAR is reused by the device.

Submitted by:	deischen
Reviewed by:	imp
Approved by:	re (kib)
2011-09-12 15:21:52 +00:00
Andriy Gapon
7a2aafc355 dsp_ioctl: fix type of variable used to store ioctl request
PR:		kern/156433
Submitted by:	Grigori Goronzy <greg@chown.ath.cx>
Reviewed by:	hselasky
Approved by:	re (kib)
MFC after:	1 week
2011-09-12 08:38:21 +00:00
Adrian Chadd
637b8c6d88 Fix the order of parameters passed to the HT frame duration calculation.
Approved by:	re (kib)
2011-09-11 09:43:13 +00:00
Hans Petter Selasky
3f37fb622c Refactor auto-quirk solution so that we break as few external
drivers as possible.

PR:		usb/160299
Approved by:	re (kib)
Suggested by:	rwatson
MFC after:	0 days
2011-09-10 15:55:36 +00:00
Adrian Chadd
fc4de9b7fc Update the TSF and next-TBTT methods to work for the AR5416 and later NICs.
This is another commit in a series of TDMA support fixes for the 11n NICs.

* Move ath_hal_getnexttbtt() into the HAL; write methods for it.
  This returns a timer value in TSF, rather than TU.

* Move ath_hal_getcca() and ath_hal_setcca() into the HAL too, where they
  likely now belong.

* Create a new HAL capability: HAL_CAP_LONG_RXDESC_TSF.
  The pre-11n NICs write 15 bit TSF snapshots into the RX descriptor;
  the AR5416 and later write 32 bit TSF snapshots into the RX descriptor.
* Use the new capability to choose between 15 and 31 bit TSF adjustment
  functions in ath_extend_tsf().

* Write ar5416GetTsf64() and ar5416SetTsf64() methods.
  ar5416GetTsf64() tries to compensate for TSF changes at the 32 bit boundary.

According to yin, this fixes the TDMA beaconing on 11n chipsets and TDMA
stations can now associate/talk, but there are still issues with traffic
stability which need to be investigated.

The ath_hal_extendtsf() function is also used in RX packet timestamping;
this may improve adhoc mode on the 11n chipsets. It also will affect the
timestamps seen in radiotap frames.

Submitted by:	Kang Yin Su <cantona@cantona.net>
Approved by:	re (kib)
2011-09-08 01:23:05 +00:00
Pyun YongHyeon
a3f4b4527c vge(4) hardwares poll media status and generates an interrupt
whenever the link state is changed.  Using software based polling
for media status tracking is known to cause MII access failure
under certain conditions once link is established so vge(4) used to
rely on link status change interrupt.
However DEVICE_POLLING completely disables generation of all kind
of interrupts on vge(4) such that this resulted in not detecting
link state change event.  This means vge(4) does not correctly
detect established/lost link with DEVICE_POLLING.  Losing the
interrupt made vge(4) not to send any packets to peer since vge(4)
does not try to send any packets when there is no established link.

Work around the issue by generating link state change interrupt
with DEVICE_POLLING.

PR:		kern/160442
Approved by:	re (kib)
2011-09-07 16:57:43 +00:00
Adrian Chadd
c62055f6de Add a definition for ASYNC_CAUSE_CLR. It's not used yet, but the
reference driver does clear the async interrupts after each service.
I'll tinker with this in a future commit.

Obtained from:	Atheros
Approved by:	re (kib)
2011-09-07 03:00:58 +00:00
Bjoern A. Zeeb
dc079616cd Shorten a variable access some using a cached value rather than
casting the input argument again, making the code more readable.

Reviewed by:	jhb
MFC after:	2 weeks
Approved by:	re (kib)
2011-09-07 00:43:28 +00:00
Adrian Chadd
aacc74998a Fix 5ghz calibration logic when using AR9280 w/ fast clock.
When the fast clock (44mhz) is enabled for 5ghz HT20, the
dual ADCs aren't enabled. Trying to do the ADC calibrations
here would result in calibration never completing; this
resulted in IQ calibration never running and thus performance
issues in 11a/11n HT20 mode.

Leave it enabled for non-fastclock (40mhz) 11a mode and
HT40 modes.

This has been fixed in discussion with Felix Fietkau (nbd)
and discussions with the Atheros baseband team.

Linux ath9k now has a similar fix.

Approved by:	re (kib)
2011-09-06 10:54:56 +00:00
Adrian Chadd
d497ffcab4 Fix the addac serial load register write for AR5416.
Obtained from:	Linux, Atheros
Approved by:	re (kib)
2011-09-06 10:49:05 +00:00
Hans Petter Selasky
5dc9d76584 Fix precedence warning when compiling kernel with clang.
Approved by:	re (kib)
Submitted by:	dim
MFC after:	1 week
2011-09-06 08:15:55 +00:00
Qing Li
62e3af5225 The maximum read size of incoming packets is done in 1024-byte increments.
The current code was rounding down the maximum frame size instead of
routing up, resulting in a read size of 1024 bytes, in the non-jumbo
frame case, and splitting the packets across multiple mbufs.

Consequently the above problem exposed another issue, which is when
packets were splitted across multiple mbufs, and all of the mbufs in the
chain have the M_PKTHDR flag set.

Submitted by:	original patch by Ray Ruvinskiy at BlueCoat dot com
Reviewed by:	jfv, kmacy, rwatson
Approved by:	re (rwatson)
MFC after:	5 days
2011-09-05 17:54:19 +00:00
Hans Petter Selasky
d334432fd3 Some USB mass storage devices requires that the sense information
is retrieved after a failed SCSI command to continue normal
operation. Else this sense information is retrived at the next
SCSI command.

Approved by:	re (kib)
Reported by:	Alex Kozlov
MFC after:	1 week
PR:		usb/160299
2011-09-05 14:37:59 +00:00
Stanislav Sedov
bd2369f62e - Fix NULL pointer dereference when a packet of uneven size is being
transmitted.

Approved by:	re (kib)
MFC after:	3 days
2011-09-02 20:35:22 +00:00
Hans Petter Selasky
d46dc4ad74 This patch adds automatic detection of USB mass storage devices
which does not support the no synchronize cache SCSI command.

The __FreeBSD_version version macro has been bumped and
external kernel modules needs to be recompiled after
this patch.

Approved by:    re (kib)
MFC after:      1 week
PR:		usb/160299
2011-09-02 18:50:44 +00:00
Robert Watson
e53e8455f0 Add support for alternative break-to-debugger support on the Xen console.
This should help debug boot-time hangs experienced in 9.0-BETA.

MFC after:	3 weeks
Tested by:	sbruno
Approved by:	re (kib)
2011-09-02 17:36:01 +00:00
Xin LI
cdd4eea9fc Fix a bug in ichwd(4) which prevents it from beig enabled if the new
timeout is the same timeout.

Submitted by:	Dmitrij Tejblum <tejblum yandex-team.ru>
PR:		kern/139604
MFC after:	2 weeks
Approved by:	re (kib)
2011-09-02 17:06:50 +00:00
Xin LI
d1f97f76a5 Expose more variables from coretemp(4) via sysctl:
- tjmax - Tj(max) value from the CPU
 - delta - current delta reading
 - resolution - sensor resolution in Celsius
 - throttle_log - whether a #PROCHOT was asserted since last reset

Submitted by:	Mark Johnston <markjdb gmail.com> (mostly)
MFC after:	1 month
Approved by:	re (kib)
2011-09-02 17:06:23 +00:00
Robert Watson
a608af7817 Add support for alternative break-to-debugger to syscons(4). While most
keyboards allow console break sequences (such as ctrl-alt-esc) to be
entered, alternative break can prove useful under virtualisation and
remote console systems where entering control sequences can be
difficult or unreliable.

MFC after:	3 weeks
Approved by:	re (bz)
2011-08-27 22:10:45 +00:00
Robert Watson
e5a0927394 Follow up to r225203 refining break-to-debugger run-time configuration
improvements:

(1) Implement new model in previously missed at91 UART driver
(2) Move BREAK_TO_DEBUGGER and ALT_BREAK_TO_DEBUGGER from opt_comconsole.h
    to opt_kdb.h (spotted by np)
(3) Garbage collect now-unused opt_comconsole.h

MFC after:	3 weeks
Approved by:	re (bz)
2011-08-27 14:24:27 +00:00
Robert Watson
4cf7545589 Attempt to make break-to-debugger and alternative break-to-debugger more
accessible:

(1) Always compile in support for breaking into the debugger if options
    KDB is present in the kernel.

(2) Disable both by default, but allow them to be enabled via tunables
    and sysctls debug.kdb.break_to_debugger and
    debug.kdb.alt_break_to_debugger.

(3) options BREAK_TO_DEBUGGER and options ALT_BREAK_TO_DEBUGGER continue
    to behave as before -- only now instead of compiling in
    break-to-debugger support, they change the default values of the
    above sysctls to enable those features by default.  Current kernel
    configurations should, therefore, continue to behave as expected.

(4) Migrate alternative break-to-debugger state machine logic out of
    individual device drivers into centralised KDB code.  This has a
    number of upsides, but also one downside: it's now tricky to release
    sio spin locks when entering the debugger, so we don't.  However,
    similar logic does not exist in other device drivers, including uart.

(5) dcons requires some special handling; unlike other console types, it
    allows overriding KDB's own debugger selection, so we need a new
    interface to KDB to allow that to work.

GENERIC kernels in -CURRENT will now support break-to-debugger as long as
appropriate boot/run-time options are set, which should improve the
debuggability of BETA kernels significantly.

MFC after:	3 weeks
Reviewed by:	kib, nwhitehorn
Approved by:	re (bz)
2011-08-26 21:46:36 +00:00
Adrian Chadd
f3fb16875c Fix a missing initialisation of bt_flags when setting up the TDMA beacon.
The AR5212 HAL didn't check this field; timers are enabled a different
way.

The AR5416 HAL however did, and since this field was uninitialised, it had
whatever was on the stack at the time. This lead to "unpredictable"
behaviour.

This allows TDMA to work on the AR5416 and later chipsets.

Thanks to:	paradyse@gmail.com
Approved by:	re (kib, blanket)
2011-08-24 14:11:00 +00:00
Alexander Motin
376271fb4c Add ID for ASMedia ASM1061 2-port PCIe 2.0 x1 6Gb/s SATA controller.
Approved by:	re (blackend)
MFC after:	1 week
2011-08-24 09:08:07 +00:00
Adrian Chadd
607756e9de TIM/Timer fixes for AR5416 and later:
* Fix SLEEP1/SLEEP2 register definitions; the CAB/Beacon timeout
  fields have changed in AR5416 and later
* The TIM_PERIOD and DTIM_PERIOD registers are now microsecond fields,
  not TU.

Obtained from:	Linux ath9k, Atheros reference
Approved by:	re (kib, blanket)
2011-08-24 00:45:53 +00:00
Adrian Chadd
34ff1d08f6 These timer registers are all 1uS in resolution in AR5416
or later. Previous hardware had some as TU, some as 1/8th
TU.

* Modify AR_NEXT_DBA and AR_NEXT_SWBA to use a new macro,
  ONE_EIGHTH_TU_TO_USEC(), which converts the 1/8th TU
  fields to USEC. This is just cosmetic and matches the
  Atheros reference driver.

* Fix AR_NEXT_TBTT, which is USEC, not TU.

Submitted by:	paradyse@gmail.com
Approved by:	re (kib, blanket)
2011-08-23 13:36:09 +00:00
Pyun YongHyeon
462d5251d7 Disable PHY hibernation until I get more detailed hibernation
programming secret.  The PHY would go into sleep state when it
detects no established link and it will re-establish link when the
cable is plugged in.  Previously it failed to re-establish link
when the cable is plugged in such that it required to manually down
and up the interface again to make it work.  This came from
incorrectly programmed hibernation parameters.  According to
Atheros, each PHY chip requires different configuration for
hibernation and different vendor has different settings for the
same chip.
Disabling hibernation may consume more power but establishing link
looks more important than saving power.
Special thanks to Atheros for giving me instructions that disable
hibernation.

MFC after:	1 week
Approved by:	re (kib)
2011-08-22 20:33:05 +00:00
Hans Petter Selasky
d840e1d248 Add new USB ID to u3g driver.
Approved by:    re (kib)
MFC after:      1 week
PR:		usb/159919
2011-08-20 16:21:40 +00:00
Hans Petter Selasky
fbaee0f1f5 Fix for recursive locking in usb_close() after change 224777.
Approved by:    re (kib)
MFC after:      3 days
Reported by:	kwm @
2011-08-20 15:12:53 +00:00
Hans Petter Selasky
0f92e529e1 Add new USB ID.
Approved by:    re (kib)
MFC after:      1 week
PR:		usb/159836
2011-08-20 14:21:32 +00:00
Marius Strobl
5ca7dfffdf Revert r224157, re-enabling r222135. The underlying problem keeping the
latter from working as expected was fixed in r225014.

MFC after:	3 days
Approved by:	re (kib)
2011-08-19 19:13:31 +00:00
Marius Strobl
6e3f307486 r221812 reveals that at least some Broadcom PHYs default to being not only
isolated but also powered down after a reset and while they just work fine
[sic] when both is the case they don't if they are only deisolate but still
powered down. So in order to put PHYs in an overall normal operation mode
for the common case, ensure in mii_phy_reset() that they are not powered
down after a reset. Unfortunately, this only helps in case of BCM5421,
while BCM5709S apparently only work when they remain isolated and powered
down after a reset. So don't call mii_phy_reset() in brgphy_reset() and
implement the reset locally leaving the problematic bits alone. Effectively
this bypasses r221812 for brgphy(4).
Thanks to Justin Hibbits for doing a binary search in order to identify
the problematic commit.

PR:		157405, 158156
Reviewed by:	yongari (mii_phy_reset() part)
Approved by:	re (kib)
MFC after:	3 days
2011-08-19 19:12:58 +00:00
Attilio Rao
72dc07eb44 Bump the maximum coretemp limit (for CPU temperature) to 110. Several
cores with temp in the range 101-105 have been found in the past.

Sponsored by:	Sandvine Incorporated
Reviewed by:	delphij, emaste
Approved by:	re (kib)
MFC after:	3 days
2011-08-19 13:31:48 +00:00
Hans Petter Selasky
9465dbeb5c Add sysctl to not reset the device on clear stall failures, to
temporarily mitigate problems with VMs.

Approved by:    re (kib)
MFC after:      1 week
2011-08-19 09:01:34 +00:00
Kenneth D. Merry
5f06dfb792 Set the max_lun field in the path inquiry CCB for the mps(4) driver to 8.
This allows LUNs greater than 0 to be probed.  The value can be increased
later if need be.

Approved by:	re (kib)
2011-08-18 16:07:41 +00:00
Alexander Motin
ad06556a91 Fix headphones pin configuration on Lenovo B450 laptop.
Submitted by:	"Sergey V. Dyatko" <sergey.dyatko@gmail.com>
Approved by:	re (kib)
2011-08-18 13:33:34 +00:00
Alexander Motin
9839387616 Always check current HPET counter value after comparator programming to
avoid lost timer interrupts. Previous optimization attempt doing it only
for intervals less then 5000 ticks (~300us) reported to be unreliable by
some people. Probably because of some heavy SMI code on their boards.
Introduce additional safety interval of 128 counter ticks (~9us) between
programmed comparator and counter values to cover different cases of
delayed write found on some chipsets.

Approved by:	re (kib)
2011-08-16 21:51:29 +00:00
Konstantin Belousov
9c00bb9190 Add the fo_chown and fo_chmod methods to struct fileops and use them
to implement fchown(2) and fchmod(2) support for several file types
that previously lacked it. Add MAC entries for chown/chmod done on
posix shared memory and (old) in-kernel posix semaphores.

Based on the submission by:	glebius
Reviewed by:	rwatson
Approved by:	re (bz)
2011-08-16 20:07:47 +00:00
Xin LI
4e32649fbf Update arcmsr(4) to 1.20.00.22 to solve recursive acquisition of buffer
mutex, which would lead to a deadlock.

Many thanks to Areca for their continued support of FreeBSD.

Submitted by:	Ching Huang <ching2048 areca com tw>
Tested by:	Willem Jan Withagen <wjw digiware nl>
MFC after:	3 days
Approved by:	re (kib)
2011-08-16 08:41:37 +00:00
John Baldwin
8efbf2642b Add device id for the Moxa CP-112UL dual-port serial adapters.
Submitted by:	Jan Mikkelsen  janm of transactionware com
Approved by:	re (kib)
MFC after:	1 week
2011-08-15 19:29:25 +00:00
Alexander Motin
1f89a4dc85 Fix integer overflow on 32bit systems when calculating media size,
reintroduced by r222475.

Approved by:	re (kib)
2011-08-14 16:17:00 +00:00
Matt Jacob
e95725cb76 Most of these changes to isp are to allow for isp.ko unloading.
We also revive loop down freezes. We also externaliz within isp
isp_prt_endcmd so something outside the core module can print
something about a command completing. Also some work in progress to
assist in handling timed out commands better.

Partially Sponsored by: Panasas
Approved by:	re (kib)
MFC after:	1 month
2011-08-13 23:34:17 +00:00
Matt Jacob
de46193396 Fixes zombie device and loop down timers so that they work more than
once. Use taskqueues to do the actual work.

Fix an offset line.

Fix isp_prt so that prints from just one buffer, which makes it
appear cleanly cleanly in logs on SMP systems.

Approved by:	re (kib)
MFC after:	1 month
2011-08-12 19:51:28 +00:00
Robert Watson
a9d2f8d84f Second-to-last commit implementing Capsicum capabilities in the FreeBSD
kernel for FreeBSD 9.0:

Add a new capability mask argument to fget(9) and friends, allowing system
call code to declare what capabilities are required when an integer file
descriptor is converted into an in-kernel struct file *.  With options
CAPABILITIES compiled into the kernel, this enforces capability
protection; without, this change is effectively a no-op.

Some cases require special handling, such as mmap(2), which must preserve
information about the maximum rights at the time of mapping in the memory
map so that they can later be enforced in mprotect(2) -- this is done by
narrowing the rights in the existing max_protection field used for similar
purposes with file permissions.

In namei(9), we assert that the code is not reached from within capability
mode, as we're not yet ready to enforce namespace capabilities there.
This will follow in a later commit.

Update two capability names: CAP_EVENT and CAP_KEVENT become
CAP_POST_KEVENT and CAP_POLL_KEVENT to more accurately indicate what they
represent.

Approved by:	re (bz)
Submitted by:	jonathan
Sponsored by:	Google Inc
2011-08-11 12:30:23 +00:00
Hans Petter Selasky
2ffd5fdcc4 Use synchronous device destruction instead of asynchronous, so that a new
device having the same name like a previous one is not created before the old
one is gone. This fixes some panics due to asserts in the devfs code which
were added recently.

Approved by:    re (kib)
MFC after:      1 week
2011-08-11 11:30:21 +00:00