diff options
Diffstat (limited to 'src/mainboard/google')
4 files changed, 48 insertions, 43 deletions
diff --git a/src/mainboard/google/slippy/variants/falco/romstage.c b/src/mainboard/google/slippy/variants/falco/romstage.c index 8254bc2df1..81174dbe08 100644 --- a/src/mainboard/google/slippy/variants/falco/romstage.c +++ b/src/mainboard/google/slippy/variants/falco/romstage.c @@ -74,6 +74,7 @@ static void copy_spd(struct pei_data *peid) int spd_index = get_gpios(gpio_vector); char *spd_file; size_t spd_file_len; + size_t spd_len = sizeof(peid->spd_data[0]); printk(BIOS_DEBUG, "SPD index %d\n", spd_index); spd_file = cbfs_boot_map_with_leak("spd.bin", CBFS_TYPE_SPD, @@ -81,27 +82,27 @@ static void copy_spd(struct pei_data *peid) if (!spd_file) die("SPD data not found."); - if (spd_file_len < - ((spd_index + 1) * sizeof(peid->spd_data[0]))) { + if (spd_file_len < ((spd_index + 1) * spd_len)) { printk(BIOS_ERR, "SPD index override to 0 - old hardware?\n"); spd_index = 0; } - if (spd_file_len < sizeof(peid->spd_data[0])) + if (spd_file_len < spd_len) die("Missing SPD data."); + memcpy(peid->spd_data[0], spd_file + (spd_index * spd_len), spd_len); + /* Index 0-2,6 are 4GB config with both CH0 and CH1 * Index 3-5,7 are 2GB config with CH0 only */ switch (spd_index) { + case 0: case 1: case 2: case 6: + memcpy(peid->spd_data[1], + spd_file + (spd_index * spd_len), spd_len); + break; case 3: case 4: case 5: case 7: peid->dimm_channel1_disabled = 3; } - - memcpy(peid->spd_data[0], - spd_file + - spd_index * sizeof(peid->spd_data[0]), - sizeof(peid->spd_data[0])); } void variant_romstage_entry(unsigned long bist) diff --git a/src/mainboard/google/slippy/variants/leon/romstage.c b/src/mainboard/google/slippy/variants/leon/romstage.c index c9cf07be3a..132f586f69 100644 --- a/src/mainboard/google/slippy/variants/leon/romstage.c +++ b/src/mainboard/google/slippy/variants/leon/romstage.c @@ -74,6 +74,7 @@ static void copy_spd(struct pei_data *peid) int spd_index = get_gpios(gpio_vector); char *spd_file; size_t spd_file_len; + size_t spd_len = sizeof(peid->spd_data[0]); printk(BIOS_DEBUG, "SPD index %d\n", spd_index); spd_file = cbfs_boot_map_with_leak("spd.bin", CBFS_TYPE_SPD, @@ -81,25 +82,24 @@ static void copy_spd(struct pei_data *peid) if (!spd_file) die("SPD data not found."); - /* Limiting to a single dimm for 2GB configuration - * Identified by bit 3 - */ - if (spd_index & 0x4) - peid->dimm_channel1_disabled = 3; - - if (spd_file_len < - ((spd_index + 1) * sizeof(peid->spd_data[0]))) { + if (spd_file_len < ((spd_index + 1) * spd_len)) { printk(BIOS_ERR, "SPD index override to 0 - old hardware?\n"); spd_index = 0; } - if (spd_file_len < sizeof(peid->spd_data[0])) + if (spd_file_len < spd_len) die("Missing SPD data."); - memcpy(peid->spd_data[0], - spd_file + - spd_index * sizeof(peid->spd_data[0]), - sizeof(peid->spd_data[0])); + memcpy(peid->spd_data[0], spd_file + (spd_index * spd_len), spd_len); + + /* Limiting to a single dimm for 2GB configuration + * Identified by bit 3 + */ + if (spd_index & 0x4) + peid->dimm_channel1_disabled = 3; + else + memcpy(peid->spd_data[1], + spd_file + (spd_index * spd_len), spd_len); } void variant_romstage_entry(unsigned long bist) diff --git a/src/mainboard/google/slippy/variants/peppy/romstage.c b/src/mainboard/google/slippy/variants/peppy/romstage.c index 4a3910185d..bf21cbc6fc 100644 --- a/src/mainboard/google/slippy/variants/peppy/romstage.c +++ b/src/mainboard/google/slippy/variants/peppy/romstage.c @@ -77,6 +77,7 @@ static void copy_spd(struct pei_data *peid) int spd_index = get_gpios(gpio_vector); char *spd_file; size_t spd_file_len; + size_t spd_len = sizeof(peid->spd_data[0]); printk(BIOS_DEBUG, "SPD index %d\n", spd_index); spd_file = cbfs_boot_map_with_leak("spd.bin", CBFS_TYPE_SPD, @@ -84,11 +85,24 @@ static void copy_spd(struct pei_data *peid) if (!spd_file) die("SPD data not found."); + if (spd_file_len < ((spd_index + 1) * sizeof(peid->spd_data[0]))) { + printk(BIOS_ERR, "SPD index override to 0 - old hardware?\n"); + spd_index = 0; + } + + if (spd_file_len < spd_len) + die("Missing SPD data."); + + memcpy(peid->spd_data[0], spd_file + (spd_index * spd_len), spd_len); + switch (google_chromeec_get_board_version()) { case PEPPY_BOARD_VERSION_PROTO: /* Index 0 is 2GB config with CH0 only. */ if (spd_index == 0) peid->dimm_channel1_disabled = 3; + else + memcpy(peid->spd_data[1], + spd_file + (spd_index * spd_len), spd_len); break; case PEPPY_BOARD_VERSION_EVT: @@ -97,22 +111,11 @@ static void copy_spd(struct pei_data *peid) * Index 4-6 are 2GB config with CH0 only. */ if (spd_index > 3) peid->dimm_channel1_disabled = 3; + else + memcpy(peid->spd_data[1], + spd_file + (spd_index * spd_len), spd_len); break; } - - if (spd_file_len < - ((spd_index + 1) * sizeof(peid->spd_data[0]))) { - printk(BIOS_ERR, "SPD index override to 0 - old hardware?\n"); - spd_index = 0; - } - - if (spd_file_len < sizeof(peid->spd_data[0])) - die("Missing SPD data."); - - memcpy(peid->spd_data[0], - spd_file + - spd_index * sizeof(peid->spd_data[0]), - sizeof(peid->spd_data[0])); } void variant_romstage_entry(unsigned long bist) diff --git a/src/mainboard/google/slippy/variants/wolf/romstage.c b/src/mainboard/google/slippy/variants/wolf/romstage.c index 4bdde31b5d..5b6b254461 100644 --- a/src/mainboard/google/slippy/variants/wolf/romstage.c +++ b/src/mainboard/google/slippy/variants/wolf/romstage.c @@ -76,6 +76,7 @@ static void copy_spd(struct pei_data *peid) int spd_index = get_gpios(gpio_vector); char *spd_file; size_t spd_file_len; + size_t spd_len = sizeof(peid->spd_data[0]); printk(BIOS_DEBUG, "SPD index %d\n", spd_index); spd_file = cbfs_boot_map_with_leak("spd.bin", CBFS_TYPE_SPD, @@ -83,27 +84,27 @@ static void copy_spd(struct pei_data *peid) if (!spd_file) die("SPD data not found."); - if (spd_file_len < - ((spd_index + 1) * sizeof(peid->spd_data[0]))) { + if (spd_file_len < ((spd_index + 1) * spd_len)) { printk(BIOS_ERR, "SPD index override to 0 - old hardware?\n"); spd_index = 0; } - if (spd_file_len < sizeof(peid->spd_data[0])) + if (spd_file_len < spd_len) die("Missing SPD data."); + memcpy(peid->spd_data[0], spd_file + (spd_index * spd_len), spd_len); + /* Index 0-2, are 4GB config with both CH0 and CH1 * Index 3-5, are 2GB config with CH0 only */ switch (spd_index) { + case 0: case 1: case 2: + memcpy(peid->spd_data[1], + spd_file + (spd_index * spd_len), spd_len); + break; case 3: case 4: case 5: peid->dimm_channel1_disabled = 3; } - - memcpy(peid->spd_data[0], - spd_file + - spd_index * sizeof(peid->spd_data[0]), - sizeof(peid->spd_data[0])); } void variant_romstage_entry(unsigned long bist) |