Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Enumerations
remoteproc.h File Reference
#include <linux/types.h>
#include <linux/klist.h>
#include <linux/mutex.h>
#include <linux/virtio.h>
#include <linux/completion.h>
#include <linux/idr.h>

Go to the source code of this file.

Data Structures

struct  resource_table
 
struct  fw_rsc_hdr
 
struct  fw_rsc_carveout
 
struct  fw_rsc_devmem
 
struct  fw_rsc_trace
 
struct  fw_rsc_vdev_vring
 
struct  fw_rsc_vdev
 
struct  rproc_mem_entry
 
struct  rproc_ops
 
struct  rproc
 
struct  rproc_vring
 
struct  rproc_vdev
 

Macros

#define FW_RSC_ADDR_ANY   (0xFFFFFFFFFFFFFFFF)
 

Enumerations

enum  fw_resource_type {
  RSC_CARVEOUT = 0, RSC_DEVMEM = 1, RSC_TRACE = 2, RSC_VDEV = 3,
  RSC_LAST = 4
}
 
may contain a human readable name of the trace buffer.

After booting the remote processor, the trace buffers are exposed to the user via debugfs entries (called trace0, trace1, etc..).

enum  rproc_state {
  RPROC_OFFLINE = 0, RPROC_SUSPENDED = 1, RPROC_RUNNING = 2, RPROC_CRASHED = 3,
  RPROC_LAST = 4
}
 
enum  rproc_crash_type { RPROC_MMUFAULT }
 

Variables

should

(optionally) contain a human readable name of this carveout region (mainly for debugging purposes).

struct resource_table __packed
 

: human readable name of the rproc

struct rproc - represents a physical remote processor device : klist node of this rproc object : iommu domain

: name of firmware file to be loaded : private data which belongs to the platform-specific rproc module : platform-specific start/stop rproc handlers : virtual device for refcounting and common remoteproc behavior : firmware-specific handlers : refcount of users who need this rproc powered up : state of the device : lock which protects concurrent manipulations of the rproc : debugfs directory of this rproc device : list of trace buffers : number of trace buffers : list of physically contiguous memory allocations : list of iommu mappings we initiated, needed on shutdown : marks e/o asynchronous firmware loading : address of first instruction to boot rproc with (optional) : list of remote virtio devices : idr for dynamically assigning rproc-wide unique notify ids : index of this rproc device : workqueue for handling a crash : crash counter : completion used to sync crash handler and the rproc reload : flag that state if recovery was disabled : largest allocated notify id.

#define RVDEV_NUM_VRINGS   2
 
struct rprocrproc_alloc (struct device *dev, const char *name, const struct rproc_ops *ops, const char *firmware, int len)
 
void rproc_put (struct rproc *rproc)
 
int rproc_add (struct rproc *rproc)
 
int rproc_del (struct rproc *rproc)
 
int rproc_boot (struct rproc *rproc)
 
void rproc_shutdown (struct rproc *rproc)
 
void rproc_report_crash (struct rproc *rproc, enum rproc_crash_type type)
 

Macro Definition Documentation

#define FW_RSC_ADDR_ANY   (0xFFFFFFFFFFFFFFFF)

Definition at line 121 of file remoteproc.h.

#define RVDEV_NUM_VRINGS   2

Definition at line 435 of file remoteproc.h.

Enumeration Type Documentation

enum fw_resource_type - types of resource entries

: request for allocation of a physically contiguous memory region. : request to iommu_map a memory-based peripheral. : announces the availability of a trace buffer into which the remote processor will be writing logs. : declare support for a virtio device, and serve as its virtio header. : just keep this one at the end

For more details regarding a specific resource type, please see its dedicated structure below.

Please note that these values are used as indices to the rproc_handle_rsc lookup table, so please keep them sane. Moreover, is used to check the validity of an index before the lookup table is accessed, so please update it as needed.

Enumerator:
RSC_CARVEOUT 
RSC_DEVMEM 
RSC_TRACE 
RSC_VDEV 
RSC_LAST 

