Commit Graph

1314 Commits

Author SHA1 Message Date
jmcneill
2bf4673f17 cast curlwp to uintptr_t before casting to ACPI_THREAD_ID, fixes i386 build 2011-02-17 10:35:50 +00:00
jruoho
99109677b7 ACPICA 20100806:
Fixed a problem with the prototype for AcpiOsReadPciConfiguration.
The prototype in acpiosxf.h had the output value pointer as a (void *).
It should be a (UINT64 *). This may affect some host OSL code.
2011-02-17 10:23:43 +00:00
jruoho
01d77446c4 ACPICA 20100806:
Obsolete Functions: AcpiOsValidateInterface - no longer used.
2011-02-17 10:21:43 +00:00
jruoho
303587c62f ACPICA 20100915:
Removed the AcpiOsDerivePciId OSL interface. The various host
implementations of this function were not OS-dependent and are now obsolete
and can be removed from all host OSLs.  This function has been replaced by
AcpiHwDerivePciId, which is now part of the ACPICA core code.
AcpiHwDerivePciId has been implemented without recursion.  Adds one new
module, hwpci.c.  ACPICA BZ 857.
2011-02-17 10:20:32 +00:00
jruoho
3b274ab6bf Switch acpi(4) to use the new location of ACPICA. 2011-02-17 07:34:42 +00:00
jruoho
3993e0d154 Make the WMI modules depend on the parent mapper. 2011-02-16 13:15:49 +00:00
jruoho
5f852a8424 Change the preprocessor defines around the module(9)'s modcmd() calls such
that the modules show in modstat(8) even though these are "builtin".
2011-02-16 09:05:12 +00:00
jruoho
2b0b13f21f Use ioconf for the module declarations. 2011-02-16 08:35:51 +00:00
jruoho
b9f301d5a2 Convert the homegrown module declarations to use ioconf. 2011-02-16 08:19:56 +00:00
jruoho
7e0b5b7921 Add a skeleton driver for Asus EeePC acpiwmi(4) mappings. 2011-02-16 07:30:26 +00:00
jruoho
2e742e4a77 Reset the firmware waking vector on resume. Adapted from FreeBSD and Linux.
No functional change intended.
2011-02-15 20:24:11 +00:00
jruoho
23501c315c Fix small negligence mistake. 2011-02-14 18:51:44 +00:00
jruoho
512cae94de Improve error reporting. 2011-01-30 08:55:52 +00:00
jmcneill
c93b203331 If the thermal zone has a _PSL method, print a list of processors
associated with the zone at attach time.

  acpitz0 at acpi0 (THM0)
  acpitz0: levels: critical 127.0 C, passive cooling
  acpitz1 at acpi0 (THM1): cpu0 cpu1
  acpitz1: levels: critical 100.0 C, passive 95.5 C, passive cooling
2011-01-18 21:15:54 +00:00
jmcneill
2dd19c519d Use AcpiOsReadPort/AcpiOsWritePort instead of inb/outb so I can get rid of
of the i386 and x86_64 ifdefs.
2011-01-18 18:56:25 +00:00
jmcneill
138a9407d2 use PRIx64 instead of llx, fixes build on amd64 2011-01-17 17:32:11 +00:00
jmcneill
8ddcdc25a9 acpiwdrt needs sysmon_wdog 2011-01-17 15:55:24 +00:00
jmcneill
27686d11fe Add a driver for ACPI "Watchdog Resource Table" devices.
acpiwdrt0 at acpi0: mem 0xfed01000,0xfed01004
  acpiwdrt0: PCI 0:000:00:0 vendor 0x1106 product 0x3337
  acpiwdrt0: watchdog interval 1-1023 sec.
2011-01-17 15:49:13 +00:00
jruoho
f82830f374 Postpone the sensor update with sysmon_taskq(9). 2011-01-13 14:25:33 +00:00
jruoho
3c51ce4b05 Upon request from jmcneill@, put the check back that prevents unnecessary
readings during the sysmon_envsys(9) poll cycle. Some systems (notably,
Asus EeePC) have so badly implemented AML that reading the values via
envstat(8) alone can cause considerable delays.
2011-01-13 13:05:13 +00:00
jruoho
f861d1bc75 Clean-up acpi_print(). XXX: The 'acpiverbose' module is still broken... 2011-01-13 05:58:05 +00:00
jruoho
710112e7c7 Scan for docking stations. 2011-01-13 05:14:48 +00:00
jruoho
3dd22c3c2c Do not try to attach more ACPI CPUs than the amount of "real" CPUs. 2011-01-13 04:18:19 +00:00
jruoho
99d6864d21 Move the function that counts the CPUs from acpicpu(4) to the MD layer. 2011-01-13 03:40:50 +00:00
jruoho
c2df94f224 Disable all GPEs when entering S5. Also add a comment that the function
acpi_enter_sleep_state() must be called with interrupts enabled.
2011-01-11 20:35:24 +00:00
jruoho
322f6c439c Regen. 2011-01-10 17:04:55 +00:00
jruoho
93da29999d Add SMO1200 (yet another TPM chip). From ThinkPad x201i. 2011-01-10 17:04:22 +00:00
jruoho
2304727048 Small clean-up in the match and attach functions. Namely, use the attach
args instead of referencing the global softc. No functional change.
2011-01-10 09:07:27 +00:00
jruoho
f640132d0b Convert aprint_error(9) to ACPI_DEBUG_PRINT. 2011-01-09 16:22:07 +00:00
jruoho
1b00e79140 Remove also rest of the ACPI_DEVICE_POWER checks. 2011-01-09 16:15:25 +00:00
jruoho
930b9f2eb4 After consulting jmcneill@, set the state to D0 ("on") upon shutdown and
detach. A safety measure so that we do not accidentally fry anything.
2011-01-09 15:43:20 +00:00
jruoho
37f5de3ab8 Add a dummy-driver for ACPI fans. 2011-01-09 15:12:33 +00:00
jruoho
019ba6b902 Use acpi_power_register() for consistency. No functional change. 2011-01-09 14:58:10 +00:00
jruoho
1dee4ee9e2 We use config_defer(9) now when scanning power resource and wake-up
capabilities, so do not fail in acpi_power_register() if ACPI_DEVICE_POWER is
not set in struct acpi_devnode::ad_flags.
2011-01-09 14:56:06 +00:00
jruoho
c40255f958 Print a message if ACPI 4.0 functionality is present (in which case the
driver should be updated).
2011-01-09 09:47:55 +00:00
jruoho
74a4ee7fc0 Rearrange (use two tabs). 2011-01-09 05:06:17 +00:00
jruoho
f422341f8e Regen. 2011-01-09 04:59:00 +00:00
jruoho
04e39f05b5 Add INTC0102 (Intel TPM chip). From ThinkPad T500. 2011-01-09 04:58:34 +00:00
cegger
21fd508d09 use aprint_error_dev 2011-01-07 14:08:29 +00:00
jruoho
ef2b108701 Fix a comment. 2011-01-06 18:57:22 +00:00
jruoho
0af1ebd4ab Split the code that makes a string from ACPI_DEVICE_INFO::Name to a function. 2011-01-06 07:05:00 +00:00
jruoho
1bb3132df6 Move the ACPI_ACTIVATE_DEV block around for clarity. 2011-01-06 06:49:12 +00:00
jruoho
e067d18bf0 Add a driver for ACPI power meters. 2011-01-05 20:08:12 +00:00
jruoho
d982261b67 Adjust previous slightly. 2011-01-05 08:08:47 +00:00
jruoho
740a9e0c0e Make a two-pass scan for acpinodebus. This should ensure that devices such
as acpiec(4) are attached before anything else. Numerous bugs are expected
to be fixed with this change.
2011-01-05 07:58:04 +00:00
jruoho
c96fe4ba5e Revert the changes made in the commit:
"Do not queue functions via sysmon_taskq(9) in the pmf(9) resume hooks.
   There is a small and unlikely race when the drivers are loaded as modules;
   suspend, resume, queue a function, and immediately unload the module."

