I  am working on  mpc8548cds board … 
  
Feature : POST DIAGNOSTICS; 
  
In  u-boot :  post/memory.c,cpu.c..etc.. 
  
Need your suggestion… 
  
There is function pointers in post.c which calls the respective function to 
perform diag test ( example ram , cpu, ether ..etc ) which will be picked from 
tests.c ( This is the structure which defines all the fileds of the tests) 
  
Function pointer defined in post.c 
  
static int post_run_single (struct post_test *test, 
                                                        int test_flags, int 
flags, unsigned int i) { 
… 
.. 
if ((*test->test) (flags) != 0) {             ( This function pointers will 
call cpu tests from post/cpu.c defined below based tested entered from u-boot 
promt  ) 
  post_log ("FAILED\n") 
} else { 
post_log ("PASSED\n") 
} 
  
------------------------------------------------------------------------------------------------------------
 
CASE 1 Experiment : 
Post/cpu.c 
  
int cpu_post_test (int flags) 
{ 
        int ic = icache_status (); 
        int  ret = 0; 
        int c; 
        post_result_cpu = 0; 
        cpu_dbg = 0; 
        boot_flag_post = 0; 
  
       printf( “ Testing cpu diag \n”);   à TRAP IS Generated and box got 
rebooted. 
  
       Other part of code exits.. 
} 
  
  
>From u-boot prompt. 
  
  
=>diag run cpu   
  
By log I verfied that this TRAP is generated from the post/cpu.c because of 
printf 
  
NIP: 00000000 XER: 00000000 LR: FFF25C40 REGS: 3feed878 TRAP: 0700 DAR: 
00000004 
MSR: 00029200 EE: 1 PR: 0 FP: 0 ME: 1 IR/DR: 00 
  
GPR00: 00000004 3FEED968 00000200 3FEEDA18 3FEEDA18 3FEEDA08 FFFFFFF4 00000007 
GPR08: 00000000 00000000 FFFFFFFF 3FEED918 44028042 00000000 3FFBBC00 00000000 
GPR16: 00000000 00000000 00000000 00000000 00000000 3FEF0378 00000003 0000000C 
GPR24: 3FEF0350 00000600 00000002 00000600 3FEEDA18 3FEEDF90 FFF4D3BC 00000000 
** Illegal Instruction ** 
Call backtrace: 
3FF73310 FFF25DB8 FFF25E38 FFF338A0 3FFA2FAC 3FFA3564 3FF8D620 
3FF98820 3FF98E98 3FF99000 3FF8AE44 3FF81DA8 3FF72628 
Program Check Exception 
NIPÞ 
  
  
  
CASE 2 Experiment: 
  
Post/cpu.c 
  
int cpu_post_test (int flags) 
{ 
        int ic = icache_status (); 
        int  ret = 0; 
        int c; 
        post_result_cpu = 0; 
        cpu_dbg = 0; 
        boot_flag_post = 0; 
  
     < Removed or commented  the printf statement  > 
         return 0;    NO TRAP  is Generated. 
  
           . 
} 
  
  
Another approach to validate the post/cpu.c fuction. Is working correctly or 
not. 
  
  
In file post.c 
  
Declared this API and directly called cpu_post_test(flags) before the function 
pointers. This API executed correctly with out a TRAP and results were 
displayed correctly. 
extern int cpu_post_test (int flags); 
  
static int post_run_single (struct post_test *test, 
                                                        int test_flags, int 
flags, unsigned int i) { 
  
ret =  cpu_post_test(flags); 
  
#if 0 
if ((*test->test) (flags) != 0) {           
  post_log ("FAILED\n") 
} else { 
post_log ("PASSED\n") 
} 
#iendif 
  
  
Could u please let me know how do I avoid this TRAP when I am using the 
function pointers.. CASE 1 Experiment: 
  
  
  
  
Regards, 
Rajshekar 
  
  
  
  
 



      
_______________________________________________
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot

Reply via email to