summaryrefslogtreecommitdiff
path: root/sys/dev/acpi
diff options
context:
space:
mode:
authorMarco Peereboom <marco@cvs.openbsd.org>2006-03-08 04:05:02 +0000
committerMarco Peereboom <marco@cvs.openbsd.org>2006-03-08 04:05:02 +0000
commit2b53cb8465d2a0144e6b4b0ba868864eb62f031e (patch)
treefdfae2c47746cfd9c899a3473050436cd12b2c2f /sys/dev/acpi
parent1c7e0c8011b149a5fdf957fc76d43481cdd5c8da (diff)
KNF.
Undo emacsisms/jordanisms. Rearange protos and globals. This file needs more cleanup but this is a start.
Diffstat (limited to 'sys/dev/acpi')
-rw-r--r--sys/dev/acpi/dsdt.c1202
1 files changed, 638 insertions, 564 deletions
diff --git a/sys/dev/acpi/dsdt.c b/sys/dev/acpi/dsdt.c
index a2e2e01e2ec..60030f5a420 100644
--- a/sys/dev/acpi/dsdt.c
+++ b/sys/dev/acpi/dsdt.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dsdt.c,v 1.33 2006/03/07 23:13:28 marco Exp $ */
+/* $OpenBSD: dsdt.c,v 1.34 2006/03/08 04:05:01 marco Exp $ */
/*
* Copyright (c) 2005 Jordan Hargrave <jordan@openbsd.org>
*
@@ -56,132 +56,287 @@
#define aml_ipaddr(n) ((n)-aml_root.start)
#ifdef ACPI_DEBUG
-const char *opregion(int id);
+const char *opregion(int id);
const char *
opregion(int id)
{
switch(id) {
- case 0: return "SystemMemory";
- case 1: return "SystemIO";
- case 2: return "PCIConfig";
- case 3: return "Embedded";
- case 4: return "SMBus";
- case 5: return "CMOS";
- case 6: return "PCIBAR";
+ case 0:
+ return "SystemMemory";
+ case 1:
+ return "SystemIO";
+ case 2:
+ return "PCIConfig";
+ case 3:
+ return "Embedded";
+ case 4:
+ return "SMBus";
+ case 5:
+ return "CMOS";
+ case 6:
+ return "PCIBAR";
}
return "";
}
#endif
-int aml_parse_length(struct acpi_context *);
-u_int64_t aml_parse_int(struct acpi_context *, int);
-const char *aml_parse_string(struct acpi_context *);
-
-int aml_isnamedop(u_int16_t);
-
-void aml_shownode(struct aml_node *);
-
-u_int64_t aml_bcd2dec(u_int64_t);
-u_int64_t aml_dec2bcd(u_int64_t);
-int aml_lsb(u_int64_t);
-int aml_msb(u_int64_t);
-
-int _aml_freevalue(struct aml_value *);
-
-struct aml_node *aml_find_name(struct acpi_softc *, struct aml_node *, const char *);
-
-int64_t aml_str2int(const char *, int, int);
-int64_t aml_evalmath(u_int16_t, int64_t, int64_t);
-int aml_logicalcmp(u_int16_t, int64_t, int64_t);
-int aml_strcmp(u_int16_t opcode, const char *lhs, const char *rhs);
-
-int64_t _aml_evalint(struct acpi_context *, struct aml_node *);
-struct aml_value *aml_getnodevalue(struct acpi_context *, struct aml_node *);
-struct aml_value *_aml_evalref(struct acpi_context *, struct aml_node *);
-struct aml_value *aml_evalnode(struct acpi_context *, struct aml_node *);
-struct aml_value *_aml_setnodevalue(struct acpi_context *, struct aml_node *, struct aml_value *, u_int64_t);
-
-struct aml_node *aml_create_node(struct aml_node *,
- int, const char *,
- u_int8_t *);
-
-int aml_match(int64_t, int, int64_t);
-
-int aml_tstbit(const u_int8_t *, int);
-void aml_setbit(u_int8_t *, int, int);
-void aml_bufcpy(u_int8_t *, int, const u_int8_t *, int, int);
-int aml_bufcmp(const u_int8_t *, int, const u_int8_t *, int);
-
-struct aml_value *aml_ederef(struct acpi_context *ctx, struct aml_value *val);
-void aml_resizevalue(struct aml_value *, int);
-struct aml_value *aml_eparseval(struct acpi_context *, int deref);
-struct aml_opcode *aml_getopcode(struct acpi_context *);
-struct aml_value *aml_esetnodevalue(struct acpi_context *, struct aml_value *lhs,
- struct aml_value *rhs, int64_t rval);
-struct aml_value *aml_eparselist(struct acpi_context *, u_int8_t *end, int);
-
-struct aml_node *_aml_searchname(struct aml_node *, const char *);
-struct aml_node *aml_doname(struct aml_node *, const char *, int);
-struct aml_node *aml_createname(struct aml_node *, const char *);
-struct aml_value *aml_eparsescope(struct acpi_context *, const char *, u_int8_t *,
- struct aml_opcode *, struct aml_value *);
-struct aml_value *aml_efieldunit(struct acpi_context *, int opcode);
-struct aml_value *aml_ebufferfield(struct acpi_context *, int bitlen, int size, int opcode);
-struct aml_value *aml_efield(struct acpi_context *, struct aml_value *e_fld,
- struct aml_value *rhs);
-struct aml_node *aml_addvname(struct acpi_context *, const char *name, int opcode,
- struct aml_value *val);
-struct aml_value *aml_eparsenode(struct acpi_context *, struct aml_node *node);
-void aml_delchildren(struct acpi_context *, struct aml_node *node);
-
-int64_t aml_val2int(struct acpi_context *, struct aml_value *);
-struct aml_value *aml_val2buf(struct acpi_context *, struct aml_value *, int);
-
-struct aml_value *aml_domethod(struct acpi_context *, struct aml_value *,
- int, struct aml_value **);
-struct aml_value *aml_dowhile(struct acpi_context *);
-struct aml_value *aml_doif(struct acpi_context *);
-struct aml_value *aml_doloadtable(struct acpi_context *);
-struct aml_value *aml_domatch(struct acpi_context *);
-struct aml_value *aml_doconcat(struct acpi_context *);
-struct aml_value *aml_domid(struct acpi_context *);
-
-void *acpi_os_allocmem(size_t);
-void acpi_os_freemem(void *);
-
-void aml_addchildnode(struct aml_node *, struct aml_node *);
-
-const char *aml_opname(int);
-void aml_dump(int, u_int8_t *);
-
-struct aml_node aml_root;
-struct aml_value *aml_global_lock;
+const char *aml_opname(int);
+const char *aml_parse_string(struct acpi_context *);
+int _aml_freevalue(struct aml_value *);
+int aml_isnamedop(u_int16_t);
+int aml_logicalcmp(u_int16_t, int64_t, int64_t);
+int aml_lsb(u_int64_t);
+int aml_match(int64_t, int, int64_t);
+int aml_msb(u_int64_t);
+int aml_parse_length(struct acpi_context *);
+int aml_strcmp(u_int16_t, const char *, const char *);
+int aml_tstbit(const u_int8_t *, int);
+int64_t _aml_evalint(struct acpi_context *, struct aml_node *);
+int64_t aml_evalmath(u_int16_t, int64_t, int64_t);
+int64_t aml_str2int(const char *, int, int);
+int64_t aml_val2int(struct acpi_context *, struct aml_value *);
+struct aml_opcode *aml_getopcode(struct acpi_context *);
+struct aml_node *_aml_searchname(struct aml_node *, const char *);
+struct aml_node *aml_createname(struct aml_node *, const char *);
+struct aml_node *aml_doname(struct aml_node *, const char *, int);
+struct aml_value *_aml_evalref(struct acpi_context *, struct aml_node *);
+struct aml_value *aml_doconcat(struct acpi_context *);
+struct aml_value *aml_ebufferfield(struct acpi_context *, int, int, int);
+struct aml_value *aml_efieldunit(struct acpi_context *, int);
+struct aml_value *aml_doif(struct acpi_context *);
+struct aml_value *aml_doloadtable(struct acpi_context *);
+struct aml_value *aml_domatch(struct acpi_context *);
+struct aml_value *aml_dowhile(struct acpi_context *);
+struct aml_value *aml_domid(struct acpi_context *);
+struct aml_value *aml_ederef(struct acpi_context *, struct aml_value *);
+struct aml_value *aml_eparselist(struct acpi_context *, u_int8_t *, int);
+struct aml_value *aml_eparseval(struct acpi_context *, int);
+struct aml_value *aml_evalnode(struct acpi_context *, struct aml_node *);
+u_int64_t aml_bcd2dec(u_int64_t);
+u_int64_t aml_dec2bcd(u_int64_t);
+u_int64_t aml_parse_int(struct acpi_context *, int);
+void _aml_notify(struct aml_node *, void *);
+void *acpi_os_allocmem(size_t);
+void acpi_os_freemem(void *);
+void aml_addchildnode(struct aml_node *, struct aml_node *);
+void aml_bufcpy(u_int8_t *, int, const u_int8_t *, int, int);
+void aml_dump(int, u_int8_t *);
+void aml_resizevalue(struct aml_value *, int);
+void aml_setbit(u_int8_t *, int, int);
+void aml_shownode(struct aml_node *);
+
+struct aml_node *aml_addvname(struct acpi_context *, const char *, int,
+ struct aml_value *);
+int aml_bufcmp(const u_int8_t *, int, const u_int8_t *,
+ int);
+struct aml_node *aml_create_node(struct aml_node *, int, const char *,
+ u_int8_t *);
+struct aml_node *aml_find_name(struct acpi_softc *, struct aml_node *,
+ const char *);
+struct aml_value *_aml_setnodevalue(struct acpi_context *,
+ struct aml_node *, struct aml_value *, u_int64_t);
+struct aml_value *aml_domethod(struct acpi_context *, struct aml_value *,
+ int, struct aml_value **);
+struct aml_value *aml_efield(struct acpi_context *, struct aml_value *,
+ struct aml_value *);
+struct aml_value *aml_eparsenode(struct acpi_context *,
+ struct aml_node *);
+struct aml_value *aml_eparsescope(struct acpi_context *, const char *,
+ u_int8_t *, struct aml_opcode *,
+ struct aml_value *);
+struct aml_value *aml_esetnodevalue(struct acpi_context *,
+ struct aml_value *, struct aml_value *, int64_t);
+struct aml_value *aml_getnodevalue(struct acpi_context *,
+ struct aml_node *);
+struct aml_value *aml_val2buf(struct acpi_context *, struct aml_value *,
+ int);
+uint64_t aml_get_pciaddr(struct acpi_context *,
+ struct aml_node *);
+void aml_delchildren(struct acpi_context *,
+ struct aml_node *);
+
+
+struct aml_node aml_root;
+struct aml_value *aml_global_lock;
+
+struct aml_opcode aml_table[] = {
+ /* Simple types */
+ { AMLOP_ZERO, "Zero", "!" },
+ { AMLOP_ONE, "One", "!" },
+ { AMLOP_ONES, "Ones", "!" },
+ { AMLOP_BYTEPREFIX, "Byte", "b" },
+ { AMLOP_WORDPREFIX, "Word", "w" },
+ { AMLOP_DWORDPREFIX, "DWord", "d" },
+ { AMLOP_QWORDPREFIX, "QWord", "q" },
+ { AMLOP_REVISION, "Revision", "" },
+ { AMLOP_STRINGPREFIX, "String", "a" },
+ { AMLOP_DEBUG, "DebugOp", "", },
+ { AMLOP_BUFFER, "Buffer", "piB" },
+ { AMLOP_PACKAGE, "Package", "pbT" },
+ { AMLOP_VARPACKAGE, "VarPackage", "piT" },
+
+ /* Simple objects */
+ { AMLOP_LOCAL0, "Local0", "", },
+ { AMLOP_LOCAL1, "Local1", "", },
+ { AMLOP_LOCAL2, "Local2", "", },
+ { AMLOP_LOCAL3, "Local3", "", },
+ { AMLOP_LOCAL4, "Local4", "", },
+ { AMLOP_LOCAL5, "Local5", "", },
+ { AMLOP_LOCAL6, "Local6", "", },
+ { AMLOP_LOCAL7, "Local7", "", },
+ { AMLOP_ARG0, "Arg0", "", },
+ { AMLOP_ARG1, "Arg1", "", },
+ { AMLOP_ARG2, "Arg2", "", },
+ { AMLOP_ARG3, "Arg3", "", },
+ { AMLOP_ARG4, "Arg4", "", },
+ { AMLOP_ARG5, "Arg5", "", },
+ { AMLOP_ARG6, "Arg6", "", },
+
+ /* Control flow */
+ { AMLOP_IF, "If", "piT", },
+ { AMLOP_ELSE, "Else", "pT", },
+ { AMLOP_WHILE, "While", "piT", },
+ { AMLOP_BREAK, "Break", "", },
+ { AMLOP_CONTINUE, "Continue", "", },
+ { AMLOP_RETURN, "Return", "t", },
+ { AMLOP_FATAL, "Fatal", "bdi", },
+ { AMLOP_NOP, "Nop", "", },
+ { AMLOP_BREAKPOINT, "BreakPoint", "", },
+
+ /* Arithmetic operations */
+ { AMLOP_INCREMENT, "Increment", "t", },
+ { AMLOP_DECREMENT, "Decrement", "t", },
+ { AMLOP_ADD, "Add", "iit", },
+ { AMLOP_SUBTRACT, "Subtract", "iit", },
+ { AMLOP_MULTIPLY, "Multiply", "iit", },
+ { AMLOP_DIVIDE, "Divide", "iitt", },
+ { AMLOP_SHL, "ShiftLeft", "iit", },
+ { AMLOP_SHR, "ShiftRight", "iit", },
+ { AMLOP_AND, "And", "iit", },
+ { AMLOP_NAND, "Nand", "iit", },
+ { AMLOP_OR, "Or", "iit", },
+ { AMLOP_NOR, "Nor", "iit", },
+ { AMLOP_XOR, "Xor", "iit", },
+ { AMLOP_NOT, "Not", "it", },
+ { AMLOP_MOD, "Mod", "iit", },
+ { AMLOP_FINDSETLEFTBIT, "FindSetLeftBit", "it", },
+ { AMLOP_FINDSETRIGHTBIT, "FindSetRightBit", "it", },
+
+ /* Logical test operations */
+ { AMLOP_LAND, "LAnd", "ii", },
+ { AMLOP_LOR, "LOr", "ii", },
+ { AMLOP_LNOT, "LNot", "i", },
+ { AMLOP_LNOTEQUAL, "LNotEqual", "tt", },
+ { AMLOP_LLESSEQUAL, "LLessEqual", "tt", },
+ { AMLOP_LGREATEREQUAL, "LGreaterEqual", "tt", },
+ { AMLOP_LEQUAL, "LEqual", "tt", },
+ { AMLOP_LGREATER, "LGreater", "tt", },
+ { AMLOP_LLESS, "LLess", "tt", },
+
+ /* Named objects */
+ { AMLOP_NAMECHAR, "NameRef", "n" },
+ { AMLOP_ALIAS, "Alias", "nN", },
+ { AMLOP_NAME, "Name", "Nt", },
+ { AMLOP_EVENT, "Event", "N", },
+ { AMLOP_MUTEX, "Mutex", "Nb", },
+ { AMLOP_DATAREGION, "DataRegion", "Nttt" },
+ { AMLOP_OPREGION, "OpRegion", "Nbii" },
+ { AMLOP_SCOPE, "Scope", "pNT" },
+ { AMLOP_DEVICE, "Device", "pNT" },
+ { AMLOP_POWERRSRC, "Power Resource", "pNbwT" },
+ { AMLOP_THERMALZONE, "ThermalZone", "pNT" },
+ { AMLOP_PROCESSOR, "Processor", "pNbdbT", },
+ { AMLOP_METHOD, "Method", "pNfM", },
+
+ /* Field operations */
+ { AMLOP_FIELD, "Field", "pnfF" },
+ { AMLOP_INDEXFIELD, "IndexField", "pntfF" },
+ { AMLOP_BANKFIELD, "BankField", "pnnifF" },
+ { AMLOP_CREATEFIELD, "CreateField", "tiiN", },
+ { AMLOP_CREATEQWORDFIELD, "CreateQWordField","tiN", },
+ { AMLOP_CREATEDWORDFIELD, "CreateDWordField","tiN", },
+ { AMLOP_CREATEWORDFIELD, "CreateWordField", "tiN", },
+ { AMLOP_CREATEBYTEFIELD, "CreateByteField", "tiN", },
+ { AMLOP_CREATEBITFIELD, "CreateBitField", "tiN", },
+
+ /* Conversion operations */
+ { AMLOP_TOINTEGER, "ToInteger", "tt", },
+ { AMLOP_TOBUFFER, "ToBuffer", "tt", },
+ { AMLOP_TODECSTRING, "ToDecString", "it", },
+ { AMLOP_TOHEXSTRING, "ToHexString", "it", },
+ { AMLOP_TOSTRING, "ToString", "t", },
+ { AMLOP_FROMBCD, "FromBCD", "it", },
+ { AMLOP_TOBCD, "ToBCD", "it", },
+ { AMLOP_MID, "Mid", "tiit", },
+
+ /* Mutex/Signal operations */
+ { AMLOP_ACQUIRE, "Acquire", "tw", },
+ { AMLOP_RELEASE, "Release", "t", },
+ { AMLOP_SIGNAL, "Signal", "t", },
+ { AMLOP_WAIT, "Wait", "ti", },
+ { AMLOP_RESET, "Reset", "t", },
+
+ { AMLOP_INDEX, "Index", "tit", },
+ { AMLOP_DEREFOF, "DerefOf", "t", },
+ { AMLOP_REFOF, "RefOf", "t", },
+ { AMLOP_CONDREFOF, "CondRef", "tt", },
+
+ { AMLOP_LOADTABLE, "LoadTable", "tttttt" },
+ { AMLOP_STALL, "Stall", "i", },
+ { AMLOP_SLEEP, "Sleep", "i", },
+ { AMLOP_LOAD, "Load", "nt" },
+ { AMLOP_UNLOAD, "Unload", "t" },
+ { AMLOP_STORE, "Store", "tt", },
+ { AMLOP_CONCAT, "Concat", "ttt" },
+ { AMLOP_CONCATRES, "ConcatRes", "ttt" },
+ { AMLOP_NOTIFY, "Notify", "ti" },
+ { AMLOP_SIZEOF, "Sizeof", "t", },
+ { AMLOP_MATCH, "Match", "tbibii", },
+ { AMLOP_OBJECTTYPE, "ObjectType", "t", },
+ { AMLOP_COPYOBJECT, "CopyObject", "tt" },
+ { 0xFFFF }
+};
+
+struct aml_notify_data
+{
+ struct aml_node *node;
+ char pnpid[20];
+ void *cbarg;
+ int (*cbproc)(struct aml_node *, int, void *);
+
+ SLIST_ENTRY(aml_notify_data) link;
+};
+
+SLIST_HEAD(aml_notify_head, aml_notify_data);
+struct aml_notify_head aml_notify_list =
+ SLIST_HEAD_INITIALIZER(&aml_notify_list);
void *
acpi_os_allocmem(size_t size)
{
- void *ptr;
+ void *ptr;
ptr = malloc(size, M_DEVBUF, M_WAITOK);
if (ptr)
memset(ptr, 0, size);
- return ptr;
+
+ return (ptr);
}
void
acpi_os_freemem(void *ptr)
{
- //free(ptr, M_DEVBUF);
+ /* free(ptr, M_DEVBUF); */
}
void
aml_dump(int len, u_int8_t *buf)
{
- int idx;
+ int idx;
dnprintf(50, "{ ");
- for (idx=0; idx<len; idx++) {
+ for (idx = 0; idx < len; idx++) {
dnprintf(50, "%s0x%.2x", idx ? ", " : "", buf[idx]);
}
dnprintf(50, " }\n");
@@ -192,6 +347,7 @@ int
aml_tstbit(const u_int8_t *pb, int bit)
{
pb += aml_bytepos(bit);
+
return (*pb & aml_bitmask(bit));
}
@@ -199,56 +355,41 @@ void
aml_setbit(u_int8_t *pb, int bit, int val)
{
pb += aml_bytepos(bit);
- if (val) {
+
+ if (val)
*pb |= aml_bitmask(bit);
- }
- else {
+ else
*pb &= ~aml_bitmask(bit);
- }
}
-/*=====================================
- * This code handles AML notifications
- *=====================================*/
-struct aml_notify_data
-{
- struct aml_node *node;
- char pnpid[20];
- void *cbarg;
- int (*cbproc)(struct aml_node *, int, void *);
-
- SLIST_ENTRY(aml_notify_data) link;
-};
-
-SLIST_HEAD(aml_notify_head, aml_notify_data);
-struct aml_notify_head aml_notify_list =
- SLIST_HEAD_INITIALIZER(&aml_notify_list);
-
void
aml_register_notify(struct aml_node *node, const char *pnpid,
- int (*proc)(struct aml_node *, int, void *),
- void *arg)
+ int (*proc)(struct aml_node *, int, void *), void *arg)
{
- struct aml_notify_data *pdata;
+ struct aml_notify_data *pdata;
dnprintf(10, "aml_register_notify: %s %s %x\n",
node->name, pnpid ? pnpid : "", proc);
+
pdata = acpi_os_allocmem(sizeof(struct aml_notify_data));
pdata->node = node;
pdata->cbarg = arg;
pdata->cbproc = proc;
+
if (pnpid)
strlcpy(pdata->pnpid, pnpid, sizeof(pdata->pnpid));
+
SLIST_INSERT_HEAD(&aml_notify_list, pdata, link);
}
void
aml_notify(struct aml_node *node, int notify_value)
{
- struct aml_notify_data *pdata = NULL;
+ struct aml_notify_data *pdata = NULL;
if (node == NULL)
return;
+
SLIST_FOREACH(pdata, &aml_notify_list, link)
if (pdata->node == node)
pdata->cbproc(pdata->node, notify_value, pdata->cbarg);
@@ -257,18 +398,16 @@ aml_notify(struct aml_node *node, int notify_value)
void
aml_notify_dev(const char *pnpid, int notify_value)
{
- struct aml_notify_data *pdata = NULL;
+ struct aml_notify_data *pdata = NULL;
if (pnpid == NULL)
return;
- SLIST_FOREACH(pdata, &aml_notify_list, link) {
+
+ SLIST_FOREACH(pdata, &aml_notify_list, link)
if (pdata->pnpid && !strcmp(pdata->pnpid, pnpid))
pdata->cbproc(pdata->node, notify_value, pdata->cbarg);
- }
}
-void _aml_notify(struct aml_node *, void *);
-
void
_aml_notify(struct aml_node *node, void *arg)
{
@@ -276,10 +415,9 @@ _aml_notify(struct aml_node *node, void *arg)
}
void
-aml_addchildnode(struct aml_node *parent,
- struct aml_node *child)
+aml_addchildnode(struct aml_node *parent, struct aml_node *child)
{
- struct aml_node **tmp;
+ struct aml_node **tmp;
for (tmp = &parent->child; *tmp; tmp = &((*tmp)->sibling))
;
@@ -290,15 +428,15 @@ aml_addchildnode(struct aml_node *parent,
}
struct aml_node *
-aml_create_node(struct aml_node *parent, int opcode,
- const char *mnem, u_int8_t *start)
+aml_create_node(struct aml_node *parent, int opcode, const char *mnem,
+ u_int8_t *start)
{
- struct aml_node *node;
+ struct aml_node *node;
node = (struct aml_node *)acpi_os_allocmem(sizeof(struct aml_node));
- if (node == NULL) {
+ if (node == NULL)
return NULL;
- }
+
node->opcode = opcode;
node->mnem = mnem;
node->depth = parent->depth+1;
@@ -308,7 +446,7 @@ aml_create_node(struct aml_node *parent, int opcode,
aml_addchildnode(parent, node);
- return node;
+ return (node);
}
/* Allocate dynamic AML value
@@ -319,9 +457,9 @@ aml_create_node(struct aml_node *parent, int opcode,
struct aml_value *
aml_allocvalue(int type, int64_t ival, void *bval)
{
- struct aml_value *rv;
- struct aml_value **pv;
- int64_t idx;
+ struct aml_value *rv;
+ struct aml_value **pv;
+ int64_t idx;
rv = (struct aml_value *)acpi_os_allocmem(sizeof(struct aml_value));
rv->type = type;
@@ -334,8 +472,8 @@ aml_allocvalue(int type, int64_t ival, void *bval)
rv->v_objref.index = -1;
break;
case AML_OBJTYPE_OBJREF:
- rv->v_objref.index = ival;
- rv->v_objref.ref = (struct aml_value *)bval;
+ rv->v_objref.index = ival;
+ rv->v_objref.ref = (struct aml_value *)bval;
break;
case AML_OBJTYPE_STATICINT:
case AML_OBJTYPE_INTEGER:
@@ -347,9 +485,9 @@ aml_allocvalue(int type, int64_t ival, void *bval)
ival = strlen((const char *)bval);
rv->length = ival;
if (ival) {
- rv->v_string = acpi_os_allocmem(ival+1);
+ rv->v_string = acpi_os_allocmem(ival + 1);
if (bval)
- strncpy(rv->v_string, bval, ival);
+ strncpy(rv->v_string, bval, ival); /* XXX */
}
break;
case AML_OBJTYPE_BUFFER:
@@ -364,13 +502,13 @@ aml_allocvalue(int type, int64_t ival, void *bval)
case AML_OBJTYPE_PACKAGE:
/* Allocate package pointers */
rv->length = ival;
- rv->v_package = (struct aml_value **)acpi_os_allocmem(rv->length * sizeof(struct aml_value *));
+ rv->v_package = (struct aml_value **)acpi_os_allocmem(
+ rv->length * sizeof(struct aml_value *));
if (bval != NULL) {
pv = (struct aml_value **)bval;
dnprintf(40, "alloc package.. %lld\n", ival);
- for (idx=0; idx<ival; idx++) {
+ for (idx = 0; idx < ival; idx++)
rv->v_package[idx] = aml_copyvalue(pv[idx]);
- }
}
break;
case AML_OBJTYPE_METHOD:
@@ -391,7 +529,8 @@ aml_allocvalue(int type, int64_t ival, void *bval)
default:
dnprintf(40, "Unknown aml_allocvalue: %.2x\n", type);
}
- return rv;
+
+ return (rv);
}
struct aml_value *
@@ -409,17 +548,20 @@ aml_allocstr(const char *str)
int
_aml_freevalue(struct aml_value *v)
{
- int idx;
+ int idx;
/* Don't free static values */
if (v == NULL)
return (-1);
+
if (v->node || v->refcnt)
return (-1);
- dnprintf(50, "freeing value : %4x %s\n", v->type,
- v->node ? "attached" : "freeable");
- return -1;
+ dnprintf(50, "freeing value : %4x %s\n", v->type,
+ v->node ? "attached" : "freeable");
+
+ /* XXX */
+ return (-1);
switch (v->type) {
case AML_OBJTYPE_STRING:
@@ -435,9 +577,8 @@ _aml_freevalue(struct aml_value *v)
}
break;
case AML_OBJTYPE_PACKAGE:
- for (idx=0; idx<v->length; idx++) {
+ for (idx = 0; idx < v->length; idx++)
aml_freevalue(&v->v_package[idx]);
- }
acpi_os_freemem(v->v_package);
v->v_package = NULL;
break;
@@ -447,6 +588,7 @@ _aml_freevalue(struct aml_value *v)
}
v->length = 0;
v->type = 0;
+
return (0);
}
@@ -466,10 +608,13 @@ aml_showvalue(struct aml_value *value)
if (value == NULL)
return;
+
if (value->node)
dnprintf(50, "node:%.8x ", value->node);
+
if (value->name)
dnprintf(50, "name:%s ", value->name);
+
switch (value->type) {
case AML_OBJTYPE_OBJREF:
dnprintf(50, "refof: %x {\n", value->v_objref.index);
@@ -483,14 +628,14 @@ aml_showvalue(struct aml_value *value)
case AML_OBJTYPE_STATICINT:
case AML_OBJTYPE_INTEGER:
dnprintf(50, "integer: %llx %s\n", value->v_integer,
- (value->type == AML_OBJTYPE_STATICINT) ? "(static)" : "");
+ (value->type == AML_OBJTYPE_STATICINT) ? "(static)" : "");
break;
case AML_OBJTYPE_STRING:
dnprintf(50, "string: %s\n", value->v_string);
break;
case AML_OBJTYPE_PACKAGE:
dnprintf(50, "package: %d {\n", value->length);
- for (idx=0; idx<value->length; idx++)
+ for (idx = 0; idx < value->length; idx++)
aml_showvalue(value->v_package[idx]);
dnprintf(50, "}\n");
break;
@@ -512,41 +657,46 @@ aml_showvalue(struct aml_value *value)
break;
case AML_OBJTYPE_PROCESSOR:
dnprintf(50, "cpu: %x,%x,%x\n",
- value->v_processor.proc_id,
- value->v_processor.proc_addr,
- value->v_processor.proc_len);
+ value->v_processor.proc_id,
+ value->v_processor.proc_addr,
+ value->v_processor.proc_len);
break;
case AML_OBJTYPE_METHOD:
dnprintf(50, "method: args=%d, serialized=%d, synclevel=%d\n",
- AML_METHOD_ARGCOUNT(value->v_method.flags),
- AML_METHOD_SERIALIZED(value->v_method.flags),
- AML_METHOD_SYNCLEVEL(value->v_method.flags));
+ AML_METHOD_ARGCOUNT(value->v_method.flags),
+ AML_METHOD_SERIALIZED(value->v_method.flags),
+ AML_METHOD_SYNCLEVEL(value->v_method.flags));
break;
case AML_OBJTYPE_FIELDUNIT:
- dnprintf(50, "%s: access=%x,lock=%x,update=%x pos=%.4x len=%.4x\n",
- aml_opname(value->v_field.type),
- AML_FIELD_ACCESS(value->v_field.flags),
- AML_FIELD_LOCK(value->v_field.flags),
- AML_FIELD_UPDATE(value->v_field.flags),
- value->v_field.bitpos,
- value->v_field.bitlen);
+ dnprintf(50, "%s: access=%x,lock=%x,update=%x pos=%.4x "
+ "len=%.4x\n",
+ aml_opname(value->v_field.type),
+ AML_FIELD_ACCESS(value->v_field.flags),
+ AML_FIELD_LOCK(value->v_field.flags),
+ AML_FIELD_UPDATE(value->v_field.flags),
+ value->v_field.bitpos,
+ value->v_field.bitlen);
+
aml_showvalue(value->v_field.ref1);
aml_showvalue(value->v_field.ref2);
break;
case AML_OBJTYPE_BUFFERFIELD:
dnprintf(50, "%s: pos=%.4x len=%.4x ",
- aml_opname(value->v_field.type),
- value->v_field.bitpos,
- value->v_field.bitlen);
+ aml_opname(value->v_field.type),
+ value->v_field.bitpos,
+ value->v_field.bitlen);
+
aml_dump(aml_bytelen(value->v_field.bitlen),
- value->v_field.ref1->v_buffer+aml_bytepos(value->v_field.bitpos));
+ value->v_field.ref1->v_buffer +
+ aml_bytepos(value->v_field.bitpos));
+
aml_showvalue(value->v_field.ref1);
break;
case AML_OBJTYPE_OPREGION:
dnprintf(50, "opregion: %s,0x%llx,0x%x\n",
- opregion(value->v_opregion.iospace),
- value->v_opregion.iobase,
- value->v_opregion.iolen);
+ opregion(value->v_opregion.iospace),
+ value->v_opregion.iobase,
+ value->v_opregion.iolen);
break;
default:
dnprintf(50, "unknown: %d\n", value->type);
@@ -556,54 +706,48 @@ aml_showvalue(struct aml_value *value)
int
aml_comparevalue(struct acpi_context *ctx, int opcode, struct aml_value *lhs,
- struct aml_value *rhs)
+ struct aml_value *rhs)
{
- struct aml_value *tmp;
- int rc;
+ struct aml_value *tmp;
+ int rc;
+
+ if (lhs->type == AML_OBJTYPE_INTEGER)
+ return aml_logicalcmp(opcode, lhs->v_integer,
+ aml_val2int(ctx, rhs));
+
+ if (rhs->type == AML_OBJTYPE_INTEGER)
+ return aml_logicalcmp(opcode,
+ aml_val2int(ctx, lhs), rhs->v_integer);
- if (lhs->type == AML_OBJTYPE_INTEGER) {
- return aml_logicalcmp(opcode, lhs->v_integer, aml_val2int(ctx, rhs));
- }
- if (rhs->type == AML_OBJTYPE_INTEGER) {
- return aml_logicalcmp(opcode, aml_val2int(ctx, lhs), rhs->v_integer);
- }
if (lhs->type == AML_OBJTYPE_BUFFER) {
tmp = aml_val2buf(ctx, rhs, 0);
rc = aml_bufcmp(lhs->v_buffer, lhs->length,
- tmp->v_buffer, tmp->length);
+ tmp->v_buffer, tmp->length);
+
return (opcode == AMLOP_LNOTEQUAL) ?
- (rc != AMLOP_LEQUAL) :
- (rc == opcode);
+ (rc != AMLOP_LEQUAL) : (rc == opcode);
}
/* XXX: fix this.. non integer comparisons */
dnprintf(40,"comparevalue: %.2x %.2x\n", lhs->type, rhs->type);
- return 0;
+
+ return (0);
}
struct aml_value *
aml_copyvalue(const struct aml_value *rhs)
{
- struct aml_value *rv;
+ struct aml_value *rv;
switch (rhs->type) {
case AML_OBJTYPE_STATICINT:
case AML_OBJTYPE_INTEGER:
- return aml_allocvalue(rhs->type,
- rhs->v_integer,
- NULL);
+ return aml_allocvalue(rhs->type, rhs->v_integer, NULL);
case AML_OBJTYPE_STRING:
- return aml_allocvalue(rhs->type,
- rhs->length,
- rhs->v_string);
+ return aml_allocvalue(rhs->type, rhs->length, rhs->v_string);
case AML_OBJTYPE_BUFFER:
- return aml_allocvalue(rhs->type,
- rhs->length,
- rhs->v_buffer);
+ return aml_allocvalue(rhs->type, rhs->length, rhs->v_buffer);
case AML_OBJTYPE_PACKAGE:
- return aml_allocvalue(rhs->type,
- rhs->length,
- rhs->v_package);
-
+ return aml_allocvalue(rhs->type, rhs->length, rhs->v_package);
case AML_OBJTYPE_BUFFERFIELD:
case AML_OBJTYPE_FIELDUNIT:
rv = aml_allocvalue(rhs->type, 0, NULL);
@@ -612,7 +756,7 @@ aml_copyvalue(const struct aml_value *rhs)
rv->length = rhs->length;
rv->v_field = rhs->v_field;
}
- return rv;
+ return (rv);
default:
dnprintf(40,"copy unknown : %x\n", rhs->type);
@@ -620,16 +764,16 @@ aml_copyvalue(const struct aml_value *rhs)
*rv = *rhs;
break;
}
- return rv;
+ return (rv);
}
/* Resize buffer/string/package if out-of-bounds access */
void
aml_resizevalue(struct aml_value *pv, int newlen)
{
- struct aml_value **newpkg;
- u_int8_t *newbuf;
- int i1;
+ struct aml_value **newpkg;
+ u_int8_t *newbuf;
+ int i1;
++newlen;
dnprintf(40, "supersizeme\n");
@@ -646,12 +790,12 @@ aml_resizevalue(struct aml_value *pv, int newlen)
break;
case AML_OBJTYPE_PACKAGE:
- newpkg = (struct aml_value **)acpi_os_allocmem(newlen * sizeof(struct aml_value *));
+ newpkg = (struct aml_value **)acpi_os_allocmem(newlen *
+ sizeof(struct aml_value *));
/* Assign old package values */
- for (i1 = 0; i1 < pv->length; i1++) {
+ for (i1 = 0; i1 < pv->length; i1++)
newpkg[i1] = pv->v_package[i1];
- }
/* Free old package */
acpi_os_freemem(pv->v_package);
@@ -664,23 +808,22 @@ aml_resizevalue(struct aml_value *pv, int newlen)
}
}
-/*
- * AML Parsing routines
- */
+/* * AML Parsing routines */
const char *
aml_parse_string(struct acpi_context *ctx)
{
- const char *str = ctx->pos;
+ const char *str = ctx->pos;
- ctx->pos += strlen(str)+1;
- return str;
+ ctx->pos += strlen(str) + 1;
+
+ return (str);
}
/* Read value from AML bytestream */
u_int64_t
aml_parse_int(struct acpi_context *ctx, int size)
{
- u_int8_t *pc = ctx->pos;
+ u_int8_t *pc = ctx->pos;
switch (size) {
case AML_BYTE:
@@ -710,37 +853,38 @@ aml_parse_int(struct acpi_context *ctx, int size)
int
aml_parse_length(struct acpi_context *ctx)
{
- u_int8_t lcode;
- int ival;
+ u_int8_t lcode;
+ int ival;
lcode = aml_parse_int(ctx, AML_BYTE);
- if (lcode <= 0x3F) {
- return lcode;
- }
+ if (lcode <= 0x3f)
+ return (lcode);
- ival = lcode & 0xF;
- if (lcode >= 0x40) ival |= aml_parse_int(ctx, AML_BYTE) << 4;
- if (lcode >= 0x80) ival |= aml_parse_int(ctx, AML_BYTE) << 12;
- if (lcode >= 0xC0) ival |= aml_parse_int(ctx, AML_BYTE) << 20;
+ ival = lcode & 0xf;
+ if (lcode >= 0x40)
+ ival |= aml_parse_int(ctx, AML_BYTE) << 4;
+ if (lcode >= 0x80)
+ ival |= aml_parse_int(ctx, AML_BYTE) << 12;
+ if (lcode >= 0xc0)
+ ival |= aml_parse_int(ctx, AML_BYTE) << 20;
- return ival;
+ return (ival);
}
/* Decode AML Namestring from stream */
const char *
aml_parse_name(struct acpi_context *ctx)
{
- int count, pfxlen;
- char *name, *pn;
- u_int8_t *base;
+ int count, pfxlen;
+ char *name, *pn;
+ u_int8_t *base;
pfxlen = 0;
- if (ctx->pos[pfxlen] == AMLOP_ROOTCHAR) {
+ if (ctx->pos[pfxlen] == AMLOP_ROOTCHAR)
pfxlen++;
- }
- while (ctx->pos[pfxlen] == AMLOP_PARENTPREFIX) {
+
+ while (ctx->pos[pfxlen] == AMLOP_PARENTPREFIX)
pfxlen++;
- }
switch (ctx->pos[pfxlen]) {
case 0x00:
@@ -748,7 +892,7 @@ aml_parse_name(struct acpi_context *ctx)
base = ctx->pos + pfxlen + 1;
break;
case AMLOP_MULTINAMEPREFIX:
- count = ctx->pos[pfxlen+1];
+ count = ctx->pos[pfxlen + 1];
base = ctx->pos + pfxlen + 2;
break;
case AMLOP_DUALNAMEPREFIX:
@@ -781,7 +925,7 @@ aml_parse_name(struct acpi_context *ctx)
ctx->pos = base;
- return name;
+ return (name);
}
/* Is this opcode an encoded name? */
@@ -794,39 +938,38 @@ aml_isnamedop(u_int16_t opcode)
case AMLOP_MULTINAMEPREFIX:
case AMLOP_DUALNAMEPREFIX:
case AMLOP_NAMECHAR:
- case 'A' ... 'Z':
+ case 'A'...'Z':
return (1);
}
return (0);
}
-/*
- * Math eval routines
- */
+/* * Math eval routines */
u_int64_t
aml_bcd2dec(u_int64_t val)
{
- u_int64_t rval;
- int n, pos;
+ u_int64_t rval;
+ int n, pos;
pos = 1;
for (rval = 0; val; val >>= 4) {
- n = (val & 0xF);
+ n = (val & 0xf);
if (n > 9)
return (0);
rval += (n * pos);
pos *= 10;
}
- return rval;
+
+ return (rval);
}
u_int64_t
aml_dec2bcd(u_int64_t val)
{
- u_int64_t rval;
- int n, pos;
+ u_int64_t rval;
+ int n, pos;
pos = 0;
for (rval = 0; val; val /= 10) {
@@ -835,35 +978,38 @@ aml_dec2bcd(u_int64_t val)
rval += (n << pos);
pos += 4;
}
- return rval;
+
+ return (rval);
}
/* Calculate LSB */
int
aml_lsb(u_int64_t val)
{
- int lsb;
+ int lsb;
if (val == 0)
return (0);
for (lsb = 1; !(val & 0x1); lsb++)
val >>= 1;
- return lsb;
+
+ return (lsb);
}
/* Calculate MSB */
int
aml_msb(u_int64_t val)
{
- int msb;
+ int msb;
if (val == 0)
return (0);
for (msb = 1; val != 0x1; msb++)
val >>= 1;
- return msb;
+
+ return (msb);
}
/* Evaluate Math operands */
@@ -871,6 +1017,7 @@ int64_t
aml_evalmath(u_int16_t opcode, int64_t lhs, int64_t rhs)
{
dnprintf(50, "evalmath: %s %lld %lld\n", aml_opname(opcode), lhs, rhs);
+
switch (opcode) {
case AMLOP_INCREMENT:
case AMLOP_ADD:
@@ -919,7 +1066,9 @@ aml_evalmath(u_int16_t opcode, int64_t lhs, int64_t rhs)
int
aml_logicalcmp(u_int16_t opcode, int64_t lhs, int64_t rhs)
{
- dnprintf(50, "logicalcmp: %s %lld %lld\n", aml_opname(opcode), lhs, rhs);
+ dnprintf(50, "logicalcmp: %s %lld %lld\n",
+ aml_opname(opcode), lhs, rhs);
+
switch(opcode) {
case AMLOP_LAND:
return (lhs && rhs);
@@ -940,157 +1089,21 @@ aml_logicalcmp(u_int16_t opcode, int64_t lhs, int64_t rhs)
case AMLOP_LLESS:
return (lhs < rhs);
}
- return 0;
-}
-
-struct aml_opcode aml_table[] = {
- /* Simple types */
- { AMLOP_ZERO, "Zero", "!" },
- { AMLOP_ONE, "One", "!" },
- { AMLOP_ONES, "Ones", "!" },
- { AMLOP_BYTEPREFIX, "Byte", "b" },
- { AMLOP_WORDPREFIX, "Word", "w" },
- { AMLOP_DWORDPREFIX, "DWord", "d" },
- { AMLOP_QWORDPREFIX, "QWord", "q" },
- { AMLOP_REVISION, "Revision", "" },
- { AMLOP_STRINGPREFIX, "String", "a" },
- { AMLOP_DEBUG, "DebugOp", "", },
- { AMLOP_BUFFER, "Buffer", "piB" },
- { AMLOP_PACKAGE, "Package", "pbT" },
- { AMLOP_VARPACKAGE, "VarPackage", "piT" },
- /* Simple objects */
- { AMLOP_LOCAL0, "Local0", "", },
- { AMLOP_LOCAL1, "Local1", "", },
- { AMLOP_LOCAL2, "Local2", "", },
- { AMLOP_LOCAL3, "Local3", "", },
- { AMLOP_LOCAL4, "Local4", "", },
- { AMLOP_LOCAL5, "Local5", "", },
- { AMLOP_LOCAL6, "Local6", "", },
- { AMLOP_LOCAL7, "Local7", "", },
- { AMLOP_ARG0, "Arg0", "", },
- { AMLOP_ARG1, "Arg1", "", },
- { AMLOP_ARG2, "Arg2", "", },
- { AMLOP_ARG3, "Arg3", "", },
- { AMLOP_ARG4, "Arg4", "", },
- { AMLOP_ARG5, "Arg5", "", },
- { AMLOP_ARG6, "Arg6", "", },
-
- /* Control flow */
- { AMLOP_IF, "If", "piT", },
- { AMLOP_ELSE, "Else", "pT", },
- { AMLOP_WHILE, "While", "piT", },
- { AMLOP_BREAK, "Break", "", },
- { AMLOP_CONTINUE, "Continue", "", },
- { AMLOP_RETURN, "Return", "t", },
- { AMLOP_FATAL, "Fatal", "bdi", },
- { AMLOP_NOP, "Nop", "", },
- { AMLOP_BREAKPOINT, "BreakPoint", "", },
-
- /* Arithmetic operations */
- { AMLOP_INCREMENT, "Increment", "t", },
- { AMLOP_DECREMENT, "Decrement", "t", },
- { AMLOP_ADD, "Add", "iit", },
- { AMLOP_SUBTRACT, "Subtract", "iit", },
- { AMLOP_MULTIPLY, "Multiply", "iit", },
- { AMLOP_DIVIDE, "Divide", "iitt", },
- { AMLOP_SHL, "ShiftLeft", "iit", },
- { AMLOP_SHR, "ShiftRight", "iit", },
- { AMLOP_AND, "And", "iit", },
- { AMLOP_NAND, "Nand", "iit", },
- { AMLOP_OR, "Or", "iit", },
- { AMLOP_NOR, "Nor", "iit", },
- { AMLOP_XOR, "Xor", "iit", },
- { AMLOP_NOT, "Not", "it", },
- { AMLOP_MOD, "Mod", "iit", },
- { AMLOP_FINDSETLEFTBIT, "FindSetLeftBit", "it", },
- { AMLOP_FINDSETRIGHTBIT, "FindSetRightBit", "it", },
-
- /* Logical test operations */
- { AMLOP_LAND, "LAnd", "ii", },
- { AMLOP_LOR, "LOr", "ii", },
- { AMLOP_LNOT, "LNot", "i", },
- { AMLOP_LNOTEQUAL, "LNotEqual", "tt", },
- { AMLOP_LLESSEQUAL, "LLessEqual", "tt", },
- { AMLOP_LGREATEREQUAL, "LGreaterEqual", "tt", },
- { AMLOP_LEQUAL, "LEqual", "tt", },
- { AMLOP_LGREATER, "LGreater", "tt", },
- { AMLOP_LLESS, "LLess", "tt", },
-
- /* Named objects */
- { AMLOP_NAMECHAR, "NameRef", "n" },
- { AMLOP_ALIAS, "Alias", "nN", },
- { AMLOP_NAME, "Name", "Nt", },
- { AMLOP_EVENT, "Event", "N", },
- { AMLOP_MUTEX, "Mutex", "Nb", },
- { AMLOP_DATAREGION, "DataRegion", "Nttt" },
- { AMLOP_OPREGION, "OpRegion", "Nbii" },
- { AMLOP_SCOPE, "Scope", "pNT" },
- { AMLOP_DEVICE, "Device", "pNT" },
- { AMLOP_POWERRSRC, "Power Resource", "pNbwT" },
- { AMLOP_THERMALZONE, "ThermalZone", "pNT" },
- { AMLOP_PROCESSOR, "Processor", "pNbdbT", },
- { AMLOP_METHOD, "Method", "pNfM", },
-
- /* Field operations */
- { AMLOP_FIELD, "Field", "pnfF" },
- { AMLOP_INDEXFIELD, "IndexField", "pntfF" },
- { AMLOP_BANKFIELD, "BankField", "pnnifF" },
- { AMLOP_CREATEFIELD, "CreateField", "tiiN", },
- { AMLOP_CREATEQWORDFIELD, "CreateQWordField","tiN", },
- { AMLOP_CREATEDWORDFIELD, "CreateDWordField","tiN", },
- { AMLOP_CREATEWORDFIELD, "CreateWordField", "tiN", },
- { AMLOP_CREATEBYTEFIELD, "CreateByteField", "tiN", },
- { AMLOP_CREATEBITFIELD, "CreateBitField", "tiN", },
-
- /* Conversion operations */
- { AMLOP_TOINTEGER, "ToInteger", "tt", },
- { AMLOP_TOBUFFER, "ToBuffer", "tt", },
- { AMLOP_TODECSTRING, "ToDecString", "it", },
- { AMLOP_TOHEXSTRING, "ToHexString", "it", },
- { AMLOP_TOSTRING, "ToString", "t", },
- { AMLOP_FROMBCD, "FromBCD", "it", },
- { AMLOP_TOBCD, "ToBCD", "it", },
- { AMLOP_MID, "Mid", "tiit", },
-
- /* Mutex/Signal operations */
- { AMLOP_ACQUIRE, "Acquire", "tw", },
- { AMLOP_RELEASE, "Release", "t", },
- { AMLOP_SIGNAL, "Signal", "t", },
- { AMLOP_WAIT, "Wait", "ti", },
- { AMLOP_RESET, "Reset", "t", },
-
- { AMLOP_INDEX, "Index", "tit", },
- { AMLOP_DEREFOF, "DerefOf", "t", },
- { AMLOP_REFOF, "RefOf", "t", },
- { AMLOP_CONDREFOF, "CondRef", "tt", },
-
- { AMLOP_LOADTABLE, "LoadTable", "tttttt" },
- { AMLOP_STALL, "Stall", "i", },
- { AMLOP_SLEEP, "Sleep", "i", },
- { AMLOP_LOAD, "Load", "nt" },
- { AMLOP_UNLOAD, "Unload", "t" },
- { AMLOP_STORE, "Store", "tt", },
- { AMLOP_CONCAT, "Concat", "ttt" },
- { AMLOP_CONCATRES, "ConcatRes", "ttt" },
- { AMLOP_NOTIFY, "Notify", "ti" },
- { AMLOP_SIZEOF, "Sizeof", "t", },
- { AMLOP_MATCH, "Match", "tbibii", },
- { AMLOP_OBJECTTYPE, "ObjectType", "t", },
- { AMLOP_COPYOBJECT, "CopyObject", "tt" },
- { 0xFFFF }
-};
+ return (0);
+}
const char *
aml_opname(int opcode)
{
- struct aml_opcode *ptab = aml_table;
+ struct aml_opcode *ptab = aml_table;
- while (ptab->opcode != 0xFFFF) {
- if (ptab->opcode == opcode) return ptab->mnem;
+ while (ptab->opcode != 0xffff) {
+ if (ptab->opcode == opcode)
+ return ptab->mnem;
ptab++;
}
- return "";
+ return ("");
}
/* Extract opcode from AML bytestream
@@ -1098,10 +1111,11 @@ aml_opname(int opcode)
* Some opcodes are multibyte
* Name strings can also be embedded within the stream
*/
-struct aml_opcode *aml_getopcode(struct acpi_context *ctx)
+struct aml_opcode
+*aml_getopcode(struct acpi_context *ctx)
{
- struct aml_opcode *ptab;
- u_int16_t twocode, opcode;
+ struct aml_opcode *ptab;
+ u_int16_t twocode, opcode;
/* Check if this is a name object */
if (aml_isnamedop(*ctx->pos))
@@ -1119,12 +1133,14 @@ struct aml_opcode *aml_getopcode(struct acpi_context *ctx)
ctx->pos++;
}
}
- for (ptab = aml_table; ptab->opcode != 0xFFFF; ptab++) {
+
+ for (ptab = aml_table; ptab->opcode != 0xffff; ptab++)
if (ptab->opcode == opcode)
- return ptab;
- }
+ return (ptab);
+
dnprintf(40, "aml_getopcode: Unknown opcode %.4x\n", opcode);
- return NULL;
+
+ return (NULL);
}
/* Test AML_MATCH operation */
@@ -1132,66 +1148,81 @@ int
aml_match(int64_t lhs, int mtype, int64_t rhs)
{
switch (mtype) {
- case AML_MATCH_TR: return (1);
- case AML_MATCH_EQ: return (lhs == rhs);
- case AML_MATCH_LT: return (lhs < rhs);
- case AML_MATCH_LE: return (lhs <= rhs);
- case AML_MATCH_GE: return (lhs >= rhs);
- case AML_MATCH_GT: return (lhs > rhs);
+ case AML_MATCH_TR:
+ return (1);
+ case AML_MATCH_EQ:
+ return (lhs == rhs);
+ case AML_MATCH_LT:
+ return (lhs < rhs);
+ case AML_MATCH_LE:
+ return (lhs <= rhs);
+ case AML_MATCH_GE:
+ return (lhs >= rhs);
+ case AML_MATCH_GT:
+ return (lhs > rhs);
}
+
return (0);
}
struct aml_node *
aml_find_name(struct acpi_softc *sc, struct aml_node *root, const char *name)
{
- struct aml_node *ret;
- const char *sname;
+ struct aml_node *ret;
+ const char *sname;
if (*name == AMLOP_ROOTCHAR) {
root = &aml_root;
name++;
}
+
while (*name == AMLOP_PARENTPREFIX) {
- if (root) root = root->parent;
+ if (root)
+ root = root->parent;
name++;
}
+
if (root == NULL)
root = &aml_root;
- for (ret=NULL; root && !ret; root = root->sibling) {
+ for (ret = NULL; root && !ret; root = root->sibling) {
if ((sname = root->name) != NULL) {
if (*sname == AMLOP_ROOTCHAR)
sname++;
+
while (*sname == AMLOP_PARENTPREFIX)
sname++;
- if (!strcmp(name, sname)) {
- return root;
- }
+
+ if (!strcmp(name, sname))
+ return (root);
}
if (root->child)
ret = aml_find_name(sc, root->child, name);
}
- return ret;
+
+ return (ret);
}
int
aml_eval_name(struct acpi_softc *sc, struct aml_node *root, const char *name,
- struct aml_value *result, struct aml_value *env)
+ struct aml_value *result, struct aml_value *env)
{
root = aml_find_name(sc, root, name);
if (root != NULL) {
- dnprintf(50, "found eval object : %s, %.4x\n", root->name, root->opcode);
+ dnprintf(50, "found eval object : %s, %.4x\n",
+ root->name, root->opcode);
+
return aml_eval_object(sc, root, result, 0, env);
}
+
return (1);
}
int64_t
aml_str2int(const char *str, int len, int radix)
{
- int64_t rval, cb;
+ int64_t rval, cb;
rval = 0;
while (*str && len--) {
@@ -1203,28 +1234,30 @@ aml_str2int(const char *str, int len, int radix)
rval += (cb - 'a');
else if (cb >= '0' && cb <= '9')
rval += (cb - '0');
- else {
+ else
break;
- }
}
+
return rval;
}
-/* aml_bufcpy copies/shifts buffer data, special case for aligned transfers
- * dstPos/srcPos are bit positions within destination/source buffers
+/*
+ * aml_bufcpy copies/shifts buffer data, special case for aligned transfers
+ * dstPos/srcPos are bit positions within destination/source buffers
*/
void
aml_bufcpy(u_int8_t *pDst, int dstPos, const u_int8_t *pSrc, int srcPos,
- int len)
+ int len)
{
- int idx;
+ int idx;
if (aml_bytealigned(dstPos|srcPos|len)) {
/* Aligned transfer: use memcpy */
memcpy(pDst+aml_bytepos(dstPos), pSrc+aml_bytepos(srcPos), aml_bytelen(len));
return;
}
+
/* Misaligned transfer: perform bitwise copy */
for (idx = 0; idx < len; idx++)
aml_setbit(pDst, idx + dstPos, aml_tstbit(pSrc, idx + srcPos));
@@ -1234,7 +1267,7 @@ aml_bufcpy(u_int8_t *pDst, int dstPos, const u_int8_t *pSrc, int srcPos,
int
aml_bufcmp(const u_int8_t *abuf, int alen, const u_int8_t *bbuf, int blen)
{
- int rc;
+ int rc;
while (alen && blen) {
rc = *(abuf++) - *(bbuf++);
@@ -1243,53 +1276,59 @@ aml_bufcmp(const u_int8_t *abuf, int alen, const u_int8_t *bbuf, int blen)
alen--;
blen--;
}
- return (alen ? AMLOP_LGREATEREQUAL : (blen ? AMLOP_LLESSEQUAL : AMLOP_LEQUAL));
+ return (alen ? AMLOP_LGREATEREQUAL :
+ (blen ? AMLOP_LLESSEQUAL : AMLOP_LEQUAL));
}
-/* Search list of objects for a name match
- * Special case for fields: search children only
+/*
+ * Search list of objects for a name match
+ * Special case for fields: search children only
*/
-struct aml_node *_aml_searchname(struct aml_node *list, const char *name)
+struct aml_node *
+_aml_searchname(struct aml_node *list, const char *name)
{
- struct aml_node *child;
+ struct aml_node *child;
+
+ if (list == NULL)
+ return (NULL);
- if (list == NULL) {
- return NULL;
- }
while (list) {
if (list->opcode == AMLOP_FIELD ||
list->opcode == AMLOP_BANKFIELD ||
- list->opcode == AMLOP_INDEXFIELD) {
- if ((child = _aml_searchname(list->child, name)) != NULL) {
+ list->opcode == AMLOP_INDEXFIELD)
+ if ((child = _aml_searchname(list->child, name)) !=
+ NULL)
return child;
- }
- }
- if (list->name && !strncmp(list->name, name, AML_NAMESEG_LEN)) {
- return list;
- }
+
+ if (list->name && !strncmp(list->name, name, AML_NAMESEG_LEN))
+ return (list);
+
list = list->sibling;
}
- return NULL;
+
+ return (NULL);
}
/* Create name references in tree, even if not initialized */
-struct aml_node *aml_doname(struct aml_node *root, const char *name, int create)
+struct aml_node *
+aml_doname(struct aml_node *root, const char *name, int create)
{
- struct aml_node *tmp;
+ struct aml_node *tmp;
if (*name == AMLOP_ROOTCHAR) {
name++;
root = &aml_root;
}
+
while (*name == AMLOP_PARENTPREFIX) {
name++;
- if ((root = root->parent) == NULL) {
- return NULL;
- }
+ if ((root = root->parent) == NULL)
+ return (NULL);
}
- if (root == NULL) {
+
+ if (root == NULL)
root = &aml_root;
- }
+
if (*name && name[AML_NAMESEG_LEN] == '\0' && !create) {
do {
tmp = _aml_searchname(root->child, name);
@@ -1299,7 +1338,8 @@ struct aml_node *aml_doname(struct aml_node *root, const char *name, int create)
}
for (tmp = root; tmp && *name; name += AML_NAMESEG_LEN) {
- if (*name == '.') name++;
+ if (*name == '.')
+ name++;
tmp = _aml_searchname(root->child, name);
@@ -1307,111 +1347,117 @@ struct aml_node *aml_doname(struct aml_node *root, const char *name, int create)
if (tmp == NULL && create) {
tmp = aml_create_node(root, -1, "DUMMY", root->start);
if (tmp != NULL) {
- tmp->name = acpi_os_allocmem(AML_NAMESEG_LEN+1);
- if (tmp->name) {
- memcpy((char *)tmp->name, name, AML_NAMESEG_LEN);
- }
+ tmp->name = acpi_os_allocmem(
+ AML_NAMESEG_LEN + 1);
+ if (tmp->name)
+ memcpy((char *)tmp->name, name,
+ AML_NAMESEG_LEN);
}
}
root = tmp;
}
- return tmp;
+
+ return (tmp);
}
-struct aml_node *aml_createname(struct aml_node *root, const char *name)
+struct aml_node *
+aml_createname(struct aml_node *root, const char *name)
{
return aml_doname(root, name, 1);
}
-struct aml_node *aml_searchname(struct aml_node *root, const char *name)
+struct aml_node *
+aml_searchname(struct aml_node *root, const char *name)
{
return aml_doname(root, name, 0);
}
-struct aml_value *aml_ederef(struct acpi_context *ctx, struct aml_value *val)
+struct aml_value *
+aml_ederef(struct acpi_context *ctx, struct aml_value *val)
{
- struct aml_node *pn;
- struct aml_value *ref;
- int64_t i1;
+ struct aml_node *pn;
+ struct aml_value *ref;
+ int64_t i1;
- if (val == NULL) {
+ if (val == NULL)
return NULL;
- }
+
switch (val->type) {
case AML_OBJTYPE_NAMEREF:
- if (val->v_objref.ref == NULL) {
- if ((pn = aml_searchname(ctx->scope, val->name)) != NULL) {
+ if (val->v_objref.ref == NULL)
+ if ((pn = aml_searchname(ctx->scope, val->name)) !=
+ NULL)
val->v_objref.ref = pn->value;
- }
- }
- if (val->v_objref.ref != NULL) {
+
+ if (val->v_objref.ref != NULL)
return aml_ederef(ctx, val->v_objref.ref);
- }
- return NULL;
+
+ return (NULL);
case AML_OBJTYPE_OBJREF:
i1 = val->v_objref.index;
ref = aml_ederef(ctx, val->v_objref.ref);
- if (i1 == -1) {
+ if (i1 == -1)
return aml_ederef(ctx, ref);
- }
- if (i1 > ref->length) {
+
+ if (i1 > ref->length)
aml_resizevalue(ref, i1);
- }
+
switch (ref->type) {
case AML_OBJTYPE_PACKAGE:
if (ref->v_package[i1] == NULL) {
/* Lazy allocate package */
- dnprintf(40, "LazyPkg: %lld/%d\n", i1, ref->length);
- ref->v_package[i1] = aml_allocvalue(AML_OBJTYPE_UNINITIALIZED, 0, NULL);
+ dnprintf(40, "LazyPkg: %lld/%d\n", i1,
+ ref->length);
+ ref->v_package[i1] = aml_allocvalue(
+ AML_OBJTYPE_UNINITIALIZED, 0, NULL);
}
- return ref->v_package[i1];
+ return (ref->v_package[i1]);
case AML_OBJTYPE_BUFFER:
- return aml_allocvalue(AML_OBJTYPE_BUFFERFIELD, 8, ref->v_buffer+i1);
+ return aml_allocvalue(AML_OBJTYPE_BUFFERFIELD, 8,
+ ref->v_buffer+i1);
default:
dnprintf(50,"Unknown refof\n");
}
+
break;
}
- return val;
-}
-uint64_t
-aml_get_pciaddr(struct acpi_context *, struct aml_node *);
+ return (val);
+}
uint64_t
aml_get_pciaddr(struct acpi_context *ctx, struct aml_node *node)
{
- struct aml_node *pn;
- uint8_t bus, dev, fn;
- uint64_t ioaddr;
+ struct aml_node *pn;
+ uint8_t bus, dev, fn;
+ uint64_t ioaddr;
if ((pn = aml_searchname(node, "_ADR")) == NULL)
- return (0xFFFF);
+ return (0xffff);
/* _ADR holds <dev>:<fn> */
ioaddr = aml_val2int(ctx, pn->value);
- fn = ioaddr & 0xFFFF;
+ fn = ioaddr & 0xffff;
dev = ioaddr >> 16;
bus = 0;
- if ((pn = aml_searchname(node, "_BBN")) != NULL) {
- /* _BBN holds <bus> */
+ if ((pn = aml_searchname(node, "_BBN")) != NULL) /* _BBN holds <bus> */
bus = aml_val2int(ctx, pn->value);
- }
+
return ACPI_PCI_ADDR(bus, dev, fn, 0);
}
struct aml_value *
aml_efield(struct acpi_context *ctx, struct aml_value *e_fld,
- struct aml_value *rhs)
+ struct aml_value *rhs)
{
- struct aml_value *e_rgn;
- struct aml_value *rv;
- struct aml_value tmp;
- uint8_t *pb;
- uint64_t ioaddr;
- int blen;
+ struct aml_value *e_rgn;
+ struct aml_value *rv;
+ struct aml_value tmp;
+ uint8_t *pb;
+ uint64_t ioaddr;
+ int blen;
dnprintf(80, "efield %s: ", rhs ? "set" : "get");
aml_showvalue(e_fld);
@@ -1420,9 +1466,13 @@ aml_efield(struct acpi_context *ctx, struct aml_value *e_fld,
tmp.type = AML_OBJTYPE_INTEGER;
switch (e_fld->v_field.type) {
case AMLOP_INDEXFIELD:
- /* Set INDEX value to FIELD position byte, then write RHS to DATA */
+ /*
+ * Set INDEX value to FIELD position byte,
+ * then write RHS to DATA
+ */
if (!aml_bytealigned(e_fld->v_field.bitpos)) {
- dnprintf(40, "aml_efield: INDEXFIELD not byte-aligned..\n");
+ dnprintf(40, "aml_efield: INDEXFIELD not "
+ "byte-aligned..\n");
}
tmp.v_integer = aml_bytepos(e_fld->v_field.bitpos);
aml_efield(ctx, e_fld->v_field.ref1, &tmp);
@@ -1439,81 +1489,91 @@ aml_efield(struct acpi_context *ctx, struct aml_value *e_fld,
e_rgn = aml_ederef(ctx, e_fld->v_field.ref1);
if (e_rgn->type != AML_OBJTYPE_OPREGION) {
dnprintf(40, "aml_efield: Wrong FIELD type!\n");
- return NULL;
+ return (NULL);
}
- ioaddr = e_rgn->v_opregion.iobase + aml_bytepos(e_fld->v_field.bitpos);
+ ioaddr = e_rgn->v_opregion.iobase +
+ aml_bytepos(e_fld->v_field.bitpos);
blen = aml_bytelen(e_fld->v_field.bitlen);
- pb = acpi_os_allocmem(blen+8); // padded space
+ pb = acpi_os_allocmem(blen+8); /* padded space */
if (rhs == NULL) {
rv = aml_allocvalue(AML_OBJTYPE_BUFFER, blen, NULL);
- /* Read field
- * XXX: don't need pb if aligned
- */
+ /* Read field XXX don't need pb if aligned */
if (aml_valid(rv)) {
if (AML_FIELD_LOCK(e_fld->v_field.flags)) {
- acpi_mutex_acquire(ctx, aml_global_lock, -1);
+ acpi_mutex_acquire(ctx,
+ aml_global_lock, -1);
}
acpi_gasio(ctx->sc, ACPI_IOREAD,
- e_rgn->v_opregion.iospace, ioaddr,
- AML_FIELD_ACCESS(e_fld->v_field.flags),
- blen, pb);
+ e_rgn->v_opregion.iospace, ioaddr,
+ AML_FIELD_ACCESS(e_fld->v_field.flags),
+ blen, pb);
+
if (AML_FIELD_LOCK(e_fld->v_field.flags)) {
- acpi_mutex_release(ctx, aml_global_lock);
+ acpi_mutex_release(ctx,
+ aml_global_lock);
}
}
if (pb != rv->v_buffer) {
- aml_bufcpy(rv->v_buffer, 0,
- pb, e_fld->v_field.bitpos,
- e_fld->v_field.bitlen);
+ aml_bufcpy(rv->v_buffer, 0, pb,
+ e_fld->v_field.bitpos,
+ e_fld->v_field.bitlen);
+
acpi_os_freemem(pb);
}
- return rv;
+ return (rv);
}
/* Write field */
if (AML_FIELD_LOCK(e_fld->v_field.flags)) {
acpi_mutex_acquire(ctx, aml_global_lock, -1);
}
+
switch (AML_FIELD_UPDATE(e_fld->v_field.flags)) {
case AML_FIELD_PRESERVE:
#if 0
/* XXX: fix length, don't read if whole length */
dnprintf(40, "old iobase = %llx,%lx\n",
- e_rgn->v_opregion.iobase, aml_bytepos(e_fld->v_field.bitpos));
+ e_rgn->v_opregion.iobase,
+ aml_bytepos(e_fld->v_field.bitpos));
+
acpi_gasio(ctx->sc, ACPI_IOREAD,
- e_rgn->v_opregion.iospace, ioaddr,
- AML_FIELD_ACCESS(e_fld->v_field.flags),
- blen, pb);
+ e_rgn->v_opregion.iospace, ioaddr,
+ AML_FIELD_ACCESS(e_fld->v_field.flags),
+ blen, pb);
#if 0
aml_showvalue(rv);
#endif
#endif
break;
case AML_FIELD_WRITEASONES:
- memset(pb, 0xFF, blen+8);
+ memset(pb, 0xff, blen + 8);
break;
case AML_FIELD_WRITEASZEROES:
- memset(pb, 0x00, blen+8);
+ memset(pb, 0x00, blen + 8);
break;
}
+
rv = aml_val2buf(ctx, rhs, blen);
- aml_bufcpy(pb, e_fld->v_field.bitpos,
- rv->v_buffer, 0,
- e_fld->v_field.bitlen);
- if (rv != rhs) {
+ aml_bufcpy(pb, e_fld->v_field.bitpos, rv->v_buffer, 0,
+ e_fld->v_field.bitlen);
+
+ if (rv != rhs)
aml_freevalue(&rv);
- }
+
acpi_gasio(ctx->sc, ACPI_IOWRITE,
- e_rgn->v_opregion.iospace,
- e_rgn->v_opregion.iobase + aml_bytepos(e_fld->v_field.bitpos),
- AML_FIELD_ACCESS(e_fld->v_field.flags),
- blen, pb);
+ e_rgn->v_opregion.iospace,
+ e_rgn->v_opregion.iobase +
+ aml_bytepos(e_fld->v_field.bitpos),
+ AML_FIELD_ACCESS(e_fld->v_field.flags),
+ blen, pb);
+
if (AML_FIELD_LOCK(e_fld->v_field.flags)) {
acpi_mutex_release(ctx, aml_global_lock);
}
+
acpi_os_freemem(pb);
break;
default:
@@ -1521,71 +1581,77 @@ aml_efield(struct acpi_context *ctx, struct aml_value *e_fld,
e_rgn = aml_ederef(ctx, e_fld->v_field.ref1);
if (e_rgn->type != AML_OBJTYPE_BUFFER) {
dnprintf(40, "aml_efield: Wrong type!\n");
- return NULL;
+ return (NULL);
}
+
blen = aml_bytelen(e_fld->v_field.bitlen);
if (rhs == NULL) {
/* Read buffer */
rv = aml_allocvalue(AML_OBJTYPE_BUFFER, blen, NULL);
- if (aml_valid(rv)) {
+ if (aml_valid(rv))
aml_bufcpy(rv->v_buffer, 0,
- e_rgn->v_buffer, e_fld->v_field.bitpos,
- e_fld->v_field.bitlen);
- }
- return rv;
+ e_rgn->v_buffer, e_fld->v_field.bitpos,
+ e_fld->v_field.bitlen);
+ return (rv);
}
/* Write buffer */
rv = aml_val2buf(ctx, rhs, blen);
aml_bufcpy(e_rgn->v_buffer, e_fld->v_field.bitpos,
- rv->v_buffer, 0,
- e_fld->v_field.bitlen);
- if (rv != rhs) {
+ rv->v_buffer, 0,
+ e_fld->v_field.bitlen);
+
+ if (rv != rhs)
aml_freevalue(&rv);
- }
break;
}
- return NULL;
+
+ return (NULL);
}
struct aml_value *
aml_val2buf(struct acpi_context *ctx, struct aml_value *oval, int mlen)
{
- struct aml_value *pb, *val;
+ struct aml_value *pb, *val;
if (val == NULL)
- return NULL;
+ return (NULL);
val = aml_ederef(ctx, oval);
switch (val->type) {
case AML_OBJTYPE_BUFFER:
- if (mlen < val->length) {
+ if (mlen < val->length)
mlen = val->length;
- }
+
pb = aml_allocvalue(AML_OBJTYPE_BUFFER, mlen, NULL);
- if (val->v_buffer && val->length) {
+ if (val->v_buffer && val->length)
memcpy(pb->v_buffer, val->v_buffer, val->length);
- }
- return pb;
+
+ return (pb);
+
case AML_OBJTYPE_BUFFERFIELD:
case AML_OBJTYPE_FIELDUNIT:
return aml_efield(ctx, val, NULL);
+
case AML_OBJTYPE_STATICINT:
case AML_OBJTYPE_INTEGER:
return aml_allocvalue(AML_OBJTYPE_BUFFER, 8, &val->v_integer);
+
case AML_OBJTYPE_STRING:
- return aml_allocvalue(AML_OBJTYPE_BUFFER, val->length, val->v_string);
+ return aml_allocvalue(AML_OBJTYPE_BUFFER, val->length,
+ val->v_string);
+
default:
dnprintf(40, "Unknown val2buf : %d\n", val->type);
- return NULL;
+ return (NULL);
}
}
int64_t
aml_val2int(struct acpi_context *ctx, struct aml_value *val)
{
- struct aml_value *pb;
- int64_t rval;
+ struct aml_value *pb;
+ int64_t rval;
pb = NULL;
if (val == NULL) {
@@ -1595,43 +1661,51 @@ aml_val2int(struct acpi_context *ctx, struct aml_value *val)
rval = 0;
switch (val->type) {
case AML_OBJTYPE_BUFFER:
- if (val->length < 8) {
+ if (val->length < 8)
memcpy(&rval, val->v_buffer, val->length);
- }
- return rval;
+ return (rval);
+
case AML_OBJTYPE_STATICINT:
case AML_OBJTYPE_INTEGER:
- return val->v_integer;
+ return (val->v_integer);
+
case AML_OBJTYPE_STRING:
if (val->v_string != NULL) {
if (!strncmp(val->v_string, "0x", 2))
- rval = aml_str2int(val->v_string+2, val->length, 16);
+ rval = aml_str2int(val->v_string + 2,
+ val->length, 16);
else
- rval = aml_str2int(val->v_string, val->length, 10);
+ rval = aml_str2int(val->v_string,
+ val->length, 10);
}
- return rval;
+ return (rval);
+
case AML_OBJTYPE_NAMEREF:
case AML_OBJTYPE_OBJREF:
- if (ctx == NULL) return 0;
+ if (ctx == NULL)
+ return (0);
pb = aml_ederef(ctx, val);
break;
case AML_OBJTYPE_BUFFERFIELD:
case AML_OBJTYPE_FIELDUNIT:
- if (ctx == NULL) return 0;
+ if (ctx == NULL)
+ return (0);
pb = aml_efield(ctx, val, NULL);
break;
case AML_OBJTYPE_METHOD:
- if (ctx == NULL) return 0;
+ if (ctx == NULL)
+ return 0;
pb = aml_domethod(ctx, val, -1, NULL);
break;
default:
dnprintf(40, "Unknown val2int: %x\n", val->type);
break;
}
- if (pb != NULL) {
+
+ if (pb != NULL)
return aml_val2int(ctx, pb);
- }
- return 0x00;
+
+ return (0);
}
struct aml_node *