/[base]/head/sys/dev/acpica/acpi_cpu.c
ViewVC logotype

Log of /head/sys/dev/acpica/acpi_cpu.c

Parent Directory Parent Directory | Revision Log Revision Log


Links to HEAD: (view) (download) (annotate)
Sticky Revision:


Revision 365096 - (view) (download) (annotate) - [select for diffs]
Modified Tue Sep 1 21:32:41 2020 UTC (3 years, 10 months ago) by mjg
File length: 47070 byte(s)
Diff to previous 358333
acpica: clean up empty lines in .c and .h files


Revision 358333 - (view) (download) (annotate) - [select for diffs]
Modified Wed Feb 26 14:26:36 2020 UTC (4 years, 4 months ago) by kaktus
File length: 47071 byte(s)
Diff to previous 339754
Mark more nodes as CTLFLAG_MPSAFE or CTLFLAG_NEEDGIANT (17 of many)

r357614 added CTLFLAG_NEEDGIANT to make it easier to find nodes that are
still not MPSAFE (or already are but aren’t properly marked).
Use it in preparation for a general review of all nodes.

This is non-functional change that adds annotations to SYSCTL_NODE and
SYSCTL_PROC nodes using one of the soon-to-be-required flags.

Mark all obvious cases as MPSAFE.  All entries that haven't been marked
as MPSAFE before are by default marked as NEEDGIANT

Approved by:	kib (mentor, blanket)
Commented by:	kib, gallatin, melifaro
Differential Revision:	https://reviews.freebsd.org/D23718


Revision 339754 - (view) (download) (annotate) - [select for diffs]
Modified Fri Oct 26 00:05:46 2018 UTC (5 years, 8 months ago) by takawata
File length: 47007 byte(s)
Diff to previous 333334
Distinguish _CID match and _HID match and make lower priority probe
when _CID match.

Reviewed by: jhb, imp
Differential Revision:https://reviews.freebsd.org/D16468


Revision 333334 - (view) (download) (annotate) - [select for diffs]
Modified Mon May 7 21:09:17 2018 UTC (6 years, 1 month ago) by imp
File length: 47004 byte(s)
Diff to previous 326956
Use device_quiet_children to silence verbose CPU probe messages.

Have cpu0 be noisy, but all the other CPU devices be quiet on boot.


Revision 326956 - (view) (download) (annotate) - [select for diffs]
Modified Tue Dec 19 02:49:11 2017 UTC (6 years, 6 months ago) by cem
File length: 46887 byte(s)
Diff to previous 324502
Implement ACPI CPU support when Processor object is not present

By the ACPI standard (ACPI 5 chapter 8.4 Declaring Processors) Processors
can be implemented in 2 distinct ways:

* Through a Processor object type (which provides P_BLK)
* Through a Device object type

Prior to this change, the FreeBSD driver only supported the former.  AMD
Epyc / Poweredge systems we are testing both implement the latter only.  Add
the missing support.

Because P_BLK is not defined in the device object case, C-states entering
must be completely controlled via _CST methods rather than P_LVL2/3.

John Baldwin points out that ACPI 6.0 formally deprecates the Processor
keyword, so eventually processors will only be enumerated as Device objects.

Submitted by:	attilio
Reviewed by:	jhb, markj, Anton Rang <rang AT acm.org>
Relnotes:	maybe
Sponsored by:	Dell EMC Isilon
Differential Revision:	https://reviews.freebsd.org/D13457


Revision 324502 - (view) (download) (annotate) - [select for diffs]
Modified Tue Oct 10 19:33:24 2017 UTC (6 years, 8 months ago) by jkim
File length: 45962 byte(s)
Diff to previous 324136
Merge ACPICA 20170929 (take 2).


Revision 324136 - (view) (download) (annotate) - [select for diffs]
Modified Sat Sep 30 20:28:50 2017 UTC (6 years, 9 months ago) by jkim
File length: 45957 byte(s)
Diff to previous 324109
Revert r324109.  This commit broke a number of systems.

Reported by:	lwhsu, kib
Requested by:	ngie


Revision 324109 - (view) (download) (annotate) - [select for diffs]
Modified Fri Sep 29 23:02:49 2017 UTC (6 years, 9 months ago) by jkim
File length: 45962 byte(s)
Diff to previous 323076
Merge ACPICA 20170929.


Revision 323076 - (view) (download) (annotate) - [select for diffs]
Modified Thu Aug 31 22:47:04 2017 UTC (6 years, 10 months ago) by jkim
File length: 45957 byte(s)
Diff to previous 316648
Merge ACPICA 20170831.


Revision 316648 - (view) (download) (annotate) - [select for diffs]
Modified Sun Apr 9 02:00:03 2017 UTC (7 years, 2 months ago) by pkelsey
File length: 46038 byte(s)
Diff to previous 314211
Corrected misspelled versions of rendezvous.

The MFC will include a compat definition of smp_no_rendevous_barrier()
that calls smp_no_rendezvous_barrier().

Reviewed by:	gnn, kib
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D10313


Revision 314211 - (view) (download) (annotate) - [select for diffs]
Modified Fri Feb 24 16:11:55 2017 UTC (7 years, 4 months ago) by kib
File length: 46036 byte(s)
Diff to previous 313447
Remove cpu_deepest_sleep variable.

On Core2 and older Intel CPUs, where TSC stops in C2, system does not
allow C2 entrance if timecounter hardware is TSC.  This is done by
tc_windup() which tests for TC_FLAGS_C2STOP flag of the new
timecounter and increases cpu_disable_c2_sleep if flag is set.  Right
now init_TSC_tc() only sets the flag if cpu_deepest_sleep >= 2, but
TSC is initialized too early for this variable to be set by
acpi_cpu.c.

There is no reason to require that ACPI reported C2 and deeper states
to set TC_FLAGS_C2STOP, so remove cpu_deepest_sleep test from
init_TSC_tc() condition.  And since this is the only use of the
variable, remove it at all.

Reported and submitted by:	Jia-Shiun Li <jiashiun@gmail.com>
Suggested by:	jhb
MFC after:	2 weeks


Revision 313447 - (view) (download) (annotate) - [select for diffs]
Modified Wed Feb 8 16:46:57 2017 UTC (7 years, 4 months ago) by jtl
File length: 46237 byte(s)
Diff to previous 299746
Ensure the idle thread's loop services interrupts in a timely way when
using the ACPI C1/mwait sleep method.

Previously, the mwait instruction would return when an interrupt was
pending; however, the idle loop did not actually enable interrupts when
this occurred. This led to a situation where the idle loop could quickly
spin through the C1/mwait sleep method a number of times when an interrupt
was pending. (Eventually, the situation corrected itself when something
other than an interrupt triggered the idle loop to either enable interrupts
or schedule another thread.)

Reviewed by:	kib, imp (earlier version)
Input from:	jhb
MFC after:	1 week
Sponsored by:	Netflix


Revision 299746 - (view) (download) (annotate) - [select for diffs]
Modified Sat May 14 18:22:52 2016 UTC (8 years, 1 month ago) by jhb
File length: 46134 byte(s)
Diff to previous 298955
Add an EARLY_AP_STARTUP option to start APs earlier during boot.

