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
......@@ -64,13 +64,13 @@
/*!
* @brief Interrupt ID of physical interrupt handled by the Notify driver to
* receive events.
* receive events.
*/
#define BASE_DUCATI2ARM_INTID 26
/*!
* @brief Interrupt ID of physical interrupt handled by the Notify driver to
* send events.
* send events.
*/
#define BASE_ARM2DUCATI_INTID 50
......@@ -104,38 +104,61 @@
*/
#define HEAPBUF_BLOCKSIZE 256
/*! @brief Start of shared memory */
#define SHAREDMEMORY_BASEADDR 0x87B00000
#define SHAREDMEMORY_BASESIZE 0x0007F000
#define SHAREDMEMORY_PHY_BASEADDR 0x87B00000
#define SHAREDMEMORY_PHY_BASESIZE 0x00100000
/*! @brief Start of Boot load page */
#define BOOTLOADPAGE_BASEADDR 0x9807F000
#define BOOTLOADPAGE_BASESIZE 0x00001000
/*! @brief Start of shared memory for SysM3 */
#define SHAREDMEMORY_PHY_BASEADDR_SYSM3 0x87B00000
#define SHAREDMEMORY_PHY_BASESIZE_SYSM3 0x0007F000
/*! @brief Start of shared memory */
#define SHAREDMEMORY_BASEADDR_APPM3 0x87B80000
#define SHAREDMEMORY_BASESIZE_APPM3 0x0007F000
/*! @brief Start of shared memory AppM3 */
#define SHAREDMEMORY_PHY_BASEADDR_APPM3 0x87B80000
#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 */
#define BOOTLOADPAGE_BASEADDR_APPM3 0x8718F000
#define BOOTLOADPAGE_BASESIZE_APPM3 0x0000F000
/*! @brief Start of Boot load page for SysM3 */
#define BOOTLOADPAGE_SLV_VRT_BASEADDR_SYSM3 0x9807F000
#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
* 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.
*/
#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
*/
#define BOOTLOADPAGE_SRINDEX 1
#define BOOTLOADPAGE_SRINDEX 1
/*!
......@@ -196,6 +219,27 @@ void *platform_heap_handle;
void *platform_mqt_gate_handle;
void *platform_transport_shm_handle;
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.
......@@ -254,6 +298,17 @@ struct platform_proc_config_params {
*/
#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.
*/
......@@ -270,27 +325,35 @@ struct platform_proc_config_params {
*/
static struct proc4430_mem_entry mem_entries[NUM_MEM_ENTRIES] = {
{
"DUCATI_SHM", /* NAME : Name of the memory region */
SHAREDMEMORY_BASEADDR,
/* PHYSADDR : Physical address */
DUCATI_SHM_VA, /* SLAVEVIRTADDR : Slave virtual address */
"DUCATI_SHM_SYSM3", /* NAME : Name of the memory region */
SHAREDMEMORY_PHY_BASEADDR_SYSM3,
/* PHYSADDR : Physical address */
SHAREDMEMORY_SLV_VRT_BASEADDR_SYSM3,
/* SLAVEVIRTADDR : Slave virtual address */
(u32) -1u,
/* MASTERVIRTADDR : Master virtual address (if known) */
0x80000, /* SIZE : Size of the memory region */
true, /* SHARE : Shared access memory? */
/* MASTERVIRTADDR : Master virtual address (if known) */
SHAREDMEMORY_SLV_VRT_BASESIZE_SYSM3,
/* SIZE : Size of the memory region */
true, /* SHARE : Shared access memory? */
},
{
"DUCATI_SHM1", /* NAME : Name of the memory region */
SHAREDMEMORY_BASEADDR_APPM3,
/* PHYSADDR : Physical address */
DUCATI_SHM_1_VA, /* SLAVEVIRTADDR : Slave virtual address */
"DUCATI_SHM_APPM3", /* NAME : Name of the memory region */
SHAREDMEMORY_PHY_BASEADDR_APPM3,
/* PHYSADDR : Physical address */
SHAREDMEMORY_SLV_VRT_BASEADDR_APPM3,
/* SLAVEVIRTADDR : Slave virtual address */
(u32) -1u,
/* MASTERVIRTADDR : Master virtual address (if known) */
0x80000, /* SIZE : Size of the memory region */
true, /* SHARE : Shared access memory? */
/* MASTERVIRTADDR : Master virtual address (if known) */
SHAREDMEMORY_SLV_VRT_BASESIZE_APPM3,
/* SIZE : Size of the memory region */
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.
......@@ -302,6 +365,27 @@ void *procmgr_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.
*/
......@@ -326,6 +410,7 @@ struct sysmgr_proc_config pc_params;
* APIS
* =============================================================================
*/
/*
* ======== platform_setup ========
* Purpose:
......@@ -333,6 +418,7 @@ struct sysmgr_proc_config pc_params;
*/
s32 platform_setup(struct sysmgr_config *config)
{
s32 status = 0;
struct proc4430_config proc_config;
struct proc_mgr_params params;
......@@ -349,8 +435,8 @@ s32 platform_setup(struct sysmgr_config *config)
}
/* Map the static region */
info.src = SHAREDMEMORY_BASEADDR;
info.size = SHAREDMEMORY_BASESIZE;
info.src = SHAREDMEMORY_PHY_BASEADDR;
info.size = SHAREDMEMORY_PHY_BASESIZE;
info.is_cached = false;
status = platform_mem_map(&info);
if (status < 0)
......@@ -359,39 +445,59 @@ s32 platform_setup(struct sysmgr_config *config)
/* Get default config for System memory manager */
sysmemmgr_get_config(&sysmemmgr_cfg);
/* Initialize the System memory manager */
sysmemmgr_cfg.static_mem_size = SHAREDMEMORY_BASESIZE;
sysmemmgr_cfg.static_phys_base_addr = SHAREDMEMORY_BASEADDR;
sysmemmgr_cfg.static_mem_size = SHAREDMEMORY_PHY_BASESIZE;
sysmemmgr_cfg.static_phys_base_addr = SHAREDMEMORY_PHY_BASEADDR;
sysmemmgr_cfg.static_virt_base_addr = info.dst;
sysmemmgr_cfg.event_no = PLATFORM_SYSMEMMGR_EVENTNO;
status = sysmemmgr_setup(&sysmemmgr_cfg);
if (status < 0)
goto sysmemmgr_setup_fail;
/* The heap for SysM3 and AppM3 are allocated at once */
platform_sm_heap_virt_addr = sysmemmgr_alloc(SMHEAP_SIZE,
sysmemmgr_allocflag_physical);
if (platform_sm_heap_virt_addr == NULL)
goto sysmemmgr_alloc_fail;
/* Create the shared region entry for the SM heap */
sharedregion_add(SMHEAP_SRINDEX, platform_sm_heap_virt_addr,
SMHEAP_SIZE);
/* Zero out the shared memory */
memset((void *) platform_sm_heap_virt_addr, 0, SMHEAP_SIZE);
platform_sm_heap_virt_addr_sysm3 = platform_sm_heap_virt_addr;
/* The AppM3 shared area is after SysM3 heap + boot load page */
platform_sm_heap_virt_addr_appm3 = (platform_sm_heap_virt_addr_sysm3 +
SHAREDMEMORY_PHY_BASESIZE_SYSM3 +
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);
status = proc4430_setup(&proc_config);
if (status < 0)
goto proc_setup_fail;
/* Get MultiProc ID by name. */
proc_id = multiproc_get_id("SysM3");
/* Create an instance of the Processor object for OMAP4430 */
proc4430_params_init(NULL, &proc_params);
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;
procmgr_proc_handle = proc4430_create(proc_id, &proc_params);
if (procmgr_proc_handle == NULL) {
status = SYSMGR_E_FAIL;
......@@ -406,7 +512,14 @@ s32 platform_setup(struct sysmgr_config *config)
status = SYSMGR_E_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:
printk(KERN_ERR "platform_setup: proc_mgr_create failed [0x%x]",
status);
......@@ -448,8 +561,8 @@ s32 platform_destroy(void)
{
s32 status = 0;
struct platform_mem_unmap_info u_info;
/* Delete the Processor instances */
if (procmgr_proc_handle != NULL) {
status = proc4430_delete(&procmgr_proc_handle);
WARN_ON(status < 0);
......@@ -488,44 +601,109 @@ void platform_load_callback(void *arg)
u32 boot_load_page;
u32 sh_addr_base;
u32 nwrite;
int index;
/* Get the boot load page address */
/* TBD:
boot_load_page = Proc_getBootLoadPage (procmgr_handle); */
boot_load_page = BOOTLOADPAGE_BASEADDR;
status = proc_mgr_translate_addr(procmgr_handle,
(void *) &sh_addr_base,
PROC_MGR_ADDRTYPE_MASTERKNLVIRT,
(void *) boot_load_page,
PROC_MGR_ADDRTYPE_SLAVEVIRT);
if (status < 0) {
printk(KERN_ERR "proc_mgr_translate_addr [0x%x]\n",
status);
} else {
/* Zero out the boot load page */
memset((void *) sh_addr_base, 0, BOOTLOADPAGE_BASESIZE);
sharedregion_add(BOOTLOADPAGE_SRINDEX, (void *)sh_addr_base,
BOOTLOADPAGE_BASESIZE);
printk(KERN_ERR "platform_load_callback\n");
/* Get the written entry */
local_id = multiproc_get_id(NULL);
/* Set the boot load page address */
sysmgr_set_boot_load_page(proc_id, sh_addr_base);
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 */
boot_load_page = BOOTLOADPAGE_SLV_VRT_BASEADDR_SYSM3;
status = proc_mgr_translate_addr(procmgr_handle_sysm3,
(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_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;
/* Get the written entry */
local_id = multiproc_get_id(NULL);
sharedregion_get_table_info(SMHEAP_SRINDEX, local_id, &info);
platform_sm_heap_phys_addr = sysmemmgr_translate(
platform_sm_heap_virt_addr,
sysmemmgr_xltflag_kvirt2phys);
info.base = (void *) DUCATI_SHM_VA;
/* Write info the boot load page */
nwrite = sysmgr_put_object_config(proc_id,
(void *) &info,
SYSMGR_CMD_SHAREDREGION_ENTRY_START,
sizeof(struct sharedregion_info));
WARN_ON(nwrite != sizeof(struct sharedregion_info));
/* 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 */
sysmgr_set_boot_load_page(proc_id, sh_addr_base);
/* Write the boot table (containing both regions) to */
/* the current processor */
/* For SysM3 */
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);
info.base = (void *) SHAREDMEMORY_SLV_VRT_BASEADDR_APPM3;
/* Write info the boot load page */
nwrite = sysmgr_put_object_config(proc_id,
(void *) &info,
SYSMGR_CMD_SHAREDREGION_ENTRY_START +
SMHEAP_SRINDEX_APPM3,
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);
......@@ -545,6 +723,7 @@ void platform_start_callback(void *arg)
u32 i = 0;
u32 cmd_id;
u32 sh_addr;
int index;
struct notify_ducatidrv_params notify_shm_params;
struct gatepeterson_params gate_params;
......@@ -562,7 +741,14 @@ void platform_start_callback(void *arg)
/*u32 proc_ids[2];*/
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 */
sysmgr_wait_for_scalability_info(proc_id);
/* Read the scalability info */
......@@ -581,6 +767,7 @@ void platform_start_callback(void *arg)
}
}
/* TODO: add condition: proc_id == multiproc_get_id("SysM3") */
if (pc_params.use_notify) {
do {
nread = sysmgr_get_object_config(proc_id,
......@@ -609,17 +796,25 @@ void platform_start_callback(void *arg)
notify_shm_params.recv_int_id = BASE_DUCATI2ARM_INTID;
notify_shm_params.send_int_id = BASE_ARM2DUCATI_INTID;
notify_shm_params.remote_proc_id = proc_id;
/* Create instance of Notify Ducati Driver */
platform_notifydrv_handle = notify_ducatidrv_create(
"NOTIFYDRIVER_DUCATI",
&notify_shm_params);
if (platform_notifydrv_handle == NULL) {
status = SYSMGR_E_FAIL;
goto notify_ducatidrv_create_fail;
/* Create instance of Notify Ducati Driver */
platform_notifydrv_handle = notify_ducatidrv_create(
"NOTIFYDRIVER_DUCATI",
&notify_shm_params);
if (platform_notifydrv_handle == NULL) {
status = SYSMGR_E_FAIL;
goto notify_ducatidrv_create_fail;
}
}
}
/* 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) {
do {
nread = sysmgr_get_object_config(proc_id,
......@@ -638,8 +833,14 @@ void platform_start_callback(void *arg)
gate_params.shared_addr = (void *) sh_addr;
gate_params.shared_addr_size = pgp_params.shared_mem_size;
do {
status = gatepeterson_open(&platform_nsrn_gate_handle,
&gate_params);
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);
} while (status == -ENXIO);
if (status < 0) {
......@@ -654,7 +855,8 @@ void platform_start_callback(void *arg)
sizeof(struct \
platform_nameserver_remotenotify_params));
} while (nread != \
sizeof(struct platform_nameserver_remotenotify_params));
sizeof(struct
platform_nameserver_remotenotify_params));
sh_addr = (u32) sharedregion_get_ptr((u32 *)
pnsrn_params.shared_mem_addr);
if (sh_addr == (u32)NULL) {
......@@ -671,18 +873,34 @@ void platform_start_callback(void *arg)
*/
nameserver_remotenotify_params_init(NULL, &nsr_params);
nsr_params.notify_driver = platform_notifydrv_handle;
/* Both are using same notify */
nsr_params.notify_event_no = pnsrn_params.notify_event_no;
nsr_params.shared_addr = (void *) sh_addr;
nsr_params.shared_addr_size = pnsrn_params.shared_mem_size;
nsr_params.gate = (void *) platform_nsrn_gate_handle;
platform_nsrn_handle = nameserver_remotenotify_create(proc_id,
&nsr_params);
if (platform_nsrn_handle == NULL) {
status = SYSMGR_E_FAIL;
goto nameserver_remotenotify_create_fail;
if (index == SMHEAP_SRINDEX_APPM3) {
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);
if (platform_nsrn_handle_sysm3 == NULL) {
status = SYSMGR_E_FAIL;
goto nameserver_remotenotify_create_fail;
}
}
}
if (pc_params.use_heapbuf) {
do {
nread = sysmgr_get_object_config(proc_id,
......@@ -690,7 +908,8 @@ void platform_start_callback(void *arg)
PLATFORM_CMD_GPHEAPBUF,
sizeof(struct \
platform_gaterpeterson_params));
} while (nread != sizeof(struct platform_gaterpeterson_params));
} while (nread != sizeof(struct
platform_gaterpeterson_params));
sh_addr = (u32) sharedregion_get_ptr((u32 *)
pgp_params.shared_mem_addr);
if (sh_addr == (u32)NULL) {
......@@ -701,8 +920,14 @@ void platform_start_callback(void *arg)
gate_params.shared_addr = (void *) sh_addr;
gate_params.shared_addr_size = pgp_params.shared_mem_size;
do {
status = gatepeterson_open(&platform_heap_gate_handle,
&gate_params);
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);
} while (status == -ENXIO);
if (status < 0) {
status = SYSMGR_E_FAIL;
......@@ -736,10 +961,19 @@ void platform_start_callback(void *arg)
}
heap_params.shared_buf_size = phb_params.shared_buf_size;
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;
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);
} while (status == -ENXIO);
if (status < 0) {
......@@ -747,7 +981,6 @@ void platform_start_callback(void *arg)
goto heapbuf_open_fail;
}
}
if (pc_params.use_messageq) {
do {
nread = sysmgr_get_object_config(proc_id, &pgp_params,
......@@ -765,9 +998,16 @@ void platform_start_callback(void *arg)
gate_params.shared_addr = (void *) sh_addr;
gate_params.shared_addr_size = pgp_params.shared_mem_size;
do {
status = gatepeterson_open(&platform_mqt_gate_handle,
&gate_params);
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);
} while (status == -ENXIO);
if (status < 0) {
status = SYSMGR_E_FAIL;
goto gatepeterson_open_fail;
......@@ -775,13 +1015,19 @@ void platform_start_callback(void *arg)
do {
nread = sysmgr_get_object_config(proc_id,
(void *) &pmqt_params, PLATFORM_CMD_MQT,
(void *) &pmqt_params,
PLATFORM_CMD_MQT,
sizeof(struct \
platform_messageq_transportshm_params));
} while (nread != sizeof(
struct platform_messageq_transportshm_params));
/* 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 *)
pmqt_params.shared_mem_addr);
if (sh_addr == (u32)NULL) {
......@@ -793,12 +1039,27 @@ void platform_start_callback(void *arg)
msgqt_params.notify_event_no = pmqt_params.notify_event_no;
msgqt_params.notify_driver = platform_notifydrv_handle;
msgqt_params.shared_addr_size = pmqt_params.shared_mem_size;
msgqt_params.gate = platform_mqt_gate_handle;
platform_transport_shm_handle = messageq_transportshm_create(
proc_id, &msgqt_params);
if (platform_transport_shm_handle == NULL) {
status = SYSMGR_E_FAIL;
goto messageq_transportshm_create_fail;
if (index == SMHEAP_SRINDEX_APPM3) {
msgqt_params.gate = platform_mqt_gate_handle_appm3;
platform_transport_shm_handle_appm3 =
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;
goto messageq_transportshm_create_fail;
}
}
}
......@@ -852,6 +1113,9 @@ sharedregion_getptr_fail:
multiproc_fail:
printk(KERN_ERR "platform_start_callback: multiproc_set_local_id failed"
" status[0x%x]", status);
proc_invalid_id:
printk(KERN_ERR "platform_load_callback failed invalid"
" proc_id [0x%x]\n", proc_id);
exit:
return;
}
......@@ -868,17 +1132,37 @@ EXPORT_SYMBOL(platform_start_callback);
void platform_stop_callback(void *arg)
{
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) {
/* 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) {
printk(KERN_ERR "platform_stop_callback : mqt "
"gatepeterson_close failed [0x%x]", status);
}
status = messageq_transportshm_delete(
&platform_transport_shm_handle);
if (index == SMHEAP_SRINDEX_APPM3)
status = messageq_transportshm_delete(
&platform_transport_shm_handle_appm3);
else
status = messageq_transportshm_delete(
&platform_transport_shm_handle_sysm3);
if (status < 0) {
printk(KERN_ERR "platform_stop_callback : "
"messageq_transportshm_delete failed [0x%x]",
......@@ -887,13 +1171,23 @@ void platform_stop_callback(void *arg)
}
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) {
printk(KERN_ERR "platform_stop_callback : nsrn"
"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) {
printk(KERN_ERR "platform_stop_callback : "
"nameserver_remotenotify_delete failed [0x%x]",
......@@ -902,20 +1196,33 @@ void platform_stop_callback(void *arg)
}
if (pc_params.use_heapbuf) {
status = messageq_unregister_heap(HEAPID);
if (index == SMHEAP_SRINDEX_APPM3)
status = messageq_unregister_heap(HEAPID);
/* FIXME HEAPID?? */
else
status = messageq_unregister_heap(HEAPID);
/* FIXME HEAPID?? */
if (status < 0) {
printk(KERN_ERR "platform_stop_callback : "
"messageq_unregister_heap failed [0x%x]",
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) {
printk(KERN_ERR "platform_stop_callback : heap"
"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) {
printk(KERN_ERR "platform_stop_callback : "
"heapbuf_close failed [0x%x]", status);
......@@ -923,9 +1230,19 @@ void platform_stop_callback(void *arg)
}
if (pc_params.use_notify) {
status = notify_ducatidrv_delete(
(struct notify_driver_object **)
&platform_notifydrv_handle);
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(
(struct notify_driver_object **)
&platform_notifydrv_handle);
platform_notifydrv_handle_sysm3 = NULL;
platform_notifydrv_handle_appm3 = NULL;
}
if (status < 0) {
printk(KERN_ERR "platform_stop_callback : "
"notify_ducatidrv_delete failed [0x%x]",
......@@ -933,17 +1250,28 @@ void platform_stop_callback(void *arg)
}
}
status = sharedregion_remove(0);
if (status < 0) {
printk(KERN_ERR "platform_stop_callback : "
"sharedregion_remove failed [0x%x]", status);
}
if (index == SMHEAP_SRINDEX_APPM3) {
status = sharedregion_remove(SMHEAP_SRINDEX_APPM3);
if (status < 0) {
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);
} else {
status = sharedregion_remove(SMHEAP_SRINDEX_SYSM3);
if (status < 0) {
printk(KERN_ERR "platform_stop_callback : "
"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);
/* 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)
if (entry->offset != -1) {
offset += entry->offset;
entry = (struct sysmgr_bootload_page_entry *)
((u32) &blp->slave_config + entry->offset);
((u32) &blp->host_config + entry->offset);
} else {
break;
}
......@@ -327,7 +327,7 @@ u32 sysmgr_put_object_config(u16 proc_id, void *config, u32 cmd_id, u32 size)
entry->valid = SYSMGR_ENTRYVALIDSTAMP;
/* 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 */
......@@ -578,8 +578,7 @@ s32 sysmgr_destroy(void)
}
if (atomic_dec_return(&sysmgr_state.ref_count)
!= SYSMGR_MAKE_MAGICSTAMP(0))
{
!= SYSMGR_MAKE_MAGICSTAMP(0)) {
status = 1;
goto exit;
}
......@@ -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",
temp->handshake);
printk(KERN_ERR "Please break the platform and load Ducati image.\n");
while (temp->handshake != SYSMGR_SCALABILITYHANDSHAKESTAMP)
;
......
......@@ -598,7 +598,7 @@ int proc_mgr_start(void *handle, u32 entry_point,
#if defined CONFIG_SYSLINK_USE_SYSMGR
if (retval == 0) {
/* 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)*/
......
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