1 /*
2 * Copyright (c) 2014, Mentor Graphics Corporation
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 *
8 * 1. Redistributions of source code must retain the above copyright notice,
9 * this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright notice,
11 * this list of conditions and the following disclaimer in the documentation
12 * and/or other materials provided with the distribution.
13 * 3. Neither the name of Mentor Graphics Corporation nor the names of its
14 * contributors may be used to endorse or promote products derived from this
15 * software without specific prior written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
18 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
21 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
22 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
23 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
25 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
26 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
27 * POSSIBILITY OF SUCH DAMAGE.
28 */
30 /* This file populates resource table for BM remotes
31 * for use by the Linux Master */
33 #include "openamp/open_amp.h"
34 #include "rsc_table.h"
36 /* Place resource table in special ELF section */
37 #define __section_t(S) __attribute__((__section__(#S)))
38 #define __resource __section_t(.resource_table)
40 #define RPMSG_IPU_C0_FEATURES 1
42 /* VirtIO rpmsg device id */
43 #define VIRTIO_ID_RPMSG_ 7
45 /* Remote supports Name Service announcement */
46 #define VIRTIO_RPMSG_F_NS 0
48 /* Resource table entries */
49 #define ELF_START 0x00000000
50 #define ELF_END 0x08000000
51 #define NUM_VRINGS 0x02
52 #define VRING_ALIGN 0x1000
53 #define RING_TX 0x08000000
54 #define RING_RX 0x08004000
55 #define VRING_SIZE 256
57 const struct remote_resource_table __resource resources = {
58 /* Version */
59 1,
61 /* NUmber of table entries */
62 2,
63 /* reserved fields */
64 {0, 0,},
66 /* Offsets of rsc entries */
67 {
68 offsetof(struct remote_resource_table, elf_cout),
69 offsetof(struct remote_resource_table, rpmsg_vdev),
70 },
72 /* End of ELF file */
73 {
74 RSC_CARVEOUT, ELF_START, ELF_START, ELF_END, 0, 0, "ELF_COUT",
75 },
77 /* Virtio device entry */
78 {RSC_VDEV, VIRTIO_ID_RPMSG_, 0, RPMSG_IPU_C0_FEATURES, 0, 0, 0,
79 NUM_VRINGS, {0, 0},
80 },
82 /* Vring rsc entry - part of vdev rsc entry */
83 {
84 RING_TX, VRING_ALIGN, VRING_SIZE, 1, 0},
85 {
86 RING_RX, VRING_ALIGN, VRING_SIZE, 2, 0},
87 };