Commit Graph

1314 Commits

Author SHA1 Message Date
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
christos
208ad48907 no need for double the newlines! 2010-05-23 22:05:54 +00:00
jruoho
2731b5ff2f Print a warning if AcpiOsSleep() is called with a value larger than two
seconds. It is known that there are systems in the field that pass bogus AML
values to the Sleep() operation code, possibly requesting delays that could
be measured in days.

Discussed with jmcneill@.

XXX: While the used mstohz(9) is documented to round to one second if the
     passed value is larger than 131072 ms, we may still need to force a
     sensible upper limit if this warning starts to appear.
2010-05-12 17:03:11 +00:00
jruoho
881c3c1e3f When scanning the device "capabilities" (power, wake-up, etc.),
include all device nodes, regardless of the status of the device.

XXX: It is known that some systems implement the _STA method incorrectly.
     If needed in the future, attachment based on the values from this
     method may need revisiting. Same goes for ACPI_ACTIVATE_DEV.
2010-05-12 16:11:05 +00:00
jruoho
a24d118616 Initial pass for issues observed by dyoung@ on HP Pavilion N3270. In this
laptop there is a PNP0C0B ("ACPI fan") with the following properties:

        _PSC : Power state for D3 (alone).
        _PR0 : Power resources for D0.
        _PSx : Power state switch for D0 and D3.

Thus, it is impossible to get or set the D3 power state via power resources
alone; there is only a single PowerResource() and it is for D0.

To tackle this:

  1. Evaluate the direct _PSC control method if and only if there is no
     given _PRx. The order is important; it is known that some other
     systems implement the _PSC method (like _STA) incorrectly.

  2. If no _PRx is available (and thus no _ON or _OFF), do not error out.
     Instead, if we have AE_NOT_FOUND, continue to evaluate the power state
     switch method, _PSx, which (on this laptop) should alone suffice for
     the D0 -> D3 transition.
2010-05-12 15:59:52 +00:00
jruoho
7600ada264 Add ASUS CUV4X-D. From Pierre Pronchery in PR #41351. 2010-04-28 17:52:17 +00:00
jruoho
20524a61c1 Include the new prototype for acpi_enter_sleep_state(). 2010-04-27 08:37:07 +00:00
jruoho
cd8924253f Make acpi_enter_sleep_state() not to return. No one cared what it returned. 2010-04-27 08:36:06 +00:00
jruoho
e7c1114893 Be consistent with the returned exception codes. Check for NULL pointers. 2010-04-27 08:15:07 +00:00
jruoho
f04ee53053 Use ACPICA's standard notify values from <actypes.h> and move the
device-specific notify constants to the device-specific files.
2010-04-27 05:57:43 +00:00
jruoho
d5124a1812 Clean up <dev/acpi/acpireg.h>. While documenting the control methods is an
admirable goal, it is pretty much mission impossible; the specifications are
nearly thousand pages each and the amount of methods is counted in hundreds.