Currently, Application Processors (non-boot CPUs) are started by
MD code at SI_SUB_CPU, but they are kept waiting in a "pen" until
SI_SUB_SMP at which point they are released to run kernel threads.
SI_SUB_SMP is one of the last SYSINIT levels, so APs don't enter
the scheduler and start running threads until fairly late in the
boot.

This change moves SI_SUB_SMP up to just before software interrupt
threads are created allowing the APs to start executing kernel
threads much sooner (before any devices are probed).  This allows
several initialization routines that need to perform initialization
on all CPUs to now perform that initialization in one step rather
than having to defer the AP initialization to a second SYSINIT run
at SI_SUB_SMP.  It also permits all CPUs to be available for
handling interrupts before any devices are probed.

This last feature fixes a problem on with interrupt vector exhaustion.
Specifically, in the old model all device interrupts were routed
onto the boot CPU during boot.  Later after the APs were released at
SI_SUB_SMP, interrupts were redistributed across all CPUs.

However, several drivers for multiqueue hardware allocate N interrupts
per CPU in the system.  In a system with many CPUs, just a few drivers
doing this could exhaust the available pool of interrupt vectors on
the boot CPU as each driver was allocating N * mp_ncpu vectors on the
boot CPU.  Now, drivers will allocate interrupts on their desired CPUs
during boot meaning that only N interrupts are allocated from the boot
CPU instead of N * mp_ncpu.

Some other bits of code can also be simplified as smp_started is
now true much earlier and will now always be true for these bits of
code.  This removes the need to treat the single-CPU boot environment
as a special case.

As a transition aid, the new behavior is available under a new kernel
option (EARLY_AP_STARTUP).  This will allow the option to be turned off
if need be during initial testing.  I plan to enable this on x86 by
default in a followup commit in the next few days and to have all
platforms moved over before 11.0.  Once the transition is complete,
the option will be removed along with the !EARLY_AP_STARTUP code.

These changes have only been tested on x86.  Other platform maintainers
are encouraged to port their architectures over as well.  The main
things to check for are any uses of smp_started in MD code that can be
simplified and SI_SUB_SMP SYSINITs in MD code that can be removed in
the EARLY_AP_STARTUP case (e.g. the interrupt shuffling).

PR:		kern/199321
Reviewed by:	markj, gnn, kib
Sponsored by:	Netflix


Revision 298955 - (view) (download) (annotate) - [select for diffs]
Modified Tue May 3 03:41:25 2016 UTC (8 years, 2 months ago) by pfg
File length: 46072 byte(s)
Diff to previous 298754
sys/dev: minor spelling fixes.

Most affect comments, very few have user-visible effects.


Revision 298754 - (view) (download) (annotate) - [select for diffs]
Modified Thu Apr 28 18:53:14 2016 UTC (8 years, 2 months ago) by jhb
File length: 46073 byte(s)
Diff to previous 298484
Only count CPU devices that are using the ACPI CPU driver.

Arguably we should only be doing the probe/attach to children of
these devices as well.

Tested by:	Michal Stanek <mst_semihalf.com> (arm64)
Differential Revision:	https://reviews.freebsd.org/D6133


Revision 298484 - (view) (download) (annotate) - [select for diffs]
Modified Fri Apr 22 17:51:19 2016 UTC (8 years, 2 months ago) by jhb
File length: 46015 byte(s)
Diff to previous 298425
Optionally return the output capabilities list from _OSC.

Both of the callers were expecting the input cap_set to be modified.
This fixes them to request cap_set to be updated with the returned buffer.

Reviewed by:	jkim
Differential Revision:	https://reviews.freebsd.org/D6040


Revision 298425 - (view) (download) (annotate) - [select for diffs]
Modified Thu Apr 21 18:27:05 2016 UTC (8 years, 2 months ago) by jhb
File length: 46011 byte(s)
Diff to previous 298379
Queue the CPU-probing task after all acpi_cpu devices are attached.

Eventually with earlier AP startup this code will change to call the
startup function synchronously instead of queueing the task.  Moving
the time we queue the task should be a no-op since taskqueue threads
don't start executing tasks until much later, but this reduces the diff
with the earlier AP startup patches.

Sponsored by:	Netflix


Revision 298379 - (view) (download) (annotate) - [select for diffs]
Modified Wed Apr 20 21:26:59 2016 UTC (8 years, 2 months ago) by jkim
File length: 45865 byte(s)
Diff to previous 298377
There is no need to use array any more.  No functional change.


Revision 298377 - (view) (download) (annotate) - [select for diffs]
Modified Wed Apr 20 21:21:47 2016 UTC (8 years, 2 months ago) by jkim
File length: 45876 byte(s)
Diff to previous 298370
Remove query flag from acpi_EvaluateOSC().  This function does not support
return buffer (yet).


Revision 298370 - (view) (download) (annotate) - [select for diffs]
Modified Wed Apr 20 20:55:58 2016 UTC (8 years, 2 months ago) by jhb
File length: 45871 byte(s)
Diff to previous 284273
Add a wrapper for evaluating _OSC methods.

This wrapper does not translate errors in the first word to ACPI
error status returns.  Use this wrapper in the acpi_cpu(4) driver in
place of the existing _OSC code.  While here, fix a bug where the wrong
count of words was passed when invoking _OSC.

Reviewed by:	jkim
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D6022


Revision 284273 - (view) (download) (annotate) - [select for diffs]
Modified Thu Jun 11 15:45:33 2015 UTC (9 years ago) by andrew
File length: 46357 byte(s)
Diff to previous 284195
Add basic support for ACPI. It splits out the nexus driver to two new
drivers, one for fdt, one for acpi. It then uses this to decide if it will
use fdt or acpi.

The GICv2 (interrupt controller) and Generic Timer drivers have been
updated to handle both cases.

As this is early code we still need FDT to find the kernel console, and
some parts are still missing, including PCI support.

Differential Revision:	https://reviews.freebsd.org/D2463
Reviewed by:	jhb, jkim, emaste
Obtained from:	ABT Systems Ltd
Relnotes:	Yes
Sponsored by:	The FreeBSD Foundation


Revision 284195 - (view) (download) (annotate) - [select for diffs]
Modified Tue Jun 9 23:13:37 2015 UTC (9 years ago) by jkim
File length: 46153 byte(s)
Diff to previous 283261
Check status of AcpiReadBitRegister() calls.

Reported by:	Coverity
CID:		1306132


Revision 283261 - (view) (download) (annotate) - [select for diffs]
Modified Thu May 21 19:31:10 2015 UTC (9 years, 1 month ago) by jkim
File length: 46034 byte(s)
Diff to previous 282771
Do not probe Intel PIIX4 south bridge quirks on amd64.  These quirky south
bridges only supported Intel Pentium and Pentium II era processors and there
is no reason for hardware virtualizations to emulate these quirks.

MFC after:	1 week


Revision 282771 - (view) (download) (annotate) - [select for diffs]
Modified Mon May 11 14:36:34 2015 UTC (9 years, 1 month ago) by andrew
File length: 45911 byte(s)
Diff to previous 282678
Hide code only used on i386 and amd64.