Queueing the checks in the resume hooks was observed to improve the resume
time by several seconds (!) on a system with poorly implemented AML code.
The observed race condition is a wider issue related to modules; things like
sysmon_taskq(9) should be modified to allow cancelling of queued functions.
2011-01-04 05:48:48 +00:00
jruoho
a26fa60e11 Fix previous. 2011-01-04 04:28:48 +00:00
jruoho
6a3b9e2cde Scan for devices that are "hot-pluggable". 2011-01-03 08:50:23 +00:00
jruoho
6248a51d8a Adjust error messages for the previous commit. 2011-01-02 12:06:02 +00:00
jruoho
e008cf160e Use "real" device names for the hw.acpi.wake and hw.acpi.power sysctl(8)
trees. For instance, instead of hw.acpi.wake.DURT, we have hw.acpi.wake.wm0
for wm(4). This is a temporary solution, but without solving the big
abstraction questions, this is the best we can do.
2011-01-02 06:05:47 +00:00
jruoho
9a11653a7b Print a warning if the BIOS thinks that the timer is unreliable. However, do
not touch the quality of the timecounter(9) based on this information.
2011-01-02 05:48:55 +00:00
jruoho
8aaffbf4e9 Include <dev/acpi/acpi_pci.h>. 2010-12-31 14:05:15 +00:00
jruoho
396210649d acpi_pcidev_find_dev(): take struct acpi_devnode as a parameter. 2010-12-31 10:56:39 +00:00
jruoho
aa705fc95d Move the function that finds a device_t for the corresponding ACPI device
node from ACPIVERBOSE to the ACPI PCI code.
2010-12-31 10:23:44 +00:00
jruoho
b99cdd8ef8 Move the ACPI sleep-specific sysctl variables to hw.acpi.sleep. The old
machdep-variables are provided for backwards compatibility (eventually these
should be removed). All ACPI sysctl variables are now under hw.acpi.
2010-12-31 09:19:43 +00:00
jruoho
77f707c929 Use "temperature #" and "fan speed #" rather than "TMP#" and "FAN#" for the
sensor names. Remove white space. No functional change.
2010-12-31 08:17:54 +00:00
jruoho
3dc9396c46 Regen. 2010-12-30 19:38:03 +00:00
jruoho
47c7d9897b Add IBM0079. 2010-12-30 19:37:39 +00:00
jruoho
a5a73b2a05 Change the default behavior to enforce the maximum frequency when the
firmware requests to do so. This cures severe overhating (> 120 C) observed
on many laptops, being also on par with the specification(s). This can be
reverted by using the new "hw.acpi.cpu.dynamic" sysctl variable.
2010-12-30 12:05:02 +00:00
jruoho
82e1351b37 Regen. 2010-12-22 22:29:19 +00:00
jruoho
e3cfc8ab23 Add IPI0001, an identifier for ipmi(4). From Dell M710. 2010-12-22 22:28:35 +00:00
jruoho
8e53b1ce30 Use branch annotations in couple of places. Add two comments. 2010-12-20 08:13:04 +00:00
jruoho
e1de74391b Add AMD C1E quirk. Tested by cegger@.
(a) This should be removed once C-states are supported.

  (b) As there seems to be no reliable way to detect whether C1E is present,
      the quirk blindly assumes that C1E is used on families 10h and 11h.
2010-11-30 04:31:00 +00:00
gsutre
4e1e5c3604 Replace ACPI_UINT64 by ACPICA's ACPI_INTEGER. Remove superfluous casts.
No functional change.
2010-11-07 16:36:26 +00:00
gsutre
64448b4070 Hm, the warning sign was not big enough. 2010-11-05 10:35:00 +00:00
gsutre
e0b5016656 Merge ACPI Fujitsu Driver. Provides support for hotkeys and other
built-in components through vendor-specific ACPI devices.

ok jruoho@
2010-11-05 10:28:20 +00:00
jruoho
01720ae0de Initialize pointers to NULL to avoid accidentally free(9)'ing garbage.
Should address the panic reported by Alan Bueno in PR # 44042. The root
cause (an empty _DOD) is yet to be determined.
2010-11-04 20:08:12 +00:00
gsutre
678179dfe4 acpi_eval_integer: check that the evaluation produced a result.
ok jruoho@
2010-11-02 16:45:48 +00:00
gsutre
027c57ec40 Lock the _DGS values (desired output state) during the display
output switch.

ok jruoho@
2010-10-29 09:04:38 +00:00
gsutre
a9f3b6413d Simplify the sysctl variable for BIOS switch policy, and document it
in acpivga(4).  The previous hw.acpi.acpivga0.policy variable is
renamed into bios_policy for consistency, and is for ACPI_DEBUG only.

ok jruoho@
2010-10-28 21:45:02 +00:00
jruoho
b6050c6897 Be silent if we get a notification to tell us that we woke up the system. 2010-10-28 18:03:11 +00:00
jruoho
639d1b9782 Install EC space handler and pass everything to acpiec(4).
Should fix PR # 43659.
2010-10-28 15:55:04 +00:00
jruoho
fcd284181f Fix a comment typo. 2010-10-28 04:28:29 +00:00
jruoho
a4915ab4db Only override data from XPSS if the conventional _PSS did not contain the
required information. Problem found and diagnosed by jakllsch@; on some AMD
systems vendors fill _PSS correctly, but do not duplicate the data in XPSS.
2010-10-28 04:27:40 +00:00
gsutre
f32ca0cfec Make acpi(4) debug aware of ACPI_DISPLAY_COMPONENT. 2010-10-27 14:39:26 +00:00
gsutre
af565a28d4 An _ADR object is not required for PCI root bridges. To solve
this, the structure acpi_pciinfo now tells whether the ACPI
device node is a PCI bridge, a regular PCI device, or both.

Problem reported by jmcneill@, who also suggested the solution.