In addition, use ACPICA's native constants from <actypes.h> when possible.
Also move ACPI_STA_OK from "mpacpi.c" to <dev/acpi/acpireg.h> to simplify
the evaluation of device status.
2010-04-27 05:34:14 +00:00
jruoho
f655bf2ab4 Fix typo. Doh. 2010-04-26 13:38:42 +00:00
jruoho
727f1f57e9 Improve and rearrange comments. 2010-04-26 13:30:31 +00:00
jruoho
696f7c4b2e AE_CTRL_TERMINATE -> AE_CTRL_FALSE. 2010-04-26 12:46:48 +00:00
jruoho
a0542f149f Move the ACPIVERBOSE blocks to a single place.
Also print non-devices in the EISAID/HID/UID/ADR-block
2010-04-26 04:31:09 +00:00
jruoho
ccaec16d65 Return instead of breaking out if the sleep state is not available. 2010-04-25 17:06:23 +00:00
jruoho
902b38408b As noted by jmcneill@, the specifications specifically mention that the _TTS
should be invoked before the system has notified any native mode device
drivers. Thus, do the call before pmf_system_suspend(9).
2010-04-25 17:03:08 +00:00
jruoho
61a52d7657 Evaluate _TTS on sleep state transitions. This is mainly to pro-actively
support some weird BIOS, which may require the evaluation. Ok jmcneill@.
2010-04-25 10:05:22 +00:00
jruoho
0c1ea6e257 Add a note about AcpiEnterSleepStatePrep(). 2010-04-25 09:12:38 +00:00
jruoho
2e3ac7f8ad Embarrassing typos: _PI_ -> _SI_, _PB_ -> _SB_. 2010-04-24 19:51:15 +00:00
jruoho
a84baa0293 Do not use __func__ with ACPI_DEBUG_PRINT (it already adds it). 2010-04-24 19:36:14 +00:00
jruoho
80e5813055 Remove retrieving the zone name via something called "REGN".
We really should not add code that aims to satisfy some oddball firmware,
not in the generic drivers that aim to comply with the specifications.
In the long-term this is even worse than quirk tables.
2010-04-24 19:16:10 +00:00
jruoho
ac93d6907f Some purely cosmetic editing in the name of readability: clean up the softc
and remove unused variables therein, remove unused constants, use
ACPI_DEBUG_PRINT, add more detailed comments, et cetera.
2010-04-24 19:11:48 +00:00
jruoho
2203417f01 Fix a bug involving acpitz(4) accidentally attaching to the _TZ_ scope.
This in turn was caused by a bug in ACPICA, which reports the types of _SB_
and _TZ_ scopes incorrectly for its own internal reasons (utglobal.c):

  /*
   * Predefined ACPI Names (Built-in to the Interpreter)
   *
   * NOTES:
   * 1) _SB_ is defined to be a device to allow \_SB_._INI to be run
   *    during the initialization sequence.
   * 2) _TZ_ is defined to be a thermal zone in order to allow ASL code to
   *    perform a Notify() operation on it.
   */

Thanks to cegger@ for noticing the bug and testing a fix.
2010-04-24 13:42:18 +00:00
jruoho
83caa2c18b Add utility function acpi_get_node().
This retrieves a struct acpi_devnode from a handle. Since this requires
accessing the global softc, it is better to do it in one place alone. The
same goes for possible locking of the node-queue; it is better not to
publicize such a lock for generic device drivers.
2010-04-24 06:57:10 +00:00
jruoho
1b81a62b62 Now that we are able to remove references to power resources, provide a
detachment routine for acpitz(4). Add comments explaining the relationship
between power resources and active cooling. Also some improvements to code
readability.
2010-04-24 06:31:44 +00:00
jruoho
ba4f1cd0dd Forgot that the firmware may change the power state behind our back,
so actively query the state when the sysctl(8) is invoked.
2010-04-23 19:00:58 +00:00
jruoho
16bdc3ff0f Add hw.acpi.power sysctl-node. 2010-04-23 18:51:31 +00:00
jruoho
f6ac0eab50 One malloc(9) type is enough for ACPI; use M_ACPI. 2010-04-23 15:52:26 +00:00
jruoho
84377acda5 Simplify acpi_pcidev_find(): directly return a pointer to the device node. 2010-04-23 15:46:59 +00:00
jruoho
f7be22cf8e Cosmetics: be pedantic and use AE_CTRL_TERMINATE instead of AE_ABORT_METHOD
as a condition to break out of a loop.
2010-04-23 15:37:01 +00:00
jruoho
7e3b451fbe When setting the power, always mark the state as invalid on failure, even if
going to D0. Also fix a potential NULL pointer dereference in an aprint_().
2010-04-23 15:20:35 +00:00
jruoho
bccc1bf1aa Make the ACPIVERBOSE output even prettier by removing cruft. 2010-04-23 07:04:18 +00:00
jruoho
bdb6986f24 Some pretty printing for ACPIVERBOSE. 2010-04-22 21:58:08 +00:00
jruoho
6772f0e062 Remove a redundant prototype. A leftover from the previous commit. 2010-04-22 18:53:23 +00:00
jruoho
9ddf2c5165 Merge new code for ACPI power resources.
The old code served us well, but a major overhaul would have been needed for
it to cope with the increased demands of the code -- and the specifications.

ok jmcneill@, pgoyette@
2010-04-22 18:40:09 +00:00
jruoho
e0aec4e102 Wrap long lines, add some white space for readability, remove unnecessary
variable assignments, misc KNF. No functional change.
2010-04-22 15:25:46 +00:00
jruoho
1af445da2a Shorten the long lines with two custom macros. 2010-04-22 15:14:24 +00:00
jruoho
b3ff23fb49 From Gregoire Sutre: rework the ACPI PCI support. This makes ACPI to
correctly pick PCI segment groups, PCI bus numbers, PCI root bridges,
PCI-to-PCI bridges, and PCI devices, among other things. In short: it is
more robust than the old code or anything in sys/arch/x86/x86/mpacpi.c.