Revision 282678 - (view) (download) (annotate) - [select for diffs]
Modified Sat May 9 12:28:48 2015 UTC (9 years, 1 month ago) by kib
File length: 45799 byte(s)
Diff to previous 277318
If x86 CPU implementation of the MWAIT instruction reasonably
interacts with interrupts, query ACPI and use MWAIT for entrance into
Cx sleep states.  Support C1 "I/O then halt" mode.  See Intel'
document 302223-007 "Intelб╝ Processor Vendor-Specific ACPI Interface
Specification" for description.

Move the acpi_cpu_c1() function into x86/cpu_machdep.c and use
it instead of inlining "sti; hlt" sequence in several places.

In the acpi(4) man page, besides documenting the dev.cpu.N.cx_methods
sysctl, correct the names for dev.cpu.N.{cx_usage,cx_lowest,cx_supported}
sysctls.

Both jkim and avg have some other patches implementing the mwait
functionality; this work is unrelated.  Linux does not rely on the
ACPI to provide correct tables describing Cx modes.  Instead, the
driver has pre-defined knowledge of the CPU models, it was supplied by
Intel.

Tested by:    pho (previous versions)
Sponsored by:	The FreeBSD Foundation


Revision 277318 - (view) (download) (annotate) - [select for diffs]
Modified Sun Jan 18 12:45:26 2015 UTC (9 years, 5 months ago) by cperciva
File length: 41602 byte(s)
Diff to previous 276724
When disabling C3+ CPU states due to the CPU_QUIRK_NO_C3 quirk, don't
accidentally enable non-existent states.

This bug was triggered if ACPI advertises the presence of a C2 state
which we fail to parse via acpi_PkgGas due to our lack of support for
FFixedHW resources, and causes an immediate panic when an attempt is
made to enter the (NULL) state.

One affected platform is the EC2 c4.8xlarge VM instance type; there
may be others.

MFC after:	1 week
Thanks to:	jkim, @_msw_


Revision 276724 - (view) (download) (annotate) - [select for diffs]
Modified Mon Jan 5 20:44:44 2015 UTC (9 years, 5 months ago) by jhb
File length: 41579 byte(s)
Diff to previous 269515
On some Intel CPUs with a P-state but not C-state invariant TSC the TSC
may also halt in C2 and not just C3 (it seems that in some cases the BIOS
advertises its C3 state as a C2 state in _CST).  Just play it safe and
disable both C2 and C3 states if a user forces the use of the TSC as the
timecounter on such CPUs.

PR:		192316
Differential Revision:	https://reviews.freebsd.org/D1441
No objection from:	jkim
MFC after:	1 week


Revision 269515 - (view) (download) (annotate) - [select for diffs]
Modified Mon Aug 4 09:05:28 2014 UTC (9 years, 11 months ago) by royger
File length: 41201 byte(s)
Diff to previous 267992
xen: add ACPI bus to xen_nexus when running as Dom0

Also disable a couple of ACPI devices that are not usable under Dom0.
To this end a couple of booleans are added that allow disabling ACPI
specific devices.

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

x86/xen/xen_nexus.c:
 - Return BUS_PROBE_SPECIFIC in the Xen Nexus attachement routine to
   force the usage of the Xen Nexus.
 - Attach the ACPI bus when running as Dom0.

dev/acpica/acpi_cpu.c:
dev/acpica/acpi_hpet.c:
dev/acpica/acpi_timer.c
 - Add a variable that gates the addition of the devices.

x86/include/init.h:
 - Declare variables that control the attachment of ACPI cpu, hpet and
   timer devices.


Revision 267992 - (view) (download) (annotate) - [select for diffs]
Modified Sat Jun 28 03:56:17 2014 UTC (10 years ago) by hselasky
File length: 41103 byte(s)
Diff to previous 267985
Pull in r267961 and r267973 again. Fix for issues reported will follow.


Revision 267985 - (view) (download) (annotate) - [select for diffs]
Modified Fri Jun 27 22:05:21 2014 UTC (10 years ago) by gjb
File length: 41160 byte(s)
Diff to previous 267961
Revert r267961, r267973:

These changes prevent sysctl(8) from returning proper output,
such as:

 1) no output from sysctl(8)
 2) erroneously returning ENOMEM with tools like truss(1)
    or uname(1)
 truss: can not get etype: Cannot allocate memory


Revision 267961 - (view) (download) (annotate) - [select for diffs]
Modified Fri Jun 27 16:33:43 2014 UTC (10 years ago) by hselasky
File length: 41103 byte(s)
Diff to previous 264250
Extend the meaning of the CTLFLAG_TUN flag to automatically check if
there is an environment variable which shall initialize the SYSCTL
during early boot. This works for all SYSCTL types both statically and
dynamically created ones, except for the SYSCTL NODE type and SYSCTLs
which belong to VNETs. A new flag, CTLFLAG_NOFETCH, has been added to
be used in the case a tunable sysctl has a custom initialisation
function allowing the sysctl to still be marked as a tunable. The
kernel SYSCTL API is mostly the same, with a few exceptions for some
special operations like iterating childrens of a static/extern SYSCTL
node. This operation should probably be made into a factored out
common macro, hence some device drivers use this. The reason for
changing the SYSCTL API was the need for a SYSCTL parent OID pointer
and not only the SYSCTL parent OID list pointer in order to quickly
generate the sysctl path. The motivation behind this patch is to avoid
parameter loading cludges inside the OFED driver subsystem. Instead of
adding special code to the OFED driver subsystem to post-load tunables
into dynamically created sysctls, we generalize this in the kernel.

Other changes:
- Corrected a possibly incorrect sysctl name from "hw.cbb.intr_mask"
to "hw.pcic.intr_mask".
- Removed redundant TUNABLE statements throughout the kernel.
- Some minor code rewrites in connection to removing not needed
TUNABLE statements.
- Added a missing SYSCTL_DECL().
- Wrapped two very long lines.
- Avoid malloc()/free() inside sysctl string handling, in case it is
called to initialize a sysctl from a tunable, hence malloc()/free() is
not ready when sysctls from the sysctl dataset are registered.
- Bumped FreeBSD version to indicate SYSCTL API change.

MFC after:	2 weeks
Sponsored by:	Mellanox Technologies


Revision 264250 - (view) (download) (annotate) - [select for diffs]
Modified Tue Apr 8 02:36:27 2014 UTC (10 years, 2 months ago) by adrian
File length: 41160 byte(s)
Diff to previous 247460
Add a basic set of data points which count the number of sleep entries
that are being done by the OS.

For now this'll match up with the "wakeups"; although I'll dig deeper into
this to see if we can determine which sleep state the CPU managed to get
into.  Most things I've seen these days only expose up to C2 or C3 via
ACPI even though the CPU goes all the way down to C6 or C7.


Revision 247460 - (view) (download) (annotate) - [select for diffs]
Modified Thu Feb 28 11:27:01 2013 UTC (11 years, 4 months ago) by davide
File length: 40207 byte(s)
Diff to previous 247454
MFcalloutng (r247427 by mav):
We don't need any precision here. Let it be fast and dirty shift then
slow and excessively precise 64-bit division.


Revision 247454 - (view) (download) (annotate) - [select for diffs]
Modified Thu Feb 28 10:46:54 2013 UTC (11 years, 4 months ago) by davide
File length: 40211 byte(s)
Diff to previous 243761
MFcalloutng:
When CPU becomes idle, cpu_idleclock() calculates time to the next timer
event in order to reprogram hw timer. Return that time in sbintime_t to
the caller and pass it to acpi_cpu_idle(), where it can be used as one
more factor (quite precise) to extimate furter sleep time and choose
optimal sleep state. This is a preparatory change for further callout
improvements will be committed in the next days.

