[coreboot] DRAM Row Attributes i82830 Help?
Joseph Smith
joe at settoplinux.org
Mon Jun 2 17:11:19 CEST 2008
Hello,
I am having a problem with my set_dram_row_attributes() function in
raminit.c and need some help. The function seems to calculate ok but when
it comes to the switches, it is only working with one so-dimm not two. Is
this because there are two switches with the same name? How can I fix it?
Here is the output with some extra debugging and the function:
Found DIMM in slot 00, setting DRA...
Test - columns 0x0a
Test - data width 0x40
Test - page size 0x00010000
Test - KB 0x08
Test - banks 0x02
DRA 0x70 has been set to 0x08 <---- THIS SHOULD BE 0X22 - SEE SWITCH BELOW
Found DIMM in slot 01, setting DRA...
Test - columns 0x09
Test - data width 0x40
Test - page size 0x00008000
Test - KB 0x04
Test - banks 0x01
DRA 0x71 has been set to 0xf1
----------------------------------
static void set_dram_row_attributes(const struct mem_controller *ctrl)
{
int i, dra, col, width, value;
for (i = 0; i < DIMM_SOCKETS; i++) {
unsigned device;
device = ctrl->channel0[i];
/* First check if a DIMM is actually present. */
if (spd_read_byte(device, 2) == 0x4) {
print_debug("Found DIMM in slot ");
print_debug_hex8(i);
print_debug(", setting DRA...\r\n");
dra = 0x00;
/* columns */
col = spd_read_byte(device, 4);
/* data width */
width = spd_read_byte(device, 6);
/* calculate page size in bits */
value = ((1 << col) * width);
/* convert to Kilobytes */
dra = ((value / 8) >> 10);
/* # of banks of DIMM (single or double sided) */
value = spd_read_byte(device, 5);
if (value == 1) {
switch (dra) {
case 2: /* 2KB */
dra = 0xF0;
break;
case 4: /* 4KB */
dra = 0xF1;
break;
case 8: /* 8KB */
dra = 0xF2;
break;
case 16: /* 16KB */
dra = 0xF3;
break;
default:
print_err("Page size not supported\r\n");
die("HALT\r\n");
}
} else if (value == 2) {
switch (dra) {
case 2: /* 2KB */
dra = 0x00;
break;
case 4: /* 4KB */
dra = 0x11;
break;
case 8: /* 8KB */
dra = 0x22;
break;
case 16: /* 16KB */
dra = 0x33;
break;
default:
print_err("Page size not supported\r\n");
die("HALT\r\n");
}
} else {
print_err("# of banks of DIMM not supported\r\n");
die("HALT\r\n");
}
} else {
PRINT_DEBUG("No DIMM found in slot ");
PRINT_DEBUG_HEX8(i);
PRINT_DEBUG(", setting DRA to 0xFF\r\n");
/* If there's no DIMM in the slot, set dra value to 0xFF. */
dra = 0xFF;
}
/* Set the value for DRAM Row Attribute Registers */
pci_write_config8(ctrl->d0, DRA + i, dra);
PRINT_DEBUG("DRA 0x");
PRINT_DEBUG_HEX8(DRA + i);
PRINT_DEBUG(" has been set to 0x");
PRINT_DEBUG_HEX8(dra);
PRINT_DEBUG("\r\n");
}
}
I am stumped, please help.
--
Thanks,
Joseph Smith
Set-Top-Linux
www.settoplinux.org
More information about the coreboot
mailing list