tuexen [Sat, 20 Nov 2010 19:37:00 +0000 (19:37 +0000)]
MFC r214939:
Do not have the MTU table twice in the code. Therefore move the
function from the timer code to util, rename it appropriately and
also fix a bug in sctp_get_prev_mtu(), where calling it with a
value existing in the MTU table did not return a smaller one.
attilio [Sat, 20 Nov 2010 18:24:09 +0000 (18:24 +0000)]
Add a second fix-up for the PC98 case.
PC98 cases might be explicit in presence of a difference with i386
because both are defined, leading to mishandling of code in
circumstances like this.
bschmidt [Sat, 20 Nov 2010 13:12:59 +0000 (13:12 +0000)]
MFC r212853-212855:
Rewrite parts of the calibration code which is run while bringing up
the device:
- Group functions used for initial calibration.
- Unobscure some of the code by moving it into its own functions.
- Get rid of some magic numbers.
- Create similar structure as the reference driver has, this should
make further syncs easier.
bschmidt [Sat, 20 Nov 2010 12:28:24 +0000 (12:28 +0000)]
MFC r215289:
The ni_rctls checks are used to verify that a ratectl algo has set up
its internal data. This has been used to bypass missing calls in drivers
which do not use the ratectl framework correctly. Issue is, not all algos
use that variable, or even have internal data, therefore valid calls are
not done. Fix this by removing the checks, all driver issues should be
resolved.
bschmidt [Sat, 20 Nov 2010 12:26:31 +0000 (12:26 +0000)]
MFC r215244:
Some device drivers calculate various timing related things based on
the currently selected rate. The calculations of course need a valid
rate. To make that possible before any call to node_rate() is done,
initialize ni_txrate on none_node_init() calls.
bschmidt [Sat, 20 Nov 2010 12:24:26 +0000 (12:24 +0000)]
MFC r214894:
Instead of using the AMRR ratectl algo as default for drivers which have
the IEEE80211_C_RATECTL flag set, default to NONE for all drivers. Only if
a driver calls ieee80211_ratectl_init() check if the NONE algo is still
selected and try to use AMRR in that case. Drivers are still free to use
any other algo by calling ieee80211_ratectl_set() prior to the
ieee80211_ratectl_init() call.
After this change it is now safe to assume that a ratectl algo is always
available and selected, which renders the IEEE80211_C_RATECTL flag pretty
much useless. Therefore revert r211314 and 211546.
bschmidt [Sat, 20 Nov 2010 12:22:02 +0000 (12:22 +0000)]
MFC r207323:
When in the RUN -> AUTH -> RUN FSM transition happens, we'll call the
ratectl_node_init() functions and since ni_rtctls was already malloc'ed()
we will panic. Fix this by using the already malloc'ed pointer.
rstone [Sat, 20 Nov 2010 04:54:58 +0000 (04:54 +0000)]
MFC r212281 and 212282
In munmap() downgrade the vm_map_lock to a read lock before taking a read
lock on the pmc-sx lock. This prevents a deadlock with
pmc_log_process_mappings, which has an exclusive lock on pmc-sx and tries
to get a read lock on a vm_map. Downgrading the vm_map_lock in munmap
allows pmc_log_process_mappings to continue, preventing the deadlock.
Without this change I could cause a deadlock on a multicore 8.1-RELEASE
system by having one thread constantly mmap'ing and then munmap'ing a
PROT_EXEC mapping in a loop while I repeatedly invoked and stopped pmcstat
in system-wide sampling mode.
thompsa [Fri, 19 Nov 2010 21:04:18 +0000 (21:04 +0000)]
MFC r213853
- Add missing LibUSB API functions:
* libusb_strerror()
* libusb_get_driver[_np]()
* libusb_detach_kernel_driver[_np]()
- Factor out setting of non-blocking flag inside libusb.
- Add missing NULL check after libusb_get_device() call.
- Correct some wrong error codes due to copy and paste error.
PR: usb/150546
Submitted by: Robert Jenssen, Alexander Leidinger
jhb [Fri, 19 Nov 2010 17:08:15 +0000 (17:08 +0000)]
MFC 204352, 208028, 209266, 209399, 210723, 213672, 215046:
- Fixed static linkage.
- Document that mptutil/mpt do not support RAID volumes in excess of 2TB.
- Report subcommand handler errors so that tools that invoke mptutil can
robustly report errors.
- Save errno values before calling warn(3) so that errors are correctly
reported.
- Check for malloc() failures.
jhb [Fri, 19 Nov 2010 16:52:18 +0000 (16:52 +0000)]
MFC 214782:
Update startup_alloc() to support multi-page allocations and allow internal
zones whose objects are larger than a page to use startup_alloc(). This
allows allocation of zone objects during early boot on machines with a large
number of CPUs since the resulting zone objects are larger than a page.
jhb [Fri, 19 Nov 2010 16:24:12 +0000 (16:24 +0000)]
MFC 215001:
Only dump the values of the PMC and CMCI local vector table entries on a
local APIC if those LVT entries are valid. This quiets spurious illegal
register local APIC errors during boot on a CPU that doesn't support those
vectors.
o-----------------------------------------------------------------------
r207344 | jkim | 2010-04-29 01:25:27 +0300 (Thu, 29 Apr 2010) | 2 lines
Merge ACPICA 20100428.
o-----------------------------------------------------------------------
r209065 | jkim | 2010-06-11 22:58:41 +0300 (Fri, 11 Jun 2010) | 2 lines
Simplify a function for getting brightness levels.
o-----------------------------------------------------------------------
r209746 | jkim | 2010-07-06 23:57:28 +0300 (Tue, 06 Jul 2010) | 2 lines
Merge ACPICA 20100702.
o-----------------------------------------------------------------------
r209747 | jkim | 2010-07-07 00:41:08 +0300 (Wed, 07 Jul 2010) | 2 lines
Fix mis-merges in the previous commit.
o-----------------------------------------------------------------------
r210150 | jkim | 2010-07-16 02:24:06 +0300 (Fri, 16 Jul 2010) | 3 lines
If there is any pending sleep request, disallow entering S5 state.
Otherwise, bad things may happen. ;-)
o-----------------------------------------------------------------------
r210976 | jkim | 2010-08-07 02:11:19 +0300 (Sat, 07 Aug 2010) | 2 lines
Merge ACPICA 20100806.
o-----------------------------------------------------------------------
r211763 | mav | 2010-08-24 21:07:59 +0300 (Tue, 24 Aug 2010) | 4 lines
When ACPI reports current battery consumption rate in mAmps, print it also
in mWatts. Values in mAmps are not always suitable, because they depend on
battery voltage, which depends on battery type and charge level.
o-----------------------------------------------------------------------
r212761 | jkim | 2010-09-16 23:08:00 +0300 (Thu, 16 Sep 2010) | 2 lines
Merge ACPICA 20100915.
o-----------------------------------------------------------------------
r213772 | rpaulo | 2010-10-13 14:38:24 +0300 (Wed, 13 Oct 2010) | 3 lines
Mark acpi_bus_number() as __unused. This allows clang to this file
without any warnings.
o-----------------------------------------------------------------------
r213783 | jkim | 2010-10-13 19:30:41 +0300 (Wed, 13 Oct 2010) | 4 lines
Remove acpi_bus_number() completely. It had to be removed in r212761.
Pointed out by: jhb
o-----------------------------------------------------------------------
r213787 | jkim | 2010-10-13 20:06:25 +0300 (Wed, 13 Oct 2010) | 2 lines
Clean up unused headers.
o-----------------------------------------------------------------------
r213806 | jkim | 2010-10-14 00:37:02 +0300 (Thu, 14 Oct 2010) | 2 lines
Merge ACPICA 20101013.
o-----------------------------------------------------------------------
r214390 | jkim | 2010-10-26 21:59:50 +0300 (Tue, 26 Oct 2010) | 18 lines
Add two new loader tunables 'hw.acpi.install_interface' and
'hw.acpi.remove_interface'. hw.acpi.install_interface lets you install new
interfaces. Conversely, hw.acpi.remove_interface lets you remove OS
interfaces from the pre-defined list in ACPICA. For example,
hw.acpi.install_interface="FreeBSD"
lets _OSI("FreeBSD") method to return 0xffffffff (or success) and
hw.acpi.remove_interface="Windows 2009"
lets _OSI("Windows 2009") method to return zero (or failure). Both are
comma-separated lists and leading white spaces are ignored. For example,
the following examples are valid:
hw.acpi.install_interface="Linux, FreeBSD"
hw.acpi.remove_interface="Windows 2006, Windows 2006.1"
o-----------------------------------------------------------------------
r214401 | jkim | 2010-10-27 00:22:55 +0300 (Wed, 27 Oct 2010) | 3 lines
Document newly added loader tunables "hw.acpi.install_interface" and
"hw.acpi.remove_interface".
o-----------------------------------------------------------------------
r214765 | jkim | 2010-11-04 01:16:35 +0200 (Thu, 04 Nov 2010) | 4 lines
Adjust a comment to clarify why \_SB_ and \_TZ_ are defined as device type
in ACPICA. Reshuffle the code a bit to make sure this kludge only applies
to these two specical cases and to make it cleaner.
o-----------------------------------------------------------------------
r214848 | jkim | 2010-11-05 21:50:09 +0200 (Fri, 05 Nov 2010) | 13 lines
Fix a use-after-free bug for extended IRQ resource[1]. When _PRS buffer is
copied as a template for _SRS, a string pointer for descriptor name is also
copied and it becomes stale as soon as it gets de-allocated[2]. Now _CRS is
used as a template for _SRS as ACPI specification suggests if it is usable.
The template from _PRS is still utilized but only when _CRS is not available
or broken. To avoid use-after-free the problem in this case, however, only
mandatory fields are copied, optional data is removed, and structure length
is adjusted accordingly.
Reported by: hps[1]
Analyzed by: avg[2]
Tested by: hps
o-----------------------------------------------------------------------
r214849 | jkim | 2010-11-05 22:24:26 +0200 (Fri, 05 Nov 2010) | 2 lines
Add a forgotten change from the previous commit.
o-----------------------------------------------------------------------
r214998 | jkim | 2010-11-08 21:52:14 +0200 (Mon, 08 Nov 2010) | 2 lines
Consistently use padding `_' in the comment.
o-----------------------------------------------------------------------
- Allocate memory for wakeup code after ACPI bus is attached. The early
memory allocation hack was inherited from i386 but amd64 does not need it.
- Exclude real mode IVT and BDA explicitly. Improve comments about memory
allocation and reason for the exclusions. It is a no-op in reality, though.
- Remove an unnecessary CLD from wakeup code and re-align.
Introduce the x86 kernel interfaces to allow kernel code to use
FPU/SSE hardware. Caller should provide a save area that is chained
into the stack of the areas; pcb save_area for usermode FPU state is
on top. The pcb now contains a pointer to the current FPU saved area,
used during FPUDNA handling and context switches. There is also a
facility to allow the kernel thread to use pcb save_area.
Change the dreaded warnings "npxdna in kernel mode!" into the panics
when FPU usage is not registered.
Use the fpu_kern_enter() interface to properly separate usermode FPU
context from in-kernel execution of padlock instructions and to handle
spurious FPUDNA exceptions that sometime are raised when doing padlock
calculations.
Remove unused i586 optimized bcopy/bzero/etc implementations that utilize
FPU registers for copying. Remove the switch table and jumps from
bcopy/bzero/... to the actual implementation.
As a side-effect, i486-optimized bzero is removed.
Remove the support for int13 FPU exception reporting on i386. It is
believed that all 486-class CPUs FreeBSD is capable to run on, either
have no FPU and cannot use external coprocessor, or have FPU on the
package and can use #MF.
After the FPU use requires #MF working due to INT13 FPU exception handling
removal, MFi386 r209198:
Use critical sections instead of disabling local interrupts to ensure
the consistency between PCPU fpcurthread and the state of FPU.
Re-implement FPU suspend/resume for amd64. This removes superfluous uses
of critical_enter(9) and critical_exit(9) by fpugetregs() and fpusetregs().
Also, we do not touch PCB flags any more.
Fix another fallout from r208833. savectx() is used to save CPU context
for crash dump (dumppcb) and kdb (stoppcbs). For both cases, there cannot
have a valid pointer in pcb_save. This should restore the previous
behaviour.
- Merge savectx2() with savectx() and struct xpcb with struct pcb. [1]
savectx() is only used for panic dump (dumppcb) and kdb (stoppcbs). Thus,
saving additional information does not hurt and it may be even beneficial.
Unfortunately, struct pcb has grown larger to accommodate more data.
Move 512-byte long pcb_user_save to the end of struct pcb while I am here.
- savectx() now saves FPU state unconditionally and copy it to the PCB of
FPU thread if necessary. This gives panic dump and kdb a chance to take
a look at the current FPU state even if the FPU is "supposedly" not used.
- Resuming CPU now unconditionally reinitializes FPU. If the saved FPU
state was irrelevant, it could be in an unknown state.
savectx() has not been used for fork(2) for about 15 years. [1]
Do not clobber FPU thread's PCB as it is more harmful. When we resume CPU,
unconditionally reload FPU state.
mav [Fri, 19 Nov 2010 09:25:12 +0000 (09:25 +0000)]
MFC r209683 by imp:
Add a safety-belt. If the identified disk has 0 blocks, don't attach
it. This can happen in some cases when plugging in SD/SmartCard PC
Cards with empty slots. It is better to detect this bogosity, and
refuse to attach rather than panic with a division by zero (in one of
many places) down stream.
mav [Fri, 19 Nov 2010 09:14:53 +0000 (09:14 +0000)]
MFC r214988:
Teach ahci(4), siis(4) and ATA_CAM ata(4) wrapper report to CAM residual
I/O length on underruns, that often happens for some SCSI commands.
thompsa [Fri, 19 Nov 2010 01:51:51 +0000 (01:51 +0000)]
MFC r215326
Add a special INIT product ID used by some models of the HUAWEI
K3765 datacard. After ejecting this device, it reappears using
the normal K3765 ID. It does not switch automatically
thompsa [Fri, 19 Nov 2010 01:48:47 +0000 (01:48 +0000)]
MFC r212134
Change argument for usbd_get_dma_delay() from USB bus to USB device, some
embedded hardware needs to know exactly which device is in question before it
exactly can decide the required delay.
thompsa [Fri, 19 Nov 2010 01:47:46 +0000 (01:47 +0000)]
MFC r212133
Fix setting of the rx_max and tx_max variables. If the expected buffer size is
greater than 65535 bytes then the CDC driver might not work as expected, which
is not likely with the existing USB speeds.
thompsa [Fri, 19 Nov 2010 01:42:13 +0000 (01:42 +0000)]
MFC r212127
We need to grab a node reference count to vap->iv_bss before using it as it is
possible for the node to be replaced and freed at any time by
ieee80211_sta_join1().
thompsa [Fri, 19 Nov 2010 01:39:29 +0000 (01:39 +0000)]
MFC r211021
Sort this file a little better: the vendors are supposed to be sorted by
vendor ID in the vendor section, and by symbolic name in the product
section. Products are sorted by product ID. While here, get rid of a
duplicate Microsoft Mouse entry, revealed by sorting.
thompsa [Fri, 19 Nov 2010 01:30:59 +0000 (01:30 +0000)]
MFC r209452
- fix for USB audio devices which use the 7-byte endpoint descriptor instead of
the 9-byte one.
- remove sync-endpoint code, which is currently unused.
Reported by: Antun Matanovi
Submitted by: Hans Petter Selasky
thompsa [Fri, 19 Nov 2010 01:30:23 +0000 (01:30 +0000)]
MFC r209450
Reduce MIDI input buffer size to one USB packet, hence some USB devices don't
properly short terminate their transfers. This fixes a problem where input
appears several seconds late.
Reported by: Alexander Yerenkow
Submitted by: Hans Petter Selasky
thompsa [Fri, 19 Nov 2010 01:28:22 +0000 (01:28 +0000)]
MFC r209144
- Because hostapd calls iv_key_set() before if_init(), make sure key_set
callback function will be executed, and that the key won't be deleted during
the init process.
- txmic and rxmic are written into the chip the same place regardless of
opmode.
- Make the hardware generate 802.11 sequence numbers.
thompsa [Fri, 19 Nov 2010 01:23:09 +0000 (01:23 +0000)]
MFC r210275
- Support for Globetrotter iCON 452.
- Fixed the interface probe routine to only attach to USB interfaces the driver
actually supports. This allows other drivers to attach to things like
MicroSD slots etc.
- Fixed network interface enumeration to be globally sequential instead of
relying on the USB interface numbers. This make sure the first network
interface always is at uhso0 and the second at usho1 and so on.
- Added a radio kill switch; exposed through sysctl.
- Updated the manual page to be verbose about the number of serial ports and
include iCON 452 in the set of tested hardware.
jh [Thu, 18 Nov 2010 19:06:56 +0000 (19:06 +0000)]
MFC r215235:
Set FD_CLOEXEC for the output file only when the file has been specified
with the -o option. Setting the flag for stderr (the default) could
cause the traced process to redirect stderr to a random file.
marius [Thu, 18 Nov 2010 18:03:52 +0000 (18:03 +0000)]
MFC: r215348
Return from mii_attach() after calling bus_generic_attach(9) on the device_t
of the MAC driver in order to attach miibus(4) on the first pass instead of
falling through to also calling it on the device_t of miibus(4). The latter
code flow was intended to attach the PHY drivers the same way regardless of
whether it's the first or a repeated pass, modulo the bus_generic_attach()
call in miibus_attach() which shouldn't be there. However, it turned out
that these variants cause miibus(4) to be attached twice under certain
conditions when using MAC drivers as modules.
yongari [Thu, 18 Nov 2010 17:44:02 +0000 (17:44 +0000)]
MFC r215132,215194:
r215132:
Add basic WOL support for MCP ethernet controllers. It seems the
controller does not perform automatic switching from 1000Mbps link
to 10/100Mbps link when WOL is activated. Implement establishing
10/100Mps link with auto-negotiation in driver. Link status change
handler was modified to remove taskqueue based approach since driver
now needs synchronous handling for link establishment.
jilles [Wed, 17 Nov 2010 23:13:02 +0000 (23:13 +0000)]
MFC r215022: test: Move tests to tools/regression/bin/test.
Convert the tests to the perl prove format.
Remove obsolete TEST.README (results of an old TEST.sh for some old Unices)
and TEST.csh (old tests without correct values, far less complete than
TEST.sh).
alc [Wed, 17 Nov 2010 17:29:22 +0000 (17:29 +0000)]
MFC r209407, r209648, r209650
Introduce and use vm_page_next() and vm_page_prev(). They provide both
a simpler and faster interface for iterating over the pages of an object.
markm [Wed, 17 Nov 2010 17:12:41 +0000 (17:12 +0000)]
MFC: Add /bin/rmail symlink to mailwrapper if sendmail is not being built
and mailwrapper is being built. Ensure that it is not removed by
"make delete-old". Add Exim example to man page.
yongari [Tue, 16 Nov 2010 20:32:09 +0000 (20:32 +0000)]
MFC r215017,215025:
Follow the lead of vendor's interrupt moderation mechanism.
It seems RTL8169/RTL8168/RTL810xE has a kind of interrupt
moderation mechanism but it is not documented at all. The magic
value dramatically reduced number of interrupts without noticeable
performance drops so apply it to all RTL8169/RTL8169 controllers.
Vendor's FreeBSD driver also applies it to RTL810xE controllers but
their Linux driver explicitly cleared the register, so do not
enable interrupt moderation for RTL810xE controllers.
While I'm here sort 8169 specific registers.
Obtained from: RealTek FreeBSD driver
MFC r215025:
Only moderate TX completion interrupts. Relying on taskqueue to
suppress RX interrupts seems to give better RX performance than
RX interrupt moderation.
yongari [Tue, 16 Nov 2010 20:21:53 +0000 (20:21 +0000)]
MFC r214992:
Reduce spin wait time consumed in GMII register access routine.
There were a couple of attempts in the past to reduce it since it
took more than 1ms. Because mii_tick() periodically polls link
status, waiting more than 1ms for each GMII register access was
overkill. Unfortunately all previous attempts were failed with
various ways on different controllers.
This time, add additional 20us dealy at the end of GMII register
access which seems to requirement of all RealTek controllers to
issue next GMII register access request. This is the same way what
Linux does.
alc [Tue, 16 Nov 2010 04:40:27 +0000 (04:40 +0000)]
MFC r214953
In case the stack size reaches its limit and its growth must be
restricted, ensure that grow_amount is a multiple of the page size.
Otherwise, the kernel may crash in swap_reserve_by_uid() on HEAD and
FreeBSD 8.x, and produce a core file with a missing stack on FreeBSD
7.x.
yongari [Tue, 16 Nov 2010 00:32:17 +0000 (00:32 +0000)]
MFC r214968:
Use shorten model name instead of showing all controller model
numbers. bge(4) supports too many models such that it's
unreasonable to list all these controllers in one line description
of name. While I'm here mention that BCM590x/BCM5779x is Fast
Ethernet controller.
bge(4) still lacks support for some controllers but supporting
these controllers should be easy now and adding new controllers
do not require touching .Nd any more.