ok cegger@, jmcneill@
2010-04-22 14:50:30 +00:00
jruoho
54e937894d Remove the block where the default address space handlers were manually
installed via AcpiInstallAddressSpaceHandler(). This was already commented
out because ACPICA does this for us when ACPI_NO_ADDRESS_SPACE_INIT is not
specified when calling AcpiEnableSubsystem().
2010-04-20 04:57:04 +00:00
jruoho
b9961a4e19 Instruct ACPICA to dynamically allocate the table descriptions in
AcpiInitializeTables() instead of pushing 128 statically allocated
descriptors. This will eliminate also the need to call
AcpiReallocateRootTable().

The rationale for the statically allocated table descriptors is to allow
initialization without virtual/dynamic memory. Later these should be copied
to dynamic memory via AcpiReallocateRootTable(). But since in NetBSD both
functions were called in the very same acpi_probe(), this dance was
completely unnecessary.
2010-04-20 04:53:22 +00:00
jruoho
92024a35be Remove a duplicate variable assignment. 2010-04-18 14:07:16 +00:00
jruoho
0c6bf9beea From Gregoire Sutre:
Modify the main ACPI namespace scan by including a parent-child
  relationship for each node. The result is a bi-directional tree.

ok jmcneill@
2010-04-18 14:05:26 +00:00
jruoho
0b7093053e Regen. 2010-04-18 10:22:33 +00:00
jruoho
2e422aa6a6 Add ATM1200. From ThinkPad X60s. 2010-04-18 10:22:01 +00:00
christos
b62024a026 fix dmesg printing. 2010-04-16 01:52:54 +00:00
jruoho
55052eca77 As discussed with jmcneill@, install a global "bus notification handler"
that receives all notifications and deliver notifications to drivers via it.
2010-04-15 07:02:24 +00:00
jruoho
d6afaa4439 Arrange some comments. 2010-04-15 04:03:38 +00:00
jruoho
603f4c71f0 Simplify the setting of the GPEs. Add a debug-printf. 2010-04-14 20:08:56 +00:00
jruoho
fb53d8ceed No need to spread the ACPICA type system any more than is necessary:
UINT8 -> uint8_t and UINT32 -> uint32_t.
2010-04-14 19:27:28 +00:00
jruoho
06a5faf4f3 Simplify error reporting, remove casts, KNF. 2010-04-14 18:39:56 +00:00
jruoho
8a96e47761 Remove the code that was copy-pasted to acpi_detach() from the attachment
routine. Add a note that the detachment is incomplete.
2010-04-14 17:20:19 +00:00
jruoho
e77002a163 Remove the #if 0'ed acpi_disable(). 2010-04-14 17:14:45 +00:00
jruoho
0c88d0e418 Reorganize the main file: add several missing prototypes, move the functions
around so that they appear in their logical order and place, etc. In
addition, split the utility functions to a separate file.

No functional change. Ok jmcneill@.
2010-04-14 17:12:14 +00:00
jruoho
426356f9b2 Refactor the fixed-event handlers.
Also provide a detachment routine for these and fix a trivial bug;
a wrong structure was used when registering a sysmon_pswitch(9) switch.
2010-04-14 06:10:32 +00:00
jruoho
f54d696d12 Scan the namespace from the root object instead of scanning from separate
scopes. Also raise the namespace walk from 100 (per scope) to UINT32_MAX.

ok jmcneill@
2010-04-12 18:59:08 +00:00
jruoho
fb74e5b5e9 Remove some unused and global variables. Make the code more readable. Deny
invalid writes to machdep.sleep_state. Cosmetics. No functional change.
2010-04-12 18:55:27 +00:00
jruoho
42105e9f81 Rework the sysctl-support.
Changes:

	hw.wake			->	hw.acpi.wake
	hw.acpi.debug_layer	->	hw.acpi.debug.layer
	hw.acpi.debug_level	->	hw.acpi.debug.level

