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