Not use remoteproc_plat in ZynqMP apps helper functions
authorWendy Liang <jliang@xilinx.com>
Thu, 22 Sep 2016 06:34:36 +0000 (23:34 -0700)
committerWendy Liang <jliang@xilinx.com>
Fri, 14 Oct 2016 00:05:35 +0000 (17:05 -0700)
As remoteproc_plat has been removed, update the ZynqMP Linux
userspace apps helper functions not to use those APIs.

Signed-off-by: Wendy Liang <jliang@xilinx.com>
apps/machine/zynqmp/platform_info.c
apps/system/linux/machine/zynqmp/helper.c

index 4c955bc091e23fb85c496e1beef6be9b7b94104b..e0c5f69ec68a69df1f7aab6b21604483eedcaf7b 100755 (executable)
  **************************************************************************/
 
 #include "openamp/hil.h"
-#include "openamp/remoteproc_plat.h"
 #include "metal/atomic.h"
-#include "platform_info.h"
 
-#define IPI_CHN_BITMASK                   0x00000100 /* IPI channel bit mask APU<->RPU0 */
-#define REMOTE_CPU_ID                     0
+#define RPU_CPU_ID             0 /* RPU ID */
+#define IPI_CHN_BITMASK        0x00000100 /* IPI channel bit mask APU<->RPU0 */
+#define RPMSG_CHAN_NAME        "rpmsg-openamp-demo-channel"
+#define DEV_BUS_NAME           "platform"
+#define IPI_DEV_NAME           "ff340000.ipi"
+#define VRING_DEV_NAME         "3ed40000.vring"
+#define SHM_DEV_NAME           "3ed80000.shm"
 
 /* -- FIX ME: ipi info is to be defined -- */
 struct ipi_info {
-       uint32_t ipi_chn_mask;
-       int need_reg;
-       atomic_int sync;
+        const char *name;
+        const char *bus_name;
+        struct meta_device *dev;
+        struct metal_io_region *io;
+       metal_phys_addr_t paddr;
+        uint32_t ipi_chn_mask;
+        int need_reg;
+        atomic_int sync;
 };
-/* Reference implementation that show cases platform_get_cpu_info and 
- platform_get_for_firmware API implementation for Bare metal environment */
 
 extern struct hil_platform_ops zynqmp_a53_r5_proc_ops;
 
 static struct ipi_info chn_ipi_info[] = {
-       { IPI_CHN_BITMASK, 1, 0},
-       { IPI_CHN_BITMASK, 0, 0},
+       {IPI_DEV_NAME, DEV_BUS_NAME, NULL, NULL, 0, IPI_CHN_BITMASK, 1, 0},
+       {IPI_DEV_NAME, DEV_BUS_NAME, NULL, NULL, 0, IPI_CHN_BITMASK, 0, 0},
 };
 
-struct rproc_info_plat_local proc_table = {
-       {
-               /* CPU ID of master */
-               REMOTE_CPU_ID,
-
-               /* HIL platform ops table. */
-               &zynqmp_a53_r5_proc_ops,
-       },
-       /* vring0 ipi device and vring descriptors memory device */
-       {
-               PLAT_RSC_VRING,
-               "platform",
-               "ff340000.ipi",
-               &chn_ipi_info[0],
-               "platform",
-               "3ed40000.vring",
-       },
-       /* vring0 ipi device and vring descriptors memory device */
-       {
-               PLAT_RSC_VRING,
-               "platform",
-               "ff340000.ipi",
-               &chn_ipi_info[1],
-               "platform",
-               "3ed40000.vring",
-       },
-       /* Shared memory device */
-       {
-               PLAT_RSC_SHM,
-               "shm",
-               0, /* UNDEFINED, up to the I/O region size */
-       },
-       /* Shared memory device */
-       {
-               PLAT_RSC_RPMSG_CHANNEL,
-               "rpmsg-openamp-demo-channel",
-       },
-       PLAT_RSC_LAST,
-};
 
 const struct firmware_info fw_table[] =
 {
@@ -111,4 +78,25 @@ const struct firmware_info fw_table[] =
         0}
 };
 
-int fw_table_size = sizeof(fw_table)/sizeof(struct firmware_info);
+const int fw_table_size = sizeof(fw_table)/sizeof(struct firmware_info);
+
+struct hil_proc *platform_create_proc(int proc_index)
+{
+       (void) proc_index;
+       struct hil_proc *proc;
+       proc = hil_create_proc(&zynqmp_a53_r5_proc_ops, RPU_CPU_ID, NULL);
+       if (!proc)
+               return NULL;
+
+       /* Setup IPI info */
+       hil_set_ipi(proc, 0, (unsigned int)(-1), (void *)&chn_ipi_info[0]);
+       hil_set_ipi(proc, 1, (unsigned int)(-1), (void *)&chn_ipi_info[1]);
+       /* Setup vring info */
+       hil_set_vring(proc, 0, DEV_BUS_NAME, VRING_DEV_NAME);
+       hil_set_vring(proc, 1, DEV_BUS_NAME, VRING_DEV_NAME);
+       /* Setup shared memory info */
+       hil_set_shm (proc, DEV_BUS_NAME, SHM_DEV_NAME, 0, 0x40000);
+       /* Setup RPMSG channel info */
+       hil_set_rpmsg_channel(proc, 0, RPMSG_CHAN_NAME);
+       return proc;
+}
index b19894aa5d098be70807737e798eb4d866dcd191..589835a6dc95598db04297952150ea743300af88 100644 (file)
 #include <string.h>
 #include <stdio.h>
 #include "metal/sys.h"
-#include "metal/shmem.h"
-#include "metal/device.h"
-#include "metal/io.h"
-
-#define SHM_DEV_NAME "3ed80000.shm"
-#define SHM_BUS_NAME "platform"
-
-static struct metal_device *shm_dev;
-static struct metal_generic_shmem shm;
 
 void init_system()
 {
-       int ret;
-       struct metal_io_region *io;
        struct metal_init_params metal_param = METAL_INIT_DEFAULTS;
 
        metal_init(&metal_param);
 
-       /* Register the UIO shared memory */
-       /* This will be a temporary solution, we should
-        * use DMA memory in fugure.
-        */
-       ret = metal_device_open(SHM_BUS_NAME, SHM_DEV_NAME, &shm_dev);
-       if (ret) {
-               fprintf(stderr, "ERROR: Failed to open shared memory device.\n");
-               return;
-       }
-       io = metal_device_io_region(shm_dev, 0);
-       if (!io) {
-               fprintf(stderr, "ERROR: Failed to get the I/O region of shared memory.\n");
-               return;
-       }
-
-       memset(&shm, 0, sizeof(struct metal_generic_shmem));
-       shm.name = "shm";
-       memcpy((void *)&shm.io, io, sizeof(struct metal_io_region));
-       ret = metal_shmem_register_generic(&shm);
-       if (ret) {
-               fprintf(stderr, "ERROR: Failed to registered shared memory.\n");
-               return;
-       }
        return;
 }
 
 void cleanup_system()
 {
-       if (shm_dev)
-               metal_device_close(shm_dev);
        metal_finish();
 }