The commmit is not targeted for MFC.


Revision 243761 - (view) (download) (annotate) - [select for diffs]
Modified Sat Dec 1 18:06:05 2012 UTC (11 years, 7 months ago) by avg
File length: 40109 byte(s)
Diff to previous 243760
acpi_cpu_notify: disable acpi_cpu_idle while updating C-state data

... to avoid any races or inconsistencies.
This should fix a regression introduced in r243404.

Also, remove a stale comment that has not been true for quite a while
now.

Pointyhat to:	avg
Teested by:	trociny, emaste, dumbbell (earlier version)
MFC after:	 1 week


Revision 243760 - (view) (download) (annotate) - [select for diffs]
Modified Sat Dec 1 18:01:01 2012 UTC (11 years, 7 months ago) by avg
File length: 39807 byte(s)
Diff to previous 243404
acpi_cpu: change cpu_disable_idle to be a per-cpu flag...

and make it safe to manipulate and check the flag

With help from:	jhb
Tested by:	trociny, emaste, dumbbell
MFC after:	1 week


Revision 243404 - (view) (download) (annotate) - [select for diffs]
Modified Thu Nov 22 14:40:26 2012 UTC (11 years, 7 months ago) by avg
File length: 39048 byte(s)
Diff to previous 240634
acpi_cpu: use fixed resource ids for cx state i/o resources

... instead of the ever increasing ones.
Also, do free old resources when allocating new ones when cx states
change.

Tested by:	Tom Lislegaard <Tom.Lislegaard@proact.no>
Obtained from:	jkim
MFC after:	1 week


Revision 240634 - (view) (download) (annotate) - [select for diffs]
Modified Tue Sep 18 08:17:29 2012 UTC (11 years, 9 months ago) by avg
File length: 38945 byte(s)
Diff to previous 240367
acpi_cpu: explicitly notify userland about c-state changes

... after they are committed.
A notification is sent per CPU.

Reviewed by:	imp
MFC after:	3 weeks


Revision 240367 - (view) (download) (annotate) - [select for diffs]
Modified Tue Sep 11 17:21:25 2012 UTC (11 years, 9 months ago) by avg
File length: 38886 byte(s)
Diff to previous 240344
revert r240344: cpu_devices[] is used in other functions and must be kept

Reported by:	gjb, glebius
Pointyhat to:	avg
MFC after:	1 day
X-MFC note:	fake MFC, reminder to never MFC r240344


Revision 240344 - (view) (download) (annotate) - [select for diffs]
Modified Tue Sep 11 06:26:20 2012 UTC (11 years, 9 months ago) by avg
File length: 38917 byte(s)
Diff to previous 238943
acpi_cpu: free result of device_get_children

MFC after:	1 week


Revision 238943 - (view) (download) (annotate) - [select for diffs]
Modified Tue Jul 31 10:58:50 2012 UTC (11 years, 11 months ago) by mav
File length: 38886 byte(s)
Diff to previous 238418
Add several performance optimizations to acpi_cpu_idle().

For C1 and C2 states use cpu_ticks() to measure sleep time instead of much
slower ACPI timer. We can't do it for C3, as TSC may stop there. But it is
less important there as wake up latency is high any way.

For C1 and C2 states do not check/clear bus mastering activity status, as
it is important only for C3. As side effect it can make CPU enter C2 instead
of C3 if last BM activity was two sleeps back (unlike one before), but
that may be even good because of collecting more statistics. Premature BM
wakeup from C3, entered because of overestimation, can easily be worse then
entering C2 from both performance and power consumption points of view.

Together on dual Xeon E5645 system on sequential 512 bytes read test this
change makes cpu_idle_acpi() as fast as simplest cpu_idle_hlt() and only
few percents slower then cpu_idle_mwait(), while deeper states are still
actively used during idle periods.

To help with diagnostics, add C-state type into dev.cpu.X.cx_supported.

Sponsored by:	iXsystems, Inc.


Revision 238418 - (view) (download) (annotate) - [select for diffs]
Modified Fri Jul 13 08:11:55 2012 UTC (11 years, 11 months ago) by avg
File length: 38737 byte(s)
Diff to previous 238229
acpi_cpu: separate a notion of current deepest allowed+available Cx level

... from a user-set persistent limit on the said level.
Allow to set the user-imposed limit below current deepest available level
as the available levels may be dynamically changed by ACPI platform
in both directions.
Allow "Cmax" as an input value for cx_lowest sysctls to mean that there
is not limit and OS can use all available C-states.
Retire global cpu_cx_count as it no longer serves any meaningful
purpose.

Reviewed by:	jhb, gianni, sbruno
Tested by:	sbruno, Vitaly Magerya <vmagerya@gmail.com>
MFC after:	2 weeks


Revision 238229 - (view) (download) (annotate) - [select for diffs]
Modified Sun Jul 8 10:57:49 2012 UTC (11 years, 11 months ago) by avg
File length: 39451 byte(s)
Diff to previous 238194
acpi_cpu: we are able to handle _CST change notifications...

so un-ifdef code that is supposed to tell ACPI platform about that

Tested by:	Taku YAMAMOTO <taku@tackymt.homeip.net>
MFC after:	2 weeks


Revision 238194 - (view) (download) (annotate) - [select for diffs]
Modified Sat Jul 7 08:19:34 2012 UTC (11 years, 11 months ago) by avg
File length: 39472 byte(s)
Diff to previous 238193
acpi_cpu_generic_cx_probe: for consistency set cpu_non_c3 here too

although by default only C1 is enabled (cx_lowest=0) and enabling deeper
states goes through acpi_cpu_set_cx_lowest which re-evaluates cpu_non_c3

MFC after:	2 weeks


Revision 238193 - (view) (download) (annotate) - [select for diffs]
Modified Sat Jul 7 08:12:51 2012 UTC (11 years, 11 months ago) by avg
File length: 39393 byte(s)
Diff to previous 238192
acpi_cpu_cx_list: there is no need to re-evaluate cpu_non_c3 here

cpu_non_c3 is already evaluated in acpi_cpu_cx_cst and in
acpi_cpu_set_cx_lowest.
Besides acpi_cpu_cx_list is not protected by any locking.

As a result also move setting of cpu_can_deep_sleep to more appropriate
places.

MFC after:	2 weeks


Revision 238192 - (view) (download) (annotate) - [select for diffs]
Modified Sat Jul 7 07:59:14 2012 UTC (11 years, 11 months ago) by avg
File length: 39473 byte(s)
Diff to previous 238009
acpi_cpu_cx_cst: consistently use cpu_cx_count during state enumeration

cpu_cx_count is an index into accepted states, while i is an index into
original _CST states

MFC after:	1 week


Revision 238009 - (view) (download) (annotate) - [select for diffs]
Modified Mon Jul 2 17:55:29 2012 UTC (12 years ago) by sbruno
File length: 39443 byte(s)
Diff to previous 238004
Revert r238004 as more review has come in and there is now a discussion
on how to best proceed.