ok jmcneill@, jruoho@
2010-10-26 22:27:44 +00:00
jruoho
85aafab84b Add LEN0014. (And to the previous commit; a driver for this, not PNP0C32, is
possibly coming.)
2010-10-26 09:13:54 +00:00
jruoho
4e313088ed Regen. 2010-10-26 08:59:06 +00:00
jruoho
91c0c3fd42 Add more identifiers for ATM chips.
Also add PNP0C32 for "quickstart buttons". A driver for this comes later.
2010-10-26 08:57:46 +00:00
jruoho
6fdfbe79c2 Add support for module(9). 2010-10-26 05:28:29 +00:00
jruoho
8eae6f006a Bump WARNS to 4. 2010-10-26 04:37:33 +00:00
jruoho
a953788eba Use kmem(9) instead of malloc(9). 2010-10-26 04:24:21 +00:00
jruoho
6b1e267f66 Refactor slightly and bump WARNS to 4. 2010-10-26 03:11:10 +00:00
jruoho
9fad28a567 Add support for module(9). 2010-10-25 17:06:58 +00:00
jruoho
a60aadf22e Fix build failure. 2010-10-25 15:38:05 +00:00
jruoho
70e14dc983 Bump WARNS to 4. 2010-10-25 07:48:03 +00:00
jmcneill
9750ca2f9c add support for building as a module 2010-10-24 18:26:29 +00:00
jmcneill
4e44999554 add support for building as modules 2010-10-24 16:25:31 +00:00
jmcneill
5991cdfeba add rescan support 2010-10-24 15:07:20 +00:00
jruoho
117351d1b6 Add acpiwmi(4) mappings for MSI laptops.
XXX: It may be necessary to fix PR # 43659 before this works on all models.
2010-10-24 08:54:14 +00:00
jruoho
c99562cb83 Simplify acpi_enter_sleep_state() and guard it against NULL pointer
dereferences. Try to avoid referencing the global acpi_softc, which should
really be static or at least internal to acpi(4).
2010-10-24 07:53:04 +00:00
gsutre
e28e04ce32 Merge ACPI display driver. Provides generic support for brightness
control and output switching, through ACPI video extensions.

TODO: use wsconsctl(8) instead of sysctl(8) for brightness control.

ok jruoho@
also discussed with cegger@ and jmcneill@
2010-10-12 19:10:49 +00:00
gsutre
646cb7e223 Store sysctl MIBs instead of a pointer to the root of the sysctl
sub-tree (because the pointer may be invalid at the time we use it).

ok jruoho@
2010-10-08 07:04:31 +00:00
gsutre
92e792e4a4 Drop _HID requirement for attachment under acpi(4). From now on,
drivers attaching to the acpinodebus interface should not assume
that the passed acpi_devnode has a valid _HID.

ok jruoho@
2010-10-02 18:06:47 +00:00
gsutre
a9c0568376 Do not discard ACPI PCI addresses with function number 0xFFFF: the
ACPI specification allows them (ACPI 4.0a, p. 200).

ok jruoho@
2010-09-24 07:48:59 +00:00
jmcneill
eb0e82d870 Add support for blacklisting ACPI BIOS implementations by year. By default,
don't use ACPI on BIOS which advertise release years <= 2000. This
can be changed by setting option ACPI_BLACKLIST_YEAR=0 or by setting
acpi_force_load=1.
2010-09-06 15:54:26 +00:00
jakllsch
eb044d2951 Remove quirk added in rev 1.14. Even after the change of 1.16, it
still matches more boards that just the one with the problem.

Interrupts from the SATA controllers on my MSI K8N Neo3 boards
(which both versions of this quirk matched) are broken when ACPI
is disabled.  My board does not exhibit AE_AML_INFINITE_LOOP
problems.

If we want to avoid manually specifying RB_MD2 in boothowto on
pgoyette@'s board, we're going to have to find another way; perhaps
with the DMI strings available from pmf(9).

Anyhow, some boards needing RB_MD2 during boot(8) is in my opinion
better than others needing to set acpi_force_load in ddb or gdb.
2010-09-06 14:09:54 +00:00
jruoho
40ac1b9f62 Use FADT instead of DSDT in the quirk added in the revision 1.14. 2010-09-04 17:48:26 +00:00
jruoho
a8cdc50f5d Fix PR kern/43765 from Scott Ellis.
Note that the solution is not optimal. If ichlpcib(4) provides SpeedStep
support, possible I/O resource conflicts may occur with acpicpu(4). Ideally,
as noted for instance in Windows design documents, ichlpcib(4) should never
expose SpeedStep when ACPI is being used. The probability for potential race
conditions is however very small, being limited to few P4-era machines and
being dependent on user actions.
2010-08-27 03:05:26 +00:00
jruoho
9d3272e78a From jmcneill@: fix and rework the obscure _OSC evaluation. 2010-08-27 02:44:05 +00:00
jruoho
8c53a12242 Bypass ACPI_NOTIFY_DEVICE_WAKE also in acpilid(4). Use aprint_debug_dev(9)
for an unknown notify. (The ACPI drivers should really not print anything
as we now have a global notify handler that can catch the debug information.)
2010-08-24 15:03:34 +00:00
jruoho
22be5f8eda Remove phony spl(9). XXX: This driver needs to be cleaned up. 2010-08-24 14:53:45 +00:00
jruoho
42a7d04b04 Add native support for AMD family 0Fh processors. This is the furthest we
will go backwards; K7 will not be supported already due doubts about
availability and reliability of ACPI during that era. Some unfortunate code
duplication is present (but not overly much). Thanks to cegger@ and jakllsch@
for patiently testing this.
2010-08-24 07:27:59 +00:00
pgoyette
4cbc14d2b2 Initialize acpi_force_load so that it gets allocated in the data segment
rather than BSS.  This lets you change its value with 'gdb --write'.

OK jruoho@
2010-08-24 04:36:02 +00:00
jruoho
4f4a7a5d46 Other entry points beyond x86_cpu_idle_halt() may use HLT as the
idle-mechanism. Send an IPI also for these in cpu_need_resched().
2010-08-23 16:20:44 +00:00
jruoho
f0bf6761b2 Use acpi_timer_read_fast() instead of acpi_timer_read_safe(). 2010-08-22 17:45:48 +00:00
jmcneill
49c09edb54 Don't put devices in the ignored IDs list just because no driver exists. 2010-08-22 00:39:08 +00:00
jruoho
22b91511fc After discussion with jakllsch@ and jmcneill@, revert the previous and only
do the status-check when the comparison value reported by BIOS is not zero.
The uncertainty noted in the previous commit still applies. But if we ever
see a timeout again, it will likely be either a firmware bug or a special
case like the Intel Turbo Boost.
2010-08-21 18:25:45 +00:00
jmcneill
c5ec9c2c52 in acpibut_notify_handler, suppress 'unknown event' messages for
ACPI_NOTIFY_DEVICE_WAKE. Control method power and sleep buttons can
generate this event upon waking from G1 sleep to indicate that it was
responsible for waking the system.
2010-08-21 16:36:15 +00:00
pgoyette
f05cff10bd Update the various xxx_verbose modules to conform to the module subsystem's
new locking protocol.
2010-08-21 13:18:35 +00:00
jmcneill
0b3fb1fe44 - don't clobber the data found by _PSS if XPSS validation fails
- XPSS spec says that Status{,Mask} and Control{,Mask} buffers are 8 bytes
- use ACPI_GET64 macros instead of memcpy when reading from buffers

