riscv: Add SBI v0.2 extension definitions
[oweals/u-boot.git] / include / remoteproc.h
index 812e0f47c4be4ccf76428801f61905bad385fe3e..a903acb9b24ffb9154758df2a480843082e30586 100644 (file)
@@ -267,6 +267,74 @@ int rproc_elf64_load_image(struct udevice *dev, ulong addr, ulong size);
  * @return 0 if the image is successfully loaded, else appropriate error value.
  */
 int rproc_elf_load_image(struct udevice *dev, unsigned long addr, ulong size);
+
+/**
+ * rproc_elf_get_boot_addr() - Get rproc's boot address.
+ * @dev:       device loading the ELF image
+ * @addr:      valid ELF image address
+ *
+ * This function returns the entry point address of the ELF
+ * image.
+ */
+ulong rproc_elf_get_boot_addr(struct udevice *dev, ulong addr);
+
+/**
+ * rproc_elf32_load_rsc_table() - load the resource table from an ELF32 image
+ *
+ * Search for the resource table in an ELF32 image, and if found, copy it to
+ * device memory.
+ *
+ * @dev:       device loading the resource table
+ * @fw_addr:   ELF image address
+ * @fw_size:   size of the ELF image
+ * @rsc_addr:  pointer to the found resource table address. Updated on
+ *             operation success
+ * @rsc_size:  pointer to the found resource table size. Updated on operation
+ *             success
+ *
+ * @return 0 if a valid resource table is successfully loaded, -ENODATA if there
+ * is no resource table (which is optional), or another appropriate error value.
+ */
+int rproc_elf32_load_rsc_table(struct udevice *dev, ulong fw_addr,
+                              ulong fw_size, ulong *rsc_addr, ulong *rsc_size);
+/**
+ * rproc_elf64_load_rsc_table() - load the resource table from an ELF64 image
+ *
+ * Search for the resource table in an ELF64 image, and if found, copy it to
+ * device memory.
+ *
+ * @dev:       device loading the resource table
+ * @fw_addr:   ELF image address
+ * @fw_size:   size of the ELF image
+ * @rsc_addr:  pointer to the found resource table address. Updated on
+ *             operation success
+ * @rsc_size:  pointer to the found resource table size. Updated on operation
+ *             success
+ *
+ * @return 0 if a valid resource table is successfully loaded, -ENODATA if there
+ * is no resource table (which is optional), or another appropriate error value.
+ */
+int rproc_elf64_load_rsc_table(struct udevice *dev, ulong fw_addr,
+                              ulong fw_size, ulong *rsc_addr, ulong *rsc_size);
+/**
+ * rproc_elf_load_rsc_table() - load the resource table from an ELF image
+ *
+ * Auto detects if the image is ELF32 or ELF64 image and search accordingly for
+ * the resource table, and if found, copy it to device memory.
+ *
+ * @dev:       device loading the resource table
+ * @fw_addr:   ELF image address
+ * @fw_size:   size of the ELF image
+ * @rsc_addr:  pointer to the found resource table address. Updated on
+ *             operation success
+ * @rsc_size:  pointer to the found resource table size. Updated on operation
+ *             success
+ *
+ * @return 0 if a valid resource table is successfully loaded, -ENODATA if there
+ * is no resource table (which is optional), or another appropriate error value.
+ */
+int rproc_elf_load_rsc_table(struct udevice *dev, ulong fw_addr,
+                            ulong fw_size, ulong *rsc_addr, ulong *rsc_size);
 #else
 static inline int rproc_init(void) { return -ENOSYS; }
 static inline int rproc_dev_init(int id) { return -ENOSYS; }
@@ -292,6 +360,20 @@ static inline int rproc_elf64_load_image(struct udevice *dev, ulong addr,
 static inline int rproc_elf_load_image(struct udevice *dev, ulong addr,
                                       ulong size)
 { return -ENOSYS; }
+static inline ulong rproc_elf_get_boot_addr(struct udevice *dev, ulong addr)
+{ return 0; }
+static inline int rproc_elf32_load_rsc_table(struct udevice *dev, ulong fw_addr,
+                                            ulong fw_size, ulong *rsc_addr,
+                                            ulong *rsc_size)
+{ return -ENOSYS; }
+static inline int rproc_elf64_load_rsc_table(struct udevice *dev, ulong fw_addr,
+                                            ulong fw_size, ulong *rsc_addr,
+                                            ulong *rsc_size)
+{ return -ENOSYS; }
+static inline int rproc_elf_load_rsc_table(struct udevice *dev, ulong fw_addr,
+                                          ulong fw_size, ulong *rsc_addr,
+                                          ulong *rsc_size)
+{ return -ENOSYS; }
 #endif
 
 #endif /* _RPROC_H_ */