Revision 238004 - (view) (download) (annotate) - [select for diffs]
Modified Mon Jul 2 16:57:13 2012 UTC (12 years ago) by sbruno
File length: 40189 byte(s)
Diff to previous 235845
Cosmetic display change of Cx states via cx_supported sysctl entries.

Adjust power_profile script to handle the new world order as well.

Some vendors are opting out of a C2 state and only defining C1 & C3.  This
leads the acpi_cpu display to indicate that the machine supports C1 & C2
which is caused by the (mis)use of the index of the cx_state array as the
ACPI_STATE_CX value.

e.g. the code was pretending that cx_state[i] would
always convert to i by subtracting 1.

cx_state[2] == ACPI_STATE_C3
cx_state[1] == ACPI_STATE_C2
cx_state[0] == ACPI_STATE_C1

however, on certain machines this would lead to
cx_state[1] == ACPI_STATE_C3
cx_state[0] == ACPI_STATE_C1

This didn't break anything but led to a display of:
 * dev.cpu.0.cx_supported: C1/1 C2/96

Instead of
 * dev.cpu.0.cx_supported: C1/1 C3/96

MFC after:	2 weeks


Revision 235845 - (view) (download) (annotate) - [select for diffs]
Modified Wed May 23 17:03:09 2012 UTC (12 years, 1 month ago) by jkim
File length: 39443 byte(s)
Diff to previous 235834
Restore Processor object path for verbose boot message.


Revision 235834 - (view) (download) (annotate) - [select for diffs]
Modified Wed May 23 13:45:52 2012 UTC (12 years, 1 month ago) by jhb
File length: 39391 byte(s)
Diff to previous 227843
Rework the previous change to honor MADT processor IDs when probing
processor objects.  Instead of forcing the new-bus CPU objects to use
a unit number equal to pc_cpuid, adjust acpi_pcpu_get_id() to honor the
MADT IDs by default.  As with the previous change, setting
debug.acpi.cpu_unordered to 1 in the loader will revert to the old
behavior.

Tested by:	jimharris
MFC after:	1 month


Revision 227843 - (view) (download) (annotate) - [select for diffs]
Modified Tue Nov 22 21:28:20 2011 UTC (12 years, 7 months ago) by marius
File length: 38463 byte(s)
Diff to previous 223527
- There's no need to overwrite the default device method with the default
  one. Interestingly, these are actually the default for quite some time
  (bus_generic_driver_added(9) since r52045 and bus_generic_print_child(9)
  since r52045) but even recently added device drivers do this unnecessarily.
  Discussed with: jhb, marcel
- While at it, use DEVMETHOD_END.
  Discussed with: jhb
- Also while at it, use __FBSDID.


Revision 223527 - (view) (download) (annotate) - [select for diffs]
Modified Sat Jun 25 02:49:47 2011 UTC (13 years ago) by marcel
File length: 38515 byte(s)
Diff to previous 223449
Now that ia64 has been switched to the event timers, remove the
conditional compilation work-arounds.


Revision 223449 - (view) (download) (annotate) - [select for diffs]
Modified Wed Jun 22 22:56:42 2011 UTC (13 years ago) by jkim
File length: 38563 byte(s)
Diff to previous 223426
Fix build on ia64 after r223426.


Revision 223426 - (view) (download) (annotate) - [select for diffs]
Modified Wed Jun 22 16:40:45 2011 UTC (13 years ago) by jkim
File length: 38539 byte(s)
Diff to previous 220433
Set negative quality to TSC timecounter when C3 state is enabled for Intel
processors unless the invariant TSC bit of CPUID is set.  Intel processors
may stop incrementing TSC when DPSLP# pin is asserted, according to Intel
processor manuals, i. e., TSC timecounter is useless if the processor can
enter deep sleep state (C3/C4).  This problem was accidentally uncovered by
r222869, which increased timecounter quality of P-state invariant TSC, e.g.,
for Core2 Duo T5870 (Family 6, Model f) and Atom N270 (Family 6, Model 1c).

Reported by:	Fabian Keil (freebsd-listen at fabiankeil dot de)
		Ian FREISLICH (ianf at clue dot co dot za)
Tested by:	Fabian Keil (freebsd-listen at fabiankeil dot de)
		- Core2 Duo T5870 (C3 state available/enabled)
		jkim - Xeon X5150 (C3 state unavailable)


Revision 220433 - (view) (download) (annotate) - [select for diffs]
Modified Thu Apr 7 23:28:28 2011 UTC (13 years, 2 months ago) by jkim
File length: 38504 byte(s)
Diff to previous 216443
Use atomic load & store for TSC frequency.  It may be overkill for amd64 but
safer for i386 because it can be easily over 4 GHz now.  More worse, it can
be easily changed by user with 'machdep.tsc_freq' tunable (directly) or
cpufreq(4) (indirectly).  Note it is intentionally not used in performance
critical paths to avoid performance regression (but we should, in theory).
Alternatively, we may add "virtual TSC" with lower frequency if maximum
frequency overflows 32 bits (and ignore possible incoherency as we do now).


Revision 216443 - (view) (download) (annotate) - [select for diffs]
Modified Tue Dec 14 20:07:51 2010 UTC (13 years, 6 months ago) by jkim
File length: 38483 byte(s)
Diff to previous 215188
Stop lying about supporting cpu_est_clockrate() when TSC is invariant.  This
function always returned the nominal frequency instead of current frequency
because we use RDTSC instruction to calculate difference in CPU ticks, which
is supposedly constant for the case.  Now we support cpu_get_nominal_mhz()
for the case, instead.  Note it should be just enough for most usage cases
because cpu_est_clockrate() is often times abused to find maximum frequency
of the processor.


Revision 215188 - (view) (download) (annotate) - [select for diffs]
Modified Fri Nov 12 17:10:12 2010 UTC (13 years, 7 months ago) by jkim
File length: 38216 byte(s)
Diff to previous 212997
Create C1 state when _CST is valid but _CST does not have one.  Some BIOSes
do not report C1 state in _CST object, probably because it is a mandatory
state with or without existence of the optional _CST.

Reviewed by:	avg


Revision 212997 - (view) (download) (annotate) - [select for diffs]
Modified Wed Sep 22 11:32:22 2010 UTC (13 years, 9 months ago) by mav
File length: 37660 byte(s)
Diff to previous 212549
Quick fix for unmotivated C2 state usage during boot, introduced at r212541.
That caused LAPIC timer failure and huge delays during boot on some systems.


Revision 212549 - (view) (download) (annotate) - [select for diffs]
Modified Mon Sep 13 09:51:24 2010 UTC (13 years, 9 months ago) by avg
File length: 37636 byte(s)
Diff to previous 212541
acpi_cpu: do not apply P_LVLx_LAT rules to latencies returned by _CST

ACPI specification sates that if P_LVL2_LAT > 100, then a system doesn't
support C2; if P_LVL3_LAT > 1000, then C3 is not supported.
But there are no such rules for Cx state data returned by _CST.  If a
state is not supported it should not be included into the return
package.  In other words, any latency value returned by _CST is valid,
it's up to the OS and/or user to decide whether to use it.

Submitted by:	nork
Suggested by:	mav
MFC after:	1 week


Revision 212541 - (view) (download) (annotate) - [select for diffs]
Modified Mon Sep 13 07:25:35 2010 UTC (13 years, 9 months ago) by mav
File length: 37840 byte(s)
Diff to previous 212413
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.