Definition at line 113 of file remoteproc.h.

enum rproc_crash_type - remote processor crash types : iommu fault

Each element of the enum is used as an array index. So that, the value of the elements should be always something sane.

Feel free to add more types when needed.

Enumerator:
RPROC_MMUFAULT 

Definition at line 372 of file remoteproc.h.

enum rproc_state - remote processor states : device is powered off : device is suspended; needs to be woken up to receive a message. : device is up and running : device has crashed; need to start recovery : just keep this one at the end

Please note that the values of these states are used as indices to rproc_state_string, a state-to-name lookup table, so please keep the two synchronized. is used to check the validity of an index before the lookup table is accessed, so please update it as needed too.

Enumerator:
RPROC_OFFLINE 
RPROC_SUSPENDED 
RPROC_RUNNING 
RPROC_CRASHED 
RPROC_LAST 

Definition at line 355 of file remoteproc.h.

Function Documentation

int rproc_add ( struct rproc rproc)

rproc_add() - register a remote processor : the remote processor handle to register

Registers with the remoteproc framework, after it has been allocated with rproc_alloc().

This is called by the platform-specific rproc implementation, whenever a new remote processor device is probed.

Returns 0 on success and an appropriate error code otherwise.

Note: this function initiates an asynchronous firmware loading context, which will look for virtio devices supported by the rproc's firmware.

If found, those virtio devices will be created and added, so as a result of registering this remote processor, additional virtio drivers might be probed.

Definition at line 1145 of file remoteproc_core.c.

struct rproc* rproc_alloc ( struct device dev,
const char name,
const struct rproc_ops ops,
const char firmware,
int  len 
)
read

Definition at line 1220 of file remoteproc_core.c.

int rproc_boot ( struct rproc rproc)

rproc_boot() - boot a remote processor : handle of a remote processor

Boot a remote processor (i.e. load its firmware, power it on, ...).

If the remote processor is already powered on, this function immediately returns (successfully).

Returns 0 on success, and an appropriate error value otherwise.

Definition at line 1000 of file remoteproc_core.c.

int rproc_del ( struct rproc rproc)

rproc_del() - unregister a remote processor : rproc handle to unregister

This function should be called when the platform specific rproc implementation decides to remove the rproc device. it should only be called if a previous invocation of rproc_add() has completed successfully.

After rproc_del() returns, isn't freed yet, because of the outstanding reference created by rproc_alloc. To decrement that one last refcount, one still needs to call rproc_put().

Returns 0 on success and -EINVAL if isn't valid.

Definition at line 1307 of file remoteproc_core.c.

void rproc_put ( struct rproc rproc)

rproc_put() - unroll rproc_alloc() : the remote processor handle

This function decrements the rproc dev refcount.

If no one holds any reference to rproc anymore, then its refcount would now drop to zero, and it would be freed.

Definition at line 1286 of file remoteproc_core.c.

void rproc_report_crash ( struct rproc rproc,
enum rproc_crash_type  type 
)

rproc_report_crash() - rproc crash reporter function : remote processor : crash type

This function must be called every time a crash is detected by the low-level drivers implementing a specific remoteproc. This should not be called from a non-remoteproc driver.

This function can be called from atomic/interrupt context.

Definition at line 1338 of file remoteproc_core.c.

void rproc_shutdown ( struct rproc rproc)

rproc_shutdown() - power off the remote processor : the remote processor

Power off a remote processor (previously booted with rproc_boot()).

In case is still being used by an additional user(s), then this function will just decrement the power refcount and exit, without really powering off the device.

Every call to rproc_boot() must (eventually) be accompanied by a call to rproc_shutdown(). Calling rproc_shutdown() redundantly is a bug.

Notes:

  • we're not decrementing the rproc's refcount, only the power refcount. which means that the handle stays valid even after rproc_shutdown() returns, and users can still use it with a subsequent rproc_boot(), if needed.

Definition at line 1082 of file remoteproc_core.c.

Variable Documentation