@@ -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 (1) value means that odpdrv_virt_to_phys() can be
+ * used to retrieve physical memory addresses, (as well as
+ * the debug function odp_drv_memmap_print() */
+ int phys_addr:1;
+
} 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 "phys_addr" is true.
+ */
+odpdrv_phys_addr_t odpdrv_virt_to_phys(const void *addr);
+
+/**
+ * Print physical address mapping on debug output
+ *
+ * @addr virtual address.
+ * @len virtual address area length (bytes)
+ *
+ * @note This routine will work only if capability "phys_addr" is true.
+ * @note This routine is intended to be used for diagnostic purposes,
+ * and uses ODP_DBG printouts (--enable-debug-print required)
+ */
+void odpdrv_memmap_print(void *addr, uint64_t len);
+
+/**
* @}
*/
The capability "phys_addr" is introduced and tells whether physical address queries are available. The function odpdrv_virt_to_phys() is added to query for physical address (from virtual address) Signed-off-by: Christophe Milard <christophe.milard@linaro.org> --- include/odp/drv/spec/shm.h | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) -- 2.7.4