From owner-svn-src-all@FreeBSD.ORG Thu Jan 9 18:51:58 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id BC6D7A20; Thu, 9 Jan 2014 18:51:58 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 9CCF812DA; Thu, 9 Jan 2014 18:51:58 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s09Ipwog072945; Thu, 9 Jan 2014 18:51:58 GMT (envelope-from ian@svn.freebsd.org) Received: (from ian@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s09Ipws7072943; Thu, 9 Jan 2014 18:51:58 GMT (envelope-from ian@svn.freebsd.org) Message-Id: <201401091851.s09Ipws7072943@svn.freebsd.org> From: Ian Lepore Date: Thu, 9 Jan 2014 18:51:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260490 - head/sys/arm/arm X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Jan 2014 18:51:58 -0000 Author: ian Date: Thu Jan 9 18:51:57 2014 New Revision: 260490 URL: http://svnweb.freebsd.org/changeset/base/260490 Log: Add a function to print the contents of the static device mapping table, and invoke it for bootverbose logging, and also from a new DDB command, "show devmap". Also tweak the format string for the bootverbose output of physical memory chunks to get the leading zeros in the hex values. Modified: head/sys/arm/arm/devmap.c head/sys/arm/arm/machdep.c Modified: head/sys/arm/arm/devmap.c ============================================================================== --- head/sys/arm/arm/devmap.c Thu Jan 9 18:28:58 2014 (r260489) +++ head/sys/arm/arm/devmap.c Thu Jan 9 18:51:57 2014 (r260490) @@ -31,6 +31,8 @@ __FBSDID("$FreeBSD$"); * Routines for mapping device memory. */ +#include "opt_ddb.h" + #include #include #include @@ -54,6 +56,36 @@ static u_int akva_devmap_idx; static vm_offset_t akva_devmap_vaddr = ARM_VECTORS_HIGH; /* + * Print the contents of the static mapping table using the provided printf-like + * output function (which will be either printf or db_printf). + */ +static void +devmap_dump_table(int (*prfunc)(const char *, ...)) +{ + const struct arm_devmap_entry *pd; + + if (devmap_table == NULL || devmap_table[0].pd_size == 0) { + prfunc("No static device mappings.\n"); + return; + } + + prfunc("Static device mappings:\n"); + for (pd = devmap_table; pd->pd_size != 0; ++pd) { + prfunc(" 0x%08x - 0x%08x mapped at VA 0x%08x\n", + pd->pd_pa, pd->pd_pa + pd->pd_size - 1, pd->pd_va); + } +} + +/* + * Print the contents of the static mapping table. Used for bootverbose. + */ +void +arm_devmap_print_table() +{ + devmap_dump_table(printf); +} + +/* * Return the "last" kva address used by the registered devmap table. It's * actually the lowest address used by the static mappings, i.e., the address of * the first unusable byte of KVA. @@ -266,3 +298,13 @@ pmap_unmapdev(vm_offset_t va, vm_size_t kva_free(va, origsize); } +#ifdef DDB +#include + +DB_SHOW_COMMAND(devmap, db_show_devmap) +{ + devmap_dump_table(db_printf); +} + +#endif /* DDB */ + Modified: head/sys/arm/arm/machdep.c ============================================================================== --- head/sys/arm/arm/machdep.c Thu Jan 9 18:28:58 2014 (r260489) +++ head/sys/arm/arm/machdep.c Thu Jan 9 18:51:57 2014 (r260490) @@ -379,10 +379,10 @@ cpu_startup(void *dummy) vm_paddr_t size; size = phys_avail[indx + 1] - phys_avail[indx]; - printf("%#08jx - %#08jx, %ju bytes (%ju pages)\n", + printf(" 0x%08jx - 0x%08jx, %ju KBytes (%ju pages)\n", (uintmax_t)phys_avail[indx], (uintmax_t)phys_avail[indx + 1] - 1, - (uintmax_t)size, (uintmax_t)size / PAGE_SIZE); + (uintmax_t)size / 1024, (uintmax_t)size / PAGE_SIZE); } } @@ -392,6 +392,9 @@ cpu_startup(void *dummy) (uintmax_t)ptoa(cnt.v_free_count), (uintmax_t)ptoa(cnt.v_free_count) / 1048576); + if (bootverbose) + arm_devmap_print_table(); + bufinit(); vm_pager_bufferinit(); pcb->un_32.pcb32_und_sp = (u_int)thread0.td_kstack +