The capability "can_getphy" is introduced and tells whether physical address queries are available. The function odpdrv_getphy() is added to query for physical address (from virtual address)
Signed-off-by: Christophe Milard <[email protected]> --- include/odp/drv/spec/shm.h | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/include/odp/drv/spec/shm.h b/include/odp/drv/spec/shm.h index ef64f5d..ca3aae2 100644 --- a/include/odp/drv/spec/shm.h +++ b/include/odp/drv/spec/shm.h @@ -43,6 +43,12 @@ extern "C" { #define ODPDRV_SHM_LOCK 0x02 /**< Memory shall be locked (no swap) */ /** + * @typedef odpdrv_phys_addr_t + * A physical memory address + * + */ + +/** * Shared memory block info */ typedef struct odpdrv_shm_info_t { @@ -75,6 +81,13 @@ typedef struct odpdrv_shm_capability_t { * available memory size. */ uint64_t max_align; + /** Can retrieve physical addresses + * + * A true (non-zero) value means that odpdrv_getphy() can be + * used to retrieve physical memory addresses, (as well as + * the debug function odp_drv_dumpphy() */ + int can_getphy; + } odpdrv_shm_capability_t; /** @@ -220,6 +233,28 @@ int odpdrv_shm_print_all(const char *title); uint64_t odpdrv_shm_to_u64(odpdrv_shm_t hdl); /** + * Get physical address from virtual address + * + * @addr virtual address. + * @return Physicall address or NULL + * + * @note This routine will work only if capability "can_getphy" is true. + */ +odpdrv_phys_addr_t odpdrv_getphy(const void *addr); + +/** + * Print physical address mapping + * + * @addr virtual address. + * @return Physicall address or NULL + * + * @note This routine will work only if capability "can_getphy" is true. + * @note This routine is intended to be used for diagnostic purposes, + * and uses ODP_DBG printouts + */ +void odpdrv_dumpphy(void *addr, uint64_t len); + +/** * @} */ -- 2.7.4