Additions:

	hw.acpi.stat.gpe	# Number of dispatched GPEs
	hw.acpi.stat.sci	# Number of SCI interrupts
	hw.acpi.stat.fixed	# Number of fixed events
	hw.acpi.stat.method	# Number of executed methods

ok jmcneill@
2010-04-12 12:14:26 +00:00
skrll
ea3fb23f81 Spello in comment. 2010-04-12 06:56:19 +00:00
jakllsch
e1ec199332 Add valz(4), a simple driver to handle the backlight keys on some
Toshiba laptops.  As of yet only tested on a Satellite A135-S4527.
2010-04-11 22:42:30 +00:00
jruoho
1863635681 Document "how-to override the DSDT" in the manual page instead of code. 2010-04-11 08:58:43 +00:00
jruoho
403b8820f1 Remove unnecessary casts. 2010-04-10 18:32:13 +00:00
jruoho
039f34b662 Move vald(4) to sys/dev/acpi. This is MI and should work also on amd64.
ok jmcneill@

XXX:    This is broken: it calls methods with absolute pathnames (almost
        guaranteed not to be portable across models), it accesses methods
        that are in the domain of other drivers, it walks the namespace on
        its own, it contains plenty of magic constants, it does not
        integrate with existing KPIs, etc. Summa summarum: this should be
        rewritten as a more generic toshiba_acpi(4).
2010-04-10 17:55:24 +00:00
jruoho
a0fefff3ae Add NSC1100. From ThinkPad T43p. 2010-04-10 16:45:51 +00:00
jruoho
2caf94afd1 Update a comment. 2010-04-10 06:56:30 +00:00
jruoho
cbd7048dde Regen 2010-04-10 06:10:13 +00:00
jruoho
1ad22d8495 Add ITE8708. From Dell Studio XPS 16. 2010-04-10 06:09:24 +00:00
jruoho
86fe3bdd61 Regen. 2010-04-09 16:33:06 +00:00
jruoho
ac1d74b59d Add SYN013B. Observed from the dmesg of cegger@'s HP Pavilion dv9700. 2010-04-09 16:32:17 +00:00
jruoho
468cbba563 Use ACPI_DEBUG_PRINT instead of a local DPRINTF. 2010-04-09 15:45:59 +00:00
jruoho
a57241d4f0 Fix a potential NULL pointer dereference. 2010-04-09 04:48:23 +00:00
jruoho
5a858cc492 Add WMI mappings for HP laptops. Requested by cegger@.
Thanks to apb@ and cegger@ for initial testing.

XXX: This conflicts with hpqlb(4). Someone with the suitable hardware needs
     to complete the list of hotkeys before -- and if -- this can replace
     hpqlb(4). For now, the driver was left uncommented in the GENERICs.
2010-04-08 17:32:30 +00:00
jruoho
7a8e952232 Semantics. 2010-04-08 12:36:21 +00:00
jruoho
a913ee750d Move acpiwmi(4) to the "sys/dev/acpi/wmi" -subdirectory. 2010-04-08 12:14:19 +00:00
jruoho
ab88ce45ea Add a dummy acpi_wmi_event_deregister() to match existing conventions. 2010-04-08 10:33:13 +00:00
jruoho
d49fb742ce Include 'files.wmi'. 2010-04-08 09:36:03 +00:00
jruoho
d97f534eb9 Add WMI mappings for Dell laptops. Requested and tested by mrg@. 2010-04-08 09:35:15 +00:00
jruoho
230c5ee4c7 ACPICA 20091112:
Implemented a post-order callback to AcpiWalkNamespace. The existing
        interface only has a pre-order callback. This change adds an
        additional parameter for a post-order callback which will be more
        useful for bus scans.  ACPICA BZ 779. Lin Ming. Updated the ACPICA
        Programmer Reference.

