remoteproc_internal.h 3.18 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
/*
 * Remote processor framework
 *
 * Copyright (C) 2011 Texas Instruments, Inc.
 * Copyright (C) 2011 Google, Inc.
 *
 * Ohad Ben-Cohen <ohad@wizery.com>
 * Brian Swetland <swetland@google.com>
 *
 * This software is licensed under the terms of the GNU General Public
 * License version 2, as published by the Free Software Foundation, and
 * may be copied, distributed, and modified under those terms.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 */

#ifndef REMOTEPROC_INTERNAL_H
#define REMOTEPROC_INTERNAL_H

#include <linux/irqreturn.h>
24
#include <linux/firmware.h>
25
26
27
28
29
30

struct rproc;

/* from remoteproc_core.c */
void rproc_release(struct kref *kref);
irqreturn_t rproc_vq_interrupt(struct rproc *rproc, int vq_id);
31
void rproc_vdev_release(struct kref *ref);
32

33
34
35
/* from remoteproc_virtio.c */
int rproc_add_virtio_dev(struct rproc_vdev *rvdev, int id);
void rproc_remove_virtio_dev(struct rproc_vdev *rvdev);
36
37
38
39

/* from remoteproc_debugfs.c */
void rproc_remove_trace_file(struct dentry *tfile);
struct dentry *rproc_create_trace_file(const char *name, struct rproc *rproc,
40
				       struct rproc_mem_entry *trace);
41
42
43
44
45
void rproc_delete_debug_dir(struct rproc *rproc);
void rproc_create_debug_dir(struct rproc *rproc);
void rproc_init_debugfs(void);
void rproc_exit_debugfs(void);

46
47
48
49
50
/* from remoteproc_sysfs.c */
extern struct class rproc_class;
int rproc_init_sysfs(void);
void rproc_exit_sysfs(void);

51
52
void rproc_free_vring(struct rproc_vring *rvring);
int rproc_alloc_vring(struct rproc_vdev *rvdev, int i);
53
54

void *rproc_da_to_va(struct rproc *rproc, u64 da, int len);
55
int rproc_trigger_recovery(struct rproc *rproc);
56

57
58
59
int rproc_elf_sanity_check(struct rproc *rproc, const struct firmware *fw);
u32 rproc_elf_get_boot_addr(struct rproc *rproc, const struct firmware *fw);
int rproc_elf_load_segments(struct rproc *rproc, const struct firmware *fw);
60
int rproc_elf_load_rsc_table(struct rproc *rproc, const struct firmware *fw);
61
62
63
struct resource_table *rproc_elf_find_loaded_rsc_table(struct rproc *rproc,
						       const struct firmware *fw);

64
65
66
static inline
int rproc_fw_sanity_check(struct rproc *rproc, const struct firmware *fw)
{
67
68
	if (rproc->ops->sanity_check)
		return rproc->ops->sanity_check(rproc, fw);
69
70
71
72
73
74
75

	return 0;
}

static inline
u32 rproc_get_boot_addr(struct rproc *rproc, const struct firmware *fw)
{
76
77
	if (rproc->ops->get_boot_addr)
		return rproc->ops->get_boot_addr(rproc, fw);
78
79
80
81
82
83
84

	return 0;
}

static inline
int rproc_load_segments(struct rproc *rproc, const struct firmware *fw)
{
85
86
	if (rproc->ops->load)
		return rproc->ops->load(rproc, fw);
87
88
89
90

	return -EINVAL;
}

91
92
static inline int rproc_load_rsc_table(struct rproc *rproc,
				       const struct firmware *fw)
93
{
94
95
	if (rproc->ops->load_rsc_table)
		return rproc->ops->load_rsc_table(rproc, fw);
96

97
	return 0;
98
99
}

100
101
static inline
struct resource_table *rproc_find_loaded_rsc_table(struct rproc *rproc,
102
						   const struct firmware *fw)
103
{
104
105
	if (rproc->ops->find_loaded_rsc_table)
		return rproc->ops->find_loaded_rsc_table(rproc, fw);
106

107
	return NULL;
108
109
}

110
#endif /* REMOTEPROC_INTERNAL_H */