nb/intel/haswell: Move SPD addresses to devicetree

Introduce a sandybridge-style devicetree setting for SPD addresses,
and use it instead of runtime code in mb_get_spd_map() for all
haswell boards without CONFIG(HAVE_SPD_IN_CBFS) - effectively all
boards except google/slippy.

Patch also covers recently added Z97 boards using Broadwell MRC.

Also update util/autoport to match.

abuild passes for all affected boards.
autoport builds, but otherwise untested.

Change-Id: I574aec9cb6a47c8aaf275ae06c7e1fb695534b34
Signed-off-by: Keith Hui <buurin@gmail.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/79025
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
Keith Hui 2023-11-11 17:25:48 -05:00 committed by Felix Held
commit b4f47e8067
42 changed files with 43 additions and 145 deletions

View file

@ -3,6 +3,7 @@ chip northbridge/intel/haswell
# This mainboard has VGA
register "gpu_ddi_e_connected" = "1"
register "spd_addresses" = "{0x50, 0x51, 0x52, 0x53}"
chip cpu/intel/haswell
device cpu_cluster 0 on ops haswell_cpu_bus_ops end
end

View file

@ -1,7 +1,6 @@
/* SPDX-License-Identifier: GPL-2.0-only */
#include <northbridge/intel/haswell/haswell.h>
#include <northbridge/intel/haswell/raminit.h>
#include <southbridge/intel/lynxpoint/pch.h>
void mainboard_config_rcba(void)
@ -16,14 +15,6 @@ void mainboard_config_rcba(void)
RCBA16(D20IR) = DIR_ROUTE(PIRQA, PIRQB, PIRQC, PIRQD);
}
void mb_get_spd_map(struct spd_info *spdi)
{
spdi->addresses[0] = 0x50;
spdi->addresses[1] = 0x51;
spdi->addresses[2] = 0x52;
spdi->addresses[3] = 0x53;
}
const struct usb2_port_config mainboard_usb2_ports[MAX_USB2_PORTS] = {
/* Length, Enable, OCn#, Location */
{ 0x0040, 1, 0, USB_PORT_BACK_PANEL },

View file

@ -1,4 +1,5 @@
chip northbridge/intel/haswell
register "spd_addresses" = "{0x50, 0x51, 0x52, 0x53}"
chip cpu/intel/haswell
device cpu_cluster 0 on
ops haswell_cpu_bus_ops

View file

@ -1,21 +1,12 @@
/* SPDX-License-Identifier: GPL-2.0-only */
#include <northbridge/intel/haswell/haswell.h>
#include <northbridge/intel/haswell/raminit.h>
#include <southbridge/intel/lynxpoint/pch.h>
void mainboard_config_rcba(void)
{
}
void mb_get_spd_map(struct spd_info *spdi)
{
spdi->addresses[0] = 0x50;
spdi->addresses[1] = 0x51;
spdi->addresses[2] = 0x52;
spdi->addresses[3] = 0x53;
}
const struct usb2_port_config mainboard_usb2_ports[MAX_USB2_PORTS] = {
/* Length, Enable, OCn#, Location */
{ 0x0040, 1, 0, USB_PORT_FLEX },

View file

@ -2,6 +2,7 @@
chip northbridge/intel/haswell
register "gpu_ddi_e_connected" = "1"
register "spd_addresses" = "{0x50, 0, 0x52, 0}"
chip cpu/intel/haswell
device cpu_cluster 0 on ops haswell_cpu_bus_ops end

View file

@ -1,7 +1,6 @@
/* SPDX-License-Identifier: GPL-2.0-only */
#include <northbridge/intel/haswell/haswell.h>
#include <northbridge/intel/haswell/raminit.h>
#include <southbridge/intel/lynxpoint/pch.h>
void mainboard_config_rcba(void)
@ -16,12 +15,6 @@ void mainboard_config_rcba(void)
RCBA16(D20IR) = DIR_ROUTE(PIRQA, PIRQB, PIRQC, PIRQD);
}
void mb_get_spd_map(struct spd_info *spdi)
{
spdi->addresses[0] = 0x50;
spdi->addresses[2] = 0x52;
}
const struct usb2_port_config mainboard_usb2_ports[MAX_USB2_PORTS] = {
/* Length, Enable, OCn#, Location */
{ 0x0040, 1, 0, USB_PORT_BACK_PANEL },

View file

@ -1,6 +1,7 @@
## SPDX-License-Identifier: GPL-2.0-or-later
chip northbridge/intel/haswell
register "spd_addresses" = "{0x50, 0, 0x52, 0}"
chip cpu/intel/haswell
device cpu_cluster 0 on ops haswell_cpu_bus_ops end
end

View file

@ -1,19 +1,12 @@
/* SPDX-License-Identifier: GPL-2.0-only */
#include <northbridge/intel/haswell/haswell.h>
#include <northbridge/intel/haswell/raminit.h>
#include <southbridge/intel/lynxpoint/pch.h>
void mainboard_config_rcba(void)
{
}
void mb_get_spd_map(struct spd_info *spdi)
{
spdi->addresses[0] = 0x50;
spdi->addresses[2] = 0x52;
}
const struct usb2_port_config mainboard_usb2_ports[MAX_USB2_PORTS] = {
/* Length, Enable, OCn#, Location */
{ 0x0040, 1, 0, USB_PORT_FLEX },

View file

@ -2,6 +2,7 @@
chip northbridge/intel/haswell
register "gpu_dp_c_hotplug" = "4"
register "spd_addresses" = "{0x50, 0x51, 0x52, 0x53}"
chip cpu/intel/haswell
device cpu_cluster 0 on

View file

@ -1,21 +1,12 @@
/* SPDX-License-Identifier: GPL-2.0-only */
#include <northbridge/intel/haswell/haswell.h>
#include <northbridge/intel/haswell/raminit.h>
#include <southbridge/intel/lynxpoint/pch.h>
void mainboard_config_rcba(void)
{
}
void mb_get_spd_map(struct spd_info *spdi)
{
spdi->addresses[0] = 0x50;
spdi->addresses[1] = 0x51;
spdi->addresses[2] = 0x52;
spdi->addresses[3] = 0x53;
}
const struct usb2_port_config mainboard_usb2_ports[MAX_USB2_PORTS] = {
/* Length, Enable, OCn#, Location */
{ 0x0040, 1, 0, USB_PORT_FLEX },

View file

@ -8,6 +8,7 @@ chip northbridge/intel/haswell
# This mainboard has a DP output
register "gpu_dp_c_hotplug" = "7"
register "spd_addresses" = "{0x50, 0x51, 0x52, 0x53}"
chip cpu/intel/haswell
device cpu_cluster 0 on ops haswell_cpu_bus_ops end
end

View file

@ -1,21 +1,12 @@
/* SPDX-License-Identifier: GPL-2.0-only */
#include <northbridge/intel/haswell/haswell.h>
#include <northbridge/intel/haswell/raminit.h>
#include <southbridge/intel/lynxpoint/pch.h>
void mainboard_config_rcba(void)
{
}
void mb_get_spd_map(struct spd_info *spdi)
{
spdi->addresses[0] = 0x50;
spdi->addresses[1] = 0x51;
spdi->addresses[2] = 0x52;
spdi->addresses[3] = 0x53;
}
const struct usb2_port_config mainboard_usb2_ports[MAX_USB2_PORTS] = {
{ 0x0110, 1, USB_OC_PIN_SKIP, USB_PORT_FRONT_PANEL }, /* USB3_4_5 */
{ 0x0110, 1, USB_OC_PIN_SKIP, USB_PORT_FRONT_PANEL }, /* USB3_4_5 */

View file

@ -3,6 +3,7 @@ chip northbridge/intel/haswell
register "gpu_dp_b_hotplug" = "4"
register "gpu_dp_c_hotplug" = "4"
register "gpu_dp_d_hotplug" = "4"
register "spd_addresses" = "{0x50, 0, 0x52, 0}"
chip cpu/intel/haswell
device cpu_cluster 0 on

View file

@ -1,19 +1,12 @@
/* SPDX-License-Identifier: GPL-2.0-only */
#include <northbridge/intel/haswell/haswell.h>
#include <northbridge/intel/haswell/raminit.h>
#include <southbridge/intel/lynxpoint/pch.h>
void mainboard_config_rcba(void)
{
}
void mb_get_spd_map(struct spd_info *spdi)
{
spdi->addresses[0] = 0x50;
spdi->addresses[2] = 0x52;
}
const struct usb2_port_config mainboard_usb2_ports[MAX_USB2_PORTS] = {
/* Length, Enable, OCn#, Location */
{ 0x0040, 1, 0, USB_PORT_FLEX },

View file

@ -2,6 +2,7 @@
chip northbridge/intel/haswell
register "ec_present" = "true"
register "spd_addresses" = "{0x50, 0, 0x52, 0}"
chip cpu/intel/haswell
device cpu_cluster 0 on ops haswell_cpu_bus_ops end

View file

@ -2,7 +2,6 @@
#include <stdint.h>
#include <northbridge/intel/haswell/haswell.h>
#include <northbridge/intel/haswell/raminit.h>
#include <southbridge/intel/lynxpoint/pch.h>
void mainboard_config_rcba(void)
@ -17,12 +16,6 @@ void mainboard_config_rcba(void)
RCBA16(D20IR) = DIR_ROUTE(PIRQA, PIRQB, PIRQC, PIRQD);
}
void mb_get_spd_map(struct spd_info *spdi)
{
spdi->addresses[0] = 0x50;
spdi->addresses[2] = 0x52;
}
const struct usb2_port_config mainboard_usb2_ports[MAX_USB2_PORTS] = {
/* Length, Enable, OCn#, Location */
{ 0x0040, 1, 0, USB_PORT_BACK_PANEL }, /* dock left */

View file

@ -3,6 +3,7 @@
chip northbridge/intel/haswell
# This mainboard has VGA
register "gpu_ddi_e_connected" = "1"
register "spd_addresses" = "{0x50, 0x51, 0x52, 0x53}"
chip cpu/intel/haswell
device cpu_cluster 0 on ops haswell_cpu_bus_ops end

View file

@ -1,6 +1,5 @@
/* SPDX-License-Identifier: GPL-2.0-only */
#include <northbridge/intel/haswell/raminit.h>
#include <southbridge/intel/lynxpoint/pch.h>
void mainboard_config_rcba(void)
@ -15,14 +14,6 @@ void mainboard_config_rcba(void)
RCBA16(D20IR) = DIR_ROUTE(PIRQD, PIRQC, PIRQB, PIRQA);
}
void mb_get_spd_map(struct spd_info *spdi)
{
spdi->addresses[0] = 0x50;
spdi->addresses[1] = 0x51;
spdi->addresses[2] = 0x52;
spdi->addresses[3] = 0x53;
}
const struct usb2_port_config mainboard_usb2_ports[MAX_USB2_PORTS] = {
/* Length, Enable, OCn#, Location */
{0x0000, 0, USB_OC_PIN_SKIP, USB_PORT_SKIP},

View file

@ -13,6 +13,7 @@ chip northbridge/intel/haswell
register "usb_xhci_on_resume" = "true"
register "spd_addresses" = "{0x50, 0, 0x52, 0}"
chip cpu/intel/haswell
device cpu_cluster 0 on ops haswell_cpu_bus_ops end
end

View file

@ -1,7 +1,6 @@
/* SPDX-License-Identifier: GPL-2.0-only */
#include <northbridge/intel/haswell/haswell.h>
#include <northbridge/intel/haswell/raminit.h>
#include <southbridge/intel/lynxpoint/pch.h>
void mainboard_config_rcba(void)
@ -39,12 +38,6 @@ void mainboard_config_rcba(void)
RCBA16(D23IR) = DIR_ROUTE(PIRQH, PIRQH, PIRQH, PIRQH); /* SDIO */
}
void mb_get_spd_map(struct spd_info *spdi)
{
spdi->addresses[0] = 0x50;
spdi->addresses[2] = 0x52;
}
const struct usb2_port_config mainboard_usb2_ports[MAX_USB2_PORTS] = {
/* Length, Enable, OCn#, Location */
{ 0x0064, 1, 0, /* P0: VP8 */

View file

@ -13,6 +13,7 @@ chip northbridge/intel/haswell
.backlight_pwm_hz = 200,
}"
register "usb_xhci_on_resume" = "true"
register "spd_addresses" = "{0x50, 0, 0x52, 0}"
chip cpu/intel/haswell
device cpu_cluster 0 on ops haswell_cpu_bus_ops end
end

View file

@ -1,7 +1,6 @@
/* SPDX-License-Identifier: GPL-2.0-only */
#include <northbridge/intel/haswell/haswell.h>
#include <northbridge/intel/haswell/raminit.h>
#include <southbridge/intel/lynxpoint/pch.h>
void mainboard_config_rcba(void)
@ -16,12 +15,6 @@ void mainboard_config_rcba(void)
RCBA16(D20IR) = DIR_ROUTE(PIRQA, PIRQB, PIRQC, PIRQD);
}
void mb_get_spd_map(struct spd_info *spdi)
{
spdi->addresses[0] = 0x50;
spdi->addresses[2] = 0x52;
}
const struct usb2_port_config mainboard_usb2_ports[MAX_USB2_PORTS] = {
/* Length, Enable, OCn#, Location */
{ 0x0080, 1, USB_OC_PIN_SKIP, USB_PORT_BACK_PANEL }, /* dock */

View file

@ -11,6 +11,7 @@ chip northbridge/intel/haswell
# Enable DVI Hotplug with 6ms pulse
register "gpu_dp_b_hotplug" = "0x06"
register "spd_addresses" = "{0x50, 0x51, 0x52, 0x53}"
chip cpu/intel/haswell
device cpu_cluster 0 on ops haswell_cpu_bus_ops end
end

View file

@ -1,7 +1,6 @@
/* SPDX-License-Identifier: GPL-2.0-only */
#include <northbridge/intel/haswell/haswell.h>
#include <northbridge/intel/haswell/raminit.h>
#include <southbridge/intel/lynxpoint/pch.h>
void mainboard_config_rcba(void)
@ -40,14 +39,6 @@ void mainboard_config_rcba(void)
RCBA16(D22IR) = DIR_ROUTE(PIRQA, PIRQB, PIRQC, PIRQD);
}
void mb_get_spd_map(struct spd_info *spdi)
{
spdi->addresses[0] = 0x50;
spdi->addresses[1] = 0x51;
spdi->addresses[2] = 0x52;
spdi->addresses[3] = 0x53;
}
const struct usb2_port_config mainboard_usb2_ports[MAX_USB2_PORTS] = {
/* Length, Enable, OCn#, Location */
{ 0x0040, 1, 0, /* P0: Back USB3 port (OC0) */

View file

@ -2,7 +2,6 @@
#include <stdint.h>
#include <northbridge/intel/haswell/haswell.h>
#include <northbridge/intel/haswell/raminit.h>
#include <southbridge/intel/lynxpoint/pch.h>
#include <option.h>
#include <ec/lenovo/pmh7/pmh7.h>

View file

@ -13,6 +13,7 @@ chip northbridge/intel/haswell
.backlight_pwm_hz = 220,
}"
register "ec_present" = "true"
register "spd_addresses" = "{0x50, 0, 0x51, 0}"
chip cpu/intel/haswell
device cpu_cluster 0 on ops haswell_cpu_bus_ops end
end

View file

@ -1,16 +1,8 @@
/* SPDX-License-Identifier: GPL-2.0-only */
#include <stdint.h>
#include <northbridge/intel/haswell/haswell.h>
#include <northbridge/intel/haswell/raminit.h>
#include <southbridge/intel/lynxpoint/pch.h>
void mb_get_spd_map(struct spd_info *spdi)
{
spdi->addresses[0] = 0x50;
spdi->addresses[2] = 0x51;
}
const struct usb2_port_config mainboard_usb2_ports[MAX_USB2_PORTS] = {
/* Length, Enable, OCn#, Location */
{ 0x0040, 1, 0, USB_PORT_BACK_PANEL }, /* USB3 */

View file

@ -13,6 +13,7 @@ chip northbridge/intel/haswell
.backlight_pwm_hz = 220,
}"
register "ec_present" = "true"
register "spd_addresses" = "{0x50, 0x52, 0x51, 0x53}"
chip cpu/intel/haswell
device cpu_cluster 0 on ops haswell_cpu_bus_ops end
end

View file

@ -2,19 +2,10 @@
#include <stdint.h>
#include <northbridge/intel/haswell/haswell.h>
#include <northbridge/intel/haswell/raminit.h>
#include <southbridge/intel/lynxpoint/pch.h>
#include <ec/lenovo/pmh7/pmh7.h>
#include <device/pci_ops.h>
void mb_get_spd_map(struct spd_info *spdi)
{
spdi->addresses[0] = 0x50;
spdi->addresses[1] = 0x52;
spdi->addresses[2] = 0x51;
spdi->addresses[3] = 0x53;
}
const struct usb2_port_config mainboard_usb2_ports[MAX_USB2_PORTS] = {
/* Length, Enable, OCn#, Location */
{ 0x0040, 1, 0, USB_PORT_BACK_PANEL },

View file

@ -2,6 +2,7 @@
chip northbridge/intel/haswell
register "gpu_ddi_e_connected" = "1"
register "spd_addresses" = "{0x50, 0, 0x52, 0}"
chip cpu/intel/haswell
device cpu_cluster 0 on ops haswell_cpu_bus_ops end
end

View file

@ -1,7 +1,6 @@
/* SPDX-License-Identifier: GPL-2.0-only */
#include <northbridge/intel/haswell/haswell.h>
#include <northbridge/intel/haswell/raminit.h>
#include <southbridge/intel/lynxpoint/pch.h>
void mainboard_config_rcba(void)
@ -16,12 +15,6 @@ void mainboard_config_rcba(void)
RCBA16(D20IR) = DIR_ROUTE(PIRQA, PIRQB, PIRQC, PIRQD);
}
void mb_get_spd_map(struct spd_info *spdi)
{
spdi->addresses[0] = 0x50;
spdi->addresses[2] = 0x52;
}
const struct usb2_port_config mainboard_usb2_ports[MAX_USB2_PORTS] = {
/* Length, Enable, OCn#, Location */
{ 0x0040, 1, 0, USB_PORT_BACK_PANEL },

View file

@ -1,6 +1,7 @@
## SPDX-License-Identifier: GPL-2.0-or-later
chip northbridge/intel/haswell
register "spd_addresses" = "{0x50, 0x51, 0x52, 0x53}"
chip cpu/intel/haswell
device cpu_cluster 0 on ops haswell_cpu_bus_ops end

View file

@ -1,7 +1,6 @@
/* SPDX-License-Identifier: GPL-2.0-only */
#include <northbridge/intel/haswell/haswell.h>
#include <northbridge/intel/haswell/raminit.h>
#include <southbridge/intel/lynxpoint/pch.h>
void mainboard_config_rcba(void)
@ -16,14 +15,6 @@ void mainboard_config_rcba(void)
RCBA16(D20IR) = DIR_ROUTE(PIRQA, PIRQB, PIRQC, PIRQD);
}
void mb_get_spd_map(struct spd_info *spdi)
{
spdi->addresses[0] = 0x50;
spdi->addresses[1] = 0x51;
spdi->addresses[2] = 0x52;
spdi->addresses[3] = 0x53;
}
const struct usb2_port_config mainboard_usb2_ports[MAX_USB2_PORTS] = {
/* Length, Enable, OCn#, Location */
{ 0x0040, 1, 0, USB_PORT_INTERNAL },

View file

@ -16,6 +16,7 @@ romstage-y += memmap.c
romstage-y += romstage.c
romstage-y += early_init.c
romstage-y += report_platform.c
romstage-y += raminit_shared.c
postcar-y += memmap.c

View file

@ -374,9 +374,8 @@ void perform_raminit(const int s3resume)
/* Broadwell MRC uses ACPI values for boot_mode */
pei_data.boot_mode = s3resume ? ACPI_S3 : ACPI_S0;
/* Obtain the SPD addresses from mainboard code */
struct spd_info spdi = {0};
mb_get_spd_map(&spdi);
get_spd_info(&spdi, cfg);
/*
* Read the SPDs over SMBus in coreboot code so that the data can be used to

View file

@ -39,6 +39,8 @@ struct northbridge_intel_haswell_config {
bool usb_xhci_on_resume;
struct i915_gpu_controller_info gfx;
u8 spd_addresses[4];
};
#endif /* NORTHBRIDGE_INTEL_HASWELL_CHIP_H */

View file

@ -391,9 +391,8 @@ void perform_raminit(const int s3resume)
/* MRC has hardcoded assumptions of 2 meaning S3 wake. Normalize it here. */
pei_data.boot_mode = s3resume ? 2 : 0;
/* Obtain the SPD addresses from mainboard code */
struct spd_info spdi = {0};
mb_get_spd_map(&spdi);
get_spd_info(&spdi, cfg);
/* MRC expects left-aligned SMBus addresses, and 0xff for memory-down */
for (size_t i = 0; i < ARRAY_SIZE(spdi.addresses); i++) {

View file

@ -5,6 +5,7 @@
#include <console/console.h>
#include <device/dram/ddr3.h>
#include <device/smbus_host.h>
#include <northbridge/intel/haswell/chip.h>
#include <northbridge/intel/haswell/haswell.h>
#include <northbridge/intel/haswell/raminit.h>
#include <string.h>
@ -70,8 +71,9 @@ static void get_spd_for_dimm(struct raminit_dimm_info *const dimm, const uint8_t
static void get_spd_data(struct sysinfo *ctrl)
{
const struct northbridge_intel_haswell_config *cfg = config_of_soc();
struct spd_info spdi = {0};
mb_get_spd_map(&spdi);
get_spd_info(&spdi, cfg);
const uint8_t *cbfs_spd = get_spd_data_from_cbfs(&spdi);
for (uint8_t channel = 0; channel < NUM_CHANNELS; channel++) {
for (uint8_t slot = 0; slot < NUM_SLOTS; slot++) {

View file

@ -4,6 +4,7 @@
#define NORTHBRIDGE_INTEL_HASWELL_RAMINIT_H
#include <types.h>
#include "chip.h"
#define SPD_MEMORY_DOWN 0xff
@ -15,6 +16,7 @@ struct spd_info {
/* Mainboard callback to fill in the SPD addresses */
void mb_get_spd_map(struct spd_info *spdi);
void get_spd_info(struct spd_info *spdi, const struct northbridge_intel_haswell_config *cfg);
void perform_raminit(const int s3resume);
#endif /* NORTHBRIDGE_INTEL_HASWELL_RAMINIT_H */

View file

@ -0,0 +1,16 @@
/* SPDX-License-Identifier: GPL-2.0-only */
#include <string.h>
#include "chip.h"
#include "raminit.h"
void get_spd_info(struct spd_info *spdi, const struct northbridge_intel_haswell_config *cfg)
{
if (CONFIG(HAVE_SPD_IN_CBFS)) {
/* With memory down: from mainboard code */
mb_get_spd_map(spdi);
} else {
/* Without memory down: from devicetree */
memcpy(spdi->addresses, cfg->spd_addresses, ARRAY_SIZE(spdi->addresses));
}
}

View file

@ -65,6 +65,7 @@ func (i haswellmc) Scan(ctx Context, addr PCIDevData) {
"usb_xhci_on_resume": "false",
/* FIXME:XX hardcoded. */
"gfx": "GMA_STATIC_DISPLAYS(0)",
"spd_addresses": "{0x50, 0x51, 0x52, 0x53}\" # FIXME: Put proper SPD map here",
},
Children: []DevTreeNode{
{

View file

@ -272,7 +272,6 @@ void mainboard_config_superio(void)
Add_gpl(sb)
sb.WriteString(`#include <stdint.h>
#include <northbridge/intel/haswell/haswell.h>
#include <northbridge/intel/haswell/raminit.h>
#include <southbridge/intel/lynxpoint/pch.h>
void mainboard_config_rcba(void)
@ -284,15 +283,6 @@ void mb_late_romstage_setup(void)
{
}
void mb_get_spd_map(struct spd_info *spdi)
{
/* FIXME: check this */
spdi->addresses[0] = 0x50;
spdi->addresses[1] = 0x51;
spdi->addresses[2] = 0x52;
spdi->addresses[3] = 0x53;
}
const struct usb2_port_config mainboard_usb2_ports[MAX_USB2_PORTS] = {
/* FIXME: Length and Location are computed from IOBP values, may be inaccurate */
/* Length, Enable, OCn#, Location */