Revision 212413 - (view) (download) (annotate) - [select for diffs]
Modified Fri Sep 10 11:19:03 2010 UTC (13 years, 9 months ago) by avg
File length: 37614 byte(s)
Diff to previous 209330
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


Revision 209330 - (view) (download) (annotate) - [select for diffs]
Modified Sat Jun 19 08:46:17 2010 UTC (14 years ago) by mav
File length: 37610 byte(s)
Diff to previous 209328
Oops! Add " / hz" missed in r209328. Assume interrupt rate hz/2, not 1/2.


Revision 209328 - (view) (download) (annotate) - [select for diffs]
Modified Sat Jun 19 08:36:12 2010 UTC (14 years ago) by mav
File length: 37605 byte(s)
Diff to previous 209213
While we indeed can't precisely measure time spent in C1, we can consider
measured interval as upper bound. It should be more precise then just
assuming hz/2. For idle CPU it should be quite precise, for busy - not
worse then before.


Revision 209213 - (view) (download) (annotate) - [select for diffs]
Modified Tue Jun 15 19:14:39 2010 UTC (14 years ago) by jhb
File length: 37403 byte(s)
Diff to previous 209059
When updating individual CPU's lowest Cx state to use, never set it to a
state lower than the lowest one supported by the current CPU.  This closes
some races with changes to the hw.acpi.cpu_cx_lowest sysctl while Cx
states for individual CPUs were changing (e.g. unplugging the AC adapter
of a laptop) that could result in panics.

Submitted by:	Giovanni Trematerra
Tested by:	David Demelier  demelier dot david of gmail
MFC after:	3 days


Revision 209059 - (view) (download) (annotate) - [select for diffs]
Modified Fri Jun 11 18:46:34 2010 UTC (14 years ago) by jhb
File length: 37262 byte(s)
Diff to previous 203776
Update several places that iterate over CPUs to use CPU_FOREACH().


Revision 203776 - (view) (download) (annotate) - [select for diffs]
Modified Thu Feb 11 08:50:21 2010 UTC (14 years, 4 months ago) by avg
File length: 37314 byte(s)
Diff to previous 203546
acpi cpu: probe+attach before all other enumerated children on acpi bus

Some current systems dynamically load SSDT(s) when _PDC/_OSC method
of Processor is evaluated.  Other devices in ACPI namespace may access
objects defined in the dynamic SSDT.  Drivers for such devices might
have to have a rather high priority, because of other dependencies.
Good example is acpi_ec driver for EC.
Thus we attach to Processors as early as possible to load the SSDTs
before any other drivers may try to evaluate control methods.
It also seems to be a natural order for a processor in a device
hierarchy.

On the other hand, some child devices on acpi cpu bus need to access
other system resources like PCI configuration space of chipset devices,
so they need to be probed and attached rather late.
For this reason we probe and attach the cpu bus at
SI_SUB_CONFIGURE:SI_ORDER_MIDDLE SYSINIT level.
In the future this could be done more elegantly via multipass.

Please note that acpi drivers that might access ACPI namespace from
device_identify will do that before _PDC/_OSC of Processors are evaluated.

Legacy cpu driver is not affected by this change.

PR:		kern/142561 (in part)
Reviewed by:	jhb
Silence from:	acpi@
MFC after:	5 weeks


Revision 203546 - (view) (download) (annotate) - [select for diffs]
Modified Sat Feb 6 12:48:06 2010 UTC (14 years, 4 months ago) by avg
File length: 36936 byte(s)
Diff to previous 203430
acpi_cpu: prefer _OSC over _PDC, just in case

_PDC was deprecated in favor of _OSC long time ago, but it
seems that they still peacefully coexist and in some case
only _PDC is present.
Still _OSC provides a reacher interface and is capable to
report back its status.
If the status is non-zero, then report it, we may find
it useful to understand what firmware expects from OS.
Also clean up some comments that became less useful over time.

Reviewed by:	njl, jhb, rpaulo
MFC after:	3 weeks


Revision 203430 - (view) (download) (annotate) - [select for diffs]
Modified Wed Feb 3 14:35:33 2010 UTC (14 years, 5 months ago) by avg
File length: 37014 byte(s)
Diff to previous 199016
acpi_cpu: correct capabilities arguments for Processor _OSC evaluation

Populate capabilities buffer according to
Intel Processor Vendor-Specific ACPI Interface Specification.

MFC after:	2 weeks


Revision 199016 - (view) (download) (annotate) - [select for diffs]
Modified Sat Nov 7 11:46:38 2009 UTC (14 years, 7 months ago) by avg
File length: 36966 byte(s)
Diff to previous 197105
acpi: remove 'magic' ivar

o acpi_hpet: auto-added 'wildcard' devices can be identified by
  non-NULL handle attribute.
o acpi_ec: auto-add 'wildcard' devices can be identified by
  unset (NULL) private attribute.
o acpi_cpu: use private instead of magic to store cpu id.

Reviewed by:	jhb
Silence from:	acpi@
MFC after:	2 weeks
X-MFC-Note:	perhaps the ivar should stay for ABI stability


Revision 197105 - (view) (download) (annotate) - [select for diffs]
Modified Fri Sep 11 22:49:34 2009 UTC (14 years, 9 months ago) by jkim
File length: 36930 byte(s)
Diff to previous 196403
Catch up with ACPICA 20090903.


Revision 196403 - (view) (download) (annotate) - [select for diffs]
Modified Thu Aug 20 19:17:53 2009 UTC (14 years, 10 months ago) by jhb
File length: 36924 byte(s)
Diff to previous 196037
Temporarily revert the new-bus locking for 8.0 release.  It will be
reintroduced after HEAD is reopened for commits by re@.

Approved by:	re (kib), attilio


Revision 196037 - (view) (download) (annotate) - [select for diffs]
Modified Sun Aug 2 14:28:40 2009 UTC (14 years, 11 months ago) by attilio
File length: 36966 byte(s)
Diff to previous 193530
Make the newbus subsystem Giant free by adding the new newbus sxlock.
The newbus lock is responsible for protecting newbus internIal structures,
device states and devclass flags. It is necessary to hold it when all
such datas are accessed. For the other operations, softc locking should
ensure enough protection to avoid races.

Newbus lock is automatically held when virtual operations on the device
and bus are invoked when loading the driver or when the suspend/resume
take place. For other 'spourious' operations trying to access/modify
the newbus topology, newbus lock needs to be automatically acquired and
dropped.

For the moment Giant is also acquired in some key point (modules subsystem)
in order to avoid problems before the 8.0 release as module handlers could
make assumptions about it. This Giant locking should go just after
the release happens.

Please keep in mind that the public interface can be expanded in order
to provide more support, if there are really necessities at some point
and also some bugs could arise as long as the patch needs a bit of
further testing.

Bump __FreeBSD_version in order to reflect the newbus lock introduction.

Reviewed by:    ed, hps, jhb, imp, mav, scottl
No answer by:   ariff, thompsa, yongari
Tested by:      pho,
                G. Trematerra <giovanni dot trematerra at gmail dot com>,
                Brandon Gooch <jamesbrandongooch at gmail dot com>
Sponsored by:   Yahoo! Incorporated
Approved by:	re (ksmith)


