Commit Graph

21059 Commits

Author SHA1 Message Date
Alexander Motin
a157e42516 Refactor timer management code with priority to one-shot operation mode.
The main goal of this is to generate timer interrupts only when there is
some work to do. When CPU is busy interrupts are generating at full rate
of hz + stathz to fullfill scheduler and timekeeping requirements. But
when CPU is idle, only minimum set of interrupts (down to 8 interrupts per
second per CPU now), needed to handle scheduled callouts is executed.
This allows significantly increase idle CPU sleep time, increasing effect
of static power-saving technologies. Also it should reduce host CPU load
on virtualized systems, when guest system is idle.

There is set of tunables, also available as writable sysctls, allowing to
control wanted event timer subsystem behavior:
  kern.eventtimer.timer - allows to choose event timer hardware to use.
On x86 there is up to 4 different kinds of timers. Depending on whether
chosen timer is per-CPU, behavior of other options slightly differs.
  kern.eventtimer.periodic - allows to choose periodic and one-shot
operation mode. In periodic mode, current timer hardware taken as the only
source of time for time events. This mode is quite alike to previous kernel
behavior. One-shot mode instead uses currently selected time counter
hardware to schedule all needed events one by one and program timer to
generate interrupt exactly in specified time. Default value depends of
chosen timer capabilities, but one-shot mode is preferred, until other is
forced by user or hardware.
  kern.eventtimer.singlemul - in periodic mode specifies how much times
higher timer frequency should be, to not strictly alias hardclock() and
statclock() events. Default values are 2 and 4, but could be reduced to 1
if extra interrupts are unwanted.
  kern.eventtimer.idletick - makes each CPU to receive every timer interrupt
independently of whether they busy or not. By default this options is
disabled. If chosen timer is per-CPU and runs in periodic mode, this option
has no effect - all interrupts are generating.

As soon as this patch modifies cpu_idle() on some platforms, I have also
refactored one on x86. Now it makes use of MONITOR/MWAIT instrunctions
(if supported) under high sleep/wakeup rate, as fast alternative to other
methods. It allows SMP scheduler to wake up sleeping CPUs much faster
without using IPI, significantly increasing performance on some highly
task-switching loads.

Tested by:	many (on i386, amd64, sparc64 and powerc)
H/W donated by:	Gheorghe Ardelean
Sponsored by:	iXsystems, Inc.
2010-09-13 07:25:35 +00:00
Alexander Motin
373d257ef0 Add tunable 'hint.hpet.X.per_cpu' to specify how much per-CPU timers driver
should provide if there is sufficient hardware. Default is 1.
2010-09-13 06:32:56 +00:00
Alexander Motin
6184f8d60e Instead of storing last event timestamp, store the next event timestamp.
It corrects handling of the first event offset in emulated periodic mode.
2010-09-12 11:11:53 +00:00
Marius Strobl
cdb25d827e Change OF_interpret() to also take an array of cell_t (missed in r209801).
Reviewed by:	nwhitehorn
2010-09-11 18:55:00 +00:00
Andriy Gapon
f5aadc99a6 make acpi_hp device a child of acpi_wmi
to properly reflect dependency between the devices/drivers

