On Wed, Feb 27, 2008 at 7:16 AM,  <<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;">
<div><div></div><div class="Wj3C7c">Quoting Corey Osgood <<a href="mailto:corey.osgood@gmail.com">corey.osgood@gmail.com</a>>:<br>
<br>
> On Tue, 2008-02-26 at 21:33 -0500, <a href="mailto:joe@smittys.pointclark.net">joe@smittys.pointclark.net</a> wrote:<br>
>> Quoting <a href="mailto:joe@smittys.pointclark.net">joe@smittys.pointclark.net</a>:<br>
>><br>
>> > Quoting Corey Osgood <<a href="mailto:corey.osgood@gmail.com">corey.osgood@gmail.com</a>>:<br>
>> ><br>
>> >><br>
>> >> On Tue, 2008-02-26 at 16:19 -0500, <a href="mailto:joe@smittys.pointclark.net">joe@smittys.pointclark.net</a> wrote:<br>
>> >>> >> +static void do_ram_command(const struct mem_controller *ctrl,<br>
>> >>> >> uint32_t command, uint32_t addr_offset)<br>
>> >>> >> +{<br>
>> >>> >> <snip><br>
>> >>> >> +<br>
>> >>> >> +     /* Read from (DIMM start address + addr_offset). */<br>
>> >>> >> +     read32(0 + addr_offset);        //first offset is always 0<br>
>> >>> >> +}<br>
>> >>> ><br>
>> >>> > This isn't ready for multiple dimms yet. See the cn700 patch I<br>
>> >>> > recently sent (but haven't committed yet, I think it was acked).<br>
>> >>> ><br>
>> >>> Oh you mean this? What do I need to do to adapt it for the i82830?<br>
>> >>><br>
>> >>> +        /* NOTE: Dual-sided ready */<br>
>> >>>          read32(0 + addr_offset);<br>
>> >>> +        for(i = 0; i < (ARRAY_SIZE(ctrl->channel0) * 2); i++) {<br>
>> >>> +                reg8 = pci_read_config8(ctrl->d0f3, 0x40 + i);<br>
>> >>> +        if(reg8) read32((reg8 << 26) + addr_offset);<br>
>> >>> + }<br>
>> >><br>
>> >> This reads from register 0x40 + i, where 0x40 is the top of the first<br>
>> >> dimm, and i counts to the max number of dimms.<br>
>> ><br>
>> > Why read this from a register?? Why not just use (i = 0; i <<br>
>> > DIMM_SOCKETS; i++)<br>
><br>
> ARRAY_SIZE(ctrl->channel0) is the number of spd addresses, which can be<br>
> less than the max number of dimms.<br>
><br>
>> ><br>
>> >> Reg 0x40 contains bits<br>
>> >> 33:26 of the top address, hence the << 26. So you'd need to adjust both<br>
>> >> of these to fit the i830's DRB mechanism. If the i830 uses an ugly<br>
>> >> format like the i810 does, then it may be easier to store the size in<br>
>> >> scratch registers somewhere after it's calculated, and then use those<br>
>> >> values instead. Sorry I can't get more specific, I've got to head out to<br>
>> >> my next service call.<br>
>> >><br>
>> > The DRB i830 is not ugly it is very simple, simple, simple. So simple<br>
>> > that it just calculates the memory size in ticks of 32 per side<br>
>> (Sorry typo I meant) +<br>
>> > the next side up to 4 sides. Like this:<br>
>> ><br>
>> > Example: 128MB SINGLE sided so-dimm in slot 1<br>
>> >           128MB DOUBLE sided so-dimm in slot 2<br>
>> ><br>
>> > There are 4 DRB registers(actually 6 but but only 4 that are usable -<br>
>> > Intel design glitch), 1 for each side. So in this example they would<br>
>> > look like this:<br>
>> ><br>
>> > DRB1 = 0x04<br>
>> > DRB2 = 0x04<br>
>> > DRB3 = 0x06<br>
>> > DRB4 = 0x08<br>
>> ><br>
>> > So if we needed to convert this we would do something like this (DRB *<br>
>> > 32) * 1024 correct? But if we just need to calculate the end of<br>
>> > so-dimm #1 and the start of so-dimm #2 the only important register<br>
>> > would be DRB2 (side 2 of so-dimm #1) and DRB3(side 1 of so-dimm #2),<br>
>> > correct?<br>
><br>
> The modified version would be something like<br>
> read32(0 + addr_offset);<br>
> for(i = 0; i < ARRAY_SIZE(ctrl->channel0); i++) {<br>
>       reg8 = pci_read_config8(ctrl->d0/*?*/, DRB1 + i);<br>
>       read32(reg8 * 32);<br>
> }<br>
><br>
</div></div>Ok starting to make sense but what is all this about? /*?*/ wouldn't<br>
it just be reg8 = pci_read_config8(ctrl->d0, DRB1 = i);<br></blockquote><div><br>DRB1 + i, but yes. The /*?*/ is an inline comment, because I wasn't sure if it was actually device 0 function 0 that had the memory registers.<br>
 </div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
This is going to show our results in MB, is that what we want? For<br>
accuracy shouldn't it be in bytes? Sorry for so many questions, I just<br>
want to get this right.</blockquote><div><br>Right again, it would need to be read32(reg8 * 32 * 1024 * 1024) (If I'm thinking correctly).<br><br>-Corey<br> </div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br>
<br>
<br>
Thanks - Joe<br>
</blockquote></div><br>