Revision 193530 - (view) (download) (annotate) - [select for diffs]
Modified Fri Jun 5 18:44:36 2009 UTC (15 years, 1 month ago) by jkim
File length: 36924 byte(s)
Diff to previous 191764
Import ACPICA 20090521.


Revision 191764 - (view) (download) (annotate) - [select for diffs]
Modified Sun May 3 06:25:37 2009 UTC (15 years, 2 months ago) by mav
File length: 36870 byte(s)
Diff to previous 191763
Make dev.cpu.X.cx_usage sysctl also report current average of sleep time.


Revision 191763 - (view) (download) (annotate) - [select for diffs]
Modified Sun May 3 04:58:44 2009 UTC (15 years, 2 months ago) by mav
File length: 36812 byte(s)
Diff to previous 191760
Remove unused variable and fix spelling in comment.


Revision 191760 - (view) (download) (annotate) - [select for diffs]
Modified Sat May 2 22:30:33 2009 UTC (15 years, 2 months ago) by mav
File length: 36868 byte(s)
Diff to previous 190454
Avoid comparing negative signed to positive unsignad values. It was
leading to a bug, when C-state does not decrease on sleep shorter then
declared transition latency. Fixing this deprecates workaround for broken
C-states on some hardware.

By the way, change state selecting logic a bit. Instead of last sleep
time use short-time average of it. Global interrupts rate in system is a
quite random value, to corellate subsequent sleeps so directly.


Revision 190454 - (view) (download) (annotate) - [select for diffs]
Modified Thu Mar 26 21:10:35 2009 UTC (15 years, 3 months ago) by jhb
File length: 38060 byte(s)
Diff to previous 188814
Move the code to update cpu_cx_count out of acpi_cpu_generic_cx_probe() and
into acpi_cpu_startup() which is where all the other code to update this
global variable lives.  This fixes a bug where cpu_cx_count was not updated
correctly if acpi_cpu_generic_cx_probe() returned early.

PR:		kern/108581
Debugged by:	Bruce Cran
Reviewed by:	avg, njl, sepotvin
MFC after:	3 days


Revision 188814 - (view) (download) (annotate) - [select for diffs]
Modified Thu Feb 19 14:39:52 2009 UTC (15 years, 4 months ago) by avg
File length: 38105 byte(s)
Diff to previous 178146
acpi_cpu: fixup for PIIX4E PCI config related to C2

This is triggered only if BIOS configures ACPI_BITREG_BUS_MASTER_RLD
aka BRLD_EN_BM to 1.
Rationale:
1. we do not support C3 on PIIX4E
2. bus master activity need not break out of C2 state
3. because of CPU_QUIRK_NO_BM_CTRL quirk we may reset bus master
   status which would result in immediate break out from C2

So if you have seen
cpu0: too many short sleeps, backing off to C1
with this chipset before you may want to try cx_lowest of C2 again.

Reviewed by: rpaulo (mentor), njl
Approved by: rpaulo (mentor)


Revision 178146 - (view) (download) (annotate) - [select for diffs]
Modified Sat Apr 12 12:06:00 2008 UTC (16 years, 2 months ago) by rpaulo
File length: 37663 byte(s)
Diff to previous 176972
Update the list of Cx states when ACPICA notifies us. Usually, this
notification is sent when the AC plug is plugged in/out.

This is required on some laptops, namely the MacBooks.

Silence on:	 freebsd-acpi


Revision 176972 - (view) (download) (annotate) - [select for diffs]
Modified Sun Mar 9 11:19:03 2008 UTC (16 years, 3 months ago) by rpaulo
File length: 37156 byte(s)
Diff to previous 176326
Some PIIX4 chipsets need to be told to generate Stop Breaks by setting
the appropriate bit in the DEVACTB register.
This change allows the C2 state on those systems to work as expected.

Reviewed by:	njl
Submitted by:	Andriy Gapon <avg at icyb.net.ua>
MFC after:	1 week


Revision 176326 - (view) (download) (annotate) - [select for diffs]
Modified Sat Feb 16 02:00:25 2008 UTC (16 years, 4 months ago) by rpaulo
File length: 36407 byte(s)
Diff to previous 176205
Skip validation of the C3 state if we disabled C3 by software (i.e.,
via quirk).

Submitted by:	Andriy Gapon <avg at icyb.net.ua>
Reviewed by:	njl (mentor)
Approved by:	njl (mentor)
Requested by:	njl (mentor)
MFC after:	3 days


Revision 176205 - (view) (download) (annotate) - [select for diffs]
Modified Tue Feb 12 15:26:59 2008 UTC (16 years, 4 months ago) by jhb
File length: 36372 byte(s)
Diff to previous 173284
Fix a typo when testing for the NO_C3 quirk.

MFC after:	3 days


Revision 173284 - (view) (download) (annotate) - [select for diffs]
Modified Fri Nov 2 17:29:36 2007 UTC (16 years, 8 months ago) by njl
File length: 36373 byte(s)
Diff to previous 172022
Fix a shutdown hang on some SMP systems.  The previous logic was to IPI all
CPUs to make sure idle threads are evicted from the softc before returning
from acpi_cpu_shutdown().  However, this is unnecessary since stop_cpus()
handles this for itself and at this point it's possible that our IPI will be
blocked (interrupts disabled).

Thanks to:	Glen Leeder <glen.leeder / nokia.com>
MFC after:	3 days


Revision 172022 - (view) (download) (annotate) - [select for diffs]
Modified Thu Aug 30 21:18:42 2007 UTC (16 years, 10 months ago) by njl
File length: 36230 byte(s)
Diff to previous 170228
Evaluate _OSC on boot to indicate our OS capabilities to ACPI.  This is
needed at least to convince the BIOS to give us access to CPU freq
control on MacBooks.

Submitted by:	Rui Paulo <rpaulo / fnop.net>
Approved by:	re
MFC after:	5 days


Revision 170228 - (view) (download) (annotate) - [select for diffs]
Modified Sun Jun 3 00:40:56 2007 UTC (17 years, 1 month ago) by njl
File length: 35353 byte(s)
Diff to previous 170214
Disable CPU idle states during suspend and reenable them during resume.
While in the suspend path, this means the idle thread will just return
immediately rather than trying to enter C1-n.  This helps in the case where
the chipset is powered down before the rest of the system and reads from
the cpu sleep registers begin returning immediately, causing the logic that
catches bad C2/C3 behavior to kick in.  Observed on my Panasonic Y4.

MFC after:	3 days


Revision 170214 - (view) (download) (annotate) - [select for diffs]
Modified Sat Jun 2 20:01:40 2007 UTC (17 years, 1 month ago) by njl
File length: 34811 byte(s)
Diff to previous 167814
Fix a bug introduced in the per-CPU Cx states commit.  The wrong loop var
(j/i) was being used and it was being incremented, not decremented as before.
Factor out this code into a common function and call it from both the common
and per-CPU case.

MFC after:	1 day


Revision 167814 - (view) (download) (annotate) - [select for diffs]
Modified Thu Mar 22 18:16:43 2007 UTC (17 years, 3 months ago) by jkim
File length: 34913 byte(s)
Diff to previous 166184
Catch up with ACPI-CA 20070320 import.