This makes acpicpu work again on my VIA C7-M, whose firmware reports
malformed XPSS packages but has a working _PSS
2010-08-21 13:12:15 +00:00
jruoho
497fed0a50 Check from CPUID 0x06 %eax (on Intel) whether we might actually have an
invariant APIC timer or an "ARAT" ("always running APIC timer"). This means
that the APIC timer may keep ticking at the same rate also in deep C-states
with some new or forthcoming Intel CPUs.
2010-08-21 06:45:50 +00:00
jruoho
6cf2f2d125 Detect whether TSC is invariant, which may be the case on both new AMD and
Intel processors. The invariance means that TSC runs at a constant rate
during all ACPI state changes. If it is variant, skew may occur and TSC is
generally unsuitable for wall clock services. This is especially relevant
with C-states; with variant TSC, the whole counter may be stopped with states
larger than C1. All x86 CPUs before circa mid-2000s can be assumed to have a
variant time stamp counter.
2010-08-21 03:55:24 +00:00
jruoho
222d798a76 Add two flags that needs to be dealt with (hardware vs. software
coordination of P-state transitions, and Turbo Boost / Turbo Core).
2010-08-20 12:20:23 +00:00
jruoho
24ca85d180 Give a hint about a driver conflict. 2010-08-20 06:36:40 +00:00
jruoho
ce692d69b0 Check the cached value also when setting a state. 2010-08-20 04:16:00 +00:00
jmcneill
11d8465e82 pull in acpireg.h for ACPI_COMPONENT_RESOURCE 2010-08-19 18:37:38 +00:00
jmcneill
e9887a1821 define _COMPONENT and ACPI_MODULE_NAME() for ACPI_DEBUG 2010-08-19 18:30:33 +00:00
jmcneill
70496e9ae2 add pmf support 2010-08-19 14:59:24 +00:00
jruoho
5ecdb7f351 Deal with autoconfiguration madness by using config_defer(9) to defer
config_interrupts(9) to be executed. This is necessary because: (a) the
initialization routines must be run only once after interrupts are enabled
and (b) all ACPI CPUs have attached.
2010-08-19 05:09:53 +00:00
jruoho
8116cea3d3 Use the idea from cegger@ and fill the (X)PSS structure during initialization. 2010-08-18 18:32:20 +00:00
jruoho
46457f068f Fix fix of a bug: first initialize sc, check sc != NULL, then KASSERT(9). 2010-08-18 02:01:45 +00:00
cegger
63f1e79c2b build fix: first initialize sc then KASSERT 2010-08-17 18:49:28 +00:00
jruoho
6846d4aa28 Adjust locking for previous. 2010-08-17 10:57:30 +00:00
jruoho
99f8ada841 Clarify the initialization of the dynamic maximums/minimums. Reset these to
defaults upon suspend. As we do not know how well the firmware maintains
state, do not run the callbacks that evaluate the maximum/minimum on resume.
2010-08-17 10:35:22 +00:00
jruoho
e70b5284eb Add support for the optional dynamic minimum (in terms of MHz) via _PDL.
Comparable to T-states, this gives effectively a window of available
performance states for passive cooling. An example:

Init:		max = 0, min = Pn.

		Time j.				Time j + 1.
		-----------			-----------
2000 MHz	P0	max			P0
		P1				P1	max
		P2		   ==>		P2
		P3				P3	min
		P4				P4
		P5	min			P5
 500 Mhz	Pn				Pn
		-----------			-----------

Search:		repeat (i = P0; i <= P5)	repeat (i = P1; i <= P3)
2010-08-17 10:17:52 +00:00
jruoho
f3e239e7c7 Fix comments. 2010-08-16 20:20:44 +00:00
jruoho
c1f0324ceb Two changes:
1.	Initialize P-states properly to P0. It is processor-specific
   	what value we might get without initialization. (Some AMD CPUs
	have even specific registers for the state after cold reset.)

  2.	Following design notes for Windows, set the lowest-power P-state
	upon suspend and restore the saved state after resume.
2010-08-16 20:07:57 +00:00
jruoho
2510a0e220 Now that the deferred configuration actually works as expected and documented,
use config_defer(9) instead of config_finalize_register(9), and simplify the
code paths around the initialization.
2010-08-16 17:58:42 +00:00
jmcneill
81c69bbce9 make it compile again 2010-08-16 10:23:25 +00:00
jruoho
c4a7ea78bd If XPSS is used, only invalidate P-states if the control MSR address is zero.
If the status address is zero, we will bluntly bypass the transition check.
2010-08-16 10:07:09 +00:00
jruoho
6c06255cee Add support for Extended PSS ACPI Method Specification from Microsoft.
This will greatly simplify supporting PowerNow! on conforming systems.
2010-08-16 07:38:38 +00:00
jruoho
b5e3d393b9 Do not error out neither in P-states nor in T-states if the method for the
dynamic maximum is nonexistent. Unsurprisingly, there is vagueness in the
standards; in ACPI 3.0 and 4.0 it is clearly indicated that also these methods
must be present, but the earlier standards are less stringent. Without too
much effort, at least one old P4-system was located that lacks _PPC.
2010-08-16 04:31:21 +00:00
jruoho
01066e7b7b Add comments and raise the minimum allowed T-state duty cycle to 10 %. 2010-08-15 08:53:19 +00:00
jruoho
46bba1f374 Properly deal with the previous FADT-issue. 2010-08-15 04:35:16 +00:00
jruoho
1084719e1b Simplify the FADT-based entry by "faking" (overriding) also the address. 2010-08-14 17:50:57 +00:00
jruoho
e04e55946a Do not accidentally write zeros to (PSTATE_CNT and CST_CNT) registers. 2010-08-14 17:27:34 +00:00
jruoho
e9a3c2e517 Check the cold-flag also in the notify handler. 2010-08-14 11:16:14 +00:00
jruoho
7aa250c707 Do not queue functions via sysmon_taskq(9) in the pmf(9) resume hooks.
There is a small and unlikely race when the drivers are loaded as modules;
suspend, resume, queue a function, and immediately unload the module.
2010-08-14 05:41:22 +00:00
jruoho
1f0e85dcbd Move the PIIX4-quirk to the MD file and disable T-states for PIIX4. 2010-08-14 05:13:20 +00:00
jruoho
1a6fcb7e2a Explicitly include <sys/evcnt.h>. 2010-08-13 19:51:54 +00:00
jruoho
25630fd34e Instead of packing structures that do not need to be __packed, remove two
CTASSERT(9) macros.  Fixes build failure on AMD64 noted by cegger@.
2010-08-13 19:48:25 +00:00
jruoho
3d52b10fd5 Remove some unnecessary locking. Mainly a leftover from previous revisions
where the dynamic maximum/minimum was used also when retrieving the current
state. The state-array itself changes only in C-states.
2010-08-13 18:44:24 +00:00
jruoho
6b9ff1079c Merge T-state a.k.a. throttling support for acpicpu(4).
Remarks:

  1.    Native instructions are supported only on Intel. Native support for
        other x86 vendors will be investigated. By assumption, AMD and others
        use the I/O based approach.

  2.    The existing code, INTEL_ONDEMAND_CLOCKMOD, must be disabled in
        order to use acpicpu(4). Otherwise fatal MSR races may occur.
        Unlike with P-states, no attempt is done to disable the existing
        implementation.

  3.    There is no rationale to export controls to user land.

  4.    Throttling is an artefact from the past. T-states will not be used for
        power management per se. For CPU frequency management, P-states are
        preferred in all circumstances. No noticeable additional power savings
        were observed in various experiments. When the system has been scaled
        to the highest (i.e. lowest power) P-state, it is preferable to move
        from C0 to deeper C-states than it is to actively throttle the CPU.

  5.    But T-states need to be implemented for passive cooling via acpitz(4).
        As specified by ACPI and Intel documents, these can be used as the
        last line of defence against critical thermal conditions. Support
        for this will be added later.
