Deleted Added
full compact
acpi_cmbat.c (193530) acpi_cmbat.c (216503)
1/*-
2 * Copyright (c) 2005 Nate Lawson
3 * Copyright (c) 2000 Munehiro Matsuda
4 * Copyright (c) 2000 Takanori Watanabe
5 * Copyright (c) 2000 Mitsuru IWASAKI <iwasaki@FreeBSD.org>
6 * All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without

--- 14 unchanged lines hidden (view full) ---

23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 * SUCH DAMAGE.
28 */
29
30#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 2005 Nate Lawson
3 * Copyright (c) 2000 Munehiro Matsuda
4 * Copyright (c) 2000 Takanori Watanabe
5 * Copyright (c) 2000 Mitsuru IWASAKI <iwasaki@FreeBSD.org>
6 * All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without

--- 14 unchanged lines hidden (view full) ---

23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 * SUCH DAMAGE.
28 */
29
30#include <sys/cdefs.h>
31__FBSDID("$FreeBSD: head/sys/dev/acpica/acpi_cmbat.c 193530 2009-06-05 18:44:36Z jkim $");
31__FBSDID("$FreeBSD: head/sys/dev/acpica/acpi_cmbat.c 216503 2010-12-17 16:21:30Z avg $");
32
33#include "opt_acpi.h"
34#include <sys/param.h>
35#include <sys/kernel.h>
36#include <sys/module.h>
37#include <sys/bus.h>
38#include <sys/ioccom.h>
39

--- 234 unchanged lines hidden (view full) ---

274 if (acpi_PkgInt32(res, 1, &sc->bst.rate) != 0)
275 goto end;
276 if (acpi_PkgInt32(res, 2, &sc->bst.cap) != 0)
277 goto end;
278 if (acpi_PkgInt32(res, 3, &sc->bst.volt) != 0)
279 goto end;
280 acpi_cmbat_info_updated(&sc->bst_lastupdated);
281
32
33#include "opt_acpi.h"
34#include <sys/param.h>
35#include <sys/kernel.h>
36#include <sys/module.h>
37#include <sys/bus.h>
38#include <sys/ioccom.h>
39

--- 234 unchanged lines hidden (view full) ---

274 if (acpi_PkgInt32(res, 1, &sc->bst.rate) != 0)
275 goto end;
276 if (acpi_PkgInt32(res, 2, &sc->bst.cap) != 0)
277 goto end;
278 if (acpi_PkgInt32(res, 3, &sc->bst.volt) != 0)
279 goto end;
280 acpi_cmbat_info_updated(&sc->bst_lastupdated);
281
282 /* Clear out undefined/extended bits that might be set by hardware. */
283 sc->bst.state &= ACPI_BATT_STAT_BST_MASK;
284 if ((sc->bst.state & ACPI_BATT_STAT_INVALID) == ACPI_BATT_STAT_INVALID)
285 ACPI_VPRINT(dev, acpi_device_get_parent_softc(dev),
286 "battery reports simultaneous charging and discharging\n");
287
282 /* XXX If all batteries are critical, perhaps we should suspend. */
283 if (sc->bst.state & ACPI_BATT_STAT_CRITICAL) {
284 if ((sc->flags & ACPI_BATT_STAT_CRITICAL) == 0) {
285 sc->flags |= ACPI_BATT_STAT_CRITICAL;
286 device_printf(dev, "critically low charge!\n");
287 }
288 } else
289 sc->flags &= ~ACPI_BATT_STAT_CRITICAL;

--- 187 unchanged lines hidden ---
288 /* XXX If all batteries are critical, perhaps we should suspend. */
289 if (sc->bst.state & ACPI_BATT_STAT_CRITICAL) {
290 if ((sc->flags & ACPI_BATT_STAT_CRITICAL) == 0) {
291 sc->flags |= ACPI_BATT_STAT_CRITICAL;
292 device_printf(dev, "critically low charge!\n");
293 }
294 } else
295 sc->flags &= ~ACPI_BATT_STAT_CRITICAL;

--- 187 unchanged lines hidden ---