Merge drm/drm-next into drm-intel-next
[linux-2.6-microblaze.git] / include / linux / remoteproc.h
index f28ee75..8b795b5 100644 (file)
@@ -315,6 +315,7 @@ struct rproc;
 /**
  * struct rproc_mem_entry - memory entry descriptor
  * @va:        virtual address
+ * @is_iomem: io memory
  * @dma: dma address
  * @len: length, in bytes
  * @da: device address
@@ -329,6 +330,7 @@ struct rproc;
  */
 struct rproc_mem_entry {
        void *va;
+       bool is_iomem;
        dma_addr_t dma;
        size_t len;
        u32 da;
@@ -361,6 +363,7 @@ enum rsc_handling_status {
  * @start:     power on the device and boot it
  * @stop:      power off the device
  * @attach:    attach to a device that his already powered up
+ * @detach:    detach from a device, leaving it powered up
  * @kick:      kick a virtqueue (virtqueue id given as a parameter)
  * @da_to_va:  optional platform hook to perform address translations
  * @parse_fw:  parse firmware to extract information (e.g. resource table)
@@ -368,7 +371,9 @@ enum rsc_handling_status {
  * RSC_HANDLED if resource was handled, RSC_IGNORED if not handled and a
  * negative value on error
  * @load_rsc_table:    load resource table from firmware image
- * @find_loaded_rsc_table: find the loaded resouce table
+ * @find_loaded_rsc_table: find the loaded resource table from firmware image
+ * @get_loaded_rsc_table: get resource table installed in memory
+ *                       by external entity
  * @load:              load firmware to memory, where the remote processor
  *                     expects to find it
  * @sanity_check:      sanity check the fw image
@@ -383,13 +388,16 @@ struct rproc_ops {
        int (*start)(struct rproc *rproc);
        int (*stop)(struct rproc *rproc);
        int (*attach)(struct rproc *rproc);
+       int (*detach)(struct rproc *rproc);
        void (*kick)(struct rproc *rproc, int vqid);
-       void * (*da_to_va)(struct rproc *rproc, u64 da, size_t len);
+       void * (*da_to_va)(struct rproc *rproc, u64 da, size_t len, bool *is_iomem);
        int (*parse_fw)(struct rproc *rproc, const struct firmware *fw);
        int (*handle_rsc)(struct rproc *rproc, u32 rsc_type, void *rsc,
                          int offset, int avail);
        struct resource_table *(*find_loaded_rsc_table)(
                                struct rproc *rproc, const struct firmware *fw);
+       struct resource_table *(*get_loaded_rsc_table)(
+                               struct rproc *rproc, size_t *size);
        int (*load)(struct rproc *rproc, const struct firmware *fw);
        int (*sanity_check)(struct rproc *rproc, const struct firmware *fw);
        u64 (*get_boot_addr)(struct rproc *rproc, const struct firmware *fw);
@@ -405,6 +413,8 @@ struct rproc_ops {
  * @RPROC_RUNNING:     device is up and running
  * @RPROC_CRASHED:     device has crashed; need to start recovery
  * @RPROC_DELETED:     device is deleted
+ * @RPROC_ATTACHED:    device has been booted by another entity and the core
+ *                     has attached to it
  * @RPROC_DETACHED:    device has been booted by another entity and waiting
  *                     for the core to attach to it
  * @RPROC_LAST:                just keep this one at the end
@@ -421,8 +431,9 @@ enum rproc_state {
        RPROC_RUNNING   = 2,
        RPROC_CRASHED   = 3,
        RPROC_DELETED   = 4,
-       RPROC_DETACHED  = 5,
-       RPROC_LAST      = 6,
+       RPROC_ATTACHED  = 5,
+       RPROC_DETACHED  = 6,
+       RPROC_LAST      = 7,
 };
 
 /**
@@ -505,11 +516,12 @@ struct rproc_dump_segment {
  * @recovery_disabled: flag that state if recovery was disabled
  * @max_notifyid: largest allocated notify id.
  * @table_ptr: pointer to the resource table in effect
+ * @clean_table: copy of the resource table without modifications.  Used
+ *              when a remote processor is attached or detached from the core
  * @cached_table: copy of the resource table
  * @table_sz: size of @cached_table
  * @has_iommu: flag to indicate if remote processor is behind an MMU
  * @auto_boot: flag to indicate if remote processor should be auto-started
- * @autonomous: true if an external entity has booted the remote processor
  * @dump_segments: list of segments in the firmware
  * @nb_vdev: number of vdev currently handled by rproc
  * @char_dev: character device of the rproc
@@ -542,11 +554,11 @@ struct rproc {
        bool recovery_disabled;
        int max_notifyid;
        struct resource_table *table_ptr;
+       struct resource_table *clean_table;
        struct resource_table *cached_table;
        size_t table_sz;
        bool has_iommu;
        bool auto_boot;
-       bool autonomous;
        struct list_head dump_segments;
        int nb_vdev;
        u8 elf_class;
@@ -655,6 +667,7 @@ rproc_of_resm_mem_entry_init(struct device *dev, u32 of_resm_idx, size_t len,
 
 int rproc_boot(struct rproc *rproc);
 void rproc_shutdown(struct rproc *rproc);
+int rproc_detach(struct rproc *rproc);
 int rproc_set_firmware(struct rproc *rproc, const char *fw_name);
 void rproc_report_crash(struct rproc *rproc, enum rproc_crash_type type);
 void rproc_coredump_using_sections(struct rproc *rproc);