From fc4055852ef23964db6b6626e3e2bfcee1bffaa1 Mon Sep 17 00:00:00 2001 From: Matthias Fend Date: Thu, 3 Feb 2022 08:51:20 +0100 Subject: [PATCH] lib: open-amp: add support for an empty resource table This allows a resource table to be included even if neither virtIO nor the RAM console are used. Signed-off-by: Matthias Fend --- lib/open-amp/resource_table.c | 3 --- lib/open-amp/resource_table.h | 6 ++++++ 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/open-amp/resource_table.c b/lib/open-amp/resource_table.c index 9c976cf5bc8..2942fe6ccfe 100644 --- a/lib/open-amp/resource_table.c +++ b/lib/open-amp/resource_table.c @@ -33,8 +33,6 @@ extern char ram_console[]; #define __resource Z_GENERIC_SECTION(.resource_table) -#if (CONFIG_OPENAMP_RSC_TABLE_NUM_RPMSG_BUFF > 0) || defined(CONFIG_RAM_CONSOLE) - static struct fw_resource_table __resource resource_table = { .ver = 1, .num = RSC_TABLE_NUM_ENTRY, @@ -79,4 +77,3 @@ void rsc_table_get(void **table_ptr, int *length) *table_ptr = (void *)&resource_table; *length = sizeof(resource_table); } -#endif diff --git a/lib/open-amp/resource_table.h b/lib/open-amp/resource_table.h index 76e57cf4b20..17ded8bd2ab 100644 --- a/lib/open-amp/resource_table.h +++ b/lib/open-amp/resource_table.h @@ -42,9 +42,11 @@ struct fw_resource_table { unsigned int reserved[2]; unsigned int offset[RSC_TABLE_NUM_ENTRY]; +#if (CONFIG_OPENAMP_RSC_TABLE_NUM_RPMSG_BUFF > 0) struct fw_rsc_vdev vdev; struct fw_rsc_vdev_vring vring0; struct fw_rsc_vdev_vring vring1; +#endif #if defined(CONFIG_RAM_CONSOLE) /* rpmsg trace entry */ @@ -54,6 +56,8 @@ struct fw_resource_table { void rsc_table_get(void **table_ptr, int *length); +#if (CONFIG_OPENAMP_RSC_TABLE_NUM_RPMSG_BUFF > 0) + inline struct fw_rsc_vdev *rsc_table_to_vdev(void *rsc_table) { return &((struct fw_resource_table *)rsc_table)->vdev; @@ -70,3 +74,5 @@ inline struct fw_rsc_vdev_vring *rsc_table_get_vring1(void *rsc_table) } #endif + +#endif