#
267654 |
|
19-Jun-2014 |
gjb |
Copy stable/9 to releng/9.3 as part of the 9.3-RELEASE cycle.
Approved by: re (implicit) Sponsored by: The FreeBSD Foundation |
#
253642 |
|
25-Jul-2013 |
avg |
protect acpi_battery_ioctl with Giant
This is a direct commit to stable/9.
There is a bug in the ACPICA version 20110527 that is used in stable/9. The bug can lead to unprotected reference counting on ACPI objects and eventually to a crash or a memory corruption. The bug has been fixed upstream and imported to head as of ACPICA version 20130328. Unfortunately, ACPICA version in stable has not been updated, so merging all past ACPICA versions or cherry-picking parts of 20130328 would be a big change with a risk of potential regressions.
During debugging it was determined that the most probable vector for the bug was through concurrent calls to ACPI battery sysctls and ioctls. The sysctls are already guarded by Giant (not MPSAFE), but ioctls could execute in parallel to a sysctl call and to each other. All the calls go through acpi_battery_ioctl function, which makes the actual calls into ACPICA and those are the calls that lack necessary protection. Thus preventing concurrency in acpi_battery_ioctl should prevent the conditions that triggered the ACPICA bug.
Some additional details can be found in this thread: http://thread.gmane.org/gmane.os.freebsd.devel.acpi/7707/focus=7774
Tested by: kron24@gmail.com, David Demelier <demelier.david@gmail.com> Approved by: re (kib)
|
#
230595 |
|
26-Jan-2012 |
dumbbell |
MFC r227992:
Prevent a division by zero with some broken batteries
This problem was seen on a laptop with a dead battery.
|
#
225736 |
|
22-Sep-2011 |
kensmith |
Copy head to stable/9 as part of 9.0-RELEASE release cycle.
Approved by: re (implicit)
|
#
216503 |
|
17-Dec-2010 |
avg |
small cleanup of acpi battery status setting and checking
This is based on the patch submitted by Yuri Skripachov. Overview of the changes: - clarify double-use of some ACPI_BATT_STAT_* definitions - clean up undefined/extended status bits returned by _BST - warn about charging+discharging bits being set at the same time
PR: kern/124744 Submitted by: Yuri Skripachov <y.skripachov@gmail.com> Tested by: Yuri Skripachov <y.skripachov@gmail.com> MFC after: 2 weeks
|
#
196403 |
|
20-Aug-2009 |
jhb |
Temporarily revert the new-bus locking for 8.0 release. It will be reintroduced after HEAD is reopened for commits by re@.
Approved by: re (kib), attilio
|
#
196037 |
|
02-Aug-2009 |
attilio |
Make the newbus subsystem Giant free by adding the new newbus sxlock. The newbus lock is responsible for protecting newbus internIal structures, device states and devclass flags. It is necessary to hold it when all such datas are accessed. For the other operations, softc locking should ensure enough protection to avoid races.
Newbus lock is automatically held when virtual operations on the device and bus are invoked when loading the driver or when the suspend/resume take place. For other 'spourious' operations trying to access/modify the newbus topology, newbus lock needs to be automatically acquired and dropped.
For the moment Giant is also acquired in some key point (modules subsystem) in order to avoid problems before the 8.0 release as module handlers could make assumptions about it. This Giant locking should go just after the release happens.
Please keep in mind that the public interface can be expanded in order to provide more support, if there are really necessities at some point and also some bugs could arise as long as the patch needs a bit of further testing.
Bump __FreeBSD_version in order to reflect the newbus lock introduction.
Reviewed by: ed, hps, jhb, imp, mav, scottl No answer by: ariff, thompsa, yongari Tested by: pho, G. Trematerra <giovanni dot trematerra at gmail dot com>, Brandon Gooch <jamesbrandongooch at gmail dot com> Sponsored by: Yahoo! Incorporated Approved by: re (ksmith)
|
#
193530 |
|
05-Jun-2009 |
jkim |
Import ACPICA 20090521.
|
#
187368 |
|
17-Jan-2009 |
mav |
Convert battery capacity/rate from mA to mW only when summary is requested. Unconditional conversion causes incorrect rate units reported by acpiconf.
MFC after: 2 weeks
|
#
173782 |
|
20-Nov-2007 |
jkim |
Check battery presence first before trying to get battery information.
PR: kern/117591 Tested by: Jessica Mahoney (root at varusonline dot com)
|
#
172490 |
|
09-Oct-2007 |
njl |
When the EC times out (common with Compaqs), it may report a design voltage of 0. This can result in a divide by zero trap. Add a guard for this case. The value of lfcap is checked in acpi_battery_bif_valid() just before this, so it is safe.
Reportd by: sam Approved by: re MFC after: 3 days
|
#
165457 |
|
21-Dec-2006 |
imp |
ACPIIO_BATT_GET_UNITS would always return ENXIO. However, it should never return an error since it returns a count of battery devices in the system. Set it to 0 explicitly, since it is the only switch branch that doesn't set it.
# I guess no one uses it.
|
#
159476 |
|
10-Jun-2006 |
njl |
Minor sysctl cleanup. The RW flag means read|write and so it is redundant to add the RD flag. Also, the debug node does not need to be writable.
|
#
152703 |
|
22-Nov-2005 |
njl |
Simplify checks for valid battery info via DeMorgan's Rule. No functional change.
|
#
151591 |
|
23-Oct-2005 |
njl |
Add prototype to be consistent.
|
#
151563 |
|
22-Oct-2005 |
njl |
Cleanups and support code for importing smart battery support.
* Use ACPI_BATT_UNKNOWN instead of constants * Use maxunit instead of a count of devices since we may have sparse battery devices in the future. Only userland should be using unit numbers anyway, so provide a translation function. (Kernel use of batteries should be restricted to looking up a device_t and calling methods directly. * Don't check acpi_BatteryIsPresent() in acpi_battery. Leave it up to the hardware-specific driver (i.e. cmbat) since smart batteries seem to not report the "battery present" flag. * Convert mA to mW if the battery uses those units. CM-batteries only used mW so this deficiency went unnoticed. * Clean strings reported in the battery info from any control chars. * Only dereference the unit from ioctl_arg if the full struct is present. Unit wouldn't have been used later if it wasn't present but this is cleaner. Translate the unit if it's not ACPI_BATTERY_ALL_UNITS. * bzero structs before returning them to usermode for future compat.
Most of this work was submitted by Hans Petter Selasky and then majorly reworked by myself.
Submitted by: Hans Petter Selasky <hselasky / c2i.net>
|
#
150003 |
|
11-Sep-2005 |
obrien |
Canonize the include of acpi.h.
|
#
148968 |
|
11-Aug-2005 |
njl |
Modify the fix in rev 1.16 slightly. Instead of setting the cap to zero, just skip summing it if it's unknown.
MFC after: 1 day
|
#
148742 |
|
05-Aug-2005 |
njl |
When summing capacities, skip info from batteries that weren't present. Previously, we used all info (including -1 or "not present") which would keep the system from reaching 100% when charging.
Reported by: Eric Anderson MFC after: 2 days
|
#
148492 |
|
28-Jul-2005 |
njl |
Add descriptions for the sysctls.
MFC after: 1 day
|
#
148489 |
|
28-Jul-2005 |
njl |
Zero the _BST, _BIF, and battinfo allocations. This is needed since we later sum capacities for all batteries, even those that weren't actually present. We only need to do this for _BST but do it for all of them.
Reported by: Eric Anderson MFC after: 1 day
|
#
148400 |
|
25-Jul-2005 |
njl |
Correct minor output bug. When the battery being queried is charging or the overall discharge rate is 0, mark the battery remaining time as "unknown", not 0.
Reported by: Eric Kjeldergaard MFC after: 4 days
|
#
148352 |
|
23-Jul-2005 |
njl |
Rewrite the acpi_battery interface to allow for other battery types (i.e., smart battery) and fix various bugs found during the cleanup.
API changes: * kernel access: Access to individual batteries is now via devclass_find("battery"). Introduce new methods ACPI_BATT_GET_STATUS (for _BST-formatted data) and ACPI_BATT_GET_INFO (for _BIF-formatted data). The helper function acpi_battery_get_battinfo() now takes a device_t instead of a unit # argument. If dev is NULL, this signifies all batteries.
* ioctl access: The ACPIIO_BATT_GET_TYPE and ACPIIO_BATT_GET_BATTDESC ioctls have been removed. Since there is now no need for a mapping between "virtual" unit and physical unit, usermode programs can just specify the unit directly and skip the old translation steps. In fact, acpiconf(8) was actually already doing this and virtual unit was the same as physical unit in all cases since there was previously only one battery type (acpi_cmbat). Additionally, we now map the ACPIIO_BATT_GET_BIF and ACPIIO_BATT_GET_BST ioctls for all batteries, if they provide the associated methods.
* apm compatibility device/ioctls: no change * sysctl: no change
Since most third-party applications use the apm(4) compat interface, there should be very few affected applications (if any).
Reviewed by: bruno MFC after: 5 days
|
#
143771 |
|
17-Mar-2005 |
njl |
Introduce a general name for the previously cmbat-only ioctls. It has the same value as the previous ioctls so no binary change. Also, make a few style changes to reduce diffs to my tree.
Loosely based on code from: Hans Petter Selasky
|
#
143002 |
|
02-Mar-2005 |
obrien |
Fix SCM ID's.
|
#
133614 |
|
13-Aug-2004 |
njl |
MPSAFE locking
* Serialize acpi_battery_get_battdesc(), acpi_battery_register(), and acpi_battery_remove(). * Assert that the sx lock is held in acpi_batteries_init(). * Remove check for device_get_softc() returning NULL.
|
#
132049 |
|
12-Jul-2004 |
njl |
Add the ability to detach a battery. Now batteries that are detached are also removed from the battery list.
|
#
118783 |
|
11-Aug-2003 |
njl |
Style cleanups to match the rest of this directory. For acpi_battery.c, remove unused includes.
|
#
110894 |
|
14-Feb-2003 |
takawata |
Allow non-privilaged user to retrive battery or AC line information.
Reviewed by: rwatson
|
#
105282 |
|
16-Oct-2002 |
jhb |
Catch up to changes in acpivar.h to add support for using ACPI on 4-stable systems.
Sponsored by: The Weather Channel
|
#
89054 |
|
08-Jan-2002 |
msmith |
Staticise devclasses and some unnecessarily global variables.
|
#
85729 |
|
30-Oct-2001 |
iwasaki |
Some improvements of control method battery driver. - Add a new MIB for battery info expire time in order to make it changeable. Battery info expire time can be specified by hw.acpi.battery.info_expire in sec. - Add own MALLOC type and fix some potential memory leakages. - Change some frequent printings to verbose printing. - Stop timeout during acpi_cmbat_get_bst() too. This should reduce the races with BIF evaluation. - Remove acpi_cmbat_get_bif() invocation from acpi_cmbat_attach(). This was redundant because this should be called from acpi_cmbat_timeout() now.
|
#
85556 |
|
26-Oct-2001 |
iwasaki |
Add APM compatibility feature to ACPI. This emulates APM device node interface APIs (mainly ioctl) and provides APM services for the applications. The goal is to support most of APM applications without any changes. Implemented ioctls in this commit are: - APMIO_SUSPEND (mapped ACPI S3 as default but changable by sysctl) - APMIO_STANDBY (mapped ACPI S1 as default but changable by sysctl) - APMIO_GETINFO and APMIO_GETINFO_OLD - APMIO_GETPWSTATUS
With above, many APM applications which get batteries, ac-line info. and transition the system into suspend/standby mode (such as wmapm, xbatt) should work with ACPI enabled kernel (if ACPI works well :-)
Reviewed by: arch@, audit@ and some guys
|
#
82372 |
|
26-Aug-2001 |
msmith |
Updates to match the ACPI CA 20010816 import:
- New debug macro (ACPI_DEBUG_PRINT), reducing debug-case code size. - New debug level/subsystem codes.
|
#
79282 |
|
05-Jul-2001 |
msmith |
Add a new helper function for finding resources in resource buffers.
Move the ACPI generic battery code into a new file.
|