public inbox for ecos-discuss@sourceware.org
 help / color / mirror / Atom feed
* [ECOS] Problem with PowerPC cache init order
@ 2004-06-14 12:50 Retallack, Mark (Siemens)
  0 siblings, 0 replies; only message in thread
From: Retallack, Mark (Siemens) @ 2004-06-14 12:50 UTC (permalink / raw)
  To: ecos-discuss

[-- Attachment #1: Type: text/plain, Size: 1505 bytes --]

I have found a problem with the PowerPC architecture hal. 

The sequence for cache initialisation after reset (in hal_enable_caches)
should be:

unlock all
invalidate all
enable cache

Instead it is:

invalidate all
unlock all
enable cache

This can cause problems if there are sections of the cache that are locked
and contain invalid data. My target crashed with an exception when it needed
to do a copyback after a first time power up (not a pretty sight!!). The
copyback address was an invalid address.

I have attached a patch to fix the problem. This works for the MPC850, but I
do not know if it is correct for the complete PowerPC family.

 <<my.patch>> 

Mark Retallack
Graduate Engineer
Siemens Traffic Controls 
Sopers Lane, Poole, Dorset. BH17 7ER. UK.
Tel: 01202 782844
Fax: 01202 782545
www.siemenstraffic.com

Committed to quality traffic solutions and service excellence





Siemens Traffic Controls is a division of Siemens plc. Registered No.
727817, England. 
Registered office: Siemens House, Oldbury, Bracknell, Berkshire, RG12 8FZ. 

This communication contains information which is confidential and 
may also be privileged. It is for the exclusive use of the addressee. 
If you are not the addressee please note that any distribution, 
reproduction, copying, publication or use of this communication 
or the information in it is prohibited.  If you have received this 
communication in error, please contact us immediately and also 
delete the communication from your computer. 



[-- Attachment #2: my.patch --]
[-- Type: application/octet-stream, Size: 1272 bytes --]

diff -r -u5 -N -x CVS -x '*~' -x '.#*' clean/ecos/packages/hal/powerpc/arch/current/src/hal_misc.c devo/ecos/packages/hal/powerpc/arch/current/src/hal_misc.c
--- clean/ecos/packages/hal/powerpc/arch/current/src/hal_misc.c	2003-12-08 15:34:57.000000000 +0000
+++ devo/ecos/packages/hal/powerpc/arch/current/src/hal_misc.c	2004-06-14 13:38:55.033750000 +0100
@@ -298,27 +298,27 @@
 // Specific behavior for each platform configured via plf_cache.h
 
 externC void
 hal_enable_caches(void)
 {
-#ifndef CYG_HAL_STARTUP_RAM
-    // Invalidate caches
-    HAL_DCACHE_INVALIDATE_ALL();
-    HAL_ICACHE_INVALIDATE_ALL();
-#endif
-
 #ifdef CYGSEM_HAL_ENABLE_ICACHE_ON_STARTUP
 #ifdef HAL_ICACHE_UNLOCK_ALL
     HAL_ICACHE_UNLOCK_ALL();
 #endif
+#ifndef CYG_HAL_STARTUP_RAM    
+    HAL_ICACHE_INVALIDATE_ALL();
+#endif
     HAL_ICACHE_ENABLE();
 #endif
 
 #ifdef CYGSEM_HAL_ENABLE_DCACHE_ON_STARTUP
 #ifdef HAL_DCACHE_UNLOCK_ALL
-    HAL_DCACHE_UNLOCK_ALL();
+    HAL_DCACHE_UNLOCK_ALL(); 
 #endif
+#ifndef CYG_HAL_STARTUP_RAM    
+    HAL_DCACHE_INVALIDATE_ALL();
+#endif  
     HAL_DCACHE_ENABLE();
 #ifdef HAL_DCACHE_WRITE_MODE
 #ifdef CYGSEM_HAL_DCACHE_STARTUP_MODE_COPYBACK
     HAL_DCACHE_WRITE_MODE(HAL_DCACHE_WRITEBACK_MODE);
 #else


[-- Attachment #3: Type: text/plain, Size: 148 bytes --]

-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2004-06-14 12:50 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-06-14 12:50 [ECOS] Problem with PowerPC cache init order Retallack, Mark (Siemens)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).