1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
|
/* SPDX-License-Identifier: GPL-2.0 */
/*
* (C) Copyright 2015
* Texas Instruments Incorporated - https://www.ti.com/
*/
#ifndef _RPROC_H_
#define _RPROC_H_
/*
* Note: The platform data support is not meant for use with newer
* platforms. This is meant only for legacy devices. This mode of
* initialization *will* be eventually removed once all necessary
* platforms have moved to dm/fdt.
*/
#include <dm/platdata.h> /* For platform data support - non dt world */
#include <linux/errno.h>
/**
* struct fw_rsc_hdr - firmware resource entry header
* @type: resource type
* @data: resource data
*
* Every resource entry begins with a 'struct fw_rsc_hdr' header providing
* its @type. The content of the entry itself will immediately follow
* this header, and it should be parsed according to the resource type.
*/
struct fw_rsc_hdr {
u32 type;
u8 data[0];
};
/**
* enum fw_resource_type - types of resource entries
*
* @RSC_CARVEOUT: request for allocation of a physically contiguous
* memory region.
* @RSC_DEVMEM: request to iommu_map a memory-based peripheral.
* @RSC_TRACE: announces the availability of a trace buffer into which
* the remote processor will be writing logs.
* @RSC_VDEV: declare support for a virtio device, and serve as its
* virtio header.
* @RSC_PRELOAD_VENDOR: a vendor resource type that needs to be handled by
* remoteproc implementations before loading
* @RSC_POSTLOAD_VENDOR: a vendor resource type that needs to be handled by
* remoteproc implementations after loading
* @RSC_LAST: 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, @RSC_LAST is used to
* check the validity of an index before the lookup table is accessed, so
* please update it as needed.
*/
enum fw_resource_type {
RSC_CARVEOUT = 0,
RSC_DEVMEM = 1,
RSC_TRACE = 2,
RSC_VDEV = 3,
RSC_PRELOAD_VENDOR = 4,
RSC_POSTLOAD_VENDOR = 5,
RSC_LAST = 6,
};
#define FW_RSC_ADDR_ANY (-1)
/**
* struct fw_rsc_carveout - physically contiguous memory request
* @da: device address
* @pa: physical address
* @len: length (in bytes)
* @flags: iommu protection flags
* @reserved: reserved (must be zero)
* @name: human-readable name of the requested memory region
*
* This resource entry requests the host to allocate a physically contiguous
* memory region.
*
* These request entries should precede other firmware resource entries,
* as other entries might request placing other data objects inside
* these memory regions (e.g. data/code segments, trace resource entries, ...).
*
* Allocating memory this way helps utilizing the reserved physical memory
* (e.g. CMA) more efficiently, and also minimizes the number of TLB entries
* needed to map it (in case @rproc is using an IOMMU). Reducing the TLB
* pressure is important; it may have a substantial impact on performance.
*
* If the firmware is compiled with static addresses, then @da should specify
* the expected device address of this memory region. If @da is set to
* FW_RSC_ADDR_ANY, then the host will dynamically allocate it, and then
* overwrite @da with the dynamically allocated address.
*
* We will always use @da to negotiate the device addresses, even if it
* isn't using an iommu. In that case, though, it will obviously contain
* physical addresses.
*
* Some remote processors needs to know the allocated physical address
* even if they do use an iommu. This is needed, e.g., if they control
* hardware accelerators which access the physical memory directly (this
* is the case with OMAP4 for instance). In that case, the host will
* overwrite @pa with the dynamically allocated physical address.
* Generally we don't want to expose physical addresses if we don't have to
* (remote processors are generally _not_ trusted), so we might want to
* change this to happen _only_ when explicitly required by the hardware.
*
* @flags is used to provide IOMMU protection flags, and @name should
* (optionally) contain a human readable name of this carveout region
* (mainly for debugging purposes).
*/
struct fw_rsc_carveout {
u32 da;
u32 pa;
u32 len;
u32 flags;
u32 reserved;
u8 name[32];
};
/**
* struct fw_rsc_devmem - iommu mapping request
* @da: device address
* @pa: physical address
* @len: length (in bytes)
* @flags: iommu protection flags
* @reserved: reserved (must be zero)
* @name: human-readable name of the requested region to be mapped
*
* This resource entry requests the host to iommu map a physically contiguous
* memory region. This is needed in case the remote processor requires
* access to certain memory-based peripherals; _never_ use it to access
* regular memory.
*
* This is obviously only needed if the remote processor is accessing memory
* via an iommu.
*
* @da should specify the required device address, @pa should specify
* the physical address we want to map, @len should specify the size of
* the mapping and @flags is the IOMMU protection flags. As always, @name may
* (optionally) contain a human readable name of this mapping (mainly for
* debugging purposes).
*
* Note: at this point we just "trust" those devmem entries to contain valid
* physical addresses, but this isn't safe and will be changed: eventually we
* want remoteproc implementations to provide us ranges of physical addresses
* the firmware is allowed to request, and not allow firmwares to request
* access to physical addresses that are outside those ranges.
*/
struct fw_rsc_devmem {
u32 da;
u32 pa;
u32 len;
u32 flags;
u32 reserved;
u8 name[32];
};
/**
* struct fw_rsc_trace - trace buffer declaration
* @da: device address
* @len: length (in bytes)
* @reserved: reserved (must be zero)
* @name: human-readable name of the trace buffer
*
* This resource entry provides the host information about a trace buffer
* into which the remote processor will write log messages.
*
* @da specifies the device address of the buffer, @len specifies
* its size, and @name 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..).
*/
struct fw_rsc_trace {
u32 da;
u32 len;
u32 reserved;
u8 name[32];
};
/**
* struct fw_rsc_vdev_vring - vring descriptor entry
* @da: device address
* @align: the alignment between the consumer and producer parts of the vring
* @num: num of buffers supported by this vring (must be power of two)
* @notifyid is a unique rproc-wide notify index for this vring. This notify
* index is used when kicking a remote processor, to let it know that this
* vring is triggered.
* @pa: physical address
*
* This descriptor is not a resource entry by itself; it is part of the
* vdev resource type (see below).
*
* Note that @da should either contain the device address where
* the remote processor is expecting the vring, or indicate that
* dynamically allocation of the vring's device address is supported.
*/
struct fw_rsc_vdev_vring {
u32 da;
u32 align;
u32 num;
u32 notifyid;
u32 pa;
};
/**
* struct fw_rsc_vdev - virtio device header
* @id: virtio device id (as in virtio_ids.h)
* @notifyid is a unique rproc-wide notify index for this vdev. This notify
* index is used when kicking a remote processor, to let it know that the
* status/features of this vdev have changes.
* @dfeatures specifies the virtio device features supported by the firmware
* @gfeatures is a place holder used by the host to write back the
* negotiated features that are supported by both sides.
* @config_len is the size of the virtio config space of this vdev. The config
* space lies in the resource table immediate after this vdev header.
* @status is a place holder where the host will indicate its virtio progress.
* @num_of_vrings indicates how many vrings are described in this vdev header
* @reserved: reserved (must be zero)
* @vring is an array of @num_of_vrings entries of 'struct fw_rsc_vdev_vring'.
*
* This resource is a virtio device header: it provides information about
* the vdev, and is then used by the host and its peer remote processors
* to negotiate and share certain virtio properties.
*
* By providing this resource entry, the firmware essentially asks remoteproc
* to statically allocate a vdev upon registration of the rproc (dynamic vdev
* allocation is not yet supported).
*
* Note: unlike virtualization systems, the term 'host' here means
* the Linux side which is running remoteproc to control the remote
* processors. We use the name 'gfeatures' to comply with virtio's terms,
* though there isn't really any virtualized guest OS here: it's the host
* which is responsible for negotiating the final features.
* Yeah, it's a bit confusing.
*
* Note: immediately following this structure is the virtio config space for
* this vdev (which is specific to the vdev; for more info, read the virtio
* spec). the size of the config space is specified by @config_len.
*/
struct fw_rsc_vdev {
u32 id;
u32 notifyid;
u32 dfeatures;
u32 gfeatures;
u32 config_len;
u8 status;
u8 num_of_vrings;
u8 reserved[2];
struct fw_rsc_vdev_vring vring[0];
};
/**
* struct rproc_mem_entry - memory entry descriptor
* @va: virtual address
* @dma: dma address
* @len: length, in bytes
* @da: device address
* @priv: associated data
* @name: associated memory region name (optional)
* @node: list node
*/
struct rproc_mem_entry {
void *va;
dma_addr_t dma;
int len;
u32 da;
void *priv;
char name[32];
struct list_head node;
};
struct rproc;
typedef u32(*init_func_proto) (u32 core_id, struct rproc *cfg);
struct l3_map {
u32 priv_addr;
u32 l3_addr;
u32 len;
};
struct rproc_intmem_to_l3_mapping {
u32 num_entries;
struct l3_map mappings[16];
};
/**
* enum rproc_crash_type - remote processor crash types
* @RPROC_MMUFAULT: iommu fault
* @RPROC_WATCHDOG: watchdog bite
* @RPROC_FATAL_ERROR fatal error
*
* 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.
*/
enum rproc_crash_type {
RPROC_MMUFAULT,
RPROC_WATCHDOG,
RPROC_FATAL_ERROR,
};
/* we currently support only two vrings per rvdev */
#define RVDEV_NUM_VRINGS 2
#define RPMSG_NUM_BUFS (512)
#define RPMSG_BUF_SIZE (512)
#define RPMSG_TOTAL_BUF_SPACE (RPMSG_NUM_BUFS * RPMSG_BUF_SIZE)
/**
* struct rproc_vring - remoteproc vring state
* @va: virtual address
* @dma: dma address
* @len: length, in bytes
* @da: device address
* @align: vring alignment
* @notifyid: rproc-specific unique vring index
* @rvdev: remote vdev
* @vq: the virtqueue of this vring
*/
struct rproc_vring {
void *va;
dma_addr_t dma;
int len;
u32 da;
u32 align;
int notifyid;
struct rproc_vdev *rvdev;
struct virtqueue *vq;
};
/** struct rproc - structure with all processor specific information for
* loading remotecore from boot loader.
*
* @num_iommus: Number of IOMMUs for this remote core. Zero indicates that the
* processor does not have an IOMMU.
*
* @cma_base: Base address of the carveout for this remotecore.
*
* @cma_size: Length of the carveout in bytes.
*
* @page_table_addr: array with the physical address of the page table. We are
* using the same page table for both IOMMU's. There is currently no strong
* usecase for maintaining different page tables for different MMU's servicing
* the same CPU.
*
* @mmu_base_addr: base address of the MMU
*
* @entry_point: address that is the entry point for the remote core. This
* address is in the memory view of the remotecore.
*
* @load_addr: Address to which the bootloader loads the firmware from
* persistent storage before invoking the ELF loader. Keeping this address
* configurable allows future optimizations such as loading the firmware from
* storage for remotecore2 via EDMA while the CPU is processing the ELF image
* of remotecore1. This address is in the memory view of the A15.
*
* @firmware_name: Name of the file that is expected to contain the ELF image.
*
* @has_rsc_table: Flag populated after parsing the ELF binary on target.
*/
struct rproc {
u32 num_iommus;
unsigned long cma_base;
u32 cma_size;
unsigned long page_table_addr;
unsigned long mmu_base_addr[2];
unsigned long load_addr;
unsigned long entry_point;
char *core_name;
char *firmware_name;
char *ptn;
init_func_proto start_clocks;
init_func_proto config_mmu;
init_func_proto config_peripherals;
init_func_proto start_core;
u32 has_rsc_table;
struct rproc_intmem_to_l3_mapping *intmem_to_l3_mapping;
u32 trace_pa;
u32 trace_len;
};
extern struct rproc *rproc_cfg_arr[2];
/**
* enum rproc_mem_type - What type of memory model does the rproc use
* @RPROC_INTERNAL_MEMORY_MAPPED: Remote processor uses own memory and is memory
* mapped to the host processor over an address range.
*
* Please note that this is an enumeration of memory model of different types
* of remote processors. Few of the remote processors do have own internal
* memories, while others use external memory for instruction and data.
*/
enum rproc_mem_type {
RPROC_INTERNAL_MEMORY_MAPPED = 0,
};
/**
* struct dm_rproc_uclass_pdata - platform data for a CPU
* @name: Platform-specific way of naming the Remote proc
* @mem_type: one of 'enum rproc_mem_type'
* @driver_plat_data: driver specific platform data that may be needed.
*
* This can be accessed with dev_get_uclass_plat() for any UCLASS_REMOTEPROC
* device.
*
*/
struct dm_rproc_uclass_pdata {
const char *name;
enum rproc_mem_type mem_type;
void *driver_plat_data;
};
/**
* struct dm_rproc_ops - Driver model remote proc operations.
*
* This defines the operations provided by remote proc driver.
*/
struct dm_rproc_ops {
/**
* init() - Initialize the remoteproc device (optional)
*
* This is called after the probe is completed allowing the remote
* processor drivers to split up the initializations between probe and
* init if needed.
*
* @dev: Remote proc device
* @return 0 if all ok, else appropriate error value.
*/
int (*init)(struct udevice *dev);
/**
* load() - Load the remoteproc device using data provided (mandatory)
*
* Load the remoteproc device with an image, do not start the device.
*
* @dev: Remote proc device
* @addr: Address of the image to be loaded
* @size: Size of the image to be loaded
* @return 0 if all ok, else appropriate error value.
*/
int (*load)(struct udevice *dev, ulong addr, ulong size);
/**
* start() - Start the remoteproc device (mandatory)
*
* @dev: Remote proc device
* @return 0 if all ok, else appropriate error value.
*/
int (*start)(struct udevice *dev);
/**
* stop() - Stop the remoteproc device (optional)
*
* @dev: Remote proc device
* @return 0 if all ok, else appropriate error value.
*/
int (*stop)(struct udevice *dev);
/**
* reset() - Reset the remoteproc device (optional)
*
* @dev: Remote proc device
* @return 0 if all ok, else appropriate error value.
*/
int (*reset)(struct udevice *dev);
/**
* is_running() - Check if the remote processor is running (optional)
*
* @dev: Remote proc device
* @return 0 if running, 1 if not running, -ve on error.
*/
int (*is_running)(struct udevice *dev);
/**
* ping() - Ping the remote device for basic communication (optional)
*
* @dev: Remote proc device
* @return 0 on success, 1 if not responding, -ve on other errors.
*/
int (*ping)(struct udevice *dev);
/**
* device_to_virt() - Return translated virtual address (optional)
*
* Translate a device address (remote processor view) to virtual
* address (main processor view).
*
* @dev: Remote proc device
* @da: Device address
* @size: Size of the memory region @da is pointing to
* @return virtual address.
*/
void * (*device_to_virt)(struct udevice *dev, ulong da, ulong size);
int (*add_res)(struct udevice *dev,
struct rproc_mem_entry *mapping);
void * (*alloc_mem)(struct udevice *dev, unsigned long len,
unsigned long align);
unsigned int (*config_pagetable)(struct udevice *dev, unsigned int virt,
unsigned int phys, unsigned int len);
};
/* Accessor */
#define rproc_get_ops(dev) ((struct dm_rproc_ops *)(dev)->driver->ops)
#if CONFIG_IS_ENABLED(REMOTEPROC)
/**
* rproc_init() - Initialize all bound remote proc devices
* Return: 0 if all ok, else appropriate error value.
*/
int rproc_init(void);
/**
* rproc_dev_init() - Initialize a remote proc device based on id
* @id: id of the remote processor
* Return: 0 if all ok, else appropriate error value.
*/
int rproc_dev_init(int id);
/**
* rproc_is_initialized() - check to see if remoteproc devices are initialized
* Return: true if all devices are initialized, false otherwise.
*/
bool rproc_is_initialized(void);
/**
* rproc_load() - load binary or elf to a remote processor
* @id: id of the remote processor
* @addr: address in memory where the image is located
* @size: size of the image
* Return: 0 if all ok, else appropriate error value.
*/
int rproc_load(int id, ulong addr, ulong size);
/**
* rproc_start() - Start a remote processor
* @id: id of the remote processor
* Return: 0 if all ok, else appropriate error value.
*/
int rproc_start(int id);
/**
* rproc_stop() - Stop a remote processor
* @id: id of the remote processor
* Return: 0 if all ok, else appropriate error value.
*/
int rproc_stop(int id);
/**
* rproc_reset() - reset a remote processor
* @id: id of the remote processor
* Return: 0 if all ok, else appropriate error value.
*/
int rproc_reset(int id);
/**
* rproc_ping() - ping a remote processor to check if it can communicate
* @id: id of the remote processor
* Return: 0 if all ok, else appropriate error value.
*
* NOTE: this might need communication path available, which is not implemented
* as part of remoteproc framework - hook on to appropriate bus architecture to
* do the same
*/
int rproc_ping(int id);
/**
* rproc_is_running() - check to see if remote processor is running
* @id: id of the remote processor
* Return: 0 if running, 1 if not running, -ve on error.
*
* NOTE: this may not involve actual communication capability of the remote
* processor, but just ensures that it is out of reset and executing code.
*/
int rproc_is_running(int id);
/**
* rproc_elf32_sanity_check() - Verify if an image is a valid ELF32 one
*
* Check if a valid ELF32 image exists at the given memory location. Verify
* basic ELF32 format requirements like magic number and sections size.
*
* @addr: address of the image to verify
* @size: size of the image
* Return: 0 if the image looks good, else appropriate error value.
*/
int rproc_elf32_sanity_check(ulong addr, ulong size);
/**
* rproc_elf64_sanity_check() - Verify if an image is a valid ELF32 one
*
* Check if a valid ELF64 image exists at the given memory location. Verify
* basic ELF64 format requirements like magic number and sections size.
*
* @addr: address of the image to verify
* @size: size of the image
* Return: 0 if the image looks good, else appropriate error value.
*/
int rproc_elf64_sanity_check(ulong addr, ulong size);
/**
* rproc_elf32_load_image() - load an ELF32 image
* @dev: device loading the ELF32 image
* @addr: valid ELF32 image address
* @size: size of the image
* Return: 0 if the image is successfully loaded, else appropriate error value.
*/
int rproc_elf32_load_image(struct udevice *dev, unsigned long addr, ulong size);
/**
* rproc_elf64_load_image() - load an ELF64 image
* @dev: device loading the ELF64 image
* @addr: valid ELF64 image address
* @size: size of the image
* Return: 0 if the image is successfully loaded, else appropriate error value.
*/
int rproc_elf64_load_image(struct udevice *dev, ulong addr, ulong size);
/**
* rproc_elf_load_image() - load an ELF image
* @dev: device loading the ELF image
* @addr: valid ELF image address
* @size: size of the image
*
* Auto detects if the image is ELF32 or ELF64 image and load accordingly.
* 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);
unsigned long rproc_parse_resource_table(struct udevice *dev,
struct rproc *cfg);
struct resource_table *rproc_find_resource_table(struct udevice *dev,
unsigned int addr,
int *tablesz);
#else
static inline int rproc_init(void) { return -ENOSYS; }
static inline int rproc_dev_init(int id) { return -ENOSYS; }
static inline bool rproc_is_initialized(void) { return false; }
static inline int rproc_load(int id, ulong addr, ulong size) { return -ENOSYS; }
static inline int rproc_start(int id) { return -ENOSYS; }
static inline int rproc_stop(int id) { return -ENOSYS; }
static inline int rproc_reset(int id) { return -ENOSYS; }
static inline int rproc_ping(int id) { return -ENOSYS; }
static inline int rproc_is_running(int id) { return -ENOSYS; }
static inline int rproc_elf32_sanity_check(ulong addr,
ulong size) { return -ENOSYS; }
static inline int rproc_elf64_sanity_check(ulong addr,
ulong size) { return -ENOSYS; }
static inline int rproc_elf_sanity_check(ulong addr,
ulong size) { return -ENOSYS; }
static inline int rproc_elf32_load_image(struct udevice *dev,
unsigned long addr, ulong size)
{ return -ENOSYS; }
static inline int rproc_elf64_load_image(struct udevice *dev, ulong addr,
ulong size)
{ return -ENOSYS; }
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_ */
|