@@ -265,3 +265,60 @@ int _odp_ishmphy_can_getphy(void)
return 1;
}
+
+/*
+ * dump the physical mapping from virtual address addr, length len.
+ */
+void _odp_ishmphy_dumpphy(void *curr_addr, uint64_t len)
+{
+ int page_sz;
+ phys_addr_t curr_phy;
+ phys_addr_t start_phy;
+ void *start_address = 0;
+ uint32_t curr_len = 0;
+ uint32_t pfn_count = 0;
+
+ /* get normal page sizes: */
+ page_sz = odp_sys_page_size();
+
+ curr_phy = _odp_ishmphy_getphy(curr_addr);
+ if (curr_phy == PHYS_ADDR_INVALID) {
+ ODP_DBG("Phy Dump failed (permission?).\n");
+ return;
+ }
+
+ ODP_DBG("Phy Dump:\n");
+ start_address = curr_addr;
+ start_phy = curr_phy;
+
+ curr_len += page_sz;
+ curr_addr = (void *)((char *)curr_addr + page_sz);
+ pfn_count++;
+ while (curr_len < len) {
+ if (_odp_ishmphy_getphy(curr_addr) == curr_phy + page_sz) {
+ curr_len += page_sz;
+ curr_addr = (void *)((char *)curr_addr + page_sz);
+ curr_phy += page_sz;
+ pfn_count++;
+ continue;
+ }
+
+ ODP_DBG("Virtual: %08" PRIx64 " <--> Phy: %08" PRIx64
+ " %" PRIu32 " PFNs, %" PRIu32 " bytes\n",
+ (uint64_t)start_address, start_phy,
+ pfn_count, pfn_count * page_sz);
+ curr_phy = _odp_ishmphy_getphy(curr_addr);
+ start_address = curr_addr;
+ start_phy = curr_phy;
+ pfn_count = 0;
+ curr_len += page_sz;
+ curr_addr = (void *)((char *)curr_addr + page_sz);
+ pfn_count++;
+ }
+
+ if (pfn_count)
+ ODP_DBG("Virtual: %08" PRIx64 " <--> Phy: %08" PRIx64
+ " %" PRIu32 " PFNs, %" PRIu32 " bytes\n",
+ (uint64_t)start_address, start_phy,
+ pfn_count, pfn_count * page_sz);
+}
@@ -32,6 +32,11 @@ int _odp_ishmphy_can_getphy(void);
*/
phys_addr_t _odp_ishmphy_getphy(const void *addr);
+/*
+ * dump the physical mapping from virtual address addr, length len.
+ */
+void _odp_ishmphy_dumpphy(void *addr, uint64_t len);
+
#ifdef __cplusplus
}
#endif
_odp_ishmphy_dumpphy() prints the virtual to physical address mapping of some memory region (defined by virtuall address + length). Signed-off-by: Christophe Milard <christophe.milard@linaro.org> --- platform/linux-generic/_ishmphy.c | 57 ++++++++++++++++++++++ platform/linux-generic/include/_ishmphy_internal.h | 5 ++ 2 files changed, 62 insertions(+) -- 2.7.4