On Tue, Mar 4, 2008 at 11:37 PM,  <<a href="mailto:joe@smittys.pointclark.net">joe@smittys.pointclark.net</a>> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
I hate to say it Corey, but this just sends it into an infinite loop.<br>
Does it make a difference that the onboard memory is located in slot2<br>
and slot1 is empty? Here is what I have:<br>
<br>
Thanks - Joe</blockquote><div><br>Try this instead, IIRC there are 4 DRBs. If it fails to build with too few registers, I think you can nuke the extra variable and just do multiple reads to the same location, or else reuse reg32 in place of reg8_2. I'm not really sure why the previous version failed, it looks sound to me. It might be interesting to put in some debugging output, to see what's going wrong.<br>
<br>static void do_ram_command(const struct mem_controller *ctrl, uint32_t<br>
command, uint32_t addr_offset)<br>
{<br>
        int i;<br>
        uint8_t reg8, reg8_2 = 0;<br>
        uint32_t reg32;<br>
<br>
        /* Configure the RAM command. */<br>
        reg32 = pci_read_config32(ctrl->d0, DRC);<br>
        /* Clear bits 29, 10-8, 6-4. */<br>
        reg32 &= 0xdffff88f;<br>
        reg32 |= command << 4;<br>
       /* If RAM_COMMAND_NORMAL set the refresh mode and IC bit. */<br>
        if (command == RAM_COMMAND_NORMAL) {<br>
        reg32 |= ((RAM_COMMAND_REFRESH << 8) | (RAM_COMMAND_IC << 29));<br>
       }<br>
        pci_write_config32(ctrl->d0, DRC, reg32);<br>
<br>
        /* RAM_COMMAND_NORMAL affects only the memory controller and<br>
           doesn't need to be "sent" to the DIMMs. */<br>
        /* if (command == RAM_COMMAND_NORMAL) return; */<br>
<br>
        PRINT_DEBUG("    Sending RAM command 0x");<br>
        PRINT_DEBUG_HEX32(reg32);<br>
        PRINT_DEBUG(" to 0x");<br>
        PRINT_DEBUG_HEX32(0 + addr_offset);<br>
        PRINT_DEBUG("\r\n");<br>
<div class="Ih2E3d"><br>
        /* NOTE: Dual-sided ready */<br>
        read32(0 + addr_offset);<br>
</div><div class="Ih2E3d">        for(i = 0; i < 4; i++) {<br>
</div>                reg8 = pci_read_config8(ctrl->d0, DRB + i);<br>               if(reg8 != reg8_2) read32(reg8 * 32 * 1024 * 1024); //extra parentheses aren't necessary <br>
                reg8_2 = reg8;<br>       }<br>
}<br> 
<br></div></div><br>