index a3d90b3176280a0b38aaffe48d89e38f6183c0a0..5e2bc0b62d7ce2a379ec93138ca3c3d6c8c29d6f 100644 (file)
/*
- * Copyright (c) 2012-2015 Texas Instruments Incorporated - http://www.ti.com
+ * Copyright (c) 2012-2018 Texas Instruments Incorporated - http://www.ti.com
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
/* Opening a remote GateMP. Need to do SharedRegion Ptr conversion. */
sharedShmBase = (SharedRegion_SRPtr)nsValue[0];
sharedAddr = SharedRegion_getPtr(sharedShmBase);
+ if ( sharedAddr == NULL ) {
+ *handlePtr = NULL;
+ return (GateMP_E_FAIL);
+ }
status = GateMP_openByAddr(sharedAddr, handlePtr);
}
else {
*/
offset = _Ipc_roundup(sizeof(ti_sdo_ipc_GateMP_Reserved), minAlign);
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;
+ (Ptr)((uintptr_t)sharedAddr + offset);
+
+ 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);
+ }
}
/*
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 {
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] ==
if (GateMP_module->hostSupport == TRUE) {
/* Add special entry to store inuse arrays' location and size */
ret = _GateMP_virtToPhys(
- (UInt32)GateMP_module->remoteSystemInUse, &nsValue[0]);
- Assert_isTrue(ret == GateMP_S_SUCCESS, (Assert_Id)NULL);
- ret = _GateMP_virtToPhys(
- (UInt32)GateMP_module->remoteCustom1InUse, &nsValue[1]);
- Assert_isTrue(ret == GateMP_S_SUCCESS, (Assert_Id)NULL);
- ret = _GateMP_virtToPhys(
- (UInt32)GateMP_module->remoteCustom2InUse, &nsValue[2]);
- Assert_isTrue(ret == GateMP_S_SUCCESS, (Assert_Id)NULL);
+ (uintptr_t)GateMP_module->remoteSystemInUse, &nsValue[0]);
+ Assert_isTrue(ret == GateMP_S_SUCCESS, (Assert_Id)0);
+ (void)ret; /* silence unused var warning when asserts disabled */
+ if (GateMP_module->numRemoteCustom1 != 0) {
+ ret = _GateMP_virtToPhys(
+ (uintptr_t)GateMP_module->remoteCustom1InUse, &nsValue[1]);
+ Assert_isTrue(ret == GateMP_S_SUCCESS, (Assert_Id)0);
+ }
+ else {
+ nsValue[1] = 0;
+ }
+ if (GateMP_module->numRemoteCustom2 != 0) {
+ ret = _GateMP_virtToPhys(
+ (uintptr_t)GateMP_module->remoteCustom2InUse, &nsValue[2]);
+ Assert_isTrue(ret == GateMP_S_SUCCESS, (Assert_Id)0);
+ }
+ else {
+ nsValue[2] = 0;
+ }
nsValue[3] = GateMP_module->numRemoteSystem;
nsValue[4] = GateMP_module->numRemoteCustom1;
nsValue[5] = GateMP_module->numRemoteCustom2;
offset = _Ipc_roundup(sizeof(ti_sdo_ipc_GateMP_Reserved), minAlign);
GateMP_module->remoteSystemInUse =
- (Ptr)((UInt32)sharedAddr + offset);
+ (Ptr)((uintptr_t)sharedAddr + offset);
/*
* initialize the in-use array in shared memory for the custom1 gates.
/* get region 0 information */
SharedRegion_getEntry(0, &entry);
- gateMPsharedAddr = (Ptr)((UInt32)sharedAddr +
+ gateMPsharedAddr = (Ptr)((uintptr_t)sharedAddr +
ti_sdo_ipc_GateMP_getRegion0ReservedSize());
if ((entry.ownerProcId != MultiProc_self()) &&
(entry.ownerProcId != MultiProc_INVALIDID)) {
+
+ /* Make sure to invalidate cache before using shared memory content */
+ if (entry.cacheEnable) {
+ Cache_inv(sharedAddr, ti_sdo_ipc_GateMP_getRegion0ReservedSize(),
+ Cache_Type_ALL, TRUE);
+ }
+
/* if not the owner of the SharedRegion */
ti_sdo_ipc_GateMP_openRegion0Reserved(sharedAddr);
/* create default GateMP */
ti_sdo_ipc_GateMP_Params_init(&gateMPParams);
- gateMPParams.sharedAddr = (Ptr)((UInt32)sharedAddr +
+ gateMPParams.sharedAddr = (Ptr)((uintptr_t)sharedAddr +
ti_sdo_ipc_GateMP_getRegion0ReservedSize());
gateMPParams.localProtect = ti_sdo_ipc_GateMP_LocalProtect_TASKLET;
gateMPParams.name = "_GateMP_TI_dGate";
/* TODO: host side created gates cannot have proxy memory */
if (obj->attrs != NULL) {
- obj->proxyAttrs = (Ptr)((UInt32)obj->attrs + offset);
+ obj->proxyAttrs = (Ptr)((uintptr_t)obj->attrs + offset);
}
else {
obj->proxyAttrs = NULL;
}
if (params->name) {
- nsValue[0] = (UInt32)obj->attrs;
+ nsValue[0] = (uintptr_t)obj->attrs;
/*
* Top 16 bits = procId of creator
* Bottom 16 bits = '0' if local, '1' otherwise
*/
- nsValue[1] = ((UInt32)MultiProc_self()) << 16;
+ nsValue[1] = ((uintptr_t)MultiProc_self()) << 16;
if (GateMP_module->hostSupport == TRUE) {
nsValue[2] = obj->attrs->arg;
offset = _Ipc_roundup(sizeof(ti_sdo_ipc_GateMP_Attrs), minAlign);
- obj->proxyAttrs = (Ptr)((UInt32)obj->attrs + offset);
+ obj->proxyAttrs = (Ptr)((uintptr_t)obj->attrs + offset);
}
else {
/* creating using sharedAddr */
/* Assert that sharedAddr has correct alignment */
Assert_isTrue(minAlign == 0 ||
- ((UInt32)params->sharedAddr % minAlign) == 0,
+ ((uintptr_t)params->sharedAddr % minAlign) == 0,
ti_sdo_ipc_Ipc_A_addrNotCacheAligned);
offset = _Ipc_roundup(sizeof(ti_sdo_ipc_GateMP_Attrs), minAlign);
- obj->proxyAttrs = (Ptr)((UInt32)obj->attrs + offset);
+ obj->proxyAttrs = (Ptr)((uintptr_t)obj->attrs + offset);
}
}
ti_sdo_ipc_GateMP_Handle *remoteHandles;
UInt8 *inUseArray;
- UInt numResources;
+ UInt size;
/* Cannot call when numOpen is non-zero. */
Assert_isTrue(obj->numOpens == 0, ti_sdo_ipc_GateMP_A_invalidDelete);
inUseArray = GateMP_module->remoteSystemInUse;
remoteHandles = GateMP_module->remoteSystemGates;
- numResources = GateMP_module->numRemoteSystem;
+ size = GateMP_module->numRemoteSystem * sizeof(UInt8);
break;
case GateMP_RemoteProtect_CUSTOM1:
inUseArray = GateMP_module->remoteCustom1InUse;
remoteHandles = GateMP_module->remoteCustom1Gates;
- numResources = GateMP_module->numRemoteCustom1;
+ size = GateMP_module->numRemoteCustom1 * sizeof(UInt8);
break;
case GateMP_RemoteProtect_CUSTOM2:
inUseArray = GateMP_module->remoteCustom2InUse;
remoteHandles = GateMP_module->remoteCustom2Gates;
- numResources = GateMP_module->numRemoteCustom2;
+ size = GateMP_module->numRemoteCustom2 * sizeof(UInt8);
break;
case GateMP_RemoteProtect_NONE:
/*
systemKey = Hwi_disable();
}
+#ifdef xdc_target__isaCompatible_v7A
+ /* ARM speculative execution might have pulled array into cache */
+ if (obj->cacheEnabled) {
+ Cache_inv(inUseArray, size, Cache_Type_ALL, TRUE);
+ }
+#endif
/* update the GateMP resource tracker */
inUseArray[obj->resourceId] = UNUSED;
if (obj->cacheEnabled) {
- Cache_wbInv(inUseArray,
- numResources * sizeof(UInt8),
- Cache_Type_ALL,
- TRUE);
+ Cache_wbInv(inUseArray, size, Cache_Type_ALL, TRUE);
}
if (GateMP_module->defaultGate != NULL) {