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