I have been looking through auto.inc and it would be very helpful if besides printing the line no inside auto.c, it would also print the actual C line.
Does anyone know how easy this would be to do ?
The reason I am asking this is because of the problem I am having with the epia code.
There is this bit of C code
// SDRAM in all banks pci_write_config8(north, 0x60, 0x3F);
// DRAM timing. I'm suspicious of this // This is for all banks, 64 is 0,1. 65 is 2,3. 66 is 4,5. // ras precharge 4T, RAS pulse 5T // cas2 is 0xd6, cas3 is 0xe6 // we're also backing off write pulse width to 2T, so result is 0xee
#if DIMM_CL2 pci_write_config8(north, 0x64, 0xd6); pci_write_config8(north, 0x65, 0xd6); pci_write_config8(north, 0x66, 0xd6); #else // CL=3 pci_write_config8(north, 0x64, 0xe6); pci_write_config8(north, 0x65, 0xe6); pci_write_config8(north, 0x66, 0xe6); #endif
print_debug_hex8(pci_read_config8(north, 0x64)); print_debug_hex8(pci_read_config8(north, 0x65)); print_debug_hex8(pci_read_config8(north, 0x66));
ok now loking at the serial output I get the following snippet
1106 0601 ece6e6init 1 done
the important bit is the ece6e6
Ok now as you can see it is not writing to the register properly. So I am now looking through auto.inc and trying to find the relevant code. While I will be honest and say at the moment I do not 100% understand it, I can never the less find the relevant assembler code. Anyway this is it
********** first bit I think is for this line pci_write_config8(north, 0x60, 0x3F); ***********
mov $63 , %al mov $3324 , %dx outb %al, %dx /* ,:0.0 */ /* * pci_write_config8,romcc_io.h:148.38 * sdram_set_registers,raminit.c:164.26 * main,auto.c:107.28 */ /* ,:0.0 */ /* * __builtin_outl,<built-in>:1.0 * outl,io.h:25.23 * pci_write_config8,romcc_io.h:148.13 * sdram_set_registers,raminit.c:164.26 * main,auto.c:107.28 */ mov $-2147483548 , %eax mov $3320 , %dx outl %eax, %dx /* ,:0.0 */ /* * __builtin_outb,<built-in>:1.0 * outb,io.h:15.23 * pci_write_config8,romcc_io.h:149.13 * sdram_set_registers,raminit.c:164.26 * main,auto.c:107.28 */
********* ok here is 1 write of 0xe6 **********
mov $230 , %al mov $3325 , %dx outb %al, %dx /* ,:0.0 */ /* * pci_write_config8,romcc_io.h:148.38 * sdram_set_registers,raminit.c:165.26 * main,auto.c:107.28 */ /* ,:0.0 */ /* * __builtin_outl,<built-in>:1.0 * outl,io.h:25.23 * pci_write_config8,romcc_io.h:148.13 * sdram_set_registers,raminit.c:165.26 * main,auto.c:107.28 */ mov $-2147483548 , %eax mov $3320 , %dx outl %eax, %dx /* ,:0.0 */ /* * __builtin_outb,<built-in>:1.0 * outb,io.h:15.23 * pci_write_config8,romcc_io.h:149.13 * sdram_set_registers,raminit.c:165.26 * main,auto.c:107.28 */
********** here is 2nd write of 0xe6 ************
mov $230 , %al mov $3326 , %dx outb %al, %dx /* * pci_read_config8,romcc_io.h:124.38 * sdram_set_registers,raminit.c:169.42 * main,auto.c:107.28 */ /* ,:0.0 */ /* * __builtin_outl,<built-in>:1.0 * outl,io.h:25.23 * pci_read_config8,romcc_io.h:124.13 * sdram_set_registers,raminit.c:169.42 * main,auto.c:107.28 */ mov $-2147483548 , %eax mov $3320 , %dx outl %eax, %dx /* ,:0.0 */ /*
******** now we get to read back the values ready to print ************
* __builtin_inb,<built-in>:1.0 * inb,io.h:31.29 * pci_read_config8,romcc_io.h:125.19 * sdram_set_registers,raminit.c:169.42 * main,auto.c:107.28
Ok now unless I am going crazy there appear to only be 2 writes of 0xe6 !!!! Where is the 3rd one? Also if romcc has missed this out, it is also possible that other bits of code are not getting executed.
Ok now maybe I am wrong and not understanding auto.inc but I am pretty sure I am looking at the right bit of code here.
What do you think ?
On 9/12/06, Ben Hewson ben@hewson-venieri.com wrote:
I have been looking through auto.inc and it would be very helpful if besides printing the line no inside auto.c, it would also print the actual C line.
Does anyone know how easy this would be to do ?
The reason I am asking this is because of the problem I am having with the epia code.
There is this bit of C code
// SDRAM in all banks pci_write_config8(north, 0x60, 0x3F); // DRAM timing. I'm suspicious of this // This is for all banks, 64 is 0,1. 65 is 2,3. 66 is 4,5. // ras precharge 4T, RAS pulse 5T // cas2 is 0xd6, cas3 is 0xe6 // we're also backing off write pulse width to 2T, so result is 0xee
#if DIMM_CL2 pci_write_config8(north, 0x64, 0xd6); pci_write_config8(north, 0x65, 0xd6); pci_write_config8(north, 0x66, 0xd6); #else // CL=3 pci_write_config8(north, 0x64, 0xe6); pci_write_config8(north, 0x65, 0xe6); pci_write_config8(north, 0x66, 0xe6); #endif
print_debug_hex8(pci_read_config8(north, 0x64)); print_debug_hex8(pci_read_config8(north, 0x65)); print_debug_hex8(pci_read_config8(north, 0x66));
ok now loking at the serial output I get the following snippet
1106 0601 ece6e6init 1 done
the important bit is the ece6e6
Ok now as you can see it is not writing to the register properly. So I am now looking through auto.inc and trying to find the relevant code. While I will be honest and say at the moment I do not 100% understand it, I can never the less find the relevant assembler code. Anyway this is it
first bit I think is for this line pci_write_config8(north, 0x60, 0x3F);
mov $63 , %al mov $3324 , %dx outb %al, %dx
3324 is cfc. data. 63 is 3f. You have to look at the code before this, but I expect that it will be for 0x60.
/* ,:0.0 */
/* * pci_write_config8,romcc_io.h:148.38 * sdram_set_registers,raminit.c:164.26 * main,auto.c:107.28 */ /* ,:0.0 */ /* * __builtin_outl,<built-in>:1.0 * outl,io.h:25.23 * pci_write_config8,romcc_io.h:148.13 * sdram_set_registers,raminit.c:164.26 * main,auto.c:107.28 */ mov $-2147483548 , %eax mov $3320 , %dx outl %eax, %dx
3320 is cf8. $-2147483548 is 64. So set cf8 to x64.
/* ,:0.0 */
/* * __builtin_outb,<built-in>:1.0 * outb,io.h:15.23 * pci_write_config8,romcc_io.h:149.13 * sdram_set_registers,raminit.c:164.26 * main,auto.c:107.28 */
********* ok here is 1 write of 0xe6 **********
mov $230 , %al mov $3325 , %dx outb %al, %dx
so, write e6 to cfd, i.e. 65. hmm. what happened to 64?
/* ,:0.0 */
/* * pci_write_config8,romcc_io.h:148.38 * sdram_set_registers,raminit.c:165.26 * main,auto.c:107.28 */ /* ,:0.0 */ /* * __builtin_outl,<built-in>:1.0 * outl,io.h:25.23 * pci_write_config8,romcc_io.h:148.13 * sdram_set_registers,raminit.c:165.26 * main,auto.c:107.28 */ mov $-2147483548 , %eax mov $3320 , %dx outl %eax, %dx
set cfc to 64.
/* ,:0.0 */
/* * __builtin_outb,<built-in>:1.0 * outb,io.h:15.23 * pci_write_config8,romcc_io.h:149.13 * sdram_set_registers,raminit.c:165.26 * main,auto.c:107.28 */
********** here is 2nd write of 0xe6 ************
mov $230 , %al mov $3326 , %dx outb %al, %dx
Write e6 to 66.
/*
* pci_read_config8,romcc_io.h:124.38 * sdram_set_registers,raminit.c:169.42 * main,auto.c:107.28 */ /* ,:0.0 */ /* * __builtin_outl,<built-in>:1.0 * outl,io.h:25.23 * pci_read_config8,romcc_io.h:124.13 * sdram_set_registers,raminit.c:169.42 * main,auto.c:107.28 */ mov $-2147483548 , %eax mov $3320 , %dx outl %eax, %dx /* ,:0.0 */
set cfc to 64.
/*
******** now we get to read back the values ready to print ************
* __builtin_inb,<built-in>:1.0 * inb,io.h:31.29 * pci_read_config8,romcc_io.h:125.19 * sdram_set_registers,raminit.c:169.42 * main,auto.c:107.28
I don't see a write to 64 either. HMMMMMM. Good detective work. Wonder what's up here?
ron
Ben Hewson wrote:
Ok I have been playing around a bit and it appears the first line after the #else is skipped Inserting a blank line is enough to make it work.
oh, bother! I wonder if this was it all along? If it is, then let me know how/where to buy you a drink of your choice :-)
You did a darn good job of root cause analysis, btw.
ron
Ok I have been playing around a bit and it appears the first line after the #else is skipped Inserting a blank line is enough to make it work.
oh, bother! I wonder if this was it all along? If it is, then let me know how/where to buy you a drink of your choice :-)
If thats it then we need to audit a lot of code or see about geting Eric to fix it.
Richard Smith wrote:
Ok I have been playing around a bit and it appears the first line after the #else is skipped Inserting a blank line is enough to make it work.
oh, bother! I wonder if this was it all along? If it is, then let me know how/where to buy you a drink of your choice :-)
If thats it then we need to audit a lot of code or see about geting Eric to fix it.
or see if we can stop using the romcc built-in cpp and go with a standard one.
ron
Ronald G Minnich wrote:
Ben Hewson wrote:
Ok I have been playing around a bit and it appears the first line after the #else is skipped Inserting a blank line is enough to make it work.
oh, bother! I wonder if this was it all along? If it is, then let me know how/where to buy you a drink of your choice :-)
You did a darn good job of root cause analysis, btw.
ron
ok I have now put an extra space after every #else in raminit.c and things are better but still have problems.
the sdram_set_spd_registers() function and I guess by that I mean smbus stuff is causing some problems. the code will sometimes hang there or take 2-3 seconds to complete.
also having problems inside sdram_enable() where the code searches for the number and size of ram modules, again probably the smbus stuff, but just guessing, it sometimes hangs again.
assuming the code makes it past there it can still hang on the ram verify, but never on ram fill. not sure why that is. even if the ram is not initialized properly, the worst that should happen is to get random data back surely ?
assuming it makes it past that it goes all the way to trying to boot my kernel image from the hard drive. it usually takes 3 or 4 resets to get this far.
will have to go through the smbus stuff next as I think the ram is being initialized ok at the moment. does anyone have some good links or documents on spd and smbus ?
anyway thats it for me tonight need to go have some food.