diff options
Diffstat (limited to 'sys')
-rw-r--r-- | sys/arch/amd64/amd64/db_interface.c | 17 | ||||
-rw-r--r-- | sys/arch/i386/i386/db_interface.c | 17 | ||||
-rw-r--r-- | sys/dev/acpi/acpidebug.c | 91 | ||||
-rw-r--r-- | sys/dev/acpi/acpidebug.h | 18 | ||||
-rw-r--r-- | sys/dev/acpi/dsdt.c | 10 | ||||
-rw-r--r-- | sys/dev/acpi/dsdt.h | 3 | ||||
-rw-r--r-- | sys/dev/acpi/files.acpi | 3 |
7 files changed, 152 insertions, 7 deletions
diff --git a/sys/arch/amd64/amd64/db_interface.c b/sys/arch/amd64/amd64/db_interface.c index a38730bd15e..170bd00a442 100644 --- a/sys/arch/amd64/amd64/db_interface.c +++ b/sys/arch/amd64/amd64/db_interface.c @@ -1,4 +1,4 @@ -/* $OpenBSD: db_interface.c,v 1.6 2005/12/05 21:31:23 miod Exp $ */ +/* $OpenBSD: db_interface.c,v 1.7 2006/03/05 14:46:45 marco Exp $ */ /* $NetBSD: db_interface.c,v 1.1 2003/04/26 18:39:27 fvdl Exp $ */ /* @@ -56,6 +56,11 @@ #include <ddb/db_output.h> #include <ddb/db_var.h> +#include "acpi.h" +#if NACPI > 0 +#include <dev/acpi/acpidebug.h> +#endif /* NACPI > 0 */ + extern label_t *db_recover; extern char *trap_type[]; extern int trap_types; @@ -370,6 +375,13 @@ x86_ipi_db(struct cpu_info *ci) } #endif /* MULTIPROCESSOR */ +#if NACPI > 0 +struct db_command db_acpi_cmds[] = { + { "tree", db_acpi_tree, 0, NULL }, + { NULL, NULL, 0, NULL } +}; +#endif /* NACPI > 0 */ + struct db_command db_machine_command_table[] = { #ifdef MULTIPROCESSOR { "cpuinfo", db_cpuinfo_cmd, 0, 0 }, @@ -377,6 +389,9 @@ struct db_command db_machine_command_table[] = { { "stopcpu", db_stopproc_cmd, 0, 0 }, { "ddbcpu", db_ddbproc_cmd, 0, 0 }, #endif +#if NACPI > 0 + { "acpi", NULL, 0, db_acpi_cmds }, +#endif /* NACPI > 0 */ { (char *)0, }, }; diff --git a/sys/arch/i386/i386/db_interface.c b/sys/arch/i386/i386/db_interface.c index 5c8786489bc..3778f3a22d9 100644 --- a/sys/arch/i386/i386/db_interface.c +++ b/sys/arch/i386/i386/db_interface.c @@ -1,4 +1,4 @@ -/* $OpenBSD: db_interface.c,v 1.16 2004/07/20 20:18:53 art Exp $ */ +/* $OpenBSD: db_interface.c,v 1.17 2006/03/05 14:46:46 marco Exp $ */ /* $NetBSD: db_interface.c,v 1.22 1996/05/03 19:42:00 christos Exp $ */ /* @@ -51,6 +51,11 @@ #include <ddb/db_output.h> #include <ddb/db_var.h> +#include "acpi.h" +#if NACPI > 0 +#include <dev/acpi/acpidebug.h> +#endif /* NACPI > 0 */ + extern label_t *db_recover; extern char *trap_type[]; extern int trap_types; @@ -322,6 +327,13 @@ db_ddbproc_cmd(db_expr_t addr, int have_addr, db_expr_t count, char *modif) } #endif /* MULTIPROCESSOR */ +#if NACPI > 0 +struct db_command db_acpi_cmds[] = { + { "tree", db_acpi_tree, 0, NULL }, + { NULL, NULL, 0, NULL } +}; +#endif /* NACPI > 0 */ + struct db_command db_machine_command_table[] = { { "sysregs", db_sysregs_cmd, 0, 0 }, #ifdef MULTIPROCESSOR @@ -330,6 +342,9 @@ struct db_command db_machine_command_table[] = { { "stopcpu", db_stopproc_cmd, 0, 0 }, { "ddbcpu", db_ddbproc_cmd, 0, 0 }, #endif /* MULTIPROCESSOR */ +#if NACPI > 0 + { "acpi", NULL, 0, db_acpi_cmds }, +#endif /* NACPI > 0 */ { (char *)0, } }; diff --git a/sys/dev/acpi/acpidebug.c b/sys/dev/acpi/acpidebug.c new file mode 100644 index 00000000000..863c1a5bb6c --- /dev/null +++ b/sys/dev/acpi/acpidebug.c @@ -0,0 +1,91 @@ +/* $OpenBSD: acpidebug.c,v 1.1 2006/03/05 14:46:46 marco Exp $ */ +/* + * Copyright (c) 2006 Marco Peereboom <marco@openbsd.org> + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#include <machine/db_machdep.h> +#include <ddb/db_command.h> +#include <ddb/db_output.h> + +#include <machine/bus.h> + +#include <dev/acpi/acpireg.h> +#include <dev/acpi/acpivar.h> +#include <dev/acpi/amltypes.h> +#include <dev/acpi/acpidebug.h> +#include <dev/acpi/dsdt.h> + +void db_aml_walktree(struct aml_node *); +void db_aml_shownode(struct aml_node *); + +void +db_aml_shownode(struct aml_node *node) +{ + db_printf(" opcode:%.4x mnem:%s %s ", + node->opcode, node->mnem, node->name ? node->name : ""); + + switch(node->opcode) { + case AMLOP_METHOD: + break; + + case AMLOP_NAMECHAR: + db_printf("%s", node->value->name); + break; + + case AMLOP_FIELD: + case AMLOP_BANKFIELD: + case AMLOP_INDEXFIELD: + break; + + case AMLOP_BYTEPREFIX: + db_printf("byte: %.2x", node->value->v_integer); + break; + case AMLOP_WORDPREFIX: + db_printf("word: %.4x", node->value->v_integer); + break; + case AMLOP_DWORDPREFIX: + db_printf("dword: %.8x", node->value->v_integer); + break; + case AMLOP_STRINGPREFIX: + db_printf("string: %s", node->value->v_string); + break; + } + db_printf("\n"); +} + +void +db_aml_walktree(struct aml_node *node) +{ + int i; + + while(node) { + db_printf(" %d ", node->depth); + for(i = 0; i < node->depth; i++) + db_printf(".."); + + db_aml_shownode(node); + db_aml_walktree(node->child); + node = node->sibling; + } +} + +/* ddb interface */ +void +db_acpi_tree(db_expr_t addr, int haddr, db_expr_t count, char *modif) +{ + extern struct aml_node aml_root; + + db_aml_walktree(aml_root.child); +} diff --git a/sys/dev/acpi/acpidebug.h b/sys/dev/acpi/acpidebug.h new file mode 100644 index 00000000000..74721f97ac1 --- /dev/null +++ b/sys/dev/acpi/acpidebug.h @@ -0,0 +1,18 @@ +/* $OpenBSD: acpidebug.h,v 1.1 2006/03/05 14:46:46 marco Exp $ */ +/* + * Copyright (c) 2006 Marco Peereboom <marco@openbsd.org> + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +void db_acpi_tree(db_expr_t, int, db_expr_t, char *); diff --git a/sys/dev/acpi/dsdt.c b/sys/dev/acpi/dsdt.c index e87855b6d1f..1ad2097edc2 100644 --- a/sys/dev/acpi/dsdt.c +++ b/sys/dev/acpi/dsdt.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dsdt.c,v 1.31 2006/02/26 07:57:47 marco Exp $ */ +/* $OpenBSD: dsdt.c,v 1.32 2006/03/05 14:46:46 marco Exp $ */ /* * Copyright (c) 2005 Jordan Hargrave <jordan@openbsd.org> * @@ -22,6 +22,11 @@ #include <machine/bus.h> +#ifdef DDB +#include <machine/db_machdep.h> +#include <ddb/db_command.h> +#endif + #include <dev/acpi/acpireg.h> #include <dev/acpi/acpivar.h> #include <dev/acpi/amltypes.h> @@ -110,7 +115,6 @@ struct acpi_context *acpi_alloccontext(struct acpi_softc *sc, int argc, struct aml_value *argv); -void aml_walkroot(void); struct aml_node *aml_find_name(struct acpi_softc *, struct aml_node *, const char *); int64_t aml_str2int(const char *, int, int); @@ -2892,7 +2896,7 @@ aml_walktree(struct aml_node *node) } void -aml_walkroot() +aml_walkroot(void) { aml_walktree(aml_root.child); } diff --git a/sys/dev/acpi/dsdt.h b/sys/dev/acpi/dsdt.h index 8c09586d580..419005fb7af 100644 --- a/sys/dev/acpi/dsdt.h +++ b/sys/dev/acpi/dsdt.h @@ -1,4 +1,4 @@ -/* $OpenBSD: dsdt.h,v 1.9 2006/02/22 19:29:24 jordan Exp $ */ +/* $OpenBSD: dsdt.h,v 1.10 2006/03/05 14:46:46 marco Exp $ */ /* * Copyright (c) 2005 Marco Peereboom <marco@openbsd.org> * @@ -30,6 +30,7 @@ int aml_eval_name(struct acpi_softc *, struct aml_node *, const char *, void aml_showvalue(struct aml_value *); void aml_walktree(struct aml_node *); +void aml_walkroot(void); struct aml_value *aml_allocint(uint64_t); struct aml_value *aml_allocstr(const char *); diff --git a/sys/dev/acpi/files.acpi b/sys/dev/acpi/files.acpi index 23b85d8f8e9..10dd854347a 100644 --- a/sys/dev/acpi/files.acpi +++ b/sys/dev/acpi/files.acpi @@ -1,4 +1,4 @@ -# $OpenBSD: files.acpi,v 1.8 2006/02/26 02:49:28 marco Exp $ +# $OpenBSD: files.acpi,v 1.9 2006/03/05 14:46:46 marco Exp $ # # Config file and device description for machine-independent ACPI code. # Included by ports that need it. @@ -9,6 +9,7 @@ attach acpi at mainbus file dev/acpi/acpi.c acpi needs-flag file dev/acpi/acpiutil.c acpi file dev/acpi/dsdt.c acpi +file dev/acpi/acpidebug.c acpi & ddb # ACPI timer device acpitimer |