Sumeet R Pawnikar has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/33129
Change subject: soc/intel/cannonlake: Set correct temperature threshold for PCH Thermal Sensor
......................................................................
soc/intel/cannonlake: Set correct temperature threshold for PCH Thermal Sensor
PMC logic shuts down the PCH thermal sensor when CPU is in a C-state and
DTS Temp <= Low Temp Threshold (LTT) in case of Dynamic Thermal shutdown
when S0ix is enabled.
BUG=None
BRANCH=None
TEST=Verified Thermal Device (B0: D18: F0) TSPM offset 0x1c [LTT (8:0)]
value is 0xFA.
Change-Id: Ibd1e669fcbfe8dc6e6e5556aa5b1373ed19c3685
Signed-off-by: Sumeet Pawnikar <sumeet.r.pawnikar(a)intel.com>
---
M src/soc/intel/cannonlake/Makefile.inc
M src/soc/intel/cannonlake/chip.h
M src/soc/intel/cannonlake/finalize.c
M src/soc/intel/cannonlake/include/soc/iomap.h
A src/soc/intel/cannonlake/include/soc/thermal.h
A src/soc/intel/cannonlake/thermal.c
6 files changed, 147 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/29/33129/1
diff --git a/src/soc/intel/cannonlake/Makefile.inc b/src/soc/intel/cannonlake/Makefile.inc
index 1328944..03faa3c 100644
--- a/src/soc/intel/cannonlake/Makefile.inc
+++ b/src/soc/intel/cannonlake/Makefile.inc
@@ -53,6 +53,7 @@
ramstage-y += smmrelocate.c
ramstage-y += spi.c
ramstage-y += systemagent.c
+ramstage-y += thermal.c
ramstage-y += uart.c
ramstage-y += vr_config.c
ramstage-y += sd.c
diff --git a/src/soc/intel/cannonlake/chip.h b/src/soc/intel/cannonlake/chip.h
index 0d51c1c..39f808b 100644
--- a/src/soc/intel/cannonlake/chip.h
+++ b/src/soc/intel/cannonlake/chip.h
@@ -421,6 +421,9 @@
* Bit 0: MISCCFG_GPDLCGEN
*/
uint8_t gpio_pm[TOTAL_GPIO_COMM];
+
+ /* PCH Trip Temperature */
+ uint8_t pch_trip_temp;
};
typedef struct soc_intel_cannonlake_config config_t;
diff --git a/src/soc/intel/cannonlake/finalize.c b/src/soc/intel/cannonlake/finalize.c
index 4dfd15b..d277658 100644
--- a/src/soc/intel/cannonlake/finalize.c
+++ b/src/soc/intel/cannonlake/finalize.c
@@ -32,6 +32,7 @@
#include <soc/pm.h>
#include <soc/smbus.h>
#include <soc/systemagent.h>
+#include <soc/thermal.h>
#include <stdlib.h>
#include "chip.h"
@@ -63,6 +64,16 @@
uint8_t reg8;
tco_lockdown();
+
+ /*
+ * Set low maximum temp value used for dynamic thermal sensor
+ * shutdown consideration.
+ *
+ * If Dynamic Thermal Shutdown is enabled then PMC logic shuts down the
+ * thermal sensor when CPU is in a C-state and DTS Temp <= LTT.
+ */
+ pch_thermal_configuration();
+
/*
* Disable ACPI PM timer based on dt policy
*
diff --git a/src/soc/intel/cannonlake/include/soc/iomap.h b/src/soc/intel/cannonlake/include/soc/iomap.h
index 100bd11..488d938 100644
--- a/src/soc/intel/cannonlake/include/soc/iomap.h
+++ b/src/soc/intel/cannonlake/include/soc/iomap.h
@@ -76,6 +76,8 @@
#define HECI1_BASE_ADDRESS 0xfeda2000
+#define THERMAL_BASE_ADDRESS 0xfe600000
+
#define VTD_BASE_ADDRESS 0xFED90000
#define VTD_BASE_SIZE 0x00004000
/*
diff --git a/src/soc/intel/cannonlake/include/soc/thermal.h b/src/soc/intel/cannonlake/include/soc/thermal.h
new file mode 100644
index 0000000..1f4085c
--- /dev/null
+++ b/src/soc/intel/cannonlake/include/soc/thermal.h
@@ -0,0 +1,24 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright (C) 2019 Intel Corp.
+ *
+ * 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_THERMAL_H_
+#define _SOC_THERMAL_H_
+
+#define THERMAL_SENSOR_POWER_MANAGEMENT 0x1c
+
+/* Enable thermal sensor power management */
+void pch_thermal_configuration(void);
+
+#endif
diff --git a/src/soc/intel/cannonlake/thermal.c b/src/soc/intel/cannonlake/thermal.c
new file mode 100644
index 0000000..9d62843
--- /dev/null
+++ b/src/soc/intel/cannonlake/thermal.c
@@ -0,0 +1,106 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright (C) 2019 Intel Corp.
+ *
+ * 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 <device/mmio.h>
+#include <device/pci_ops.h>
+#include <console/console.h>
+#include <device/device.h>
+#include <device/pci.h>
+#include <soc/iomap.h>
+#include <soc/pci_devs.h>
+#include <soc/thermal.h>
+
+#include "chip.h"
+
+#define MAX_TRIP_TEMP 205
+#define DEFAULT_TRIP_TEMP 50
+
+static void *pch_thermal_get_bar(struct device *dev)
+{
+ uintptr_t bar;
+
+ bar = pci_read_config32(dev, PCI_BASE_ADDRESS_0);
+ /*
+ * Bits [31:12] are the base address as per EDS for Thermal Device,
+ * Don't care about [11:0] bits
+ */
+ return (void *)(bar & ~PCI_BASE_ADDRESS_MEM_ATTR_MASK);
+}
+
+static void pch_thermal_set_bar(struct device *dev, uintptr_t tempbar)
+{
+ uint8_t pcireg;
+
+ /* Assign Resources to Thermal Device */
+ /* Clear BIT 1-2 of Command Register */
+ pcireg = pci_read_config8(dev, PCI_COMMAND);
+ pcireg &= ~(PCI_COMMAND_MASTER | PCI_COMMAND_MEMORY);
+ pci_write_config8(dev, PCI_COMMAND, pcireg);
+
+ /* Program Temporary BAR for Thermal Device */
+ pci_write_config32(dev, PCI_BASE_ADDRESS_0, tempbar);
+ pci_write_config32(dev, PCI_BASE_ADDRESS_1, 0x0);
+
+ /* Enable Bus Master and MMIO Space */
+ pcireg = pci_read_config8(dev, PCI_COMMAND);
+ pcireg |= PCI_COMMAND_MASTER | PCI_COMMAND_MEMORY;
+ pci_write_config8(dev, PCI_COMMAND, pcireg);
+}
+
+/* PCH Low Temp Threshold (LTT) */
+static uint16_t pch_get_ltt_value(struct device *dev)
+{
+ static struct soc_intel_skylake_config *config;
+ uint16_t ltt_value;
+ uint16_t trip_temp = DEFAULT_TRIP_TEMP;
+
+ config = dev->chip_info;
+
+ if (config->pch_trip_temp)
+ trip_temp = config->pch_trip_temp;
+
+ if (trip_temp > MAX_TRIP_TEMP)
+ die("Input PCH temp trip is higher than allowed range!");
+
+ /* Trip Point Temp = (LTT / 2 - 50 degree C) */
+ ltt_value = (trip_temp + 50) * 2;
+
+ return ltt_value;
+}
+
+/* Enable thermal sensor power management */
+void pch_thermal_configuration(void)
+{
+ uint16_t reg16;
+ struct device *dev = PCH_DEV_THERMAL;
+ if (!dev) {
+ printk(BIOS_ERR, "PCH_DEV_THERMAL device not found!\n");
+ return;
+ }
+ void *thermalbar = pch_thermal_get_bar(dev);
+
+ /* Use default pre-ram bar */
+ if (!thermalbar) {
+ pch_thermal_set_bar(dev, THERMAL_BASE_ADDRESS);
+ thermalbar = (void *)THERMAL_BASE_ADDRESS;
+ }
+
+ /* Set Low Temp Threshold (LTT) at TSPM offset 0x1c[8:0] */
+ reg16 = read16(thermalbar + THERMAL_SENSOR_POWER_MANAGEMENT);
+ reg16 &= ~0x1ff;
+ /* Low Temp Threshold (LTT) */
+ reg16 |= pch_get_ltt_value(dev);
+ write16(thermalbar + THERMAL_SENSOR_POWER_MANAGEMENT, reg16);
+}
--
To view, visit https://review.coreboot.org/c/coreboot/+/33129
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-Change-Id: Ibd1e669fcbfe8dc6e6e5556aa5b1373ed19c3685
Gerrit-Change-Number: 33129
Gerrit-PatchSet: 1
Gerrit-Owner: Sumeet R Pawnikar <sumeet.r.pawnikar(a)intel.com>
Gerrit-MessageType: newchange
Evgeny Zinoviev has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/38926 )
Change subject: Documentation: Add GM45 ThinkPads common page
......................................................................
Documentation: Add GM45 ThinkPads common page
- Add a common page about X200/T400/T500 ThinkPads.
- Describe how to remove ME on these models.
- Describe default flash layouts.
Change-Id: I85917821efe63fff4b933b6226e99c17b63eb1b9
Signed-off-by: Evgeny Zinoviev <me(a)ch1p.io>
---
M Documentation/mainboard/index.md
A Documentation/mainboard/lenovo/xx00_series.md
2 files changed, 115 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/26/38926/1
diff --git a/Documentation/mainboard/index.md b/Documentation/mainboard/index.md
index ce30ee2..3b5903b 100644
--- a/Documentation/mainboard/index.md
+++ b/Documentation/mainboard/index.md
@@ -77,6 +77,7 @@
### GM45 series
+- [X200 / T400 / T500 common](lenovo/xx00_series.md)
- [X301](lenovo/x301.md)
### Sandy Bridge series
diff --git a/Documentation/mainboard/lenovo/xx00_series.md b/Documentation/mainboard/lenovo/xx00_series.md
new file mode 100644
index 0000000..3ac7c87
--- /dev/null
+++ b/Documentation/mainboard/lenovo/xx00_series.md
@@ -0,0 +1,114 @@
+# Lenovo X200 / T400 / T500 common
+
+These models can have 8 MB or 4 MB flash chip installed. You can identify the
+chip in your machine through flashrom:
+```
+flashrom -p internal
+```
+
+## Installing without ME firmware
+
+On GM45 machines it's possible to disable and remove ME by modifying the flash
+descriptor. This also make it possible to use the flash region the ME used for
+`bios` region, allowing for much larger payloads.
+
+First of all create a backup of your ROM with an external programmer:
+```
+flashrom -p YOUR_PROGRAMMER -r backup.rom
+```
+
+Then extract FD modules to a separate files. Your will need
+`flashregion_3_gbe.bin` later.
+```
+ifdtool -x backup.rom
+```
+
+There is a tool to generate modified flash descriptor called **bincfg**. Go to
+`util/bincfg` and build it:
+```
+cd util/bincfg
+make
+```
+
+If your flash is 4 MB, edit the `ifd-x200.set` file as shown:
+
+```diff
+diff --git a/util/blobtool/ifd-x200.set b/util/blobtool/ifd-x200.set
+--- a/util/blobtool/ifd-x200.set
++++ b/util/blobtool/ifd-x200.set
+@@ -35,7 +35,7 @@
+ "flmap2_msl" = 0x1,
+ "flmap2_reserved" = 0x0,
+
+- "flcomp_density1" = 0x4,
++ "flcomp_density1" = 0x3,
+ "flcomp_density2" = 0x2,
+ "flcomp_reserved0" = 0x0,
+ "flcomp_reserved1" = 0x0,
+@@ -56,7 +56,7 @@
+ "flreg0_reserved1" = 0x0,
+ "flreg1_base" = 0x3,
+ "flreg1_reserved0" = 0x0,
+- "flreg1_limit" = 0x7ff,
++ "flreg1_limit" = 0x3ff,
+ "flreg1_reserved1" = 0x0,
+ "flreg2_base" = 0x1fff,
+ "flreg2_reserved0" = 0x0,
+```
+
+Create the flash descriptor:
+```
+./bincfg ifd-x200.spec ifd-x200.set ifd.bin
+```
+
+Now configure coreboot. You need to select correct chip size and specify paths
+to flash descriptor and gbe dump.
+```
+Mainboard --->
+ ROM chip size (8192 KB (8 MB)) # According to your chip
+ (0x7fd000) Size of CBFS filesystem in ROM # or 0x3fd000 for 4 MB chip
+
+Chipset --->
+ [*] Add Intel descriptor.bin file
+ (/path/to/util/bincfg/ifd.bin) Path and filename of the descriptor.bin file
+
+ [*] Add gigabit ethernet configuration
+ (/path/to/flashregion_3_gbe.bin) Path to gigabit ethernet configuration
+```
+
+Then build coreboot and flash whole `build/coreboot.rom` to the chip.
+
+## Installing with ME firmware
+
+To install coreboot and keep ME, you don't need to do anything special. Just
+flash only `bios` and don't touch other regions:
+```
+flashrom -p YOUR_PROGRAMMER -w coreboot.rom --ifd -i bios
+```
+
+## Flash layout
+
+The flash layout of the OEM firmware on 8 MB chips is as follows:
+```
+00000000:00000fff descriptor
+00001000:005f5fff me
+005f6000:005f7fff gbe
+005f8000:005fffff platform
+00600000:007fffff bios
+00690000:006affff ec
+007e0000:007fffff bootblock
+```
+
+On 4 MB chips:
+```
+00000000:00000fff descriptor
+00001000:001f5fff me
+001f6000:001f7fff gbe
+001f8000:001fffff platform
+00200000:003fffff bios
+00290000:002affff ec
+003e0000:003fffff bootblock
+```
+
+The `ec` region is not where EC firmware is stored. It's where EC firmware
+updates are stored for PhoenixBIOS to write them to EC once.
--
To view, visit https://review.coreboot.org/c/coreboot/+/38926
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-Change-Id: I85917821efe63fff4b933b6226e99c17b63eb1b9
Gerrit-Change-Number: 38926
Gerrit-PatchSet: 1
Gerrit-Owner: Evgeny Zinoviev <me(a)ch1p.io>
Gerrit-MessageType: newchange
Hello Julius Werner,
I'd like you to do a code review. Please visit
https://review.coreboot.org/c/coreboot/+/38538
to review the following change.
Change subject: libpayload/corebootfb: Add option to center a 80x25 console
......................................................................
libpayload/corebootfb: Add option to center a 80x25 console
This makes payloads which are hardcoded to a 80x25 console look much
better, e.g. FILO with its "GRUB" user interface.
Change-Id: I9f4752328d85d148cd40a0c2337c7191e1d6a586
Signed-off-by: Nico Huber <nico.huber(a)secunet.com>
---
M payloads/libpayload/Kconfig
M payloads/libpayload/drivers/video/corebootfb.c
2 files changed, 28 insertions(+), 2 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/38/38538/1
diff --git a/payloads/libpayload/Kconfig b/payloads/libpayload/Kconfig
index f7501e3..36f4af5 100644
--- a/payloads/libpayload/Kconfig
+++ b/payloads/libpayload/Kconfig
@@ -315,6 +315,13 @@
Say Y here if coreboot switched to a graphics mode and
your payload wants to use it.
+config COREBOOT_VIDEO_CENTERED
+ bool "Center a classic 80x25 console on bigger screens"
+ depends on COREBOOT_VIDEO_CONSOLE
+ help
+ Say 'y' here if your payload is hardcoded to a 80x25 console. Otherwise
+ its output would look squeezed into the upper-left corner of the screen.
+
config FONT_SCALE_FACTOR
int "Scale factor for the included font"
depends on GEODELX_VIDEO_CONSOLE || COREBOOT_VIDEO_CONSOLE
diff --git a/payloads/libpayload/drivers/video/corebootfb.c b/payloads/libpayload/drivers/video/corebootfb.c
index c4b5048..8e7ac11 100644
--- a/payloads/libpayload/drivers/video/corebootfb.c
+++ b/payloads/libpayload/drivers/video/corebootfb.c
@@ -236,8 +236,16 @@
font_init(FI->x_resolution);
- coreboot_video_console.columns = FI->x_resolution / font_width;
- coreboot_video_console.rows = FI->y_resolution / font_height;
+ /* Draw centered on the framebuffer if requested and feasible, */
+ const int center =
+ IS_ENABLED(CONFIG_LP_COREBOOT_VIDEO_CENTERED)
+ && coreboot_video_console.columns * font_width <= FI->x_resolution
+ && coreboot_video_console.rows * font_height <= FI->y_resolution;
+ /* adapt to the framebuffer size, otherwise. */
+ if (!center) {
+ coreboot_video_console.columns = FI->x_resolution / font_width;
+ coreboot_video_console.rows = FI->y_resolution / font_height;
+ }
chars = malloc(coreboot_video_console.rows *
coreboot_video_console.columns * 2);
@@ -246,6 +254,17 @@
// clear boot splash screen if there is one.
corebootfb_clear();
+
+ if (center) {
+ FI->physical_address +=
+ (FI->x_resolution - coreboot_video_console.columns * font_width)
+ / 2 * FI->bits_per_pixel / 8
+ + (FI->y_resolution - coreboot_video_console.rows * font_height)
+ / 2 * FI->bytes_per_line;
+ FI->x_resolution = coreboot_video_console.columns * font_width;
+ FI->y_resolution = coreboot_video_console.rows * font_height;
+ }
+
return 0;
}
--
To view, visit https://review.coreboot.org/c/coreboot/+/38538
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-Change-Id: I9f4752328d85d148cd40a0c2337c7191e1d6a586
Gerrit-Change-Number: 38538
Gerrit-PatchSet: 1
Gerrit-Owner: Nico Huber <nico.h(a)gmx.de>
Gerrit-Reviewer: Julius Werner <jwerner(a)chromium.org>
Gerrit-MessageType: newchange
Hello Julius Werner,
I'd like you to do a code review. Please visit
https://review.coreboot.org/c/coreboot/+/38537
to review the following change.
Change subject: libpayload/corebootfb: Keep local copy of framebuffer info
......................................................................
libpayload/corebootfb: Keep local copy of framebuffer info
Keeping a local copy of the framebuffer info allows us to make changes,
e.g. add offsets. It also avoids trouble with relocation.
Change-Id: I852c4eb229dd0724114acb302ab2ed7164712b64
Signed-off-by: Nico Huber <nico.huber(a)secunet.com>
---
M payloads/libpayload/drivers/video/corebootfb.c
1 file changed, 6 insertions(+), 10 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/37/38537/1
diff --git a/payloads/libpayload/drivers/video/corebootfb.c b/payloads/libpayload/drivers/video/corebootfb.c
index 11397ba..c4b5048 100644
--- a/payloads/libpayload/drivers/video/corebootfb.c
+++ b/payloads/libpayload/drivers/video/corebootfb.c
@@ -61,13 +61,12 @@
(0xFF << 16) | (0xFF << 8) | 0xFF,
};
-/* Addresses for the various components */
-static unsigned long fbinfo;
-static unsigned long fbaddr;
+struct cb_framebuffer fbinfo;
static unsigned short *chars;
-#define FI ((struct cb_framebuffer *) phys_to_virt(fbinfo))
-#define FB ((unsigned char *) phys_to_virt(fbaddr))
+/* Addresses for the various components */
+#define FI (&fbinfo)
+#define FB ((unsigned char *) phys_to_virt(FI->physical_address))
#define CHARS (chars)
static void corebootfb_scroll_up(void)
@@ -230,12 +229,9 @@
if (lib_sysinfo.framebuffer == NULL)
return -1;
- /* We might have been called before relocation (like FILO does). So
- just keep the physical address which won't break on relocation. */
- fbinfo = virt_to_phys(lib_sysinfo.framebuffer);
+ fbinfo = *lib_sysinfo.framebuffer;
- fbaddr = FI->physical_address;
- if (fbaddr == 0)
+ if (FI->physical_address == 0)
return -1;
font_init(FI->x_resolution);
--
To view, visit https://review.coreboot.org/c/coreboot/+/38537
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-Change-Id: I852c4eb229dd0724114acb302ab2ed7164712b64
Gerrit-Change-Number: 38537
Gerrit-PatchSet: 1
Gerrit-Owner: Nico Huber <nico.h(a)gmx.de>
Gerrit-Reviewer: Julius Werner <jwerner(a)chromium.org>
Gerrit-MessageType: newchange