diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2006-12-21 11:23:42 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2006-12-21 11:23:42 +0000 |
commit | a9a99472c501c54713ea8c3a654aa924bdd04b50 (patch) | |
tree | 916c8466a317284a91fe2359e571bd908a8807dd /sys | |
parent | 733ed3643d67aeb8a4cd5cd1805475c5be8b9108 (diff) |
more minor knf
Diffstat (limited to 'sys')
-rw-r--r-- | sys/dev/acpi/acpiac.c | 6 | ||||
-rw-r--r-- | sys/dev/acpi/acpibat.c | 12 | ||||
-rw-r--r-- | sys/dev/acpi/acpibtn.c | 4 | ||||
-rw-r--r-- | sys/dev/acpi/acpicpu.c | 4 | ||||
-rw-r--r-- | sys/dev/acpi/acpidev.h | 6 | ||||
-rw-r--r-- | sys/dev/acpi/acpiprt.c | 4 | ||||
-rw-r--r-- | sys/dev/acpi/acpitz.c | 6 | ||||
-rw-r--r-- | sys/dev/acpi/acpivar.h | 6 | ||||
-rw-r--r-- | sys/dev/acpi/amltypes.h | 10 | ||||
-rw-r--r-- | sys/dev/acpi/dsdt.h | 161 |
10 files changed, 105 insertions, 114 deletions
diff --git a/sys/dev/acpi/acpiac.c b/sys/dev/acpi/acpiac.c index 301c47bffbf..8b37c7fbbcc 100644 --- a/sys/dev/acpi/acpiac.c +++ b/sys/dev/acpi/acpiac.c @@ -1,4 +1,4 @@ -/* $OpenBSD: acpiac.c,v 1.11 2006/12/18 17:55:58 deraadt Exp $ */ +/* $OpenBSD: acpiac.c,v 1.12 2006/12/21 11:23:41 deraadt Exp $ */ /* * Copyright (c) 2005 Marco Peereboom <marco@openbsd.org> * @@ -71,7 +71,7 @@ acpiac_attach(struct device *parent, struct device *self, void *aux) aml_register_notify(sc->sc_devnode->parent, aa->aaa_dev, acpiac_notify, sc); - acpiac_getsta(sc); + acpiac_getsta(sc); printf(": AC unit "); if (sc->sc_ac_stat == PSR_ONLINE) printf("online\n"); @@ -92,7 +92,7 @@ acpiac_refresh(void *arg) { struct acpiac_softc *sc = arg; - acpiac_getsta(sc); + acpiac_getsta(sc); sc->sens[0].value = sc->sc_ac_stat; } diff --git a/sys/dev/acpi/acpibat.c b/sys/dev/acpi/acpibat.c index 26424149f1e..927ee581bc2 100644 --- a/sys/dev/acpi/acpibat.c +++ b/sys/dev/acpi/acpibat.c @@ -1,4 +1,4 @@ -/* $OpenBSD: acpibat.c,v 1.32 2006/12/21 04:54:27 marco Exp $ */ +/* $OpenBSD: acpibat.c,v 1.33 2006/12/21 11:23:41 deraadt Exp $ */ /* * Copyright (c) 2005 Marco Peereboom <marco@openbsd.org> * @@ -74,10 +74,10 @@ acpibat_attach(struct device *parent, struct device *self, void *aux) if (aml_evalname(sc->sc_acpi, sc->sc_devnode, "_STA", 0, NULL, &res)) dnprintf(10, "%s: no _STA\n", DEVNAME(sc)); - + if ((sc->sc_bat_present = res.v_integer & STA_BATTERY) != 0) { acpibat_getbif(sc); - acpibat_getbst(sc); + acpibat_getbst(sc); printf(": %s: model: %s serial: %s type: %s oem: %s\n", sc->sc_devnode->parent->name, sc->sc_bif.bif_model, @@ -86,9 +86,9 @@ acpibat_attach(struct device *parent, struct device *self, void *aux) sc->sc_bif.bif_oem); } else printf(": %s: not present\n", sc->sc_devnode->parent->name); - + acpibat_monitor(sc); - + aml_freevalue(&res); aml_register_notify(sc->sc_devnode->parent, aa->aaa_dev, @@ -177,7 +177,7 @@ acpibat_refresh(void *arg) } acpibat_getbif(sc); - acpibat_getbst(sc); + acpibat_getbst(sc); sc->sc_sens[0].value = sc->sc_bif.bif_last_capacity * 1000; sc->sc_sens[1].value = sc->sc_bif.bif_warning * 1000; diff --git a/sys/dev/acpi/acpibtn.c b/sys/dev/acpi/acpibtn.c index 1b0f3b5f108..0ab39c1a40e 100644 --- a/sys/dev/acpi/acpibtn.c +++ b/sys/dev/acpi/acpibtn.c @@ -1,4 +1,4 @@ -/* $OpenBSD: acpibtn.c,v 1.13 2006/12/18 20:57:45 canacar Exp $ */ +/* $OpenBSD: acpibtn.c,v 1.14 2006/12/21 11:23:41 deraadt Exp $ */ /* * Copyright (c) 2005 Marco Peereboom <marco@openbsd.org> * @@ -95,7 +95,7 @@ acpibtn_attach(struct device *parent, struct device *self, void *aux) else sc->sc_btn_type = ACPIBTN_UNKNOWN; - acpibtn_getsta(sc); + acpibtn_getsta(sc); printf(": %s\n", sc->sc_devnode->parent->name); diff --git a/sys/dev/acpi/acpicpu.c b/sys/dev/acpi/acpicpu.c index 94bd165fcc4..60289576b20 100644 --- a/sys/dev/acpi/acpicpu.c +++ b/sys/dev/acpi/acpicpu.c @@ -1,4 +1,4 @@ -/* $OpenBSD: acpicpu.c,v 1.15 2006/12/20 22:48:29 gwk Exp $ */ +/* $OpenBSD: acpicpu.c,v 1.16 2006/12/21 11:23:41 deraadt Exp $ */ /* * Copyright (c) 2005 Marco Peereboom <marco@openbsd.org> * @@ -69,7 +69,7 @@ struct cfdriver acpicpu_cd = { extern int setperf_prio; -#ifdef __i386__ +#ifdef __i386__ struct acpicpu_softc *acpicpu_sc[I386_MAXPROCS]; #elif __amd64__ struct acpicpu_softc *acpicpu_sc[X86_MAXPROCS]; diff --git a/sys/dev/acpi/acpidev.h b/sys/dev/acpi/acpidev.h index 4fff97272e4..93b4f6f1bc6 100644 --- a/sys/dev/acpi/acpidev.h +++ b/sys/dev/acpi/acpidev.h @@ -1,4 +1,4 @@ -/* $OpenBSD: acpidev.h,v 1.11 2006/11/29 22:17:07 marco Exp $ */ +/* $OpenBSD: acpidev.h,v 1.12 2006/12/21 11:23:41 deraadt Exp $ */ /* * Copyright (c) 2005 Marco Peereboom <marco@openbsd.org> * Copyright (c) 2005 Thorsten Lockert <tholo@sigmasoft.com> @@ -85,11 +85,11 @@ struct acpibat_bif { * Battery Remaining Capacity //DWORD * Battery Present Voltage //DWORD * } - * + * * Per the spec section 10.2.2.3 * Remaining Battery Percentage[%] = (Battery Remaining Capacity [=0 ~ 100] / * Last Full Charged Capacity[=100]) * 100 - * + * * Remaining Battery Life [h] = Battery Remaining Capacity [mAh/mWh] / * Battery Present Rate [=0xFFFFFFFF] = unknown */ diff --git a/sys/dev/acpi/acpiprt.c b/sys/dev/acpi/acpiprt.c index ea5ff8330bc..e7116555fe7 100644 --- a/sys/dev/acpi/acpiprt.c +++ b/sys/dev/acpi/acpiprt.c @@ -1,4 +1,4 @@ -/* $OpenBSD: acpiprt.c,v 1.8 2006/12/18 05:47:35 deraadt Exp $ */ +/* $OpenBSD: acpiprt.c,v 1.9 2006/12/21 11:23:41 deraadt Exp $ */ /* * Copyright (c) 2006 Mark Kettenis <kettenis@openbsd.org> * @@ -192,7 +192,7 @@ acpiprt_prt_add(struct acpiprt_softc *sc, struct aml_value *v) } #ifdef ACPI_DEBUG - printf("%s: %s addr 0x%llx pin %d irq %d sta %x\n", + printf("%s: %s addr 0x%llx pin %d irq %d sta %x\n", DEVNAME(sc), aml_nodename(pp->node), addr, pin, irq, sta); #endif diff --git a/sys/dev/acpi/acpitz.c b/sys/dev/acpi/acpitz.c index c4e734368bd..7d06407816a 100644 --- a/sys/dev/acpi/acpitz.c +++ b/sys/dev/acpi/acpitz.c @@ -1,4 +1,4 @@ -/* $OpenBSD: acpitz.c,v 1.11 2006/12/19 18:17:15 deraadt Exp $ */ +/* $OpenBSD: acpitz.c,v 1.12 2006/12/21 11:23:41 deraadt Exp $ */ /* * Copyright (c) 2006 Can Erkin Acar <canacar@openbsd.org> * Copyright (c) 2005 Marco Peereboom <marco@openbsd.org> @@ -127,7 +127,7 @@ acpitz_attach(struct device *parent, struct device *self, void *aux) aml_register_notify(sc->sc_devnode->parent, NULL, acpitz_notify, sc); - + memset(&sc->sc_sens, 0, sizeof(sc->sc_sens)); strlcpy(sc->sc_sens.device, DEVNAME(sc), sizeof(sc->sc_sens.device)); strlcpy(sc->sc_sens.desc, "zone temperature", @@ -213,7 +213,7 @@ acpitz_setfan(struct acpitz_softc *sc, int i, char *method) } ref = res1.v_package[y]->v_objref.ref; if (aml_evalname(sc->sc_acpi, ref->node, method, 0, - NULL, NULL)) + NULL, NULL)) printf("%s: %s[%d.%d] %s fails\n", DEVNAME(sc), name, x, y, method); diff --git a/sys/dev/acpi/acpivar.h b/sys/dev/acpi/acpivar.h index 0c15514122c..54c907edf07 100644 --- a/sys/dev/acpi/acpivar.h +++ b/sys/dev/acpi/acpivar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: acpivar.h,v 1.29 2006/11/25 18:24:54 marco Exp $ */ +/* $OpenBSD: acpivar.h,v 1.30 2006/12/21 11:23:41 deraadt Exp $ */ /* * Copyright (c) 2005 Thorsten Lockert <tholo@sigmasoft.com> * @@ -153,7 +153,7 @@ struct acpi_softc { struct klist *sc_note; struct acpi_reg_map sc_pmregs[ACPIREG_MAXREG]; bus_space_handle_t sc_ioh_pm1a_evt; - + void *sc_interrupt; #ifdef __HAVE_GENERIC_SOFT_INTERRUPTS void *sc_softih; @@ -177,7 +177,7 @@ struct acpi_softc { u_int32_t sc_gpe_sts; u_int32_t sc_gpe_en; struct acpi_thread *sc_thread; - + struct aml_node *sc_tts; struct aml_node *sc_pts; struct aml_node *sc_bfs; diff --git a/sys/dev/acpi/amltypes.h b/sys/dev/acpi/amltypes.h index 3b12dd2c8a0..7f7181a2522 100644 --- a/sys/dev/acpi/amltypes.h +++ b/sys/dev/acpi/amltypes.h @@ -1,4 +1,4 @@ -/* $OpenBSD: amltypes.h,v 1.20 2006/11/25 18:24:54 marco Exp $ */ +/* $OpenBSD: amltypes.h,v 1.21 2006/12/21 11:23:41 deraadt Exp $ */ /* * Copyright (c) 2005 Jordan Hargrave <jordan@openbsd.org> * @@ -147,7 +147,7 @@ /* * Comparison types for Match() - * + * * true,==,<=,<,>=,> */ #define AML_MATCH_TR 0 @@ -238,8 +238,7 @@ enum aml_objecttype { struct aml_node; /* AML Object Value */ -struct aml_value -{ +struct aml_value { int type; int length; int refcnt; @@ -307,8 +306,7 @@ struct aml_value #define aml_pkglen(v) ((v)->length) #define aml_pkgval(v,i) (&(v)->v_package[(i)]) -struct aml_node -{ +struct aml_node { struct aml_node *parent; struct aml_node *child; struct aml_node *sibling; diff --git a/sys/dev/acpi/dsdt.h b/sys/dev/acpi/dsdt.h index d1ad9919d97..38568a3b4dc 100644 --- a/sys/dev/acpi/dsdt.h +++ b/sys/dev/acpi/dsdt.h @@ -1,4 +1,4 @@ -/* $OpenBSD: dsdt.h,v 1.21 2006/11/27 18:30:38 kettenis Exp $ */ +/* $OpenBSD: dsdt.h,v 1.22 2006/12/21 11:23:41 deraadt Exp $ */ /* * Copyright (c) 2005 Marco Peereboom <marco@openbsd.org> * @@ -18,17 +18,15 @@ #ifndef __DEV_ACPI_DSDT_H__ #define __DEV_ACPI_DSDT_H__ -struct aml_vallist -{ +struct aml_vallist { struct aml_value *obj; int nobj; struct aml_vallist *next; }; -struct aml_scope -{ +struct aml_scope { struct acpi_softc *sc; - uint8_t *pos; + uint8_t *pos; uint8_t *end; struct aml_node *node; struct aml_vallist *tmpvals; @@ -39,12 +37,12 @@ struct aml_scope }; -struct aml_opcode -{ +struct aml_opcode { u_int32_t opcode; const char *mnem; const char *args; - struct aml_value *(*handler)(struct aml_scope *,int,struct aml_value*); + struct aml_value *(*handler)(struct aml_scope *, int, + struct aml_value*); }; const char *aml_eisaid(u_int32_t); @@ -52,7 +50,8 @@ const char *aml_args(int); const char *aml_mnem(int); int64_t aml_val2int(struct aml_value *); struct aml_node *aml_searchname(struct aml_node *, const void *); -struct aml_node *aml_createname(struct aml_node *, const void *, struct aml_value *); +struct aml_node *aml_createname(struct aml_node *, const void *, + struct aml_value *); struct aml_value *aml_allocint(uint64_t); struct aml_value *aml_allocstr(const char *); @@ -73,23 +72,21 @@ int aml_eval_object(struct acpi_softc *, struct aml_node *, void aml_register_notify(struct aml_node *, const char *, int (*)(struct aml_node *, int, void *), void *); -u_int64_t aml_getpciaddr(struct acpi_softc *, struct aml_node *); +u_int64_t aml_getpciaddr(struct acpi_softc *, struct aml_node *); -int aml_evalnode(struct acpi_softc *, struct aml_node *, - int , struct aml_value *, - struct aml_value *); +int aml_evalnode(struct acpi_softc *, struct aml_node *, + int , struct aml_value *, struct aml_value *); +int aml_evalname(struct acpi_softc *, struct aml_node *, + const char *, int, struct aml_value *, + struct aml_value *); -int aml_evalname(struct acpi_softc *, struct aml_node *, - const char *, int, struct aml_value *, - struct aml_value *); +void aml_fixup_dsdt(u_int8_t *, u_int8_t *, int); +void aml_create_defaultobjects(void); -void aml_fixup_dsdt(u_int8_t *, u_int8_t *, int); -void aml_create_defaultobjects(void); +int acpi_mutex_acquire(struct aml_value *, int); +void acpi_mutex_release(struct aml_value *); -int acpi_mutex_acquire(struct aml_value *, int); -void acpi_mutex_release(struct aml_value *); - -const char *aml_nodename(struct aml_node *); +const char *aml_nodename(struct aml_node *); #define SR_IRQ 0x04 #define SR_DMA 0x05 @@ -108,59 +105,58 @@ const char *aml_nodename(struct aml_node *); #define LR_EXTIRQ 0x89 #define LR_QWORD 0x8A -union acpi_resource -{ +union acpi_resource { struct { uint8_t typecode; uint16_t length; } __packed hdr; - /* Small resource structures - * format of typecode is: tttttlll, t = type, l = length + /* Small resource structures + * format of typecode is: tttttlll, t = type, l = length */ - struct { - uint8_t typecode; - uint16_t irq_mask; - uint8_t irq_info; - } __packed sr_irq; - struct { - uint8_t typecode; - uint8_t dma_chan; - uint8_t dma_info; - } __packed sr_dma; - struct { - uint8_t typecode; - uint8_t io_info; - uint16_t io_min; - uint16_t io_max; - uint8_t io_aln; - uint8_t io_len; - } __packed sr_ioport; - struct { - uint8_t typecode; - uint16_t fio_bas; - uint8_t fio_len; - } __packed sr_fioport; - - /* Large resource structures */ - struct { - uint8_t typecode; - uint16_t length; - uint8_t m24_info; - uint16_t m24_min; - uint16_t m24_max; - uint16_t m24_aln; - uint16_t m24_len; - } __packed lr_m24; - struct { - uint8_t typecode; - uint16_t length; - uint8_t m32_info; - uint32_t m32_min; - uint32_t m32_max; - uint32_t m32_aln; - uint32_t m32_len; - } __packed lr_m32; + struct { + uint8_t typecode; + uint16_t irq_mask; + uint8_t irq_info; + } __packed sr_irq; + struct { + uint8_t typecode; + uint8_t dma_chan; + uint8_t dma_info; + } __packed sr_dma; + struct { + uint8_t typecode; + uint8_t io_info; + uint16_t io_min; + uint16_t io_max; + uint8_t io_aln; + uint8_t io_len; + } __packed sr_ioport; + struct { + uint8_t typecode; + uint16_t fio_bas; + uint8_t fio_len; + } __packed sr_fioport; + + /* Large resource structures */ + struct { + uint8_t typecode; + uint16_t length; + uint8_t m24_info; + uint16_t m24_min; + uint16_t m24_max; + uint16_t m24_aln; + uint16_t m24_len; + } __packed lr_m24; + struct { + uint8_t typecode; + uint16_t length; + uint8_t m32_info; + uint32_t m32_min; + uint32_t m32_max; + uint32_t m32_aln; + uint32_t m32_len; + } __packed lr_m32; struct { uint8_t typecode; uint16_t length; @@ -170,16 +166,14 @@ union acpi_resource } __packed lr_extirq; } __packed; -#define AML_CRSTYPE(x) ((x)->hdr.typecode & 0x80 ? \ - (x)->hdr.typecode : \ -(x)->hdr.typecode >> 3) -#define AML_CRSLEN(x) ((x)->hdr.typecode & 0x80 ? \ - (x)->hdr.length+2 : \ -(x)->hdr.typecode & 0x7) +#define AML_CRSTYPE(x) ((x)->hdr.typecode & 0x80 ? \ + (x)->hdr.typecode : (x)->hdr.typecode >> 3) +#define AML_CRSLEN(x) ((x)->hdr.typecode & 0x80 ? \ + (x)->hdr.length+2 : (x)->hdr.typecode & 0x7) -int aml_print_resource(union acpi_resource *, void *); -int aml_parse_resource(int, uint8_t *, int (*)(union acpi_resource *, void *), - void *); +int aml_print_resource(union acpi_resource *, void *); +int aml_parse_resource(int, uint8_t *, + int (*)(union acpi_resource *, void *), void *); #define ACPI_E_NOERROR 0x00 #define ACPI_E_BADVALUE 0x01 @@ -194,11 +188,10 @@ int aml_parse_resource(int, uint8_t *, int (*)(union acpi_resource *, void *), #define AML_WALK_PRE 0x00 #define AML_WALK_POST 0x01 -void -aml_walknodes(struct aml_node *, int, - int (*)(struct aml_node *, void *), - void *); -void aml_postparse(void); +void aml_walknodes(struct aml_node *, int, + int (*)(struct aml_node *, void *), void *); + +void aml_postparse(void); #endif /* __DEV_ACPI_DSDT_H__ */ |