is discharging; it might make sense when charging, but it doesn't
make sense if neither is the case -- remove a wrong assertion and
arrange the code to make this obvious
(actually, the ACPI spec says that the requirement is only for
rechargeable batteries)
* Remove ACPI_BAT_DEBUG.
* Reduce the amount of error reporting.
* Remove the internal bookkeeping flags.
* Remove the debugging functions used to print status and information
changes. This information is fully conveyed in the output of envstat(8).
* Always evaluate _STA. If it fails or the battery is not present, mark
all remaining sensors as invalid. This will eliminate the convoluted
update routine.
* Semantics.
Over 200 LOC was eliminated, but functional change should again be minimal.
ok jmcneill@, pgoyette@
* Provide proper definitions and use these.
* Clarify the evaluation of _STA.
* Mark the state of a sensor according to the return value from _STA.
* Share the basic object evaluation in _BIF and _BST.
* Verify the object types before using the objects.
* Be aware of bogus values from _BIF and _BST, as noted in the
specification.
Despite of the list, functional change should be minimal. Ok pgoyette@.
- Provide the module declaration and use ACPI_FREE
as well as ACPI_ALLOCATE_LOCAL_BUFFER for ACPI_DEBUG.
- Maintain the calling conventions of existing ACPI utility
functions by initializing the output buffer for the caller
in all applicable functions.
- Remove superfluous const correctness. Additional semantics:
u_char -> char, u_int16_t -> uint16_t, and u_int64_t -> uint64_t.
- Collect the validation of input parameters to a single function.
ok pgoyette@
Multiple WMI mapper devices are supported, but each one can have only one
child device.
All exposed functions now require the parent mapper device as a parameter.
ok pgoyette@, jmcneill@
device's active cooling levels prevents the user from overriding these
limits with his own values.
XXX We should probably also change setting SCRITOVER state to SCRITICAL,
XXX but right now that just confuses things. We currently don't have a
XXX way for a sensor to be both SCRITICAL and SCRITOVER.
should store the value in the correct location. We're already setting
the correct flag bit.
Should resolve problem reported by Frank Wille on current-users...
HP Pavillion dv9700 laptop features a fan sensor
in the ACPI Thermal Zone which is beyond of the ACPI
Spec.
envstat shows
[acpitz0]
Processor Thermal Zone: 56.000 95.000 degC
FAN: 2840 RPM
envstat -W shows the limits
[acpitz0]
Processor Thermal Zone: 55.000 degC
FAN: 2570 4500 2000 RPM
Patch presented on tech-kern@.
No comments.
- Remove redundant assertions.
- Properly check for NULL pointers.
- No real need to keep track whether the internal event handler is installed.
- Add a missing function to pass possible extra information associated with
an event. Mentioned in the specification.
Import acpiwmi(4) from Jukka Ruohonen. From the PR:
Attached is a driver that implements ACPI WMI API:
http://www.microsoft.com/whdc/system/pnppwr/wmi/wmi-acpi.mspx
The WMI is used to provide a generic interface for OEMs to use certain
platform/laptop-specific additions to the standard ACPI in a somewhat
portable way. These can be hotkeys for additional buttons, different event
handlers (wireless kill switch, lid switch, etc.), and so on. At least HP
and Acer use it by default nowadays.
The benefit of this interface would be portability. For an example, instead
of hpqlb(4) that works only with certain HP models, we could have a generic
HP WMI-driver that should work in theory across all HP laptops. On many new
laptops WMI may also be the only way to access laptop/manufacturer-specific
features.
Workaround for firmware that doesn't report battery present status
immediately at boot and doesn't issue a subsequent notify when the
information becomes available.
and make suspension by self, by drvctl(8), and by ACPI system sleep
play nice together. Start solidifying some temporary API changes.
1. Extract a new header file, <sys/device_if.h>, from <sys/device.h> and
#include it from <sys/pmf.h> instead of <sys/device.h> to break the
circular dependency between <sys/device.h> and <sys/pmf.h>.
2. Introduce pmf_qual_t, an aggregate of qualifications on a PMF
suspend/resume call. Start to replace instances of PMF_FN_PROTO,
PMF_FN_ARGS, et cetera, with a pmf_qual_t.
3. Introduce the notion of a "suspensor," an entity that holds a
device in suspension. More than one suspensor may hold a device
at once. A device stays suspended as long as at least one
suspensor holds it. A device resumes when the last suspensor
releases it.
Currently, the kernel defines three suspensors,
3a the system-suspensor: for system suspension, initiated
by 'sysctl -w machdep.sleep_state=3', by lid closure, by
power-button press, et cetera,
3b the drvctl-suspensor: for device suspension by /dev/drvctl
ioctl, e.g., drvctl -S sip0.
3c the system self-suspensor: for device drivers that suspend
themselves and their children. Several drivers for network
interfaces put the network device to sleep while it is not
administratively up, that is, after the kernel calls if_stop(,
1). The self-suspensor should not be used directly. See
the description of suspensor delegates, below.
A suspensor can have one or more "delegates". A suspensor can
release devices that its delegates hold suspended. Right now,
only the system self-suspensor has delegates. For each device
that a self-suspending driver attaches, it creates the device's
self-suspensor, a delegate of the system self-suspensor.
Suspensors stop a system-wide suspend/resume cycle from waking
devices that the operator put to sleep with drvctl before the cycle.
They also help self-suspension to work more simply, safely, and in
accord with expectations.
4. Add the notion of device activation level, devact_level_t,
and a routine for checking the current activation level,
device_activation(). Current activation levels are DEVACT_LEVEL_BUS,
DEVACT_LEVEL_DRIVER, and DEVACT_LEVEL_CLASS, which respectively
indicate that the device's bus is active, that the bus and device are
active, and that the bus, device, and the functions of the device's
class (network, audio) are active.
Suspend/resume calls can be qualified with a devact_level_t.
The power-management framework treats a devact_level_t that
qualifies a device suspension as the device's current activation
level; it only runs hooks to reduce the activation level from
the presumed current level to the fully suspended state. The
framework treats a devact_level_t qualifying device resumption
as the target activation level; it only runs hooks to raise the
activation level to the target.
5. Use pmf_qual_t, devact_level_t, and self-suspensors in several
drivers.
6. Temporarily add an unused power-management workqueue that I will
remove or replace, soon.
restore the system from sleep. set/clear wake GPEs as specified before
entering sleep.
by default, the following devices are enabled for wake:
- sleep/power buttons
- lid switch
- pc kbd controller
reviewed by: joerg
driver was updated to sysmon_envsys V2; a simple_lock was turned into
a mutex. But the only code that ever used the simple_lock was removed
so the mutex can also be removed.
Noticed by njoly@
1. ENVSYS_WARNOVER event is generated whenever any active cooling level
is exceeded.
2. ENVSYS_CRITOVER event is generated whenever _HOT limit is exceeded;
if the _HOT limit is not defined, then ENVSYS_CRITOVER will be
generated when the _CRT limit is exceeded.
3. For Passive Cooling Only mode, there will be no change in behavior.
Additionally, since there are specific actions taken at each of the Active
Cooling Levels (powering parts of a zone on or off), and the limits are not
user-programmable,
4. The {warn,crit}{min,max} threshold levels will be specified only
by the device itself; event reporting thresholds may not be set
from userland.
No comments received for two weeks after proposing these changes on both
current-users@ and tech-kern@
devices that attach at acpi(4).
Begin deriving an acpi(4) device-detachment hook, acpi_detach(), from
acpi_attach(). The code between #if 0 and #endif still needs to be
turned to the opposite calls (enables to disables, maps to unmaps,
attaches to detaches), which should be run in the opposite order.
Somebody with deep ACPI knowledge can probably finish this off without
too much trouble.
There are still about 1600 left, but they have ',' or /* ... */
in the actual variable definitions - which my awk script doesn't handle.
There are also many that need () -> (void).
(The script does handle misordered arguments.)
via ECDT, we would print:
acpiec0 at acpi0 (EC, PHP0C09-0): ACPI Embedded Controller (disabled)
The embedded controller isn't actually disabled, but instead this driver
instance, so change the message to read:
acpiec0 at acpi0 (EC, PHP0C09-0): using acpiecdt0
resources on the same line as autoconf messages. Things like:
pcppi1 at acpi0 (SPKR, PNP0800)
pcppi1: io 0x61
become:
pcppi1 at acpi0 (SPKR, PNP0800): io 0x61
Switch to polling mode after the acpi(4) device has been suspended as
interrupts will be disabled later on and we may still need to execute
AML that tries to sleep or wait on a semaphore.
we will get notified for changes there). Use SME_POLL_ONLY so applications
that use GTREDATA don't cause trouble, and don't use SME_INIT_REFRESH as it
appears to be completely broken.
* No need for sme_refresh callback; GPE handler will tell us when the
device status changed (otherwise we can refresh data up to once a second,
and that can take time!)
* Since sme_refresh callback is gone, mutex is no longer required to
synchronize GPE handlers and refresh thread, so nuke it.
* Don't do any more work in GPE handler than required; use AcpiOsExecute
to clear battery status/information in the sysmon_task_queue along with
the refresh.
With these changes running GNOME's battstat-applet-2 no longer causes
my mouse to stutter once a second, and significantly reduces its CPU usage.
4.99.42 and nobody has complained. Newer systems with ioapic shouldn't
need this, and older non-ioapic systems should properly restore PCI IRQ
routing within their PCI-ISA bridge drivers.
config_found_ia on the node to save a bunch of useless 'device NNN
not configured' messages at startup. While here, condense ACPI printfs
at attach time.
the same value! Fixes the AE_AML_MUTEX_NOT_ACQUIRED issue when evaluating
_BST on ASUS Eee PC. Who knows what other mysterious bugs this has caused
over the years...
All Reference Objects returned via the AcpiEvaluateObject interface are now
marked as type "REFERENCE" instead of "ANY". The type ANY is now reserved for
NULL objects - either NULL package elements or unresolved named references.
to always fetch new status after resuming, otherwise if AACAD_F_AVAILABLE
is set, acpiacad_get_status() won't be called.
Also use the SME_INIT_REFRESH flag to fetch sensor data once in the
autoconf(9) process.
Ok'ed by <jmcneill>.
Improve PMF-ability.
Add a 'flags' argument to suspend/resume handlers and
callers such as pmf_system_suspend().
Define a flag, PMF_F_SELF, which indicates to PMF that a
device is suspending/resuming itself. Add helper routines,
pmf_device_suspend_self(dev) and pmf_device_resume_self(dev),
that call pmf_device_suspend(dev, PMF_F_SELF) and
pmf_device_resume(dev, PMF_F_SELF), respectively. Use
PMF_F_SELF to suspend/resume self in ath(4), audio(4),
rtw(4), and sip(4).
In ath(4) and in rtw(4), replace the icky sc_enable/sc_disable
callbacks, provided by the bus front-end, with
self-suspension/resumption. Also, clean up the bus
front-ends. Make sure that the interrupt handler is
disestablished during suspension. Get rid of driver-private
flags (e.g., RTW_F_ENABLED, ath_softc->sc_invalid); use
device_is_active()/device_has_power() calls, instead.
In the network-class suspend handler, call if_stop(, 0)
instead of if_stop(, 1), because the latter is superfluous
(bus- and driver-suspension hooks will 'disable' the NIC),
and it may cause recursion.
In the network-class resume handler, prevent infinite
recursion through if_init() by getting out early if we are
self-suspending (PMF_F_SELF).
rtw(4) improvements:
Destroy rtw(4) callouts when we detach it. Make rtw at
pci detachable. Print some more information with the "rx
frame too long" warning.
Remove activate() methods:
Get rid of rtw_activate() and ath_activate(). The device
activate() methods are not good for much these days.
Make ath at cardbus resume with crypto functions intact:
Introduce a boolean device property, "pmf-powerdown". If
pmf-powerdown is present and false, it indicates that a
bus back-end should not remove power from a device.
Honor this property in cardbus_child_suspend().
Set this property to 'false' in ath_attach(), since removing
power from an ath at cardbus seems to lobotomize the WPA
crypto engine. XXX Should the pmf-powerdown property
propagate toward the root of the device tree?
Miscellaneous ath(4) changes:
Warn if ath(4) tries to write crypto keys to suspended
hardware.
Reduce differences between FreeBSD and NetBSD in ath(4)
multicast filter setup.
Make ath_printrxbuf() print an rx descriptor's status &
key index, to help debug crypto errors.
Shorten a staircase in ath_ioctl(). Don't check for
ieee80211_ioctl() return code ERESTART, it never happens.
Add a method for detaching children. XXX acpi(4) may leak some
resources for each child detached. Needs attention from someone
who understands acpi(4).
except the ppbus stuff (which doesn't compile) and ulpt(4) which is
unrelated and can be dealt with separately.
As usual, it comes with related cosmetic changes.
- Change the attimer <-> pcppi communication using device_t so that
pcppi(4) doesn't have to know about the contents of struct attimer_softc.
XXX pcppi's childdet function is completely wrong. This has to be
XXX revisited later.
register com_cleanup() as the shutdown hook.
Add a generic suspend routine. Suspend and resume com@isa.
Protect against dereferencing a NULL softc in comioctl().
Destroy both a mutex and a callout in com_detach().
Cosmetic: use aprint_*_dev(). Use PMF_FN_ARGS, PMF_FN_PROTO.
the elements rather than Integer.Value, which sometimes doesn't
match and gives unexpected results on the error path.
This fixes the kmem_poison_check on DEBUG kernels (finally). Patch
by Fukumoto Atsushi. Thanks!
from S3 sleep. Until we get proper ACPI power resource support, simply
call \\_SB.PCI0.LPC.EC.PUBS._ON() on resume if the method exists.
Fixes kern/37279 by Steven M Bellovin.