summaryrefslogtreecommitdiff
path: root/sys/dev/acpi
diff options
context:
space:
mode:
authorMarco Peereboom <marco@cvs.openbsd.org>2007-02-21 04:12:48 +0000
committerMarco Peereboom <marco@cvs.openbsd.org>2007-02-21 04:12:48 +0000
commit52d8fcb212a34f22bb934155501ca2e7ebbc6b45 (patch)
tree31615ae7565df53509faaaf8ddd9f0799e332b11 /sys/dev/acpi
parent37e747b0763424aed192ccdbcdf7e127858e2cf0 (diff)
KNF
Diffstat (limited to 'sys/dev/acpi')
-rw-r--r--sys/dev/acpi/acpiec.c32
1 files changed, 18 insertions, 14 deletions
diff --git a/sys/dev/acpi/acpiec.c b/sys/dev/acpi/acpiec.c
index 24acd86d84e..5870f93cac2 100644
--- a/sys/dev/acpi/acpiec.c
+++ b/sys/dev/acpi/acpiec.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: acpiec.c,v 1.16 2007/02/17 23:59:03 marco Exp $ */
+/* $OpenBSD: acpiec.c,v 1.17 2007/02/21 04:12:47 marco Exp $ */
/*
* Copyright (c) 2006 Can Erkin Acar <canacar@openbsd.org>
*
@@ -47,7 +47,8 @@ void acpiec_write_1(struct acpiec_softc *, u_int8_t, u_int8_t);
void acpiec_read(struct acpiec_softc *, u_int8_t, int, u_int8_t *);
void acpiec_write(struct acpiec_softc *, u_int8_t, int, u_int8_t *);
-int acpiec_getcrs(struct acpiec_softc *, struct acpi_attach_args *);
+int acpiec_getcrs(struct acpiec_softc *,
+ struct acpi_attach_args *);
int acpiec_getregister(const u_int8_t *, int, int *, bus_size_t *);
void acpiec_wait(struct acpiec_softc *, u_int8_t, u_int8_t);
@@ -63,7 +64,7 @@ struct aml_node *aml_find_name(struct acpi_softc *, struct aml_node *,
/* EC Status bits */
#define EC_STAT_SMI_EVT 0x40 /* SMI event pending */
#define EC_STAT_SCI_EVT 0x20 /* SCI event pending */
-#define EC_STAT_BURST 0x10 /* Controller in burst mode */
+#define EC_STAT_BURST 0x10 /* Controller in burst mode */
#define EC_STAT_CMD 0x08 /* data is command */
#define EC_STAT_IBF 0x02 /* input buffer full */
#define EC_STAT_OBF 0x01 /* output buffer full */
@@ -118,7 +119,8 @@ acpiec_wait(struct acpiec_softc *sc, u_int8_t mask, u_int8_t val)
{
u_int8_t stat;
- dnprintf(40, "%s: EC wait_ns for: %b == %02x\n", DEVNAME(sc), (int)mask,
+ dnprintf(40, "%s: EC wait_ns for: %b == %02x\n",
+ DEVNAME(sc), (int)mask,
"\20\x8IGN\x7SMI\x6SCI\05BURST\04CMD\03IGN\02IBF\01OBF", (int)val);
while (((stat = acpiec_status(sc)) & mask) != val) {
@@ -141,7 +143,7 @@ void
acpiec_write_data(struct acpiec_softc *sc, u_int8_t val)
{
acpiec_wait(sc, EC_STAT_IBF, 0);
- dnprintf(40, "acpiec: write_data -- %d\n", (int) val);
+ dnprintf(40, "acpiec: write_data -- %d\n", (int)val);
bus_space_write_1(sc->sc_data_bt, sc->sc_data_bh, 0, val);
}
@@ -149,7 +151,7 @@ void
acpiec_write_cmd(struct acpiec_softc *sc, u_int8_t val)
{
acpiec_wait(sc, EC_STAT_IBF, 0);
- dnprintf(40, "acpiec: write_cmd -- %d\n", (int) val);
+ dnprintf(40, "acpiec: write_cmd -- %d\n", (int)val);
bus_space_write_1(sc->sc_cmd_bt, sc->sc_cmd_bh, 0, val);
}
@@ -159,7 +161,7 @@ acpiec_read_data(struct acpiec_softc *sc)
u_int8_t val;
acpiec_wait(sc, EC_STAT_OBF, EC_STAT_OBF);
- dnprintf(40, "acpiec: read_data\n", (int) val);
+ dnprintf(40, "acpiec: read_data\n", (int)val);
val = bus_space_read_1(sc->sc_data_bt, sc->sc_data_bh, 0);
return (val);
@@ -179,7 +181,7 @@ acpiec_sci_event(struct acpiec_softc *sc)
evt = bus_space_read_1(sc->sc_data_bt, sc->sc_data_bh, 0);
if (evt) {
- dnprintf(10, "%s: sci_event: 0x%02x\n", DEVNAME(sc), (int) evt);
+ dnprintf(10, "%s: sci_event: 0x%02x\n", DEVNAME(sc), (int)evt);
aml_evalnode(sc->sc_acpi, sc->sc_events[evt].event, 0, NULL,
NULL);
}
@@ -230,7 +232,7 @@ acpiec_read(struct acpiec_softc *sc, u_int8_t addr, int len, u_int8_t *buffer)
* transaction does not get interrupted.
*/
acpiec_burst_enable(sc);
- dnprintf(20, "%s: read %d, %d\n", DEVNAME(sc), (int) addr, len);
+ dnprintf(20, "%s: read %d, %d\n", DEVNAME(sc), (int)addr, len);
for (reg = 0; reg < len; reg++)
buffer[reg] = acpiec_read_1(sc, addr + reg);
@@ -247,7 +249,7 @@ acpiec_write(struct acpiec_softc *sc, u_int8_t addr, int len, u_int8_t *buffer)
* transaction does not get interrupted.
*/
acpiec_burst_enable(sc);
- dnprintf(20, "%s: write %d, %d\n", DEVNAME(sc), (int) addr, len);
+ dnprintf(20, "%s: write %d, %d\n", DEVNAME(sc), (int)addr, len);
for (reg = 0; reg < len; reg++)
acpiec_write_1(sc, addr + reg, buffer[reg]);
}
@@ -338,8 +340,10 @@ acpiec_gpehandler(struct acpi_softc *acpi_sc, int gpe, void *arg)
acpiec_sci_event(sc);
stat = acpiec_status(sc);
- dnprintf(40, "%s: EC interrupt, stat: %b\n", DEVNAME(sc), (int)stat,
- "\20\x8IGN\x7SMI\x6SCI\05BURST\04CMD\03IGN\02IBF\01OBF");
+ dnprintf(40, "%s: EC interrupt, stat: %b\n",
+ DEVNAME(sc), (int)stat,
+ "\20\x8IGN\x7SMI\x6SCI\05BURST\04CMD\03IGN\02IBF\01OBF");
+
if (stat & EC_STAT_SCI_EVT)
sc->sc_gotsci = 1;
} while (sc->sc_gotsci);
@@ -365,7 +369,7 @@ acpiec_getregister(const u_int8_t *buf, int size, int *type, bus_size_t *addr)
/* large resource */
if (size < 3)
return (1);
- len = (int) buf[1] + 256 * (int) buf[2];
+ len = (int)buf[1] + 256 * (int)buf[2];
hlen = 3;
} else {
/* small resource */
@@ -382,7 +386,7 @@ acpiec_getregister(const u_int8_t *buf, int size, int *type, bus_size_t *addr)
/* XXX validate? */
*type = GAS_SYSTEM_IOSPACE;
- *addr = (int) buf[2] + 256 * (int) buf[3];
+ *addr = (int)buf[2] + 256 * (int)buf[3];
return (hlen + len);
}