Whitespace, spelling and comments cleanup. Try to bring this a little

closer to a consistent style without going totally overboard.  Preserve
the 8-space indents even though I loathe them.
This commit is contained in:
Mike Smith 2000-09-27 05:43:54 +00:00
parent 81a324e8b0
commit 13b19f6885
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=66402
3 changed files with 381 additions and 329 deletions

File diff suppressed because it is too large Load Diff

View File

@ -30,108 +30,137 @@
#ifndef _DEV_ACPI_ACPI_H_
#define _DEV_ACPI_ACPI_H_
/* PowerResource control */
/*
* PowerResource control
*/
struct acpi_powerres_device {
LIST_ENTRY(acpi_powerres_device) links;
struct aml_name *name;
struct aml_name *name;
/* _PR[0-2] */
/* _PR[0-2] */
u_int8_t state; /* D0 to D3 */
u_int8_t next_state; /* initialized with D0 */
#define ACPI_D_STATE_D0 0
#define ACPI_D_STATE_D1 1
#define ACPI_D_STATE_D2 2
#define ACPI_D_STATE_D3 3
#define ACPI_D_STATE_UNKNOWN 255
u_int8_t state; /* D0 to D3 */
u_int8_t next_state; /* initialized with D0 */
/* _PRW */
/* _PRW */
u_int8_t wake_cap; /* wake capability */
#define ACPI_D_WAKECAP_DISABLE 0
#define ACPI_D_WAKECAP_ENABLE 1
#define ACPI_D_WAKECAP_UNKNOWN 255
#define ACPI_D_WAKECAP_DEFAULT 1 /* XXX default enable for testing */
u_int8_t wake_cap; /* wake capability */
boolean_t gpe_enabled; /* GEPx_EN enabled/disabled */
union aml_object *prw_val[2]; /* elements of _PRW package */
#define ACPI_D_WAKECAP_DEFAULT 1 /* XXX default enable for testing */
boolean_t gpe_enabled; /* GEPx_EN enabled/disabled */
union aml_object *prw_val[2]; /* elements of _PRW package */
};
/* Device Power Management Chind Object Type */
#define ACPI_D_PM_TYPE_IRC 0 /* _IRC */
#define ACPI_D_PM_TYPE_PRW 1 /* _PRW */
#define ACPI_D_PM_TYPE_PRX 2 /* _PR0 - _PR2 */
/* Device Power Management Chained Object Type */
#define ACPI_D_PM_TYPE_IRC 0 /* _IRC */
#define ACPI_D_PM_TYPE_PRW 1 /* _PRW */
#define ACPI_D_PM_TYPE_PRX 2 /* _PR0 - _PR2 */
/* and more... */
struct acpi_powerres_device_ref {
LIST_ENTRY(acpi_powerres_device_ref) links;
struct acpi_powerres_device *device;
struct acpi_powerres_device *device;
};
struct acpi_powerres_info {
LIST_ENTRY(acpi_powerres_info) links;
struct aml_name *name;
struct aml_name *name;
u_int8_t state; /* OFF or ON */
#define ACPI_POWER_RESOURCE_ON 1
#define ACPI_POWER_RESOURCE_OFF 0
u_int8_t state; /* OFF or ON */
#define ACPI_PR_MAX 3 /* _PR[0-2] */
#define ACPI_PR_MAX 3 /* _PR[0-2] */
LIST_HEAD(, acpi_powerres_device_ref) reflist[ACPI_PR_MAX];
LIST_HEAD(, acpi_powerres_device_ref) prwlist;
};
/*Event Structure */
/*
* Event Structure
*/
struct acpi_event {
STAILQ_ENTRY (acpi_event) ae_q;
int ae_type;
#define ACPI_EVENT_TYPE_FIXEDREG 0
#define ACPI_EVENT_TYPE_GPEREG 1
#define ACPI_EVENT_TYPE_EC 2
int ae_type;
int ae_arg;
};
/* softc */
/*
* Softc
*/
typedef struct acpi_softc {
device_t dev;
dev_t dev_t;
device_t dev;
dev_t dev_t;
struct resource *port;
int port_rid;
int port_rid;
struct resource *irq;
int irq_rid;
void *irq_handle;
int irq_rid;
void *irq_handle;
struct ACPIsdt *rsdt;
struct ACPIsdt *facp;
struct FACPbody *facp_body;
struct ACPIsdt *dsdt;
struct FACS *facs;
int system_state;
int system_state_initialized;
int broken_wakeuplogic;
u_int32_t gpe0_mask;
u_int32_t gpe1_mask;
int enabled;
u_int32_t ignore_events;
struct acpi_system_state_package system_state_package;
struct proc *acpi_thread;
struct ACPIsdt *rsdt;
struct ACPIsdt *facp;
struct FACPbody *facp_body;
struct ACPIsdt *dsdt;
struct FACS *facs;
int system_state;
int system_state_initialized;
int broken_wakeuplogic;
u_int32_t gpe0_mask;
u_int32_t gpe1_mask;
int enabled;
u_int32_t ignore_events;
struct acpi_system_state_package system_state_package;
LIST_HEAD(, acpi_powerres_info) acpi_powerres_inflist;
LIST_HEAD(, acpi_powerres_device) acpi_powerres_devlist;
STAILQ_HEAD(, acpi_event) event;
struct proc *acpi_thread;
} acpi_softc_t;
/* Device State */
u_int8_t acpi_get_current_device_state(struct aml_name *);
void acpi_set_device_state(acpi_softc_t *, struct aml_name *,
u_int8_t);
void acpi_set_device_wakecap(acpi_softc_t *, struct aml_name *,
u_int8_t);
/*
* Device State
*/
extern u_int8_t acpi_get_current_device_state(struct aml_name *name);
extern void acpi_set_device_state(acpi_softc_t *sc, struct aml_name *name,
u_int8_t state);
extern void acpi_set_device_wakecap(acpi_softc_t *sc, struct aml_name *name,
u_int8_t cap);
/* PowerResource State */
void acpi_powerres_init(acpi_softc_t *);
void acpi_powerres_debug(acpi_softc_t *);
u_int8_t acpi_get_current_powerres_state(struct aml_name *);
void acpi_set_powerres_state(acpi_softc_t *, struct aml_name *,
u_int8_t);
void acpi_powerres_set_sleeping_state(acpi_softc_t *, u_int8_t);
/*
* PowerResource State
*/
extern void acpi_powerres_init(acpi_softc_t *sc);
extern void acpi_powerres_debug(acpi_softc_t *sc);
extern u_int8_t acpi_get_current_powerres_state(struct aml_name *name);
extern void acpi_set_powerres_state(acpi_softc_t *sc, struct aml_name *name,
u_int8_t state);
extern void acpi_powerres_set_sleeping_state(acpi_softc_t *sc, u_int8_t state);
/* GPE enable bit manipulation */
void acpi_gpe_enable_bit(acpi_softc_t *, u_int32_t, boolean_t);
/*
* GPE enable bit manipulation
*/
extern void acpi_gpe_enable_bit(acpi_softc_t *, u_int32_t, boolean_t);
/*
* Event queue
*/
extern void acpi_queue_event(acpi_softc_t *sc, int type, int arg);
/*
* Debugging, console output
*
* XXX this should really be using device_printf
*/
extern int acpi_debug;
#define ACPI_DEVPRINTF(args...) printf("acpi0: " args)
#define ACPI_DEBUGPRINT(args...) do { if (acpi_debug) ACPI_DEVPRINTF(args);} while(0)
/*Event queue*/
void acpi_queue_event(acpi_softc_t *, int, int);
#endif /* !_DEV_ACPI_ACPI_H_ */

