-/* $OpenBSD: dsdt.c,v 1.170 2010/07/21 15:07:40 deraadt Exp $ */
+/* $OpenBSD: dsdt.c,v 1.171 2010/07/21 19:35:15 deraadt Exp $ */
/*
* Copyright (c) 2005 Jordan Hargrave <jordan@openbsd.org>
*
#define AML_INTSTRLEN 16
#define AML_NAMESEG_LEN 4
-struct acpi_q *acpi_maptable(struct acpi_softc *sc, paddr_t,
- const char *, const char *,
- const char *, int);
-struct aml_scope *aml_load(struct acpi_softc *, struct aml_scope *,
- struct aml_value *, struct aml_value *);
+struct acpi_q *acpi_maptable(struct acpi_softc *sc, paddr_t,
+ const char *, const char *,
+ const char *, int);
+struct aml_scope *aml_load(struct acpi_softc *, struct aml_scope *,
+ struct aml_value *, struct aml_value *);
void aml_copyvalue(struct aml_value *, struct aml_value *);
#ifndef SMALL_KERNEL
struct aml_scope *root;
struct aml_value *sp;
-
int idx;
#endif /* SMALL_KERNEL */
va_list ap;
int i;
/* Dynamically allocate hash table */
- aml_ophash = (struct aml_opcode **)acpi_os_malloc(HASH_SIZE*sizeof(struct aml_opcode *));
+ aml_ophash = (struct aml_opcode **)acpi_os_malloc(HASH_SIZE *
+ sizeof(struct aml_opcode *));
for (i = 0; i < sizeof(aml_table) / sizeof(aml_table[0]); i++)
aml_ophash[HASH_KEY(aml_table[i].opcode)] = &aml_table[i];
}
sptr = &(((struct acpi_memblock *)ptr)[-1]);
acpi_nalloc -= sptr->size;
-#ifdef ACPI_MEMDEBUG
+#ifdef ACPI_MEMDEBUG
LIST_REMOVE(sptr, link);
#endif
long acpi_acquire_global_lock(void*);
long acpi_release_global_lock(void*);
static long global_lock_count = 0;
-#define acpi_acquire_global_lock(x) 1
+#define acpi_acquire_global_lock(x) 1
#define acpi_release_global_lock(x) 0
void
aml_lockfield(struct aml_scope *scope, struct aml_value *field)
break;
case AMLOP_MULTINAMEPREFIX:
for (i=0; i<pos[1]; i++)
- node = __aml_search(node, pos+2+i*AML_NAMESEG_LEN,
+ node = __aml_search(node, pos+2+i*AML_NAMESEG_LEN,
create);
pos += 2+i*AML_NAMESEG_LEN;
break;
}
aml_xaddref(*rval, 0);
- dnprintf(10, "parsename: %s %x\n", aml_nodename(node),
+ dnprintf(10, "parsename: %s %x\n", aml_nodename(node),
(*rval)->type);
} else {
*rval = aml_allocvalue(AML_OBJTYPE_NAMEREF, 0, start);
- dnprintf(10, "%s:%s not found\n", aml_nodename(inode),
+ dnprintf(10, "%s:%s not found\n", aml_nodename(inode),
aml_getname(start));
}
{ "_REV", AML_OBJTYPE_INTEGER, 2, NULL },
{ "_GL", AML_OBJTYPE_MUTEX, 1, NULL, &aml_global_lock },
{ "_OSI", AML_OBJTYPE_METHOD, 1, aml_callosi },
-
+
/* Create default scopes */
{ "_GPE" },
{ "_PR_" },
}
/*
- * XXX: NEW PARSER CODE GOES HERE
+ * XXX: NEW PARSER CODE GOES HERE
*/
int aml_error;
struct aml_value *aml_gettgt(struct aml_value *, int);
struct aml_value *aml_xeval(struct aml_scope *, struct aml_value *, int, int,
struct aml_value *);
-struct aml_value *aml_xparsesimple(struct aml_scope *, char,
+struct aml_value *aml_xparsesimple(struct aml_scope *, char,
struct aml_value *);
struct aml_value *aml_xparse(struct aml_scope *, int, const char *);
struct aml_value *aml_seterror(struct aml_scope *, const char *, ...);
struct aml_scope *aml_xfindscope(struct aml_scope *, int, int);
-struct aml_scope *aml_xpushscope(struct aml_scope *, struct aml_value *,
+struct aml_scope *aml_xpushscope(struct aml_scope *, struct aml_value *,
struct aml_node *, int);
struct aml_scope *aml_xpopscope(struct aml_scope *);
struct aml_value *aml_xmid(struct aml_value *, int, int);
int aml_ccrlen(union acpi_resource *, void *);
-void aml_xstore(struct aml_scope *, struct aml_value *, int64_t,
+void aml_xstore(struct aml_scope *, struct aml_value *, int64_t,
struct aml_value *);
int
return (0);
if (acpi_checksum(hdr, hdr->length) != 0)
return (0);
- return (1);
+ return (1);
}
/*
{
if (val == NULL)
return;
- dnprintf(50, "XAddRef: %p %s:[%s] %d\n",
+ dnprintf(50, "XAddRef: %p %s:[%s] %d\n",
val, lbl,
val->node ? aml_nodename(val->node) : "INTERNAL",
val->refcnt);
val = *pv;
val->refcnt--;
if (val->refcnt == 0) {
- dnprintf(50, "XDelRef: %p %s %2d [%s] %s\n",
+ dnprintf(50, "XDelRef: %p %s %2d [%s] %s\n",
val, lbl,
val->refcnt,
val->node ? aml_nodename(val->node) : "INTERNAL",
struct aml_scope *
aml_xfindscope(struct aml_scope *scope, int type, int endscope)
{
- while (scope) {
+ while (scope) {
switch (endscope) {
case AMLOP_RETURN:
scope->pos = scope->end;
struct aml_value *
aml_getstack(struct aml_scope *scope, int opcode)
{
- struct aml_value *sp;
+ struct aml_value *sp;
sp = NULL;
scope = aml_xfindscope(scope, AMLOP_METHOD, 0);
sp = scope->locals->v_package[opcode - AMLOP_LOCAL0];
sp->stack = opcode;
} else if (opcode >= AMLOP_ARG0 && opcode <= AMLOP_ARG6) {
- if (scope->args == NULL)
+ if (scope->args == NULL)
scope->args = aml_allocvalue(AML_OBJTYPE_PACKAGE, 7, NULL);
sp = scope->args->v_package[opcode - AMLOP_ARG0];
if (sp->type == AML_OBJTYPE_OBJREF)
#ifdef ACPI_DEBUG
/* Dump AML Stack */
-void
+void
aml_showstack(struct aml_scope *scope)
{
struct aml_value *sp;
int idx;
- dnprintf(10, "===== Stack %s:%s\n", aml_nodename(scope->node),
+ dnprintf(10, "===== Stack %s:%s\n", aml_nodename(scope->node),
aml_mnem(scope->type, 0));
for (idx=0; scope->args && idx<7; idx++) {
sp = aml_getstack(scope, AMLOP_ARG0+idx);
while (index < pkg->length) {
/* Convert package value to integer */
- tmp = aml_xconvert(pkg->v_package[index],
+ tmp = aml_xconvert(pkg->v_package[index],
AML_OBJTYPE_INTEGER, -1);
/* Perform test */
- flag = aml_xmatchtest(tmp->v_integer, v1, op1) &&
+ flag = aml_xmatchtest(tmp->v_integer, v1, op1) &&
aml_xmatchtest(tmp->v_integer, v2, op2);
aml_xdelref(&tmp, "xmatch");
dnprintf(10,"convert to buffer\n");
switch (a->type) {
case AML_OBJTYPE_INTEGER:
- c = aml_allocvalue(AML_OBJTYPE_BUFFER, a->length,
+ c = aml_allocvalue(AML_OBJTYPE_BUFFER, a->length,
&a->v_integer);
break;
case AML_OBJTYPE_STRING:
- c = aml_allocvalue(AML_OBJTYPE_BUFFER, a->length,
+ c = aml_allocvalue(AML_OBJTYPE_BUFFER, a->length,
a->v_string);
break;
}
switch (a->type) {
case AML_OBJTYPE_BUFFER:
c = aml_allocvalue(AML_OBJTYPE_INTEGER, 0, NULL);
- memcpy(&c->v_integer, a->v_buffer,
+ memcpy(&c->v_integer, a->v_buffer,
min(a->length, c->length));
break;
case AML_OBJTYPE_STRING:
switch (a->type) {
case AML_OBJTYPE_INTEGER:
c = aml_allocvalue(AML_OBJTYPE_STRING, 20, NULL);
- snprintf(c->v_string, c->length, (ctype == AML_OBJTYPE_HEXSTRING) ?
+ snprintf(c->v_string, c->length, (ctype == AML_OBJTYPE_HEXSTRING) ?
"0x%llx" : "%lld", a->v_integer);
break;
case AML_OBJTYPE_BUFFER:
rc = aml_evalexpr(a1->v_integer, a2->v_integer, opcode);
else {
/* Perform String/Buffer comparison */
- rc = memcmp(a1->v_buffer, a2->v_buffer,
+ rc = memcmp(a1->v_buffer, a2->v_buffer,
min(a1->length, a2->length));
if (rc == 0) {
/* If buffers match, which one is longer */
a2 = aml_xconvert(a2, a1->type, -1);
switch (a1->type) {
case AML_OBJTYPE_INTEGER:
- c = aml_allocvalue(AML_OBJTYPE_BUFFER,
+ c = aml_allocvalue(AML_OBJTYPE_BUFFER,
a1->length + a2->length, NULL);
memcpy(c->v_buffer, &a1->v_integer, a1->length);
memcpy(c->v_buffer+a1->length, &a2->v_integer, a2->length);
break;
case AML_OBJTYPE_BUFFER:
- c = aml_allocvalue(AML_OBJTYPE_BUFFER,
+ c = aml_allocvalue(AML_OBJTYPE_BUFFER,
a1->length + a2->length, NULL);
memcpy(c->v_buffer, a1->v_buffer, a1->length);
memcpy(c->v_buffer+a1->length, a2->v_buffer, a2->length);
break;
case AML_OBJTYPE_STRING:
- c = aml_allocvalue(AML_OBJTYPE_STRING,
+ c = aml_allocvalue(AML_OBJTYPE_STRING,
a1->length + a2->length, NULL);
memcpy(c->v_string, a1->v_string, a1->length);
memcpy(c->v_string+a1->length, a2->v_string, a2->length);
aml_ccrlen(union acpi_resource *rs, void *arg)
{
int *plen = arg;
-
+
*plen += AML_CRSLEN(rs);
return (0);
}
int l1 = 0, l2 = 0, l3 = 2;
uint8_t a3[] = { 0x79, 0x00 };
- if (a1->type != AML_OBJTYPE_BUFFER || a2->type != AML_OBJTYPE_BUFFER)
+ if (a1->type != AML_OBJTYPE_BUFFER || a2->type != AML_OBJTYPE_BUFFER)
aml_die("concatres: not buffers\n");
/* Walk a1, a2, get length minus end tags, concatenate buffers, add end tag */
if ((index + length) > src->length)
length = src->length - index;
return aml_allocvalue(src->type, length, src->v_buffer + index);
-}
+}
/*
- * Field I/O utility functions
+ * Field I/O utility functions
*/
void aml_xcreatefield(struct aml_value *, int, struct aml_value *, int, int,
struct aml_value *, int, int);
return (-1);
/* Integer _HID: convert to EISA ID */
- if (val->type == AML_OBJTYPE_INTEGER)
+ if (val->type == AML_OBJTYPE_INTEGER)
_aml_setvalue(val, AML_OBJTYPE_STRING, -1, aml_eisaid(val->v_integer));
return (0);
}
sz = 1;
break;
}
-
+
tbit = &tmp.v_integer;
vbit = &val->v_integer;
slen = (blen + 7) >> 3;
struct aml_value *data, int bpos, int blen,
struct aml_value *index, int indexval, int flags)
{
- dnprintf(10, "## %s(%s): %s %.4x-%.4x\n",
+ dnprintf(10, "## %s(%s): %s %.4x-%.4x\n",
aml_mnem(opcode, 0),
blen > aml_intlen ? "BUF" : "INT",
aml_nodename(field->node), bpos, blen);
if (index) {
- dnprintf(10, " index:%s:%.2x\n", aml_nodename(index->node),
+ dnprintf(10, " index:%s:%.2x\n", aml_nodename(index->node),
indexval);
}
dnprintf(10, " data:%s\n", aml_nodename(data->node));
- field->type = (opcode == AMLOP_FIELD ||
- opcode == AMLOP_INDEXFIELD ||
+ field->type = (opcode == AMLOP_FIELD ||
+ opcode == AMLOP_INDEXFIELD ||
opcode == AMLOP_BANKFIELD) ?
- AML_OBJTYPE_FIELDUNIT :
+ AML_OBJTYPE_FIELDUNIT :
AML_OBJTYPE_BUFFERFIELD;
if (opcode == AMLOP_INDEXFIELD) {
indexval = bpos >> 3;
bpos &= 7;
}
- if (field->type == AML_OBJTYPE_BUFFERFIELD &&
- data->type != AML_OBJTYPE_BUFFER)
+ if (field->type == AML_OBJTYPE_BUFFERFIELD &&
+ data->type != AML_OBJTYPE_BUFFER)
{
printf("WARN: %s not buffer\n",
aml_nodename(data->node));
/* Parse Field/IndexField/BankField scope */
void
-aml_xparsefieldlist(struct aml_scope *mscope, int opcode, int flags,
+aml_xparsefieldlist(struct aml_scope *mscope, int opcode, int flags,
struct aml_value *data, struct aml_value *index, int indexval)
{
struct aml_value *rv;
mscope->pos = aml_parsename(mscope->node, mscope->pos,
&rv, 1);
blen = aml_parselength(mscope);
- aml_xcreatefield(rv, opcode, data, bpos, blen, index,
+ aml_xcreatefield(rv, opcode, data, bpos, blen, index,
indexval, flags);
aml_xdelref(&rv, 0);
break;
}
/*
- * Mutex/Event utility functions
+ * Mutex/Event utility functions
*/
int acpi_xmutex_acquire(struct aml_scope *, struct aml_value *, int);
void acpi_xmutex_release(struct aml_scope *, struct aml_value *);
void acpi_xevent_reset(struct aml_scope *, struct aml_value *);
int
-acpi_xmutex_acquire(struct aml_scope *scope, struct aml_value *mtx,
+acpi_xmutex_acquire(struct aml_scope *scope, struct aml_value *mtx,
int timeout)
{
int err;
int err;
if (mtx == aml_global_lock) {
- dnprintf(10,"UNLOCKING GLOBAL\n");
+ dnprintf(10,"UNLOCKING GLOBAL\n");
err=acpi_release_global_lock(&acpi_softc->sc_facs->global_lock);
}
dnprintf(5, "%s releases mutex %s\n", scope->node->name,
/* Store result value into an object */
void
-aml_xstore(struct aml_scope *scope, struct aml_value *lhs , int64_t ival,
+aml_xstore(struct aml_scope *scope, struct aml_value *lhs , int64_t ival,
struct aml_value *rhs)
{
struct aml_value tmp;
if (rhs == NULL) {
rhs = _aml_setvalue(&tmp, AML_OBJTYPE_INTEGER, ival, NULL);
}
- if (rhs->type == AML_OBJTYPE_BUFFERFIELD ||
+ if (rhs->type == AML_OBJTYPE_BUFFERFIELD ||
rhs->type == AML_OBJTYPE_FIELDUNIT) {
aml_rwfield(rhs, 0, rhs->v_field.bitlen, &tmp, ACPI_IOREAD);
rhs = &tmp;
}
void
-aml_disasm(struct aml_scope *scope, int lvl,
- void (*dbprintf)(void *, const char *, ...),
+aml_disasm(struct aml_scope *scope, int lvl,
+ void (*dbprintf)(void *, const char *, ...),
void *arg)
{
int pc, opcode;
if (rv->type == AML_OBJTYPE_METHOD) {
strlcat(mch, "(", sizeof(mch));
for (ival=0; ival<AML_METHOD_ARGCOUNT(rv->v_method.flags); ival++) {
- strlcat(mch, ival ? ", %z" : "%z",
+ strlcat(mch, ival ? ", %z" : "%z",
sizeof(mch));
}
strlcat(mch, ")", sizeof(mch));
ch="%q";
break;
case AMLOP_STRINGPREFIX:
- ch="%a";
+ ch="%a";
break;
case AMLOP_INCREMENT:
case 'a':
dbprintf(arg, "\'%s\'", scope->pos);
scope->pos += strlen(scope->pos)+1;
- break;
+ break;
case 'N':
/* Create Name */
rv = aml_xparsesimple(scope, c, NULL);
case 'R':
/* Search name */
printf("%s", aml_getname(scope->pos));
- scope->pos = aml_parsename(scope->node, scope->pos,
+ scope->pos = aml_parsename(scope->node, scope->pos,
&rv, 0);
aml_xdelref(&rv, 0);
break;
} else if (*ms->pos == 0x01) {
ms->pos+=3;
} else {
- ms->pos = aml_parsename(ms->node,
+ ms->pos = aml_parsename(ms->node,
ms->pos, &rv, 1);
aml_parselength(ms);
- dbprintf(arg," %s\n",
+ dbprintf(arg," %s\n",
aml_nodename(rv->node));
aml_xdelref(&rv, 0);
}
ms = aml_xpushscope(scope, &tmp, scope->node, 0);
while (ms && ms->pos < ms->end) {
- aml_disasm(ms, (lvl + 1) & 0x7FFF,
+ aml_disasm(ms, (lvl + 1) & 0x7FFF,
dbprintf, arg);
}
aml_xpopscope(ms);
aml_getname(my_ret->v_nameref));
break;
case AML_OBJTYPE_METHOD:
- dnprintf(10,"\n--== Eval Method [%s, %d args] to %c ==--\n",
- aml_nodename(tmp->node),
+ dnprintf(10,"\n--== Eval Method [%s, %d args] to %c ==--\n",
+ aml_nodename(tmp->node),
AML_METHOD_ARGCOUNT(tmp->v_method.flags),
ret_type);
ms = aml_xpushscope(scope, tmp, tmp->node, AMLOP_METHOD);
-
+
/* Parse method arguments */
for (idx=0; idx<AML_METHOD_ARGCOUNT(tmp->v_method.flags); idx++) {
struct aml_value *sp;
#ifdef ACPI_DEBUG
aml_showstack(ms);
#endif
-
+
/* Evaluate method scope */
aml_root.start = tmp->v_method.base;
if (tmp->v_method.fneval != NULL) {
aml_xparse(ms, 'T', "METHEVAL");
my_ret = ms->retv;
}
- dnprintf(10,"\n--==Finished evaluating method: %s %c\n",
+ dnprintf(10,"\n--==Finished evaluating method: %s %c\n",
aml_nodename(tmp->node), ret_type);
#ifdef ACPI_DEBUG
aml_showvalue(my_ret, 0);
case AML_OBJTYPE_BUFFERFIELD:
case AML_OBJTYPE_FIELDUNIT:
my_ret = aml_allocvalue(0,0,NULL);
- dnprintf(20,"quick: Convert Bufferfield to %c 0x%x\n",
+ dnprintf(20,"quick: Convert Bufferfield to %c 0x%x\n",
ret_type, my_ret);
aml_rwfield(tmp, 0, tmp->v_field.bitlen, my_ret, ACPI_IOREAD);
break;
_aml_setvalue(rv, AML_OBJTYPE_DEBUGOBJ, 0, NULL);
break;
case AML_ARG_BYTE:
- _aml_setvalue(rv, AML_OBJTYPE_INTEGER,
+ _aml_setvalue(rv, AML_OBJTYPE_INTEGER,
aml_get8(scope->pos), NULL);
scope->pos += 1;
break;
case AML_ARG_WORD:
- _aml_setvalue(rv, AML_OBJTYPE_INTEGER,
+ _aml_setvalue(rv, AML_OBJTYPE_INTEGER,
aml_get16(scope->pos), NULL);
scope->pos += 2;
break;
case AML_ARG_DWORD:
- _aml_setvalue(rv, AML_OBJTYPE_INTEGER,
+ _aml_setvalue(rv, AML_OBJTYPE_INTEGER,
aml_get32(scope->pos), NULL);
scope->pos += 4;
break;
case AML_ARG_QWORD:
- _aml_setvalue(rv, AML_OBJTYPE_INTEGER,
+ _aml_setvalue(rv, AML_OBJTYPE_INTEGER,
aml_get64(scope->pos), NULL);
scope->pos += 8;
break;
}
/*
- * Main Opcode Parser/Evaluator
+ * Main Opcode Parser/Evaluator
*
* ret_type is expected type for return value
* 'o' = Data Object (Int/Str/Buf/Pkg/Name)
case AML_ARG_OBJLEN:
end = aml_parseend(scope);
break;
- case AML_ARG_IFELSE:
+ case AML_ARG_IFELSE:
/* Special Case: IF-ELSE:piTbpT or IF:piT */
- ch = (*end == AMLOP_ELSE && end < scope->end) ?
+ ch = (*end == AMLOP_ELSE && end < scope->end) ?
"-TbpT" : "-T";
break;
/* Complex arguments */
case 's':
- case 'S':
- case AML_ARG_TARGET:
+ case 'S':
+ case AML_ARG_TARGET:
case AML_ARG_TERMOBJ:
case AML_ARG_INTEGER:
if (*ch == 'r' && *scope->pos == AMLOP_ZERO) {
scope->pos = end;
break;
case AML_ARG_CONST:
- rv = aml_allocvalue(AML_OBJTYPE_INTEGER,
+ rv = aml_allocvalue(AML_OBJTYPE_INTEGER,
(char)opcode, NULL);
break;
case AML_ARG_CREATENAME:
if (scope->type == AMLOP_PACKAGE) {
/* Special case for package */
if (my_ret->type == AML_OBJTYPE_NAMEREF)
- my_ret = aml_allocvalue(AML_OBJTYPE_STRING, -1,
+ my_ret = aml_allocvalue(AML_OBJTYPE_STRING, -1,
aml_getname(my_ret->v_nameref));
else if (my_ret->node)
- my_ret = aml_allocvalue(AML_OBJTYPE_STRING, -1,
+ my_ret = aml_allocvalue(AML_OBJTYPE_STRING, -1,
aml_nodename(my_ret->node));
break;
}
case AMLOP_BUFFER:
/* Buffer: iB => Buffer */
- my_ret = aml_allocvalue(AML_OBJTYPE_BUFFER,
+ my_ret = aml_allocvalue(AML_OBJTYPE_BUFFER,
opargs[0]->v_integer, NULL);
- memcpy(my_ret->v_buffer, opargs[1]->v_buffer,
+ memcpy(my_ret->v_buffer, opargs[1]->v_buffer,
opargs[1]->length);
break;
case AMLOP_PACKAGE:
case AMLOP_VARPACKAGE:
/* Package/VarPackage: bT/iT => Package */
- my_ret = aml_allocvalue(AML_OBJTYPE_PACKAGE,
+ my_ret = aml_allocvalue(AML_OBJTYPE_PACKAGE,
opargs[0]->v_integer, 0);
- mscope = aml_xpushscope(scope, opargs[1], scope->node,
+ mscope = aml_xpushscope(scope, opargs[1], scope->node,
AMLOP_PACKAGE);
/* Recursively parse package contents */
case AMLOP_SUBTRACT:
case AMLOP_MULTIPLY:
/* XXX: iir => I */
- ival = aml_evalexpr(opargs[0]->v_integer,
+ ival = aml_evalexpr(opargs[0]->v_integer,
opargs[1]->v_integer, opcode);
aml_xstore(scope, opargs[2], ival, NULL);
break;
case AMLOP_DIVIDE:
/* Divide: iirr => I */
if (opargs[1]->v_integer == 0) {
- my_ret = aml_seterror(scope, "Divide by Zero!");
+ my_ret = aml_seterror(scope, "Divide by Zero!");
break;
}
- ival = aml_evalexpr(opargs[0]->v_integer,
+ ival = aml_evalexpr(opargs[0]->v_integer,
opargs[1]->v_integer, AMLOP_MOD);
aml_xstore(scope, opargs[2], ival, NULL);
- ival = aml_evalexpr(opargs[0]->v_integer,
+ ival = aml_evalexpr(opargs[0]->v_integer,
opargs[1]->v_integer, AMLOP_DIVIDE);
aml_xstore(scope, opargs[3], ival, NULL);
break;
case AMLOP_LOR:
case AMLOP_LAND:
/* XXX: ii => Bool */
- ival = aml_evalexpr(opargs[0]->v_integer,
+ ival = aml_evalexpr(opargs[0]->v_integer,
opargs[1]->v_integer, opcode);
break;
case AMLOP_LLESS:
#ifndef SMALL_KERNEL
aml_showvalue(opargs[0], 0);
#endif
- aml_die("Index out of bounds %d/%d\n", idx,
+ aml_die("Index out of bounds %d/%d\n", idx,
opargs[0]->length);
}
switch (opargs[0]->type) {
} else {
my_ret = aml_allocvalue(AML_OBJTYPE_OBJREF, AMLOP_PACKAGE,
opargs[0]->v_package[idx]);
- aml_xaddref(my_ret->v_objref.ref,
+ aml_xaddref(my_ret->v_objref.ref,
"Index.Package");
}
break;
case AML_OBJTYPE_INTEGER:
rv = aml_xconvert(opargs[0], AML_OBJTYPE_BUFFER, -1);
if (ret_type == 't' || ret_type == 'i' || ret_type == 'T') {
- dnprintf(12,"Index.Buf Term: %d = %x\n",
+ dnprintf(12,"Index.Buf Term: %d = %x\n",
idx, rv->v_buffer[idx]);
ival = rv->v_buffer[idx];
} else {
dnprintf(12, "Index.Buf Targ\n");
my_ret = aml_allocvalue(0,0,NULL);
- aml_xcreatefield(my_ret, AMLOP_INDEX, rv,
+ aml_xcreatefield(my_ret, AMLOP_INDEX, rv,
8 * idx, 8, NULL, 0, AML_FIELD_BYTEACC);
}
aml_xdelref(&rv, "Index.BufStr");
break;
case AMLOP_TOSTRING:
/* Source:B, Length:I, Result => String */
- my_ret = aml_xconvert(opargs[0], AML_OBJTYPE_STRING,
+ my_ret = aml_xconvert(opargs[0], AML_OBJTYPE_STRING,
opargs[1]->v_integer);
aml_xstore(scope, opargs[2], 0, my_ret);
break;
break;
case AMLOP_MID:
/* Source:BS, Index:I, Length:I, Result => BS */
- my_ret = aml_xmid(opargs[0], opargs[1]->v_integer,
+ my_ret = aml_xmid(opargs[0], opargs[1]->v_integer,
opargs[2]->v_integer);
aml_xstore(scope, opargs[3], 0, my_ret);
break;
case AMLOP_CREATEBITFIELD:
/* Source:B, BitIndex:I, FieldName */
rv = _aml_setvalue(opargs[2], AML_OBJTYPE_BUFFERFIELD, 0, 0);
- aml_xcreatefield(rv, opcode, opargs[0], opargs[1]->v_integer,
- 1, NULL, 0, 0);
+ aml_xcreatefield(rv, opcode, opargs[0], opargs[1]->v_integer,
+ 1, NULL, 0, 0);
break;
case AMLOP_CREATEBYTEFIELD:
/* Source:B, ByteIndex:I, FieldName */
rv = _aml_setvalue(opargs[2], AML_OBJTYPE_BUFFERFIELD, 0, 0);
- aml_xcreatefield(rv, opcode, opargs[0], opargs[1]->v_integer*8,
+ aml_xcreatefield(rv, opcode, opargs[0], opargs[1]->v_integer*8,
8, NULL, 0, AML_FIELD_BYTEACC);
break;
case AMLOP_CREATEWORDFIELD:
/* Source:B, ByteIndex:I, FieldName */
rv = _aml_setvalue(opargs[2], AML_OBJTYPE_BUFFERFIELD, 0, 0);
- aml_xcreatefield(rv, opcode, opargs[0], opargs[1]->v_integer*8,
+ aml_xcreatefield(rv, opcode, opargs[0], opargs[1]->v_integer*8,
16, NULL, 0, AML_FIELD_WORDACC);
break;
case AMLOP_CREATEDWORDFIELD:
/* Source:B, ByteIndex:I, FieldName */
rv = _aml_setvalue(opargs[2], AML_OBJTYPE_BUFFERFIELD, 0, 0);
- aml_xcreatefield(rv, opcode, opargs[0], opargs[1]->v_integer*8,
+ aml_xcreatefield(rv, opcode, opargs[0], opargs[1]->v_integer*8,
32, NULL, 0, AML_FIELD_DWORDACC);
break;
case AMLOP_CREATEQWORDFIELD:
/* Source:B, ByteIndex:I, FieldName */
rv = _aml_setvalue(opargs[2], AML_OBJTYPE_BUFFERFIELD, 0, 0);
- aml_xcreatefield(rv, opcode, opargs[0], opargs[1]->v_integer*8,
+ aml_xcreatefield(rv, opcode, opargs[0], opargs[1]->v_integer*8,
64, NULL, 0, AML_FIELD_QWORDACC);
break;
case AMLOP_FIELD:
/* Field: n:OpRegion, b:Flags, F:ieldlist */
mscope = aml_xpushscope(scope, opargs[2], scope->node, opcode);
- aml_xparsefieldlist(mscope, opcode, opargs[1]->v_integer,
+ aml_xparsefieldlist(mscope, opcode, opargs[1]->v_integer,
opargs[0], NULL, 0);
mscope = NULL;
break;
case AMLOP_INDEXFIELD:
/* IndexField: n:Index, n:Data, b:Flags, F:ieldlist */
mscope = aml_xpushscope(scope, opargs[3], scope->node, opcode);
- aml_xparsefieldlist(mscope, opcode, opargs[2]->v_integer,
+ aml_xparsefieldlist(mscope, opcode, opargs[2]->v_integer,
opargs[1], opargs[0], 0);
mscope = NULL;
break;
case AMLOP_BANKFIELD:
/* BankField: n:OpRegion, n:Field, i:Bank, b:Flags, F:ieldlist */
mscope = aml_xpushscope(scope, opargs[4], scope->node, opcode);
- aml_xparsefieldlist(mscope, opcode, opargs[3]->v_integer,
+ aml_xparsefieldlist(mscope, opcode, opargs[3]->v_integer,
opargs[0], opargs[1], opargs[2]->v_integer);
mscope = NULL;
break;
case AMLOP_NOTIFY:
/* Notify: Si */
rv = aml_gettgt(opargs[0], opcode);
- dnprintf(50,"Notifying: %s %x\n",
- aml_nodename(rv->node),
+ dnprintf(50,"Notifying: %s %x\n",
+ aml_nodename(rv->node),
opargs[1]->v_integer);
aml_notify(rv->node, opargs[1]->v_integer);
break;
case AMLOP_FATAL:
/* Fatal: bdi */
aml_die("AML FATAL ERROR: %x,%x,%x\n",
- opargs[0]->v_integer, opargs[1]->v_integer,
+ opargs[0]->v_integer, opargs[1]->v_integer,
opargs[2]->v_integer);
break;
case AMLOP_LOADTABLE:
- /* LoadTable(Sig:Str, OEMID:Str, OEMTable:Str, [RootPath:Str], [ParmPath:Str],
+ /* LoadTable(Sig:Str, OEMID:Str, OEMTable:Str, [RootPath:Str], [ParmPath:Str],
[ParmData:DataRefObj]) => DDBHandle */
aml_die("LoadTable");
break;
my_ret = aml_allocvalue(AML_OBJTYPE_INTEGER, ival, NULL);
}
if (ret_type == 'i' && my_ret && my_ret->type != AML_OBJTYPE_INTEGER) {
- dnprintf(10,"quick: %.4x convert to integer %s -> %s\n",
+ dnprintf(10,"quick: %.4x convert to integer %s -> %s\n",
pc, htab->mnem, stype);
my_ret = aml_xconvert(my_ret, AML_OBJTYPE_INTEGER, -1);
}
if (my_ret != NULL) {
/* Display result */
- dnprintf(20,"quick: %.4x %18s %c %.4x\n", pc, stype,
+ dnprintf(20,"quick: %.4x %18s %c %.4x\n", pc, stype,
ret_type, my_ret->stack);
}
}
odp--;
- dnprintf(50, ">>return [%s] %s %c %p\n", aml_nodename(scope->node),
+ dnprintf(50, ">>return [%s] %s %c %p\n", aml_nodename(scope->node),
stype, ret_type, my_ret);
return my_ret;
res.type = AML_OBJTYPE_SCOPE;
res.length = length;
res.v_buffer = start;
-
+
/* Push toplevel scope, parse AML */
aml_error = 0;
scope = aml_xpushscope(NULL, &res, &aml_root, AMLOP_SCOPE);
int argc, struct aml_value *argv, struct aml_value *res)
{
struct aml_value *xres;
-
+
if (res)
memset(res, 0, sizeof(*res));
if (node == NULL || node->value == NULL)
}
/*
- * Search for an AML name in namespace.. root only
+ * Search for an AML name in namespace.. root only
*/
struct aml_node *
aml_searchname(struct aml_node *root, const void *vname)