ipc: rpmsg_service: Remove virtual shared memory device
A virtual metal_device is created, next the needed IO regions are created and added to this device. Immediately we extract these regions back out and make use of them. There is no reason to create the metal_device and add the IO regions to it, instead simply use the IO regions directly. This is similar to what was already done to the openamp_rsc_table sample. Signed-off-by: Andrew Davis <afd@ti.com>
This commit is contained in:
parent
8ccc43912f
commit
d58542fcc4
@ -13,7 +13,6 @@
|
||||
#include <zephyr/logging/log.h>
|
||||
|
||||
#include <openamp/open_amp.h>
|
||||
#include <metal/device.h>
|
||||
|
||||
#define LOG_MODULE_NAME rpmsg_backend
|
||||
LOG_MODULE_REGISTER(LOG_MODULE_NAME, CONFIG_RPMSG_SERVICE_LOG_LEVEL);
|
||||
@ -61,25 +60,7 @@ static const struct device *const ipm_handle =
|
||||
#endif
|
||||
|
||||
static metal_phys_addr_t shm_physmap[] = { SHM_START_ADDR };
|
||||
static struct metal_device shm_device = {
|
||||
.name = SHM_DEVICE_NAME,
|
||||
.bus = NULL,
|
||||
.num_regions = 1,
|
||||
{
|
||||
{
|
||||
.virt = (void *) SHM_START_ADDR,
|
||||
.physmap = shm_physmap,
|
||||
.size = SHM_SIZE,
|
||||
.page_shift = 0xffffffff,
|
||||
.page_mask = 0xffffffff,
|
||||
.mem_flags = 0,
|
||||
.ops = { NULL },
|
||||
},
|
||||
},
|
||||
.node = { NULL },
|
||||
.irq_num = 0,
|
||||
.irq_info = NULL
|
||||
};
|
||||
static struct metal_io_region shm_io;
|
||||
|
||||
static struct virtio_vring_info rvrings[2] = {
|
||||
[0] = {
|
||||
@ -184,7 +165,6 @@ int rpmsg_backend_init(struct metal_io_region **io, struct virtio_device *vdev)
|
||||
{
|
||||
int32_t err;
|
||||
struct metal_init_params metal_params = METAL_INIT_DEFAULTS;
|
||||
struct metal_device *device;
|
||||
|
||||
/* Start IPM workqueue */
|
||||
k_work_queue_start(&ipm_work_q, ipm_stack_area,
|
||||
@ -202,23 +182,9 @@ int rpmsg_backend_init(struct metal_io_region **io, struct virtio_device *vdev)
|
||||
return err;
|
||||
}
|
||||
|
||||
err = metal_register_generic_device(&shm_device);
|
||||
if (err) {
|
||||
LOG_ERR("Couldn't register shared memory device: %d", err);
|
||||
return err;
|
||||
}
|
||||
|
||||
err = metal_device_open("generic", SHM_DEVICE_NAME, &device);
|
||||
if (err) {
|
||||
LOG_ERR("metal_device_open failed: %d", err);
|
||||
return err;
|
||||
}
|
||||
|
||||
*io = metal_device_io_region(device, 0);
|
||||
if (!*io) {
|
||||
LOG_ERR("metal_device_io_region failed to get region");
|
||||
return err;
|
||||
}
|
||||
/* declare shared memory region */
|
||||
metal_io_init(&shm_io, (void *)SHM_START_ADDR, shm_physmap, SHM_SIZE, -1, 0, NULL);
|
||||
*io = &shm_io;
|
||||
|
||||
/* IPM setup */
|
||||
#if defined(CONFIG_RPMSG_SERVICE_DUAL_IPM_SUPPORT)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user