summaryrefslogtreecommitdiff
path: root/sys/dev/acpi
diff options
context:
space:
mode:
authorJordan Hargrave <jordan@cvs.openbsd.org>2009-03-11 21:54:16 +0000
committerJordan Hargrave <jordan@cvs.openbsd.org>2009-03-11 21:54:16 +0000
commit02dea2236c1bbb1a336a51b1e04dad6ffa7ae481 (patch)
tree6345aa39a8d0cc77a131864324d3dcd90dfbbce4 /sys/dev/acpi
parentbaf2b519be65ecae2d6ea3f5bb4f278856431564 (diff)
More aml_evalinteger fixup
ok marco@
Diffstat (limited to 'sys/dev/acpi')
-rw-r--r--sys/dev/acpi/acpibat.c17
-rw-r--r--sys/dev/acpi/acpiprt.c23
-rw-r--r--sys/dev/acpi/acpitz.c12
3 files changed, 23 insertions, 29 deletions
diff --git a/sys/dev/acpi/acpibat.c b/sys/dev/acpi/acpibat.c
index 56cb1746c02..f3f390f3d4e 100644
--- a/sys/dev/acpi/acpibat.c
+++ b/sys/dev/acpi/acpibat.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: acpibat.c,v 1.53 2008/11/06 23:41:28 marco Exp $ */
+/* $OpenBSD: acpibat.c,v 1.54 2009/03/11 21:54:15 jordan Exp $ */
/*
* Copyright (c) 2005 Marco Peereboom <marco@openbsd.org>
*
@@ -64,17 +64,17 @@ acpibat_attach(struct device *parent, struct device *self, void *aux)
{
struct acpibat_softc *sc = (struct acpibat_softc *)self;
struct acpi_attach_args *aa = aux;
- struct aml_value res;
+ int64_t sta;
sc->sc_acpi = (struct acpi_softc *)parent;
sc->sc_devnode = aa->aaa_node;
- if (aml_evalname(sc->sc_acpi, sc->sc_devnode, "_STA", 0, NULL, &res)) {
+ if (aml_evalinteger(sc->sc_acpi, sc->sc_devnode, "_STA", 0, NULL, &sta)) {
dnprintf(10, "%s: no _STA\n", DEVNAME(sc));
return;
}
- if ((res.v_integer & STA_BATTERY) != 0) {
+ if ((sta & STA_BATTERY) != 0) {
sc->sc_bat_present = 1;
acpibat_getbif(sc);
acpibat_getbst(sc);
@@ -94,8 +94,6 @@ acpibat_attach(struct device *parent, struct device *self, void *aux)
printf(": %s not present\n", sc->sc_devnode->name);
}
- aml_freevalue(&res);
-
/* create sensors */
acpibat_monitor(sc);
@@ -399,16 +397,15 @@ int
acpibat_notify(struct aml_node *node, int notify_type, void *arg)
{
struct acpibat_softc *sc = arg;
- struct aml_value res;
+ int64_t sta;
int present;
dnprintf(10, "acpibat_notify: %.2x %s\n", notify_type,
sc->sc_devnode->name);
/* Check if installed state of battery has changed */
- memset(&res, 0, sizeof(res));
- if (aml_evalname(sc->sc_acpi, node, "_STA", 0, NULL, &res) == 0) {
- present = res.v_integer & STA_BATTERY;
+ if (aml_evalinteger(sc->sc_acpi, node, "_STA", 0, NULL, &sta) == 0) {
+ present = sta & STA_BATTERY;
if (!sc->sc_bat_present && present) {
printf("%s: %s inserted\n", DEVNAME(sc),
sc->sc_devnode->name);
diff --git a/sys/dev/acpi/acpiprt.c b/sys/dev/acpi/acpiprt.c
index bd3e4f25cc0..81c19e00af8 100644
--- a/sys/dev/acpi/acpiprt.c
+++ b/sys/dev/acpi/acpiprt.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: acpiprt.c,v 1.32 2009/03/11 20:37:46 jordan Exp $ */
+/* $OpenBSD: acpiprt.c,v 1.33 2009/03/11 21:54:15 jordan Exp $ */
/*
* Copyright (c) 2006 Mark Kettenis <kettenis@openbsd.org>
*
@@ -385,6 +385,7 @@ acpiprt_getpcibus(struct acpiprt_softc *sc, struct aml_node *node)
pcitag_t tag;
pcireg_t reg;
int bus, dev, func, rv;
+ int64_t ires;
if (parent == NULL)
return 0;
@@ -407,21 +408,18 @@ acpiprt_getpcibus(struct acpiprt_softc *sc, struct aml_node *node)
* If our parent is the root of the bus, it should specify the
* base bus number.
*/
- if (aml_evalname(sc->sc_acpi, parent, "_BBN.", 0, NULL, &res) == 0) {
- rv = aml_val2int(&res);
- aml_freevalue(&res);
- return (rv);
+ if (aml_evalinteger(sc->sc_acpi, parent, "_BBN.", 0, NULL, &ires) == 0) {
+ return (ires);
}
/*
* If our parent is a PCI-PCI bridge, get our bus number from its
* PCI config space.
*/
- if (aml_evalname(sc->sc_acpi, parent, "_ADR.", 0, NULL, &res) == 0) {
+ if (aml_evalinteger(sc->sc_acpi, parent, "_ADR.", 0, NULL, &ires) == 0) {
bus = acpiprt_getpcibus(sc, parent);
- dev = ACPI_PCI_DEV(aml_val2int(&res) << 16);
- func = ACPI_PCI_FN(aml_val2int(&res) << 16);
- aml_freevalue(&res);
+ dev = ACPI_PCI_DEV(ires << 16);
+ func = ACPI_PCI_FN(ires << 16);
/*
* Some systems return 255 as the device number for
@@ -456,7 +454,8 @@ acpiprt_route_interrupt(int bus, int dev, int pin)
struct aml_node *node = NULL;
struct aml_value res, res2;
union acpi_resource *crs;
- int irq, newirq, sta;
+ int irq, newirq;
+ int64_t sta;
SIMPLEQ_FOREACH(p, &acpiprt_map_list, list) {
if (p->bus == bus && p->dev == dev && p->pin == (pin - 1)) {
@@ -469,13 +468,11 @@ acpiprt_route_interrupt(int bus, int dev, int pin)
if (node == NULL)
return;
- if (aml_evalname(sc->sc_acpi, node, "_STA", 0, NULL, &res)) {
+ if (aml_evalinteger(sc->sc_acpi, node, "_STA", 0, NULL, &sta)) {
printf("no _STA method\n");
return;
}
- sta = aml_val2int(&res);
- aml_freevalue(&res);
KASSERT(sta & STA_PRESENT);
if (aml_evalname(sc->sc_acpi, node, "_CRS", 0, NULL, &res)) {
diff --git a/sys/dev/acpi/acpitz.c b/sys/dev/acpi/acpitz.c
index f1a56860bce..7dfc4699d71 100644
--- a/sys/dev/acpi/acpitz.c
+++ b/sys/dev/acpi/acpitz.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: acpitz.c,v 1.28 2008/09/12 12:35:19 miod Exp $ */
+/* $OpenBSD: acpitz.c,v 1.29 2009/03/11 21:54:15 jordan Exp $ */
/*
* Copyright (c) 2006 Can Erkin Acar <canacar@openbsd.org>
* Copyright (c) 2005 Marco Peereboom <marco@openbsd.org>
@@ -183,9 +183,10 @@ int
acpitz_setfan(struct acpitz_softc *sc, int i, char *method)
{
struct aml_node *node;
- struct aml_value res0, res1, res2, *ref;
+ struct aml_value res0, res1, *ref;
char name[8];
int rv = 1, x, y;
+ int64_t sta;
dnprintf(20, "%s: acpitz_setfan(%d, %s)\n", DEVNAME(sc), i, method);
@@ -260,13 +261,12 @@ acpitz_setfan(struct acpitz_softc *sc, int i, char *method)
DEVNAME(sc), name, x, y, method);
/* save off status of fan */
- if (aml_evalname(sc->sc_acpi, ref->node, "_STA", 0,
- NULL, &res2))
+ if (aml_evalinteger(sc->sc_acpi, ref->node, "_STA", 0,
+ NULL, &sta))
printf("%s: %s[%d.%d] _STA fails\n",
DEVNAME(sc), name, x, y);
else {
- sc->sc_ac_stat[i] = aml_val2int(&res2);
- aml_freevalue(&res2);
+ sc->sc_ac_stat[i] = sta;
}
}
aml_freevalue(&res1);