View File

@ -61,10 +61,10 @@ static char *powerres_statestr[2] = {"_OFF", "_ON"};
u_int8_t
acpi_get_current_device_state(struct aml_name *name)
{
u_int8_t dstate;
struct aml_name *method;
union aml_object *ret;
struct aml_environ env;
u_int8_t dstate;
struct aml_name *method;
union aml_object *ret;
struct aml_environ env;
dstate = ACPI_D_STATE_D0;
method = aml_find_from_namespace(name, "_PSC");
@ -83,7 +83,7 @@ acpi_get_current_device_state(struct aml_name *name)
static __inline struct acpi_powerres_device *
acpi_powerres_get_powerres_device(acpi_softc_t *sc, struct aml_name *name)
{
struct acpi_powerres_device *device;
struct acpi_powerres_device *device;
LIST_FOREACH(device, &sc->acpi_powerres_devlist, links) {
if (device->name == name) {
@ -100,12 +100,12 @@ acpi_powerres_get_powerres_device(acpi_softc_t *sc, struct aml_name *name)
void
acpi_set_device_state(acpi_softc_t *sc, struct aml_name *name, u_int8_t dstate)
{
char psx[5]; /* "_PSx" */
struct acpi_powerres_info *powerres;
struct acpi_powerres_device_ref *device_ref;
struct acpi_powerres_device *device;
struct aml_name *method;
struct aml_environ env;
char psx[5]; /* "_PSx" */
struct acpi_powerres_info *powerres;
struct acpi_powerres_device_ref *device_ref;
struct acpi_powerres_device *device;
struct aml_name *method;
struct aml_environ env;
if (dstate > ACPI_D_STATE_D3) {
return;
@ -168,11 +168,11 @@ acpi_set_device_state(acpi_softc_t *sc, struct aml_name *name, u_int8_t dstate)
void
acpi_set_device_wakecap(acpi_softc_t *sc, struct aml_name *name, u_int8_t cap)
{
struct acpi_powerres_info *powerres;
struct acpi_powerres_device_ref *device_ref;
struct acpi_powerres_device *device;
struct aml_name *method;
union aml_object argv[1];
struct acpi_powerres_info *powerres;
struct acpi_powerres_device_ref *device_ref;
struct acpi_powerres_device *device;
struct aml_name *method;
union aml_object argv[1];
if (cap != ACPI_D_WAKECAP_ENABLE && cap != ACPI_D_WAKECAP_DISABLE ) {
return;
@ -233,10 +233,10 @@ acpi_set_device_wakecap(acpi_softc_t *sc, struct aml_name *name, u_int8_t cap)
u_int8_t
acpi_get_current_powerres_state(struct aml_name *name)
{
u_int8_t pstate;
struct aml_name *method;
union aml_object *ret;
struct aml_environ env;
u_int8_t pstate;
struct aml_name *method;
union aml_object *ret;
struct aml_environ env;
pstate = ACPI_POWER_RESOURCE_ON;
method = aml_find_from_namespace(name, "_STA");
@ -255,7 +255,7 @@ acpi_get_current_powerres_state(struct aml_name *name)
static __inline struct acpi_powerres_info *
acpi_powerres_get_powerres(acpi_softc_t *sc, struct aml_name *name)
{
struct acpi_powerres_info *powerres;
struct acpi_powerres_info *powerres;
LIST_FOREACH(powerres, &sc->acpi_powerres_inflist, links) {
if (powerres->name == name) {
@ -271,11 +271,11 @@ acpi_powerres_get_powerres(acpi_softc_t *sc, struct aml_name *name)
*/
void
acpi_set_powerres_state(acpi_softc_t *sc, struct aml_name *name,
u_int8_t pstate)
u_int8_t pstate)
{
struct acpi_powerres_info *powerres;
struct aml_name *method;
struct aml_environ env;
struct acpi_powerres_info *powerres;
struct aml_name *method;
struct aml_environ env;
if (pstate != ACPI_POWER_RESOURCE_ON &&
pstate != ACPI_POWER_RESOURCE_OFF) {
@ -305,10 +305,10 @@ acpi_set_powerres_state(acpi_softc_t *sc, struct aml_name *name,
void
acpi_powerres_init(acpi_softc_t *sc)
{
struct acpi_powerres_info *powerres;
struct acpi_powerres_device_ref *device_ref;
struct acpi_powerres_device *device;
int i;
struct acpi_powerres_info *powerres;
struct acpi_powerres_device_ref *device_ref;
struct acpi_powerres_device *device;
int i;
while ((powerres = LIST_FIRST(&sc->acpi_powerres_inflist))) {
for (i = 0; i < ACPI_PR_MAX; i++) {
@ -358,10 +358,10 @@ acpi_powerres_device_prw_print(struct acpi_powerres_device *device)
void
acpi_powerres_debug(acpi_softc_t *sc)
{
struct acpi_powerres_info *powerres;
struct acpi_powerres_device_ref *device_ref;
struct acpi_powerres_device *device;
int i;
struct acpi_powerres_info *powerres;
struct acpi_powerres_device_ref *device_ref;
struct acpi_powerres_device *device;
int i;
LIST_FOREACH(powerres, &sc->acpi_powerres_inflist, links) {
printf("acpi_powerres_debug[powerres]:");
@ -413,9 +413,9 @@ acpi_powerres_debug(acpi_softc_t *sc)
static int
acpi_powerres_register(struct aml_name *name, va_list ap)
{
int i, order;
acpi_softc_t *sc;
struct acpi_powerres_info *powerres, *other_pr, *last_pr;
int i, order;
acpi_softc_t *sc;
struct acpi_powerres_info *powerres, *other_pr, *last_pr;
sc = va_arg(ap, acpi_softc_t *);
@ -465,19 +465,20 @@ acpi_powerres_register(struct aml_name *name, va_list ap)
static int
acpi_powerres_add_device(struct aml_name *name, va_list ap)
{
int i, offset, objtype;
int prnum;
int dev_found;
acpi_softc_t *sc;
struct acpi_powerres_device *device;
struct acpi_powerres_device_ref *device_ref;
struct acpi_powerres_info *powerres;
struct aml_name *powerres_name;
struct aml_environ env;
union aml_object **objects;
int i, offset, objtype;
int prnum;
int dev_found;
acpi_softc_t *sc;
struct acpi_powerres_device *device;
struct acpi_powerres_device_ref *device_ref;
struct acpi_powerres_info *powerres;
struct aml_name *powerres_name;
struct aml_environ env;
union aml_object **objects;
sc = va_arg(ap, acpi_softc_t *);
objtype = prnum = 0;
/* should be _PR[0-2] or _PRW */
switch (name->name[3]) {
case '0' ... '2':
@ -610,7 +611,7 @@ acpi_powerres_add_device(struct aml_name *name, va_list ap)
static __inline void
acpi_set_device_prw_gpe(acpi_softc_t *sc, struct acpi_powerres_device *device,
boolean_t on_off)
boolean_t on_off)
{
u_long ef;
@ -632,9 +633,8 @@ acpi_set_device_prw_gpe(acpi_softc_t *sc, struct acpi_powerres_device *device,
}
static void
acpi_set_device_next_state(acpi_softc_t *sc,
struct acpi_powerres_device *device, u_int8_t sleeping_state,
u_int8_t def_dstate)
acpi_set_device_next_state(acpi_softc_t *sc, struct acpi_powerres_device *device,
u_int8_t sleeping_state, u_int8_t def_dstate)
{
/* set given default device state */
@ -669,10 +669,10 @@ acpi_set_device_next_state(acpi_softc_t *sc,
void
acpi_powerres_set_sleeping_state(acpi_softc_t *sc, u_int8_t state)
{
int i;
struct acpi_powerres_info *powerres;
struct acpi_powerres_device *device;
struct acpi_powerres_device_ref *device_ref;
int i;
struct acpi_powerres_info *powerres;
struct acpi_powerres_device *device;
struct acpi_powerres_device_ref *device_ref;
if (state > ACPI_S_STATE_S4) {
return;