2010-08-13 16:21:50 +00:00
jruoho
c4e35077eb Three small things: (1) fix off by one, (2) protect the cached P-state
(required for interaction with T-states), and (3) use aprint_debug(9)
instead of the ACPI_DEBUG_PRINT(x) macro for the dynamic frequency changes
(for the time being, people need easier way to observe the dynamic changes).
2010-08-12 06:17:14 +00:00
jruoho
aa6fdddc15 Properly protect against garbage values. 2010-08-11 18:15:52 +00:00
jruoho
675dfd8bb3 Print the state information only once. The per-CPU information was quite
pointless as identical parameters are expected across processors.
2010-08-11 16:41:19 +00:00
jruoho
7a63961323 Check the 'sc->sc_cold' flag also in P-state code, and set this flag once
we start the detachment routine.
2010-08-11 16:22:18 +00:00
jruoho
33733d6120 Add a small additional check for the validity of the GAS register. 2010-08-11 13:02:59 +00:00
jruoho
0963b3f611 Use a define instead of a magic constant for the arbitrary P-state limit. 2010-08-11 11:48:21 +00:00
jruoho
7598fbdbbd Pretty printing. 2010-08-11 10:44:07 +00:00
gsutre
8e80a0a5b0 acpi_print_tree: print ACPI and PCI autoconf(9) device names.
ok jruoho@
2010-08-11 10:32:42 +00:00
jruoho
69855d87bf Fix xref in a comment. 2010-08-10 05:22:07 +00:00
jruoho
06ea2864c4 Add a XXX-comment as a TODO. From jmcneill@:
/*
         * XXX: The pci_find_device(9) function only deals with
         *      attached devices. Change this to use something like
         *      pci_device_foreach(), and implement it for IA-64.
         */
2010-08-10 04:38:06 +00:00
jruoho
afd0718108 Use evcnt(9) for the counters. 2010-08-10 02:42:05 +00:00
jruoho
c832263680 On systems where both the existing EST code and the one provided by ACPI are
functional, the previously loaded EST code may have used frequencies that
are not present in the BIOS. This will cause failures since acpicpu(4) will
treat these unknown frequencies as errors. "Fix" this by initializing the
cached P-state to P0, regardless of what the true state might be.
2010-08-09 15:56:45 +00:00
jruoho
af42249343 Remove a redundant function. 2010-08-09 13:41:38 +00:00
gsutre
474664a934 acpi_pcidev_scan: attach PCI information only to working devices.
ok jruoho@
2010-08-09 09:36:42 +00:00
jruoho
eb3ca71af1 Downgrade the currently supported maximum C-state to C1. There appears to be
timer-related interrupt issues also in C2. With C1 it is guaranteed that
acpicpu(4) will not cause any slowdowns due stalled local APIC timer.
2010-08-09 05:00:24 +00:00
jruoho
c72ee2046d When retrieving the current frequency, scan all available P-states.
Only use the dynamic maximum when setting a frequency.
2010-08-09 04:27:07 +00:00
jruoho
d4f0008ba0 jmcneill@: do not touch the bus_space(9) handle. 2010-08-08 18:47:54 +00:00
jruoho
337dd64961 Improve error and debug messages. 2010-08-08 18:25:06 +00:00
jruoho
5520795ab6 As per jmcneill@'s suggestion, improve error reporting. 2010-08-08 18:10:34 +00:00
jruoho
9f5abae832 Add P-states. (I blame the ease of using modules.) 2010-08-08 17:21:14 +00:00
jruoho
1e80cb5566 Remove bogus check and allow all CPUs to use I/O-based P-states. 2010-08-08 17:05:50 +00:00
jruoho
53e8f6c919 Merge P-state support for acpicpu(4).
Remarks:

  1.    All processors (x86 or not) for which the vendor has implemented
        ACPI I/O access routines are supported. Native instructions are
        currently supported only for Intel's "Enhanced Speedstep". Code for
        "PowerNow!" (AMD) will be merged later. Native support for VIA's
        "PowerSaver" will be investigated.

  2.    Backwards compatibility with existing userland code is maintained.
        Comparable to the case with cpu_idle(9), the ACPI CPU driver
        installs alternative functions for the existing sysctl(8) controls.
        The "native" behavior (if any) is restored upon detachment.

  3.    The dynamic nature of ACPI-provided P-states needs more investigation.
        The maximum frequency induced (but not forced) by the firmware may
        change dynamically. Currently, the sysctl(8) controls error out with
        a value larger than the dynamic maximum. The code itself does not
        however yet react to the notifications from the firmware by changing
        the frequencies in-place. Presumably the system administrator should
        be able to choose whether to use dynamic or static frequencies.
2010-08-08 16:58:41 +00:00
gsutre
110cd99be7 acpi_pcidev_scan: discard invalid PCI addresses. 2010-08-08 16:26:47 +00:00
jruoho
6745d5be67 Do not try to disable ACPI if we can not enter to legacy mode. While it is
safe to call AcpiDisable() even if a system operates only in ACPI mode, this
leads to unpleasantly verbose error messages in ACPICA.
2010-08-07 20:07:25 +00:00
jruoho
2146168c62 Allow to dump the basic information at runtime with a flag to modload(8).
This can help when dealing with problem reports, as the user does not need
to reboot nor compile a kernel. Instead: 'modload -b dump=true acpiverbose'.
2010-08-07 18:59:53 +00:00
jruoho
40f2c5cbe7 Fix build failure. 2010-08-07 17:12:55 +00:00
jruoho
3319c9a659 Dump MADT in ACPIVERBOSE. 2010-08-07 14:17:21 +00:00
jruoho
21753466cc Remove the last ACPI driver -specific #ifdef, ACPI_FDC_DEBUG. 2010-08-07 09:55:59 +00:00
jruoho
6e6e026403 Reorganize: also the APIC tables will be dumped in ACPIVERBOSE, and the
callback functions will be modified to be suitable also with other tables.
2010-08-07 09:41:19 +00:00
jruoho
77da05df17 Dump the whole FADT in ACPIVERBOSE. 2010-08-07 08:59:51 +00:00
jruoho
e1035e2b84 Simplify the acpiverbose module. 2010-08-06 23:38:34 +00:00
jruoho
460de0d614 Remove the acpiwmi(4) dump from the ACPIVERBOSE module. Instead of this
complex solution, just use aprint_debug(9) in the driver.
2010-08-06 22:45:00 +00:00
jruoho
2a35c4cf20 Fix prototypes; SYSCTLFN_ARGS -> SYSCTLFN_PROTO.
(These things really only obscure the code.)
2010-08-06 18:10:40 +00:00
jruoho
d8b9e18823 Store the MADT-derived CPU ID to <x86/cpu.h>. This is required to properly
match the ACPI processor object ID with the ID available in the APIC table.
2010-08-04 10:02:11 +00:00
jruoho
87a3551c76 On second thought, rename the mutex so it can be (logically) shared. We will
not need such granularity that different states would require a different lock.
2010-07-30 06:11:14 +00:00
jruoho
988469445d Add a per ACPI CPU mutex for C-states. Protect the _CST update with this:
when the idle-information is being updated (e.g. due acpiacad(4) events),
we can not enter the idle-loop. The lock must run at the same priority
(IPL_NONE) as ACPICA's mutexes obtained via AcpiOsCreateMutex() a.k.a.
AcpiOsCreateSemaphore(). Also check want_resched as the first thing and
clarify the suspend/resume path.

