Elyes Haouas has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/69273 )
Change subject: mb/google/{eve,glados}: Use <spd_bin.h> ......................................................................
mb/google/{eve,glados}: Use <spd_bin.h>
Change-Id: I3978d100ad1b763d7318d261cd7825ce2ac4ba97 Signed-off-by: Elyes Haouas ehaouas@noos.fr --- M src/mainboard/google/eve/romstage.c M src/mainboard/google/eve/spd/spd.c M src/mainboard/google/eve/spd/spd.h M src/mainboard/google/glados/romstage.c M src/mainboard/google/glados/spd/spd.c M src/mainboard/google/glados/spd/spd.h 6 files changed, 35 insertions(+), 42 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/73/69273/1
diff --git a/src/mainboard/google/eve/romstage.c b/src/mainboard/google/eve/romstage.c index f3c0f11..43021f1 100644 --- a/src/mainboard/google/eve/romstage.c +++ b/src/mainboard/google/eve/romstage.c @@ -34,7 +34,7 @@
mem_cfg->MemorySpdPtr00 = mainboard_get_spd_data(); mem_cfg->MemorySpdPtr10 = mem_cfg->MemorySpdPtr00; - mem_cfg->MemorySpdDataLen = SPD_LEN; + mem_cfg->MemorySpdDataLen = SPD_PAGE_LEN;
/* Limit K4EBE304EB-EGCF memory to 1600MHz for stability */ if (board_id() < 6 && mainboard_get_spd_index() == 5) { diff --git a/src/mainboard/google/eve/spd/spd.c b/src/mainboard/google/eve/spd/spd.c index e9405f0..0d0c7b6 100644 --- a/src/mainboard/google/eve/spd/spd.c +++ b/src/mainboard/google/eve/spd/spd.c @@ -19,15 +19,15 @@ const int spd_ranks[8] = { 1, 2, 3, 4, -1, -1, -1, -1 }; const int spd_devw[8] = { 4, 8, 16, 32, -1, -1, -1, -1 }; const int spd_busw[8] = { 8, 16, 32, 64, -1, -1, -1, -1 }; - char spd_name[SPD_PART_LEN+1] = { 0 }; + char spd_name[DDR3_SPD_PART_LEN+1] = { 0 };
int banks = spd_banks[(spd[SPD_DENSITY_BANKS] >> 4) & 7]; int capmb = spd_capmb[spd[SPD_DENSITY_BANKS] & 7] * 256; int rows = spd_rows[(spd[SPD_ADDRESSING] >> 3) & 7]; int cols = spd_cols[spd[SPD_ADDRESSING] & 7]; - int ranks = spd_ranks[(spd[SPD_ORGANIZATION] >> 3) & 7]; - int devw = spd_devw[spd[SPD_ORGANIZATION] & 7]; - int busw = spd_busw[spd[SPD_BUS_DEV_WIDTH] & 7]; + int ranks = spd_ranks[(spd[DDR3_ORGANIZATION] >> 3) & 7]; + int devw = spd_devw[spd[DDR3_ORGANIZATION] & 7]; + int busw = spd_busw[spd[DDR3_BUS_DEV_WIDTH] & 7];
/* Module type */ printk(BIOS_INFO, "SPD: module type is "); @@ -35,7 +35,7 @@ case SPD_DRAM_DDR3: printk(BIOS_INFO, "DDR3\n"); break; - case SPD_DRAM_LPDDR3: + case SPD_DRAM_LPDDR3_INTEL: printk(BIOS_INFO, "LPDDR3\n"); break; default: @@ -44,8 +44,8 @@ }
/* Module Part Number */ - memcpy(spd_name, &spd[SPD_PART_OFF], SPD_PART_LEN); - spd_name[SPD_PART_LEN] = 0; + memcpy(spd_name, &spd[DDR3_SPD_PART_OFF], DDR3_SPD_PART_LEN); + spd_name[DDR3_SPD_PART_LEN] = 0; printk(BIOS_INFO, "SPD: module part is %s\n", spd_name);
printk(BIOS_INFO, @@ -87,16 +87,16 @@ die("SPD data not found.");
/* make sure we have at least one SPD in the file. */ - if (spd_file_len < SPD_LEN) + if (spd_file_len < SPD_PAGE_LEN) die("Missing SPD data.");
/* Make sure we did not overrun the buffer */ - if (spd_file_len < ((spd_index + 1) * SPD_LEN)) { + if (spd_file_len < ((spd_index + 1) * SPD_PAGE_LEN)) { printk(BIOS_ERR, "SPD index override to 1 - old hardware?\n"); spd_index = 1; }
- spd_index *= SPD_LEN; + spd_index *= SPD_PAGE_LEN; mainboard_print_spd_info((uint8_t *)(spd_file + spd_index));
return (uintptr_t)(spd_file + spd_index); diff --git a/src/mainboard/google/eve/spd/spd.h b/src/mainboard/google/eve/spd/spd.h index 7b53fd4..b46ea4d 100644 --- a/src/mainboard/google/eve/spd/spd.h +++ b/src/mainboard/google/eve/spd/spd.h @@ -3,17 +3,9 @@ #ifndef MAINBOARD_SPD_H #define MAINBOARD_SPD_H
-#define SPD_LEN 256 +#include <spd_bin.h> +#include <stdint.h>
-#define SPD_DRAM_TYPE 2 -#define SPD_DRAM_DDR3 0x0b -#define SPD_DRAM_LPDDR3 0xf1 -#define SPD_DENSITY_BANKS 4 -#define SPD_ADDRESSING 5 -#define SPD_ORGANIZATION 7 -#define SPD_BUS_DEV_WIDTH 8 -#define SPD_PART_OFF 128 -#define SPD_PART_LEN 18 #define SPD_MANU_OFF 148
int mainboard_get_spd_index(void); diff --git a/src/mainboard/google/glados/romstage.c b/src/mainboard/google/glados/romstage.c index 9a968b1..1c4641e 100644 --- a/src/mainboard/google/glados/romstage.c +++ b/src/mainboard/google/glados/romstage.c @@ -30,7 +30,7 @@ }; const int spd_idx = gpio_base2_value(spd_gpios, ARRAY_SIZE(spd_gpios));
- mem_cfg->MemorySpdDataLen = SPD_LEN; + mem_cfg->MemorySpdDataLen = SPD_PAGE_LEN; mem_cfg->DqPinsInterleaved = FALSE;
spd_memory_init_params(mupd, spd_idx); diff --git a/src/mainboard/google/glados/spd/spd.c b/src/mainboard/google/glados/spd/spd.c index 9bfb202..5deae62 100644 --- a/src/mainboard/google/glados/spd/spd.c +++ b/src/mainboard/google/glados/spd/spd.c @@ -20,15 +20,15 @@ const int spd_ranks[8] = { 1, 2, 3, 4, -1, -1, -1, -1 }; const int spd_devw[8] = { 4, 8, 16, 32, -1, -1, -1, -1 }; const int spd_busw[8] = { 8, 16, 32, 64, -1, -1, -1, -1 }; - char spd_name[SPD_PART_LEN+1] = { 0 }; + char spd_name[DDR3_SPD_PART_LEN+1] = { 0 };
int banks = spd_banks[(spd[SPD_DENSITY_BANKS] >> 4) & 7]; int capmb = spd_capmb[spd[SPD_DENSITY_BANKS] & 7] * 256; int rows = spd_rows[(spd[SPD_ADDRESSING] >> 3) & 7]; int cols = spd_cols[spd[SPD_ADDRESSING] & 7]; - int ranks = spd_ranks[(spd[SPD_ORGANIZATION] >> 3) & 7]; - int devw = spd_devw[spd[SPD_ORGANIZATION] & 7]; - int busw = spd_busw[spd[SPD_BUS_DEV_WIDTH] & 7]; + int ranks = spd_ranks[(spd[DDR3_ORGANIZATION] >> 3) & 7]; + int devw = spd_devw[spd[DDR3_ORGANIZATION] & 7]; + int busw = spd_busw[spd[DDR3_BUS_DEV_WIDTH] & 7];
/* Module type */ printk(BIOS_INFO, "SPD: module type is "); @@ -36,7 +36,7 @@ case SPD_DRAM_DDR3: printk(BIOS_INFO, "DDR3\n"); break; - case SPD_DRAM_LPDDR3: + case SPD_DRAM_LPDDR3_INTEL: printk(BIOS_INFO, "LPDDR3\n"); break; default: @@ -45,8 +45,8 @@ }
/* Module Part Number */ - memcpy(spd_name, &spd[SPD_PART_OFF], SPD_PART_LEN); - spd_name[SPD_PART_LEN] = 0; + memcpy(spd_name, &spd[DDR3_SPD_PART_OFF], DDR3_SPD_PART_LEN); + spd_name[DDR3_SPD_PART_LEN] = 0; printk(BIOS_INFO, "SPD: module part is %s\n", spd_name);
printk(BIOS_INFO, @@ -84,16 +84,16 @@ die("SPD data not found.");
/* make sure we have at least one SPD in the file. */ - if (spd_file_len < SPD_LEN) + if (spd_file_len < SPD_PAGE_LEN) die("Missing SPD data.");
/* Make sure we did not overrun the buffer */ - if (spd_file_len < ((spd_index + 1) * SPD_LEN)) { + if (spd_file_len < ((spd_index + 1) * SPD_PAGE_LEN)) { printk(BIOS_ERR, "SPD index override to 1 - old hardware?\n"); spd_index = 1; }
- const size_t spd_offset = spd_index * SPD_LEN; + const size_t spd_offset = spd_index * SPD_PAGE_LEN; /* Make sure a valid SPD was found */ if (spd_file[spd_offset] == 0) die("Invalid SPD data."); diff --git a/src/mainboard/google/glados/spd/spd.h b/src/mainboard/google/glados/spd/spd.h index 764958b..02e9c7c 100644 --- a/src/mainboard/google/glados/spd/spd.h +++ b/src/mainboard/google/glados/spd/spd.h @@ -3,17 +3,8 @@ #ifndef MAINBOARD_SPD_H #define MAINBOARD_SPD_H
-#define SPD_LEN 256 +#include <spd_bin.h>
-#define SPD_DRAM_TYPE 2 -#define SPD_DRAM_DDR3 0x0b -#define SPD_DRAM_LPDDR3 0xf1 -#define SPD_DENSITY_BANKS 4 -#define SPD_ADDRESSING 5 -#define SPD_ORGANIZATION 7 -#define SPD_BUS_DEV_WIDTH 8 -#define SPD_PART_OFF 128 -#define SPD_PART_LEN 18 #define SPD_MANU_OFF 148
#endif