# [LinuxBIOS] i82830 raminit.c

Joseph Smith joe at smittys.pointclark.net
Mon Jul 16 11:58:58 CEST 2007

```>
> int i, spd_byte_31, spd_byte_5;
>
> for (i = 8; i >= 0; i--) {
>     /* Find the larger value. The larger side is always side1 */
>     if (spd_byte_31 & (1 << i) == (1 << i)) {
>         sz.side1 = i;
>         break;
>     }
> }
>
> /* Set to 0 in case it's single sided */
> sz.side2 = 0;
>
> /* Test if it's a dual-sided dimm */
> if (spd_byte_5 > 1) {
>     /* Test to see if there's a second value, if so it's asymmetrical */
>     if (spd_byte_31 != (1 << i)) {
>         /* Find the second value, picking up where we left off */
>         /* i-- done initially to make sure we don't get the same value
> again */
>         for (i--; i >= 0; i--) {
>           if (spd_byte_31 == (1 << i) {
>              sz.side2 = i;
>              break;
>           }
>        }
>     }
>     /* If not, it's symmetrical */
>     else {
>         sz.side2 = sz.side1;
>     }
>     return sz; //sizes are now in units of 4mb, so 1 = 4mb, 2 = 8mb, etc.
> }
>
>
> -Corey
>
>

Corey,
I have been playing around with this a bit. I really like it! The only
thing I do not understand is how you get ticks of 4mb out of it. Say
we have a single sided 128mb dimm. i is going to end up being 7
correct? 4 * 7 is not 128, I'm confused.....
Couldn't you just make the end result something like sz.side1 = (1 <<
i) after it breaks out of the for loop? This would give you the total
without messing around with ticks of 4mb right?

Thanks - Joe

```