mb/intel/{harcuvar,kunimitsu}: Use <spd.h> and <dram/ddr{3,4}.h>
Change-Id: I2d73f7815e83e8bf0c6d0a402d32bc99c32c7d90 Signed-off-by: Elyes Haouas <ehaouas@noos.fr> Reviewed-on: https://review.coreboot.org/c/coreboot/+/82243 Reviewed-by: Angel Pons <th3fanbus@gmail.com> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
@@ -2,6 +2,8 @@
|
|||||||
|
|
||||||
#include <cbfs.h>
|
#include <cbfs.h>
|
||||||
#include <console/console.h>
|
#include <console/console.h>
|
||||||
|
#include <device/dram/ddr4.h>
|
||||||
|
#include <spd.h>
|
||||||
|
|
||||||
#include "spd.h"
|
#include "spd.h"
|
||||||
|
|
||||||
@@ -19,17 +21,17 @@ uint8_t *mainboard_find_spd_data(void)
|
|||||||
if (!spd_file)
|
if (!spd_file)
|
||||||
die("SPD data not found.");
|
die("SPD data not found.");
|
||||||
|
|
||||||
if (spd_file_len < ((spd_index + 1) * SPD_LEN)) {
|
if (spd_file_len < ((spd_index + 1) * SPD_SIZE_MAX_DDR4)) {
|
||||||
printk(BIOS_ERR,
|
printk(BIOS_ERR,
|
||||||
"SPD index override to 0 due to incorrect SPD index.\n");
|
"SPD index override to 0 due to incorrect SPD index.\n");
|
||||||
spd_index = 0;
|
spd_index = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (spd_file_len < SPD_LEN)
|
if (spd_file_len < SPD_SIZE_MAX_DDR4)
|
||||||
die("Missing SPD data.");
|
die("Missing SPD data.");
|
||||||
|
|
||||||
/* Assume same memory in both channels */
|
/* Assume same memory in both channels */
|
||||||
spd_index *= SPD_LEN;
|
spd_index *= SPD_SIZE_MAX_DDR4;
|
||||||
spd_data = (uint8_t *)(spd_file + spd_index);
|
spd_data = (uint8_t *)(spd_file + spd_index);
|
||||||
|
|
||||||
/* Make sure a valid SPD was found */
|
/* Make sure a valid SPD was found */
|
||||||
|
@@ -5,18 +5,6 @@
|
|||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
#define SPD_LEN 512
|
|
||||||
|
|
||||||
#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
|
|
||||||
|
|
||||||
uint8_t *mainboard_find_spd_data(void);
|
uint8_t *mainboard_find_spd_data(void);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@@ -4,6 +4,9 @@
|
|||||||
#include <gpio.h>
|
#include <gpio.h>
|
||||||
#include "gpio.h"
|
#include "gpio.h"
|
||||||
#include <soc/romstage.h>
|
#include <soc/romstage.h>
|
||||||
|
#include <device/dram/ddr3.h>
|
||||||
|
#include <spd.h>
|
||||||
|
|
||||||
#include "spd/spd.h"
|
#include "spd/spd.h"
|
||||||
|
|
||||||
void mainboard_memory_init_params(FSPM_UPD *mupd)
|
void mainboard_memory_init_params(FSPM_UPD *mupd)
|
||||||
@@ -20,5 +23,5 @@ void mainboard_memory_init_params(FSPM_UPD *mupd)
|
|||||||
mem_cfg->MemorySpdPtr00 = mainboard_get_spd_data();
|
mem_cfg->MemorySpdPtr00 = mainboard_get_spd_data();
|
||||||
if (mainboard_has_dual_channel_mem())
|
if (mainboard_has_dual_channel_mem())
|
||||||
mem_cfg->MemorySpdPtr10 = mem_cfg->MemorySpdPtr00;
|
mem_cfg->MemorySpdPtr10 = mem_cfg->MemorySpdPtr00;
|
||||||
mem_cfg->MemorySpdDataLen = SPD_LEN;
|
mem_cfg->MemorySpdDataLen = SPD_SIZE_MAX_DDR3;
|
||||||
}
|
}
|
||||||
|
@@ -8,19 +8,6 @@
|
|||||||
|
|
||||||
#define MAINBOARD_SPD_H
|
#define MAINBOARD_SPD_H
|
||||||
|
|
||||||
#define SPD_LEN 256
|
|
||||||
|
|
||||||
#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
|
|
||||||
|
|
||||||
#define HYNIX_SINGLE_CHAN 0x1
|
#define HYNIX_SINGLE_CHAN 0x1
|
||||||
#define SAMSUNG_SINGLE_CHAN 0x4
|
#define SAMSUNG_SINGLE_CHAN 0x4
|
||||||
#define MIC_SINGLE_CHAN 0x5
|
#define MIC_SINGLE_CHAN 0x5
|
||||||
|
@@ -1,8 +1,11 @@
|
|||||||
/* SPDX-License-Identifier: GPL-2.0-only */
|
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||||
#include <cbfs.h>
|
#include <cbfs.h>
|
||||||
#include <console/console.h>
|
#include <console/console.h>
|
||||||
|
#include <device/dram/ddr3.h>
|
||||||
|
#include <spd.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include "boardid.h"
|
#include "boardid.h"
|
||||||
#include "spd.h"
|
#include "spd.h"
|
||||||
|
|
||||||
@@ -72,16 +75,16 @@ uintptr_t mainboard_get_spd_data(void)
|
|||||||
die("SPD data not found.");
|
die("SPD data not found.");
|
||||||
|
|
||||||
/* make sure we have at least one SPD in the file. */
|
/* make sure we have at least one SPD in the file. */
|
||||||
if (spd_file_len < SPD_LEN)
|
if (spd_file_len < SPD_SIZE_MAX_DDR3)
|
||||||
die("Missing SPD data.");
|
die("Missing SPD data.");
|
||||||
|
|
||||||
/* Make sure we did not overrun the buffer */
|
/* 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_SIZE_MAX_DDR3)) {
|
||||||
printk(BIOS_ERR, "SPD index override to 0 - old hardware?\n");
|
printk(BIOS_ERR, "SPD index override to 0 - old hardware?\n");
|
||||||
spd_index = 0;
|
spd_index = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
spd_span = spd_index * SPD_LEN;
|
spd_span = spd_index * SPD_SIZE_MAX_DDR3;
|
||||||
return (uintptr_t)(spd_file + spd_span);
|
return (uintptr_t)(spd_file + spd_span);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user