Module Name: src Committed By: mrg Date: Sun Jan 17 00:23:59 UTC 2021
Modified Files: src/sys/arch/aarch64/aarch64: db_machdep.c Log Message: add a command to dump the bootconfig passed meminfo. To generate a diff of this commit: cvs rdiff -u -r1.30 -r1.31 src/sys/arch/aarch64/aarch64/db_machdep.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/arch/aarch64/aarch64/db_machdep.c diff -u src/sys/arch/aarch64/aarch64/db_machdep.c:1.30 src/sys/arch/aarch64/aarch64/db_machdep.c:1.31 --- src/sys/arch/aarch64/aarch64/db_machdep.c:1.30 Fri Dec 11 18:03:33 2020 +++ src/sys/arch/aarch64/aarch64/db_machdep.c Sun Jan 17 00:23:59 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: db_machdep.c,v 1.30 2020/12/11 18:03:33 skrll Exp $ */ +/* $NetBSD: db_machdep.c,v 1.31 2021/01/17 00:23:59 mrg Exp $ */ /*- * Copyright (c) 2014 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: db_machdep.c,v 1.30 2020/12/11 18:03:33 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: db_machdep.c,v 1.31 2021/01/17 00:23:59 mrg Exp $"); #ifdef _KERNEL_OPT #include "opt_compat_netbsd32.h" @@ -79,6 +79,7 @@ void db_md_watch_cmd(db_expr_t, bool, db #if defined(_KERNEL) && defined(MULTIPROCESSOR) void db_md_switch_cpu_cmd(db_expr_t, bool, db_expr_t, const char *); #endif +static void db_md_meminfo_cmd(db_expr_t, bool, db_expr_t, const char *); const struct db_command db_machine_command_table[] = { #if defined(_KERNEL) && defined(MULTIPROCESSOR) @@ -152,6 +153,12 @@ const struct db_command db_machine_comma "\t#: watchpoint number to remove" "\t/1..8: size of data\n") }, + { + DDB_ADD_CMD( + "meminfo", db_md_meminfo_cmd, 0, + "Dump info about memory ranges", + NULL, NULL) + }, #endif { DDB_ADD_CMD(NULL, NULL, 0, @@ -1075,3 +1082,18 @@ kdb_trap(int type, struct trapframe *tf) return 1; } #endif + +static void +db_md_meminfo_cmd(db_expr_t addr, bool have_addr, db_expr_t count, + const char *modif) +{ + unsigned blk; + + for (blk = 0; blk < bootconfig.dramblocks; blk++) { + db_printf("blk[%u]: start %lx end %lx (pages %x)\n", + blk, bootconfig.dram[blk].address, + bootconfig.dram[blk].address + + (uint64_t)bootconfig.dram[blk].pages * PAGE_SIZE, + bootconfig.dram[blk].pages); + } +}