PR:		kern/147858
Suggested by:	jhb
Tested by:	Maciej Suszko <maciej@suszko.eu>
MFC after:	1 week
2010-09-11 08:09:14 +00:00
Kenneth D. Merry
d3c7b9a08a MFp4 (//depot/projects/mps/...)
Bring in a driver for the LSI Logic MPT2 6Gb SAS controllers.

This driver supports basic I/O, and works with SAS and SATA drives and
expanders.

Basic error recovery works (i.e. timeouts and aborts) as well.

Integrated RAID isn't supported yet, and there are some known bugs.

So this isn't ready for production use, but is certainly ready for
testing and additional development.  For the moment, new commits to this
driver should go into the FreeBSD Perforce repository first
(//depot/projects/mps/...) and then get merged into -current once
they've been vetted.

This has only been added to the amd64 GENERIC, since that is the only
architecture I have tested this driver with.

Submitted by:	scottl
Discussed with:	imp, gibbs, will
Sponsored by:	Yahoo, Spectra Logic Corporation
2010-09-10 15:03:56 +00:00
Andriy Gapon
3d844eddb7 bus_add_child: change type of order parameter to u_int
This reflects actual type used to store and compare child device orders.
Change is mostly done via a Coccinelle (soon to be devel/coccinelle)
semantic patch.
Verified by LINT+modules kernel builds.

Followup to:	r212213
MFC after:	10 days
2010-09-10 11:19:03 +00:00
Bernhard Schmidt
571d92b012 Fix firmware module dependencies.
malo and mwl use the firmware framework to access firmware images.
Depending on the firmware modules itself is not required and in this
case even wrong because no modules with those names exist.

Pointed out by:	brucec
MFC after:	1 week
2010-09-10 08:11:48 +00:00
John Baldwin
d1a02e0932 Catch up to rename of the constant for the Master Data Parity Error bit in
the PCI status register.

Pointed out by:	mdf
Pointy hat to:	jhb
2010-09-09 20:26:30 +00:00
Matthew D Fleming
10e0075ddb Fix an incorrect use of sbuf_overflowed() after a call to sbuf_finish(). 2010-09-09 18:35:08 +00:00
Matthew D Fleming
dd67e2103c Add a drain function for struct sysctl_req, and use it for a variety of
handlers, some of which had to do awkward things to get a large enough
FIXEDLEN buffer.

Note that some sysctl handlers were explicitly outputting a trailing NUL
byte.  This behaviour was preserved, though it should not be necessary.

Reviewed by:	phk
2010-09-09 18:33:46 +00:00
John Baldwin
da6b22afaf - Rename the constant for the Master Data Parity Error flag in the
PCI status register to map its current name.
- Use PCIM_* rather than PCIR_* for constants for fields in various AER
  registers.  I got about half of them right in the previous commit.

MFC after:	1 week
2010-09-09 18:19:15 +00:00
Nathan Whitehorn
c14e163ad1 Fix a problem where device detection would work unreliably on Serverworks
K2 SATA controllers. The chip's status register must be read first, and
as a long, for other registers to be correctly updated after a command, and
this includes the command sequence in device detection as well as the
previously handled case after interrupts. While here, clean up some
previous hacks related to this controller.

Reported by:	many
Reviewed by:	mav
MFC after:	3 weeks
2010-09-09 13:17:30 +00:00
Ed Schouten
1901fd2ffe Let psm(4) use si_drv1 to refer to its softc. 2010-09-09 07:52:15 +00:00
Pyun YongHyeon
a8924cde73 Correct definition of T2 mode bit of MRBE Message Page 5 Next Page
Control Register.
2010-09-08 21:08:54 +00:00
John Baldwin
79c2de35b5 - Add register definitions related to extended capability IDs in
PCI-express.  I used PCIZ_* for ID constants (plain capability IDs use
  PCIY_*).
- Add register definitions for the Advanced Error Reporting, Virtual
  Channels, and Device Serial Number extended capabilities.
- Teach pciconf -c to list extended as well as plain capabilities.   Adds
  more detailed parsing for AER, VC, and device serial numbers.

MFC after:	2 weeks
2010-09-08 17:53:34 +00:00
Alexander Motin
b28fc1b5c8 During SMP startup there is time window, when SMP started, but interrupts
are still bound to BSP. It confuses timer management logic in per-CPU mode
and may cause timer not being reloaded. Check such cases on interrupt
arival and reload timer to give system some more time to manage proper
binding.
2010-09-08 16:59:22 +00:00
Pyun YongHyeon
a64ee4e18f Consistently use tab characters instead of tab + space characters.
No functional changes.
2010-09-07 23:08:38 +00:00
Pyun YongHyeon
beab55bfc5 Remove trailing CR at EOL. 2010-09-07 22:44:29 +00:00
Jack F Vogel
26c88ee828 Code correction in refresh_mbufs, just continuing
without index recalc was wrong.
2010-09-07 21:28:45 +00:00
Jack F Vogel
d9f1a5aa8e Tighten up the rx mbuf refresh code, there were some
discrepencies from the igb version which was the target.

Change the message when neither MSI or MSIX are enabled
and a fallback to Legacy interrupts happen, the existing
message was confusing.
2010-09-07 20:13:08 +00:00
Pyun YongHyeon
12c65daeaf Make sure to create DMA'able memory for statistics block. This was
missed in r212061 and it caused crashes for 570x controllers as
controller DMAed statistics to physical address 0.

Reported by:	kan
2010-09-07 18:29:29 +00:00
Andriy Gapon
9fa1edb882 acpi_hp: fix bus attachment code
- add identify method to create driver's own device_t
- successfully probe only driver's own device_t instead of any device_t
- (ab)use device order to hopefully be probed/attached after acpi_wmi

PR:		kern/147858
Tested by:	Maciej Suszko <maciej@suszko.eu>
MFC after:	1 week
2010-09-06 07:34:32 +00:00
Alexander Motin
af82b9a9ee Add support for the Sharp/Micron flash chips to powermac_mvram(4).
Tested on PowerMac G4 AGP.

Reviewed by:	nwhitehorn
2010-09-05 20:04:02 +00:00
Alexander Motin
09538b1020 Several improvements to HPET driver:
- Add special check for case when time expires before being programmed.
This fixes interrupt loss and respectively timer death on attempt to
program very short interval. Increase minimal supported period to more
realistic value.
 - Add support for hint.hpet.X.allowed_irqs tunable, allowing manually
specify which interrupts driver allowed to use. Unluckily, many BIOSes
program wrong allowed interrupts mask, so driver tries to stay on safe
side by not using unshareable ISA IRQs. This option gives control over
this limitation, allowing more per-CPU timers to be provided, when FSB
interrupts are not supported. Value of this tunable is bitmask.
 - Do not use regular interrupts on virtual machines. QEMU and VirtualBox
do not support them properly, that may cause problems. Stay safe by default.
Same time both QEMU and VirtualBox work fine in legacy_route mode.
VirtualBox also works fine if manually specify allowed ISA IRQs with above.
2010-09-05 19:24:32 +00:00
Fabien Thomas
2aef9dd6d3 Fix invalid class removal when IAF is not the last class.
Keep IAF class with 0 PMC and change the alias in libpmc to IAP.

MFC after:	1 week
2010-09-05 13:31:14 +00:00
Bjoern A. Zeeb
3887319477 Fix a compile problem introduced with r212008 on 32bit:
Both deadline and current_time are time_seconds (+ utc_offset())
casted to unsigned long long. No need to cast to or print as pointers.

MFC after:	4 days
2010-09-04 16:27:14 +00:00
Pyun YongHyeon
443f331ec5 Fix another bug introduced in r212109. We should unload DMA maps
only after sending the last fragment of a frame so the mbuf pointer
also should be stored in the last descriptor index.
2010-09-03 18:00:17 +00:00
Andriy Gapon
b1f9b9965b acpi: update stale comments about order of cpu devices probing
These comments should have been updated in r203776 when the order was
changed.

Pointyhat to:	avg
MFC after:	3 days
2010-09-03 08:07:04 +00:00
Pyun YongHyeon
0af3989be9 Initial WOL support. NS DP8315 was tested but SiS900/SiS7016 was
not tested.
While I'm here, clean up SIOCSIFCAP handler.
2010-09-03 00:34:45 +00:00
Pyun YongHyeon
7968da57dc Implement initial device suspend/resume method. 2010-09-02 22:37:13 +00:00
Pyun YongHyeon
94222398d1 Unlike most other controllers, NS DP83815/DP83816 controllers seem
to pad with 0xFF when it encounter short frames.  According to RFC
1042 the pad bytes should be 0x00.
Because manual padding consumes extra CPU cycles, introduce a new
tunable which controls the padding behavior. Turning this tunable
on will have driver pad manually but it's disabled by default. Users
can enable software padding by setting the following tunable to
non-zero value.

dev.sis.%d.manual_pad="1"

PR:	kern/35422 (patch not used)
2010-09-02 18:10:11 +00:00
Pyun YongHyeon
74e8a3238f Fix the last endianness issue on handling station address which
prevented driver from working on big-endian machines. Also rewrite
station address programming to make it work on strict-alignment
architectures. With this change, sis(4) now works on sparc64 and
performance number looks good even though sis(4) have to apply
fixup code to align received frames on 2 bytes boundary on sparc64.
2010-09-02 17:51:41 +00:00
Jung-uk Kim
90017de999 Disable video ROM shadowing by default as I originally intended. I found
a case where video ROM for an IGP is too tightly coupled with system BIOS
to get relocated.
2010-09-02 17:22:12 +00:00
Dag-Erling Smørgrav
2cd149f045 Remove the freelist, which simply duplicates some of the zone allocator's
functionality.

Submitted by:	Daniel Braniss <danny@cs.huji.ac.il>
MFC after:	3 weeks
2010-09-02 14:13:43 +00:00
Alexander Motin
a6c48c7c72 Add fix for SiI3114 and SiI3512 chips bug, which caused sending R_ERR in
response to DMA activate FIS under certain circumstances. This is
recommended fix from chip datasheet. If triggered, this bug most likely
cause write command timeout.

MFC after:	2 weeks
2010-09-02 12:32:29 +00:00
Alexander Motin
a250a687f7 SATA1.x SiliconImage controllers on power-on reset TFD Status register into
value 0xff. On hot-plug this value confuses ata_generic_reset() device
presence detection logic. As soon as we already know drive presence from
SATA hard reset, hint ata_generic_reset() to wait for device signature
until success or full timeout.
2010-09-02 11:18:43 +00:00
Andrew Thompson
ae538d8533 Reduce the need to accesss struct usb_device by providing functions to access
the product, manufacturer and serial strings.

Submitted by:	Hans Petter Selasky
2010-09-02 04:39:45 +00:00
Andrew Thompson
d2d71ce7a8 Add support for power mode filtering as some USB hardware does not support
power saving.

Submitted by:	Hans Petter Selasky
2010-09-02 04:05:00 +00:00
Andrew Thompson
527aa7b226 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.

Submitted by:	Hans Petter Selasky
2010-09-02 04:01:18 +00:00
Andrew Thompson
dd5c0f870a 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.

Submitted by:	Hans Petter Selasky
2010-09-02 03:55:08 +00:00
Andrew Thompson
1f27b68522 Fix UMS_BUTTON_MAX define name 2010-09-02 03:52:04 +00:00
Andrew Thompson
13226c4c02 Fix build breakage from r212127 2010-09-02 03:50:11 +00:00
Andrew Thompson
edd913eb1a Add GPIO programming for more PHY hardware.
Submitted by:	yongari
2010-09-02 03:47:07 +00:00
Andrew Thompson
ee6e1a6f5a Add support for extra buttons on the Kensington Slimblade Trackball.
Submitted by:	Lee, Chung-Yeol
2010-09-02 03:44:56 +00:00
Andrew Thompson
a6eb83193e Silence debug error by default.
PR:		usb/141212
Submitted by:	Hans Petter Selasky
2010-09-02 03:42:26 +00:00
Andrew Thompson
8d8bdb018d 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().
2010-09-02 03:28:03 +00:00
Pyun YongHyeon
8c6cd8631f Fix stupid error in r212109 which didn't swap DMA maps. This caused
IOMMU panic on sparc64 under high TX load.
2010-09-02 00:44:05 +00:00
Andrew Thompson
910cb8feb9 Add missing MODULE_VERSION() definitions, this resolves problems around
duplicate module loads.

PR:		usb/125736
Submitted by:	danger, mm
Reviewed by:	hselasky
2010-09-01 23:47:53 +00:00
Pyun YongHyeon
7723fa2e04 Move sis_reset() to sis_initl(). This ensures driver starts with
known good state of controller.
2010-09-01 22:50:11 +00:00