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