[RFC PATCH 01/10] remoteproc: move resource table definition

Tanmay Shah tanmay.shah at amd.com
Tue Jul 25 16:06:41 CEST 2023


Resource table is defined in multiple files. Instead move
definition to remoteproc header file and include header file
in multiple c files where resource table definition is needed.

Signed-off-by: Tanmay Shah <tanmay.shah at amd.com>
---
 drivers/remoteproc/rproc-elf-loader.c | 33 ---------------------------
 drivers/remoteproc/rproc-uclass.c     |  7 ------
 include/remoteproc.h                  | 33 +++++++++++++++++++++++++++
 3 files changed, 33 insertions(+), 40 deletions(-)

diff --git a/drivers/remoteproc/rproc-elf-loader.c b/drivers/remoteproc/rproc-elf-loader.c
index b185a6cafb..8a13872f85 100644
--- a/drivers/remoteproc/rproc-elf-loader.c
+++ b/drivers/remoteproc/rproc-elf-loader.c
@@ -12,39 +12,6 @@
 #include <dm/device_compat.h>
 #include <linux/compat.h>
 
-/**
- * struct resource_table - firmware resource table header
- * @ver: version number
- * @num: number of resource entries
- * @reserved: reserved (must be zero)
- * @offset: array of offsets pointing at the various resource entries
- *
- * A resource table is essentially a list of system resources required
- * by the remote processor. It may also include configuration entries.
- * If needed, the remote processor firmware should contain this table
- * as a dedicated ".resource_table" ELF section.
- *
- * Some resources entries are mere announcements, where the host is informed
- * of specific remoteproc configuration. Other entries require the host to
- * do something (e.g. allocate a system resource). Sometimes a negotiation
- * is expected, where the firmware requests a resource, and once allocated,
- * the host should provide back its details (e.g. address of an allocated
- * memory region).
- *
- * The header of the resource table, as expressed by this structure,
- * contains a version number (should we need to change this format in the
- * future), the number of available resource entries, and their offsets
- * in the table.
- *
- * Immediately following this header are the resource entries themselves.
- */
-struct resource_table {
-	u32 ver;
-	u32 num;
-	u32 reserved[2];
-	u32 offset[0];
-} __packed;
-
 /* Basic function to verify ELF32 image format */
 int rproc_elf32_sanity_check(ulong addr, ulong size)
 {
diff --git a/drivers/remoteproc/rproc-uclass.c b/drivers/remoteproc/rproc-uclass.c
index 50bcc9030e..d697639cdd 100644
--- a/drivers/remoteproc/rproc-uclass.c
+++ b/drivers/remoteproc/rproc-uclass.c
@@ -23,13 +23,6 @@
 
 DECLARE_GLOBAL_DATA_PTR;
 
-struct resource_table {
-	u32 ver;
-	u32 num;
-	u32 reserved[2];
-	u32 offset[0];
-} __packed;
-
 typedef int (*handle_resource_t) (struct udevice *, void *, int offset, int avail);
 
 static struct resource_table *rsc_table;
diff --git a/include/remoteproc.h b/include/remoteproc.h
index f48054de6b..af5c584e6e 100644
--- a/include/remoteproc.h
+++ b/include/remoteproc.h
@@ -15,6 +15,39 @@
  */
 #include <dm/platdata.h>	/* For platform data support - non dt world */
 
+/**
+ * struct resource_table - firmware resource table header
+ * @ver: version number
+ * @num: number of resource entries
+ * @reserved: reserved (must be zero)
+ * @offset: array of offsets pointing at the various resource entries
+ *
+ * A resource table is essentially a list of system resources required
+ * by the remote processor. It may also include configuration entries.
+ * If needed, the remote processor firmware should contain this table
+ * as a dedicated ".resource_table" ELF section.
+ *
+ * Some resources entries are mere announcements, where the host is informed
+ * of specific remoteproc configuration. Other entries require the host to
+ * do something (e.g. allocate a system resource). Sometimes a negotiation
+ * is expected, where the firmware requests a resource, and once allocated,
+ * the host should provide back its details (e.g. address of an allocated
+ * memory region).
+ *
+ * The header of the resource table, as expressed by this structure,
+ * contains a version number (should we need to change this format in the
+ * future), the number of available resource entries, and their offsets
+ * in the table.
+ *
+ * Immediately following this header are the resource entries themselves.
+ */
+struct resource_table {
+	u32 ver;
+	u32 num;
+	u32 reserved[2];
+	u32 offset[0];
+} __packed;
+
 /**
  * struct fw_rsc_hdr - firmware resource entry header
  * @type: resource type
-- 
2.25.1



More information about the U-Boot mailing list