Commit Graph

22574 Commits

Author SHA1 Message Date
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
Marius Strobl
1bf5a6cf3c o Improve 224494:
- Ignore some more internal SAS device status change events.
  - Correct inverted Bus and TargetID arguments in a warning.
o Add a warning for MPI_EVENT_SAS_DISCOVERY_ERROR events, which can help
  identifying broken disks.

Submitted by:	Andrew Boyer
Approved by:	re (kib)
Committed from: Chaos Communication Camp 2011
2011-08-10 19:05:22 +00:00
Attilio Rao
2d49ef5934 Revert r224736 as the introduced value was already present.
Reported by:	tinderbox, pluknet
Approved by:	re (kib)
2011-08-09 20:55:54 +00:00
Attilio Rao
b1f0f5b76e Add the PCI ID for the PCH DH89xxCC on ichsmb as got from Linux counterpart.
Sponsored by:	Sandvine Incorporated
Reviewed by:	emaste, rstone
Approved by:	re (bz)
MFC after:	3 days
2011-08-09 16:42:31 +00:00
Adrian Chadd
e69c2d83cf Remove the now unneeded references to these DFS methods.
Sorry for the noise everyone.

Approved by:	re (kib, blanket)
2011-08-09 15:46:52 +00:00
Alexander Motin
477a63a864 Do not block zero report ID. It is correct value for devices with single
ID. This fixes USB_SET_IMMED call (synchronous operation) of the uhid(4)
driver on devices with single report ID.

Reviewed by:	hselasky
Approved by:	re (kib)
MFC after:	1 week
2011-08-09 08:11:26 +00:00
Adrian Chadd
f35ec93778 Remove this call, now that I've solved the radar module problem without
needing this particular modification.

It can be called during ath_dfs_radar_enable() and still achieve the
same functionality, so I am.

Approved by:	re (kib, blanket)
2011-08-09 04:24:56 +00:00
Adrian Chadd
ef068c6d9f And add another missing brace. Another pointy hat moment.
This one however isn't used by any public code yet, so it
didn't break the build.

Approved by:	re (kib, blanket)
2011-08-08 19:03:26 +00:00
Adrian Chadd
ffae5d00d2 Bitten again by the optional HALDEBUG compilation.
Remove this debugging, it's not needed anymore and when not enabled,
those variables trigger a compiler warning.

Approved by:	re (kib, blanket)
Pointy-hat-to:	adrian, for not testing a non-debug compile of this code enough
2011-08-08 18:05:22 +00:00
Adrian Chadd
7dd4de1301 The older HAL code sets up the regulatory domain once; FreeBSD/net80211
allows it to be overridden at runtime.

Thus, add a function which updates ah_dfsDomain after a channel set
call to ath_hal_set_channels().

Approved by:	re (kib, blanket)
2011-08-08 17:33:35 +00:00
Adrian Chadd
8db87e4079 Introduce some more DFS related hooks, inspired both by local work
and the Atheros reference code.

The radar detection code needs to know what the current DFS domain is.
Since net80211 doesn't currently know this information, it's extracted
from the HAL regulatory domain information.

The specifics:

* add a new ath_dfs API hook, ath_dfs_init_radar_filters(), which
  updates the radar filters whenever the regulatory domain changes.
* add HAL_DFS_DOMAIN which describes the currently configured DFS domain .
* add a new HAL internal variable which tracks the currently configured
  HAL DFS domain.
* add a new HAL capability, HAL_CAP_DFS_DMN, which returns the currently
  configured HAL DFS domain setting.
* update the HAL DFS domain setting whenever the channel setting is
  updated.

Since this isn't currently used by any radar code, these should all
be no-ops for existing users.

Obtained from:	Atheros
Submitted by:	KBC Networks, sibridge
Approved by:	re (kib, blanket)
2011-08-08 16:22:42 +00:00
Adrian Chadd
6bd78ef403 .. and add a missing bracket.
Approved by:	re (kib, blanket)
2011-08-08 15:42:37 +00:00
Adrian Chadd
aa2c3507bc Fix method naming to match the reference HAL definition.
Obtained from:	Atheros
Approved by:	re (kib, blanket)
2011-08-08 15:41:03 +00:00
Adrian Chadd
60829c4817 Add another HAL method - ah_isFastClockEnabled - which returns AH_TRUE
if 5ghz fast clock is enabled in the current operating mode.

It's slightly dirty, but it's part of the reference HAL and used by
the (currently closed-source) radar event code to map radar pulses
back to microsecond durations.

Obtained from:	Atheros
Approved by:	re (kib, blanket)
2011-08-08 13:15:39 +00:00