Commit 16baf7d0 authored by Simon Que's avatar Simon Que Committed by Hari Kanigeri

Subject: SYSLINK SysMgr setup for AppM3

Made SysMgr, Platform, ProcMgr compatible for setting up for
AppM3, in addition to SysM3.
Signed-off-by: default avatarSimon Que <sque@ti.com>
parent 6b320295
...@@ -104,34 +104,57 @@ ...@@ -104,34 +104,57 @@
*/ */
#define HEAPBUF_BLOCKSIZE 256 #define HEAPBUF_BLOCKSIZE 256
/*! @brief Start of shared memory */ /*! @brief Start of shared memory */
#define SHAREDMEMORY_BASEADDR 0x87B00000 #define SHAREDMEMORY_PHY_BASEADDR 0x87B00000
#define SHAREDMEMORY_BASESIZE 0x0007F000 #define SHAREDMEMORY_PHY_BASESIZE 0x00100000
/*! @brief Start of Boot load page */ /*! @brief Start of shared memory for SysM3 */
#define BOOTLOADPAGE_BASEADDR 0x9807F000 #define SHAREDMEMORY_PHY_BASEADDR_SYSM3 0x87B00000
#define BOOTLOADPAGE_BASESIZE 0x00001000 #define SHAREDMEMORY_PHY_BASESIZE_SYSM3 0x0007F000
/*! @brief Start of shared memory */ /*! @brief Start of shared memory AppM3 */
#define SHAREDMEMORY_BASEADDR_APPM3 0x87B80000 #define SHAREDMEMORY_PHY_BASEADDR_APPM3 0x87B80000
#define SHAREDMEMORY_BASESIZE_APPM3 0x0007F000 #define SHAREDMEMORY_PHY_BASESIZE_APPM3 0x0007F000
/*! @brief Start of SHM for SysM3 */
#define SHAREDMEMORY_SLV_VRT_BASEADDR_SYSM3 0x98000000
#define SHAREDMEMORY_SLV_VRT_BASESIZE_SYSM3 0x00080000
/*! @brief Start of SHM for AppM3 */
#define SHAREDMEMORY_SLV_VRT_BASEADDR_APPM3 0x98080000
#define SHAREDMEMORY_SLV_VRT_BASESIZE_APPM3 0x00080000
/*! @brief Start of Boot load page */ /*! @brief Start of Boot load page for SysM3 */
#define BOOTLOADPAGE_BASEADDR_APPM3 0x8718F000 #define BOOTLOADPAGE_SLV_VRT_BASEADDR_SYSM3 0x9807F000
#define BOOTLOADPAGE_BASESIZE_APPM3 0x0000F000 #define BOOTLOADPAGE_SLV_VRT_BASESIZE_SYSM3 0x00001000
/*! @brief Start of Boot load page for AppM3 */
#define BOOTLOADPAGE_SLV_VRT_BASEADDR_APPM3 0x980FF000
#define BOOTLOADPAGE_SLV_VRT_BASESIZE_APPM3 0x00001000
/*! /*!
* @brief Size of the shared memory heap, this heap is used for providing * @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. * shared memory to drivers/instances. Should not be used for any other purpose.
*/ */
#define SMHEAP_SIZE 0x7F000 #define SMHEAP_SIZE SHAREDMEMORY_PHY_BASESIZE
/*! /*!
* @brief Shared region index for Shared memory heap. * @brief Shared region index for Shared memory heap.
*/ */
#define SMHEAP_SRINDEX 0 #define SMHEAP_SRINDEX 0
/*!
* @brief Shared region index for Shared memory heap for SysM3.
*/
#define SMHEAP_SRINDEX_SYSM3 0
/*!
* @brief Shared region index for Shared memory heap for AppM3.
*/
#define SMHEAP_SRINDEX_APPM3 1
/*! /*!
* @brief Shared region index for SysM3 boot load page * @brief Shared region index for SysM3 boot load page
*/ */
...@@ -196,6 +219,27 @@ void *platform_heap_handle; ...@@ -196,6 +219,27 @@ void *platform_heap_handle;
void *platform_mqt_gate_handle; void *platform_mqt_gate_handle;
void *platform_transport_shm_handle; void *platform_transport_shm_handle;
void *platform_messageq; void *platform_messageq;
/* Handles for SysM3 */
void *platform_nsrn_gate_handle_sysm3;
void *platform_nsrn_handle_sysm3;
void *platform_notifydrv_handle_sysm3;
void *platform_heap_gate_handle_sysm3;
void *platform_heap_handle_sysm3;
void *platform_mqt_gate_handle_sysm3;
void *platform_transport_shm_handle_sysm3;
void *platform_messageq_sysm3;
void *platform_notifydrv_handle;
/* Handles for AppM3 */
void *platform_nsrn_gate_handle_appm3;
void *platform_nsrn_handle_appm3;
void *platform_notifydrv_handle_appm3;
void *platform_heap_gate_handle_appm3;
void *platform_heap_handle_appm3;
void *platform_mqt_gate_handle_appm3;
void *platform_transport_shm_handle_appm3;
void *platform_messageq_appm3;
/** ============================================================================ /** ============================================================================
* Struct & Enums. * Struct & Enums.
...@@ -254,6 +298,17 @@ struct platform_proc_config_params { ...@@ -254,6 +298,17 @@ struct platform_proc_config_params {
*/ */
#define NUM_MEM_ENTRIES 2 #define NUM_MEM_ENTRIES 2
/*!
* @brief Number of slave memory entries for OMAP4430 SYSM3.
*/
#define NUM_MEM_ENTRIES_SYSM3 1
/*!
* @brief Number of slave memory entries for OMAP4430 APPM3.
*/
#define NUM_MEM_ENTRIES_APPM3 1
/*! /*!
* @brief Position of reset vector memory region in the memEntries array. * @brief Position of reset vector memory region in the memEntries array.
*/ */
...@@ -270,27 +325,35 @@ struct platform_proc_config_params { ...@@ -270,27 +325,35 @@ struct platform_proc_config_params {
*/ */
static struct proc4430_mem_entry mem_entries[NUM_MEM_ENTRIES] = { static struct proc4430_mem_entry mem_entries[NUM_MEM_ENTRIES] = {
{ {
"DUCATI_SHM", /* NAME : Name of the memory region */ "DUCATI_SHM_SYSM3", /* NAME : Name of the memory region */
SHAREDMEMORY_BASEADDR, SHAREDMEMORY_PHY_BASEADDR_SYSM3,
/* PHYSADDR : Physical address */ /* PHYSADDR : Physical address */
DUCATI_SHM_VA, /* SLAVEVIRTADDR : Slave virtual address */ SHAREDMEMORY_SLV_VRT_BASEADDR_SYSM3,
/* SLAVEVIRTADDR : Slave virtual address */
(u32) -1u, (u32) -1u,
/* MASTERVIRTADDR : Master virtual address (if known) */ /* MASTERVIRTADDR : Master virtual address (if known) */
0x80000, /* SIZE : Size of the memory region */ SHAREDMEMORY_SLV_VRT_BASESIZE_SYSM3,
/* SIZE : Size of the memory region */
true, /* SHARE : Shared access memory? */ true, /* SHARE : Shared access memory? */
}, },
{ {
"DUCATI_SHM1", /* NAME : Name of the memory region */ "DUCATI_SHM_APPM3", /* NAME : Name of the memory region */
SHAREDMEMORY_BASEADDR_APPM3, SHAREDMEMORY_PHY_BASEADDR_APPM3,
/* PHYSADDR : Physical address */ /* PHYSADDR : Physical address */
DUCATI_SHM_1_VA, /* SLAVEVIRTADDR : Slave virtual address */ SHAREDMEMORY_SLV_VRT_BASEADDR_APPM3,
/* SLAVEVIRTADDR : Slave virtual address */
(u32) -1u, (u32) -1u,
/* MASTERVIRTADDR : Master virtual address (if known) */ /* MASTERVIRTADDR : Master virtual address (if known) */
0x80000, /* SIZE : Size of the memory region */ SHAREDMEMORY_SLV_VRT_BASESIZE_APPM3,
/* SIZE : Size of the memory region */
true, /* SHARE : Shared access memory? */ true, /* SHARE : Shared access memory? */
} }
}; };
void *procmgr_handle;
void *procmgr_proc_handle;
void *platform_sm_heap_virt_addr_sysm3;
void *platform_sm_heap_virt_addr_appm3;
/*! /*!
* @brief Handle to the ProcMgr instance used. * @brief Handle to the ProcMgr instance used.
...@@ -302,6 +365,27 @@ void *procmgr_handle; ...@@ -302,6 +365,27 @@ void *procmgr_handle;
*/ */
void *procmgr_proc_handle; void *procmgr_proc_handle;
/*!
* @brief Handle to the SysM3 ProcMgr instance used.
*/
void *procmgr_handle_sysm3;
/*!
* @brief Handle to the AppM3 ProcMgr instance used.
*/
void *procmgr_handle_appm3;
/*!
* @brief Handle to the SysM3 Processor instance used.
*/
void *procmgr_proc_handle_sysm3;
/*!
* @brief Handle to the AppM3 Processor instance used.
*/
void *procmgr_proc_handle_appm3;
/*! /*!
* @brief File ID of the file loaded. * @brief File ID of the file loaded.
*/ */
...@@ -326,6 +410,7 @@ struct sysmgr_proc_config pc_params; ...@@ -326,6 +410,7 @@ struct sysmgr_proc_config pc_params;
* APIS * APIS
* ============================================================================= * =============================================================================
*/ */
/* /*
* ======== platform_setup ======== * ======== platform_setup ========
* Purpose: * Purpose:
...@@ -333,6 +418,7 @@ struct sysmgr_proc_config pc_params; ...@@ -333,6 +418,7 @@ struct sysmgr_proc_config pc_params;
*/ */
s32 platform_setup(struct sysmgr_config *config) s32 platform_setup(struct sysmgr_config *config)
{ {
s32 status = 0; s32 status = 0;
struct proc4430_config proc_config; struct proc4430_config proc_config;
struct proc_mgr_params params; struct proc_mgr_params params;
...@@ -349,8 +435,8 @@ s32 platform_setup(struct sysmgr_config *config) ...@@ -349,8 +435,8 @@ s32 platform_setup(struct sysmgr_config *config)
} }
/* Map the static region */ /* Map the static region */
info.src = SHAREDMEMORY_BASEADDR; info.src = SHAREDMEMORY_PHY_BASEADDR;
info.size = SHAREDMEMORY_BASESIZE; info.size = SHAREDMEMORY_PHY_BASESIZE;
info.is_cached = false; info.is_cached = false;
status = platform_mem_map(&info); status = platform_mem_map(&info);
if (status < 0) if (status < 0)
...@@ -359,39 +445,59 @@ s32 platform_setup(struct sysmgr_config *config) ...@@ -359,39 +445,59 @@ s32 platform_setup(struct sysmgr_config *config)
/* Get default config for System memory manager */ /* Get default config for System memory manager */
sysmemmgr_get_config(&sysmemmgr_cfg); sysmemmgr_get_config(&sysmemmgr_cfg);
/* Initialize the System memory manager */ /* Initialize the System memory manager */
sysmemmgr_cfg.static_mem_size = SHAREDMEMORY_BASESIZE; sysmemmgr_cfg.static_mem_size = SHAREDMEMORY_PHY_BASESIZE;
sysmemmgr_cfg.static_phys_base_addr = SHAREDMEMORY_BASEADDR; sysmemmgr_cfg.static_phys_base_addr = SHAREDMEMORY_PHY_BASEADDR;
sysmemmgr_cfg.static_virt_base_addr = info.dst; sysmemmgr_cfg.static_virt_base_addr = info.dst;
sysmemmgr_cfg.event_no = PLATFORM_SYSMEMMGR_EVENTNO; sysmemmgr_cfg.event_no = PLATFORM_SYSMEMMGR_EVENTNO;
status = sysmemmgr_setup(&sysmemmgr_cfg); status = sysmemmgr_setup(&sysmemmgr_cfg);
if (status < 0) if (status < 0)
goto sysmemmgr_setup_fail; goto sysmemmgr_setup_fail;
/* The heap for SysM3 and AppM3 are allocated at once */
platform_sm_heap_virt_addr = sysmemmgr_alloc(SMHEAP_SIZE, platform_sm_heap_virt_addr = sysmemmgr_alloc(SMHEAP_SIZE,
sysmemmgr_allocflag_physical); sysmemmgr_allocflag_physical);
if (platform_sm_heap_virt_addr == NULL) if (platform_sm_heap_virt_addr == NULL)
goto sysmemmgr_alloc_fail; goto sysmemmgr_alloc_fail;
/* Create the shared region entry for the SM heap */ platform_sm_heap_virt_addr_sysm3 = platform_sm_heap_virt_addr;
sharedregion_add(SMHEAP_SRINDEX, platform_sm_heap_virt_addr, /* The AppM3 shared area is after SysM3 heap + boot load page */
SMHEAP_SIZE); platform_sm_heap_virt_addr_appm3 = (platform_sm_heap_virt_addr_sysm3 +
/* Zero out the shared memory */ SHAREDMEMORY_PHY_BASESIZE_SYSM3 +
memset((void *) platform_sm_heap_virt_addr, 0, SMHEAP_SIZE); BOOTLOADPAGE_SLV_VRT_BASESIZE_APPM3);
/* Create the shared region entry for the SysM3 heap */
sharedregion_add(SMHEAP_SRINDEX_SYSM3,
platform_sm_heap_virt_addr_sysm3,
SHAREDMEMORY_PHY_BASESIZE_SYSM3);
/* Zero out the shared memory for SysM3 */
memset((void *) platform_sm_heap_virt_addr_sysm3,
0,
SHAREDMEMORY_PHY_BASESIZE_SYSM3);
/* Create the shared region entry for the AppM3 heap */
sharedregion_add(SMHEAP_SRINDEX_APPM3,
platform_sm_heap_virt_addr_appm3,
SHAREDMEMORY_PHY_BASESIZE_APPM3);
/* Zero out the shared memory for AppM3 */
memset((void *) platform_sm_heap_virt_addr_appm3,
0,
SHAREDMEMORY_PHY_BASESIZE_APPM3);
proc4430_get_config(&proc_config); proc4430_get_config(&proc_config);
status = proc4430_setup(&proc_config); status = proc4430_setup(&proc_config);
if (status < 0) if (status < 0)
goto proc_setup_fail; goto proc_setup_fail;
/* Get MultiProc ID by name. */ /* Get MultiProc ID by name. */
proc_id = multiproc_get_id("SysM3"); proc_id = multiproc_get_id("SysM3");
/* Create an instance of the Processor object for OMAP4430 */ /* Create an instance of the Processor object for OMAP4430 */
proc4430_params_init(NULL, &proc_params); proc4430_params_init(NULL, &proc_params);
proc_params.num_mem_entries = NUM_MEM_ENTRIES; proc_params.num_mem_entries = NUM_MEM_ENTRIES;
proc_params.mem_entries = (struct proc4430_mem_entry *) &mem_entries; proc_params.mem_entries = mem_entries;
proc_params.reset_vector_mem_entry = RESET_VECTOR_ENTRY_ID; proc_params.reset_vector_mem_entry = RESET_VECTOR_ENTRY_ID;
procmgr_proc_handle = proc4430_create(proc_id, &proc_params); procmgr_proc_handle = proc4430_create(proc_id, &proc_params);
if (procmgr_proc_handle == NULL) { if (procmgr_proc_handle == NULL) {
status = SYSMGR_E_FAIL; status = SYSMGR_E_FAIL;
...@@ -406,7 +512,14 @@ s32 platform_setup(struct sysmgr_config *config) ...@@ -406,7 +512,14 @@ s32 platform_setup(struct sysmgr_config *config)
status = SYSMGR_E_FAIL; status = SYSMGR_E_FAIL;
goto proc_mgr_create_fail; goto proc_mgr_create_fail;
} }
goto exit;
/* SysM3 and AppM3 use the same handle */
procmgr_handle_sysm3 = procmgr_handle;
procmgr_proc_handle_sysm3 = procmgr_proc_handle;
procmgr_handle_appm3 = procmgr_handle;
procmgr_proc_handle_appm3 = procmgr_proc_handle;
proc_mgr_create_fail: proc_mgr_create_fail:
printk(KERN_ERR "platform_setup: proc_mgr_create failed [0x%x]", printk(KERN_ERR "platform_setup: proc_mgr_create failed [0x%x]",
status); status);
...@@ -448,8 +561,8 @@ s32 platform_destroy(void) ...@@ -448,8 +561,8 @@ s32 platform_destroy(void)
{ {
s32 status = 0; s32 status = 0;
struct platform_mem_unmap_info u_info; struct platform_mem_unmap_info u_info;
/* Delete the Processor instances */ /* Delete the Processor instances */
if (procmgr_proc_handle != NULL) { if (procmgr_proc_handle != NULL) {
status = proc4430_delete(&procmgr_proc_handle); status = proc4430_delete(&procmgr_proc_handle);
WARN_ON(status < 0); WARN_ON(status < 0);
...@@ -488,44 +601,109 @@ void platform_load_callback(void *arg) ...@@ -488,44 +601,109 @@ void platform_load_callback(void *arg)
u32 boot_load_page; u32 boot_load_page;
u32 sh_addr_base; u32 sh_addr_base;
u32 nwrite; u32 nwrite;
int index;
printk(KERN_ERR "platform_load_callback\n");
/* Get the written entry */
local_id = multiproc_get_id(NULL);
if (proc_id == multiproc_get_id("SysM3"))
index = SMHEAP_SRINDEX_SYSM3;
else if (proc_id == multiproc_get_id("AppM3"))
index = SMHEAP_SRINDEX_APPM3;
else {
status = SYSMGR_E_FAIL;
goto proc_invalid_id;
}
/* Add the to sharedregion */
switch (index) {
case SMHEAP_SRINDEX_SYSM3: /* For SysM3 */
/* Get the boot load page address */ /* Get the boot load page address */
/* TBD: boot_load_page = BOOTLOADPAGE_SLV_VRT_BASEADDR_SYSM3;
boot_load_page = Proc_getBootLoadPage (procmgr_handle); */ status = proc_mgr_translate_addr(procmgr_handle_sysm3,
boot_load_page = BOOTLOADPAGE_BASEADDR;
status = proc_mgr_translate_addr(procmgr_handle,
(void *) &sh_addr_base, (void *) &sh_addr_base,
PROC_MGR_ADDRTYPE_MASTERKNLVIRT, PROC_MGR_ADDRTYPE_MASTERKNLVIRT,
(void *) boot_load_page, (void *) boot_load_page,
PROC_MGR_ADDRTYPE_SLAVEVIRT); PROC_MGR_ADDRTYPE_SLAVEVIRT);
if (status < 0) { if (status < 0)
printk(KERN_ERR "proc_mgr_translate_addr [0x%x]\n", break;
status);
} else {
/* Zero out the boot load page */ /* Zero out the boot load page */
memset((void *) sh_addr_base, 0, BOOTLOADPAGE_BASESIZE); memset((void *) sh_addr_base,
sharedregion_add(BOOTLOADPAGE_SRINDEX, (void *)sh_addr_base, 0,
BOOTLOADPAGE_BASESIZE); BOOTLOADPAGE_SLV_VRT_BASESIZE_SYSM3);
break;
case SMHEAP_SRINDEX_APPM3: /* For AppM3 */
/* Get the boot load page address */
boot_load_page = BOOTLOADPAGE_SLV_VRT_BASEADDR_APPM3;
status = proc_mgr_translate_addr(procmgr_handle_appm3,
(void *) &sh_addr_base,
PROC_MGR_ADDRTYPE_MASTERKNLVIRT,
(void *) boot_load_page,
PROC_MGR_ADDRTYPE_SLAVEVIRT);
if (status < 0)
break;
/* Zero out the boot load page */
memset((void *) sh_addr_base,
0,
BOOTLOADPAGE_SLV_VRT_BASESIZE_APPM3);
break;
}
if (status < 0)
goto proc_mgr_translate_addr_fail;
/* Set the boot load page address */ /* Set the boot load page address */
sysmgr_set_boot_load_page(proc_id, sh_addr_base); sysmgr_set_boot_load_page(proc_id, sh_addr_base);
/* Get the written entry */ /* Write the boot table (containing both regions) to */
local_id = multiproc_get_id(NULL); /* the current processor */
sharedregion_get_table_info(SMHEAP_SRINDEX, local_id, &info);
platform_sm_heap_phys_addr = sysmemmgr_translate( /* For SysM3 */
platform_sm_heap_virt_addr, sharedregion_get_table_info(SMHEAP_SRINDEX_SYSM3,
local_id,
&info);
platform_sm_heap_virt_addr_sysm3 = sysmemmgr_translate(
platform_sm_heap_virt_addr_sysm3,
sysmemmgr_xltflag_kvirt2phys);
info.base = (void *) SHAREDMEMORY_SLV_VRT_BASEADDR_SYSM3;
nwrite = sysmgr_put_object_config(proc_id,
(void *) &info,
SYSMGR_CMD_SHAREDREGION_ENTRY_START +
SMHEAP_SRINDEX_SYSM3,
sizeof(struct sharedregion_info));
WARN_ON(nwrite != sizeof(struct sharedregion_info));
/* For AppM3 */
sharedregion_get_table_info(SMHEAP_SRINDEX_APPM3,
local_id,
&info);
platform_sm_heap_virt_addr_appm3 = sysmemmgr_translate(
platform_sm_heap_virt_addr_appm3,
sysmemmgr_xltflag_kvirt2phys); sysmemmgr_xltflag_kvirt2phys);
info.base = (void *) DUCATI_SHM_VA; info.base = (void *) SHAREDMEMORY_SLV_VRT_BASEADDR_APPM3;
/* Write info the boot load page */ /* Write info the boot load page */
nwrite = sysmgr_put_object_config(proc_id, nwrite = sysmgr_put_object_config(proc_id,
(void *) &info, (void *) &info,
SYSMGR_CMD_SHAREDREGION_ENTRY_START, SYSMGR_CMD_SHAREDREGION_ENTRY_START +
SMHEAP_SRINDEX_APPM3,
sizeof(struct sharedregion_info)); sizeof(struct sharedregion_info));
WARN_ON(nwrite != sizeof(struct sharedregion_info)); WARN_ON(nwrite != sizeof(struct sharedregion_info));
} goto exit;
proc_mgr_translate_addr_fail:
printk(KERN_ERR "platform_load_callback: proc_mgr_translate_addr failed"
" [0x%x] for proc_id [0x%x]\n",
status, proc_id);
goto exit;
proc_invalid_id:
printk(KERN_ERR "platform_load_callback failed invalid proc_id [0x%x]\n",
proc_id);
exit:
return;
} }
EXPORT_SYMBOL(platform_load_callback); EXPORT_SYMBOL(platform_load_callback);
...@@ -545,6 +723,7 @@ void platform_start_callback(void *arg) ...@@ -545,6 +723,7 @@ void platform_start_callback(void *arg)
u32 i = 0; u32 i = 0;
u32 cmd_id; u32 cmd_id;
u32 sh_addr; u32 sh_addr;
int index;
struct notify_ducatidrv_params notify_shm_params; struct notify_ducatidrv_params notify_shm_params;
struct gatepeterson_params gate_params; struct gatepeterson_params gate_params;
...@@ -562,7 +741,14 @@ void platform_start_callback(void *arg) ...@@ -562,7 +741,14 @@ void platform_start_callback(void *arg)
/*u32 proc_ids[2];*/ /*u32 proc_ids[2];*/
printk(KERN_ERR "platform_start_callback\n"); printk(KERN_ERR "platform_start_callback\n");
if (proc_id == multiproc_get_id("SysM3"))
index = SMHEAP_SRINDEX_SYSM3;
else if (proc_id == multiproc_get_id("AppM3"))
index = SMHEAP_SRINDEX_APPM3;
else {
status = SYSMGR_E_FAIL;
goto proc_invalid_id;
}
/* Wait for slave to write the scalability info */ /* Wait for slave to write the scalability info */
sysmgr_wait_for_scalability_info(proc_id); sysmgr_wait_for_scalability_info(proc_id);
/* Read the scalability info */ /* Read the scalability info */
...@@ -581,6 +767,7 @@ void platform_start_callback(void *arg) ...@@ -581,6 +767,7 @@ void platform_start_callback(void *arg)
} }
} }
/* TODO: add condition: proc_id == multiproc_get_id("SysM3") */
if (pc_params.use_notify) { if (pc_params.use_notify) {
do { do {
nread = sysmgr_get_object_config(proc_id, nread = sysmgr_get_object_config(proc_id,
...@@ -609,7 +796,7 @@ void platform_start_callback(void *arg) ...@@ -609,7 +796,7 @@ void platform_start_callback(void *arg)
notify_shm_params.recv_int_id = BASE_DUCATI2ARM_INTID; notify_shm_params.recv_int_id = BASE_DUCATI2ARM_INTID;
notify_shm_params.send_int_id = BASE_ARM2DUCATI_INTID; notify_shm_params.send_int_id = BASE_ARM2DUCATI_INTID;
notify_shm_params.remote_proc_id = proc_id; notify_shm_params.remote_proc_id = proc_id;
if (platform_notifydrv_handle == NULL) {
/* Create instance of Notify Ducati Driver */ /* Create instance of Notify Ducati Driver */
platform_notifydrv_handle = notify_ducatidrv_create( platform_notifydrv_handle = notify_ducatidrv_create(
"NOTIFYDRIVER_DUCATI", "NOTIFYDRIVER_DUCATI",
...@@ -620,6 +807,14 @@ void platform_start_callback(void *arg) ...@@ -620,6 +807,14 @@ void platform_start_callback(void *arg)
} }
} }
/* The notify is created only once and used for Sys and App */
if (index == SMHEAP_SRINDEX_APPM3)
platform_notifydrv_handle_appm3 =
platform_notifydrv_handle;
else
platform_notifydrv_handle_sysm3 =
platform_notifydrv_handle;
}
if (pc_params.use_nameserver) { if (pc_params.use_nameserver) {
do { do {
nread = sysmgr_get_object_config(proc_id, nread = sysmgr_get_object_config(proc_id,
...@@ -638,7 +833,13 @@ void platform_start_callback(void *arg) ...@@ -638,7 +833,13 @@ void platform_start_callback(void *arg)
gate_params.shared_addr = (void *) sh_addr; gate_params.shared_addr = (void *) sh_addr;
gate_params.shared_addr_size = pgp_params.shared_mem_size; gate_params.shared_addr_size = pgp_params.shared_mem_size;
do { do {
status = gatepeterson_open(&platform_nsrn_gate_handle, if (index == SMHEAP_SRINDEX_APPM3)
status = gatepeterson_open(
&platform_nsrn_gate_handle_appm3,
&gate_params);
else
status = gatepeterson_open(
&platform_nsrn_gate_handle_sysm3,
&gate_params); &gate_params);
} while (status == -ENXIO); } while (status == -ENXIO);
...@@ -654,7 +855,8 @@ void platform_start_callback(void *arg) ...@@ -654,7 +855,8 @@ void platform_start_callback(void *arg)
sizeof(struct \ sizeof(struct \
platform_nameserver_remotenotify_params)); platform_nameserver_remotenotify_params));
} while (nread != \ } while (nread != \
sizeof(struct platform_nameserver_remotenotify_params)); sizeof(struct
platform_nameserver_remotenotify_params));
sh_addr = (u32) sharedregion_get_ptr((u32 *) sh_addr = (u32) sharedregion_get_ptr((u32 *)
pnsrn_params.shared_mem_addr); pnsrn_params.shared_mem_addr);
if (sh_addr == (u32)NULL) { if (sh_addr == (u32)NULL) {
...@@ -671,18 +873,34 @@ void platform_start_callback(void *arg) ...@@ -671,18 +873,34 @@ void platform_start_callback(void *arg)
*/ */
nameserver_remotenotify_params_init(NULL, &nsr_params); nameserver_remotenotify_params_init(NULL, &nsr_params);
nsr_params.notify_driver = platform_notifydrv_handle; nsr_params.notify_driver = platform_notifydrv_handle;
/* Both are using same notify */
nsr_params.notify_event_no = pnsrn_params.notify_event_no; nsr_params.notify_event_no = pnsrn_params.notify_event_no;
nsr_params.shared_addr = (void *) sh_addr; nsr_params.shared_addr = (void *) sh_addr;
nsr_params.shared_addr_size = pnsrn_params.shared_mem_size; nsr_params.shared_addr_size = pnsrn_params.shared_mem_size;
nsr_params.gate = (void *) platform_nsrn_gate_handle; if (index == SMHEAP_SRINDEX_APPM3) {
platform_nsrn_handle = nameserver_remotenotify_create(proc_id, nsr_params.gate =
(void *) platform_nsrn_gate_handle_appm3;
platform_nsrn_handle_appm3 =
nameserver_remotenotify_create(
proc_id,
&nsr_params);
if (platform_nsrn_handle_appm3 == NULL) {
status = SYSMGR_E_FAIL;
goto nameserver_remotenotify_create_fail;
}
} else {
nsr_params.gate =
(void *) platform_nsrn_gate_handle_sysm3;
platform_nsrn_handle_sysm3 =
nameserver_remotenotify_create(
proc_id,
&nsr_params); &nsr_params);
if (platform_nsrn_handle == NULL) { if (platform_nsrn_handle_sysm3 == NULL) {
status = SYSMGR_E_FAIL; status = SYSMGR_E_FAIL;
goto nameserver_remotenotify_create_fail; goto nameserver_remotenotify_create_fail;
} }
} }
}
if (pc_params.use_heapbuf) { if (pc_params.use_heapbuf) {
do { do {
nread = sysmgr_get_object_config(proc_id, nread = sysmgr_get_object_config(proc_id,
...@@ -690,7 +908,8 @@ void platform_start_callback(void *arg) ...@@ -690,7 +908,8 @@ void platform_start_callback(void *arg)
PLATFORM_CMD_GPHEAPBUF, PLATFORM_CMD_GPHEAPBUF,
sizeof(struct \ sizeof(struct \
platform_gaterpeterson_params)); platform_gaterpeterson_params));
} while (nread != sizeof(struct platform_gaterpeterson_params)); } while (nread != sizeof(struct
platform_gaterpeterson_params));
sh_addr = (u32) sharedregion_get_ptr((u32 *) sh_addr = (u32) sharedregion_get_ptr((u32 *)
pgp_params.shared_mem_addr); pgp_params.shared_mem_addr);
if (sh_addr == (u32)NULL) { if (sh_addr == (u32)NULL) {
...@@ -701,7 +920,13 @@ void platform_start_callback(void *arg) ...@@ -701,7 +920,13 @@ void platform_start_callback(void *arg)
gate_params.shared_addr = (void *) sh_addr; gate_params.shared_addr = (void *) sh_addr;
gate_params.shared_addr_size = pgp_params.shared_mem_size; gate_params.shared_addr_size = pgp_params.shared_mem_size;
do { do {
status = gatepeterson_open(&platform_heap_gate_handle, if (index == SMHEAP_SRINDEX_APPM3)
status = gatepeterson_open(
&platform_heap_gate_handle_appm3,
&gate_params);
else
status = gatepeterson_open(
&platform_heap_gate_handle_sysm3,
&gate_params); &gate_params);
} while (status == -ENXIO); } while (status == -ENXIO);
if (status < 0) { if (status < 0) {
...@@ -736,10 +961,19 @@ void platform_start_callback(void *arg) ...@@ -736,10 +961,19 @@ void platform_start_callback(void *arg)
} }
heap_params.shared_buf_size = phb_params.shared_buf_size; heap_params.shared_buf_size = phb_params.shared_buf_size;
heap_params.shared_buf = (void *) sh_addr; heap_params.shared_buf = (void *) sh_addr;
heap_params.gate = platform_heap_gate_handle; if (index == SMHEAP_SRINDEX_APPM3)
heap_params.gate = platform_heap_gate_handle_appm3;
else
heap_params.gate = platform_heap_gate_handle_sysm3;
heap_params.shared_addr_size = phb_params.shared_mem_size; heap_params.shared_addr_size = phb_params.shared_mem_size;
do { do {
status = heapbuf_open(&platform_heap_handle, if (index == SMHEAP_SRINDEX_APPM3)
status = heapbuf_open(
&platform_heap_handle_appm3,
&heap_params);
else
status = heapbuf_open(
&platform_heap_handle_sysm3,
&heap_params); &heap_params);
} while (status == -ENXIO); } while (status == -ENXIO);
if (status < 0) { if (status < 0) {
...@@ -747,7 +981,6 @@ void platform_start_callback(void *arg) ...@@ -747,7 +981,6 @@ void platform_start_callback(void *arg)
goto heapbuf_open_fail; goto heapbuf_open_fail;
} }
} }
if (pc_params.use_messageq) { if (pc_params.use_messageq) {
do { do {
nread = sysmgr_get_object_config(proc_id, &pgp_params, nread = sysmgr_get_object_config(proc_id, &pgp_params,
...@@ -765,9 +998,16 @@ void platform_start_callback(void *arg) ...@@ -765,9 +998,16 @@ void platform_start_callback(void *arg)
gate_params.shared_addr = (void *) sh_addr; gate_params.shared_addr = (void *) sh_addr;
gate_params.shared_addr_size = pgp_params.shared_mem_size; gate_params.shared_addr_size = pgp_params.shared_mem_size;
do { do {
status = gatepeterson_open(&platform_mqt_gate_handle, if (index == SMHEAP_SRINDEX_APPM3)
status = gatepeterson_open(
&platform_mqt_gate_handle_appm3,
&gate_params);
else
status = gatepeterson_open(
&platform_mqt_gate_handle_sysm3,
&gate_params); &gate_params);
} while (status == -ENXIO); } while (status == -ENXIO);
if (status < 0) { if (status < 0) {
status = SYSMGR_E_FAIL; status = SYSMGR_E_FAIL;
goto gatepeterson_open_fail; goto gatepeterson_open_fail;
...@@ -775,13 +1015,19 @@ void platform_start_callback(void *arg) ...@@ -775,13 +1015,19 @@ void platform_start_callback(void *arg)
do { do {
nread = sysmgr_get_object_config(proc_id, nread = sysmgr_get_object_config(proc_id,
(void *) &pmqt_params, PLATFORM_CMD_MQT, (void *) &pmqt_params,
PLATFORM_CMD_MQT,
sizeof(struct \ sizeof(struct \
platform_messageq_transportshm_params)); platform_messageq_transportshm_params));
} while (nread != sizeof( } while (nread != sizeof(
struct platform_messageq_transportshm_params)); struct platform_messageq_transportshm_params));
/* Register this heap with platform_messageq */ /* Register this heap with platform_messageq */
messageq_register_heap(platform_heap_handle, HEAPID); if (index == SMHEAP_SRINDEX_APPM3)
messageq_register_heap(platform_heap_handle_appm3,
HEAPID);
else
messageq_register_heap(platform_heap_handle_sysm3,
HEAPID);
sh_addr = (u32) sharedregion_get_ptr((u32 *) sh_addr = (u32) sharedregion_get_ptr((u32 *)
pmqt_params.shared_mem_addr); pmqt_params.shared_mem_addr);
if (sh_addr == (u32)NULL) { if (sh_addr == (u32)NULL) {
...@@ -793,13 +1039,28 @@ void platform_start_callback(void *arg) ...@@ -793,13 +1039,28 @@ void platform_start_callback(void *arg)
msgqt_params.notify_event_no = pmqt_params.notify_event_no; msgqt_params.notify_event_no = pmqt_params.notify_event_no;
msgqt_params.notify_driver = platform_notifydrv_handle; msgqt_params.notify_driver = platform_notifydrv_handle;
msgqt_params.shared_addr_size = pmqt_params.shared_mem_size; msgqt_params.shared_addr_size = pmqt_params.shared_mem_size;
msgqt_params.gate = platform_mqt_gate_handle; if (index == SMHEAP_SRINDEX_APPM3) {
platform_transport_shm_handle = messageq_transportshm_create( msgqt_params.gate = platform_mqt_gate_handle_appm3;
proc_id, &msgqt_params); platform_transport_shm_handle_appm3 =
if (platform_transport_shm_handle == NULL) { messageq_transportshm_create(
proc_id,
&msgqt_params);
if (platform_transport_shm_handle_appm3 == NULL) {
status = SYSMGR_E_FAIL;
goto messageq_transportshm_create_fail;
}
} else {
msgqt_params.gate = platform_mqt_gate_handle_sysm3;
platform_transport_shm_handle_sysm3 =
messageq_transportshm_create(
proc_id,
&msgqt_params);
if (platform_transport_shm_handle_sysm3 == NULL) {
status = SYSMGR_E_FAIL; status = SYSMGR_E_FAIL;
goto messageq_transportshm_create_fail; goto messageq_transportshm_create_fail;
} }
}
} }
if (status >= 0) { if (status >= 0) {
...@@ -852,6 +1113,9 @@ sharedregion_getptr_fail: ...@@ -852,6 +1113,9 @@ sharedregion_getptr_fail:
multiproc_fail: multiproc_fail:
printk(KERN_ERR "platform_start_callback: multiproc_set_local_id failed" printk(KERN_ERR "platform_start_callback: multiproc_set_local_id failed"
" status[0x%x]", status); " status[0x%x]", status);
proc_invalid_id:
printk(KERN_ERR "platform_load_callback failed invalid"
" proc_id [0x%x]\n", proc_id);
exit: exit:
return; return;
} }
...@@ -868,17 +1132,37 @@ EXPORT_SYMBOL(platform_start_callback); ...@@ -868,17 +1132,37 @@ EXPORT_SYMBOL(platform_start_callback);
void platform_stop_callback(void *arg) void platform_stop_callback(void *arg)
{ {
s32 status = 0; s32 status = 0;
u16 proc_id = (u32) arg;
int index = 0;
if (proc_id == multiproc_get_id("SysM3"))
index = SMHEAP_SRINDEX_SYSM3;
else if (proc_id == multiproc_get_id("AppM3"))
index = SMHEAP_SRINDEX_APPM3;
else {
status = SYSMGR_E_FAIL;
goto proc_invalid_id;
}
if (pc_params.use_messageq) { if (pc_params.use_messageq) {
/* Finalize drivers */ /* Finalize drivers */
status = gatepeterson_close(&platform_mqt_gate_handle); if (index == SMHEAP_SRINDEX_APPM3)
status = gatepeterson_close(
&platform_mqt_gate_handle_appm3);
else
status = gatepeterson_close(
&platform_mqt_gate_handle_sysm3);
if (status < 0) { if (status < 0) {
printk(KERN_ERR "platform_stop_callback : mqt " printk(KERN_ERR "platform_stop_callback : mqt "
"gatepeterson_close failed [0x%x]", status); "gatepeterson_close failed [0x%x]", status);
} }
if (index == SMHEAP_SRINDEX_APPM3)
status = messageq_transportshm_delete( status = messageq_transportshm_delete(
&platform_transport_shm_handle); &platform_transport_shm_handle_appm3);
else
status = messageq_transportshm_delete(
&platform_transport_shm_handle_sysm3);
if (status < 0) { if (status < 0) {
printk(KERN_ERR "platform_stop_callback : " printk(KERN_ERR "platform_stop_callback : "
"messageq_transportshm_delete failed [0x%x]", "messageq_transportshm_delete failed [0x%x]",
...@@ -887,13 +1171,23 @@ void platform_stop_callback(void *arg) ...@@ -887,13 +1171,23 @@ void platform_stop_callback(void *arg)
} }
if (pc_params.use_nameserver) { if (pc_params.use_nameserver) {
status = gatepeterson_close(&platform_nsrn_gate_handle); if (index == SMHEAP_SRINDEX_APPM3)
status = gatepeterson_close(
&platform_nsrn_gate_handle_appm3);
else
status = gatepeterson_close(
&platform_nsrn_gate_handle_sysm3);
if (status < 0) { if (status < 0) {
printk(KERN_ERR "platform_stop_callback : nsrn" printk(KERN_ERR "platform_stop_callback : nsrn"
"gatepeterson_close failed [0x%x]", status); "gatepeterson_close failed [0x%x]", status);
} }
status = nameserver_remotenotify_delete(&platform_nsrn_handle); if (index == SMHEAP_SRINDEX_APPM3)
status = nameserver_remotenotify_delete(
&platform_nsrn_handle_appm3);
else
status = nameserver_remotenotify_delete(
&platform_nsrn_handle_sysm3);
if (status < 0) { if (status < 0) {
printk(KERN_ERR "platform_stop_callback : " printk(KERN_ERR "platform_stop_callback : "
"nameserver_remotenotify_delete failed [0x%x]", "nameserver_remotenotify_delete failed [0x%x]",
...@@ -902,20 +1196,33 @@ void platform_stop_callback(void *arg) ...@@ -902,20 +1196,33 @@ void platform_stop_callback(void *arg)
} }
if (pc_params.use_heapbuf) { if (pc_params.use_heapbuf) {
if (index == SMHEAP_SRINDEX_APPM3)
status = messageq_unregister_heap(HEAPID);
/* FIXME HEAPID?? */
else
status = messageq_unregister_heap(HEAPID); status = messageq_unregister_heap(HEAPID);
/* FIXME HEAPID?? */
if (status < 0) { if (status < 0) {
printk(KERN_ERR "platform_stop_callback : " printk(KERN_ERR "platform_stop_callback : "
"messageq_unregister_heap failed [0x%x]", "messageq_unregister_heap failed [0x%x]",
status); status);
} }
status = gatepeterson_close(&platform_heap_gate_handle); if (index == SMHEAP_SRINDEX_APPM3)
status = gatepeterson_close(
&platform_heap_gate_handle_appm3);
else
status = gatepeterson_close(
&platform_heap_gate_handle_sysm3);
if (status < 0) { if (status < 0) {
printk(KERN_ERR "platform_stop_callback : heap" printk(KERN_ERR "platform_stop_callback : heap"
"gatepeterson_close failed [0x%x]", status); "gatepeterson_close failed [0x%x]", status);
} }
status = heapbuf_close(platform_heap_handle); if (index == SMHEAP_SRINDEX_APPM3)
status = heapbuf_close(platform_heap_handle_appm3);
else
status = heapbuf_close(platform_heap_handle_sysm3);
if (status < 0) { if (status < 0) {
printk(KERN_ERR "platform_stop_callback : " printk(KERN_ERR "platform_stop_callback : "
"heapbuf_close failed [0x%x]", status); "heapbuf_close failed [0x%x]", status);
...@@ -923,9 +1230,19 @@ void platform_stop_callback(void *arg) ...@@ -923,9 +1230,19 @@ void platform_stop_callback(void *arg)
} }
if (pc_params.use_notify) { if (pc_params.use_notify) {
if (index == SMHEAP_SRINDEX_APPM3)
platform_notifydrv_handle_appm3 = NULL;
else
platform_notifydrv_handle_sysm3 = NULL;
if (platform_notifydrv_handle_sysm3 == NULL &&
platform_notifydrv_handle_appm3 == NULL) {
status = notify_ducatidrv_delete( status = notify_ducatidrv_delete(
(struct notify_driver_object **) (struct notify_driver_object **)
&platform_notifydrv_handle); &platform_notifydrv_handle);
platform_notifydrv_handle_sysm3 = NULL;
platform_notifydrv_handle_appm3 = NULL;
}
if (status < 0) { if (status < 0) {
printk(KERN_ERR "platform_stop_callback : " printk(KERN_ERR "platform_stop_callback : "
"notify_ducatidrv_delete failed [0x%x]", "notify_ducatidrv_delete failed [0x%x]",
...@@ -933,17 +1250,28 @@ void platform_stop_callback(void *arg) ...@@ -933,17 +1250,28 @@ void platform_stop_callback(void *arg)
} }
} }
status = sharedregion_remove(0); if (index == SMHEAP_SRINDEX_APPM3) {
status = sharedregion_remove(SMHEAP_SRINDEX_APPM3);
if (status < 0) { if (status < 0) {
printk(KERN_ERR "platform_stop_callback : " printk(KERN_ERR "platform_stop_callback : "
"sharedregion_remove failed [0x%x]", status); "sharedregion_remove failed [0x%x]", status);
} }
status = sharedregion_remove(1); } else {
status = sharedregion_remove(SMHEAP_SRINDEX_SYSM3);
if (status < 0) { if (status < 0) {
printk(KERN_ERR "platform_stop_callback : " printk(KERN_ERR "platform_stop_callback : "
"sharedregion_remove failed [0x%x]", status); "sharedregion_remove failed [0x%x]", status);
} }
}
goto exit;
proc_invalid_id:
printk(KERN_ERR "platform_load_callback failed invalid"
" proc_id [0x%x]\n", proc_id);
exit:
return;
} }
EXPORT_SYMBOL(platform_stop_callback); EXPORT_SYMBOL(platform_stop_callback);
/* FIXME: since application has to call this API for now */ /* FIXME: since application has to call this API for now */
...@@ -299,7 +299,7 @@ u32 sysmgr_put_object_config(u16 proc_id, void *config, u32 cmd_id, u32 size) ...@@ -299,7 +299,7 @@ u32 sysmgr_put_object_config(u16 proc_id, void *config, u32 cmd_id, u32 size)
if (entry->offset != -1) { if (entry->offset != -1) {
offset += entry->offset; offset += entry->offset;
entry = (struct sysmgr_bootload_page_entry *) entry = (struct sysmgr_bootload_page_entry *)
((u32) &blp->slave_config + entry->offset); ((u32) &blp->host_config + entry->offset);
} else { } else {
break; break;
} }
...@@ -327,7 +327,7 @@ u32 sysmgr_put_object_config(u16 proc_id, void *config, u32 cmd_id, u32 size) ...@@ -327,7 +327,7 @@ u32 sysmgr_put_object_config(u16 proc_id, void *config, u32 cmd_id, u32 size)
entry->valid = SYSMGR_ENTRYVALIDSTAMP; entry->valid = SYSMGR_ENTRYVALIDSTAMP;
/* Attach the new created entry */ /* Attach the new created entry */
prev->offset = ((u32) entry - (u32) &blp->slave_config); prev->offset = ((u32) entry - (u32) &blp->host_config);
} }
/* return number of bytes wrote to the boot load page */ /* return number of bytes wrote to the boot load page */
...@@ -578,8 +578,7 @@ s32 sysmgr_destroy(void) ...@@ -578,8 +578,7 @@ s32 sysmgr_destroy(void)
} }
if (atomic_dec_return(&sysmgr_state.ref_count) if (atomic_dec_return(&sysmgr_state.ref_count)
!= SYSMGR_MAKE_MAGICSTAMP(0)) != SYSMGR_MAKE_MAGICSTAMP(0)) {
{
status = 1; status = 1;
goto exit; goto exit;
} }
...@@ -776,6 +775,8 @@ void sysmgr_wait_for_scalability_info(u16 proc_id) ...@@ -776,6 +775,8 @@ void sysmgr_wait_for_scalability_info(u16 proc_id)
printk(KERN_ERR "sysmgr_wait_for_scalability_info: BF while temp->handshake:%x\n", printk(KERN_ERR "sysmgr_wait_for_scalability_info: BF while temp->handshake:%x\n",
temp->handshake); temp->handshake);
printk(KERN_ERR "Please break the platform and load Ducati image.\n");
while (temp->handshake != SYSMGR_SCALABILITYHANDSHAKESTAMP) while (temp->handshake != SYSMGR_SCALABILITYHANDSHAKESTAMP)
; ;
......
...@@ -598,7 +598,7 @@ int proc_mgr_start(void *handle, u32 entry_point, ...@@ -598,7 +598,7 @@ int proc_mgr_start(void *handle, u32 entry_point,
#if defined CONFIG_SYSLINK_USE_SYSMGR #if defined CONFIG_SYSLINK_USE_SYSMGR
if (retval == 0) { if (retval == 0) {
/* TBD: should be removed when notify local is implemepented */ /* TBD: should be removed when notify local is implemepented */
platform_start_callback(proc_mgr_handle->proc_id); platform_start_callback((void *)params->proc_id);
} }
#endif /* defined (CONFIG_SYSLINK_USE_SYSMGR)*/ #endif /* defined (CONFIG_SYSLINK_USE_SYSMGR)*/
......
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