There is still one race condition identified: when the driver is loaded as a
module, we must gracefully kick all CPUs out from the ACPI idle-loop upon
detachment.
2010-07-29 22:42:58 +00:00
jruoho
2ef2de7924 Refactor to make this more readable. No functional change. 2010-07-29 11:03:09 +00:00
jruoho
a240caeadb Add "pnp0c14" to the list of HIDs. Required for LG X110. As valid EISA IDs
should be all upper case, leave this as a onetime quirk specific to acpiwmi(4).
2010-07-29 07:10:39 +00:00
jruoho
cc2aad5da2 Remove also the HIDs from previous. 2010-07-28 16:29:11 +00:00
jruoho
c1b6b639ac Remove the homegrown attempt to match the parent PCI bus. This was only used
for descriptive purposes, and for such purposes the ACPIVERBOSE output is
much better.
2010-07-28 16:26:56 +00:00
jruoho
0df7185e13 Remove leftovers from the aiboost(4) removal. 2010-07-28 16:02:33 +00:00
pgoyette
9e9cac1c34 Use __arraycount(). No functional change. 2010-07-27 15:16:16 +00:00
jruoho
1d37b0a731 Add a quirk for pgoyette@'s old (ACPI 1.0) NVIDIA board.
It was analyzed that this DSDT busy-loops some unknown PCI memory regions in
several places. Because the regions are apparently almost constant, this
causes several conditions where the interpreter might enter into an infinite
loop. Luckily ACPICA detects this and rightly spams AE_AML_INFINITE_LOOP
warnings.

Not much we can do. Declare as broken beyond repair. Set acpi_force_load=1
to use ACPI or use a custom DSDT.
2010-07-27 06:14:37 +00:00
jruoho
1392a1cea1 Move the GAS definition to the header so it can be shared. Make a basic
sanity check before casting to the GAS. Rename the _CSD structure; the
optional "cross logical processor dependency information" is almost
identical in C, P, and T states. Add some comments to the header.
2010-07-27 05:11:32 +00:00
jruoho
6ba3ba49aa Fix wrong return value. 2010-07-26 15:14:33 +00:00
jruoho
0ad9aaa477 Improve comments. Move the #ifdef around. 2010-07-25 17:44:01 +00:00
jruoho
fe682d3527 Add PNP0B01 and PNP0B02, both variants of the PC/AT RTC. From the spec. 2010-07-25 16:23:51 +00:00
pgoyette
1587dcc60f Move setting of acpi_verbose_loaded flag into the module's init routine.
This ensures that the flag is set even if the module was manually loaded
by the user rather than just auto-loaded.
2010-07-25 12:54:46 +00:00
jruoho
cc774b9046 Remove the currently unnecessary mutex. 2010-07-24 22:44:00 +00:00
jruoho
f534f13d87 Revert the previous partially for the time being. 2010-07-24 21:53:53 +00:00
jruoho
6f76995c42 Move ACPI_FLUSH_CPU_CACHE() (a.k.a. WBINVD on x86) to MD headers where it
belongs to. Let IA-64 define its own function/instruction instead of
requiring a dummy wbinvd() to satisfy the definition in a MI header.
2010-07-24 09:35:36 +00:00
jruoho
cb59d41daa Update and fix a typo. 2010-07-24 06:10:43 +00:00
jruoho
4127064077 Make sure we use MWAIT with MONITOR.
Also clarify when we have interrupts disabled.
2010-07-23 13:54:21 +00:00
jruoho
00ad9caa92 Add a new flag that determines whether we should check for bus master
activity (BM_STS) by reading from the PM1 register. According to the Intel
processor specification for ACPI, the FFH GAS encoding may provide a hint
that the check is not required. This may help some systems to enter C2/C3
even when e.g. usb(4) keeps the BM_STS bit always enabled.
2010-07-23 08:11:49 +00:00
jruoho
44091f0125 Remove the recently added ACPICPU_FLAG_INIT and instead operate with the
existing ACPICPU_FLAG_C, as was intended. Set that flag only after the
idle-loop has been installed, so that the notify handler errors out if an
interrupt is received before the idle-loop is in place.
2010-07-23 05:32:02 +00:00
pgoyette
aabfc9142c Even if there's an error in attaching the device (failure to find IRQ
resource, or I/O mapping), set-up a power management handler so we can
sleep later on.
2010-07-22 16:35:24 +00:00
cegger
d36c53b8ff ACPI enumerates cpus with 0..n.
Fixes panic reported by Patrick Welche on current-users@
Fixes panic on my own HP Pavilion laptop
2010-07-21 14:59:31 +00:00
jakllsch
fb6eaa4e58 correct an obvious typo: acpwmi -> acpiwmi 2010-07-19 18:22:53 +00:00
christos
515e411d3f XXX: If this is not correct, revert or fix.
This makes my laptop boot instead of panic:

panic: kernel diagnostic assertion "native_idle != NULL" failed: file "../../../../arch/x86/acpi/acpi_cpu_md.c", line 155
fatal breakpoint trap in supervisor mode
type 1 code 0 rip ffffffff8022e4ad cs 8 rflags 246 cr2  0 cpl 0 rsp ffff80004c37db10

trace
breakpoint() at netbsd:breakpoint+0x5
panic() at netbsd:panic+0x2ba
kern_assert() at netbsd:kern_assert+0x2d
acpicpu_md_idle_stop() at netbsd:acpicpu_md_idle_stop+0x62
acpicpu_cstate_callback() at netbsd:acpicpu_cstate_callback+0x34
sysmon_task_queue_thread() at netbsd:sysmon_task_queue_thread+0x41

1. ACPI seems to define cpuids 1..n; we define 0..n-1. Adjust for that
2. My laptop is dual core, but ACPI reports 4 cpu nodes. Instead of
   attaching the unmatched ones, make the match fail. Do we want to
   attach and do nothing instead?
3. Create a flag, and only set it after we are completely initialized,
   so the sysmon thread does not try to access unitialized state.
2010-07-19 00:59:32 +00:00
jruoho
097ffbd0d4 Fix build failure in i386/ALL. Again caused by a missing _COMPONENT
declaration required for ACPI_DEBUG. Noted by cegger@ -- thanks.
2010-07-18 20:20:04 +00:00
jruoho
441a667547 The first bug: do not error out if the latency values supplied in _CST are
larger than the upper limit constants. Only sanity check against these
defaults when operating with FADT. This is also noted in a fine print of the
specification (ACPI 4.0, p. 314): "[...] The worst-case latency to enter and
exit the C State (in microseconds). There are no latency restrictions."
2010-07-18 13:09:04 +00:00
jruoho
9fcb11c8f6 Add missing CVS identifiers. 2010-07-18 09:39:45 +00:00
jruoho
4d861e5bb4 Merge a driver for ACPI CPUs with basic support for processor power states,
also known as C-states. The code is modular and provides an easy way to add
the remaining functionality later (namely throttling and P-states).

Remarks:

  1.	Commented out in the GENERICs; more testing exposure is needed.

  2.	The C3-state is disabled for the time being because it turns off
	timers, among them the local APIC timer. This may not be universally
	true on all x86 processors; define ACPICPU_ENABLE_C3 to test.

  3.	The algorithm used to choose a power state may need tuning. When
	evaluating the appropriate state, the implementation uses the
	previous sleep time as an indicator. Additional hints would include
	for example the system load.

	Also bus master activity is evaluated when choosing a state. The
	usb(4) stack is notorious for such activity even when unused.
	Typically it must be disabled in order to reach the C3-state,
	but it may also prevent the use of C2.

  4.	While no extensive empirical measurements have been carried out, the
	power savings are somewhere between 1-2 W with C1 and C2, depending
	on the processor, firmware, and load. With C3 even up to 4 W can be
	saved.  The less something ticks, the more power is saved.

ok jmcneill@, joerg@, and discussed with various people.
2010-07-18 09:29:11 +00:00
jruoho
8c1a5f831d Shorten some of the descriptions. 2010-07-18 06:58:48 +00:00
gsutre
afdde45eb6 AcpiOsDerivePciId: make sure that we only update the PCI bus number,
and that we do so only if it was succesfully derived.

ok jruoho@, kochi@
2010-07-10 21:31:00 +00:00
jruoho
4d8f91f9bc Export also the delta function. 2010-07-10 19:37:38 +00:00
jruoho
bd772854cf Export the wrapper functions that read from the ACPI PM timer.
Needed for ACPI CPUs. Also KNF, cosmetics. No functional change.
2010-07-10 13:08:09 +00:00
jruoho
e9bd2598ab Remove PNP0C01 and PNP0C02 from the list of ignored HIDs (and CIDs).
Fixes PR kern/42937 from Ryo Onodera.

