Commit e93d6898 authored by Anna Suman's avatar Anna Suman Committed by Hari Kanigeri

SYSLINK:sys manager changes and bug fixes

This patch adds sysmanager module to Syslink.
Sys-manager handles IPC setup and manages booting
of Co-processors.
Signed-off-by: default avatarAnna Suman <suman-anna@ti.com>
Signed-off-by: default avatarSimon Que <sque@ti.com>
Signed-off-by: default avatarArun Gopalakrishna <arunmg@ti.com>
Signed-off-by: default avatarsubramaniam <subramaniam.ca@ti.com>
parent cdd36dde
......@@ -36,7 +36,9 @@ enum ipc_command_count {
LISTMP_SHAREDMEMORY_CMD_NOS = 18,
MESSAGEQ_CMD_NOS = 17,
MESSAGEQ_TRANSPORTSHM_CMD_NOS = 9,
NAMESERVERREMOTENOTIFY_CMD_NOS = 8
NAMESERVERREMOTENOTIFY_CMD_NOS = 8,
SYSMGR_CMD_NOS = 2,
SYSMEMMGR_CMD_NOS = 6
};
enum ipc_command_ranges {
......@@ -74,10 +76,17 @@ enum ipc_command_ranges {
NAMESERVERREMOTENOTIFY_BASE_CMD = 160,
NAMESERVERREMOTENOTIFY_END_CMD = (NAMESERVERREMOTENOTIFY_BASE_CMD + \
NAMESERVERREMOTENOTIFY_CMD_NOS - 1)
NAMESERVERREMOTENOTIFY_CMD_NOS - 1),
SYSMGR_BASE_CMD = 170,
SYSMGR_END_CMD = (SYSMGR_BASE_CMD + \
SYSMGR_CMD_NOS - 1),
SYSMEMMGR_BASE_CMD = 180,
SYSMEMMGR_END_CMD = (SYSMEMMGR_BASE_CMD + \
SYSMEMMGR_CMD_NOS - 1)
};
int ipc_ioc_router(u32 cmd, ulong arg);
#endif /* _IPC_IOCTL_H */
......@@ -21,6 +21,9 @@
#include <linux/types.h>
#define VOLATILE volatile
/*
* Unique module ID
*/
......
......@@ -19,6 +19,8 @@
#include <linux/types.h>
#include <syslink/multiproc.h>
#define PROCMGR_MODULEID 0xf2ba
/*
......
......@@ -4,7 +4,8 @@ gatepeterson.o gatepeterson_ioctl.o sharedregion.o sharedregion_ioctl.o \
nameserver_remote.o nameserver_remotenotify.o listmp_sharedmemory.o \
listmp.o listmp_sharedmemory_ioctl.o messageq.o messageq_ioctl.o \
messageq_transportshm.o messageq_transportshm_ioctl.o \
nameserver_remotenotify_ioctl.o platform_mem.o ipc_ioctl.o ipc_drv.o
nameserver_remotenotify_ioctl.o platform_mem.o sysmgr.o sysmgr_ioctl.o \
sysmemmgr.o sysmemmgr_ioctl.o platformcfg.o platform.o ipc_ioctl.o ipc_drv.o
obj-$(CONFIG_MPU_SYSLINK_IPC) += syslink_ipc.o
syslink_ipc-objs = $(libservices) $(libsyslink_ipc)
......
......@@ -29,6 +29,7 @@
#include <sharedregion.h>
#include <gatepeterson.h>
/* IPC stubs */
/*
......@@ -66,10 +67,10 @@ struct gatepeterson_moduleobject {
* Structure defining attribute parameters for the Gate Peterson module
*/
struct gatepeterson_attrs {
volatile u32 version;
volatile u32 status;
volatile u16 creator_proc_id;
volatile u16 opener_proc_id;
VOLATILE u32 version;
VOLATILE u32 status;
VOLATILE u16 creator_proc_id;
VOLATILE u16 opener_proc_id;
};
/*
......@@ -77,9 +78,9 @@ struct gatepeterson_attrs {
*/
struct gatepeterson_obj {
struct list_head elem;
volatile struct gatepeterson_attrs *attrs; /* Instance attr */
volatile u32 *flag[2]; /* Falgs for processors */
volatile u32 *turn; /* Indicates whoes turn it is now? */
VOLATILE struct gatepeterson_attrs *attrs; /* Instance attr */
VOLATILE u32 *flag[2]; /* Falgs for processors */
VOLATILE u32 *turn; /* Indicates whoes turn it is now? */
u8 self_id; /* Self identifier */
u8 other_id; /* Other's identifier */
u32 nested; /* Counter to track nesting */
......@@ -168,8 +169,7 @@ int gatepeterson_setup(const struct gatepeterson_config *config)
if (atomic_inc_return(&gatepeterson_state.ref_count)
!= GATEPETERSON_MAKE_MAGICSTAMP(1)) {
retval = -EEXIST;
goto exit;
return 1;
}
if (config == NULL) {
......@@ -707,9 +707,9 @@ u32 gatepeterson_enter(void *gphandle)
/* Wait while other processor is using the resource and has
* the turn
*/
while ((*((volatile u32 *) obj->flag[obj->other_id])
while ((*((VOLATILE u32 *) obj->flag[obj->other_id])
== GATEPETERSON_BUSY) &&
(*((volatile u32 *)obj->turn) == obj->other_id))
(*((VOLATILE u32 *)obj->turn) == obj->other_id))
; /* Empty body loop */
}
......@@ -742,7 +742,7 @@ void gatepeterson_leave(void *gphandle, u32 flag)
obj = (struct gatepeterson_obj *)handle->obj;
obj->nested--;
if (obj->nested == 0)
*((volatile u32 *)obj->flag[obj->self_id]) = GATEPETERSON_FREE;
*((VOLATILE u32 *)obj->flag[obj->self_id]) = GATEPETERSON_FREE;
if (obj->local_gate != NULL)
mutex_unlock(obj->local_gate);
......
......@@ -42,7 +42,6 @@
/* brief Macro to make a correct module magic number with refCount */
#define HEAPBUF_MAKE_MAGICSTAMP(x) ((HEAPBUF_MODULEID << 12) | (x))
#define VOLATILE volatile
/*
* Structure defining attribute parameters for the heapbuf module
......@@ -172,8 +171,7 @@ int heapbuf_setup(const struct heapbuf_config *cfg)
if (atomic_inc_return(&heapbuf_state.ref_count)
!= HEAPBUF_MAKE_MAGICSTAMP(1)) {
retval = -EEXIST;
goto error;
return 1;
}
if (cfg == NULL) {
......
......@@ -29,6 +29,8 @@
#include <messageq_ioctl.h>
#include <messageq_transportshm_ioctl.h>
#include <nameserver_remotenotify_ioctl.h>
#include <sysmgr_ioctl.h>
#include <sysmemmgr_ioctl.h>
/*
* ======== ipc_ioctl_router ========
......@@ -70,9 +72,14 @@ int ipc_ioc_router(u32 cmd, ulong arg)
else if (ioc_nr >= NAMESERVERREMOTENOTIFY_BASE_CMD &&
ioc_nr <= NAMESERVERREMOTENOTIFY_END_CMD)
retval = nameserver_remotenotify_ioctl(NULL, NULL, cmd, arg);
else if (ioc_nr >= SYSMGR_BASE_CMD &&
ioc_nr <= SYSMGR_END_CMD)
retval = sysmgr_ioctl(NULL, NULL, cmd, arg);
else if (ioc_nr >= SYSMEMMGR_BASE_CMD &&
ioc_nr <= SYSMEMMGR_END_CMD)
retval = sysmemmgr_ioctl(NULL, NULL, cmd, arg);
else
retval = -ENOTTY;
return retval;
}
......@@ -243,8 +243,7 @@ int listmp_sharedmemory_setup(struct listmp_config *config)
if (atomic_inc_return(&listmp_sharedmemory_state.ref_count)
!= LISTMPSHAREDMEMORY_MAKE_MAGICSTAMP(1)) {
status = -EEXIST;
goto exit;
return 1;
}
if (config == NULL) {
......
......@@ -82,10 +82,9 @@ static inline int listmp_sharedmemory_ioctl_setup(
}
status = listmp_sharedmemory_setup(&config);
cargs->api_status = status;
if (unlikely(status))
goto exit;
cargs->api_status = status;
exit:
return retval;
}
......
......@@ -311,8 +311,7 @@ int messageq_setup(const struct messageq_config *cfg)
MESSAGEQ_MAKE_MAGICSTAMP(0));
if (atomic_inc_return(&messageq_state.ref_count)
!= MESSAGEQ_MAKE_MAGICSTAMP(1)) {
status = -EEXIST;
goto exit;
return 1;
}
if (cfg == NULL) {
......
......@@ -34,7 +34,6 @@
#include <listmp_sharedmemory.h>
#include <messageq_transportshm.h>
/* =============================================================================
* Globals
* =============================================================================
......@@ -78,8 +77,8 @@ struct messageq_transportshm_moduleobject {
* Structure of attributes in shared memory
*/
struct messageq_transportshm_attrs {
volatile u32 version;
volatile u32 flag;
VOLATILE u32 version;
VOLATILE u32 flag;
};
/*
......@@ -87,13 +86,13 @@ struct messageq_transportshm_attrs {
* instances.
*/
struct messageq_transportshm_object {
volatile struct messageq_transportshm_attrs *attrs[2];
VOLATILE struct messageq_transportshm_attrs *attrs[2];
/* Attributes for both processors */
void *my_listmp_handle;
/* List for this processor */
void *remote_listmp_handle;
/* List for remote processor */
volatile int status;
VOLATILE int status;
/* Current status */
int my_index;
/* 0 | 1 */
......@@ -217,14 +216,13 @@ int messageq_transportshm_setup(const struct messageq_transportshm_config *cfg)
/* This sets the refCount variable is not initialized, upper 16 bits is
* written with module Id to ensure correctness of refCount variable.
*/
atomic_cmpmask_and_set(&messageq_transportshm_state.ref_count,
atomic_cmpmask_and_set(&messageq_transportshm_state.ref_count,
MESSAGEQTRANSPORTSHM_MAKE_MAGICSTAMP(0),
MESSAGEQTRANSPORTSHM_MAKE_MAGICSTAMP(0));
if (atomic_inc_return(&messageq_transportshm_state.ref_count)
!= MESSAGEQTRANSPORTSHM_MAKE_MAGICSTAMP(1u)) {
status = -EEXIST;;
goto exit;
return 1;
}
if (cfg == NULL) {
......@@ -367,7 +365,7 @@ void *messageq_transportshm_create(u16 proc_id,
int my_index;
int remote_index;
listmp_sharedmemory_params listmp_params[2];
volatile u32 *otherflag;
VOLATILE u32 *otherflag;
gt_2trace(mqtshm_debugmask, GT_ENTER, "messageq_transportshm_create",
proc_id, params);
......@@ -464,7 +462,7 @@ void *messageq_transportshm_create(u16 proc_id,
handle->attrs[my_index]->version = MESSAGEQ_TRANSPORTSHM_VERSION;
handle->attrs[my_index]->flag = MESSAGEQ_TRANSPORTSHM_UP;
/* Store in volatile to make sure it is not compiled out... */
/* Store in VOLATILE to make sure it is not compiled out... */
otherflag = &(handle->attrs[remote_index]->flag);
gt_1trace(mqtshm_debugmask, GT_1CLASS, "messageq_transportshm_create\n"
"Synchronization flag addr [0x%x]", otherflag);
......
......@@ -97,7 +97,7 @@ s32 multiproc_setup(struct multiproc_config *cfg)
if (atomic_inc_return(&multiproc_state.ref_count)
!= MULTIPROC_MAKE_MAGICSTAMP(1u)) {
status = -EEXIST;
status = 1;
} else {
if (cfg == NULL) {
multiproc_get_config(&tmp_cfg);
......
......@@ -69,8 +69,15 @@ static int mproc_ioctl_destroy(struct multiproc_cmd_args *cargs)
static int mproc_ioctl_get_config(struct multiproc_cmd_args *cargs)
{
struct multiproc_config config;
u32 size;
multiproc_get_config(&config);
size = copy_to_user(cargs->args.get_config.config, &config,
sizeof(struct multiproc_config));
if (size) {
cargs->api_status = -EFAULT;
return 0;
}
cargs->api_status = 0;
return 0;
}
......
......@@ -238,8 +238,7 @@ int nameserver_setup(void)
if (atomic_inc_return(&nameserver_state.ref_count)
!= NAMESERVER_MAKE_MAGICSTAMP(1)) {
retval = -EEXIST;
goto exit;
return 1;
}
nr_procs = multiproc_get_max_processors();
......
......@@ -105,32 +105,39 @@
#define HEAPBUF_BLOCKSIZE 256
/*! @brief Start of shared memory */
#define SHAREDMEMORY_BASEADDR 0x87100000
#define SHAREDMEMORY_BASEADDR 0x87B00000
#define SHAREDMEMORY_BASESIZE 0x0007F000
/*! @brief Start of Boot load page */
#define BOOTLOADPAGE_BASEADDR 0x8717F000
#define BOOTLOADPAGE_BASEADDR 0x9807F000
#define BOOTLOADPAGE_BASESIZE 0x00001000
/*! @brief Start of shared memory */
#define SHAREDMEMORY_BASEADDR_APPM3 0x87180000
#define SHAREDMEMORY_BASEADDR_APPM3 0x87B80000
#define SHAREDMEMORY_BASESIZE_APPM3 0x0007F000
/*! @brief Start of Boot load page */
#define BOOTLOADPAGE_BASEADDR_APPM3 0x8718F000
#define BOOTLOADPAGE_BASESIZE_APPM3 0x0000F000
/*!
* @brief Size of the shared memory heap, this heap is used for providing
* shared memory to drivers/instances. Should not be used for any other purpose.
*/
#define SMHEAP_SIZE 0x10000
#define SMHEAP_SIZE 0x7F000
/*!
* @brief Shared region index for Shared memory heap.
*/
#define SMHEAP_SRINDEX 0
/*!
* @brief Shared region index for SysM3 boot load page
*/
#define BOOTLOADPAGE_SRINDEX 1
/*!
* @brief Event no used by sysmemmgr
*/
......@@ -233,12 +240,13 @@ struct platform_proc_config_params {
u32 use_notify;
u32 use_messageq;
u32 use_heapbuf;
u32 use_frameq;
u32 use_ring_io;
u32 use_listmp;
u32 use_nameserver;
u32 reserved2;
};
/** ============================================================================
* Macros and types
* ============================================================================
......@@ -264,7 +272,8 @@ struct platform_proc_config_params {
static struct proc4430_mem_entry mem_entries[NUM_MEM_ENTRIES] = {
{
"DUCATI_SHM", /* NAME : Name of the memory region */
0x87100000, /* PHYSADDR : Physical address */
SHAREDMEMORY_BASEADDR,
/* PHYSADDR : Physical address */
0x98000000, /* SLAVEVIRTADDR : Slave virtual address */
(u32) -1u,
/* MASTERVIRTADDR : Master virtual address (if known) */
......@@ -273,7 +282,8 @@ static struct proc4430_mem_entry mem_entries[NUM_MEM_ENTRIES] = {
},
{
"DUCATI_SHM1", /* NAME : Name of the memory region */
0x87180000, /* PHYSADDR : Physical address */
SHAREDMEMORY_BASEADDR_APPM3,
/* PHYSADDR : Physical address */
0x98080000, /* SLAVEVIRTADDR : Slave virtual address */
(u32) -1u,
/* MASTERVIRTADDR : Master virtual address (if known) */
......@@ -397,7 +407,7 @@ s32 platform_setup(struct sysmgr_config *config)
status = SYSMGR_E_FAIL;
goto proc_mgr_create_fail;
}
goto exit;
proc_mgr_create_fail:
printk(KERN_ERR "platform_setup: proc_mgr_create failed [0x%x]",
status);
......@@ -495,6 +505,9 @@ void platform_load_callback(void *arg)
} else {
/* Zero out the boot load page */
memset((void *) sh_addr_base, 0, BOOTLOADPAGE_BASESIZE);
sharedregion_add(BOOTLOADPAGE_SRINDEX, sh_addr_base,
BOOTLOADPAGE_BASESIZE);
/* Set the boot load page address */
sysmgr_set_boot_load_page(proc_id, sh_addr_base);
......@@ -505,7 +518,7 @@ void platform_load_callback(void *arg)
platform_sm_heap_phys_addr = sysmemmgr_translate(
platform_sm_heap_virt_addr,
sysmemmgr_xltflag_kvirt2phys);
info.base = (void *) platform_sm_heap_phys_addr;
info.base = (void *) 0x98000000;
/* Write info the boot load page */
nwrite = sysmgr_put_object_config(proc_id,
......@@ -549,6 +562,8 @@ void platform_start_callback(void *arg)
struct platform_messageq_transportshm_params pmqt_params;
/*u32 proc_ids[2];*/
printk(KERN_ERR "platform_start_callback\n");
/* Wait for slave to write the scalability info */
sysmgr_wait_for_scalability_info(proc_id);
/* Read the scalability info */
......@@ -576,6 +591,7 @@ void platform_start_callback(void *arg)
platform_notify_ducatidrv_params));
} while (nread != \
sizeof(struct platform_notify_ducatidrv_params));
sh_addr = (u32)sharedregion_get_ptr((u32 *)
pnds_params.shared_mem_addr);
if (sh_addr == (u32)NULL) {
......@@ -808,6 +824,7 @@ void platform_start_callback(void *arg)
}
}
}
goto exit;
messageq_transportshm_create_fail:
printk(KERN_ERR "platform_start_callback: "
......@@ -899,7 +916,7 @@ void platform_stop_callback(void *arg)
"gatepeterson_close failed [0x%x]", status);
}
status = heapbuf_close(&platform_heap_handle);
status = heapbuf_close(platform_heap_handle);
if (status < 0) {
printk(KERN_ERR "platform_stop_callback : "
"heapbuf_close failed [0x%x]", status);
......@@ -922,6 +939,12 @@ void platform_stop_callback(void *arg)
printk(KERN_ERR "platform_stop_callback : "
"sharedregion_remove failed [0x%x]", status);
}
status = sharedregion_remove(1);
if (status < 0) {
printk(KERN_ERR "platform_stop_callback : "
"sharedregion_remove failed [0x%x]", status);
}
}
EXPORT_SYMBOL(platform_stop_callback);
/* FIXME: since application has to call this API for now */
......@@ -73,8 +73,7 @@ int platform_mem_setup(void)
PLATFORM_MEM_MAKE_MAGICSTAMP(0));
if (atomic_inc_return(&platform_mem_state.ref_count)
!= PLATFORM_MEM_MAKE_MAGICSTAMP(1)) {
retval = -EEXIST;
goto exit;
return 1;
}
/* Create the Gate handle */
......
......@@ -20,15 +20,6 @@
#include <linux/types.h>
#include <linux/module.h>
/* Utilities headers */
/*#include <linux/string.h>
#include <linux/list.h>
#include <linux/slab.h>
#include <linux/semaphore.h>*/
/* Utilities & Osal headers */
/*#include <Gate.h>
#include <GateMutex.h>*/
#include <syslink/atomic_linux.h>
/* Module headers */
......@@ -37,6 +28,7 @@
#include <sysmgr.h>
#include <_sysmgr.h>
#include <platform.h>
#include <platform_mem.h>
#include <gatepeterson.h>
#include <sharedregion.h>
......@@ -103,8 +95,6 @@
/* Macro to make a correct module magic number with ref_count */
#define SYSMGR_MAKE_MAGICSTAMP(x) ((SYSMGR_MODULEID << 12) | (x))
/* FIXME: Using macro for minimum checkpatch errors */
#define VOLATILE volatile
/* =============================================================================
* Structures & Enums
......@@ -245,7 +235,7 @@ void sysmgr_get_config(struct sysmgr_config *config)
nameserver_remotenotify_get_config(
&config->nameserver_remotenotify_cfg);
}
EXPORT_SYMBOL(sysmgr_get_config);
/*
* ======== sysmgr_get_object_config ========
......@@ -364,7 +354,7 @@ s32 sysmgr_setup(const struct sysmgr_config *cfg)
if (atomic_inc_return(&sysmgr_state.ref_count)
!= SYSMGR_MAKE_MAGICSTAMP(1)) {
status = SYSMGR_S_ALREADYSETUP;
status = 1;
goto exit;
}
......@@ -377,14 +367,25 @@ s32 sysmgr_setup(const struct sysmgr_config *cfg)
config = (struct sysmgr_config *) cfg;
}
/* Initialize PlatformMem */
status = platform_mem_setup();
if (status < 0) {
printk(KERN_ERR "sysmgr_setup : platform_mem_setup "
"failed [0x%x]\n", status);
} else {
printk(KERN_ERR "platform_mem_setup_setup : status [0x%x]\n" ,
status);
}
/* Override the platform specific configuration */
platform_override_config(config);
status = multiproc_setup(&(config->multiproc_cfg));
if (status < 0) {
printk(KERN_ERR "sysmgr_setup : multiproc_setup "
"failed [0x%x]", status);
"failed [0x%x]\n", status);
} else {
printk(KERN_ERR "sysmgr_setup : status [0x%x]\n" , status);
sysmgr_state.multiproc_init_flag = true;
}
......@@ -393,8 +394,10 @@ s32 sysmgr_setup(const struct sysmgr_config *cfg)
status = proc_mgr_setup(&(config->proc_mgr_cfg));
if (status < 0) {
printk(KERN_ERR "sysmgr_setup : proc_mgr_setup "
"failed [0x%x]", status);
"failed [0x%x]\n", status);
} else {
printk(KERN_ERR "proc_mgr_setup : status [0x%x]\n" ,
status);
sysmgr_state.proc_mgr_init_flag = true;
}
}
......@@ -404,8 +407,10 @@ s32 sysmgr_setup(const struct sysmgr_config *cfg)
status = sharedregion_setup(&config->sharedregion_cfg);
if (status < 0) {
printk(KERN_ERR "sysmgr_setup : sharedregion_setup "
"failed [0x%x]", status);
"failed [0x%x]\n", status);
} else {
printk(KERN_ERR "sharedregion_setup : status [0x%x]\n" ,
status);
sysmgr_state.sharedregion_init_flag = true;
}
}
......@@ -415,8 +420,10 @@ s32 sysmgr_setup(const struct sysmgr_config *cfg)
status = notify_setup(&config->notify_cfg);
if (status < 0) {
printk(KERN_ERR "sysmgr_setup : notify_setup "
"failed [0x%x]", status);
"failed [0x%x]\n", status);
} else {
printk(KERN_ERR "notify_setup : status [0x%x]\n" ,
status);
sysmgr_state.notify_init_flag = true;
}
}
......@@ -426,8 +433,10 @@ s32 sysmgr_setup(const struct sysmgr_config *cfg)
status = nameserver_setup();
if (status < 0) {
printk(KERN_ERR "sysmgr_setup : nameserver_setup "
"failed [0x%x]", status);
"failed [0x%x]\n", status);
} else {
printk(KERN_ERR "nameserver_setup : status [0x%x]\n" ,
status);
sysmgr_state.nameserver_init_flag = true;
}
}
......@@ -437,8 +446,10 @@ s32 sysmgr_setup(const struct sysmgr_config *cfg)
status = gatepeterson_setup(&config->gatepeterson_cfg);
if (status < 0) {
printk(KERN_ERR "sysmgr_setup : gatepeterson_setup "
"failed [0x%x]", status);
"failed [0x%x]\n", status);
} else {
printk(KERN_ERR "gatepeterson_setup : status [0x%x]\n" ,
status);
sysmgr_state.gatepeterson_init_flag = true;
}
}
......@@ -448,8 +459,10 @@ s32 sysmgr_setup(const struct sysmgr_config *cfg)
status = messageq_setup(&config->messageq_cfg);
if (status < 0) {
printk(KERN_ERR "sysmgr_setup : messageq_setup "
"failed [0x%x]", status);
"failed [0x%x]\n", status);
} else {
printk(KERN_ERR "messageq_setup : status [0x%x]\n" ,
status);
sysmgr_state.messageq_init_flag = true;
}
}
......@@ -459,8 +472,10 @@ s32 sysmgr_setup(const struct sysmgr_config *cfg)
status = heapbuf_setup(&config->heapbuf_cfg);
if (status < 0) {
printk(KERN_ERR "sysmgr_setup : heapbuf_setup "
"failed [0x%x]", status);
"failed [0x%x]\n", status);
} else {
printk(KERN_ERR "heapbuf_setup : status [0x%x]\n" ,
status);
sysmgr_state.heapbuf_init_flag = true;
}
}
......@@ -471,9 +486,11 @@ s32 sysmgr_setup(const struct sysmgr_config *cfg)
&config->listmp_sharedmemory_cfg);
if (status < 0) {
printk(KERN_ERR "sysmgr_setup : "
"listmp_sharedmemory_setup failed [0x%x]",
"listmp_sharedmemory_setup failed [0x%x]\n",
status);
} else {
printk(KERN_ERR "listmp_sharedmemory_setup : "
"status [0x%x]\n" , status);
sysmgr_state.listmp_sharedmemory_init_flag = true;
}
}
......@@ -484,9 +501,11 @@ s32 sysmgr_setup(const struct sysmgr_config *cfg)
&config->messageq_transportshm_cfg);
if (status < 0) {
printk(KERN_ERR "sysmgr_setup : "
"messageq_transportshm_setup failed [0x%x]",
"messageq_transportshm_setup failed [0x%x]\n",
status);
} else {
printk(KERN_ERR "messageq_transportshm_setup : "
"status [0x%x]\n", status);
sysmgr_state.messageq_transportshm_init_flag = true;
}
}
......@@ -496,9 +515,11 @@ s32 sysmgr_setup(const struct sysmgr_config *cfg)
status = notify_ducatidrv_setup(&config->notify_ducatidrv_cfg);
if (status < 0) {
printk(KERN_ERR "sysmgr_setup : "
"notify_ducatidrv_setup failed [0x%x]",
"notify_ducatidrv_setup failed [0x%x]\n",
status);
} else {
printk(KERN_ERR "notify_ducatidrv_setup : "
"status [0x%x]\n" , status);
sysmgr_state.notify_ducatidrv_init_flag = true;
}
}
......@@ -509,9 +530,11 @@ s32 sysmgr_setup(const struct sysmgr_config *cfg)
&config->nameserver_remotenotify_cfg);
if (status < 0) {
printk(KERN_ERR "sysmgr_setup : "
"nameserver_remotenotify_setup failed [0x%x]",
"nameserver_remotenotify_setup failed [0x%x]\n",
status);
} else {
printk(KERN_ERR "nameserver_remotenotify_setup : "
"status [0x%x]\n" , status);
sysmgr_state.nameserver_remotenotify_init_flag = true;
}
}
......@@ -521,8 +544,10 @@ s32 sysmgr_setup(const struct sysmgr_config *cfg)
status = platform_setup(config);
if (status < 0) {
printk(KERN_ERR "sysmgr_setup : platform_setup "
"failed [0x%x]", status);
"failed [0x%x]\n", status);
} else {
printk(KERN_ERR "platform_setup : status [0x%x]\n" ,
status);
sysmgr_state.platform_init_flag = true;
}
}
......@@ -533,7 +558,7 @@ exit:
return status;
}
EXPORT_SYMBOL(sysmgr_setup);
/*
* ======== sysmgr_setup ========
......@@ -553,7 +578,7 @@ s32 sysmgr_destroy(void)
}
if (atomic_dec_return(&sysmgr_state.ref_count)
!= SYSMGR_MAKE_MAGICSTAMP(0))
== SYSMGR_MAKE_MAGICSTAMP(0))
goto exit;
/* Finalize Platform module*/
......@@ -715,7 +740,7 @@ exit:
}
return status;
}
EXPORT_SYMBOL(sysmgr_destroy);
/*
* ======== sysmgr_set_boot_load_page ========
......@@ -745,8 +770,15 @@ void sysmgr_wait_for_scalability_info(u16 proc_id)
VOLATILE struct sysmgr_boot_load_page *temp = \
sysmgr_state.boot_load_page[proc_id];
printk(KERN_ERR "sysmgr_wait_for_scalability_info: BF while temp->handshake:%x\n",
temp->handshake);
while (temp->handshake != SYSMGR_SCALABILITYHANDSHAKESTAMP)
;
printk(KERN_ERR "sysmgr_wait_for_scalability_info:AF while temp->handshake:%x\n",
temp->handshake);
}
......
......@@ -652,8 +652,7 @@ int notify_ducatidrv_setup(struct notify_ducatidrv_config *cfg)
if (atomic_inc_return(&(notify_ducatidriver_state.ref_count)) !=
NOTIFYDRIVERSHM_MAKE_MAGICSTAMP(1u)) {
/* FIXME Already exists status to be returned. */
return -1;
return 1;
}
......
......@@ -227,8 +227,6 @@ void *proc4430_create(u16 proc_id, const struct proc4430_params *params)
/* Enter critical section protection. */
WARN_ON(mutex_lock_interruptible(proc4430_state.gate_handle));
if (proc4430_state.proc_handles[proc_id] != NULL) {
printk(KERN_WARNING "Processor already exists for specified"
"%d proc_id\n", proc_id);
handle = proc4430_state.proc_handles[proc_id];
goto func_end;
} else {
......@@ -277,7 +275,7 @@ void *proc4430_create(u16 proc_id, const struct proc4430_params *params)
func_end:
mutex_unlock(proc4430_state.gate_handle);
return handle;
return (void *)handle;
}
EXPORT_SYMBOL(proc4430_create);
......@@ -461,19 +459,11 @@ int proc4430_detach(void *handle)
int proc4430_start(void *handle, u32 entry_pt,
struct processor_start_params *start_params)
{
int i;
switch (start_params->params->proc_id) {
case SYS_M3:
__raw_writel(0x02, CORE_PRM_BASE + RM_MPU_M3_RSTCTRL_OFFSET);
break;
case APP_M3:
i = __raw_readl(CORE_PRM_BASE + RM_MPU_M3_RSTCTRL_OFFSET);
if (i & RM_MPU_M3_RST1) {
printk(KERN_ALERT"ERROR: proc4430Start: SYS M3 is in"
"reset cannot start APP M3\n");
return -EFAULT;
}
__raw_writel(0x0, CORE_PRM_BASE + RM_MPU_M3_RSTCTRL_OFFSET);
break;
default:
......
......@@ -38,13 +38,6 @@
/*! @brief Macro to make a correct module magic number with refCount */
#define PROCMGR_MAKE_MAGICSTAMP(x) ((PROCMGR_MODULEID << 12u) | (x))
#if defined SYSLINK_USE_SYSMGR
/* HACK - replace once the platform.c file is ready */
int dummy() {return 0; };
#define platform_start_callback(pid) dummy()
#define platform_stop_callback(pid) dummy()
#endif /* if defined (SYSLINK_USE_SYSMGR) */
/*
* ProcMgr Module state object
*/
......@@ -275,6 +268,13 @@ void *proc_mgr_create(u16 proc_id, const struct proc_mgr_params *params)
printk(KERN_ERR "proc_mgr_create: Error - module not initialized\n");
return NULL;
}
if (proc_mgr_obj_state.proc_handles[proc_id] != NULL) {
handle = proc_mgr_obj_state.proc_handles[proc_id];
printk(KERN_WARNING "proc_mgr_create:"
"Processor already exists for specified"
"%d proc_id, handle = 0x%x\n", proc_id, (u32)handle);
return handle;
}
WARN_ON(mutex_lock_interruptible(proc_mgr_obj_state.gate_handle));
handle = (struct proc_mgr_object *)
vmalloc(sizeof(struct proc_mgr_object));
......@@ -466,6 +466,8 @@ int proc_mgr_attach(void *handle, struct proc_mgr_attach_params *params)
retval = processor_attach(proc_mgr_handle->proc_handle,
&proc_attach_params);
proc_mgr_handle->num_mem_entries = proc_attach_params.num_mem_entries;
printk(KERN_INFO "proc_mgr_attach:proc_mgr_handle->num_mem_entries = %d\n",
proc_mgr_handle->num_mem_entries);
/* Store memory information in local object.*/
memcpy(&(proc_mgr_handle->mem_entries),
&(proc_attach_params.mem_entries),
......@@ -577,6 +579,9 @@ int proc_mgr_start(void *handle, u32 entry_point,
proc_mgr_get_start_params(handle, &tmp_params);
params = &tmp_params;
}
#if defined SYSLINK_USE_SYSMGR
platform_load_callback((void *)params->proc_id); /* FIXME */
#endif
WARN_ON(mutex_lock_interruptible(proc_mgr_obj_state.gate_handle));
memcpy(&(proc_mgr_handle->start_params), params,
sizeof(struct proc_mgr_start_params));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment