coreboot-gerrit
Threads by month
- ----- 2025 -----
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
March 2022
- 1 participants
- 6700 discussions

Change in coreboot[master]: Revert "console: Update for vboot before bootblock"
by Nico Huber (Code Review) Aug. 7, 2023
by Nico Huber (Code Review) Aug. 7, 2023
Aug. 7, 2023
Hello build bot (Jenkins), Raul Rangel, Martin Roth, Patrick Georgi, Furquan Shaikh, Eric Peers, Aaron Durbin,
I'd like you to do a code review. Please visit
https://review.coreboot.org/c/coreboot/+/42165
to review the following change.
Change subject: Revert "console: Update for vboot before bootblock"
......................................................................
Revert "console: Update for vboot before bootblock"
This reverts commit baba3e961072bfb7ffb4f0031ada27046a58d29e.
Reason for revert: Submitted during review.
Change-Id: I657a6170aba5aba685531380353aa9ba999f9c4e
---
M src/console/Makefile.inc
1 file changed, 2 insertions(+), 4 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/65/42165/1
diff --git a/src/console/Makefile.inc b/src/console/Makefile.inc
index e2a20d7..2154eb9 100644
--- a/src/console/Makefile.inc
+++ b/src/console/Makefile.inc
@@ -11,14 +11,12 @@
smm-y += die.c
smm-y += post.c
-ifneq ($(CONFIG_VBOOT_STARTS_BEFORE_BOOTBLOCK),y)
+verstage-y += init.c
verstage-y += printk.c
+verstage-y += vtxprintf.c vsprintf.c
verstage-y += console.c
-endif
verstage-y += post.c
verstage-y += die.c
-verstage-y += init.c
-verstage-y += vtxprintf.c vsprintf.c
romstage-y += vtxprintf.c printk.c vsprintf.c
romstage-y += init.c console.c
--
To view, visit https://review.coreboot.org/c/coreboot/+/42165
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-Change-Id: I657a6170aba5aba685531380353aa9ba999f9c4e
Gerrit-Change-Number: 42165
Gerrit-PatchSet: 1
Gerrit-Owner: Nico Huber <nico.h(a)gmx.de>
Gerrit-Reviewer: Aaron Durbin <adurbin(a)chromium.org>
Gerrit-Reviewer: Eric Peers <epeers(a)google.com>
Gerrit-Reviewer: Furquan Shaikh <furquan(a)google.com>
Gerrit-Reviewer: Martin Roth <martinroth(a)google.com>
Gerrit-Reviewer: Patrick Georgi <pgeorgi(a)google.com>
Gerrit-Reviewer: Raul Rangel <rrangel(a)chromium.org>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-CC: Kyösti Mälkki <kyosti.malkki(a)gmail.com>
Gerrit-CC: Paul Menzel <paulepanter(a)users.sourceforge.net>
Gerrit-MessageType: newchange
3
4

Change in coreboot[master]: [WIP]mb/intel/minnowmax: Add mainboard
by Arthur Heymans (Code Review) Aug. 7, 2023
by Arthur Heymans (Code Review) Aug. 7, 2023
Aug. 7, 2023
Arthur Heymans has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/44102 )
Change subject: [WIP]mb/intel/minnowmax: Add mainboard
......................................................................
[WIP]mb/intel/minnowmax: Add mainboard
TODO: Fixup SPD handling, Check PCI (vendor disables most)
Working: USB (EHCI and XHCI), SATA, UART, ethernet
Change-Id: I9a1236425c8a0914f92adcad445230ef2692393a
Signed-off-by: Arthur Heymans <arthur(a)aheymans.xyz>
---
A src/mainboard/intel/minnowmax/Kconfig
A src/mainboard/intel/minnowmax/Kconfig.name
A src/mainboard/intel/minnowmax/Makefile.inc
A src/mainboard/intel/minnowmax/acpi/ec.asl
A src/mainboard/intel/minnowmax/acpi/mainboard.asl
A src/mainboard/intel/minnowmax/acpi/superio.asl
A src/mainboard/intel/minnowmax/acpi_tables.c
A src/mainboard/intel/minnowmax/board_info.txt
A src/mainboard/intel/minnowmax/cmos.layout
A src/mainboard/intel/minnowmax/data.vbt
A src/mainboard/intel/minnowmax/devicetree.cb
A src/mainboard/intel/minnowmax/dsdt.asl
A src/mainboard/intel/minnowmax/gpio.c
A src/mainboard/intel/minnowmax/irqroute.c
A src/mainboard/intel/minnowmax/irqroute.h
A src/mainboard/intel/minnowmax/mainboard.c
A src/mainboard/intel/minnowmax/romstage.c
A src/mainboard/intel/minnowmax/spd/micron_2GiB_dimm_MT41K256M16HA-125.spd.hex
M src/soc/intel/baytrail/Makefile.inc
M src/soc/intel/baytrail/refcode.c
20 files changed, 662 insertions(+), 3 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/02/44102/1
diff --git a/src/mainboard/intel/minnowmax/Kconfig b/src/mainboard/intel/minnowmax/Kconfig
new file mode 100644
index 0000000..d7ad307
--- /dev/null
+++ b/src/mainboard/intel/minnowmax/Kconfig
@@ -0,0 +1,50 @@
+##
+## This file is part of the coreboot project.
+##
+## Copyright (C) 2013-2014 Sage Electronic Engineering, LLC.
+## Copyright (C) 2014 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
+## the Free Software Foundation; version 2 of the License.
+##
+## This program is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+## GNU General Public License for more details.
+##
+
+if BOARD_INTEL_MINNOWMAX
+
+config BOARD_SPECIFIC_OPTIONS
+ def_bool y
+ select SOC_INTEL_BAYTRAIL
+ select BOARD_ROMSIZE_KB_8192
+ select HAVE_ACPI_TABLES
+ select HAVE_OPTION_TABLE
+ select ENABLE_BUILTIN_COM1 if CONSOLE_SERIAL
+ select HAVE_ACPI_RESUME
+ select INTEL_GMA_HAVE_VBT
+
+config MAINBOARD_DIR
+ string
+ default "intel/minnowmax"
+
+config MAINBOARD_PART_NUMBER
+ string
+ default "Minnow Max"
+
+config CBFS_SIZE
+ hex
+ default 0x00300000
+
+config POST_DEVICE
+ bool
+ default n
+
+config SEABIOS_HARDWARE_IRQ
+ bool
+ default n
+
+
+endif # BOARD_INTEL_MINNOWMAX
diff --git a/src/mainboard/intel/minnowmax/Kconfig.name b/src/mainboard/intel/minnowmax/Kconfig.name
new file mode 100644
index 0000000..abe9225
--- /dev/null
+++ b/src/mainboard/intel/minnowmax/Kconfig.name
@@ -0,0 +1,2 @@
+config BOARD_INTEL_MINNOWMAX
+ bool "Minnow Max"
diff --git a/src/mainboard/intel/minnowmax/Makefile.inc b/src/mainboard/intel/minnowmax/Makefile.inc
new file mode 100644
index 0000000..6d22cdf
--- /dev/null
+++ b/src/mainboard/intel/minnowmax/Makefile.inc
@@ -0,0 +1,22 @@
+## SPDX-License-Identifier: GPL-2.0-only
+
+ramstage-y += gpio.c
+ramstage-y += irqroute.c
+
+SPD_BIN = $(obj)/spd.bin
+
+SPD_SOURCES = micron_2GiB_dimm_MT41K256M16HA-125
+
+SPD_DEPS := $(foreach f, $(SPD_SOURCES), src/mainboard/$(MAINBOARDDIR)/spd/$(f).spd.hex)
+
+# Include spd ROM data
+$(SPD_BIN): $(SPD_DEPS)
+ for f in $+; \
+ do for c in $$(cat $$f | grep -v ^#); \
+ do printf $$(printf '\%o' 0x$$c); \
+ done; \
+ done > $@
+
+cbfs-files-y += spd.bin
+spd.bin-file := $(SPD_BIN)
+spd.bin-type := spd
diff --git a/src/mainboard/intel/minnowmax/acpi/ec.asl b/src/mainboard/intel/minnowmax/acpi/ec.asl
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/src/mainboard/intel/minnowmax/acpi/ec.asl
diff --git a/src/mainboard/intel/minnowmax/acpi/mainboard.asl b/src/mainboard/intel/minnowmax/acpi/mainboard.asl
new file mode 100644
index 0000000..d17d26f
--- /dev/null
+++ b/src/mainboard/intel/minnowmax/acpi/mainboard.asl
@@ -0,0 +1,15 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+/*
+ * NOTE: this has to be here even when the board has no LPE audio, otherwise
+ * it breaks the SOC specific ACPI code
+ */
+Scope (\_SB.PCI0.LPEA)
+{
+ Name (GBUF, ResourceTemplate () {})
+}
+
+
+Device (PWRB)
+{
+ Name(_HID, EisaId("PNP0C0C"))
+}
diff --git a/src/mainboard/intel/minnowmax/acpi/superio.asl b/src/mainboard/intel/minnowmax/acpi/superio.asl
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/src/mainboard/intel/minnowmax/acpi/superio.asl
diff --git a/src/mainboard/intel/minnowmax/acpi_tables.c b/src/mainboard/intel/minnowmax/acpi_tables.c
new file mode 100644
index 0000000..5439050
--- /dev/null
+++ b/src/mainboard/intel/minnowmax/acpi_tables.c
@@ -0,0 +1,44 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+
+#include <acpi/acpi.h>
+#include <acpi/acpi_gnvs.h>
+#include <arch/ioapic.h>
+#include <device/device.h>
+#include <soc/acpi.h>
+#include <soc/nvs.h>
+#include <soc/iomap.h>
+
+void acpi_create_gnvs(struct global_nvs *gnvs)
+{
+ acpi_init_gnvs(gnvs);
+
+ /* Enable USB ports in S3 */
+ gnvs->s3u0 = 1;
+ gnvs->s3u1 = 1;
+ /* Disable USB ports in S5 */
+ gnvs->s5u0 = 0;
+ gnvs->s5u1 = 0;
+ /* TPM not present */
+ gnvs->tpmp = 0;
+ /* Disable DPTF */
+ gnvs->dpte = 0;
+}
+
+unsigned long acpi_fill_madt(unsigned long current)
+{
+ /* Local APICs */
+ current = acpi_create_madt_lapics(current);
+
+ /* IOAPIC */
+ current += acpi_create_madt_ioapic((acpi_madt_ioapic_t *) current,
+ 2, IO_APIC_ADDR, 0);
+
+ current = acpi_madt_irq_overrides(current);
+
+ return current;
+}
+
+void mainboard_fill_fadt(acpi_fadt_t *fadt)
+{
+ fadt->preferred_pm_profile = PM_DESKTOP;
+}
diff --git a/src/mainboard/intel/minnowmax/board_info.txt b/src/mainboard/intel/minnowmax/board_info.txt
new file mode 100644
index 0000000..5af79f8
--- /dev/null
+++ b/src/mainboard/intel/minnowmax/board_info.txt
@@ -0,0 +1,4 @@
+Category: sbc
+ROM protocol: SPI
+Flashrom support: y
+Release year: 2014
diff --git a/src/mainboard/intel/minnowmax/cmos.layout b/src/mainboard/intel/minnowmax/cmos.layout
new file mode 100644
index 0000000..bbc3f3c
--- /dev/null
+++ b/src/mainboard/intel/minnowmax/cmos.layout
@@ -0,0 +1,44 @@
+
+## SPDX-License-Identifier: GPL-2.0-only
+# -----------------------------------------------------------------
+entries
+# -----------------------------------------------------------------
+0 120 r 0 reserved_memory
+# -----------------------------------------------------------------
+# RTC_BOOT_BYTE (coreboot hardcoded)
+384 1 e 4 boot_option
+388 4 h 0 reboot_counter
+# -----------------------------------------------------------------
+# coreboot config options: console
+395 4 e 6 debug_level
+# coreboot config options: cpu
+400 1 e 2 hyper_threading
+# coreboot config options: southbridge
+408 1 e 1 nmi
+409 2 e 7 power_on_after_fail
+# coreboot config options: check sums
+984 16 h 0 check_sum
+# -----------------------------------------------------------------
+enumerations
+#ID value text
+1 0 Disable
+1 1 Enable
+2 0 Enable
+2 1 Disable
+4 0 Fallback
+4 1 Normal
+6 0 Emergency
+6 1 Alert
+6 2 Critical
+6 3 Error
+6 4 Warning
+6 5 Notice
+6 6 Info
+6 7 Debug
+6 8 Spew
+7 0 Disable
+7 1 Enable
+7 2 Keep
+# -----------------------------------------------------------------
+checksums
+checksum 392 415 984
diff --git a/src/mainboard/intel/minnowmax/data.vbt b/src/mainboard/intel/minnowmax/data.vbt
new file mode 100644
index 0000000..cfb393c
--- /dev/null
+++ b/src/mainboard/intel/minnowmax/data.vbt
Binary files differ
diff --git a/src/mainboard/intel/minnowmax/devicetree.cb b/src/mainboard/intel/minnowmax/devicetree.cb
new file mode 100644
index 0000000..7f5a907
--- /dev/null
+++ b/src/mainboard/intel/minnowmax/devicetree.cb
@@ -0,0 +1,82 @@
+##
+## This file is part of the coreboot project.
+##
+## Copyright (C) 2013-2014 Sage Electronic Engineering, LLC.
+## Copyright (C) 2014 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
+## the Free Software Foundation; version 2 of the License.
+##
+## This program is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+## GNU General Public License for more details.
+##
+
+chip soc/intel/baytrail
+
+ register "usb2_comp_bg" = "0x4700"
+ # Allow PCIe devices to wake system from suspend
+ register "pcie_wake_enable" = "1"
+ # SATA port enable mask (2 ports)
+ register "sata_port_map" = "0x1"
+ register "sata_ahci" = "0x1"
+ # Do not route USB ports to XHCI
+ register "usb_route_to_xhci" = "0"
+ # USB Port Disable Mask
+ register "usb2_port_disable_mask" = "0x0"
+ register "usb3_port_disable_mask" = "0x0"
+ # USB PHY settings
+ register "usb2_per_port_lane0" = "0x00049a09"
+ register "usb2_per_port_rcomp_hs_pullup0" = "0x0300401d"
+ register "usb2_per_port_lane1" = "0x00049a09"
+ register "usb2_per_port_rcomp_hs_pullup1" = "0x0300401d"
+ register "usb2_per_port_lane2" = "0x00049209"
+ register "usb2_per_port_rcomp_hs_pullup2" = "0x01004015"
+ register "usb2_per_port_lane3" = "0x00049a09"
+ register "usb2_per_port_rcomp_hs_pullup3" = "0x0300401d"
+ # Disable SLP_X stretching after SUS power well fail.
+ register "disable_slp_x_stretch_sus_fail" = "1"
+
+ device cpu_cluster 0 on
+ device lapic 0 on end
+ end
+
+ device domain 0 on
+ device pci 00.0 on end # 8086 0F00 - SoC router -
+ device pci 02.0 on end # 8086 0F31 - GFX micro HDMI
+ device pci 03.0 off end # 8086 0F38 - MIPI -
+
+ device pci 10.0 off end # 8086 0F14 - MMC Port -
+ device pci 11.0 off end # 8086 0F15 - SDIO Port -
+ device pci 12.0 on end # 8086 0F16 - SD Port MicroSD on SD3
+ device pci 13.0 on end # 8086 0F23 - SATA AHCI Onboard & HSEC
+ device pci 14.0 on end # 8086 0F35 - USB XHCI - Onboard & HSEC - Enabling both EHCI and XHCI will default to EHCI if not changed at runtime
+ device pci 15.0 on end # 8086 0F28 - LP Engine Audio LSEC
+ device pci 17.0 off end # 8086 0F50 - MMC45 Port -
+ device pci 18.0 on end # 8086 0F40 - SIO - DMA -
+ device pci 18.1 off end # 8086 0F41 - I2C Port 1 (0) -
+ device pci 18.2 on end # 8086 0F42 - I2C Port 2 (1) - (testpoints)
+ device pci 18.3 off end # 8086 0F43 - I2C Port 3 (2) -
+ device pci 18.4 off end # 8086 0F44 - I2C Port 4 (3) -
+ device pci 18.5 off end # 8086 0F45 - I2C Port 5 (4) -
+ device pci 18.6 on end # 8086 0F46 - I2C Port 6 (5) LSEC
+ device pci 18.7 on end # 8086 0F47 - I2C Port 7 (6) HSEC
+ device pci 1a.0 on end # 8086 0F18 - TXE -
+ device pci 1b.0 off end # 8086 0F04 - HD Audio -
+ device pci 1c.0 on end # 8086 0F48 - PCIe Port 1 (0) Must remain on
+ device pci 1c.1 on end # 8086 0F4A - PCIe Port 2 (1) Onboard GBE (some models)
+ device pci 1c.2 on end # 8086 0F4C - PCIe Port 3 (2) Onboard GBE
+ device pci 1c.3 on end # 8086 0F4E - PCIe Port 4 (3) HSEC
+ device pci 1d.0 on end # 8086 0F34 - USB EHCI - Enabling both EHCI and XHCI will default to EHCI if not changed at runtime
+ device pci 1e.0 on end # 8086 0F06 - SIO - DMA -
+ device pci 1e.1 on end # 8086 0F08 - PWM 1 LSEC
+ device pci 1e.2 on end # 8086 0F09 - PWM 2 LSEC
+ device pci 1e.3 on end # 8086 0F0A - HSUART 1 LSEC
+ device pci 1e.4 on end # 8086 0F0C - HSUART 2 LSEC
+ device pci 1e.5 on end # 8086 0F0E - SPI LSEC
+ device pci 1f.0 on end # 8086 0F1C - LPC bridge No connector
+ device pci 1f.3 on end # 8086 0F12 - SMBus 0 SPC
+ end
+end
diff --git a/src/mainboard/intel/minnowmax/dsdt.asl b/src/mainboard/intel/minnowmax/dsdt.asl
new file mode 100644
index 0000000..0ae74495
--- /dev/null
+++ b/src/mainboard/intel/minnowmax/dsdt.asl
@@ -0,0 +1,22 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+#include <acpi/acpi.h>
+DefinitionBlock(
+ "dsdt.aml",
+ "DSDT",
+ 0x02, // DSDT revision: ACPI v2.0 and up
+ OEM_ID,
+ ACPI_TABLE_CREATOR,
+ 0x20110725 // OEM revision
+)
+{
+ #include <soc/intel/baytrail/acpi/platform.asl>
+ // global NVS and variables
+ #include <soc/intel/baytrail/acpi/globalnvs.asl>
+ #include <cpu/intel/common/acpi/cpu.asl>
+ Device (\_SB.PCI0)
+ {
+ #include <soc/intel/baytrail/acpi/southcluster.asl>
+ }
+ #include <southbridge/intel/common/acpi/sleepstates.asl>
+ #include "acpi/mainboard.asl"
+}
\ No newline at end of file
diff --git a/src/mainboard/intel/minnowmax/gpio.c b/src/mainboard/intel/minnowmax/gpio.c
new file mode 100644
index 0000000..8b5a639
--- /dev/null
+++ b/src/mainboard/intel/minnowmax/gpio.c
@@ -0,0 +1,242 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright (C) 2013 Google Inc.
+ * Copyright (C) 2014 Sage Electronic Engineering, LLC.
+ *
+ * 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
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+#include <stdlib.h>
+#include <soc/gpio.h>
+#include "irqroute.h"
+
+#define GPIO_OUT_HIGH_LEGACY \
+ { .pad_conf0 = PAD_PULL_DISABLE | PAD_CONFIG0_DEFAULT, \
+ .pad_conf1 = PAD_CONFIG1_DEFAULT, \
+ .pad_val = PAD_VAL_OUTPUT | PAD_VAL_HIGH, \
+ .use_sel = GPIO_USE_LEGACY, \
+ .io_sel = GPIO_DIR_OUTPUT, \
+ .gp_lvl = GPIO_LEVEL_HIGH, \
+ .is_gpio = 1 }
+
+
+/*
+ * For multiplexed functions, look in EDS:
+ * 10.3 Ball Name and Function by Location
+ *
+ * The pads list is in the BWG_VOL2 Rev1p2:
+ * Note that Pad # is not the same as GPIO#
+ * 37 GPIO Handling:
+ * Table 37-1. SCORE Pads List
+ * Table 37-2. SSUSORE Pads List
+ */
+
+/* NCORE GPIOs */
+static const struct soc_gpio_map gpncore_gpio_map[] = {
+ GPIO_FUNC2, // GPIO_S0_NC[00] - HDMI_HPD
+ GPIO_FUNC2, // GPIO_S0_NC[01] - HDMI_DDCDAT
+ GPIO_FUNC2, // GPIO_S0_NC[02] - HDMI_DDCCLK
+ GPIO_NC, // GPIO_S0_NC[03] - No Connect
+ GPIO_NC, // GPIO_S0_NC[04] - No Connect
+ GPIO_NC, // GPIO_S0_NC[05] - No Connect
+ GPIO_NC, // GPIO_S0_NC[06] - No Connect
+ GPIO_FUNC2, // GPIO_S0_NC[07] - DDI1_DDCDAT
+ GPIO_NC, // GPIO_S0_NC[08] - No Connect
+ GPIO_NC, // GPIO_S0_NC[09] - No Connect
+ GPIO_NC, // GPIO_S0_NC[10] - No Connect
+ GPIO_NC, // GPIO_S0_NC[11] - No Connect
+ GPIO_FUNC(0, PULL_UP, 20K), // GPIO_S0_NC[12] - TP15
+ GPIO_NC, // GPIO_S0_NC[13] - No Connect
+ GPIO_NC, // GPIO_S0_NC[14] - No Connect
+ GPIO_NC, // GPIO_S0_NC[15] - No Connect
+ GPIO_NC, // GPIO_S0_NC[16] - No Connect
+ GPIO_NC, // GPIO_S0_NC[17] - No Connect
+ GPIO_NC, // GPIO_S0_NC[18] - No Connect
+ GPIO_NC, // GPIO_S0_NC[19] - No Connect
+ GPIO_NC, // GPIO_S0_NC[20] - No Connect
+ GPIO_NC, // GPIO_S0_NC[21] - No Connect
+ GPIO_NC, // GPIO_S0_NC[22] - No Connect
+ GPIO_NC, // GPIO_S0_NC[23] - No Connect
+ GPIO_NC, // GPIO_S0_NC[24] - No Connect
+ GPIO_NC, // GPIO_S0_NC[25] - No Connect
+ GPIO_NC, // GPIO_S0_NC[26] - No Connect
+ GPIO_END
+};
+
+/* SCORE GPIOs (GPIO_S0_SC_XX) */
+static const struct soc_gpio_map gpscore_gpio_map[] = {
+ GPIO_FUNC1, // GPIO_S0_SC[000] - SATA_GP0
+ GPIO_FUNC1, // GPIO_S0_SC[001] - SATA_GP1
+ GPIO_FUNC1, // GPIO_S0_SC[002] - SATA_LED_B
+ GPIO_FUNC1, // GPIO_S0_SC[003] - PCIE_CLKREQ_0
+ GPIO_FUNC1, // GPIO_S0_SC[004] - PCIE_CLKREQ_1
+ GPIO_FUNC1, // GPIO_S0_SC[005] - PCIE_CLKREQ_2
+ GPIO_FUNC1, // GPIO_S0_SC[006] - PCIE_CLKREQ_3
+ GPIO_FUNC2, // GPIO_S0_SC[007] - SD3_WP
+ GPIO_NC, // GPIO_S0_SC[008] - No Connect
+ GPIO_NC, // GPIO_S0_SC[009] - No Connect
+ GPIO_NC, // GPIO_S0_SC[010] - No Connect
+ GPIO_NC, // GPIO_S0_SC[011] - No Connect
+ GPIO_NC, // GPIO_S0_SC[012] - No Connect
+ GPIO_NC, // GPIO_S0_SC[013] - No Connect
+ GPIO_NC, // GPIO_S0_SC[014] - No Connect
+ GPIO_NC, // GPIO_S0_SC[015] - No Connect
+ GPIO_NC, // GPIO_S0_SC[016] - No Connect
+ GPIO_NC, // GPIO_S0_SC[017] - No Connect
+ GPIO_NC, // GPIO_S0_SC[018] - No Connect
+ GPIO_NC, // GPIO_S0_SC[019] - No Connect
+ GPIO_NC, // GPIO_S0_SC[020] - No Connect
+ GPIO_NC, // GPIO_S0_SC[021] - No Connect
+ GPIO_NC, // GPIO_S0_SC[022] - No Connect
+ GPIO_NC, // GPIO_S0_SC[023] - No Connect
+ GPIO_NC, // GPIO_S0_SC[024] - No Connect
+ GPIO_NC, // GPIO_S0_SC[025] - No Connect
+ GPIO_NC, // GPIO_S0_SC[026] - No Connect
+ GPIO_NC, // GPIO_S0_SC[027] - No Connect
+ GPIO_NC, // GPIO_S0_SC[028] - No Connect
+ GPIO_NC, // GPIO_S0_SC[029] - No Connect
+ GPIO_NC, // GPIO_S0_SC[030] - No Connect
+ GPIO_NC, // GPIO_S0_SC[031] - No Connect
+ GPIO_NC, // GPIO_S0_SC[032] - No Connect
+ GPIO_FUNC1, // GPIO_S0_SC[033] - SD3_CLK
+ GPIO_FUNC1, // GPIO_S0_SC[034] - SD3_D0
+ GPIO_FUNC1, // GPIO_S0_SC[035] - SD3_D1
+ GPIO_FUNC1, // GPIO_S0_SC[036] - SD3_D2
+ GPIO_FUNC1, // GPIO_S0_SC[037] - SD3_D3
+ GPIO_FUNC1, // GPIO_S0_SC[038] - SD3_CD#
+ GPIO_FUNC1, // GPIO_S0_SC[039] - SD3_CMD
+ GPIO_FUNC1, // GPIO_S0_SC[040] - TP12 (SD3_1P8EN)
+ GPIO_FUNC1, // GPIO_S0_SC[041] - TP11 (/SD3_PWREN)
+ GPIO_NC, // GPIO_S0_SC[042] - No Connect
+ GPIO_NC, // GPIO_S0_SC[043] - No Connect
+ GPIO_NC, // GPIO_S0_SC[044] - No Connect
+ GPIO_NC, // GPIO_S0_SC[045] - No Connect
+ GPIO_NC, // GPIO_S0_SC[046] - No Connect
+ GPIO_NC, // GPIO_S0_SC[047] - No Connect
+ GPIO_NC, // GPIO_S0_SC[048] - No Connect
+ GPIO_NC, // GPIO_S0_SC[049] - No Connect
+ GPIO_NC, // GPIO_S0_SC[050] - No Connect
+ GPIO_FUNC1, // GPIO_S0_SC[051] - PCU_SMB_DATA
+ GPIO_FUNC1, // GPIO_S0_SC[052] - PCU_SMB_CLK
+ GPIO_FUNC1, // GPIO_S0_SC[053] - PCU_SMB_ALERT
+ GPIO_FUNC1, // GPIO_S0_SC[054] - ILB_8254_SPKR
+ GPIO_FUNC(0, PULL_UP, 20K), // GPIO_S0_SC[055] - TP8 (GPIO_S0_SC_55)
+ GPIO_FUNC0, // GPIO_S0_SC[056] - GPIO_S0_SC_56
+ GPIO_FUNC1, // GPIO_S0_SC[057] - PCU_UART3_TXD
+ GPIO_FUNC(0, PULL_UP, 20K), // GPIO_S0_SC[058] - TP9 (GPIO_S0_SC_58)
+ GPIO_FUNC0, // GPIO_S0_SC[059] - HDMI_DCDC_ENB
+ GPIO_FUNC0, // GPIO_S0_SC[060] - HDMI_LDSW_ENB
+ GPIO_FUNC1, // GPIO_S0_SC[061] - PCU_UART3_RXD
+ GPIO_FUNC1, // GPIO_S0_SC[062] - LPE_I2S_CLK
+ GPIO_FUNC1, // GPIO_S0_SC[063] - LPE_I2S_FRM
+ GPIO_FUNC1, // GPIO_S0_SC[064] - LPE_I2S_DATIN
+ GPIO_FUNC1, // GPIO_S0_SC[065] - LPE_I2S_DATOUT
+ GPIO_FUNC1, // GPIO_S0_SC[066] - SOC_SIO_SPI_CS1
+ GPIO_FUNC1, // GPIO_S0_SC[067] - SOC_SIO_SPI_MISO
+ GPIO_FUNC1, // GPIO_S0_SC[068] - SOC_SIO_SPI_MOSI
+ GPIO_FUNC1, // GPIO_S0_SC[069] - SOC_SIO_SPI_CLK
+ GPIO_FUNC1, // GPIO_S0_SC[070] - SIO_UART1_RXD
+ GPIO_FUNC1, // GPIO_S0_SC[071] - SIO_UART1_TXD
+ GPIO_FUNC1, // GPIO_S0_SC[072] - SIO_UART1_RTSB
+ GPIO_FUNC1, // GPIO_S0_SC[073] - SIO_UART1_CTSB
+ GPIO_FUNC1, // GPIO_S0_SC[074] - SIO_UART2_RXD
+ GPIO_FUNC1, // GPIO_S0_SC[075] - SIO_UART2_TXD
+ GPIO_NC, // GPIO_S0_SC[076] - No Connect
+ GPIO_NC, // GPIO_S0_SC[077] - No Connect
+ GPIO_NC, // GPIO_S0_SC[078] - No Connect
+ GPIO_NC, // GPIO_S0_SC[079] - No Connect
+ GPIO_FUNC1, // GPIO_S0_SC[080] - TP6 (SIO_I2C1_SDA)
+ GPIO_FUNC1, // GPIO_S0_SC[081] - TP5 (SIO_I2C1_SCL)
+ GPIO_NC, // GPIO_S0_SC[082] - No Connect
+ GPIO_NC, // GPIO_S0_SC[083] - No Connect
+ GPIO_NC, // GPIO_S0_SC[084] - No Connect
+ GPIO_NC, // GPIO_S0_SC[085] - No Connect
+ GPIO_NC, // GPIO_S0_SC[086] - No Connect
+ GPIO_NC, // GPIO_S0_SC[087] - No Connect
+ GPIO_FUNC1, // GPIO_S0_SC[088] - LSS_I2C_SDA
+ GPIO_FUNC1, // GPIO_S0_SC[089] - LSS_I2C_SCL
+ GPIO_FUNC1, // GPIO_S0_SC[090] - EXP_I2C_SDA
+ GPIO_FUNC1, // GPIO_S0_SC[091] - EXP_I2C_SCL
+ GPIO_FUNC(1, PULL_UP, 20K), // GPIO_S0_SC[092] - TP13
+ GPIO_FUNC(1, PULL_UP, 20K), // GPIO_S0_SC[093] - TP16
+ GPIO_FUNC1, // GPIO_S0_SC[094] - SOC_PWM0
+ GPIO_FUNC1, // GPIO_S0_SC[095] - SOC_PWM1
+ GPIO_NC, // GPIO_S0_SC[096] - No Connect
+ GPIO_NC, // GPIO_S0_SC[097] - No Connect
+ GPIO_NC, // GPIO_S0_SC[098] - No Connect
+ GPIO_NC, // GPIO_S0_SC[099] - No Connect
+ GPIO_NC, // GPIO_S0_SC[100] - No Connect
+ GPIO_NC, // GPIO_S0_SC[101] - No Connect
+ GPIO_END
+};
+
+/* SSUS GPIOs (GPIO_S5) */
+static const struct soc_gpio_map gpssus_gpio_map[] = {
+ GPIO_FUNC(0, PULL_UP, 20K), // GPIO_S5[00] - SOC_GPIO_S5_0
+ GPIO_FUNC(0, PULL_UP, 20K), // GPIO_S5[01] - SOC_GPIO_S5_1
+ GPIO_FUNC(0, PULL_UP, 20K), // GPIO_S5[02] - SOC_GPIO_S5_2
+ GPIO_FUNC6, // GPIO_S5[03] - mPCIE_WAKEB
+ GPIO_NC, // GPIO_S5[04] - No Connect
+ GPIO_INPUT, // GPIO_S5[05] - BOM_OP1
+ // Memory: 0=1GB 1=2GB or 4GB
+ GPIO_INPUT, // GPIO_S5[06] - BOM_OP2
+ GPIO_INPUT, // GPIO_S5[07] - BOM_OP3
+ GPIO_OUT_HIGH_LEGACY, // GPIO_S5[08] - SOC_USB_HOST_EN0
+ GPIO_OUT_HIGH_LEGACY, // GPIO_S5[09] - SOC_USB_HOST_EN1
+ GPIO_OUT_HIGH_LEGACY, // GPIO_S5[10] - GPIO_S5_10_UNLOCK
+ GPIO_FUNC0, // GPIO_S5[11] - SUSPWRDNACK (TP14)
+ GPIO_FUNC0, // GPIO_S5[12] - PMC_SUSCLK0
+ GPIO_FUNC1, // GPIO_S5[13] - PMC_SLP_S0IX (TP10)
+ GPIO_FUNC1, // GPIO_S5[14] - GPIO_S514_J20
+ GPIO_FUNC0, // GPIO_S5[15] - PMC_PCIE_WAKE_R
+ GPIO_FUNC0, // GPIO_S5[16] - PMC_PWRBTN
+ GPIO_NC, // GPIO_S5[17] - No Connect
+ GPIO_FUNC1, // GPIO_S5[18] - LPCPD_L (TP7)
+ GPIO_FUNC0, // GPIO_S5[19] - SOC_USB_HOST_OC0
+ GPIO_FUNC0, // GPIO_S5[20] - SOC_USB_HOST_OC1
+ GPIO_FUNC0, // GPIO_S5[21] - SOC_SPI_CS1B
+ GPIO_INPUT_PD, // GPIO_S5[22] - NC or LED D2
+ GPIO_FUNC(0, PULL_UP, 20K), // GPIO_S5[23] - XDP_H_OBSDATA_A0
+ GPIO_FUNC(0, PULL_UP, 20K), // GPIO_S5[24] - XDP_H_OBSDATA_A1
+ GPIO_FUNC(0, PULL_UP, 20K), // GPIO_S5[25] - XDP_H_OBSDATA_A2
+ GPIO_FUNC(0, PULL_UP, 20K), // GPIO_S5[26] - XDP_H_OBSDATA_A3
+ GPIO_FUNC(0, PULL_UP, 20K), // GPIO_S5[27] - EXP_GPIO1
+ GPIO_FUNC(0, PULL_UP, 20K), // GPIO_S5[28] - EXP_GPIO2
+ GPIO_FUNC(0, PULL_UP, 20K), // GPIO_S5[29] - EXP_GPIO3
+ GPIO_FUNC(0, PULL_UP, 20K), // GPIO_S5[30] - EXP_GPIO4
+ GPIO_NC, // GPIO_S5[31] - No Connect
+ GPIO_NC, // GPIO_S5[32] - No Connect
+ GPIO_NC, // GPIO_S5[33] - No Connect
+ GPIO_NC, // GPIO_S5[34] - No Connect
+ GPIO_NC, // GPIO_S5[35] - No Connect
+ GPIO_NC, // GPIO_S5[36] - No Connect
+ GPIO_NC, // GPIO_S5[37] - No Connect
+ GPIO_NC, // GPIO_S5[38] - No Connect
+ GPIO_NC, // GPIO_S5[39] - No Connect
+ GPIO_NC, // GPIO_S5[40] - No Connect
+ GPIO_NC, // GPIO_S5[41] - No Connect
+ GPIO_NC, // GPIO_S5[42] - No Connect
+ GPIO_NC, // GPIO_S5[43] - No Connect
+ GPIO_END
+};
+
+static struct soc_gpio_config gpio_config = {
+ .ncore = gpncore_gpio_map,
+ .score = gpscore_gpio_map,
+ .ssus = gpssus_gpio_map,
+ .core_dirq = NULL,
+ .sus_dirq = NULL,
+};
+
+struct soc_gpio_config *mainboard_get_gpios(void)
+{
+ return &gpio_config;
+}
diff --git a/src/mainboard/intel/minnowmax/irqroute.c b/src/mainboard/intel/minnowmax/irqroute.c
new file mode 100644
index 0000000..6fa0366
--- /dev/null
+++ b/src/mainboard/intel/minnowmax/irqroute.c
@@ -0,0 +1,5 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+
+#include "irqroute.h"
+
+DEFINE_IRQ_ROUTES;
diff --git a/src/mainboard/intel/minnowmax/irqroute.h b/src/mainboard/intel/minnowmax/irqroute.h
new file mode 100644
index 0000000..e0e43f0
--- /dev/null
+++ b/src/mainboard/intel/minnowmax/irqroute.h
@@ -0,0 +1,27 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+
+#include <soc/irq.h>
+#include <soc/pci_devs.h>
+
+#define PCI_DEV_PIRQ_ROUTES \
+ PCI_DEV_PIRQ_ROUTE(GFX_DEV, A, B, C, D), \
+ PCI_DEV_PIRQ_ROUTE(SD_DEV, A, B, C, D), \
+ PCI_DEV_PIRQ_ROUTE(SATA_DEV, A, B, C, D), \
+ PCI_DEV_PIRQ_ROUTE(XHCI_DEV, A, B, C, D), \
+ PCI_DEV_PIRQ_ROUTE(LPE_DEV, A, B, C, D), \
+ PCI_DEV_PIRQ_ROUTE(SIO1_DEV, A, B, C, D), \
+ PCI_DEV_PIRQ_ROUTE(TXE_DEV, A, B, C, D), \
+ PCI_DEV_PIRQ_ROUTE(PCIE_DEV, A, B, C, D), \
+ PCI_DEV_PIRQ_ROUTE(EHCI_DEV, A, B, C, D), \
+ PCI_DEV_PIRQ_ROUTE(SIO2_DEV, A, B, C, D), \
+ PCI_DEV_PIRQ_ROUTE(PCU_DEV, A, B, C, D)
+
+#define PIRQ_PIC_ROUTES \
+ PIRQ_PIC(A, DISABLE), \
+ PIRQ_PIC(B, DISABLE), \
+ PIRQ_PIC(C, DISABLE), \
+ PIRQ_PIC(D, DISABLE), \
+ PIRQ_PIC(E, DISABLE), \
+ PIRQ_PIC(F, DISABLE), \
+ PIRQ_PIC(G, DISABLE), \
+ PIRQ_PIC(H, DISABLE)
diff --git a/src/mainboard/intel/minnowmax/mainboard.c b/src/mainboard/intel/minnowmax/mainboard.c
new file mode 100644
index 0000000..69b9405
--- /dev/null
+++ b/src/mainboard/intel/minnowmax/mainboard.c
@@ -0,0 +1,26 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+
+#include <acpi/acpi.h>
+#include <bootstate.h>
+void mainboard_suspend_resume(void)
+{
+}
+
+static void mainboard_init(struct device *dev)
+{
+}
+static int mainboard_smbios_data(struct device *dev, int *handle,
+ unsigned long *current)
+{
+ return 0;
+}
+// mainboard_enable is executed as first thing after
+// enumerate_buses().
+static void mainboard_enable(struct device *dev)
+{
+ dev->ops->init = mainboard_init;
+ dev->ops->get_smbios_data = mainboard_smbios_data;
+}
+struct chip_operations mainboard_ops = {
+ .enable_dev = mainboard_enable,
+};
diff --git a/src/mainboard/intel/minnowmax/romstage.c b/src/mainboard/intel/minnowmax/romstage.c
new file mode 100644
index 0000000..c504cd4
--- /dev/null
+++ b/src/mainboard/intel/minnowmax/romstage.c
@@ -0,0 +1,43 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+
+#include <stdint.h>
+#include <soc/gpio.h>
+#include <cbfs.h>
+#include <console/console.h>
+#include <soc/mrc_wrapper.h>
+#include <soc/romstage.h>
+
+#define DRAM_GPIO_FUSE 5
+#define SPD_SIZE 256
+
+static void *get_spd_pointer(char *spd_file_content)
+{
+ u8 gpio5 = 0;
+
+ ssus_disable_internal_pull(DRAM_GPIO_FUSE);
+
+ gpio5 = ssus_get_gpio(DRAM_GPIO_FUSE);
+
+ // TODO
+ return &spd_file_content[SPD_SIZE * 0];
+}
+
+void mainboard_fill_mrc_params(struct mrc_params *mp)
+{
+ void *spd_content;
+ void *spd_file;
+ size_t spd_fsize;
+
+ spd_file = cbfs_boot_map_with_leak("spd.bin", CBFS_TYPE_SPD, &spd_fsize);
+
+ if (!spd_file)
+ die("SPD data not found.");
+
+ spd_content = get_spd_pointer(spd_file);
+
+ mp->mainboard.dram_type = DRAM_DDR3L;
+ mp->mainboard.dram_info_location = DRAM_INFO_SPD_MEM;
+ mp->mainboard.weaker_odt_settings = 1;
+
+ mp->mainboard.dram_data[0] = spd_content;
+}
diff --git a/src/mainboard/intel/minnowmax/spd/micron_2GiB_dimm_MT41K256M16HA-125.spd.hex b/src/mainboard/intel/minnowmax/spd/micron_2GiB_dimm_MT41K256M16HA-125.spd.hex
new file mode 100644
index 0000000..f3bcb56
--- /dev/null
+++ b/src/mainboard/intel/minnowmax/spd/micron_2GiB_dimm_MT41K256M16HA-125.spd.hex
@@ -0,0 +1,32 @@
+92 11 0b 03 04 19 02 02
+03 11 01 08 0a 00 fe 00
+69 78 69 3c 69 11 18 86
+20 08 3c 3c 01 40 83 05
+00 00 00 00 00 00 00 00
+00 00 00 00 00 00 00 00
+00 00 00 00 00 00 00 00
+00 00 00 00 0f 01 02 00
+00 00 00 00 00 00 00 00
+00 00 00 00 00 00 00 00
+00 00 00 00 00 00 00 00
+00 00 00 00 00 00 00 00
+00 00 00 00 00 00 00 00
+00 00 00 00 00 00 00 00
+00 00 00 00 00 80 2c 00
+00 00 00 00 00 00 19 d2
+34 4b 54 46 32 35 36 36
+34 48 5a 2d 31 47 36 45
+31 20 45 31 80 2c 00 00
+00 00 00 00 00 00 00 00
+00 00 00 00 00 00 00 00
+00 00 00 00 00 00 00 00
+ff ff ff ff ff ff ff ff
+ff ff ff ff ff ff ff ff
+ff ff ff ff ff ff ff ff
+ff ff ff ff ff ff ff ff
+ff ff ff ff ff ff ff ff
+ff ff ff ff ff ff ff ff
+ff ff ff ff ff ff ff ff
+ff ff ff ff ff ff ff ff
+ff ff ff ff ff ff ff ff
+ff ff ff ff ff ff ff ff
diff --git a/src/soc/intel/baytrail/Makefile.inc b/src/soc/intel/baytrail/Makefile.inc
index bfa1846..cd03458 100644
--- a/src/soc/intel/baytrail/Makefile.inc
+++ b/src/soc/intel/baytrail/Makefile.inc
@@ -66,8 +66,7 @@
postcar-y += ../../../cpu/intel/car/non-evict/exit_car.S
-cpu_microcode_bins += 3rdparty/blobs/soc/intel/baytrail/microcode.bin \
- 3rdparty/intel-microcode/intel-ucode/06-37-09
+cpu_microcode_bins += 3rdparty/intel-microcode/intel-ucode/06-37-*
CPPFLAGS_common += -Isrc/soc/intel/baytrail/include
diff --git a/src/soc/intel/baytrail/refcode.c b/src/soc/intel/baytrail/refcode.c
index 297ed9c..99fb335 100644
--- a/src/soc/intel/baytrail/refcode.c
+++ b/src/soc/intel/baytrail/refcode.c
@@ -19,7 +19,7 @@
static efi_wrapper_entry_t load_refcode_from_cache(void)
{
- struct prog refcode;
+ static struct prog refcode;
printk(BIOS_DEBUG, "refcode loading from cache.\n");
--
To view, visit https://review.coreboot.org/c/coreboot/+/44102
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-Change-Id: I9a1236425c8a0914f92adcad445230ef2692393a
Gerrit-Change-Number: 44102
Gerrit-PatchSet: 1
Gerrit-Owner: Arthur Heymans <arthur(a)aheymans.xyz>
Gerrit-MessageType: newchange
5
15

Change in coreboot[master]: mb/google/volteer: Implement variant_devtree_update for volteer sku's
by Shaunak Saha (Code Review) Aug. 7, 2023
by Shaunak Saha (Code Review) Aug. 7, 2023
Aug. 7, 2023
Shaunak Saha has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/44261 )
Change subject: mb/google/volteer: Implement variant_devtree_update for volteer sku's
......................................................................
mb/google/volteer: Implement variant_devtree_update for volteer sku's
HybridStorageMode FSP UPD needs to be set only for optane storage.
Enabling HybridStorageMode causes some extra delay in FspSiliconInit due
to HECI command and hence is avoided for NVMe and SATA scenerios. This change
disables "HybridStorageMode" by default from baseboard devicetree. Any
volteer variant which is using optane should enable "HybridStorageMode" from
the override devicetree file.This change also provides an implementation of
variant_devtree_update() for volteer that enables HybridStorageMode for
SKU ID = 3 and 5.
BUG=b:158573805
TEST=Verify HybridStorageMode is disabled when SKU ID != 3 or 5 and
enabled for those 2 sku's only.
Signed-off-by: Shaunak Saha <shaunak.saha(a)intel.com>
Change-Id: I5c3bcfafe1710155bb47f706c3568dd9500c1975
---
M src/mainboard/google/volteer/Makefile.inc
A src/mainboard/google/volteer/ramstage.c
M src/mainboard/google/volteer/variants/baseboard/devicetree.cb
M src/mainboard/google/volteer/variants/baseboard/include/baseboard/variants.h
M src/mainboard/google/volteer/variants/volteer/Makefile.inc
A src/mainboard/google/volteer/variants/volteer/variant.c
6 files changed, 39 insertions(+), 1 deletion(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/61/44261/1
diff --git a/src/mainboard/google/volteer/Makefile.inc b/src/mainboard/google/volteer/Makefile.inc
index c01f993..b5579a7 100644
--- a/src/mainboard/google/volteer/Makefile.inc
+++ b/src/mainboard/google/volteer/Makefile.inc
@@ -10,6 +10,7 @@
ramstage-y += ec.c
ramstage-$(CONFIG_FW_CONFIG) += fw_config.c
ramstage-y += mainboard.c
+ramstage-y += ramstage.c
smm-y += smihandler.c
diff --git a/src/mainboard/google/volteer/ramstage.c b/src/mainboard/google/volteer/ramstage.c
new file mode 100644
index 0000000..084e69e
--- /dev/null
+++ b/src/mainboard/google/volteer/ramstage.c
@@ -0,0 +1,15 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+
+#include <baseboard/variants.h>
+#include <soc/ramstage.h>
+
+void mainboard_silicon_init_params(FSP_S_CONFIG *params)
+{
+ variant_devtree_update();
+}
+
+void __weak variant_devtree_update(void)
+{
+ /* Override dev tree settings per board */
+}
+
diff --git a/src/mainboard/google/volteer/variants/baseboard/devicetree.cb b/src/mainboard/google/volteer/variants/baseboard/devicetree.cb
index 53bbe5a..ccd1877 100644
--- a/src/mainboard/google/volteer/variants/baseboard/devicetree.cb
+++ b/src/mainboard/google/volteer/variants/baseboard/devicetree.cb
@@ -81,7 +81,9 @@
# Enable Optane PCIE 11 using clk 0
register "PcieRpEnable[10]" = "1"
register "PcieRpLtrEnable[10]" = "1"
- register "HybridStorageMode" = "1"
+ # Disable it by default. Device tree overwrite needs to enable this feature
+ # for platforms using Optane memory.
+ register "HybridStorageMode" = "0"
# Enable SD Card PCIE 8 using clk 3
register "PcieRpEnable[7]" = "1"
diff --git a/src/mainboard/google/volteer/variants/baseboard/include/baseboard/variants.h b/src/mainboard/google/volteer/variants/baseboard/include/baseboard/variants.h
index 2f90a42..aa8ea27 100644
--- a/src/mainboard/google/volteer/variants/baseboard/include/baseboard/variants.h
+++ b/src/mainboard/google/volteer/variants/baseboard/include/baseboard/variants.h
@@ -21,4 +21,6 @@
const struct lpddr4x_cfg *variant_memory_params(void);
int variant_memory_sku(void);
+void variant_devtree_update(void);
+
#endif /* __BASEBOARD_VARIANTS_H__ */
diff --git a/src/mainboard/google/volteer/variants/volteer/Makefile.inc b/src/mainboard/google/volteer/variants/volteer/Makefile.inc
index 13269db..04af3ae 100644
--- a/src/mainboard/google/volteer/variants/volteer/Makefile.inc
+++ b/src/mainboard/google/volteer/variants/volteer/Makefile.inc
@@ -3,3 +3,4 @@
bootblock-y += gpio.c
ramstage-y += gpio.c
+ramstage-y += variant.c
diff --git a/src/mainboard/google/volteer/variants/volteer/variant.c b/src/mainboard/google/volteer/variants/volteer/variant.c
new file mode 100644
index 0000000..8d3adef
--- /dev/null
+++ b/src/mainboard/google/volteer/variants/volteer/variant.c
@@ -0,0 +1,17 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+
+#include <baseboard/variants.h>
+#include <chip.h>
+#include <ec/google/chromeec/ec.h>
+
+void variant_devtree_update(void)
+{
+ uint32_t sku_id;
+ config_t *cfg = config_of_soc();
+
+ if (google_chromeec_cbi_get_sku_id(&sku_id))
+ return;
+
+ if ((sku_id == 3) || (sku_id == 5))
+ cfg->HybridStorageMode = 1;
+}
--
To view, visit https://review.coreboot.org/c/coreboot/+/44261
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-Change-Id: I5c3bcfafe1710155bb47f706c3568dd9500c1975
Gerrit-Change-Number: 44261
Gerrit-PatchSet: 1
Gerrit-Owner: Shaunak Saha <shaunak.saha(a)intel.com>
Gerrit-MessageType: newchange
4
11

Change in coreboot[master]: soc/intel/baytrail: Start VBOOT in bootblock
by Arthur Heymans (Code Review) Aug. 7, 2023
by Arthur Heymans (Code Review) Aug. 7, 2023
Aug. 7, 2023
Arthur Heymans has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/36874 )
Change subject: soc/intel/baytrail: Start VBOOT in bootblock
......................................................................
soc/intel/baytrail: Start VBOOT in bootblock
The earlier the more that can be updated via RW fmap regions.
Change-Id: Ifcaf6ad8e27c09fee99cf6a8b12f9fadcb0cef2c
Signed-off-by: Arthur Heymans <arthur(a)aheymans.xyz>
---
M src/mainboard/google/rambi/Makefile.inc
M src/soc/intel/baytrail/Kconfig
M src/soc/intel/baytrail/Makefile.inc
M src/soc/intel/baytrail/pmutil.c
4 files changed, 9 insertions(+), 6 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/74/36874/1
diff --git a/src/mainboard/google/rambi/Makefile.inc b/src/mainboard/google/rambi/Makefile.inc
index 0e80b64..6660d23 100644
--- a/src/mainboard/google/rambi/Makefile.inc
+++ b/src/mainboard/google/rambi/Makefile.inc
@@ -13,6 +13,7 @@
## GNU General Public License for more details.
##
+verstage-$(CONFIG_CHROMEOS) += chromeos.c
romstage-$(CONFIG_CHROMEOS) += chromeos.c
ramstage-$(CONFIG_CHROMEOS) += chromeos.c
ramstage-$(CONFIG_EC_GOOGLE_CHROMEEC) += ec.c
diff --git a/src/soc/intel/baytrail/Kconfig b/src/soc/intel/baytrail/Kconfig
index cfea93a..e4e8c30 100644
--- a/src/soc/intel/baytrail/Kconfig
+++ b/src/soc/intel/baytrail/Kconfig
@@ -41,11 +41,8 @@
config VBOOT
select VBOOT_MUST_REQUEST_DISPLAY
- select VBOOT_STARTS_IN_ROMSTAGE
-
-config BOOTBLOCK_CPU_INIT
- string
- default "soc/intel/baytrail/bootblock/bootblock.c"
+ select VBOOT_STARTS_IN_BOOTBLOCK
+ select VBOOT_SEPARATE_VERSTAGE
config MMCONF_BASE_ADDRESS
hex
diff --git a/src/soc/intel/baytrail/Makefile.inc b/src/soc/intel/baytrail/Makefile.inc
index eda3e25..d21f744 100644
--- a/src/soc/intel/baytrail/Makefile.inc
+++ b/src/soc/intel/baytrail/Makefile.inc
@@ -16,6 +16,8 @@
bootblock-y += ../../../cpu/x86/early_reset.S
bootblock-y += bootblock/bootblock.c
+verstage-y += pmutil.c
+
romstage-y += iosf.c
romstage-y += memmap.c
romstage-y += pmutil.c
diff --git a/src/soc/intel/baytrail/pmutil.c b/src/soc/intel/baytrail/pmutil.c
index 51174fc..2d14d84 100644
--- a/src/soc/intel/baytrail/pmutil.c
+++ b/src/soc/intel/baytrail/pmutil.c
@@ -368,7 +368,10 @@
{
uint32_t gen_pmcon1;
int rtc_fail;
- struct chipset_power_state *ps = cbmem_find(CBMEM_ID_POWER_STATE);
+ struct chipset_power_state *ps = NULL;
+
+ if (ENV_RAMSTAGE)
+ ps = cbmem_find(CBMEM_ID_POWER_STATE);
if (ps != NULL)
gen_pmcon1 = ps->gen_pmcon1;
--
To view, visit https://review.coreboot.org/c/coreboot/+/36874
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-Change-Id: Ifcaf6ad8e27c09fee99cf6a8b12f9fadcb0cef2c
Gerrit-Change-Number: 36874
Gerrit-PatchSet: 1
Gerrit-Owner: Arthur Heymans <arthur(a)aheymans.xyz>
Gerrit-Reviewer: Arthur Heymans <arthur(a)aheymans.xyz>
Gerrit-Reviewer: Martin Roth <martinroth(a)google.com>
Gerrit-Reviewer: Patrick Georgi <pgeorgi(a)google.com>
Gerrit-Reviewer: Patrick Rudolph <siro(a)das-labor.org>
Gerrit-MessageType: newchange
4
6

Change in coreboot[master]: mb/gigabyte/ga-g41m-es2l: Prepare for a variant
by Arthur Heymans (Code Review) Aug. 7, 2023
by Arthur Heymans (Code Review) Aug. 7, 2023
Aug. 7, 2023
Arthur Heymans has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/41867 )
Change subject: mb/gigabyte/ga-g41m-es2l: Prepare for a variant
......................................................................
mb/gigabyte/ga-g41m-es2l: Prepare for a variant
To ease the review of adding a variant (ga-g41m-combo) move a few
things around without yet adding the variant.
Change-Id: I0b22731849e157b76be97dbe02a7538f1cea472d
Signed-off-by: Arthur Heymans <arthur(a)aheymans.xyz>
---
M src/mainboard/gigabyte/ga-g41m-es2l/Kconfig
M src/mainboard/gigabyte/ga-g41m-es2l/Makefile.inc
M src/mainboard/gigabyte/ga-g41m-es2l/devicetree.cb
M src/mainboard/gigabyte/ga-g41m-es2l/early_init.c
A src/mainboard/gigabyte/ga-g41m-es2l/include/mainboard/superio.h
A src/mainboard/gigabyte/ga-g41m-es2l/superio.h
R src/mainboard/gigabyte/ga-g41m-es2l/variants/ga-g41m-es2l/gpio.c
R src/mainboard/gigabyte/ga-g41m-es2l/variants/ga-g41m-es2l/hda_verb.c
A src/mainboard/gigabyte/ga-g41m-es2l/variants/ga-g41m-es2l/overridetree.cb
A src/mainboard/gigabyte/ga-g41m-es2l/variants/ga-g41m-es2l/superio.c
10 files changed, 166 insertions(+), 119 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/67/41867/1
diff --git a/src/mainboard/gigabyte/ga-g41m-es2l/Kconfig b/src/mainboard/gigabyte/ga-g41m-es2l/Kconfig
index fa6783d1..97f155a 100644
--- a/src/mainboard/gigabyte/ga-g41m-es2l/Kconfig
+++ b/src/mainboard/gigabyte/ga-g41m-es2l/Kconfig
@@ -7,7 +7,7 @@
select CPU_INTEL_SOCKET_LGA775
select NORTHBRIDGE_INTEL_X4X
select SOUTHBRIDGE_INTEL_I82801GX
- select SUPERIO_ITE_IT8718F
+ select SUPERIO_ITE_IT8718F if BOARD_GIGABYTE_GA_G41M_ES2L
select HAVE_ACPI_TABLES
select BOARD_ROMSIZE_KB_1024
select PCIEXP_ASPM
@@ -24,9 +24,17 @@
string
default "gigabyte/ga-g41m-es2l"
+config VARIANT_DIR
+ string
+ default "ga-g41m-es2l" if BOARD_GIGABYTE_GA_G41M_ES2L
+
+config OVERRIDE_DEVICETREE
+ string
+ default "variants/$(CONFIG_VARIANT_DIR)/overridetree.cb"
+
config MAINBOARD_PART_NUMBER
string
- default "GA-G41M-ES2L"
+ default "GA-G41M-ES2L" if BOARD_GIGABYTE_GA_G41M_ES2L
config MAX_CPUS
int
diff --git a/src/mainboard/gigabyte/ga-g41m-es2l/Makefile.inc b/src/mainboard/gigabyte/ga-g41m-es2l/Makefile.inc
index 4100476..cf8ce96 100644
--- a/src/mainboard/gigabyte/ga-g41m-es2l/Makefile.inc
+++ b/src/mainboard/gigabyte/ga-g41m-es2l/Makefile.inc
@@ -1,7 +1,11 @@
ramstage-y += cstates.c
-romstage-y += gpio.c
bootblock-y += early_init.c
romstage-y += early_init.c
ramstage-$(CONFIG_MAINBOARD_USE_LIBGFXINIT) += gma-mainboard.ads
+
+CPPFLAGS_common += -I$(src)/mainboard/$(MAINBOARDDIR)/include
+bootblock-y += variants/$(VARIANT_DIR)/superio.c
+romstage-y += variants/$(VARIANT_DIR)/gpio.c
+ramstage-y += variants/$(VARIANT_DIR)/hda_verb.c
diff --git a/src/mainboard/gigabyte/ga-g41m-es2l/devicetree.cb b/src/mainboard/gigabyte/ga-g41m-es2l/devicetree.cb
index 6328bc6..bdeda72 100644
--- a/src/mainboard/gigabyte/ga-g41m-es2l/devicetree.cb
+++ b/src/mainboard/gigabyte/ga-g41m-es2l/devicetree.cb
@@ -68,79 +68,6 @@
device pci 1e.3 off end # AC'97 Modem
device pci 1f.0 on # ISA bridge
subsystemid 0x1458 0x5001
- chip superio/ite/it8718f # Super I/O
- register "TMPIN1.mode" = "THERMAL_RESISTOR"
- register "TMPIN2.mode" = "THERMAL_RESISTOR"
- register "TMPIN3.mode" = "THERMAL_DIODE"
- register "TMPIN3.offset" = "0"
- register "ec.vin_mask" = "VIN7 | VIN4 | VIN3 | VIN2 | VIN1 | VIN0"
-
- register "FAN1.mode" = "FAN_SMART_AUTOMATIC"
- register "FAN1.smart.tmpin" = "3"
- register "FAN1.smart.tmp_off" = "25"
- register "FAN1.smart.tmp_start" = "30"
- register "FAN1.smart.tmp_full" = "65"
- register "FAN1.smart.tmp_delta" = "3"
- register "FAN1.smart.smoothing" = "1"
- register "FAN1.smart.pwm_start" = "0"
- register "FAN1.smart.slope" = "10"
-
- register "FAN2.mode" = "FAN_SMART_AUTOMATIC"
- register "FAN2.smart.tmpin" = "3"
- register "FAN2.smart.tmp_off" = "25"
- register "FAN2.smart.tmp_start" = "30"
- register "FAN2.smart.tmp_full" = "65"
- register "FAN2.smart.tmp_delta" = "3"
- register "FAN2.smart.smoothing" = "1"
- register "FAN2.smart.pwm_start" = "0"
- register "FAN2.smart.slope" = "10"
-
- device pnp 2e.0 on # Floppy
- io 0x60 = 0x3f0
- irq 0x70 = 6
- drq 0x74 = 2
- irq 0xf0 = 0x00
- irq 0xf1 = 0x80
- end
- device pnp 2e.1 on # COM1
- io 0x60 = 0x3f8
- irq 0x70 = 4
- end
- device pnp 2e.2 on # COM2
- io 0x60 = 0x2f8
- irq 0x70 = 3
- end
- device pnp 2e.3 on # Parallel port
- io 0x60 = 0x378
- irq 0x70 = 7
- io 0x62 = 0x000
- drq 0x74 = 4
- irq 0xf0 = 0x08
- end
- device pnp 2e.4 on # Environment controller
- io 0x60 = 0x290
- irq 0x70 = 0x00
- io 0x62 = 0x000
- irq 0xf0 = 0x80
- irq 0xf1 = 0x00
- irq 0xf2 = 0x0a
- irq 0xf3 = 0x80
- irq 0xf4 = 0x00
- irq 0xf5 = 0x00
- irq 0xf6 = 0xff
- end
- device pnp 2e.5 on # Keyboard
- io 0x60 = 0x60
- irq 0x70 = 1
- io 0x62 = 0x64
- irq 0xf0 = 0x48
- end
- device pnp 2e.6 on # Mouse
- irq 0x70 = 12
- irq 0x71 = 2
- irq 0xf0 = 0
- end
- end
end
device pci 1f.1 on # PATA/IDE
subsystemid 0x1458 0xb004
diff --git a/src/mainboard/gigabyte/ga-g41m-es2l/early_init.c b/src/mainboard/gigabyte/ga-g41m-es2l/early_init.c
index 4b0ea16..c204070 100644
--- a/src/mainboard/gigabyte/ga-g41m-es2l/early_init.c
+++ b/src/mainboard/gigabyte/ga-g41m-es2l/early_init.c
@@ -4,12 +4,7 @@
#include <device/pci_ops.h>
#include <southbridge/intel/i82801gx/i82801gx.h>
#include <northbridge/intel/x4x/x4x.h>
-#include <superio/ite/it8718f/it8718f.h>
-#include <superio/ite/common/ite.h>
-
-#define SERIAL_DEV PNP_DEV(0x2e, IT8718F_SP1)
-#define GPIO_DEV PNP_DEV(0x2e, IT8718F_GPIO)
-#define EC_DEV PNP_DEV(0x2e, IT8718F_EC)
+#include <mainboard/superio.h>
/* Early mainboard specific GPIO setup.
* We should use standard gpio.h eventually
@@ -17,43 +12,7 @@
void bootblock_mainboard_early_init(void)
{
- /* Set default GPIOs on superio */
- ite_reg_write(GPIO_DEV, 0x25, 0x00);
- ite_reg_write(GPIO_DEV, 0x26, 0xc7);
- ite_reg_write(GPIO_DEV, 0x27, 0x80);
- ite_reg_write(GPIO_DEV, 0x28, 0x41);
- ite_reg_write(GPIO_DEV, 0x29, 0x0a);
- ite_reg_write(GPIO_DEV, 0x2c, 0x01);
- ite_reg_write(GPIO_DEV, 0x62, 0x08);
- ite_reg_write(GPIO_DEV, 0x72, 0x00);
- ite_reg_write(GPIO_DEV, 0x73, 0x00);
- ite_reg_write(GPIO_DEV, 0xb8, 0x00);
- ite_reg_write(GPIO_DEV, 0xbb, 0x40);
- ite_reg_write(GPIO_DEV, 0xc0, 0x00);
- ite_reg_write(GPIO_DEV, 0xc1, 0xc7);
- ite_reg_write(GPIO_DEV, 0xc2, 0x80);
- ite_reg_write(GPIO_DEV, 0xc3, 0x01);
- ite_reg_write(GPIO_DEV, 0xc4, 0x0a);
- ite_reg_write(GPIO_DEV, 0xc8, 0x00);
- ite_reg_write(GPIO_DEV, 0xc9, 0x04);
- ite_reg_write(GPIO_DEV, 0xcb, 0x00);
- ite_reg_write(GPIO_DEV, 0xcc, 0x02);
- ite_reg_write(GPIO_DEV, 0xf0, 0x10);
- ite_reg_write(GPIO_DEV, 0xf1, 0x40);
- ite_reg_write(GPIO_DEV, 0xf6, 0x26);
- ite_reg_write(GPIO_DEV, 0xfc, 0x52);
-
- ite_reg_write(EC_DEV, 0xf0, 0x80);
- ite_reg_write(EC_DEV, 0xf1, 0x00);
- ite_reg_write(EC_DEV, 0xf2, 0x0a);
- ite_reg_write(EC_DEV, 0xf3, 0x80);
- ite_reg_write(EC_DEV, 0x70, 0x00); // Don't use IRQ9
- ite_reg_write(EC_DEV, 0x30, 0x01); // Enable
-
- ite_enable_serial(SERIAL_DEV, CONFIG_TTYS0_BASE);
-
- /* Disable SIO reboot */
- ite_reg_write(GPIO_DEV, 0xEF, 0x7E);
+ mainboard_early_superio();
/* IRQ routing */
RCBA32(D31IP) = 0x00002210;
diff --git a/src/mainboard/gigabyte/ga-g41m-es2l/include/mainboard/superio.h b/src/mainboard/gigabyte/ga-g41m-es2l/include/mainboard/superio.h
new file mode 100644
index 0000000..ddc7d04
--- /dev/null
+++ b/src/mainboard/gigabyte/ga-g41m-es2l/include/mainboard/superio.h
@@ -0,0 +1,8 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+
+#ifndef MAINBOARD_GIGABYTE_GA_G41M_ES2l_SUPERIO
+#define MAINBOARD_GIGABYTE_GA_G41M_ES2l_SUPERIO
+
+void mainboard_early_superio(void);
+
+#endif
diff --git a/src/mainboard/gigabyte/ga-g41m-es2l/superio.h b/src/mainboard/gigabyte/ga-g41m-es2l/superio.h
new file mode 100644
index 0000000..62bf591
--- /dev/null
+++ b/src/mainboard/gigabyte/ga-g41m-es2l/superio.h
@@ -0,0 +1,8 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+
+#ifdef MAINBOARD_GIGABYTE_GA_G41M_ES2l_SUPERIO
+#define MAINBOARD_GIGABYTE_GA_G41M_ES2l_SUPERIO
+
+
+
+#endif
diff --git a/src/mainboard/gigabyte/ga-g41m-es2l/gpio.c b/src/mainboard/gigabyte/ga-g41m-es2l/variants/ga-g41m-es2l/gpio.c
similarity index 100%
rename from src/mainboard/gigabyte/ga-g41m-es2l/gpio.c
rename to src/mainboard/gigabyte/ga-g41m-es2l/variants/ga-g41m-es2l/gpio.c
diff --git a/src/mainboard/gigabyte/ga-g41m-es2l/hda_verb.c b/src/mainboard/gigabyte/ga-g41m-es2l/variants/ga-g41m-es2l/hda_verb.c
similarity index 100%
rename from src/mainboard/gigabyte/ga-g41m-es2l/hda_verb.c
rename to src/mainboard/gigabyte/ga-g41m-es2l/variants/ga-g41m-es2l/hda_verb.c
diff --git a/src/mainboard/gigabyte/ga-g41m-es2l/variants/ga-g41m-es2l/overridetree.cb b/src/mainboard/gigabyte/ga-g41m-es2l/variants/ga-g41m-es2l/overridetree.cb
new file mode 100644
index 0000000..f481195
--- /dev/null
+++ b/src/mainboard/gigabyte/ga-g41m-es2l/variants/ga-g41m-es2l/overridetree.cb
@@ -0,0 +1,84 @@
+# SPDX-License-Identifier: GPL-2.0-or-later
+
+chip northbridge/intel/x4x # Northbridge
+ device domain 0 on # PCI domain
+ chip southbridge/intel/i82801gx # Southbridge
+ device pci 1f.0 on # ISA bridge
+ subsystemid 0x1458 0x5001
+ chip superio/ite/it8718f # Super I/O
+ register "TMPIN1.mode" = "THERMAL_RESISTOR"
+ register "TMPIN2.mode" = "THERMAL_RESISTOR"
+ register "TMPIN3.mode" = "THERMAL_DIODE"
+ register "TMPIN3.offset" = "0"
+ register "ec.vin_mask" = "VIN7 | VIN4 | VIN3 | VIN2 | VIN1 | VIN0"
+
+ register "FAN1.mode" = "FAN_SMART_AUTOMATIC"
+ register "FAN1.smart.tmpin" = "3"
+ register "FAN1.smart.tmp_off" = "25"
+ register "FAN1.smart.tmp_start" = "30"
+ register "FAN1.smart.tmp_full" = "65"
+ register "FAN1.smart.tmp_delta" = "3"
+ register "FAN1.smart.smoothing" = "1"
+ register "FAN1.smart.pwm_start" = "0"
+ register "FAN1.smart.slope" = "10"
+
+ register "FAN2.mode" = "FAN_SMART_AUTOMATIC"
+ register "FAN2.smart.tmpin" = "3"
+ register "FAN2.smart.tmp_off" = "25"
+ register "FAN2.smart.tmp_start" = "30"
+ register "FAN2.smart.tmp_full" = "65"
+ register "FAN2.smart.tmp_delta" = "3"
+ register "FAN2.smart.smoothing" = "1"
+ register "FAN2.smart.pwm_start" = "0"
+ register "FAN2.smart.slope" = "10"
+
+ device pnp 2e.0 on # Floppy
+ io 0x60 = 0x3f0
+ irq 0x70 = 6
+ drq 0x74 = 2
+ irq 0xf0 = 0x00
+ irq 0xf1 = 0x80
+ end
+ device pnp 2e.1 on # COM1
+ io 0x60 = 0x3f8
+ irq 0x70 = 4
+ end
+ device pnp 2e.2 on # COM2
+ io 0x60 = 0x2f8
+ irq 0x70 = 3
+ end
+ device pnp 2e.3 on # Parallel port
+ io 0x60 = 0x378
+ irq 0x70 = 7
+ io 0x62 = 0x000
+ drq 0x74 = 4
+ irq 0xf0 = 0x08
+ end
+ device pnp 2e.4 on # Environment controller
+ io 0x60 = 0x290
+ irq 0x70 = 0x00
+ io 0x62 = 0x000
+ irq 0xf0 = 0x80
+ irq 0xf1 = 0x00
+ irq 0xf2 = 0x0a
+ irq 0xf3 = 0x80
+ irq 0xf4 = 0x00
+ irq 0xf5 = 0x00
+ irq 0xf6 = 0xff
+ end
+ device pnp 2e.5 on # Keyboard
+ io 0x60 = 0x60
+ irq 0x70 = 1
+ io 0x62 = 0x64
+ irq 0xf0 = 0x48
+ end
+ device pnp 2e.6 on # Mouse
+ irq 0x70 = 12
+ irq 0x71 = 2
+ irq 0xf0 = 0
+ end
+ end
+ end
+ end
+ end
+end
diff --git a/src/mainboard/gigabyte/ga-g41m-es2l/variants/ga-g41m-es2l/superio.c b/src/mainboard/gigabyte/ga-g41m-es2l/variants/ga-g41m-es2l/superio.c
new file mode 100644
index 0000000..c759532
--- /dev/null
+++ b/src/mainboard/gigabyte/ga-g41m-es2l/variants/ga-g41m-es2l/superio.c
@@ -0,0 +1,49 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+#include <mainboard/superio.h>
+#include <superio/ite/it8718f/it8718f.h>
+#include <superio/ite/common/ite.h>
+
+#define SERIAL_DEV PNP_DEV(0x2e, IT8718F_SP1)
+#define GPIO_DEV PNP_DEV(0x2e, IT8718F_GPIO)
+#define EC_DEV PNP_DEV(0x2e, IT8718F_EC)
+
+void mainboard_early_superio(void)
+{
+ /* Set default GPIOs on superio */
+ ite_reg_write(GPIO_DEV, 0x25, 0x00);
+ ite_reg_write(GPIO_DEV, 0x26, 0xc7);
+ ite_reg_write(GPIO_DEV, 0x27, 0x80);
+ ite_reg_write(GPIO_DEV, 0x28, 0x41);
+ ite_reg_write(GPIO_DEV, 0x29, 0x0a);
+ ite_reg_write(GPIO_DEV, 0x2c, 0x01);
+ ite_reg_write(GPIO_DEV, 0x62, 0x08);
+ ite_reg_write(GPIO_DEV, 0x72, 0x00);
+ ite_reg_write(GPIO_DEV, 0x73, 0x00);
+ ite_reg_write(GPIO_DEV, 0xb8, 0x00);
+ ite_reg_write(GPIO_DEV, 0xbb, 0x40);
+ ite_reg_write(GPIO_DEV, 0xc0, 0x00);
+ ite_reg_write(GPIO_DEV, 0xc1, 0xc7);
+ ite_reg_write(GPIO_DEV, 0xc2, 0x80);
+ ite_reg_write(GPIO_DEV, 0xc3, 0x01);
+ ite_reg_write(GPIO_DEV, 0xc4, 0x0a);
+ ite_reg_write(GPIO_DEV, 0xc8, 0x00);
+ ite_reg_write(GPIO_DEV, 0xc9, 0x04);
+ ite_reg_write(GPIO_DEV, 0xcb, 0x00);
+ ite_reg_write(GPIO_DEV, 0xcc, 0x02);
+ ite_reg_write(GPIO_DEV, 0xf0, 0x10);
+ ite_reg_write(GPIO_DEV, 0xf1, 0x40);
+ ite_reg_write(GPIO_DEV, 0xf6, 0x26);
+ ite_reg_write(GPIO_DEV, 0xfc, 0x52);
+
+ ite_reg_write(EC_DEV, 0xf0, 0x80);
+ ite_reg_write(EC_DEV, 0xf1, 0x00);
+ ite_reg_write(EC_DEV, 0xf2, 0x0a);
+ ite_reg_write(EC_DEV, 0xf3, 0x80);
+ ite_reg_write(EC_DEV, 0x70, 0x00); // Don't use IRQ9
+ ite_reg_write(EC_DEV, 0x30, 0x01); // Enable
+
+ ite_enable_serial(SERIAL_DEV, CONFIG_TTYS0_BASE);
+
+ /* Disable SIO reboot */
+ ite_reg_write(GPIO_DEV, 0xEF, 0x7E);
+}
--
To view, visit https://review.coreboot.org/c/coreboot/+/41867
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-Change-Id: I0b22731849e157b76be97dbe02a7538f1cea472d
Gerrit-Change-Number: 41867
Gerrit-PatchSet: 1
Gerrit-Owner: Arthur Heymans <arthur(a)aheymans.xyz>
Gerrit-Reviewer: Martin Roth <martinroth(a)google.com>
Gerrit-Reviewer: Patrick Georgi <pgeorgi(a)google.com>
Gerrit-MessageType: newchange
3
3

Change in coreboot[master]: The .config is overwritten when added to coreboot.rom via CBFS at the...
by Jeremy Jackson (Code Review) Aug. 7, 2023
by Jeremy Jackson (Code Review) Aug. 7, 2023
Aug. 7, 2023
Jeremy Jackson has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/42028 )
Change subject: The .config is overwritten when added to coreboot.rom via CBFS at the end of the build (if you choose that option)... should this be a separate file for each of fallback and normal? Since there can be two different versions and/or configurations, would fallback/config and normal/config make more sense? Also the "revision" file might benefit from similar treatment.
......................................................................
The .config is overwritten when added to coreboot.rom via CBFS at the end
of the build (if you choose that option)... should this be a separate file
for each of fallback and normal? Since there can be two different versions
and/or configurations, would fallback/config and normal/config make more
sense? Also the "revision" file might benefit from similar treatment.
Signed-off-by: Jeremy Jackson <jerj(a)coplanar.net>
Change-Id: I3e904e44137f731f239f51dbf224965f33838e19
---
M Makefile.inc
1 file changed, 6 insertions(+), 6 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/28/42028/1
diff --git a/Makefile.inc b/Makefile.inc
index 86467a6..b547f11 100644
--- a/Makefile.inc
+++ b/Makefile.inc
@@ -1195,13 +1195,13 @@
vgaroms/seavgabios.bin-file := $(CONFIG_PAYLOAD_VGABIOS_FILE)
vgaroms/seavgabios.bin-type := raw
-cbfs-files-$(CONFIG_INCLUDE_CONFIG_FILE) += config
-config-file := $(DOTCONFIG):defconfig
-config-type := raw
+cbfs-files-$(CONFIG_INCLUDE_CONFIG_FILE) += $(CONFIG_CBFS_PREFIX)/config
+$(CONFIG_CBFS_PREFIX)/config-file := $(DOTCONFIG):defconfig
+$(CONFIG_CBFS_PREFIX)/config-type := raw
-cbfs-files-$(CONFIG_INCLUDE_CONFIG_FILE) += revision
-revision-file := $(obj)/build.h
-revision-type := raw
+cbfs-files-$(CONFIG_INCLUDE_CONFIG_FILE) += $(CONFIG_CBFS_PREFIX)/revision
+$(CONFIG_CBFS_PREFIX)/revision-file := $(obj)/build.h
+$(CONFIG_CBFS_PREFIX)/revision-type := raw
BOOTSPLASH_SUFFIX=$(suffix $(call strip_quotes,$(CONFIG_BOOTSPLASH_FILE)))
cbfs-files-$(CONFIG_BOOTSPLASH_IMAGE) += bootsplash$(BOOTSPLASH_SUFFIX)
--
To view, visit https://review.coreboot.org/c/coreboot/+/42028
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-Change-Id: I3e904e44137f731f239f51dbf224965f33838e19
Gerrit-Change-Number: 42028
Gerrit-PatchSet: 1
Gerrit-Owner: Jeremy Jackson <jerj(a)coplanar.net>
Gerrit-MessageType: newchange
7
14

Change in coreboot[master]: WIP: Hash RAM contents on S3 entry and verify on S3 resume
by Raul Rangel (Code Review) Aug. 7, 2023
by Raul Rangel (Code Review) Aug. 7, 2023
Aug. 7, 2023
Raul Rangel has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/42890 )
Change subject: WIP: Hash RAM contents on S3 entry and verify on S3 resume
......................................................................
WIP: Hash RAM contents on S3 entry and verify on S3 resume
I used murmur3 since it's supposed to be fast. Though I don't think the
license is really compatible.
The ram_hash code still needs some refactoring to reduce duplication and
to add the ability to handle unaligned blocks.
BUG=b:159081993
TEST=Boot trembyle and see no verification failures.
Signed-off-by: Raul E Rangel <rrangel(a)chromium.org>
Change-Id: I6b38facba17bdd57a94987cfb49e71067ff8b769
---
M Makefile.inc
M src/arch/x86/acpi_s3.c
A src/include/murmur3.h
A src/include/ram_hash.h
M src/lib/Makefile.inc
A src/lib/murmur3.c
A src/lib/ram_hash.c
M src/soc/amd/picasso/chip.c
M src/soc/amd/picasso/memlayout.ld
M src/soc/amd/picasso/smihandler.c
10 files changed, 595 insertions(+), 2 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/90/42890/1
diff --git a/Makefile.inc b/Makefile.inc
index 86335d9..b7020e8 100644
--- a/Makefile.inc
+++ b/Makefile.inc
@@ -410,8 +410,8 @@
CFLAGS_common += -Wwrite-strings -Wredundant-decls -Wno-trigraphs -Wimplicit-fallthrough
CFLAGS_common += -Wstrict-aliasing -Wshadow -Wdate-time -Wtype-limits -Wvla
CFLAGS_common += -Wlogical-op -Wduplicated-cond -Wdangling-else
-CFLAGS_common += -fno-common -ffreestanding -fno-builtin -fomit-frame-pointer
-CFLAGS_common += -ffunction-sections -fdata-sections -fno-pie
+CFLAGS_common += -fno-common -ffreestanding -fno-builtin -fmit-frame-pointer
+CFLAGS_common += -ffunction-sections -fdata-sections -fno-pie -Wno-implicit-fallthrough
ifeq ($(CONFIG_COMPILER_GCC),y)
# Don't add these GCC specific flags when running scan-build
ifeq ($(CCC_ANALYZER_OUTPUT_FORMAT),)
diff --git a/src/arch/x86/acpi_s3.c b/src/arch/x86/acpi_s3.c
index d4c697e..9c209b2 100644
--- a/src/arch/x86/acpi_s3.c
+++ b/src/arch/x86/acpi_s3.c
@@ -9,6 +9,7 @@
#include <cpu/x86/smm.h>
#include <fallback.h>
#include <timestamp.h>
+#include <ram_hash.h>
#include <romstage_handoff.h>
#if ENV_RAMSTAGE || ENV_POSTCAR
@@ -70,6 +71,8 @@
timestamp_add_now(TS_ACPI_WAKE_JUMP);
+ verify_ram();
+
acpi_do_wakeup((uintptr_t)vector);
}
diff --git a/src/include/murmur3.h b/src/include/murmur3.h
new file mode 100644
index 0000000..138f87f
--- /dev/null
+++ b/src/include/murmur3.h
@@ -0,0 +1,29 @@
+//-----------------------------------------------------------------------------
+// MurmurHash3 was written by Austin Appleby, and is placed in the
+// public domain. The author hereby disclaims copyright to this source
+// code.
+
+#ifndef _MURMURHASH3_H_
+#define _MURMURHASH3_H_
+
+#include <stdint.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+//-----------------------------------------------------------------------------
+
+void MurmurHash3_x86_32 (const void *key, int len, uint32_t seed, uint32_t *out);
+
+void MurmurHash3_x86_128(const void *key, int len, uint32_t seed, void *out);
+
+void MurmurHash3_x64_128(const void *key, int len, uint32_t seed, void *out);
+
+//-----------------------------------------------------------------------------
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // _MURMURHASH3_H_
diff --git a/src/include/ram_hash.h b/src/include/ram_hash.h
new file mode 100644
index 0000000..67eaa76
--- /dev/null
+++ b/src/include/ram_hash.h
@@ -0,0 +1,9 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+
+#ifndef RAM_HASH_H
+#define RAM_HASH_H
+
+void hash_ram(void);
+void verify_ram(void);
+
+#endif /* RAM_HASH_H */
diff --git a/src/lib/Makefile.inc b/src/lib/Makefile.inc
index e0003bd..5bf0df2 100644
--- a/src/lib/Makefile.inc
+++ b/src/lib/Makefile.inc
@@ -145,6 +145,10 @@
ramstage-y += imd_cbmem.c
ramstage-y += imd.c
+bootblock-y += ram_hash.c crc32.c murmur3.c
+ramstage-y += ram_hash.c crc32.c murmur3.c
+smm-y += ram_hash.c crc32.c murmur3.c
+
postcar-$(CONFIG_VENDOR_EMULATION) += ramdetect.c
postcar-y += cbmem_common.c
postcar-$(CONFIG_CONSOLE_CBMEM) += cbmem_console.c
diff --git a/src/lib/murmur3.c b/src/lib/murmur3.c
new file mode 100644
index 0000000..f2b6b18
--- /dev/null
+++ b/src/lib/murmur3.c
@@ -0,0 +1,314 @@
+//-----------------------------------------------------------------------------
+// MurmurHash3 was written by Austin Appleby, and is placed in the public
+// domain. The author hereby disclaims copyright to this source code.
+
+// Note - The x86 and x64 versions do _not_ produce the same results, as the
+// algorithms are optimized for their respective platforms. You can still
+// compile and run any of them on any platform, but your performance with the
+// non-native version will be less than optimal.
+
+#include "murmur3.h"
+
+//-----------------------------------------------------------------------------
+// Platform-specific functions and macros
+
+#ifdef __GNUC__
+#define FORCE_INLINE __attribute__((always_inline)) inline
+#else
+#define FORCE_INLINE inline
+#endif
+
+static FORCE_INLINE uint32_t rotl32 ( uint32_t x, int8_t r )
+{
+ return (x << r) | (x >> (32 - r));
+}
+
+static FORCE_INLINE uint64_t rotl64 ( uint64_t x, int8_t r )
+{
+ return (x << r) | (x >> (64 - r));
+}
+
+#define ROTL32(x,y) rotl32(x,y)
+#define ROTL64(x,y) rotl64(x,y)
+
+#define BIG_CONSTANT(x) (x##LLU)
+
+//-----------------------------------------------------------------------------
+// Block read - if your platform needs to do endian-swapping or can only
+// handle aligned reads, do the conversion here
+
+#define getblock(p, i) (p[i])
+
+//-----------------------------------------------------------------------------
+// Finalization mix - force all bits of a hash block to avalanche
+
+static FORCE_INLINE uint32_t fmix32 ( uint32_t h )
+{
+ h ^= h >> 16;
+ h *= 0x85ebca6b;
+ h ^= h >> 13;
+ h *= 0xc2b2ae35;
+ h ^= h >> 16;
+
+ return h;
+}
+
+//----------
+
+static FORCE_INLINE uint64_t fmix64 ( uint64_t k )
+{
+ k ^= k >> 33;
+ k *= BIG_CONSTANT(0xff51afd7ed558ccd);
+ k ^= k >> 33;
+ k *= BIG_CONSTANT(0xc4ceb9fe1a85ec53);
+ k ^= k >> 33;
+
+ return k;
+}
+
+//-----------------------------------------------------------------------------
+
+void MurmurHash3_x86_32 ( const void * key, int len,
+ uint32_t seed, uint32_t * out )
+{
+ const uint8_t * data = (const uint8_t*)key;
+ const int nblocks = len / 4;
+ int i;
+
+ uint32_t h1 = seed;
+
+ uint32_t c1 = 0xcc9e2d51;
+ uint32_t c2 = 0x1b873593;
+
+ //----------
+ // body
+
+ const uint32_t * blocks = (const uint32_t *)(data + nblocks*4);
+
+ for(i = -nblocks; i; i++)
+ {
+ uint32_t k1 = getblock(blocks,i);
+
+ k1 *= c1;
+ k1 = ROTL32(k1,15);
+ k1 *= c2;
+
+ h1 ^= k1;
+ h1 = ROTL32(h1,13);
+ h1 = h1*5+0xe6546b64;
+ }
+
+ //----------
+ // tail
+
+ const uint8_t * tail = (const uint8_t*)(data + nblocks*4);
+
+ uint32_t k1 = 0;
+
+ switch(len & 3)
+ {
+ case 3: k1 ^= tail[2] << 16;
+ case 2: k1 ^= tail[1] << 8;
+ case 1: k1 ^= tail[0];
+ k1 *= c1; k1 = ROTL32(k1,15); k1 *= c2; h1 ^= k1;
+ };
+
+ //----------
+ // finalization
+
+ h1 ^= len;
+
+ h1 = fmix32(h1);
+
+ *(uint32_t*)out = h1;
+}
+
+//-----------------------------------------------------------------------------
+
+void MurmurHash3_x86_128 ( const void * key, const int len,
+ uint32_t seed, void * out )
+{
+ const uint8_t * data = (const uint8_t*)key;
+ const int nblocks = len / 16;
+ int i;
+
+ uint32_t h1 = seed;
+ uint32_t h2 = seed;
+ uint32_t h3 = seed;
+ uint32_t h4 = seed;
+
+ uint32_t c1 = 0x239b961b;
+ uint32_t c2 = 0xab0e9789;
+ uint32_t c3 = 0x38b34ae5;
+ uint32_t c4 = 0xa1e38b93;
+
+ //----------
+ // body
+
+ const uint32_t * blocks = (const uint32_t *)(data + nblocks*16);
+
+ for(i = -nblocks; i; i++)
+ {
+ uint32_t k1 = getblock(blocks,i*4+0);
+ uint32_t k2 = getblock(blocks,i*4+1);
+ uint32_t k3 = getblock(blocks,i*4+2);
+ uint32_t k4 = getblock(blocks,i*4+3);
+
+ k1 *= c1; k1 = ROTL32(k1,15); k1 *= c2; h1 ^= k1;
+
+ h1 = ROTL32(h1,19); h1 += h2; h1 = h1*5+0x561ccd1b;
+
+ k2 *= c2; k2 = ROTL32(k2,16); k2 *= c3; h2 ^= k2;
+
+ h2 = ROTL32(h2,17); h2 += h3; h2 = h2*5+0x0bcaa747;
+
+ k3 *= c3; k3 = ROTL32(k3,17); k3 *= c4; h3 ^= k3;
+
+ h3 = ROTL32(h3,15); h3 += h4; h3 = h3*5+0x96cd1c35;
+
+ k4 *= c4; k4 = ROTL32(k4,18); k4 *= c1; h4 ^= k4;
+
+ h4 = ROTL32(h4,13); h4 += h1; h4 = h4*5+0x32ac3b17;
+ }
+
+ //----------
+ // tail
+
+ const uint8_t * tail = (const uint8_t*)(data + nblocks*16);
+
+ uint32_t k1 = 0;
+ uint32_t k2 = 0;
+ uint32_t k3 = 0;
+ uint32_t k4 = 0;
+
+ switch(len & 15)
+ {
+ case 15: k4 ^= tail[14] << 16;
+ case 14: k4 ^= tail[13] << 8;
+ case 13: k4 ^= tail[12] << 0;
+ k4 *= c4; k4 = ROTL32(k4,18); k4 *= c1; h4 ^= k4;
+
+ case 12: k3 ^= tail[11] << 24;
+ case 11: k3 ^= tail[10] << 16;
+ case 10: k3 ^= tail[ 9] << 8;
+ case 9: k3 ^= tail[ 8] << 0;
+ k3 *= c3; k3 = ROTL32(k3,17); k3 *= c4; h3 ^= k3;
+
+ case 8: k2 ^= tail[ 7] << 24;
+ case 7: k2 ^= tail[ 6] << 16;
+ case 6: k2 ^= tail[ 5] << 8;
+ case 5: k2 ^= tail[ 4] << 0;
+ k2 *= c2; k2 = ROTL32(k2,16); k2 *= c3; h2 ^= k2;
+
+ case 4: k1 ^= tail[ 3] << 24;
+ case 3: k1 ^= tail[ 2] << 16;
+ case 2: k1 ^= tail[ 1] << 8;
+ case 1: k1 ^= tail[ 0] << 0;
+ k1 *= c1; k1 = ROTL32(k1,15); k1 *= c2; h1 ^= k1;
+ };
+
+ //----------
+ // finalization
+
+ h1 ^= len; h2 ^= len; h3 ^= len; h4 ^= len;
+
+ h1 += h2; h1 += h3; h1 += h4;
+ h2 += h1; h3 += h1; h4 += h1;
+
+ h1 = fmix32(h1);
+ h2 = fmix32(h2);
+ h3 = fmix32(h3);
+ h4 = fmix32(h4);
+
+ h1 += h2; h1 += h3; h1 += h4;
+ h2 += h1; h3 += h1; h4 += h1;
+
+ ((uint32_t*)out)[0] = h1;
+ ((uint32_t*)out)[1] = h2;
+ ((uint32_t*)out)[2] = h3;
+ ((uint32_t*)out)[3] = h4;
+}
+
+//-----------------------------------------------------------------------------
+
+void MurmurHash3_x64_128 ( const void * key, const int len,
+ const uint32_t seed, void * out )
+{
+ const uint8_t * data = (const uint8_t*)key;
+ const int nblocks = len / 16;
+ int i;
+
+ uint64_t h1 = seed;
+ uint64_t h2 = seed;
+
+ uint64_t c1 = BIG_CONSTANT(0x87c37b91114253d5);
+ uint64_t c2 = BIG_CONSTANT(0x4cf5ad432745937f);
+
+ //----------
+ // body
+
+ const uint64_t * blocks = (const uint64_t *)(data);
+
+ for(i = 0; i < nblocks; i++)
+ {
+ uint64_t k1 = getblock(blocks,i*2+0);
+ uint64_t k2 = getblock(blocks,i*2+1);
+
+ k1 *= c1; k1 = ROTL64(k1,31); k1 *= c2; h1 ^= k1;
+
+ h1 = ROTL64(h1,27); h1 += h2; h1 = h1*5+0x52dce729;
+
+ k2 *= c2; k2 = ROTL64(k2,33); k2 *= c1; h2 ^= k2;
+
+ h2 = ROTL64(h2,31); h2 += h1; h2 = h2*5+0x38495ab5;
+ }
+
+ //----------
+ // tail
+
+ const uint8_t * tail = (const uint8_t*)(data + nblocks*16);
+
+ uint64_t k1 = 0;
+ uint64_t k2 = 0;
+
+ switch(len & 15)
+ {
+ case 15: k2 ^= (uint64_t)(tail[14]) << 48;
+ case 14: k2 ^= (uint64_t)(tail[13]) << 40;
+ case 13: k2 ^= (uint64_t)(tail[12]) << 32;
+ case 12: k2 ^= (uint64_t)(tail[11]) << 24;
+ case 11: k2 ^= (uint64_t)(tail[10]) << 16;
+ case 10: k2 ^= (uint64_t)(tail[ 9]) << 8;
+ case 9: k2 ^= (uint64_t)(tail[ 8]) << 0;
+ k2 *= c2; k2 = ROTL64(k2,33); k2 *= c1; h2 ^= k2;
+
+ case 8: k1 ^= (uint64_t)(tail[ 7]) << 56;
+ case 7: k1 ^= (uint64_t)(tail[ 6]) << 48;
+ case 6: k1 ^= (uint64_t)(tail[ 5]) << 40;
+ case 5: k1 ^= (uint64_t)(tail[ 4]) << 32;
+ case 4: k1 ^= (uint64_t)(tail[ 3]) << 24;
+ case 3: k1 ^= (uint64_t)(tail[ 2]) << 16;
+ case 2: k1 ^= (uint64_t)(tail[ 1]) << 8;
+ case 1: k1 ^= (uint64_t)(tail[ 0]) << 0;
+ k1 *= c1; k1 = ROTL64(k1,31); k1 *= c2; h1 ^= k1;
+ };
+
+ //----------
+ // finalization
+
+ h1 ^= len; h2 ^= len;
+
+ h1 += h2;
+ h2 += h1;
+
+ h1 = fmix64(h1);
+ h2 = fmix64(h2);
+
+ h1 += h2;
+ h2 += h1;
+
+ ((uint64_t*)out)[0] = h1;
+ ((uint64_t*)out)[1] = h2;
+}
+
+//-----------------------------------------------------------------------------
diff --git a/src/lib/ram_hash.c b/src/lib/ram_hash.c
new file mode 100644
index 0000000..9f07183
--- /dev/null
+++ b/src/lib/ram_hash.c
@@ -0,0 +1,223 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+
+#include <stdint.h>
+#include <murmur3.h>
+#include <ram_hash.h>
+#include <string.h>
+#include <lib.h>
+#include <console/console.h>
+#include <commonlib/bsd/helpers.h>
+
+#define HASH_BUFFER 0x2BD000
+#define EHASH_BUFFER 0x3BD000
+// extern char HASH_BUFFER[];
+// extern char EHASH_BUFFER[];
+
+struct hash_range {
+ uintptr_t start;
+ uintptr_t end;
+ unsigned int block_size;
+ unsigned int diff;
+};
+
+struct hash_entry {
+ uint32_t hash;
+ uint32_t data[];
+};
+
+struct hash_range mem_layout[] = {
+ {
+ .start = 0x1000,
+ .end = 0xa0000,
+ .block_size = 1 * KiB,
+ .diff = 1
+ },
+ {
+ .start = 0x3bd000,
+ .end = 0x3c0000,
+ .block_size = 4 * KiB,
+ .diff = 0
+ },
+ {
+ .start = 0x3c0000,
+ .end = 0xcc4c0000,
+ .block_size = 256 * KiB,
+ .diff = 0
+ },
+ {
+ .start = 0xcc4c0000,
+ .end = 0xcc51c000,
+ .block_size = 4 * KiB,
+ .diff = 0
+ },
+};
+
+static struct hash_entry *hash_range(const struct hash_range *range, struct hash_entry *entry,
+ size_t buffer_size)
+{
+ unsigned int total_blocks = (range->end - range->start) / range->block_size;
+ void *current;
+ unsigned int i;
+
+ for (i = 0; i < total_blocks; ++i) {
+ current = (void *)(range->start + i * range->block_size);
+
+ if (!(i % 256))
+ printk(BIOS_DEBUG, "%s: block %u/%u @ %p\n", __func__, i, total_blocks,
+ current);
+
+ // printk(BIOS_ERR, "%s: buffer_size: %zd\n", __func__, buffer_size);
+
+ if (buffer_size < sizeof(*entry)) {
+ printk(BIOS_ERR, "%s: Hash buffer is too small for entry\n", __func__);
+ return NULL;
+ }
+
+ // printk(BIOS_ERR, "%s: current: %p\n", __func__, current);
+ // printk(BIOS_ERR, "%s: current_entry: %p\n", __func__, entry);
+
+ /* Allocate one entry in the buffer */
+ buffer_size -= sizeof(*entry);
+
+ MurmurHash3_x86_32(current, range->block_size, 0xDEADBEEF, &entry->hash);
+ // printk(BIOS_ERR, "%s: crc: %#x\n", __func__, entry->hash);
+
+ if (range->diff) {
+ if (buffer_size < range->block_size) {
+ printk(BIOS_DEBUG, "%s: Hash buffer is too small for data\n",
+ __func__);
+ return NULL;
+ }
+
+ /* Allocate diff size in buffer */
+ buffer_size -= range->block_size;
+ memcpy(entry->data, current, range->block_size);
+
+ entry = (struct hash_entry *)((uintptr_t)(entry + 1)
+ + range->block_size);
+ } else {
+ entry++;
+ }
+ // printk(BIOS_ERR, "%s: next_entry: %p\n", __func__, entry);
+ }
+
+ return entry;
+}
+
+void hash_ram(void)
+{
+ struct hash_entry *current_entry = (struct hash_entry *)HASH_BUFFER;
+ struct hash_range *range;
+ unsigned int i;
+
+ printk(BIOS_INFO, "%s: Start: HASH_BUFFER: %#x, EHASH_BUFFER: %#x\n", __func__,
+ HASH_BUFFER, EHASH_BUFFER);
+
+ for (i = 0; i < ARRAY_SIZE(mem_layout); ++i) {
+ range = &mem_layout[i];
+ printk(BIOS_DEBUG, "%s: Hashing range %p -> %p\n", __func__,
+ (void *)range->start, (void *)range->end);
+ current_entry =
+ hash_range(range, current_entry,
+ ((uintptr_t)EHASH_BUFFER - (uintptr_t)current_entry));
+
+ if (!current_entry) {
+ printk(BIOS_ERR, "%s: Hash buffer is too small\n", __func__);
+ break;
+ }
+ }
+
+ printk(BIOS_INFO, "%s: Done\n", __func__);
+}
+
+static struct hash_entry *verify_range(const struct hash_range *range, struct hash_entry *entry,
+ size_t buffer_size)
+{
+ unsigned int total_blocks = (range->end - range->start) / range->block_size;
+ void *current;
+ unsigned int i;
+ uint32_t crc;
+
+ for (i = 0; i < total_blocks; ++i) {
+ current = (void *)(range->start + i * range->block_size);
+
+ if (!(i % 256))
+ printk(BIOS_DEBUG, "%s: block %u/%u @ %p\n", __func__, i, total_blocks,
+ current);
+
+ // printk(BIOS_ERR, "%s: buffer_size: %zd\n", __func__, buffer_size);
+
+ if (buffer_size < sizeof(*entry)) {
+ printk(BIOS_ERR, "%s: Hash buffer is too small for entry\n", __func__);
+ return NULL;
+ }
+
+ // printk(BIOS_ERR, "%s: current: %p\n", __func__, current);
+ // printk(BIOS_ERR, "%s: current_entry: %p\n", __func__, entry);
+
+ /* Allocate one entry in the buffer */
+ buffer_size -= sizeof(*entry);
+
+ MurmurHash3_x86_32(current, range->block_size, 0xDEADBEEF, &crc);
+ // printk(BIOS_ERR, "%s: crc: %#x\n", __func__, entry->hash);
+
+ if (crc != entry->hash) {
+ printk(BIOS_ERR, "%s: crc error at %p. %x != %x\n", __func__, current,
+ crc, entry->hash);
+ }
+
+ if (range->diff) {
+ if (buffer_size < range->block_size) {
+ printk(BIOS_DEBUG, "%s: Hash buffer is too small for data\n",
+ __func__);
+ return NULL;
+ }
+
+ /* Allocate diff size in buffer */
+ buffer_size -= range->block_size;
+
+ if (crc != entry->hash) {
+
+ printk(BIOS_ERR, "Expected:\n");
+ hexdump(entry->data, range->block_size);
+
+ printk(BIOS_ERR, "Actual:\n");
+ hexdump(current, range->block_size);
+ }
+
+ entry = (struct hash_entry *)((uintptr_t)(entry + 1)
+ + range->block_size);
+ } else {
+ entry++;
+ }
+ // printk(BIOS_ERR, "%s: next_entry: %p\n", __func__, entry);
+ }
+
+ return entry;
+}
+
+void verify_ram()
+{
+ struct hash_entry *current_entry = (struct hash_entry *)HASH_BUFFER;
+ struct hash_range *range;
+ unsigned int i;
+
+ printk(BIOS_INFO, "%s: Start: HASH_BUFFER: %#x, EHASH_BUFFER: %#x\n", __func__,
+ HASH_BUFFER, EHASH_BUFFER);
+
+ for (i = 0; i < ARRAY_SIZE(mem_layout); ++i) {
+ range = &mem_layout[i];
+ printk(BIOS_DEBUG, "%s: Verifying range %p -> %p\n", __func__,
+ (void *)range->start, (void *)range->end);
+ current_entry =
+ verify_range(range, current_entry,
+ ((uintptr_t)EHASH_BUFFER - (uintptr_t)current_entry));
+
+ if (!current_entry) {
+ printk(BIOS_ERR, "%s: Hash buffer is too small\n", __func__);
+ break;
+ }
+ }
+
+ printk(BIOS_INFO, "%s: Done\n", __func__);
+}
diff --git a/src/soc/amd/picasso/chip.c b/src/soc/amd/picasso/chip.c
index 2abe54e..678ce03 100644
--- a/src/soc/amd/picasso/chip.c
+++ b/src/soc/amd/picasso/chip.c
@@ -14,6 +14,7 @@
#include <soc/southbridge.h>
#include "chip.h"
#include <fsp/api.h>
+#include <ram_hash.h>
/* Supplied by i2c.c */
extern struct device_operations picasso_i2c_mmio_ops;
@@ -184,6 +185,7 @@
static void picasso_os_entry(void *unused)
{
picasso_disable_paging(NULL);
+ verify_ram();
}
struct chip_operations soc_amd_picasso_ops = {
diff --git a/src/soc/amd/picasso/memlayout.ld b/src/soc/amd/picasso/memlayout.ld
index 27c72a2..a128019 100644
--- a/src/soc/amd/picasso/memlayout.ld
+++ b/src/soc/amd/picasso/memlayout.ld
@@ -92,6 +92,7 @@
REGION(pagetables, CONFIG_PAGE_TABLE_ADDR, 4096 * 12, 8)
REGION(pdpt, ., 32, 32)
+ REGION(hash_buffer, 0x2BD000, 1M, 4)
EARLY_RESERVED_DRAM_END(.)
RAMSTAGE(CONFIG_RAMBASE, 8M)
diff --git a/src/soc/amd/picasso/smihandler.c b/src/soc/amd/picasso/smihandler.c
index 992dc2b..616f116 100644
--- a/src/soc/amd/picasso/smihandler.c
+++ b/src/soc/amd/picasso/smihandler.c
@@ -3,6 +3,7 @@
#include <arch/io.h>
#include <console/console.h>
#include <cpu/x86/smm.h>
+#include <ram_hash.h>
#include <cpu/x86/cache.h>
#include <cpu/amd/amd64_save_state.h>
#include <acpi/acpi.h>
@@ -144,6 +145,13 @@
printk(BIOS_SPEW, "SMI#: SLP = 0x%04x\n", pm1cnt);
slp_typ = acpi_sleep_from_pm1(pm1cnt);
+ /*
+ * Hash RAM as soon as we know we are entering S3 to catch any problems
+ * caused by the SMM handler, PSP, or SMU.
+ */
+ if (slp_typ == ACPI_S3)
+ hash_ram();
+
/* Do any mainboard sleep handling */
mainboard_smi_sleep(slp_typ);
--
To view, visit https://review.coreboot.org/c/coreboot/+/42890
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-Change-Id: I6b38facba17bdd57a94987cfb49e71067ff8b769
Gerrit-Change-Number: 42890
Gerrit-PatchSet: 1
Gerrit-Owner: Raul Rangel <rrangel(a)chromium.org>
Gerrit-Reviewer: Julius Werner <jwerner(a)chromium.org>
Gerrit-Reviewer: Martin Roth <martinroth(a)google.com>
Gerrit-Reviewer: Patrick Georgi <pgeorgi(a)google.com>
Gerrit-MessageType: newchange
3
8

Change in coreboot[master]: WIP: lib: Add murmur3 algorithm for RAM hash
by Raul Rangel (Code Review) Aug. 7, 2023
by Raul Rangel (Code Review) Aug. 7, 2023
Aug. 7, 2023
Raul Rangel has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/43301 )
Change subject: WIP: lib: Add murmur3 algorithm for RAM hash
......................................................................
WIP: lib: Add murmur3 algorithm for RAM hash
This is the murmur3 algorithm from
https://github.com/PeterScott/murmur3.
I'm not sure we can even include this since it's public domain. We might
need to use another hash algorithm. I picked it because it's supposed to
be fast.
I didn't cleanup the code at all. This is why -Wno-implicit-fallthrough
was added to the CFLAGS.
BUG=b:159081993
TEST=Suspend trembyle and see hashes being generated.
Signed-off-by: Raul E Rangel <rrangel(a)chromium.org>
Change-Id: I9dfd371c67966bf7a342fdb5562445e63afce664
---
M Makefile.inc
A src/include/murmur3.h
M src/lib/Kconfig
M src/lib/Makefile.inc
A src/lib/murmur3.c
A src/lib/ram_hash_murmur.c
6 files changed, 362 insertions(+), 2 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/01/43301/1
diff --git a/Makefile.inc b/Makefile.inc
index 89bb3e4..9b39b39 100644
--- a/Makefile.inc
+++ b/Makefile.inc
@@ -421,7 +421,7 @@
CFLAGS_common += -Wstrict-aliasing -Wshadow -Wdate-time -Wtype-limits -Wvla
CFLAGS_common += -Wlogical-op -Wduplicated-cond -Wdangling-else
CFLAGS_common += -fno-common -ffreestanding -fno-builtin -fomit-frame-pointer
-CFLAGS_common += -ffunction-sections -fdata-sections -fno-pie
+CFLAGS_common += -ffunction-sections -fdata-sections -fno-pie -Wno-implicit-fallthrough
ifeq ($(CONFIG_COMPILER_GCC),y)
# Don't add these GCC specific flags when running scan-build
ifeq ($(CCC_ANALYZER_OUTPUT_FORMAT),)
diff --git a/src/include/murmur3.h b/src/include/murmur3.h
new file mode 100644
index 0000000..138f87f
--- /dev/null
+++ b/src/include/murmur3.h
@@ -0,0 +1,29 @@
+//-----------------------------------------------------------------------------
+// MurmurHash3 was written by Austin Appleby, and is placed in the
+// public domain. The author hereby disclaims copyright to this source
+// code.
+
+#ifndef _MURMURHASH3_H_
+#define _MURMURHASH3_H_
+
+#include <stdint.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+//-----------------------------------------------------------------------------
+
+void MurmurHash3_x86_32 (const void *key, int len, uint32_t seed, uint32_t *out);
+
+void MurmurHash3_x86_128(const void *key, int len, uint32_t seed, void *out);
+
+void MurmurHash3_x64_128(const void *key, int len, uint32_t seed, void *out);
+
+//-----------------------------------------------------------------------------
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // _MURMURHASH3_H_
diff --git a/src/lib/Kconfig b/src/lib/Kconfig
index 8eeceec..0e4fa88 100644
--- a/src/lib/Kconfig
+++ b/src/lib/Kconfig
@@ -111,6 +111,8 @@
depends on ENABLE_RAM_HASH
help
The hash algorithm to use for RAM hash.
-# TODO: Add algorithms
+
+config RAM_HASH_ALGO_MURMUR3
+ bool "murmur3"
endchoice
diff --git a/src/lib/Makefile.inc b/src/lib/Makefile.inc
index 05df3c6..54b23e2 100644
--- a/src/lib/Makefile.inc
+++ b/src/lib/Makefile.inc
@@ -148,6 +148,9 @@
ramstage-$(CONFIG_ENABLE_RAM_HASH) += ram_hash.c
smm-$(CONFIG_ENABLE_RAM_HASH) += ram_hash.c
+ramstage-$(CONFIG_RAM_HASH_ALGO_MURMUR3) += ram_hash_murmur.c murmur3.c
+smm-$(CONFIG_RAM_HASH_ALGO_MURMUR3) += ram_hash_murmur.c murmur3.c
+
postcar-$(CONFIG_VENDOR_EMULATION) += ramdetect.c
postcar-y += cbmem_common.c
postcar-$(CONFIG_CONSOLE_CBMEM) += cbmem_console.c
diff --git a/src/lib/murmur3.c b/src/lib/murmur3.c
new file mode 100644
index 0000000..f2b6b18
--- /dev/null
+++ b/src/lib/murmur3.c
@@ -0,0 +1,314 @@
+//-----------------------------------------------------------------------------
+// MurmurHash3 was written by Austin Appleby, and is placed in the public
+// domain. The author hereby disclaims copyright to this source code.
+
+// Note - The x86 and x64 versions do _not_ produce the same results, as the
+// algorithms are optimized for their respective platforms. You can still
+// compile and run any of them on any platform, but your performance with the
+// non-native version will be less than optimal.
+
+#include "murmur3.h"
+
+//-----------------------------------------------------------------------------
+// Platform-specific functions and macros
+
+#ifdef __GNUC__
+#define FORCE_INLINE __attribute__((always_inline)) inline
+#else
+#define FORCE_INLINE inline
+#endif
+
+static FORCE_INLINE uint32_t rotl32 ( uint32_t x, int8_t r )
+{
+ return (x << r) | (x >> (32 - r));
+}
+
+static FORCE_INLINE uint64_t rotl64 ( uint64_t x, int8_t r )
+{
+ return (x << r) | (x >> (64 - r));
+}
+
+#define ROTL32(x,y) rotl32(x,y)
+#define ROTL64(x,y) rotl64(x,y)
+
+#define BIG_CONSTANT(x) (x##LLU)
+
+//-----------------------------------------------------------------------------
+// Block read - if your platform needs to do endian-swapping or can only
+// handle aligned reads, do the conversion here
+
+#define getblock(p, i) (p[i])
+
+//-----------------------------------------------------------------------------
+// Finalization mix - force all bits of a hash block to avalanche
+
+static FORCE_INLINE uint32_t fmix32 ( uint32_t h )
+{
+ h ^= h >> 16;
+ h *= 0x85ebca6b;
+ h ^= h >> 13;
+ h *= 0xc2b2ae35;
+ h ^= h >> 16;
+
+ return h;
+}
+
+//----------
+
+static FORCE_INLINE uint64_t fmix64 ( uint64_t k )
+{
+ k ^= k >> 33;
+ k *= BIG_CONSTANT(0xff51afd7ed558ccd);
+ k ^= k >> 33;
+ k *= BIG_CONSTANT(0xc4ceb9fe1a85ec53);
+ k ^= k >> 33;
+
+ return k;
+}
+
+//-----------------------------------------------------------------------------
+
+void MurmurHash3_x86_32 ( const void * key, int len,
+ uint32_t seed, uint32_t * out )
+{
+ const uint8_t * data = (const uint8_t*)key;
+ const int nblocks = len / 4;
+ int i;
+
+ uint32_t h1 = seed;
+
+ uint32_t c1 = 0xcc9e2d51;
+ uint32_t c2 = 0x1b873593;
+
+ //----------
+ // body
+
+ const uint32_t * blocks = (const uint32_t *)(data + nblocks*4);
+
+ for(i = -nblocks; i; i++)
+ {
+ uint32_t k1 = getblock(blocks,i);
+
+ k1 *= c1;
+ k1 = ROTL32(k1,15);
+ k1 *= c2;
+
+ h1 ^= k1;
+ h1 = ROTL32(h1,13);
+ h1 = h1*5+0xe6546b64;
+ }
+
+ //----------
+ // tail
+
+ const uint8_t * tail = (const uint8_t*)(data + nblocks*4);
+
+ uint32_t k1 = 0;
+
+ switch(len & 3)
+ {
+ case 3: k1 ^= tail[2] << 16;
+ case 2: k1 ^= tail[1] << 8;
+ case 1: k1 ^= tail[0];
+ k1 *= c1; k1 = ROTL32(k1,15); k1 *= c2; h1 ^= k1;
+ };
+
+ //----------
+ // finalization
+
+ h1 ^= len;
+
+ h1 = fmix32(h1);
+
+ *(uint32_t*)out = h1;
+}
+
+//-----------------------------------------------------------------------------
+
+void MurmurHash3_x86_128 ( const void * key, const int len,
+ uint32_t seed, void * out )
+{
+ const uint8_t * data = (const uint8_t*)key;
+ const int nblocks = len / 16;
+ int i;
+
+ uint32_t h1 = seed;
+ uint32_t h2 = seed;
+ uint32_t h3 = seed;
+ uint32_t h4 = seed;
+
+ uint32_t c1 = 0x239b961b;
+ uint32_t c2 = 0xab0e9789;
+ uint32_t c3 = 0x38b34ae5;
+ uint32_t c4 = 0xa1e38b93;
+
+ //----------
+ // body
+
+ const uint32_t * blocks = (const uint32_t *)(data + nblocks*16);
+
+ for(i = -nblocks; i; i++)
+ {
+ uint32_t k1 = getblock(blocks,i*4+0);
+ uint32_t k2 = getblock(blocks,i*4+1);
+ uint32_t k3 = getblock(blocks,i*4+2);
+ uint32_t k4 = getblock(blocks,i*4+3);
+
+ k1 *= c1; k1 = ROTL32(k1,15); k1 *= c2; h1 ^= k1;
+
+ h1 = ROTL32(h1,19); h1 += h2; h1 = h1*5+0x561ccd1b;
+
+ k2 *= c2; k2 = ROTL32(k2,16); k2 *= c3; h2 ^= k2;
+
+ h2 = ROTL32(h2,17); h2 += h3; h2 = h2*5+0x0bcaa747;
+
+ k3 *= c3; k3 = ROTL32(k3,17); k3 *= c4; h3 ^= k3;
+
+ h3 = ROTL32(h3,15); h3 += h4; h3 = h3*5+0x96cd1c35;
+
+ k4 *= c4; k4 = ROTL32(k4,18); k4 *= c1; h4 ^= k4;
+
+ h4 = ROTL32(h4,13); h4 += h1; h4 = h4*5+0x32ac3b17;
+ }
+
+ //----------
+ // tail
+
+ const uint8_t * tail = (const uint8_t*)(data + nblocks*16);
+
+ uint32_t k1 = 0;
+ uint32_t k2 = 0;
+ uint32_t k3 = 0;
+ uint32_t k4 = 0;
+
+ switch(len & 15)
+ {
+ case 15: k4 ^= tail[14] << 16;
+ case 14: k4 ^= tail[13] << 8;
+ case 13: k4 ^= tail[12] << 0;
+ k4 *= c4; k4 = ROTL32(k4,18); k4 *= c1; h4 ^= k4;
+
+ case 12: k3 ^= tail[11] << 24;
+ case 11: k3 ^= tail[10] << 16;
+ case 10: k3 ^= tail[ 9] << 8;
+ case 9: k3 ^= tail[ 8] << 0;
+ k3 *= c3; k3 = ROTL32(k3,17); k3 *= c4; h3 ^= k3;
+
+ case 8: k2 ^= tail[ 7] << 24;
+ case 7: k2 ^= tail[ 6] << 16;
+ case 6: k2 ^= tail[ 5] << 8;
+ case 5: k2 ^= tail[ 4] << 0;
+ k2 *= c2; k2 = ROTL32(k2,16); k2 *= c3; h2 ^= k2;
+
+ case 4: k1 ^= tail[ 3] << 24;
+ case 3: k1 ^= tail[ 2] << 16;
+ case 2: k1 ^= tail[ 1] << 8;
+ case 1: k1 ^= tail[ 0] << 0;
+ k1 *= c1; k1 = ROTL32(k1,15); k1 *= c2; h1 ^= k1;
+ };
+
+ //----------
+ // finalization
+
+ h1 ^= len; h2 ^= len; h3 ^= len; h4 ^= len;
+
+ h1 += h2; h1 += h3; h1 += h4;
+ h2 += h1; h3 += h1; h4 += h1;
+
+ h1 = fmix32(h1);
+ h2 = fmix32(h2);
+ h3 = fmix32(h3);
+ h4 = fmix32(h4);
+
+ h1 += h2; h1 += h3; h1 += h4;
+ h2 += h1; h3 += h1; h4 += h1;
+
+ ((uint32_t*)out)[0] = h1;
+ ((uint32_t*)out)[1] = h2;
+ ((uint32_t*)out)[2] = h3;
+ ((uint32_t*)out)[3] = h4;
+}
+
+//-----------------------------------------------------------------------------
+
+void MurmurHash3_x64_128 ( const void * key, const int len,
+ const uint32_t seed, void * out )
+{
+ const uint8_t * data = (const uint8_t*)key;
+ const int nblocks = len / 16;
+ int i;
+
+ uint64_t h1 = seed;
+ uint64_t h2 = seed;
+
+ uint64_t c1 = BIG_CONSTANT(0x87c37b91114253d5);
+ uint64_t c2 = BIG_CONSTANT(0x4cf5ad432745937f);
+
+ //----------
+ // body
+
+ const uint64_t * blocks = (const uint64_t *)(data);
+
+ for(i = 0; i < nblocks; i++)
+ {
+ uint64_t k1 = getblock(blocks,i*2+0);
+ uint64_t k2 = getblock(blocks,i*2+1);
+
+ k1 *= c1; k1 = ROTL64(k1,31); k1 *= c2; h1 ^= k1;
+
+ h1 = ROTL64(h1,27); h1 += h2; h1 = h1*5+0x52dce729;
+
+ k2 *= c2; k2 = ROTL64(k2,33); k2 *= c1; h2 ^= k2;
+
+ h2 = ROTL64(h2,31); h2 += h1; h2 = h2*5+0x38495ab5;
+ }
+
+ //----------
+ // tail
+
+ const uint8_t * tail = (const uint8_t*)(data + nblocks*16);
+
+ uint64_t k1 = 0;
+ uint64_t k2 = 0;
+
+ switch(len & 15)
+ {
+ case 15: k2 ^= (uint64_t)(tail[14]) << 48;
+ case 14: k2 ^= (uint64_t)(tail[13]) << 40;
+ case 13: k2 ^= (uint64_t)(tail[12]) << 32;
+ case 12: k2 ^= (uint64_t)(tail[11]) << 24;
+ case 11: k2 ^= (uint64_t)(tail[10]) << 16;
+ case 10: k2 ^= (uint64_t)(tail[ 9]) << 8;
+ case 9: k2 ^= (uint64_t)(tail[ 8]) << 0;
+ k2 *= c2; k2 = ROTL64(k2,33); k2 *= c1; h2 ^= k2;
+
+ case 8: k1 ^= (uint64_t)(tail[ 7]) << 56;
+ case 7: k1 ^= (uint64_t)(tail[ 6]) << 48;
+ case 6: k1 ^= (uint64_t)(tail[ 5]) << 40;
+ case 5: k1 ^= (uint64_t)(tail[ 4]) << 32;
+ case 4: k1 ^= (uint64_t)(tail[ 3]) << 24;
+ case 3: k1 ^= (uint64_t)(tail[ 2]) << 16;
+ case 2: k1 ^= (uint64_t)(tail[ 1]) << 8;
+ case 1: k1 ^= (uint64_t)(tail[ 0]) << 0;
+ k1 *= c1; k1 = ROTL64(k1,31); k1 *= c2; h1 ^= k1;
+ };
+
+ //----------
+ // finalization
+
+ h1 ^= len; h2 ^= len;
+
+ h1 += h2;
+ h2 += h1;
+
+ h1 = fmix64(h1);
+ h2 = fmix64(h2);
+
+ h1 += h2;
+ h2 += h1;
+
+ ((uint64_t*)out)[0] = h1;
+ ((uint64_t*)out)[1] = h2;
+}
+
+//-----------------------------------------------------------------------------
diff --git a/src/lib/ram_hash_murmur.c b/src/lib/ram_hash_murmur.c
new file mode 100644
index 0000000..4f6ac9b
--- /dev/null
+++ b/src/lib/ram_hash_murmur.c
@@ -0,0 +1,12 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+
+#include <stdint.h>
+#include <murmur3.h>
+#include <ram_hash.h>
+
+uint32_t generate_hash(const void *buffer, unsigned int size)
+{
+ uint32_t hash;
+ MurmurHash3_x86_32(buffer, size, 0xDEADBEEF, &hash);
+ return hash;
+}
--
To view, visit https://review.coreboot.org/c/coreboot/+/43301
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-Change-Id: I9dfd371c67966bf7a342fdb5562445e63afce664
Gerrit-Change-Number: 43301
Gerrit-PatchSet: 1
Gerrit-Owner: Raul Rangel <rrangel(a)chromium.org>
Gerrit-Reviewer: Martin Roth <martinroth(a)google.com>
Gerrit-Reviewer: Patrick Georgi <pgeorgi(a)google.com>
Gerrit-MessageType: newchange
4
6

Change in coreboot[master]: soc/amd/picasso: Add support for RAM hash
by Raul Rangel (Code Review) Aug. 7, 2023
by Raul Rangel (Code Review) Aug. 7, 2023
Aug. 7, 2023
Raul Rangel has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/43302 )
Change subject: soc/amd/picasso: Add support for RAM hash
......................................................................
soc/amd/picasso: Add support for RAM hash
This CL allocates a region in EARLY_DRAM to store the RAM hashes. It
also introduces a hard coded memory map based on the current e820 map. In
the future we could maybe automate the generate of the hash_ranges.
Until now we will need to keep it updated.
To enable, add the following to your .config:
CONFIG_ENABLE_RAM_HASH=y
Hashing RAM from the SMM handler is pretty slow compared to trying it in
bootblock. Not sure if the OS has reset the MTRRs.
Example of entering S3:
coreboot-4.12-1163-gd9cc83a4ce58-dirty Tue Jul 7 21:34:13 UTC 2020 smm starting (log level: 8)...
SMI# #0
SMI#: SLP = 0x0c01
hash_ram: Start
for_each_range: Processing range 0x1000 -> 0xa0000
Processed block 128: crc: 0x7f00c996. Remaining: 0 MiB
Processed block 256: crc: 0x7f00c996. Remaining: 0 MiB
Processed block 384: crc: 0x7f00c996. Remaining: 0 MiB
Processed block 512: crc: 0x7f00c996. Remaining: 0 MiB
for_each_range: Processing range 0x100000 -> 0x2000000
for_each_range: Processing range 0x22cd000 -> 0xcc50c000
Processed block 128: crc: 0x9a22c19c. Remaining: 3107 MiB
Processed block 256: crc: 0x9a22c19c. Remaining: 2979 MiB
Processed block 384: crc: 0x9a22c19c. Remaining: 2851 MiB
...
Example of exiting S3:
Timestamp - ACPI wake jump: 36887335255
verify_ram: Start
for_each_range: Processing range 0x1000 -> 0xa0000
Processed block 128: crc: 0x7f00c996. Remaining: 0 MiB
Processed block 256: crc: 0x7f00c996. Remaining: 0 MiB
Processed block 384: crc: 0x7f00c996. Remaining: 0 MiB
Processed block 512: crc: 0x7f00c996. Remaining: 0 MiB
for_each_range: Processing range 0x100000 -> 0x2000000
for_each_range: Processing range 0x22cd000 -> 0xcc50c000
Processed block 128: crc: 0x9a22c19c. Remaining: 3107 MiB
Processed block 256: crc: 0x9a22c19c. Remaining: 2979 MiB
Processed block 384: crc: 0x9a22c19c. Remaining: 2851 MiB
Processed block 512: crc: 0x9a22c19c. Remaining: 2723 MiB
Processed block 640: crc: 0x9a22c19c. Remaining: 2595 MiB
Processed block 768: crc: 0x9a22c19c. Remaining: 2467 MiB
Processed block 896: crc: 0x9a22c19c. Remaining: 2339 MiB
Processed block 1024: crc: 0x9a22c19c. Remaining: 2211 MiB
Processed block 1152: crc: 0x9a22c19c. Remaining: 2083 MiB
Processed block 1280: crc: 0x9a22c19c. Remaining: 1955 MiB
Processed block 1408: crc: 0x9a22c19c. Remaining: 1827 MiB
Processed block 1536: crc: 0x9a22c19c. Remaining: 1699 MiB
Processed block 1664: crc: 0x9a22c19c. Remaining: 1571 MiB
Processed block 1792: crc: 0x9a22c19c. Remaining: 1443 MiB
Processed block 1920: crc: 0x9a22c19c. Remaining: 1315 MiB
Processed block 2048: crc: 0x9a22c19c. Remaining: 1187 MiB
Processed block 2176: crc: 0x9a22c19c. Remaining: 1059 MiB
Processed block 2304: crc: 0x9a22c19c. Remaining: 931 MiB
Processed block 2432: crc: 0x9a22c19c. Remaining: 803 MiB
Processed block 2560: crc: 0x9a22c19c. Remaining: 675 MiB
Processed block 2688: crc: 0x9a22c19c. Remaining: 547 MiB
Processed block 2816: crc: 0x9a22c19c. Remaining: 419 MiB
Processed block 2944: crc: 0x9a22c19c. Remaining: 291 MiB
Processed block 3072: crc: 0x9a22c19c. Remaining: 163 MiB
Processed block 3200: crc: 0x9a22c19c. Remaining: 35 MiB
verify_ram: Done
BUG=b:159081993
TEST=S3 suspend and resume on trembyle
Signed-off-by: Raul E Rangel <rrangel(a)chromium.org>
Change-Id: Ia9b80044dd794ddfb0b661d517367259917cd944
---
M src/soc/amd/picasso/Kconfig
M src/soc/amd/picasso/Makefile.inc
M src/soc/amd/picasso/memlayout.ld
A src/soc/amd/picasso/ram_hash.c
M src/soc/amd/picasso/smihandler.c
5 files changed, 65 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/02/43302/1
diff --git a/src/soc/amd/picasso/Kconfig b/src/soc/amd/picasso/Kconfig
index fd2a205..2e7ce89 100644
--- a/src/soc/amd/picasso/Kconfig
+++ b/src/soc/amd/picasso/Kconfig
@@ -57,6 +57,7 @@
select HAVE_CF9_RESET
select SUPPORT_CPU_UCODE_IN_CBFS
select ACPI_NO_SMI_GNVS
+ select HAS_RAM_HASH
config MEMLAYOUT_LD_FILE
string
@@ -174,6 +175,20 @@
Sets the size of DRAM allocation for verstage in linker script if
running as a separate stage on x86.
+config RAM_HASH_ADDR
+ hex
+ depends on ENABLE_RAM_HASH
+ default 0x21CD000
+ help
+ Where in memory to store the hashes.
+
+config RAM_HASH_SIZE
+ hex
+ depends on ENABLE_RAM_HASH
+ default 0x100000
+ help
+ Size of the RAM_HASH buffer.
+
config RAMBASE
hex
default 0x10000000
diff --git a/src/soc/amd/picasso/Makefile.inc b/src/soc/amd/picasso/Makefile.inc
index 39269e9..679ee98 100644
--- a/src/soc/amd/picasso/Makefile.inc
+++ b/src/soc/amd/picasso/Makefile.inc
@@ -89,6 +89,9 @@
smm-y += smu.c
smm-y += config.c
+ramstage-$(CONFIG_ENABLE_RAM_HASH) += ram_hash.c
+smm-$(CONFIG_ENABLE_RAM_HASH) += ram_hash.c
+
CPPFLAGS_common += -I$(src)/soc/amd/picasso
CPPFLAGS_common += -I$(src)/soc/amd/picasso/include
CPPFLAGS_common += -I$(src)/soc/amd/picasso/acpi
diff --git a/src/soc/amd/picasso/memlayout.ld b/src/soc/amd/picasso/memlayout.ld
index 6f43ba1..bb15263 100644
--- a/src/soc/amd/picasso/memlayout.ld
+++ b/src/soc/amd/picasso/memlayout.ld
@@ -89,6 +89,10 @@
VERSTAGE(CONFIG_VERSTAGE_ADDR, CONFIG_VERSTAGE_SIZE)
#endif
+#if CONFIG(ENABLE_RAM_HASH)
+ REGION(hash_buffer, 0x21CD000, 1M, 4)
+#endif
+
EARLY_RESERVED_DRAM_END(.)
RAMSTAGE(CONFIG_RAMBASE, 8M)
diff --git a/src/soc/amd/picasso/ram_hash.c b/src/soc/amd/picasso/ram_hash.c
new file mode 100644
index 0000000..c7f0be4
--- /dev/null
+++ b/src/soc/amd/picasso/ram_hash.c
@@ -0,0 +1,35 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+
+#include <stdint.h>
+#include <ram_hash.h>
+#include <commonlib/bsd/helpers.h>
+
+struct hash_range mem_layout[] = {
+ {
+ .start = 0x1000,
+ .end = 0xa0000,
+ .block_size = 1 * KiB,
+ .diff = 1
+ },
+ {
+ .start = 0x100000,
+ .end = 0x2000000,
+ .block_size = 1 * MiB,
+ .diff = 0
+ },
+ {
+ .start = 0x22cd000,
+ .end = 0xcc50c000,
+ .block_size = 1 * MiB,
+ .diff = 0
+ },
+};
+
+void soc_hash_ram(void)
+{
+ hash_ram(mem_layout, ARRAY_SIZE(mem_layout));
+}
+void soc_verify_ram(void)
+{
+ verify_ram(mem_layout, ARRAY_SIZE(mem_layout));
+}
diff --git a/src/soc/amd/picasso/smihandler.c b/src/soc/amd/picasso/smihandler.c
index 7e762a9..6832526 100644
--- a/src/soc/amd/picasso/smihandler.c
+++ b/src/soc/amd/picasso/smihandler.c
@@ -3,6 +3,7 @@
#include <arch/io.h>
#include <console/console.h>
#include <cpu/x86/smm.h>
+#include <ram_hash.h>
#include <cpu/x86/cache.h>
#include <cpu/amd/amd64_save_state.h>
#include <acpi/acpi.h>
@@ -144,6 +145,13 @@
printk(BIOS_SPEW, "SMI#: SLP = 0x%04x\n", pm1cnt);
slp_typ = acpi_sleep_from_pm1(pm1cnt);
+ /*
+ * Hash RAM as soon as we know we are entering S3 to catch any problems
+ * caused by the SMM handler, PSP, or SMU.
+ */
+ if (slp_typ == ACPI_S3)
+ soc_hash_ram();
+
/* Do any mainboard sleep handling */
mainboard_smi_sleep(slp_typ);
--
To view, visit https://review.coreboot.org/c/coreboot/+/43302
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-Change-Id: Ia9b80044dd794ddfb0b661d517367259917cd944
Gerrit-Change-Number: 43302
Gerrit-PatchSet: 1
Gerrit-Owner: Raul Rangel <rrangel(a)chromium.org>
Gerrit-Reviewer: Julius Werner <jwerner(a)chromium.org>
Gerrit-Reviewer: Martin Roth <martinroth(a)google.com>
Gerrit-Reviewer: Patrick Georgi <pgeorgi(a)google.com>
Gerrit-MessageType: newchange
2
3

