]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - processor-sdk/open-amp.git/blob - apps/machine/zynq7/platform_info.c
apps: zynq7: remove setting rproc platform data funciton
[processor-sdk/open-amp.git] / apps / machine / zynq7 / platform_info.c
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 /**************************************************************************
31  * FILE NAME
32  *
33  *       platform_info.c
34  *
35  * DESCRIPTION
36  *
37  *       This file implements APIs to get platform specific
38  *       information for OpenAMP. 
39  *
40  **************************************************************************/
42 #include <string.h>
43 #include "openamp/hil.h"
45 /* Reference implementation that show cases platform_get_cpu_info and 
46  platform_get_for_firmware API implementation for Bare metal environment */
48 extern struct hil_platform_ops zynq_a9_proc_ops;
50 /* IPC Device parameters */
51 #define SHM_ADDR                          (void *)0x08008000
52 #define SHM_SIZE                          0x00200000
53 #define VRING0_IPI_VECT                   15
54 #define VRING1_IPI_VECT                   14
55 #define MASTER_CPU_ID                     0
56 #define REMOTE_CPU_ID                     1
58 /**
59  * This array provdes defnition of CPU nodes for master and remote
60  * context. It contains two nodes beacuse the same file is intended
61  * to use with both master and remote configurations. On zynq platform
62  * only one node defintion is required for master/remote as there
63  * are only two cores present in the platform.
64  *
65  * Only platform specific info is populated here. Rest of information
66  * is obtained during resource table parsing.The platform specific
67  * information includes;
68  *
69  * -CPU ID
70  * -Shared Memory
71  * -Interrupts
72  * -Channel info.
73  *
74  * Although the channel info is not platform specific information
75  * but it is conveneient to keep it in HIL so that user can easily
76  * provide it without modifying the generic part.
77  *
78  * It is good idea to define hil_proc structure with platform
79  * specific fields populated as this can be easily copied to hil_proc
80  * structure passed as parameter in platform_get_processor_info. The
81  * other option is to populate the required structures individually
82  * and copy them one by one to hil_proc structure in platform_get_processor_info
83  * function. The first option is adopted here.
84  *
85  *
86  * 1) First node in the array is intended for the remote contexts and it
87  *    defines Master CPU ID, shared memory, interrupts info, number of channels
88  *    and there names. This node defines only one channel
89  *   "rpmsg-openamp-demo-channel".
90  *
91  * 2)Second node is required by the master and it defines remote CPU ID,
92  *   shared memory and interrupts info. In general no channel info is required by the
93  *   Master node, however in baremetal master and linux remote case the linux
94  *   rpmsg bus driver behaves as master so the rpmsg driver on linux side still needs
95  *   channel info. This information is not required by the masters for baremetal
96  *   remotes. 
97  *
98  */
99 struct hil_proc proc_table[] = {
101         /* CPU node for remote context */
102         {
103          /* CPU ID of master */
104          MASTER_CPU_ID,
106          /* Shared memory info - Last field is not used currently */
107          {
108           SHM_ADDR, SHM_SIZE, 0x00},
110          /* VirtIO device info */
111          {
112           /* Leave these three fields empty as these are obtained from rsc
113            * table.
114            */
115           0, 0, 0,
117           /* Vring info */
118           {
120            {
121             /* Provide only vring interrupts info here. Other fields are
122              * obtained from the resource table so leave them empty.
123              */
124             NULL, NULL, 0, 0,
125             {
126              VRING0_IPI_VECT, 0x1006, 1, NULL}
127             },
128            {
129             NULL, NULL, 0, 0,
130             {
131              VRING1_IPI_VECT, 0x1006, 1, NULL}
132             }
133            }
134           },
136          /* Number of RPMSG channels */
137          1,
139          /* RPMSG channel info - Only channel name is expected currently */
140          {
141           {"rpmsg-openamp-demo-channel"}
142           },
144          /* HIL platform ops table. */
145          &zynq_a9_proc_ops,
147          /* Next three fields are for future use only */
148          0,
149          0,
150          NULL,
151          {NULL, NULL}
152         },
153 };
155 int platform_get_processor_for_fw(char *fw_name)
158         return 1;