the following patch was just integrated into master:
commit ded1e05d11675d899e07906e04032b3cc2f29711
Author: Patrick Georgi <pgeorgi(a)chromium.org>
Date: Thu Dec 15 15:21:56 2016 +0100
util/romcc: Don't reference a variable after checking it for NULL
Change-Id: Ic8e850bdf75d38fc061fb3a8c55d38bcf09c305a
Signed-off-by: Patrick Georgi <pgeorgi(a)chromium.org>
Found-by: Coverity Scan #1129146
Reviewed-on: https://review.coreboot.org/17886
Tested-by: build bot (Jenkins)
Reviewed-by: Nico Huber <nico.h(a)gmx.de>
See https://review.coreboot.org/17886 for details.
-gerrit
the following patch was just integrated into master:
commit 44a46a1f041ad7101cfe3c2dcb94b1406bd4246b
Author: Patrick Georgi <pgeorgi(a)chromium.org>
Date: Sat Jan 28 13:12:09 2017 +0100
device/dram: use global DIMM_SPD_SIZE Kconfig variable
Also make sure that no board changes behaviour because of that by adding
a static assert.
TEST=abuild over all builds still succeeds (where it doesn't if
DIMM_SPD_SIZE isn't set to 128 bytes for boards that use the
device/dram code).
Change-Id: Iddb962b16857ee859ddcf1b52d18da9b3be56449
Signed-off-by: Patrick Georgi <pgeorgi(a)chromium.org>
Reviewed-on: https://review.coreboot.org/18254
Reviewed-by: Aaron Durbin <adurbin(a)chromium.org>
Tested-by: build bot (Jenkins)
See https://review.coreboot.org/18254 for details.
-gerrit
Subrata Banik (subrata.banik(a)intel.com) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/18287
-gerrit
commit ef4f3e02bf2215d70dcdf1fb3dee258c39d3dcda
Author: Subrata Banik <subrata.banik(a)intel.com>
Date: Fri Feb 3 18:57:49 2017 +0530
soc/intel/skylake: Perform CPU MP Init before FSP-S Init
As per BWG, CPU MP Init (loading ucode) should be done prior
to BIOS_RESET_CPL. Hence, pull MP Init to BS_DEV_INIT_CHIPS Entry
(before FSP-S call).
BUG=chrome-os-partner:62438
BRANCH=NONE
TEST=Boot to OS with all threads enabled.
Change-Id: Ia6f83d466fb27e1290da84abe7832dc814b5273a
Signed-off-by: Subrata Banik <subrata.banik(a)intel.com>
---
src/soc/intel/skylake/chip.c | 4 +--
src/soc/intel/skylake/chip_fsp20.c | 4 +--
src/soc/intel/skylake/cpu.c | 35 +++++++++++++++-------
src/soc/intel/skylake/include/fsp11/soc/ramstage.h | 3 +-
src/soc/intel/skylake/include/fsp20/soc/ramstage.h | 3 +-
5 files changed, 31 insertions(+), 18 deletions(-)
diff --git a/src/soc/intel/skylake/chip.c b/src/soc/intel/skylake/chip.c
index c64a8df..060c4ee 100644
--- a/src/soc/intel/skylake/chip.c
+++ b/src/soc/intel/skylake/chip.c
@@ -2,7 +2,7 @@
* This file is part of the coreboot project.
*
* Copyright (C) 2014 Google Inc.
- * Copyright (C) 2015 Intel Corporation.
+ * Copyright (C) 2015-2017 Intel Corporation.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -49,7 +49,7 @@ static struct device_operations pci_domain_ops = {
};
static struct device_operations cpu_bus_ops = {
- .init = &soc_init_cpus,
+ .init = DEVICE_NOOP,
#if IS_ENABLED(CONFIG_HAVE_ACPI_TABLES)
.acpi_fill_ssdt_generator = generate_cpu_entries,
#endif
diff --git a/src/soc/intel/skylake/chip_fsp20.c b/src/soc/intel/skylake/chip_fsp20.c
index ebd3134..f1a32c4 100644
--- a/src/soc/intel/skylake/chip_fsp20.c
+++ b/src/soc/intel/skylake/chip_fsp20.c
@@ -1,7 +1,7 @@
/*
* This file is part of the coreboot project.
*
- * Copyright (C) 2016 Intel Corporation.
+ * Copyright (C) 2016-2017 Intel Corporation.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -59,7 +59,7 @@ static struct device_operations cpu_bus_ops = {
.read_resources = DEVICE_NOOP,
.set_resources = DEVICE_NOOP,
.enable_resources = DEVICE_NOOP,
- .init = &soc_init_cpus,
+ .init = DEVICE_NOOP,
#if IS_ENABLED(CONFIG_HAVE_ACPI_TABLES)
.acpi_fill_ssdt_generator = generate_cpu_entries,
#endif
diff --git a/src/soc/intel/skylake/cpu.c b/src/soc/intel/skylake/cpu.c
index e8616f0..fd726c8 100644
--- a/src/soc/intel/skylake/cpu.c
+++ b/src/soc/intel/skylake/cpu.c
@@ -3,7 +3,7 @@
*
* Copyright (C) 2007-2009 coresystems GmbH
* Copyright (C) 2014 Google Inc.
- * Copyright (C) 2015 Intel Corporation.
+ * Copyright (C) 2015-2017 Intel Corporation.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -15,6 +15,8 @@
* GNU General Public License for more details.
*/
+#include <assert.h>
+#include <bootstate.h>
#include <console/console.h>
#include <device/device.h>
#include <device/pci.h>
@@ -397,13 +399,6 @@ static const struct cpu_driver driver __cpu_driver = {
static const void *microcode_patch;
static int ht_disabled;
-static void pre_mp_init(void)
-{
- /* Setup MTRRs based on physical address size. */
- x86_setup_mtrrs_with_detect();
- x86_mtrr_check();
-}
-
static int get_cpu_count(void)
{
msr_t msr;
@@ -463,7 +458,12 @@ static void post_mp_init(void)
}
static const struct mp_ops mp_ops = {
- .pre_mp_init = pre_mp_init,
+ /*
+ * Skip Pre MP init MTRR programming as MTRRs are mirrored from BSP,
+ * that are set prior to ramstage.
+ * Real MTRRs programming are being done after resource allocation.
+ */
+ .pre_mp_init = NULL,
.get_cpu_count = get_cpu_count,
.get_smm_info = smm_info,
.get_microcode_info = get_microcode_info,
@@ -474,8 +474,10 @@ static const struct mp_ops mp_ops = {
.post_mp_init = post_mp_init,
};
-void soc_init_cpus(device_t dev)
+static void soc_init_cpus(void *unused)
{
+ device_t dev = dev_find_path(NULL, DEVICE_PATH_CPU_CLUSTER);
+ assert(dev != NULL);
struct bus *cpu_bus = dev->link_list;
if (mp_init_with_smm(cpu_bus, &mp_ops)) {
@@ -486,6 +488,13 @@ void soc_init_cpus(device_t dev)
configure_thermal_target();
}
+/* Ensure to re-program all MTRRs based on DRAM resource settings */
+static void soc_post_cpus_init(void *unused)
+{
+ if (mp_run_on_all_cpus(&x86_setup_mtrrs_with_detect, 1000) < 0)
+ printk(BIOS_ERR, "MTRR programming failure\n");
+}
+
int soc_skip_ucode_update(u32 current_patch_id, u32 new_patch_id)
{
msr_t msr;
@@ -498,3 +507,9 @@ int soc_skip_ucode_update(u32 current_patch_id, u32 new_patch_id)
msr = rdmsr(MTRR_CAP_MSR);
return (msr.lo & PRMRR_SUPPORTED) && (current_patch_id == new_patch_id - 1);
}
+
+/*
+ * Do CPU MP Init before FSP Silicon Init
+ */
+BOOT_STATE_INIT_ENTRY(BS_DEV_INIT_CHIPS, BS_ON_ENTRY, soc_init_cpus, NULL);
+BOOT_STATE_INIT_ENTRY(BS_DEV_INIT, BS_ON_EXIT, soc_post_cpus_init, NULL);
diff --git a/src/soc/intel/skylake/include/fsp11/soc/ramstage.h b/src/soc/intel/skylake/include/fsp11/soc/ramstage.h
index 8df7796..f1a9e53 100644
--- a/src/soc/intel/skylake/include/fsp11/soc/ramstage.h
+++ b/src/soc/intel/skylake/include/fsp11/soc/ramstage.h
@@ -2,7 +2,7 @@
* This file is part of the coreboot project.
*
* Copyright (C) 2014 Google Inc.
- * Copyright (C) 2015 Intel Corporation.
+ * Copyright (C) 2015-2017 Intel Corporation.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -29,7 +29,6 @@
void soc_irq_settings(FSP_SIL_UPD *params);
void pch_enable_dev(device_t dev);
void soc_init_pre_device(void *chip_info);
-void soc_init_cpus(device_t dev);
const char *soc_acpi_name(struct device *dev);
int init_igd_opregion(igd_opregion_t *igd_opregion);
extern struct pci_operations soc_pci_ops;
diff --git a/src/soc/intel/skylake/include/fsp20/soc/ramstage.h b/src/soc/intel/skylake/include/fsp20/soc/ramstage.h
index 0ae87f4..136c4f2 100644
--- a/src/soc/intel/skylake/include/fsp20/soc/ramstage.h
+++ b/src/soc/intel/skylake/include/fsp20/soc/ramstage.h
@@ -2,7 +2,7 @@
* This file is part of the coreboot project.
*
* Copyright (C) 2014 Google Inc.
- * Copyright (C) 2015 Intel Corporation.
+ * Copyright (C) 2015-2017 Intel Corporation.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -29,7 +29,6 @@
void mainboard_silicon_init_params(FSP_S_CONFIG *params);
void pch_enable_dev(device_t dev);
void soc_init_pre_device(void *chip_info);
-void soc_init_cpus(device_t dev);
void soc_irq_settings(FSP_SIL_UPD *params);
const char *soc_acpi_name(struct device *dev);
Arthur Heymans (arthur(a)aheymans.xyz) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/18320
-gerrit
commit 49004dc4c399675e6cccca895e236e59f137d008
Author: Arthur Heymans <arthur(a)aheymans.xyz>
Date: Fri Feb 10 12:08:16 2017 +0100
device/dram/ddr2: Add common function to select common CAS en freq
This function finds highest common CAS and select tCLK based on
the dimm with highest minumum tCLK at that CAS.
Change-Id: I3ab39d38a243edddfde8f70ebd23f79ff774e90e
Signed-off-by: Arthur Heymans <arthur(a)aheymans.xyz>
---
src/device/dram/ddr2.c | 33 +++++++++++++++++++++++++++++++++
src/include/device/dram/ddr2.h | 15 ++++++++++++++-
2 files changed, 47 insertions(+), 1 deletion(-)
diff --git a/src/device/dram/ddr2.c b/src/device/dram/ddr2.c
index b712192..67d6868 100644
--- a/src/device/dram/ddr2.c
+++ b/src/device/dram/ddr2.c
@@ -2,6 +2,7 @@
* This file is part of the coreboot project.
*
* Copyright (C) 2017 Patrick Rudolph <siro(a)das-labor.org>
+ * Copyright (C) 2017 Arthur Heymans <arthur(a)aheymans.xyz>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -593,3 +594,35 @@ void dram_print_spd_ddr2(const dimm_attr *dimm)
print_us(" tPLL : ", dimm->tPLL);
print_us(" tRR : ", dimm->tRR);
}
+
+u32 get_common_freq_cas(u8 max_freq, u8 cas_mask, const dimm_attr *dimm,
+ int num_dimms, u8 *selected_cas)
+{
+ int i, high_supp_cas;
+ u32 tCLK = 0;
+
+ for (i = 0; i < num_dimms; i++) {
+ if (dimm[i].dimm_type == SPD_DIMM_TYPE_UNDEFINED)
+ continue;
+ cas_mask &= dimm[i].cas_supported;
+ }
+
+ if (!cas_mask) {
+ printk(BIOS_DEBUG, "No common supported CAS\n");
+ return 0;
+ }
+
+ high_common_cas = spd_get_msbs(cas_mask);
+ for (i = 0; i < num_dimms; i++) {
+ if (dimm[i].dimm_type == SPD_DIMM_TYPE_UNDEFINED)
+ continue;
+ if (dimm[i].cycle_time[high_supp_cas] == 0)
+ printk(BIOS_DEBUG, "No minimum tCLK defined for dimm %d at CAS %d\n",
+ i, high_supp_cas);
+ if (tCLK < dimm[i].cycle_time[high_supp_cas])
+ tCLK = dimm[i].cycle_time[high_supp_cas];
+ }
+
+ *selected_cas = high_common_cas;
+ return tCLK;
+}
diff --git a/src/include/device/dram/ddr2.h b/src/include/device/dram/ddr2.h
index 236be49..8bfcfc1 100644
--- a/src/include/device/dram/ddr2.h
+++ b/src/include/device/dram/ddr2.h
@@ -46,6 +46,18 @@
#define TCK_333MHZ 768
#define TCK_266MHZ 960
#define TCK_200MHZ 1280
+
+enum dram_freq {
+ DDR2_200MHZ,
+ DDR2_266MHZ,
+ DDR2_333MHZ,
+ DDR2_400MHZ,
+ DDR2_533MHZ,
+ DDR2_666MHZ,
+ DDR2_700MHZ,
+ DDR2_800MHZ,
+};
+
/** @} */
/**
@@ -198,6 +210,7 @@ u32 spd_decode_spd_size_ddr2(u8 byte0);
u32 spd_decode_eeprom_size_ddr2(u8 byte1);
int spd_decode_ddr2(dimm_attr *dimm, spd_raw_data spd);
void dram_print_spd_ddr2(const dimm_attr *dimm);
-
+int get_common_freq_cas(u8 max_freq, u8 cas_mask, const dimm_attr *dimm,
+ int num_dimms, u8 *selected_freq, u8 *selected_cas);
#endif /* DEVICE_DRAM_DDR2L_H */