From 7e26d3ef3ffa11e7c5b80b81ee2daba28689cd0d Mon Sep 17 00:00:00 2001 From: Norman Feske Date: Thu, 3 Feb 2022 15:47:29 +0100 Subject: [PATCH] Give diagnostic aid to callers of 'dma_addr' If the platform driver lacks the 'managing_system="yes"' attribute, requests for DMA addresses return 0. This patch is meant to help diagnosing such configuration issues. Issue #2243 --- repos/os/include/platform_session/client.h | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/repos/os/include/platform_session/client.h b/repos/os/include/platform_session/client.h index 08803b7a35..fa96596d17 100644 --- a/repos/os/include/platform_session/client.h +++ b/repos/os/include/platform_session/client.h @@ -15,6 +15,7 @@ #define _INCLUDE__PLATFORM_SESSION__CLIENT_H_ #include +#include #include namespace Platform { struct Client; } @@ -43,8 +44,16 @@ struct Platform::Client : Genode::Rpc_client void free_dma_buffer(Ram_dataspace_capability cap) override { call(cap); } - addr_t dma_addr(Ram_dataspace_capability cap) override { - return call(cap); } + addr_t dma_addr(Ram_dataspace_capability cap) override + { + addr_t const result = call(cap); + + /* the platform driver may lack the 'managing_system' role */ + if (!result) + warning("unable to obtain DMA address from platform driver"); + + return result; + } }; #endif /* _INCLUDE__PLATFORM_SESSION__CLIENT_H_ */