kernel/eka/kernel/arm/cache_external.cpp
changeset 200 73ea206103e6
parent 90 947f0dc9f7a8
equal deleted inserted replaced
152:657f875b013e 200:73ea206103e6
   311 	DrainBuffers();
   311 	DrainBuffers();
   312 	}
   312 	}
   313 
   313 
   314 void ExternalCache::AtomicSync()
   314 void ExternalCache::AtomicSync()
   315 	{
   315 	{
   316 	CHECK_PRECONDITIONS(MASK_INTERRUPTS_DISABLED,"ExternalCache::AtomicSync");
   316 	// This methos is called during reboot or power down sequence and therefore is not allowed
   317 	__KTRACE_OPT(KMMU,Kern::Printf("ExternalCache::AtomicSync"));
   317 	// to do Kernel calls that may hold spin lock - such as Kern::Print or precondition checkings.
   318 
   318 	// CHECK_PRECONDITIONS(MASK_INTERRUPTS_DISABLED,"ExternalCache::AtomicSync");
       
   319 	// __KTRACE_OPT(KMMU,Kern::Printf("ExternalCache::AtomicSync"));
   319 #if defined(__ARM_PL310_CACHE__)
   320 #if defined(__ARM_PL310_CACHE__)
   320 	// On Pl310, we hold the lock while maintaining cache. Therefore, we cannot
   321     // Do not use maintain-by-way operations on PL310 (due to erratum 727915 for example)
   321 	// do that on a way basis as it takes too long to complete.
   322     // Also, do not use ARML2C_CleanInvalidateByIndexWay (erratum 588369)
   322 	// This will also ensure that PL310 erratum 727915 is sorted out.
   323     // Do not hold spin lock as it is assumed this is the only running CPU.
   323 
   324     TInt indexNo = Info.iSize>>3; // This is the number of cache lines in each way. Assoc is always 8 in this cache
   324 #if defined(__ARM_PL310_ERRATUM_588369_FIXED)
   325     volatile TInt* ctrlReg = (volatile TInt*)(Base+ARML2C_CleanByIndexWay);
   325 	Maintain_All((TInt*)(Base+ARML2C_CleanInvalidateByIndexWay));
   326     TInt way,index;
   326 #else //defined(__ARM_PL310_ERRATUM_588369_FIXED)
   327     for (way = 0 ; way <Info.iAssoc ; way++)
   327 	//CleanAndInvalidate is broken. Just clean it.
   328         {
   328 	Maintain_All((TInt*)(Base+ARML2C_CleanByIndexWay));
   329         for (index = 0 ; index <indexNo ; index++)
   329 #endif //else defined(__ARM_PL310_ERRATUM_588369_FIXED)
   330             {
   330 	
   331             *ctrlReg = (way<<ARML2C_WayShift) | (index<<ARML2C_IndexShift); //This will maintain a single cache line
       
   332             }
       
   333         }
   331 #else //defined(__ARM_PL310_CACHE__)
   334 #else //defined(__ARM_PL310_CACHE__)
   332 
   335 
   333 	#if defined (__ARM_L210_CACHE__)
   336 	#if defined (__ARM_L210_CACHE__)
   334 	// Flush buffers before starting background clean+invalidate.
   337 	// Flush buffers before starting background clean+invalidate.
   335 	// This is the fix for an erratum (see the top of the file).
   338 	// This is the fix for an erratum (see the top of the file).