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 <christophe.mil...@linaro.org> --- platform/linux-generic/drv_shm.c | 12 ++++++++++++ platform/linux-generic/include/_ishmphy_internal.h | 3 ++- platform/linux-generic/include/odp/drv/plat/shm_types.h | 3 +++ 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/platform/linux-generic/drv_shm.c b/platform/linux-generic/drv_shm.c index 9b2560d..831c325 100644 --- a/platform/linux-generic/drv_shm.c +++ b/platform/linux-generic/drv_shm.c @@ -8,6 +8,7 @@ #include <odp/api/std_types.h> #include <odp/drv/shm.h> #include <_ishm_internal.h> +#include <_ishmphy_internal.h> static inline uint32_t from_handle(odpdrv_shm_t shm) { @@ -24,6 +25,7 @@ int odpdrv_shm_capability(odpdrv_shm_capability_t *capa) capa->max_blocks = ODPDRV_CONFIG_SHM_BLOCKS; capa->max_size = 0; capa->max_align = 0; + capa->can_getphy = _odp_ishmphy_can_getphy(); return 0; } @@ -100,3 +102,13 @@ int odpdrv_shm_print_all(const char *title) { return _odp_ishm_status(title); } + +odpdrv_phys_addr_t odpdrv_getphy(const void *addr) +{ + return (odpdrv_phys_addr_t)_odp_ishmphy_getphy(addr); +} + +void odpdrv_dumpphy(void *addr, uint64_t len) +{ + _odp_ishmphy_dumpphy(addr, len); +} diff --git a/platform/linux-generic/include/_ishmphy_internal.h b/platform/linux-generic/include/_ishmphy_internal.h index bb61ab4..1b56a64 100644 --- a/platform/linux-generic/include/_ishmphy_internal.h +++ b/platform/linux-generic/include/_ishmphy_internal.h @@ -12,8 +12,9 @@ extern "C" { #endif #include <stdint.h> +#include <odp/drv/shm.h> -typedef uint64_t phys_addr_t; /* Physical address definition. */ +typedef odpdrv_phys_addr_t phys_addr_t; /* Physical address definition. */ #define PHYS_ADDR_INVALID ((phys_addr_t)-1) void *_odp_ishmphy_book_va(uintptr_t len, intptr_t align); diff --git a/platform/linux-generic/include/odp/drv/plat/shm_types.h b/platform/linux-generic/include/odp/drv/plat/shm_types.h index c48eeca..a54d806 100644 --- a/platform/linux-generic/include/odp/drv/plat/shm_types.h +++ b/platform/linux-generic/include/odp/drv/plat/shm_types.h @@ -29,6 +29,9 @@ typedef ODPDRV_HANDLE_T(odpdrv_shm_t); #define ODPDRV_SHM_INVALID _odpdrv_cast_scalar(odpdrv_shm_t, 0) +/* a physical address: */ +typedef uint64_t odpdrv_phys_addr_t; + /** Get printable format of odpdrv_shm_t */ static inline uint64_t odpdrv_shm_to_u64(odpdrv_shm_t hdl) { -- 2.7.4