summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authorJordan Hargrave <jordan@cvs.openbsd.org>2006-03-09 05:38:13 +0000
committerJordan Hargrave <jordan@cvs.openbsd.org>2006-03-09 05:38:13 +0000
commit2647ea2c20a9c934a16ba0bf1969f76693bd9699 (patch)
treeb87d8312d211f8e26c0d1da5f6302f70b4d1081c /sys/dev
parente3d547ead85fa8ed6098c299854a87c01f4593f2 (diff)
Used common aml_opname for debugger
Removed redundant code ok marco@
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/acpi/acpidebug.c43
-rw-r--r--sys/dev/acpi/dsdt.c3
-rw-r--r--sys/dev/acpi/dsdt.h12
3 files changed, 11 insertions, 47 deletions
diff --git a/sys/dev/acpi/acpidebug.c b/sys/dev/acpi/acpidebug.c
index 7a42f21cf1a..adba63f59d6 100644
--- a/sys/dev/acpi/acpidebug.c
+++ b/sys/dev/acpi/acpidebug.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: acpidebug.c,v 1.6 2006/03/09 04:41:11 marco Exp $ */
+/* $OpenBSD: acpidebug.c,v 1.7 2006/03/09 05:38:12 jordan Exp $ */
/*
* Copyright (c) 2006 Marco Peereboom <marco@openbsd.org>
*
@@ -30,11 +30,9 @@
#include <dev/acpi/dsdt.h>
const char *db_aml_objtype(struct aml_value *);
-const char *db_aml_opname(int);
const char *db_opregion(int);
int db_aml_nodetype(struct aml_node *);
int db_parse_name(void);
-struct aml_opcode *db_findem(int);
void db_aml_disasm(struct acpi_context *, int);
void db_aml_disint(struct acpi_context *, int, int);
void db_aml_disline(uint8_t *, int, const char *, ...);
@@ -46,13 +44,6 @@ void db_spaceit(int);
extern struct aml_node aml_root;
-/* Perfect hash values for AML opcodes */
-#define HASH_VAL 11
-#define HASH_SIZE 204
-#define HASH_KEY(v) (((v) * HASH_VAL) % HASH_SIZE)
-
-struct aml_opcode *htab[HASH_SIZE];
-
/* line buffer */
char buf[128];
@@ -161,7 +152,7 @@ db_aml_showvalue(struct aml_value *value)
case AML_OBJTYPE_FIELDUNIT:
db_printf("%s: access=%x,lock=%x,update=%x pos=%.4x "
"len=%.4x\n",
- db_aml_opname(value->v_field.type),
+ 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),
@@ -173,7 +164,7 @@ db_aml_showvalue(struct aml_value *value)
break;
case AML_OBJTYPE_BUFFERFIELD:
db_printf("%s: pos=%.4x len=%.4x ",
- db_aml_opname(value->v_field.type),
+ aml_opname(value->v_field.type),
value->v_field.bitpos,
value->v_field.bitlen);
@@ -203,22 +194,6 @@ db_spaceit(int len)
db_printf("..");
}
-struct aml_opcode
-*db_findem(int opcode)
-{
- int key, cnt;
-
- cnt = 0;
- key = HASH_KEY(opcode);
-
- while (htab[key] != NULL && htab[key]->opcode != opcode) {
- key = (key + 1) % HASH_SIZE;
- cnt++;
- }
-
- return (htab[key]);
-}
-
int
db_aml_nodetype(struct aml_node *node)
{
@@ -226,16 +201,6 @@ db_aml_nodetype(struct aml_node *node)
}
const char *
-db_aml_opname(int opcode)
-{
- struct aml_opcode *opc;
-
- opc = db_findem(opcode);
-
- return (opc ? opc->mnem : "");
-}
-
-const char *
db_aml_objtype(struct aml_value *val)
{
if (val == NULL)
@@ -278,7 +243,7 @@ db_aml_objtype(struct aml_value *val)
return "refof";
case AML_OBJTYPE_FIELDUNIT:
case AML_OBJTYPE_BUFFERFIELD:
- return db_aml_opname(val->v_field.type);
+ return aml_opname(val->v_field.type);
};
return ("");
diff --git a/sys/dev/acpi/dsdt.c b/sys/dev/acpi/dsdt.c
index c9d0c33035d..5f845084be1 100644
--- a/sys/dev/acpi/dsdt.c
+++ b/sys/dev/acpi/dsdt.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dsdt.c,v 1.37 2006/03/09 05:24:03 marco Exp $ */
+/* $OpenBSD: dsdt.c,v 1.38 2006/03/09 05:38:12 jordan Exp $ */
/*
* Copyright (c) 2005 Jordan Hargrave <jordan@openbsd.org>
*
@@ -81,7 +81,6 @@ opregion(int id)
}
#endif
-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);
diff --git a/sys/dev/acpi/dsdt.h b/sys/dev/acpi/dsdt.h
index 974b1cda59a..bb3cf2fb544 100644
--- a/sys/dev/acpi/dsdt.h
+++ b/sys/dev/acpi/dsdt.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: dsdt.h,v 1.12 2006/03/08 04:03:21 marco Exp $ */
+/* $OpenBSD: dsdt.h,v 1.13 2006/03/09 05:38:12 jordan Exp $ */
/*
* Copyright (c) 2005 Marco Peereboom <marco@openbsd.org>
*
@@ -36,26 +36,26 @@ struct aml_opcode
const char *args;
};
-const char *aml_parse_name(struct acpi_context *);
const char *aml_eisaid(u_int32_t);
+const char *aml_opname(int);
+const char *aml_parse_name(struct acpi_context *);
int aml_parse_length(struct acpi_context *);
int64_t aml_eparseint(struct acpi_context *, 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_opcode *aml_getopcode(struct acpi_context *);
struct aml_value *aml_allocint(uint64_t);
struct aml_value *aml_allocstr(const char *);
struct aml_value *aml_allocvalue(int, int64_t, void *);
struct aml_value *aml_copyvalue(const struct aml_value *);
u_int8_t *aml_eparselen(struct acpi_context *);
+void acpi_freecontext(struct acpi_context *);
void aml_freevalue(struct aml_value **);
void aml_notify(struct aml_node *, int);
void aml_notify_dev(const char *, int);
void aml_showvalue(struct aml_value *);
-void aml_walktree(struct aml_node *);
void aml_walkroot(void);
-void acpi_freecontext(struct acpi_context *);
-
+void aml_walktree(struct aml_node *);
int aml_comparevalue(struct acpi_context *, int,
struct aml_value *, struct aml_value *);