Linux Kernel
3.7.1
Main Page
Related Pages
Modules
Namespaces
Data Structures
Files
File List
Globals
All
Data Structures
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
Groups
Pages
include
linux
remoteproc.h
Go to the documentation of this file.
1
/*
2
* Remote Processor Framework
3
*
4
* Copyright(c) 2011 Texas Instruments, Inc.
5
* Copyright(c) 2011 Google, Inc.
6
* All rights reserved.
7
*
8
* Redistribution and use in source and binary forms, with or without
9
* modification, are permitted provided that the following conditions
10
* are met:
11
*
12
* * Redistributions of source code must retain the above copyright
13
* notice, this list of conditions and the following disclaimer.
14
* * Redistributions in binary form must reproduce the above copyright
15
* notice, this list of conditions and the following disclaimer in
16
* the documentation and/or other materials provided with the
17
* distribution.
18
* * Neither the name Texas Instruments nor the names of its
19
* contributors may be used to endorse or promote products derived
20
* from this software without specific prior written permission.
21
*
22
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
25
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
26
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
27
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
28
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
29
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
30
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
32
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33
*/
34
35
#ifndef REMOTEPROC_H
36
#define REMOTEPROC_H
37
38
#include <linux/types.h>
39
#include <
linux/klist.h
>
40
#include <
linux/mutex.h
>
41
#include <linux/virtio.h>
42
#include <
linux/completion.h
>
43
#include <
linux/idr.h
>
44
72
struct
resource_table
{
73
u32
ver
;
74
u32
num
;
75
u32
reserved
[2];
76
u32
offset
[0];
77
}
__packed
;
78
88
struct
fw_rsc_hdr
{
89
u32
type
;
90
u8
data
[0];
91
}
__packed
;
92
113
enum
fw_resource_type
{
114
RSC_CARVEOUT
= 0,
115
RSC_DEVMEM
= 1,
116
RSC_TRACE
= 2,
117
RSC_VDEV
= 3,
118
RSC_LAST
= 4,
119
};
120
121
#define FW_RSC_ADDR_ANY (0xFFFFFFFFFFFFFFFF)
122
166
struct
fw_rsc_carveout
{
167
u32
da
;
168
u32
pa
;
169
u32
len
;
170
u32
flags
;
171
u32
reserved
;
172
u8
name
[32];
173
}
__packed
;
174
204
struct
fw_rsc_devmem
{
205
u32
da
;
206
u32
pa
;
207
u32
len
;
208
u32
flags
;
209
u32
reserved
;
210
u8
name
[32];
211
}
__packed
;
212
229
struct
fw_rsc_trace
{
230
u32
da
;
231
u32
len
;
232
u32
reserved
;
233
u8
name
[32];
234
}
__packed
;
235
253
struct
fw_rsc_vdev_vring
{
254
u32
da
;
255
u32
align
;
256
u32
num
;
257
u32
notifyid
;
258
u32
reserved
;
259
}
__packed
;
260
296
struct
fw_rsc_vdev
{
297
u32
id
;
298
u32
notifyid
;
299
u32
dfeatures
;
300
u32
gfeatures
;
301
u32
config_len
;
302
u8
status
;
303
u8
num_of_vrings
;
304
u8
reserved
[2];
305
struct
fw_rsc_vdev_vring
vring
[0];
306
}
__packed
;
307
317
struct
rproc_mem_entry
{
318
void
*
va
;
319
dma_addr_t
dma
;
320
int
len
;
321
u32
da
;
322
void
*
priv
;
323
struct
list_head
node
;
324
};
325
326
struct
rproc
;
327
334
struct
rproc_ops
{
335
int
(*
start
)(
struct
rproc
*
rproc
);
336
int
(*
stop
)(
struct
rproc
*
rproc
);
337
void
(*
kick
)(
struct
rproc
*
rproc
,
int
vqid);
338
};
339
355
enum
rproc_state
{
356
RPROC_OFFLINE
= 0,
357
RPROC_SUSPENDED
= 1,
358
RPROC_RUNNING
= 2,
359
RPROC_CRASHED
= 3,
360
RPROC_LAST
= 4,
361
};
362
372
enum
rproc_crash_type
{
373
RPROC_MMUFAULT
,
374
};
375
405
struct
rproc
{
406
struct
klist_node
node
;
407
struct
iommu_domain
*
domain
;
408
const
char
*
name
;
409
const
char
*
firmware
;
410
void
*
priv
;
411
const
struct
rproc_ops
*
ops
;
412
struct
device
dev
;
413
const
struct
rproc_fw_ops
*
fw_ops
;
414
atomic_t
power
;
415
unsigned
int
state
;
416
struct
mutex
lock
;
417
struct
dentry
*
dbg_dir
;
418
struct
list_head
traces
;
419
int
num_traces
;
420
struct
list_head
carveouts
;
421
struct
list_head
mappings
;
422
struct
completion
firmware_loading_complete
;
423
u32
bootaddr
;
424
struct
list_head
rvdevs
;
425
struct
idr
notifyids
;
426
int
index
;
427
struct
work_struct
crash_handler
;
428
unsigned
crash_cnt
;
429
struct
completion
crash_comp
;
430
bool
recovery_disabled
;
431
int
max_notifyid
;
432
};
433
434
/* we currently support only two vrings per rvdev */
435
#define RVDEV_NUM_VRINGS 2
436
448
struct
rproc_vring
{
449
void
*
va
;
450
dma_addr_t
dma
;
451
int
len
;
452
u32
da
;
453
u32
align
;
454
int
notifyid
;
455
struct
rproc_vdev
*
rvdev
;
456
struct
virtqueue
*
vq
;
457
};
458
468
struct
rproc_vdev
{
469
struct
list_head
node
;
470
struct
rproc
*
rproc
;
471
struct
virtio_device
vdev
;
472
struct
rproc_vring
vring
[
RVDEV_NUM_VRINGS
];
473
unsigned
long
dfeatures
;
474
unsigned
long
gfeatures
;
475
};
476
477
struct
rproc
*
rproc_alloc
(
struct
device
*
dev
,
const
char
*
name
,
478
const
struct
rproc_ops
*
ops
,
479
const
char
*
firmware
,
int
len);
480
void
rproc_put
(
struct
rproc
*
rproc
);
481
int
rproc_add
(
struct
rproc
*
rproc
);
482
int
rproc_del
(
struct
rproc
*
rproc
);
483
484
int
rproc_boot
(
struct
rproc
*
rproc
);
485
void
rproc_shutdown
(
struct
rproc
*
rproc
);
486
void
rproc_report_crash
(
struct
rproc
*
rproc
,
enum
rproc_crash_type
type
);
487
488
static
inline
struct
rproc_vdev
*vdev_to_rvdev(
struct
virtio_device
*
vdev
)
489
{
490
return
container_of
(vdev,
struct
rproc_vdev
, vdev);
491
}
492
493
static
inline
struct
rproc
*vdev_to_rproc(
struct
virtio_device
*vdev)
494
{
495
struct
rproc_vdev
*rvdev = vdev_to_rvdev(vdev);
496
497
return
rvdev->
rproc
;
498
}
499
500
#endif
/* REMOTEPROC_H */
Generated on Thu Jan 10 2013 14:52:28 for Linux Kernel by
1.8.2