summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam Nelson <sam.nelson@ti.com>2016-02-11 14:19:58 -0500
committerAngela Stegmaier <angelabaker@ti.com>2016-02-12 13:11:14 -0600
commit852ee1f3048ac49d9f1b2c9de1fdc6bfdb8cd5c0 (patch)
tree3483c49b27e42bde49089255dfacfa1a8eb1a18f
parent2b47e35ed72170e4e56906fb9ab93dd9ef385a38 (diff)
downloadipc-852ee1f3048ac49d9f1b2c9de1fdc6bfdb8cd5c0.tar.gz
GateMP: Add check for zero resources case
When reserving SR0 regions for GateMp instances, in some cases, (for example the NULL gate) has zero resources. This was not handled properly and resulted in failure. Fix is to avoid doing unnecessary operations in case of zero resources. Signed-off-by: Sam Nelson <sam.nelson@ti.com>
-rw-r--r--packages/ti/sdo/ipc/GateMP.c90
1 files changed, 46 insertions, 44 deletions
diff --git a/packages/ti/sdo/ipc/GateMP.c b/packages/ti/sdo/ipc/GateMP.c
index 98ec273..79b3efe 100644
--- a/packages/ti/sdo/ipc/GateMP.c
+++ b/packages/ti/sdo/ipc/GateMP.c
@@ -653,23 +653,25 @@ Void ti_sdo_ipc_GateMP_setRegion0Reserved(Ptr sharedAddr)
GateMP_module->remoteSystemInUse =
(Ptr)((UInt32)sharedAddr + offset);
- memset(GateMP_module->remoteSystemInUse, 0,
- GateMP_module->numRemoteSystem * sizeof(UInt8));
- delegateReservedMask =
- ti_sdo_ipc_GateMP_RemoteSystemProxy_getReservedMask();
- if (delegateReservedMask != NULL) {
- for (i = 0; i < GateMP_module->numRemoteSystem; i++) {
- if (delegateReservedMask[i >> 5] & (1 << (i % 32))) {
- GateMP_module->remoteSystemInUse[i] = RESERVED;
+ if (GateMP_module->numRemoteSystem != 0) {
+ memset(GateMP_module->remoteSystemInUse, 0,
+ GateMP_module->numRemoteSystem * sizeof(UInt8));
+ delegateReservedMask =
+ ti_sdo_ipc_GateMP_RemoteSystemProxy_getReservedMask();
+ if (delegateReservedMask != NULL) {
+ for (i = 0; i < GateMP_module->numRemoteSystem; i++) {
+ if (delegateReservedMask[i >> 5] & (1 << (i % 32))) {
+ GateMP_module->remoteSystemInUse[i] = RESERVED;
+ }
}
}
- }
- if (SharedRegion_isCacheEnabled(0)) {
- Cache_wbInv(GateMP_module->remoteSystemInUse,
- GateMP_module->numRemoteSystem * sizeof(UInt8),
- Cache_Type_ALL,
- TRUE);
+ if (SharedRegion_isCacheEnabled(0)) {
+ Cache_wbInv(GateMP_module->remoteSystemInUse,
+ GateMP_module->numRemoteSystem * sizeof(UInt8),
+ Cache_Type_ALL,
+ TRUE);
+ }
}
/*
@@ -682,24 +684,24 @@ Void ti_sdo_ipc_GateMP_setRegion0Reserved(Ptr sharedAddr)
if (GateMP_module->numRemoteCustom1 != 0) {
GateMP_module->remoteCustom1InUse =
GateMP_module->remoteSystemInUse + offset;
- }
- memset(GateMP_module->remoteCustom1InUse, 0,
- GateMP_module->numRemoteCustom1 * sizeof(UInt8));
- delegateReservedMask =
- ti_sdo_ipc_GateMP_RemoteCustom1Proxy_getReservedMask();
- if (delegateReservedMask != NULL) {
- for (i = 0; i < GateMP_module->numRemoteCustom1; i++) {
- if (delegateReservedMask[i >> 5] & (1 << (i % 32))) {
- GateMP_module->remoteCustom1InUse[i] = RESERVED;
+ memset(GateMP_module->remoteCustom1InUse, 0,
+ GateMP_module->numRemoteCustom1 * sizeof(UInt8));
+ delegateReservedMask =
+ ti_sdo_ipc_GateMP_RemoteCustom1Proxy_getReservedMask();
+ if (delegateReservedMask != NULL) {
+ for (i = 0; i < GateMP_module->numRemoteCustom1; i++) {
+ if (delegateReservedMask[i >> 5] & (1 << (i % 32))) {
+ GateMP_module->remoteCustom1InUse[i] = RESERVED;
+ }
}
}
- }
- if (SharedRegion_isCacheEnabled(0)) {
- Cache_wbInv(GateMP_module->remoteCustom1InUse,
- GateMP_module->numRemoteCustom1 * sizeof(UInt8),
- Cache_Type_ALL,
- TRUE);
+ if (SharedRegion_isCacheEnabled(0)) {
+ Cache_wbInv(GateMP_module->remoteCustom1InUse,
+ GateMP_module->numRemoteCustom1 * sizeof(UInt8),
+ Cache_Type_ALL,
+ TRUE);
+ }
}
}
else {
@@ -717,25 +719,25 @@ Void ti_sdo_ipc_GateMP_setRegion0Reserved(Ptr sharedAddr)
if (GateMP_module->numRemoteCustom2 != 0) {
GateMP_module->remoteCustom2InUse =
GateMP_module->remoteCustom1InUse + offset;
- }
- memset(GateMP_module->remoteCustom2InUse, 0,
- GateMP_module->numRemoteCustom2 * sizeof(UInt8));
- delegateReservedMask =
- ti_sdo_ipc_GateMP_RemoteCustom2Proxy_getReservedMask();
- if (delegateReservedMask != NULL) {
- for (i = 0; i < GateMP_module->numRemoteCustom2; i++) {
- if (delegateReservedMask[i >> 5] & (1 << (i % 32))) {
- GateMP_module->remoteCustom2InUse[i] = RESERVED;
+ memset(GateMP_module->remoteCustom2InUse, 0,
+ GateMP_module->numRemoteCustom2 * sizeof(UInt8));
+ delegateReservedMask =
+ ti_sdo_ipc_GateMP_RemoteCustom2Proxy_getReservedMask();
+ if (delegateReservedMask != NULL) {
+ for (i = 0; i < GateMP_module->numRemoteCustom2; i++) {
+ if (delegateReservedMask[i >> 5] & (1 << (i % 32))) {
+ GateMP_module->remoteCustom2InUse[i] = RESERVED;
+ }
}
}
- }
- if (SharedRegion_isCacheEnabled(0)) {
- Cache_wbInv(GateMP_module->remoteCustom2InUse,
- GateMP_module->numRemoteCustom2 * sizeof(UInt8),
- Cache_Type_ALL,
- TRUE);
+ if (SharedRegion_isCacheEnabled(0)) {
+ Cache_wbInv(GateMP_module->remoteCustom2InUse,
+ GateMP_module->numRemoteCustom2 * sizeof(UInt8),
+ Cache_Type_ALL,
+ TRUE);
+ }
}
}
else if (GateMP_module->proxyMap[ti_sdo_ipc_GateMP_ProxyOrder_CUSTOM2] ==