Change in ...coreboot[master]: nb/intel/sandybridge: Introduce soc/iomap.h
by Patrick Rudolph (Code Review) Aug. 7, 2023
by Patrick Rudolph (Code Review) Aug. 7, 2023
Aug. 7, 2023
Patrick Rudolph has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/32075
Change subject: nb/intel/sandybridge: Introduce soc/iomap.h
......................................................................
nb/intel/sandybridge: Introduce soc/iomap.h
Defines the memory ranges used by the northbridge in a separate header.
Include the new header and rename the defines to match the one found
in soc/intel/common.
Change-Id: I93aa0e78ff52e46256debd26601600a96404509f
Signed-off-by: Patrick Rudolph <patrick.rudolph(a)9elements.com>
---
M src/northbridge/intel/sandybridge/Makefile.inc
M src/northbridge/intel/sandybridge/acpi.c
M src/northbridge/intel/sandybridge/early_init.c
A src/northbridge/intel/sandybridge/include/soc/iomap.h
M src/northbridge/intel/sandybridge/northbridge.c
M src/northbridge/intel/sandybridge/raminit_common.c
M src/northbridge/intel/sandybridge/raminit_mrc.c
M src/northbridge/intel/sandybridge/sandybridge.h
8 files changed, 92 insertions(+), 54 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/75/32075/1
diff --git a/src/northbridge/intel/sandybridge/Makefile.inc b/src/northbridge/intel/sandybridge/Makefile.inc
index 54a4057..c3d9079 100644
--- a/src/northbridge/intel/sandybridge/Makefile.inc
+++ b/src/northbridge/intel/sandybridge/Makefile.inc
@@ -15,6 +15,8 @@
ifeq ($(CONFIG_NORTHBRIDGE_INTEL_SANDYBRIDGE)$(CONFIG_NORTHBRIDGE_INTEL_IVYBRIDGE),y)
+CFLAGS_common += -Isrc/northbridge/intel/sandybridge/include
+
ramstage-y += ram_calc.c
ramstage-y += northbridge.c
ramstage-y += pcie.c
diff --git a/src/northbridge/intel/sandybridge/acpi.c b/src/northbridge/intel/sandybridge/acpi.c
index 4afb546..af2f37b 100644
--- a/src/northbridge/intel/sandybridge/acpi.c
+++ b/src/northbridge/intel/sandybridge/acpi.c
@@ -92,7 +92,8 @@
unsigned long tmp;
tmp = current;
- current += acpi_create_dmar_drhd(current, 0, 0, IOMMU_BASE1);
+ current += acpi_create_dmar_drhd(current, 0, 0,
+ GFXVT_BASE_ADDRESS);
current += acpi_create_dmar_ds_pci(current, 0, 2, 0);
current += acpi_create_dmar_ds_pci(current, 0, 2, 1);
acpi_dmar_drhd_fixup(tmp, current);
@@ -107,8 +108,8 @@
}
const unsigned long tmp = current;
- current += acpi_create_dmar_drhd(current,
- DRHD_INCLUDE_PCI_ALL, 0, IOMMU_BASE2);
+ current += acpi_create_dmar_drhd(current, DRHD_INCLUDE_PCI_ALL, 0,
+ VTVC0_BASE_ADDRESS);
current += acpi_create_dmar_ds_ioapic(current,
2, PCH_IOAPIC_PCI_BUS, PCH_IOAPIC_PCI_SLOT, 0);
size_t i;
diff --git a/src/northbridge/intel/sandybridge/early_init.c b/src/northbridge/intel/sandybridge/early_init.c
index 5307a2c..2e0f087 100644
--- a/src/northbridge/intel/sandybridge/early_init.c
+++ b/src/northbridge/intel/sandybridge/early_init.c
@@ -35,20 +35,20 @@
return;
/* setup BARs */
- MCHBAR32(0x5404) = IOMMU_BASE1 >> 32;
- MCHBAR32(0x5400) = IOMMU_BASE1 | 1;
- MCHBAR32(0x5414) = IOMMU_BASE2 >> 32;
- MCHBAR32(0x5410) = IOMMU_BASE2 | 1;
+ MCHBAR32(0x5404) = GFXVT_BASE_ADDRESS >> 32;
+ MCHBAR32(0x5400) = GFXVT_BASE_ADDRESS | 1;
+ MCHBAR32(0x5414) = VTVC0_BASE_ADDRESS >> 32;
+ MCHBAR32(0x5410) = VTVC0_BASE_ADDRESS | 1;
/* lock policies */
- write32((void *)(IOMMU_BASE1 + 0xff0), 0x80000000);
+ write32((void *)(GFXVT_BASE_ADDRESS + 0xff0), 0x80000000);
const struct device *const azalia = pcidev_on_root(0x1b, 0);
if (azalia && azalia->enabled) {
- write32((void *)(IOMMU_BASE2 + 0xff0), 0x20000000);
- write32((void *)(IOMMU_BASE2 + 0xff0), 0xa0000000);
+ write32((void *)(VTVC0_BASE_ADDRESS + 0xff0), 0x20000000);
+ write32((void *)(VTVC0_BASE_ADDRESS + 0xff0), 0xa0000000);
} else {
- write32((void *)(IOMMU_BASE2 + 0xff0), 0x80000000);
+ write32((void *)(VTVC0_BASE_ADDRESS + 0xff0), 0x80000000);
}
}
@@ -67,12 +67,12 @@
{
printk(BIOS_DEBUG, "Setting up static northbridge registers...");
/* Set up all hardcoded northbridge BARs */
- pci_write_config32(PCI_DEV(0, 0x00, 0), EPBAR, DEFAULT_EPBAR | 1);
- pci_write_config32(PCI_DEV(0, 0x00, 0), EPBAR + 4, (0LL+DEFAULT_EPBAR) >> 32);
- pci_write_config32(PCI_DEV(0, 0x00, 0), MCHBAR, (uintptr_t)DEFAULT_MCHBAR | 1);
- pci_write_config32(PCI_DEV(0, 0x00, 0), MCHBAR + 4, (0LL+(uintptr_t)DEFAULT_MCHBAR) >> 32);
- pci_write_config32(PCI_DEV(0, 0x00, 0), DMIBAR, (uintptr_t)DEFAULT_DMIBAR | 1);
- pci_write_config32(PCI_DEV(0, 0x00, 0), DMIBAR + 4, (0LL+(uintptr_t)DEFAULT_DMIBAR) >> 32);
+ pci_write_config32(PCI_DEV(0, 0x00, 0), EPBAR, EP_BASE_ADDRESS | 1);
+ pci_write_config32(PCI_DEV(0, 0x00, 0), EPBAR + 4, EP_BASE_ADDRESS >> 32);
+ pci_write_config32(PCI_DEV(0, 0x00, 0), MCHBAR, MCH_BASE_ADDRESS | 1);
+ pci_write_config32(PCI_DEV(0, 0x00, 0), MCHBAR + 4, MCH_BASE_ADDRESS >> 32);
+ pci_write_config32(PCI_DEV(0, 0x00, 0), DMIBAR, DMI_BASE_ADDRESS | 1);
+ pci_write_config32(PCI_DEV(0, 0x00, 0), DMIBAR + 4, DMI_BASE_ADDRESS >> 32);
printk(BIOS_DEBUG, " done\n");
}
diff --git a/src/northbridge/intel/sandybridge/include/soc/iomap.h b/src/northbridge/intel/sandybridge/include/soc/iomap.h
new file mode 100644
index 0000000..75fd9d9
--- /dev/null
+++ b/src/northbridge/intel/sandybridge/include/soc/iomap.h
@@ -0,0 +1,51 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright (C) 2018 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
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+#ifndef _SOC_SANDYBRIDGE_IOMAP_H_
+#define _SOC_SANDYBRIDGE_IOMAP_H_
+
+/*
+ * Memory-mapped I/O registers.
+ */
+#define MCFG_BASE_ADDRESS CONFIG_MMCONF_BASE_ADDRESS
+#define MCFG_BASE_SIZE 0x4000000
+
+/* Intel Enhanced Debug region must be 4MB */
+
+#define IED_SIZE CONFIG_IED_REGION_SIZE
+
+#define ILB_BASE_ADDRESS 0xfed08000ULL
+#define ILB_BASE_SIZE 0x400
+
+#define DMI_BASE_ADDRESS 0xfed18000ULL
+#define DMI_BASE_SIZE 0x1000
+
+#define MCH_BASE_ADDRESS 0xfed10000ULL
+#define MCH_BASE_SIZE 0x4000
+
+#define EP_BASE_ADDRESS 0xfed19000ULL
+#define EP_BASE_SIZE 0x1000
+
+#define GFXVT_BASE_ADDRESS 0xfed90000ULL
+#define GFXVT_BASE_SIZE 0x1000
+
+#define VTVC0_BASE_ADDRESS 0xfed91000ULL
+#define VTVC0_BASE_SIZE 0x1000
+
+#define TPM_BASE_ADDRESS 0xfed40000ULL
+#define TPM_BASE_SIZE 0x5000
+
+
+#endif
diff --git a/src/northbridge/intel/sandybridge/northbridge.c b/src/northbridge/intel/sandybridge/northbridge.c
index 5aa06c8..71dea62 100644
--- a/src/northbridge/intel/sandybridge/northbridge.c
+++ b/src/northbridge/intel/sandybridge/northbridge.c
@@ -112,8 +112,8 @@
/* Reserve IOMMU BARs */
const u32 capid0_a = pci_read_config32(dev, 0xe4);
if (!(capid0_a & (1 << 23))) {
- mmio_resource(dev, index++, IOMMU_BASE1 >> 10, 4);
- mmio_resource(dev, index++, IOMMU_BASE2 >> 10, 4);
+ mmio_resource(dev, index++, GFXVT_BASE_ADDRESS / KiB, 4);
+ mmio_resource(dev, index++, VTVC0_BASE_ADDRESS / KiB, 4);
}
}
diff --git a/src/northbridge/intel/sandybridge/raminit_common.c b/src/northbridge/intel/sandybridge/raminit_common.c
index 55df03b..72ae5b0 100644
--- a/src/northbridge/intel/sandybridge/raminit_common.c
+++ b/src/northbridge/intel/sandybridge/raminit_common.c
@@ -41,23 +41,23 @@
* Channel X = [0, 1]
* Command queue index Y = [0, 1, 2, 3]
*
- * DEFAULT_MCHBAR + 0x4220 + 0x400 * X + 4 * Y: command io register
+ * MCH_BASE_ADDRESS + 0x4220 + 0x400 * X + 4 * Y: command io register
* Controls the DRAM command signals
* Bit 0: !RAS
* Bit 1: !CAS
* Bit 2: !WE
*
- * DEFAULT_MCHBAR + 0x4200 + 0x400 * X + 4 * Y: addr bankslot io register
+ * MCH_BASE_ADDRESS + 0x4200 + 0x400 * X + 4 * Y: addr bankslot io register
* Controls the address, bank address and slotrank signals
* Bit 0-15 : Address
* Bit 20-22: Bank Address
* Bit 24-25: slotrank
*
- * DEFAULT_MCHBAR + 0x4230 + 0x400 * X + 4 * Y: idle register
+ * MCH_BASE_ADDRESS + 0x4230 + 0x400 * X + 4 * Y: idle register
* Controls the idle time after issuing this DRAM command
* Bit 16-32: number of clock-cylces to idle
*
- * DEFAULT_MCHBAR + 0x4284 + 0x400 * channel: execute command queue
+ * MCH_BASE_ADDRESS + 0x4284 + 0x400 * channel: execute command queue
* Starts to execute all queued commands
* Bit 0 : start DRAM command execution
* Bit 18-19 : number of queued commands - 1
diff --git a/src/northbridge/intel/sandybridge/raminit_mrc.c b/src/northbridge/intel/sandybridge/raminit_mrc.c
index c544a74..2382084 100644
--- a/src/northbridge/intel/sandybridge/raminit_mrc.c
+++ b/src/northbridge/intel/sandybridge/raminit_mrc.c
@@ -277,10 +277,10 @@
static void northbridge_fill_pei_data(struct pei_data *pei_data)
{
- pei_data->mchbar = (uintptr_t)DEFAULT_MCHBAR;
- pei_data->dmibar = (uintptr_t)DEFAULT_DMIBAR;
- pei_data->epbar = DEFAULT_EPBAR;
- pei_data->pciexbar = CONFIG_MMCONF_BASE_ADDRESS;
+ pei_data->mchbar = MCH_BASE_ADDRESS;
+ pei_data->dmibar = DMI_BASE_ADDRESS;
+ pei_data->epbar = EP_BASE_ADDRESS;
+ pei_data->pciexbar = MCFG_BASE_ADDRESS;
pei_data->smbusbar = SMBUS_IO_BASE;
pei_data->wdbbar = 0x4000000;
pei_data->wdbsize = 0x1000;
diff --git a/src/northbridge/intel/sandybridge/sandybridge.h b/src/northbridge/intel/sandybridge/sandybridge.h
index d7de843..dc9f889 100644
--- a/src/northbridge/intel/sandybridge/sandybridge.h
+++ b/src/northbridge/intel/sandybridge/sandybridge.h
@@ -17,6 +17,8 @@
#ifndef __NORTHBRIDGE_INTEL_SANDYBRIDGE_SANDYBRIDGE_H__
#define __NORTHBRIDGE_INTEL_SANDYBRIDGE_SANDYBRIDGE_H__
+#include <northbridge/intel/sandybridge/include/soc/iomap.h>
+
/* Device ID for SandyBridge and IvyBridge */
#define BASE_REV_SNB 0x00
#define BASE_REV_IVB 0x50
@@ -34,24 +36,6 @@
#define IVB_STEP_K0 (BASE_REV_IVB + 5)
#define IVB_STEP_D0 (BASE_REV_IVB + 6)
-/* Intel Enhanced Debug region must be 4MB */
-
-#define IED_SIZE CONFIG_IED_REGION_SIZE
-
-/* Northbridge BARs */
-#ifndef __ACPI__
-#define DEFAULT_MCHBAR ((u8 *)0xfed10000) /* 16 KB */
-#define DEFAULT_DMIBAR ((u8 *)0xfed18000) /* 4 KB */
-#else
-#define DEFAULT_MCHBAR 0xfed10000 /* 16 KB */
-#define DEFAULT_DMIBAR 0xfed18000 /* 4 KB */
-#endif
-#define DEFAULT_EPBAR 0xfed19000 /* 4 KB */
-#define DEFAULT_RCBABASE ((u8 *)0xfed1c000)
-
-#define IOMMU_BASE1 0xfed90000ULL
-#define IOMMU_BASE2 0xfed91000ULL
-
/* Everything below this line is ignored in the DSDT */
#ifndef __ACPI__
#include <cpu/intel/model_206ax/model_206ax.h>
@@ -118,9 +102,9 @@
* MCHBAR
*/
-#define MCHBAR8(x) (*((volatile u8 *)(DEFAULT_MCHBAR + (x))))
-#define MCHBAR16(x) (*((volatile u16 *)(DEFAULT_MCHBAR + (x))))
-#define MCHBAR32(x) (*((volatile u32 *)(DEFAULT_MCHBAR + (x))))
+#define MCHBAR8(x) (*((volatile u8 *)((uintptr_t)MCH_BASE_ADDRESS + (x))))
+#define MCHBAR16(x) (*((volatile u16 *)((uintptr_t)MCH_BASE_ADDRESS + (x))))
+#define MCHBAR32(x) (*((volatile u32 *)((uintptr_t)MCH_BASE_ADDRESS + (x))))
#define MCHBAR32_OR(x, or) (MCHBAR32(x) = (MCHBAR32(x) | (or)))
#define MCHBAR32_AND(x, and) (MCHBAR32(x) = (MCHBAR32(x) & (and)))
#define MCHBAR32_AND_OR(x, and, or) \
@@ -133,9 +117,9 @@
* EPBAR - Egress Port Root Complex Register Block
*/
-#define EPBAR8(x) (*((volatile u8 *)(DEFAULT_EPBAR + (x))))
-#define EPBAR16(x) (*((volatile u16 *)(DEFAULT_EPBAR + (x))))
-#define EPBAR32(x) (*((volatile u32 *)(DEFAULT_EPBAR + (x))))
+#define EPBAR8(x) (*((volatile u8 *)((uintptr_t)EP_BASE_ADDRESS + (x))))
+#define EPBAR16(x) (*((volatile u16 *)((uintptr_t)EP_BASE_ADDRESS + (x))))
+#define EPBAR32(x) (*((volatile u32 *)((uintptr_t)EP_BASE_ADDRESS + (x))))
#define EPPVCCAP1 0x004 /* 32bit */
#define EPPVCCAP2 0x008 /* 32bit */
@@ -164,9 +148,9 @@
* DMIBAR
*/
-#define DMIBAR8(x) (*((volatile u8 *)(DEFAULT_DMIBAR + (x))))
-#define DMIBAR16(x) (*((volatile u16 *)(DEFAULT_DMIBAR + (x))))
-#define DMIBAR32(x) (*((volatile u32 *)(DEFAULT_DMIBAR + (x))))
+#define DMIBAR8(x) (*((volatile u8 *)((uintptr_t)DMI_BASE_ADDRESS + (x))))
+#define DMIBAR16(x) (*((volatile u16 *)((uintptr_t)DMI_BASE_ADDRESS + (x))))
+#define DMIBAR32(x) (*((volatile u32 *)((uintptr_t)DMI_BASE_ADDRESS + (x))))
#define DMIVCECH 0x000 /* 32bit */
#define DMIPVCCAP1 0x004 /* 32bit */
--
To view, visit https://review.coreboot.org/c/coreboot/+/32075
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-Change-Id: I93aa0e78ff52e46256debd26601600a96404509f
Gerrit-Change-Number: 32075
Gerrit-PatchSet: 1
Gerrit-Owner: Patrick Rudolph <patrick.rudolph(a)9elements.com>
Gerrit-Reviewer: Martin Roth <martinroth(a)google.com>
Gerrit-Reviewer: Patrick Georgi <pgeorgi(a)google.com>
Gerrit-Reviewer: Patrick Rudolph <patrick.rudolph(a)9elements.com>
Gerrit-Reviewer: Patrick Rudolph <siro(a)das-labor.org>
Gerrit-MessageType: newchange
6
9