As acpi_match_hid() matches also "compatible IDs" (CIDs), we must be careful
when adding devices to this list. For example, the above PR revealed that
the following is a fairly typical way to define the HPET device:

   Device (HPET)
                 {
                     Name (_HID, EisaId ("PNP0103"))
                     Name (_CID, EisaId ("PNP0C01"))
				...

Arguably this is a BIOS bug, given that PNP0C01 and PNP0C02 should uniquely
identify a device (or a resource template) that has nothing to do with HPET.
2010-07-02 05:18:38 +00:00
jruoho
62a3a0659b Simplify a little by removing the redundant acpi_rescan1(). 2010-07-02 05:00:48 +00:00
jruoho
c3a9861b26 Add HPQ0004, the HP-branded device for the LIS3LV02DL-based accelerometers. 2010-07-01 14:18:26 +00:00
jruoho
9cb2ef6c20 Fix a carelessness bug introduced in the revision 1.17; acpi_power_get() now
takes a handle instead of node as a parameter. (The compiler did not catch
this as ACPI_HANDLE is a pointer to void.)
2010-07-01 09:28:37 +00:00
jruoho
ab05d95b29 Only aprint*() the battery information if the battery has changed. Based on
suggestion from mrg@. The used serial number is hopefully unique enough as
an identifier. Should fix PR kern/43505 by David Demelier.
2010-06-30 15:38:27 +00:00
jruoho
100be188a7 Initialize pointers to NULL. Otherwise we may try to free garbage.
Tries to address a panic reported by David Demelier in PR kern/43504.
2010-06-30 07:58:11 +00:00
jruoho
951577ebd1 Provide a sysctl-knob for the Debug() opcode, hw.acpi.debug.object. This
prints debug-messages possibly used in the AML. Only enabled for ACPI_DEBUG
kernels.
2010-06-30 07:42:36 +00:00
jruoho
e493401fef Regen. 2010-06-16 06:19:16 +00:00
jruoho
0ea654cd56 Add CSC0000, CSC0003, CSC0010. Observed from jnemeth@'s ThinkPad 380Z. 2010-06-16 06:17:48 +00:00
jruoho
4dc5d3cab8 A small nit from the spec: _PSW should be called after _PTS. Thus call the
wakedev routine after AcpiEnterSleepStatePrep(). Unlikely to make any
difference whatsoever, but there might always be a BIOS writer who disagrees.
2010-06-10 20:36:55 +00:00
mrg
0196355634 pci_chipset_tag_t is opaque - don't compare it to NULL, just use it.
shouldn't be a problem because "acpi_softc" variable isn't setup until
the "sc_pc" member is set.

fixes ia64 build.  tested on amd64.  ok jruoho.
2010-06-09 04:20:10 +00:00
jruoho
15a42e9f63 Only check the parent's power state if the parent has power management
capabilities. Based on a short DSDT survey, not all systems adhere to the
model noted in the comment.
2010-06-08 21:47:26 +00:00
jruoho
709c34f11d Fix a comment and some debug printing. 2010-06-08 18:38:18 +00:00
jruoho
fc9a58b32f Error out if we try to set power to a higher-power state than the parent's
state. This follows the "bus power state" -logic noted in the spec:

        bus: D1
                device A : D1 -> D0 -> error
                device B : D1 -> D2 -> success

                -> bus must remain in D1 due device A

Following this scheme, it is easy to derive the "bus power state" now that
we have the device nodes in a tree-like structure. If required, separate
acpi_power_get_bus() and acpi_power_set_bus() can be added in the future.
2010-06-08 18:18:24 +00:00
jruoho
64f353c42a Add PNP0C33, "a hardware error device". Part of APEI. 2010-06-08 17:04:49 +00:00
jruoho
c51a135130 Add and organize some comments. Add also ACPI_DEVICE_EJECT constant to
indicate "ejectable" devices such as docking stations.
2010-06-08 16:55:02 +00:00
jruoho
5f7d603c37 Use the same notation with the PNP identifiers. Specifically note that
PNP0C80 is the device that is required for memory hot-plug on x86.
2010-06-08 16:49:53 +00:00
jruoho
2052593844 Now that we have 1:1 mapping between handles and nodes, use the former for
all power resource operations. Eliminates the wrapper functions.
2010-06-07 17:28:17 +00:00
jruoho
5e449c623c Use the new ACPICA functions AcpiAttachData() and AcpiGetData() to associate
all "struct acpi_devnodes" to their corresponding ACPI_HANDLEs. Anywhere in
the acpi(4) subtree, the node-structure can be obtained from a handle via
acpi_get_node(). The idea is similar to e.g. device_private().

Benefits: (a) simplifies code, (b) avoids issues with locking as ACPICA does
the serialization for us, (c) avoids the need to access the glocal softc, and
(d) avoids the O(n) loop required to search for a handle from the node queue.
2010-06-07 17:13:52 +00:00
jruoho
2da098d0fd Fix a bug: the last elements in the _PRW package are direct references to
power resources, not devices. Thus, we can not use the function that sets
the power state of a device.
2010-06-07 14:12:20 +00:00
jruoho
9c09c7fc2c Refactor slightly: we need to expose the function that turns individual
power resource on or off.
2010-06-07 14:07:25 +00:00
jruoho
4333086998 Build the power resource queue dynamically. This eliminates the need to call
acpi_power_res_add() in the main scan function, also saving few bytes of
memory.
2010-06-07 13:04:31 +00:00
jruoho
c751d2d518 Instead of disabling all GPEs for non-wakedevs, set both runtime and wake
GPEs, but unset only wake GPEs. The old behavior was questionable, as the
intention was only to disable a device's ability to wake the system.
Maintaining the runtime GPE generation is more important now as ACPICA
supports sharing a single GPE across multiple devices.

Discussed with jmcneill@.
2010-06-07 04:08:26 +00:00
pgoyette
9f0fa4d25b Update acpiverbose module to use module_autoload() rather than module_load().
Load the module right before each attempt to use its features, and let the
module subsystem handle unloading.
2010-06-07 01:45:27 +00:00
jruoho
d02842f45a We can no longer explicitly clear a GPE by calling AcpiClearGpe() in the
interrupt handler. However, all edge-triggered GPEs should already be
cleared before our GPE handler has a chance to run.

The reason can be found from the changes in the locking primitives of
ACPICA. All GPE operations now use a spin mutex on AcpiGbl_GpeLock, acquired
via AcpiOsAcquireLock(). This same lock is now acquired unconditionally in
the AcpiClearGpe() function. This causes a deadlock of the following form:

  ...

  AcpiEvGpeDetect() : acquire AcpiGbl_GpeLock;

 	  -> AcpiEvGpeDispatch();

		  -> acpiec_gpe_handler();

			  -> AcpiClearGpe() : acquire AcpiGbl_GpeLock;

			 	  -> panic.
2010-06-06 18:56:10 +00:00
jruoho
4563fc3267 ACPICA 20100331:
Completed a major update for the GPE support in order to improve
	support for shared GPEs and to simplify both host OS and ACPICA
	code. Added a reference count mechanism to support shared GPEs that
	require multiple device drivers.  Several external interfaces have
	changed. One external interface has been removed. One new external
	interface was added. Most of the GPE external interfaces now use the
	GPE spinlock instead of the events mutex (and the Flags parameter
	for many GPE interfaces has been removed.) See the updated ACPICA
	Programmer Reference for details. Matthew Garrett, Bob Moore, Rafael
	Wysocki. ACPICA BZ 831.

	Changed:
	    AcpiEnableGpe, AcpiDisableGpe, AcpiClearGpe, AcpiGetGpeStatus
	Removed:
	    AcpiSetGpeType
	New:
	    AcpiSetGpe
2010-06-06 18:40:51 +00:00
jruoho
03fcc3422b Although sysmon_pswitch_unregister(9) does not currently do anything, in
order to be ready for possible future API changes, call it if we failed to
install the fixed event handlers. Also small ACPI_DEBUG_PRINT clarifications.
2010-06-06 10:44:40 +00:00
jruoho
7b26e5d94f Remove also the debug-printf in case of long Stall() requests;
/*
	* sleep(9) isn't safe because AcpiOsStall may be called
	* with interrupt-disabled. (eg. by AcpiEnterSleepState)
	* we should watch out for long stall requests.
	*/

ACPICA has long printed a similar warning by itself. Moreover, this message
was never reached as the interpreter does not invoke AcpiOsStall() when a
delay longer than 255 usec is requested.
2010-06-05 16:57:48 +00:00
jruoho
3aca70d9a2 Remove the recently added warning about long Sleep() requests.
This is now in ACPICA (20100528):

	Added support to limit the maximum time for the ASL Sleep()
	operator. To prevent accidental deep sleeps, limit the maximum time
	that Sleep() will actually sleep. Configurable, the default maximum
	is two seconds. ACPICA bugzilla 854.
2010-06-05 16:47:49 +00:00
jruoho
e42cf0f8ae Switch the third argument to the _DSW method from 3 to 0. This means that
devices should be placed in the D0 state ("fully on") after resume. We were
not prepared to handle the previous value as it implied that devices could
be placed in an arbitrary power state once in S0.

Minimal functional change, given that the _DSW is seldom seen in the field.
2010-06-05 15:47:59 +00:00
jruoho
1bfe5139f3 Complete the support for wakeup devices. As imposed by the standard, all
power resources should be turned on for wakeup devices. This follows common
sense: a device cannot wake if the power of it is turned off.

ok jmcneill@
2010-06-05 15:31:21 +00:00
jruoho
8e7819f753 Convert an aprint_error_dev() to ACPI_DEBUG_PRINT in acpi_power_set().
This "fixes" the issue observed by dyoung@. Since the AML may not keep any
state by itself, it is possible that the firmware tries to continuously put
a device into a power state where the device already is (e.g. D3 -> D3).

XXX: The code (like the old power resource code) rests on the assumption
     that it is possible to reliably obtain the power state of a device
     either directly via _PSC or indirectly via _STA. However, because there
     is some evidence that few broken systems implement these methods
     incorrectly (e.g. always returns D0 as a constant, even if the state
     would be D3 in reality), we may need to revisit this by always setting
     the power state, even if it is impossible to get the power state.
2010-06-05 07:59:13 +00:00
jruoho
1f4ce9efc5 Remove trailing white space. 2010-06-05 06:07:12 +00:00
plunky
6d4cc93fdf adjust autoconfig output: this item is part of a verbose line 2010-06-01 19:20:43 +00:00
pgoyette
6c40070d66 Extract ACPIVERBOSE into a kernel module. The module can be builtin
by defining 'options ACPIVERBOSE' in the kernel config file (no change
from current behavior), or it can be loaded at boot time on those
architectures that support the boot loader's "load" command.

ACPIVERBOSE also includes code to dump acpi/wmi data.
2010-05-31 20:32:28 +00:00
jruoho
5b0c19905b Silently return if a power state transition is requested for a device that
has no support for it. For example, in Kurt Schreiner's Shuttle G61:

        Device (FAN)
        {
            Name (_HID, EisaId ("PNP0C0B"))
            Method (_INI, 0, NotSerialized)
            {
                Store (TP1H, CTOS)
                Store (TP1L, CTHY)
            }
        }

Obviously acpitz(4) has little use for a device that only contains _INI.
(The handle of this device is referenced incorrectly in _AL0.)
2010-05-31 20:10:56 +00:00
plunky
31555cd112 fix up autoconfig output 2010-05-31 17:41:24 +00:00
jruoho
46e95075aa Regen. 2010-05-26 09:48:26 +00:00
jruoho
0f7795c449 Split the IrDA devices to their own section. Add HWPC224 and IBM0071,
both for the PC8738x-family of SuperIO chips from NSC (or Winbond).
2010-05-26 09:47:17 +00:00