Revision 166184 - (view) (download) (annotate) - [select for diffs]
Modified Tue Jan 23 07:20:44 2007 UTC (17 years, 5 months ago) by njl
File length: 35008 byte(s)
Diff to previous 166027
Add missing function trace for debug prints.


Revision 166027 - (view) (download) (annotate) - [select for diffs]
Modified Mon Jan 15 18:17:36 2007 UTC (17 years, 5 months ago) by njl
File length: 34953 byte(s)
Diff to previous 165882
Clean up some debug prints from last commit and move one under boot -v.
Reminded by:	bruno


Revision 165882 - (view) (download) (annotate) - [select for diffs]
Modified Mon Jan 8 00:45:46 2007 UTC (17 years, 5 months ago) by njl
File length: 35004 byte(s)
Diff to previous 165875
Fix LINT and ACPI_DEBUG builds and add print for use of flush cache inst.


Revision 165875 - (view) (download) (annotate) - [select for diffs]
Modified Sun Jan 7 21:53:42 2007 UTC (17 years, 5 months ago) by njl
File length: 34879 byte(s)
Diff to previous 151678
Re-work Cx handling to be per-cpu and asymmetrical, fixing support on
modern dual-core systems as well.

- Parse the _CST packages for each cpu and track all the states individually,
on a per-cpu basis.

- Revert to generic FADT/P_BLK based Cx control if the _CST package
is not present on all cpus. In that case, the new driver will
still support per-cpu Cx state handling. The driver will determine the
highest Cx level that can be supported by all the cpus and configure the
available Cx state based on that.

- Fixed the case where multiple cpus in the system share the same
registers for Cx state handling. To do that, added a new flag
parameter to the acpi_PkgGas and acpi_bus_alloc_gas functions that
enable the caller to add the RF_SHAREABLE flag.  This flag could also be
useful to other callers (acpi_throttle?) in the tree but this change is
not yet made.

- For Core Duo cpus, both cores seems to be taken out of C3 state when
any one of the cores need to transition out. This broke the short sleep
detection logic.  It is disabled now if there is more than one cpu in
the system for now as it fixed it in my case.  This quirk may need to
be re-enabled later differently.

- Added support to control cx_lowest on a per-cpu basis. There is still
a generic cx_lowest to enable changing cx_lowest for all cpus with a single
sysctl and for ease of use.  Sample output for the new sysctl:

dev.cpu.0.cx_supported: C1/1 C2/1 C3/57
dev.cpu.0.cx_lowest: C3
dev.cpu.0.cx_usage: 0.00% 43.16% 56.83%
dev.cpu.1.cx_supported: C1/1 C2/1 C3/57
dev.cpu.1.cx_lowest: C3
dev.cpu.1.cx_usage: 0.00% 45.65% 54.34%
hw.acpi.cpu.cx_lowest: C3

This work was done by Stephane E. Potvin with some simple reworking by
myself.  Thank you.

Submitted by:	Stephane E. Potvin <sepotvin / videotron.ca>
MFC after:	2 weeks


Revision 151678 - (view) (download) (annotate) - [select for diffs]
Modified Tue Oct 25 21:15:47 2005 UTC (18 years, 8 months ago) by njl
File length: 30938 byte(s)
Diff to previous 150003
If we're trying to use C2/3 and reads from the register are returning
immediately, back off to the next higher Cx sleep state.  Some machines
with a Via chipset report a valid C3 but a register read doesn't actually
halt the CPU.  This would cause the machine to appear unresponsive as it
repeatedly called cpu_idle() which immediately returned.  Causing interrupts
(i.e. by pressing the power button) would cause the system to make forward
progress, showing that it wasn't actually hung.

Also, enable interrupts a little earlier.  We don't need them disabled
to calculate the delta time for the read.

Reported by:	silby
MFC after:	2 weeks


Revision 150003 - (view) (download) (annotate) - [select for diffs]
Modified Sun Sep 11 18:39:03 2005 UTC (18 years, 9 months ago) by obrien
File length: 30311 byte(s)
Diff to previous 144878
Canonize the include of acpi.h.


Revision 144878 - (view) (download) (annotate) - [select for diffs]
Modified Sun Apr 10 19:21:42 2005 UTC (19 years, 2 months ago) by njl
File length: 30292 byte(s)
Diff to previous 144875
Advertise that we can handle unified SMP control of processor power
states, idling, etc.  This has been supported since the cpufreq import.


Revision 144875 - (view) (download) (annotate) - [select for diffs]
Modified Sun Apr 10 19:07:08 2005 UTC (19 years, 2 months ago) by njl
File length: 30074 byte(s)
Diff to previous 144629
Fix support for _PDC by using the proper version/length format for the
buffer.  Also, reference the Intel document where the _PDC values were
found.  This now supports ACPI-assisted SpeedStep on my borrowed T42.


Revision 144629 - (view) (download) (annotate) - [select for diffs]
Modified Mon Apr 4 15:46:57 2005 UTC (19 years, 3 months ago) by njl
File length: 29433 byte(s)
Diff to previous 144170
Add the acpi_get_features() method.  This method is called on child drivers
to see what features they may support before calling identify/probe/attach.
This is necessary because the ACPI 3.0 spec requires driver support be
advertised before running any methods.  For now, the flags are as specified
in for the _PDC and _OSC methods but we can support private flags as needed.

Add an implementation of this for acpi_cpu.  It checks all its children
(notably cpufreq drivers) and calls the _PDC method to report the results.


Revision 144170 - (view) (download) (annotate) - [select for diffs]
Modified Sun Mar 27 03:37:43 2005 UTC (19 years, 3 months ago) by njl
File length: 29546 byte(s)
Diff to previous 141429
If a device_add_child fails (i.e. low memory situation), be sure to free
the unused ivars also.

Submitted by:	pjd
Obtained from:	Coverity Prevent analysis


Revision 141429 - (view) (download) (annotate) - [select for diffs]
Modified Mon Feb 7 04:03:06 2005 UTC (19 years, 4 months ago) by njl
File length: 29518 byte(s)
Diff to previous 141415
Remove handling _PSS notifies from acpi_cpu and let acpi_perf handle them.


Revision 141415 - (view) (download) (annotate) - [select for diffs]
Modified Sun Feb 6 21:10:19 2005 UTC (19 years, 4 months ago) by njl
File length: 29841 byte(s)
Diff to previous 141411
Remove acpi throttling support from the acpi_cpu(4) driver now that this
is supported by acpi_throttle(4).


Revision 141411 - (view) (download) (annotate) - [select for diffs]
Added Sun Feb 6 20:12:28 2005 UTC (19 years, 4 months ago) by njl
File length: 36921 byte(s)
Diff to previous 141380
Notify the OS that we're taking over Px states in acpi_perf(4) instead of
doing it in the cpu driver.  The previous code was incorrect anyway since
this value controls Px states, not throttling as the comment said.  Since
we didn't support Px states before, there was no impact.  Also, note that
we delay the write to SMI_CMD until after booting is complete since it
sometimes triggers a change in the frequency and we want to have all
drivers ready to detect/handle this.



This form allows you to request diffs between any two revisions of this file. For each of the two "sides" of the diff, enter a numeric revision.

  Diffs between and
  Type of Diff should be a

  ViewVC Help
Powered by ViewVC 1.1.27