#ifndef _AML_OBJ_H_
#define _AML_OBJ_H_
#include <sys/queue.h>
struct aml_environ;
enum aml_objtype {
aml_t_namestr = -3,
aml_t_regfield,
aml_t_objref,
aml_t_null = 0,
aml_t_num,
aml_t_string,
aml_t_buffer,
aml_t_package,
aml_t_device,
aml_t_field,
aml_t_event,
aml_t_method,
aml_t_mutex,
aml_t_opregion,
aml_t_powerres,
aml_t_processor,
aml_t_therm,
aml_t_bufferfield,
aml_t_ddbhandle,
aml_t_debug
};
struct aml_namestr {
enum aml_objtype type;
u_int8_t *dp;
};
struct aml_opregion {
enum aml_objtype type;
int space;
int offset;
int length;
};
struct aml_num {
enum aml_objtype type;
int number;
int constant;
};
struct aml_package {
enum aml_objtype type;
int elements;
union aml_object **objects;
};
struct aml_string {
enum aml_objtype type;
int needfree;
u_int8_t *string;
};
struct aml_buffer {
enum aml_objtype type;
int size;
u_int8_t *data;
};
enum fieldtype {
f_t_field,
f_t_index,
f_t_bank
};
struct nfieldd {
enum fieldtype ftype;
u_int8_t *regname;
};
struct ifieldd {
enum fieldtype ftype;
u_int8_t *indexname;
u_int8_t *dataname;
};
struct bfieldd {
enum fieldtype ftype;
u_int8_t *regname;
u_int8_t *bankname;
u_int32_t bankvalue;
};
struct aml_field {
enum aml_objtype type;
u_int32_t flags;
int bitoffset;
int bitlen;
union {
enum fieldtype ftype;
struct nfieldd fld;
struct ifieldd ifld;
struct bfieldd bfld;
} f;
};
struct aml_bufferfield {
enum aml_objtype type;
int bitoffset;
int bitlen;
u_int8_t *origin;
};
struct aml_method {
enum aml_objtype type;
int argnum;
u_int8_t *from;
u_int8_t *to;
};
struct aml_powerres {
enum aml_objtype type;
int level;
int order;
};
struct aml_processor {
enum aml_objtype type;
int id;
int addr;
int len;
};
struct aml_mutex_queue {
STAILQ_ENTRY(aml_mutex_queue) entry;
};
struct aml_mutex {
enum aml_objtype type;
int level;
volatile void *cookie;
STAILQ_HEAD(, aml_mutex_queue) queue;
};
struct aml_objref {
enum aml_objtype type;
struct aml_name *nameref;
union aml_object *ref;
int offset;
unsigned deref;
unsigned alias;
};
struct aml_regfield {
enum aml_objtype type;
int space;
u_int32_t flags;
int offset;
int bitoffset;
int bitlen;
};
struct aml_event {
enum aml_objtype type;
int inuse;
};
union aml_object {
enum aml_objtype type;
struct aml_num num;
struct aml_processor proc;
struct aml_powerres pres;
struct aml_opregion opregion;
struct aml_method meth;
struct aml_field field;
struct aml_mutex mutex;
struct aml_namestr nstr;
struct aml_buffer buffer;
struct aml_bufferfield bfld;
struct aml_package package;
struct aml_string str;
struct aml_objref objref;
struct aml_event event;
struct aml_regfield regfield;
};
union aml_object *aml_copy_object(struct aml_environ *,
union aml_object *);
union aml_object *aml_alloc_object(enum aml_objtype,
union aml_object *);
void aml_free_objectcontent(union aml_object *);
void aml_free_object(union aml_object **);
void aml_realloc_object(union aml_object *, int);
#endif