summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: f045ed1)
raw | patch | inline | side by side (parent: f045ed1)
author | Ramsey Harris <ramsey@ti.com> | |
Sat, 17 Jan 2015 00:58:24 +0000 (16:58 -0800) | ||
committer | Robert Tivy <rtivy@ti.com> | |
Wed, 21 Jan 2015 00:45:55 +0000 (16:45 -0800) |
Added cluster support on IPC Linux implementation. Added two new
fields to the MultiProc_Config structure: numProcsInCluster, and
baseIdOfCluster. Updated all LAD config files with new fields.
Made changes to iterate over processors in cluster instead of
iterating over all processors in the system. Mapped procId to
clusterId as needed. Added LOG3 macro to LAD.
Added new cluster fields to MultiProc config struct
Linux and QNX share the same MultiProc API implementation
but different MultiProc configuration definitions. I needed
to add the new cluster fields to the QNX config struct. This
does not add cluster support to QNX.
fields to the MultiProc_Config structure: numProcsInCluster, and
baseIdOfCluster. Updated all LAD config files with new fields.
Made changes to iterate over processors in cluster instead of
iterating over all processors in the system. Mapped procId to
clusterId as needed. Added LOG3 macro to LAD.
Added new cluster fields to MultiProc config struct
Linux and QNX share the same MultiProc API implementation
but different MultiProc configuration definitions. I needed
to add the new cluster fields to the QNX config struct. This
does not add cluster support to QNX.
18 files changed:
index 83bbce59e6927941550b9e7cbed6aa33137405fd..d7f505f0b6f172b19ace6c794cbe7963ba2a628e 100644 (file)
/*
- * Copyright (c) 2013, Texas Instruments Incorporated
+ * Copyright (c) 2013-2015 Texas Instruments Incorporated - http://www.ti.com
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
#include <ti/ipc/MultiProc.h>
#include <_MultiProc.h>
+/*
+ * ======== MultiProc_getBaseIdOfCluster ========
+ */
+UInt16 MultiProc_getBaseIdOfCluster()
+{
+ return (_MultiProc_cfg.baseIdOfCluster);
+}
+
/*
* ======== MultiProc_getId ========
*/
assert(name != NULL);
id = MultiProc_INVALIDID;
- for (i = 0; i < _MultiProc_cfg.numProcessors; i++) {
+ for (i = 0; i < _MultiProc_cfg.numProcsInCluster; i++) {
if ((_MultiProc_cfg.nameList[i] != NULL) &&
(strcmp(name, _MultiProc_cfg.nameList[i]) == 0)) {
- id = i;
+ id = _MultiProc_cfg.baseIdOfCluster + i;
}
}
return (id);
{
assert(id < _MultiProc_cfg.numProcessors);
- return (_MultiProc_cfg.nameList[id]);
+ return (_MultiProc_cfg.nameList[id - _MultiProc_cfg.baseIdOfCluster]);
}
/*
return (_MultiProc_cfg.numProcessors);
}
+/*
+ * ======== MultiProc_getNumProcsInCluster ========
+ */
+UInt16 MultiProc_getNumProcsInCluster()
+{
+ return (_MultiProc_cfg.numProcsInCluster);
+}
/*
* ======== MultiProc_self ========
index 78f741933a5f70c1be34af44220fad8a71ac8132..afd3a52d908bd06338de1792c42da25228bddc81 100644 (file)
/*
- * Copyright (c) 2008-2014, Texas Instruments Incorporated
+ * Copyright (c) 2008-2015 Texas Instruments Incorporated - http://www.ti.com
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
/*!< Linux "remoteproc index" for processors in the system */
UInt16 id;
/*!< Local Proc ID. This needs to be set before calling any other APIs */
+ UInt16 numProcsInCluster;
+ /*!< number of processors in the cluster */
+ UInt16 baseIdOfCluster;
+ /*!< processor ID of first entry in cluster */
} MultiProc_Config;
/* =============================================================================
diff --git a/linux/include/_lad.h b/linux/include/_lad.h
index a0a52925ee7410e1ea7d2916a8c7654effea7c42..69c8367bcc10d55bf8761aaa9733f3aedd3f5180 100644 (file)
--- a/linux/include/_lad.h
+++ b/linux/include/_lad.h
/*
- * Copyright (c) 2012-2014, Texas Instruments Incorporated
+ * Copyright (c) 2012-2015 Texas Instruments Incorporated - http://www.ti.com
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
fflush(logPtr); \
}
+#define LOG3(a, b, c, d) \
+ if (logFile == TRUE) { \
+ struct timeval tv; \
+ gettimeofday(&tv, NULL); \
+ fprintf(logPtr, "[%d.%06d] " a, \
+ (unsigned int)(tv.tv_sec - start_tv.tv_sec), \
+ (unsigned int)tv.tv_usec, b, c, d); \
+ fflush(logPtr); \
+ }
+
/* macros for generating verbose output: */
#define PRINTVERBOSE0(a) \
if (verbose == TRUE) { printf(a); }
diff --git a/linux/src/api/Ipc.c b/linux/src/api/Ipc.c
index a828e58dd785ad4fb981aa0e6669f2a8e6623248..f2c9457b03b4e90b4805e2ef596811126035a6f2 100644 (file)
--- a/linux/src/api/Ipc.c
+++ b/linux/src/api/Ipc.c
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-
/*!
* @file Ipc.c
*
Int attachStatus;
Int32 status;
LAD_Status ladStatus;
- UInt16 rprocId;
+ Int i;
+ UInt16 procId;
Int32 attachedAny;
+ UInt16 clusterSize;
+ UInt16 clusterBase;
/* function must be serialized */
pthread_mutex_lock(&Ipc_module.gate);
goto exit;
}
- /*
- * Get MultiProc configuration from LAD and initialize local MultiProc
- * config structure.
+ /* Get MultiProc configuration from LAD and initialize local
+ * MultiProc config structure.
*/
MultiProc_getConfig(&mpCfg);
_MultiProc_initCfg(&mpCfg);
status = NameServer_setup();
+
if (status >= 0) {
MessageQ_getConfig(&msgqCfg);
MessageQ_setup(&msgqCfg);
- /*
- * Attach to all remote processors. We need to attach to
- * at least one, so tolerate MessageQ_E_RESOURCE failures for
- * now.
+ /* Attach to all remote processors. For now, must attach to
+ * at least one to tolerate MessageQ_E_RESOURCE failures.
*/
status = Ipc_S_SUCCESS;
attachedAny = FALSE;
- for (rprocId = 0; rprocId < MultiProc_getNumProcessors(); rprocId++) {
- if (0 == rprocId) {
- /* Skip host, which should always be 0th entry. */
+ /* needed to enumerate processors in cluster */
+ clusterSize = MultiProc_getNumProcsInCluster();
+ clusterBase = MultiProc_getBaseIdOfCluster();
+
+ for (i = 0, procId = clusterBase; i < clusterSize; i++, procId++) {
+
+ if (MultiProc_self() == procId) {
continue;
}
- params.rprocId = rprocId;
+ params.rprocId = procId;
transport = TransportRpmsg_create(¶ms, &attachStatus);
if (transport) {
iMsgQTrans = TransportRpmsg_upCast(transport);
- MessageQ_registerTransport(iMsgQTrans, rprocId, 0);
-
+ MessageQ_registerTransport(iMsgQTrans, procId, 0);
attachedAny = TRUE;
}
else {
if (attachStatus == MessageQ_E_RESOURCE) {
continue;
}
-
- printf("Ipc_start: failed to attach to %d: %d\n",
- rprocId, attachStatus);
-
+ printf("Ipc_start: failed to attach to procId=%d status=%d\n",
+ procId, attachStatus);
status = Ipc_E_FAIL;
-
break;
}
}
GateHWSpinlock_stop();
gatehwspinlockstart_fail:
#if 0
- for (rprocId = rprocId - 1; (rprocId > 0) && (status >= 0); rprocId--) {
- MessageQ_detach(rprocId);
+ for (procId = procId - 1; (procId > 0) && (status >= 0); procId--) {
+ MessageQ_detach(procId);
}
#endif
#endif
*/
Int Ipc_stop(Void)
{
- Int32 status = Ipc_S_SUCCESS;
- LAD_Status ladStatus;
- UInt16 rprocId;
+ Int32 status = Ipc_S_SUCCESS;
+ LAD_Status ladStatus;
+ Int i;
+ UInt16 procId;
+ UInt16 clusterSize;
+ UInt16 clusterBase;
/* function must be serialized */
pthread_mutex_lock(&Ipc_module.gate);
goto exit;
}
- /* Now detach from all remote processors, assuming they are up. */
- for (rprocId = 0;
- (rprocId < MultiProc_getNumProcessors()) && (status >= 0);
- rprocId++) {
- if (0 == rprocId) {
- /* Skip host, which should always be 0th entry. */
- continue;
+ /* needed to enumerate processors in cluster */
+ clusterSize = MultiProc_getNumProcsInCluster();
+ clusterBase = MultiProc_getBaseIdOfCluster();
+
+ /* detach from all remote processors, assuming they are up */
+ for (i = 0, procId = clusterBase; i < clusterSize; i++, procId++) {
+
+ /* no need to detach from myself */
+ if (MultiProc_self() == procId) {
+ continue;
}
#if 0
- status = MessageQ_detach(rprocId);
+ status = MessageQ_detach(procId);
if (status < 0) {
printf("Ipc_stop: MessageQ_detach(%d) failed: %d\n",
- rprocId, status);
+ procId, status);
status = Ipc_E_FAIL;
goto exit;
}
index 3d7e8b2d7c498d92d5fbd9595a7a18e838da4da2..c55015c449c58940548e94e126f2cab0ce9ddff1 100644 (file)
--- a/linux/src/api/MessageQ.c
+++ b/linux/src/api/MessageQ.c
/*
- * Copyright (c) 2012-2014, Texas Instruments Incorporated
+ * Copyright (c) 2012-2015 Texas Instruments Incorporated - http://www.ti.com
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
UInt16 rprocId, UInt priority)
{
Int status = FALSE;
+ UInt16 clusterId;
if (handle == NULL) {
printf("MessageQ_registerTransport: invalid handle, must be non-NULL\n"
return status;
}
- if (rprocId >= MultiProc_MAXPROCESSORS) {
+ /* map procId to clusterId */
+ clusterId = rprocId - MultiProc_getBaseIdOfCluster();
+
+ if (clusterId >= MultiProc_MAXPROCESSORS) {
printf("MessageQ_registerTransport: invalid procId %d\n", rprocId);
return status;
}
- if (MessageQ_module->transports[rprocId][priority] == NULL) {
- MessageQ_module->transports[rprocId][priority] = handle;
+ if (MessageQ_module->transports[clusterId][priority] == NULL) {
+ MessageQ_module->transports[clusterId][priority] = handle;
status = TRUE;
}
}
if (tid >= MessageQ_MAXTRANSPORTS) {
- printf("MessageQ_unregisterNetTransport: invalid transport id %d, must be < %d\n", tid, MessageQ_MAXTRANSPORTS);
+ printf("MessageQ_unregisterNetTransport: invalid transport id %d,"
+ "must be < %d\n", tid, MessageQ_MAXTRANSPORTS);
return MessageQ_E_INVALIDARG;
}
if (MessageQ_module->transInst[tid] != NULL) {
- printf("MessageQ_registerTransportId: transport id %d already registered\n", tid);
+ printf("MessageQ_registerTransportId: transport id %d already "
+ "registered\n", tid);
return MessageQ_E_ALREADYEXISTS;
}
Void MessageQ_unregisterTransport(UInt16 rprocId, UInt priority)
{
- if (rprocId >= MultiProc_MAXPROCESSORS) {
- printf("MessageQ_registerTransport: invalid rprocId %d\n", rprocId);
+ UInt16 clusterId;
+
+ /* map procId to clusterId */
+ clusterId = rprocId - MultiProc_getBaseIdOfCluster();
+
+ if (clusterId >= MultiProc_MAXPROCESSORS) {
+ printf("MessageQ_unregisterTransport: invalid rprocId %d\n", rprocId);
return;
}
- MessageQ_module->transports[rprocId][priority] = NULL;
+ MessageQ_module->transports[clusterId][priority] = NULL;
}
Void MessageQ_unregisterTransportId(UInt tid)
{
if (tid >= MessageQ_MAXTRANSPORTS) {
- printf("MessageQ_unregisterTransportId: invalid transport id %d, must be < %d\n", tid, MessageQ_MAXTRANSPORTS);
+ printf("MessageQ_unregisterTransportId: invalid transport id %d, "
+ "must be < %d\n", tid, MessageQ_MAXTRANSPORTS);
return;
}
struct LAD_CommandObj cmd;
union LAD_ResponseObj rsp;
Int pri;
- Int rprocId;
+ Int i;
Int tid;
pthread_mutex_lock(&MessageQ_module->gate);
pthread_mutex_init(&MessageQ_module->gate, NULL);
- for (rprocId = 0; rprocId < MultiProc_MAXPROCESSORS; rprocId++) {
+ for (i = 0; i < MultiProc_MAXPROCESSORS; i++) {
for (pri = 0; pri < 2; pri++) {
- MessageQ_module->transports[rprocId][pri] = NULL;
+ MessageQ_module->transports[i][pri] = NULL;
}
}
+
for (tid = 0; tid < MessageQ_MAXTRANSPORTS; tid++) {
MessageQ_module->transInst[tid] = NULL;
}
IMessageQTransport_Handle transport;
INetworkTransport_Handle transInst;
UInt16 queueIndex;
- UInt16 rprocId;
+ UInt16 clusterId;
Int tid;
Int priority;
LAD_ClientHandle handle;
return NULL;
}
- PRINTVERBOSE2("MessageQ_create: creating endpoints for '%s' queueIndex %d\n", name, queueIndex)
+ PRINTVERBOSE2("MessageQ_create: creating endpoints for '%s' "
+ "queueIndex %d\n", name, queueIndex)
- for (rprocId = 0; rprocId < MultiProc_MAXPROCESSORS; rprocId++) {
+ for (clusterId = 0; clusterId < MultiProc_MAXPROCESSORS; clusterId++) {
for (priority = 0; priority < 2; priority++) {
- transport = MessageQ_module->transports[rprocId][priority];
+ transport = MessageQ_module->transports[clusterId][priority];
if (transport) {
/* need to check return and do something if error */
IMessageQTransport_bind((Void *)transport, obj->queue);
}
}
}
+
for (tid = 1; tid < MessageQ_MAXTRANSPORTS; tid++) {
transInst = MessageQ_module->transInst[tid];
if (transInst) {
INetworkTransport_Handle transInst;
Int status = MessageQ_S_SUCCESS;
UInt16 queueIndex;
- UInt16 rprocId;
+ UInt16 clusterId;
Int tid;
Int priority;
LAD_ClientHandle handle;
"MessageQ_delete: got LAD response for client %d, status=%d\n",
handle, status)
- for (rprocId = 0; rprocId < MultiProc_MAXPROCESSORS; rprocId++) {
+ for (clusterId = 0; clusterId < MultiProc_MAXPROCESSORS; clusterId++) {
for (priority = 0; priority < 2; priority++) {
- transport = MessageQ_module->transports[rprocId][priority];
+ transport = MessageQ_module->transports[clusterId][priority];
if (transport) {
IMessageQTransport_unbind((Void *)transport, obj->queue);
}
}
}
+
for (tid = 1; tid < MessageQ_MAXTRANSPORTS; tid++) {
transInst = MessageQ_module->transInst[tid];
if (transInst) {
INetworkTransport_Handle netTrans;
Int priority;
UInt tid;
+ UInt16 clusterId;
msg->dstId = queueIndex;
msg->dstProc = dstProcId;
tid = MessageQ_getTransportId(msg);
if (tid == 0) {
priority = MessageQ_getMsgPri(msg);
- msgTrans = MessageQ_module->transports[dstProcId][priority];
+ clusterId = dstProcId - MultiProc_getBaseIdOfCluster();
+
+ /* primary transport can only be used for intra-cluster delivery */
+ if (clusterId > MultiProc_getNumProcsInCluster()) {
+ printf("MessageQ_put: Error: destination procId=%d is not "
+ "in cluster. Must specify a transportId.\n", dstProcId);
+ return MessageQ_E_FAIL;
+ }
+
+ msgTrans = MessageQ_module->transports[clusterId][priority];
IMessageQTransport_put(msgTrans, (Ptr)msg);
}
if (tid >= MessageQ_MAXTRANSPORTS) {
printf("MessageQ_put: transport id %d too big, must be < %d\n",
tid, MessageQ_MAXTRANSPORTS);
-
return MessageQ_E_FAIL;
}
switch (ITransport_itype(transport)) {
case INetworkTransport_TypeId:
INetworkTransport_put(netTrans, (Ptr)msg);
-
break;
default:
/* error */
- printf("MessageQ_put: transport id %d is an unsupported transport type\n", tid);
-
+ printf("MessageQ_put: Error: transport id %d is an "
+ "unsupported transport type\n", tid);
status = MessageQ_E_FAIL;
-
break;
}
}
index 3b48b78daf3e247bc0b906a191fb5efc8a492077..d9d87687a8eb0a149e1e1fceeb47ef1ae46bf910 100644 (file)
/*
- * Copyright (c) 2014, Texas Instruments Incorporated
+ * Copyright (c) 2014-2015 Texas Instruments Incorporated - http://www.ti.com
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
.nameList[1] = "CORE0",
.rprocList[0] = -1,
.rprocList[1] = 0,
- .id = 0, /* The host is always zero */
+ .id = 0, /* host processor must be coherent with cluster */
+ .numProcsInCluster = 2,
+ .baseIdOfCluster = 0
};
index 4e98715521191d259e4033e614efd28380d15edf..5bd96d7bec8cf7a22b1b916e1de4ba07ebd3f0b7 100644 (file)
/*
- * Copyright (c) 2013, Texas Instruments Incorporated
+ * Copyright (c) 2013-2015 Texas Instruments Incorporated - http://www.ti.com
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
.rprocList[4] = 2,
#endif /* LINUX_VERSION_CODE */
.id = 0, /* The host is always zero */
+ .numProcsInCluster = 5,
+ .baseIdOfCluster = 0
};
diff --git a/linux/src/daemon/MultiProcCfg_omap54xx_smp.c b/linux/src/daemon/MultiProcCfg_omap54xx_smp.c
index 3cabbac980572a261d9fa9141e9594620e6ff28b..e6e0bffe60fec12654c38763377143f96f9f2a22 100644 (file)
/*
- * Copyright (c) 2013, Texas Instruments Incorporated
+ * Copyright (c) 2013-2015 Texas Instruments Incorporated - http://www.ti.com
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
.rprocList[1] = 1,
.rprocList[2] = 0,
.id = 0, /* The host is always zero */
+ .numProcsInCluster = 3,
+ .baseIdOfCluster = 0
};
index d7508e8eedefe7554f9f8c35d96b231fea4428eb..6fd5fd3a89253cec4c237d10fd5c15bdf29a68c5 100644 (file)
/*
- * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * Copyright (c) 2012-2015 Texas Instruments Incorporated - http://www.ti.com
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
.rprocList[0] = -1,
.rprocList[1] = 0,
.id = 0, /* The host is always zero */
+ .numProcsInCluster = 2,
+ .baseIdOfCluster = 0
};
index 1528b25099ba8b994ad46e384738ace9ae44bc5d..af50bf51ff0939d571e794c13e4ef2ef6adf2035 100644 (file)
/*
- * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * Copyright (c) 2012-2015 Texas Instruments Incorporated - http://www.ti.com
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
.rprocList[2] = 1,
.rprocList[3] = 2,
.rprocList[4] = 3,
- .id = 0, /* The host is always zero */
+ .id = 0, /* host processor must be coherent with cluster */
+ .numProcsInCluster = 5,
+ .baseIdOfCluster = 0
};
index 0c48322be99dd23e8d65a7e174b968402720b168..af50bf51ff0939d571e794c13e4ef2ef6adf2035 100644 (file)
/*
- * Copyright (c) 2012-2014, Texas Instruments Incorporated
+ * Copyright (c) 2012-2015 Texas Instruments Incorporated - http://www.ti.com
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
.rprocList[2] = 1,
.rprocList[3] = 2,
.rprocList[4] = 3,
- .id = 0, /* The host is always zero */
+ .id = 0, /* host processor must be coherent with cluster */
+ .numProcsInCluster = 5,
+ .baseIdOfCluster = 0
};
index 18b338a8d5fa3730e7b161d68f1c90dec87eb215..7668aa60f801cef4e0cf31dcc6fb3a7367cf4dbe 100644 (file)
/*
- * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * Copyright (c) 2012-2015 Texas Instruments Incorporated - http://www.ti.com
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
.rprocList[6] = 5,
.rprocList[7] = 6,
.rprocList[8] = 7,
- .id = 0, /* The host is always zero */
+ .id = 0, /* host processor must be coherent with cluster */
+ .numProcsInCluster = 9,
+ .baseIdOfCluster = 0
};
index c004aad23581c0ac680232ded82c52d068392170..9c1becbda1e398696c550b814bb7de84aaac3c76 100644 (file)
/*
- * Copyright (c) 2013, Texas Instruments Incorporated
+ * Copyright (c) 2013-2015 Texas Instruments Incorporated - http://www.ti.com
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
memcpy (cfg, &_MultiProc_cfg, sizeof(MultiProc_Config));
LOG1("MultiProc_getConfig() - %d procs\n", _MultiProc_cfg.numProcessors);
+ LOG1("# processors in cluster - %d\n", _MultiProc_cfg.numProcsInCluster);
+ LOG1("base procId of cluster - %d\n", _MultiProc_cfg.baseIdOfCluster);
- for (i = 0; i < _MultiProc_cfg.numProcessors; i++) {
+ for (i = 0; i < _MultiProc_cfg.numProcsInCluster; i++) {
LOG2("\tProc %d - \"%s\"\n", i, _MultiProc_cfg.nameList[i]);
}
}
index 31d448d38112f9b6b036ac9c484558b4d4118a5d..9d8b0005dc5a9a38ccd45eefbab8323747fac0c2 100644 (file)
Int status = NameServer_E_FAIL;
int err;
uint64_t buf = 1;
- int numBytes;
int waitFd = NameServer_module->waitFd;
+ UInt16 clusterId;
if (msg->request == NAMESERVER_REQUEST) {
LOG2("NameServer Request: instanceName: %s, name: %s\n",
msg->reserved = NAMESERVER_MSG_TOKEN;
/* send response message to remote processor */
- err = send(NameServer_module->sendSock[procId], msg,
+ clusterId = procId - MultiProc_getBaseIdOfCluster();
+ err = send(NameServer_module->sendSock[clusterId], msg,
sizeof(NameServerMsg), 0);
if (err < 0) {
LOG2("NameServer: send failed: %d, %s\n", errno, strerror(errno))
memcpy(&NameServer_module->nsMsg, msg, sizeof(NameServerMsg));
/* Post the eventfd upon which NameServer_get() is waiting */
- numBytes = write(waitFd, &buf, sizeof(uint64_t));
+ write(waitFd, &buf, sizeof(uint64_t));
}
}
{
fd_set rfds;
int ret = 0, maxfd;
+ int i;
UInt16 procId;
struct sockaddr_rpmsg fromAddr;
unsigned int len;
NameServerMsg msg;
int byteCount;
- UInt16 numProcs = MultiProc_getNumProcessors();
+ UInt16 numProcs = MultiProc_getNumProcsInCluster();
+ UInt16 baseId = MultiProc_getBaseIdOfCluster();
int sock;
LOG0("listener_cb: Entered Listener thread.\n")
FD_ZERO(&rfds);
FD_SET(NameServer_module->unblockFd, &rfds);
maxfd = NameServer_module->unblockFd;
- for (procId = 0; procId < numProcs; procId++) {
- if (procId == MultiProc_self() ||
- NameServer_module->recvSock[procId] == INVALIDSOCKET) {
+
+ for (i = 0, procId = baseId; i < numProcs; i++, procId++) {
+ if ((MultiProc_self() == procId)
+ || (NameServer_module->recvSock[i] == INVALIDSOCKET)) {
continue;
}
- sock = NameServer_module->recvSock[procId];
+ sock = NameServer_module->recvSock[i];
FD_SET(sock, &rfds);
maxfd = MAX(sock, maxfd);
}
}
LOG0("NameServer: back from select()\n")
- for (procId = 0; procId < numProcs; procId++) {
- if (procId == MultiProc_self() ||
- NameServer_module->recvSock[procId] == INVALIDSOCKET) {
+ for (i = 0, procId = baseId; i < numProcs; i++, procId++) {
+ if ((MultiProc_self() == procId)
+ || (NameServer_module->recvSock[i] == INVALIDSOCKET)) {
continue;
}
- sock = NameServer_module->recvSock[procId];
+ sock = NameServer_module->recvSock[i];
if (FD_ISSET(sock, &rfds)) {
LOG1("NameServer: Listener got NameServer message "
"from sock: %d!\n", sock);
int err;
int sock;
int ret;
+ int clId;
UInt16 procId;
UInt16 numProcs;
+ UInt16 baseId;
pthread_mutex_lock(&NameServer_module->modGate);
- LOG1("NameServer_setup: entered, refCount=%d\n", NameServer_module->refCount)
+ LOG1("NameServer_setup: entered, refCount=%d\n",
+ NameServer_module->refCount)
NameServer_module->refCount++;
goto exit;
}
- numProcs = MultiProc_getNumProcessors();
-
NameServer_module->unblockFd = eventfd(0, 0);
if (NameServer_module->unblockFd < 0) {
status = NameServer_E_FAIL;
goto exit;
}
- for (procId = 0; procId < numProcs; procId++) {
- NameServer_module->sendSock[procId] = INVALIDSOCKET;
- NameServer_module->recvSock[procId] = INVALIDSOCKET;
+ numProcs = MultiProc_getNumProcsInCluster();
+ baseId = MultiProc_getBaseIdOfCluster();
+
+ for (clId = 0, procId = baseId; clId < numProcs; clId++, procId++) {
+ NameServer_module->sendSock[clId] = INVALIDSOCKET;
+ NameServer_module->recvSock[clId] = INVALIDSOCKET;
/* Only support NameServer to remote procs: */
- if (procId == MultiProc_self()) {
+ if (MultiProc_self() == procId) {
continue;
}
err = ConnectSocket(sock, procId, MESSAGEQ_RPMSG_PORT);
if (err < 0) {
status = NameServer_E_FAIL;
- LOG2("NameServer_setup: connect failed: %d, %s\n",
- errno, strerror(errno))
+ LOG3("NameServer_setup: connect failed: procId=%d, "
+ "errno=%d (%s)\n", procId, errno, strerror(errno))
LOG1(" closing send socket: %d\n", sock)
close(sock);
}
else {
- NameServer_module->sendSock[procId] = sock;
+ NameServer_module->sendSock[clId] = sock;
}
}
close(sock);
}
else {
- NameServer_module->recvSock[procId] = sock;
+ NameServer_module->recvSock[clId] = sock;
}
}
}
}
else {
/* look for at least one good send/recv pair to indicate success */
- for (procId = 0; procId < numProcs; procId++) {
- if (NameServer_module->sendSock[procId] != INVALIDSOCKET &&
- NameServer_module->recvSock[procId] != INVALIDSOCKET) {
+ for (clId = 0; clId < numProcs; clId++) {
+ if (NameServer_module->sendSock[clId] != INVALIDSOCKET &&
+ NameServer_module->recvSock[clId] != INVALIDSOCKET) {
status = NameServer_S_SUCCESS;
-
break;
}
}
}
exit:
- LOG1("NameServer_setup: exiting, refCount=%d\n", NameServer_module->refCount)
+ LOG1("NameServer_setup: exiting, refCount=%d\n",
+ NameServer_module->refCount)
pthread_mutex_unlock(&NameServer_module->modGate);
/*! Function to destroy the nameserver module. */
Int NameServer_destroy(void)
{
- Int status = NameServer_S_SUCCESS;
- UInt16 numProcs = MultiProc_getNumProcessors();
+ Int status = NameServer_S_SUCCESS;
+ UInt16 numProcs;
+ UInt16 baseId;
UInt16 procId;
+ int clId;
int sock;
uint64_t buf = 1;
- int numBytes;
pthread_mutex_lock(&NameServer_module->modGate);
- LOG1("NameServer_destroy: entered, refCount=%d\n", NameServer_module->refCount)
+ LOG1("NameServer_destroy: entered, refCount=%d\n",
+ NameServer_module->refCount)
NameServer_module->refCount--;
if (NameServer_module->refCount > 0) {
- LOG1("NameServer_destroy(): refCount(%d) > 0, exiting\n", NameServer_module->refCount)
+ LOG1("NameServer_destroy(): refCount(%d) > 0, exiting\n",
+ NameServer_module->refCount)
status = NameServer_S_SUCCESS;
-
goto exit;
}
- for (procId = 0; procId < numProcs; procId++) {
+ numProcs = MultiProc_getNumProcsInCluster();
+ baseId = MultiProc_getBaseIdOfCluster();
+
+ LOG2("NameServer_destroy: numProcs=%d, baseId=%d\n", numProcs, baseId);
+
+ for (clId = 0, procId = baseId; clId < numProcs; clId++, procId++) {
+
/* Only support NameServer to remote procs: */
- if (procId == MultiProc_self()) {
+ if (MultiProc_self() == procId) {
continue;
}
/* Close the socket: */
- sock = NameServer_module->sendSock[procId];
+ sock = NameServer_module->sendSock[clId];
if (sock != INVALIDSOCKET) {
LOG1("NameServer_destroy: closing socket: %d\n", sock)
close(sock);
- NameServer_module->sendSock[procId] = INVALIDSOCKET;
+ NameServer_module->sendSock[clId] = INVALIDSOCKET;
}
/* Close the socket: */
- sock = NameServer_module->recvSock[procId];
+ sock = NameServer_module->recvSock[clId];
if (sock != INVALIDSOCKET) {
LOG1("NameServer_destroy: closing socket: %d\n", sock)
close(sock);
- NameServer_module->recvSock[procId] = INVALIDSOCKET;
+ NameServer_module->recvSock[clId] = INVALIDSOCKET;
}
}
/* Unblock the NameServer listener thread: */
LOG0("NameServer_destroy: unblocking listener...\n")
- numBytes = write(NameServer_module->unblockFd, &buf, sizeof(uint64_t));
+ write(NameServer_module->unblockFd, &buf, sizeof(uint64_t));
/* Join: */
LOG0("NameServer_destroy: joining listener thread...\n")
close(NameServer_module->waitFd);
exit:
- LOG1("NameServer_destroy: exiting, refCount=%d\n", NameServer_module->refCount)
+ LOG1("NameServer_destroy: exiting, refCount=%d\n",
+ NameServer_module->refCount)
pthread_mutex_unlock(&NameServer_module->modGate);
int ret = 0, sock, maxfd, waitFd;
struct timeval tv;
uint64_t buf = 1;
- int numBytes;
int err;
int i;
static int seqNum = 0;
Bool done = FALSE;
+ UInt16 clusterId;
/* Set Timeout to wait: */
tv.tv_sec = 0;
tv.tv_usec = NAMESERVER_GET_TIMEOUT;
/* Create request message and send to remote: */
- sock = NameServer_module->sendSock[procId];
+ clusterId = procId - MultiProc_getBaseIdOfCluster();
+ sock = NameServer_module->sendSock[clusterId];
if (sock == INVALIDSOCKET) {
LOG1("NameServer_getRemote: no socket connection to processor %d\n",
procId);
if (FD_ISSET(waitFd, &rfds)) {
/* Read, just to balance the write: */
- numBytes = read(waitFd, &buf, sizeof(uint64_t));
+ read(waitFd, &buf, sizeof(uint64_t));
/* Process response: */
replyMsg = &NameServer_module->nsMsg;
UInt16 procId[])
{
Int status = NameServer_S_SUCCESS;
- UInt16 numProcs = MultiProc_getNumProcessors();
+ UInt16 numProcs;
UInt32 i;
+ UInt16 clusterId;
+ UInt16 baseId;
+
+ numProcs = MultiProc_getNumProcsInCluster();
+ baseId = MultiProc_getBaseIdOfCluster();
/*
* BIOS side uses a gate (mutex) to protect NameServer_module->nsMsg, but
if (procId == NULL) {
status = NameServer_getLocal(handle, name, value, len);
if (status == NameServer_E_NOTFOUND) {
- for (i = 0; i < numProcs; i++) {
+ for (clusterId = 0; clusterId < numProcs; clusterId++) {
+
/* getLocal call already covers "self", keep going */
- if (i == MultiProc_self()) {
+ if ((baseId + clusterId) == MultiProc_self()) {
continue;
}
- status = NameServer_getRemote(handle, name, value, len, i);
+ status = NameServer_getRemote(handle, name, value, len,
+ baseId + clusterId);
if ((status >= 0) ||
((status < 0) && (status != NameServer_E_NOTFOUND) &&
index c07dc90614e7133841ba8b8c15954276c06facae..52c275e8379c90014686af17e63d107162650b3b 100644 (file)
/*
- * Copyright (c) 2014, Texas Instruments Incorporated
+ * Copyright (c) 2014-2015 Texas Instruments Incorporated - http://www.ti.com
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
Int *attachStatus)
{
TransportRpmsg_Object *obj;
- Int *queues;
Int rv;
rv = attach(params->rprocId);
static Int attach(UInt16 rprocId)
{
- Int status = MessageQ_S_SUCCESS;
- int sock;
+ Int status = MessageQ_S_SUCCESS;
+ int sock;
+ UInt16 clusterId;
+
+
+ clusterId = rprocId - MultiProc_getBaseIdOfCluster();
/* Create the socket for sending messages to the remote proc: */
sock = socket(AF_RPMSG, SOCK_SEQPACKET, 0);
goto exitSock;
}
- TransportRpmsg_module->sock[rprocId] = sock;
+ TransportRpmsg_module->sock[clusterId] = sock;
if (TransportRpmsg_module->threadStarted == FALSE) {
/* create a module wide event to unblock the socket select thread */
exitSock:
close(sock);
- TransportRpmsg_module->sock[rprocId] = 0;
+ TransportRpmsg_module->sock[clusterId] = 0;
exit:
return status;
static Int detach(UInt16 rprocId)
{
- Int status = -1;
- int sock;
+ Int status = -1;
+ int sock;
+ UInt16 clusterId;
- sock = TransportRpmsg_module->sock[rprocId];
+ clusterId = rprocId - MultiProc_getBaseIdOfCluster();
+ sock = TransportRpmsg_module->sock[clusterId];
if (sock) {
PRINTVERBOSE1("detach: closing socket: %d\n", sock)
rprocId = obj->rprocId;
- PRINTVERBOSE2("TransportRpmsg_bind: creating endpoint for rprocId %d queueIndex %d\n", rprocId, queueIndex)
+ PRINTVERBOSE2("TransportRpmsg_bind: creating endpoint for rprocId %d "
+ "queueIndex %d\n", rprocId, queueIndex)
/* Create the socket to receive messages for this messageQ. */
fd = socket(AF_RPMSG, SOCK_SEQPACKET, 0);
Int status = TRUE;
int sock;
int err;
- UInt16 dstProcId = msg->dstProc;
+ UInt16 clusterId;
/*
* Retrieve the socket for the AF_SYSLINK protocol associated with this
* transport.
*/
- sock = TransportRpmsg_module->sock[dstProcId];
+ clusterId = msg->dstProc - MultiProc_getBaseIdOfCluster();
+ sock = TransportRpmsg_module->sock[clusterId];
if (!sock) {
return FALSE;
}
else {
queueId = MessageQ_getDstQueue(retMsg);
- PRINTVERBOSE1("rpmsgThreadFxn: got message, delivering to queueId 0x%x\n", queueId)
+ PRINTVERBOSE1("rpmsgThreadFxn: got message, "
+ "delivering to queueId 0x%x\n", queueId)
MessageQ_put(queueId, retMsg);
}
}
PRINTVERBOSE1("transportGet: recvfrom socket: fd: %d\n", sock)
- PRINTVERBOSE3("\tReceived a msg: byteCount: %d, rpmsg addr: %d, rpmsg proc: %d\n", byteCount, fromAddr.addr, fromAddr.vproc_id)
- PRINTVERBOSE2("\tMessage Id: %d, Message size: %d\n", msg->msgId, msg->msgSize)
+ PRINTVERBOSE3("\tReceived a msg: byteCount: %d, rpmsg addr: %d, rpmsg "
+ "proc: %d\n", byteCount, fromAddr.addr, fromAddr.vproc_id)
+ PRINTVERBOSE2("\tMessage Id: %d, Message size: %d\n", msg->msgId,
+ msg->msgSize)
*retMsg = msg;
diff --git a/qnx/src/ipc3x_dev/ti/syslink/family/omap5430/SystemCfg_omap5432.c b/qnx/src/ipc3x_dev/ti/syslink/family/omap5430/SystemCfg_omap5432.c
index 4645e2323ee524bedd4903cf6268e1395687f418..5e64f697c668a4cfcba981e3fa5524b5a69d487d 100644 (file)
/*
- * Copyright (c) 2013, Texas Instruments Incorporated
+ * Copyright (c) 2013-2015 Texas Instruments Incorporated - http://www.ti.com
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
.nameList[1] = "IPU",
.nameList[2] = "DSP",
.id = 0, /* The host is always zero */
+ .numProcsInCluster = 3,
+ .baseIdOfCluster = 0
};
diff --git a/qnx/src/ipc3x_dev/ti/syslink/family/vayu/SystemCfg_vayu.c b/qnx/src/ipc3x_dev/ti/syslink/family/vayu/SystemCfg_vayu.c
index b0c7212fcdbef9603abd98149fa55b6a11969ff7..01cbcc7845793dff849f9465d27cbb765dccf4c2 100644 (file)
/*
- * Copyright (c) 2013, Texas Instruments Incorporated
+ * Copyright (c) 2013-2015 Texas Instruments Incorporated - http://www.ti.com
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
.nameList[3] = "DSP2",
.nameList[4] = "DSP1",
.id = 0, /* The host is always zero */
+ .numProcsInCluster = 5,
+ .baseIdOfCluster = 0
};
diff --git a/qnx/src/ipc3x_dev/ti/syslink/inc/_MultiProc.h b/qnx/src/ipc3x_dev/ti/syslink/inc/_MultiProc.h
index 79890ee77cbb1454e43111135a3983fbcaf07332..5cb5279fea7077575c0356bbadce5e4f233fd034 100644 (file)
/*
- * Copyright (c) 2008-2013, Texas Instruments Incorporated
+ * Copyright (c) 2008-2015 Texas Instruments Incorporated - http://www.ti.com
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
/*!< Name List for processors in the system */
UInt16 id;
/*!< Local Proc ID. This needs to be set before calling any other APIs */
+ UInt16 numProcsInCluster;
+ /*!< number of processors in the cluster */
+ UInt16 baseIdOfCluster;
+ /*!< processor ID of first entry in cluster */
} MultiProc_Config;