We will use the old "pre-order callback" for the time being.
2010-04-08 04:40:51 +00:00
jruoho
7fe08819d5 Update the limits when a change from absent to present is detected. 2010-04-03 16:29:22 +00:00
dyoung
0841103645 Attach acpiecdt with acpibus_attach_args. Sverre Froyen reports that
this helps his Thinkpad boot again.
2010-03-29 16:35:59 +00:00
pgoyette
0a999d0c06 Update acpiapm_get_powstat() to adjust for the recent changes to
acpi_bat(4).  (The warn_cap and low_cap sensors were removed, and the
values are now stored as the alarm limits of the charge sensor.)
2010-03-28 13:11:23 +00:00
pooka
54be9a9f62 Catch up with cosmetic changes to output from config(1) 2010-03-26 15:51:55 +00:00
pooka
929e108067 Convert to config_init/fini_component.
tested by jruoho
2010-03-26 05:59:26 +00:00
pgoyette
0c7008e9c3 Set the SME_INIT_REFRESH flag so that the sensors' values (including
charge's max_value) are available when the event monitors are created.
2010-03-24 12:18:54 +00:00
pgoyette
c998024539 Only set the APM_BATT_FLAG_NO_SYSTEM_BATTERY if _all_ batteries are
not_present.
2010-03-24 01:45:37 +00:00
dyoung
f52f7d91ef Do not use unitialized bus_space_tag_t's. Use the tag(s) from the
attachment arguments.
2010-03-24 01:13:30 +00:00
jruoho
dfc3a8d66a Fix the previous commit properly: we need to set all sensor-flags during the
initialization of sysmon_envsys(9), otherwise, if _STA does not return true
during the attachment of the driver, it is possible that a flag is never
set. This flaw has always been present, but it only got exposed after the
conversion to use the sysmon-limits.
2010-03-22 15:08:35 +00:00
jruoho
998dd58875 Regen. 2010-03-22 11:16:02 +00:00
jruoho
0a2027602e Add IFX0102 and PNP0C15. Fix INT0800.
Observed from the dmesg of njoly@'s Sony VAIO VGN-BZ12VN.
2010-03-22 11:13:23 +00:00
jruoho
72763cb4e7 Set the capacity flags already in the acpibat_get_info(),
instead of acpibat_get_status().
2010-03-22 09:31:24 +00:00
pooka
f3beefdb45 Convert acpibat to use ioconf instead of homerolled config glue.
Note, config whines about things like:
files.acpi:30: attaching undefined device `apm'

I intentionally was a lazy boy and didn't include a ton of dirt to
keep the hot napalm and riot blasts in the config thread rolling ;)

tested by jruoho (thanks!)
2010-03-21 07:09:56 +00:00
cnst
deaf16ef51 Remove aiboost(4) as obsolete and redundant since the introduction of aibs(4).
http://mail-index.netbsd.org/tech-kern/2010/03/06/msg007458.html

Reviewed by <pgoyette>, <cegger>, <jruoho>, <tech-kern>.
2010-03-19 04:04:27 +00:00
jruoho
2786f7261b Silence errors from the integer evaluations in case the objects are not found.
(This was too verbose even for ACPI_DEBUG.) Also fit the status messages to
one line during boot by using aprint_verbose() for extra information.
2010-03-17 20:29:32 +00:00
jruoho
ef2b6dd20b Print also the so-called "granularity" values when the _BIF is evaluated.
These refer to the smallest increment in capacity that the battery is
capable of measuring.
2010-03-17 11:07:59 +00:00
jruoho
dce0020d0c Remove the technology "sensor" (a fixed constant). Report this information
in an improved output when the battery information changes (i.e. device
attachment or battery removal/insertion).
2010-03-17 09:21:50 +00:00
jruoho
febc76c6be Remove the timer-based check in the sensor refresh routine. We henceforth
trust that the sysmon_envsys(9)'s polling is functioning properly. Discussed
with drochner@, jmcneill@, and pgoyette@.
2010-03-17 08:07:27 +00:00
jruoho
88e4bfe590 Fix the testing of temporarily unknown values. 2010-03-17 07:48:18 +00:00
jruoho
73b3b3d393 Move the low and warning capacity sensors to the limits framework provided
by sysmon_envsys(9).
2010-03-17 07:40:34 +00:00
jruoho
b32f00af46 Remove the call to AcpiGetType() in acpi_make_devnode(). This is the same
information as ACPI_DEVICE_INFO::Type, obtained later by AcpiGetObjectInfo().
2010-03-16 08:02:01 +00:00
jruoho
dd980e2a52 Remove unused headers. 2010-03-16 07:18:55 +00:00
jruoho
881fa5618a With the intent of making 'struct acpi_devnode' as the central place for
information related to ACPI device nodes: (a) introduce a generic scan
function for ACPI device driver "capabilities", and (b) eliminate local data
structures from ACPI wake-devices. Discussed with jmcneill@.
2010-03-16 05:48:42 +00:00