Attention is currently required from: Varshit B Pandya, Lance Zhao, Subrata Banik, Rizwan Qureshi, Tim Wawrzynczak.
Hello Lance Zhao, build bot (Jenkins), Subrata Banik, Rizwan Qureshi, Tim Wawrzynczak, Eric Lai,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/63315
to look at the new patch set (#3).
Change subject: drivers/intel/dptf: Add support for Battery participant
......................................................................
drivers/intel/dptf: Add support for Battery participant
As per Intel Dynamic Tuning revision 1.3.13 (Doc no: 541817)
Add support for TBAT device under \_SB.DPTF
BUG=b:205928013
TEST=Build, boot brya0 and dump SSDT to check TBAT device
Device (TBAT)
{
Name (_HID, "INTC1061") // _HID: Hardware ID
Name (_UID, "TBAT") // _UID: Unique ID
Name (_STR, "Battery Participant") // _STR: Description String
Name (PTYP, 0xC)
Method (_STA, 0, NotSerialized) // _STA: Status
{
Return (0x0F)
}
}
Signed-off-by: Varshit B Pandya <varshit.b.pandya(a)intel.com>
Change-Id: I9104318fd838f30253ab1eeac4e212b3b917f516
---
M src/acpi/acpigen_dptf.c
M src/drivers/intel/dptf/Kconfig
M src/drivers/intel/dptf/dptf.c
M src/drivers/intel/dptf/dptf.h
M src/include/acpi/acpigen_dptf.h
5 files changed, 36 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/15/63315/3
--
To view, visit https://review.coreboot.org/c/coreboot/+/63315
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-Change-Id: I9104318fd838f30253ab1eeac4e212b3b917f516
Gerrit-Change-Number: 63315
Gerrit-PatchSet: 3
Gerrit-Owner: Varshit B Pandya <varshit.b.pandya(a)intel.com>
Gerrit-Reviewer: Eric Lai <eric_lai(a)quanta.corp-partner.google.com>
Gerrit-Reviewer: Lance Zhao
Gerrit-Reviewer: Rizwan Qureshi <rizwan.qureshi(a)intel.com>
Gerrit-Reviewer: Subrata Banik <subratabanik(a)google.com>
Gerrit-Reviewer: Tim Wawrzynczak <twawrzynczak(a)chromium.org>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-CC: Poornima Tom <poornima.tom(a)intel.com>
Gerrit-CC: Sumeet R Pawnikar <sumeet.r.pawnikar(a)intel.com>
Gerrit-Attention: Varshit B Pandya <varshit.b.pandya(a)intel.com>
Gerrit-Attention: Lance Zhao
Gerrit-Attention: Subrata Banik <subratabanik(a)google.com>
Gerrit-Attention: Rizwan Qureshi <rizwan.qureshi(a)intel.com>
Gerrit-Attention: Tim Wawrzynczak <twawrzynczak(a)chromium.org>
Gerrit-MessageType: newpatchset
Felix Held has submitted this change. ( https://review.coreboot.org/c/coreboot/+/63221 )
Change subject: soc/intel/common/block/fast_spi: Refactor ROM caching implementation
......................................................................
soc/intel/common/block/fast_spi: Refactor ROM caching implementation
This patch removes different implementation to cache the SPI ROM between
early and later boot stage where SPI ROM caching doesn't need even
advanced implementation like `mtrr_use_temp_range()` as SPI ROM ranage
is always mapped to below 4GB hence, simple `set_var_mtrr()` function
can be sufficient without any additional complexity.
BUG=b:225766934
TEST=Calling into `fast_spi_cache_bios_region()` from ramstage is able
to update the temporary variable range MTRRs and showed ~44ms of boot
time savings as below:
Before:
90:starting to load payload       1,084,052 (14)
 15:starting LZMA decompress (ignore for x86)  1,084,121 (68)
 16:finished LZMA decompress (ignore for x86)  1,140,742 (56,620)
After:
90:starting to load payload        1,090,433 (14)
 15:starting LZMA decompress (ignore for x86)  1,090,650 (217)
 16:finished LZMA decompress (ignore for x86)  1,102,896 (12,245)
Signed-off-by: Subrata Banik <subratabanik(a)google.com>
Change-Id: I43973b45dc6d032cfcc920eeb36b37fe027e6e8e
Reviewed-on: https://review.coreboot.org/c/coreboot/+/63221
Reviewed-by: Tim Wawrzynczak <twawrzynczak(a)chromium.org>
Reviewed-by: Arthur Heymans <arthur(a)aheymans.xyz>
Reviewed-by: Nick Vaccaro <nvaccaro(a)google.com>
Reviewed-by: Eric Lai <eric_lai(a)quanta.corp-partner.google.com>
Tested-by: build bot (Jenkins) <no-reply(a)coreboot.org>
---
M src/soc/intel/common/block/fast_spi/fast_spi.c
1 file changed, 15 insertions(+), 20 deletions(-)
Approvals:
build bot (Jenkins): Verified
Arthur Heymans: Looks good to me, approved
Nick Vaccaro: Looks good to me, approved
Tim Wawrzynczak: Looks good to me, approved
Eric Lai: Looks good to me, approved
diff --git a/src/soc/intel/common/block/fast_spi/fast_spi.c b/src/soc/intel/common/block/fast_spi/fast_spi.c
index 7be71a2..5a76df3 100644
--- a/src/soc/intel/common/block/fast_spi/fast_spi.c
+++ b/src/soc/intel/common/block/fast_spi/fast_spi.c
@@ -7,6 +7,7 @@
#include <assert.h>
#include <device/pci_def.h>
#include <device/pci_ops.h>
+#include <console/console.h>
#include <commonlib/helpers.h>
#include <cpu/x86/mtrr.h>
#include <fast_spi_def.h>
@@ -196,6 +197,18 @@
write32(spibar + SPIBAR_RESET_LOCK, ssl);
}
+static void fast_spi_enable_cache_range(unsigned int base, unsigned int size)
+{
+ const int type = MTRR_TYPE_WRPROT;
+ int mtrr = get_free_var_mtrr();
+ if (mtrr == -1) {
+ printk(BIOS_WARNING, "ROM caching failed due to no free MTRR available!\n");
+ return;
+ }
+
+ set_var_mtrr(mtrr, base, size, type);
+}
+
/*
* Returns bios_start and fills in size of the BIOS region.
*/
@@ -240,19 +253,11 @@
{
size_t ext_bios_size;
uintptr_t ext_bios_base;
- const int type = MTRR_TYPE_WRPROT;
if (!fast_spi_ext_bios_cache_range(&ext_bios_base, &ext_bios_size))
return;
- if (ENV_PAYLOAD_LOADER) {
- mtrr_use_temp_range(ext_bios_base, ext_bios_size, type);
- } else {
- int mtrr = get_free_var_mtrr();
- if (mtrr == -1)
- return;
- set_var_mtrr(mtrr, ext_bios_base, ext_bios_size, type);
- }
+ fast_spi_enable_cache_range(ext_bios_base, ext_bios_size);
}
void fast_spi_cache_ext_bios_postcar(struct postcar_frame *pcf)
@@ -271,7 +276,6 @@
{
size_t bios_size;
uint32_t alignment;
- const int type = MTRR_TYPE_WRPROT;
uintptr_t base;
/* Only the IFD BIOS region is memory mapped (at top of 4G) */
@@ -290,16 +294,7 @@
bios_size = ALIGN_UP(bios_size, alignment);
base = 4ULL*GiB - bios_size;
- if (ENV_PAYLOAD_LOADER) {
- mtrr_use_temp_range(base, bios_size, type);
- } else {
- int mtrr = get_free_var_mtrr();
-
- if (mtrr == -1)
- return;
-
- set_var_mtrr(mtrr, base, bios_size, type);
- }
+ fast_spi_enable_cache_range(base, bios_size);
/* Check if caching is needed for extended bios region if supported */
fast_spi_cache_ext_bios_window();
--
To view, visit https://review.coreboot.org/c/coreboot/+/63221
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-Change-Id: I43973b45dc6d032cfcc920eeb36b37fe027e6e8e
Gerrit-Change-Number: 63221
Gerrit-PatchSet: 3
Gerrit-Owner: Subrata Banik <subratabanik(a)google.com>
Gerrit-Reviewer: Angel Pons <th3fanbus(a)gmail.com>
Gerrit-Reviewer: Arthur Heymans <arthur(a)aheymans.xyz>
Gerrit-Reviewer: Eric Lai <eric_lai(a)quanta.corp-partner.google.com>
Gerrit-Reviewer: Felix Held <felix-coreboot(a)felixheld.de>
Gerrit-Reviewer: Kane Chen <kane.chen(a)intel.com>
Gerrit-Reviewer: Nick Vaccaro <nvaccaro(a)google.com>
Gerrit-Reviewer: Tim Wawrzynczak <twawrzynczak(a)chromium.org>
Gerrit-Reviewer: Werner Zeh <werner.zeh(a)siemens.com>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-CC: Amanda Hwang <amanda_hwang(a)compal.corp-partner.google.com>
Gerrit-CC: Dtrain Hsu <dtrain_hsu(a)compal.corp-partner.google.com>
Gerrit-CC: Frank Wu <frank_wu(a)compal.corp-partner.google.com>
Gerrit-CC: Ian Feng <ian_feng(a)compal.corp-partner.google.com>
Gerrit-CC: John Su <john_su(a)compal.corp-partner.google.com>
Gerrit-CC: Paul Menzel <paulepanter(a)mailbox.org>
Gerrit-MessageType: merged
Felix Held has submitted this change. ( https://review.coreboot.org/c/coreboot/+/63220 )
Change subject: cpu/x86/mtrr: Delay removing `temp` variable range MTRR snapshot
......................................................................
cpu/x86/mtrr: Delay removing `temp` variable range MTRR snapshot
This patch delays removing `temporary` MTRR snapshots to avoid conflicts
with other operations attached with same `BS_PAYLOAD_BOOT/BS_ON_EXIT`
boot state.
BUG=b:225766934
TEST=Having variable MTRR snapshot using display_mtrrs() is able to
list only the permanent MTRRs and all temporary MTRRs are removed
prior to boot to payload.
Signed-off-by: Subrata Banik <subratabanik(a)google.com>
Change-Id: I602dca989745159d013d6573191861b296f5d3ab
Reviewed-on: https://review.coreboot.org/c/coreboot/+/63220
Tested-by: build bot (Jenkins) <no-reply(a)coreboot.org>
Reviewed-by: Arthur Heymans <arthur(a)aheymans.xyz>
Reviewed-by: Eric Lai <eric_lai(a)quanta.corp-partner.google.com>
Reviewed-by: Tim Wawrzynczak <twawrzynczak(a)chromium.org>
---
M src/cpu/x86/mtrr/mtrr.c
1 file changed, 1 insertion(+), 1 deletion(-)
Approvals:
build bot (Jenkins): Verified
Arthur Heymans: Looks good to me, approved
Tim Wawrzynczak: Looks good to me, approved
Eric Lai: Looks good to me, but someone else must approve
diff --git a/src/cpu/x86/mtrr/mtrr.c b/src/cpu/x86/mtrr/mtrr.c
index 84d844a..89cac7f 100644
--- a/src/cpu/x86/mtrr/mtrr.c
+++ b/src/cpu/x86/mtrr/mtrr.c
@@ -915,4 +915,4 @@
}
BOOT_STATE_INIT_ENTRY(BS_OS_RESUME, BS_ON_ENTRY, remove_temp_solution, NULL);
-BOOT_STATE_INIT_ENTRY(BS_PAYLOAD_LOAD, BS_ON_EXIT, remove_temp_solution, NULL);
+BOOT_STATE_INIT_ENTRY(BS_PAYLOAD_BOOT, BS_ON_ENTRY, remove_temp_solution, NULL);
1 is the latest approved patch-set.
No files were changed between the latest approved patch-set and the submitted one.
--
To view, visit https://review.coreboot.org/c/coreboot/+/63220
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-Change-Id: I602dca989745159d013d6573191861b296f5d3ab
Gerrit-Change-Number: 63220
Gerrit-PatchSet: 4
Gerrit-Owner: Subrata Banik <subratabanik(a)google.com>
Gerrit-Reviewer: Angel Pons <th3fanbus(a)gmail.com>
Gerrit-Reviewer: Arthur Heymans <arthur(a)aheymans.xyz>
Gerrit-Reviewer: Eric Lai <eric_lai(a)quanta.corp-partner.google.com>
Gerrit-Reviewer: Felix Held <felix-coreboot(a)felixheld.de>
Gerrit-Reviewer: Kane Chen <kane.chen(a)intel.com>
Gerrit-Reviewer: Nick Vaccaro <nvaccaro(a)google.com>
Gerrit-Reviewer: Tim Wawrzynczak <twawrzynczak(a)chromium.org>
Gerrit-Reviewer: Werner Zeh <werner.zeh(a)siemens.com>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-CC: Amanda Hwang <amanda_hwang(a)compal.corp-partner.google.com>
Gerrit-CC: Dtrain Hsu <dtrain_hsu(a)compal.corp-partner.google.com>
Gerrit-CC: Frank Wu <frank_wu(a)compal.corp-partner.google.com>
Gerrit-CC: Ian Feng <ian_feng(a)compal.corp-partner.google.com>
Gerrit-CC: John Su <john_su(a)compal.corp-partner.google.com>
Gerrit-CC: Paul Menzel <paulepanter(a)mailbox.org>
Gerrit-MessageType: merged
Felix Held has submitted this change. ( https://review.coreboot.org/c/coreboot/+/63219 )
Change subject: {cpu/x86, drivers/amd}: Use `get_var_mtrr_count()` to get MTRR count
......................................................................
{cpu/x86, drivers/amd}: Use `get_var_mtrr_count()` to get MTRR count
This patch replaces the implementation that is used to get the number of
variable MTRRs with `get_var_mtrr_count()` function.
BUG=b:225766934
TEST=Able to build and boot google/redrix board to ChromeOS.
Signed-off-by: Subrata Banik <subratabanik(a)google.com>
Change-Id: I4751add9c45374e60b7a425df87d06f52e6fcb8c
Reviewed-on: https://review.coreboot.org/c/coreboot/+/63219
Tested-by: build bot (Jenkins) <no-reply(a)coreboot.org>
Reviewed-by: Felix Held <felix-coreboot(a)felixheld.de>
Reviewed-by: Arthur Heymans <arthur(a)aheymans.xyz>
Reviewed-by: Eric Lai <eric_lai(a)quanta.corp-partner.google.com>
Reviewed-by: Tim Wawrzynczak <twawrzynczak(a)chromium.org>
---
M src/cpu/x86/mp_init.c
M src/cpu/x86/mtrr/mtrr.c
M src/cpu/x86/mtrr/xip_cache.c
M src/drivers/amd/agesa/mtrr_fixme.c
4 files changed, 4 insertions(+), 12 deletions(-)
Approvals:
build bot (Jenkins): Verified
Felix Held: Looks good to me, approved
Arthur Heymans: Looks good to me, approved
Tim Wawrzynczak: Looks good to me, approved
Eric Lai: Looks good to me, approved
diff --git a/src/cpu/x86/mp_init.c b/src/cpu/x86/mp_init.c
index 1f1f968..81c987b 100644
--- a/src/cpu/x86/mp_init.c
+++ b/src/cpu/x86/mp_init.c
@@ -247,11 +247,9 @@
int num_var_mtrrs;
struct saved_msr *msr_entry;
int i;
- msr_t msr;
/* Determine number of MTRRs need to be saved. */
- msr = rdmsr(MTRR_CAP_MSR);
- num_var_mtrrs = msr.lo & 0xff;
+ num_var_mtrrs = get_var_mtrr_count();
/* 2 * num_var_mtrrs for base and mask. +1 for IA32_MTRR_DEF_TYPE. */
msr_count = 2 * num_var_mtrrs + NUM_FIXED_MTRRS + 1;
diff --git a/src/cpu/x86/mtrr/mtrr.c b/src/cpu/x86/mtrr/mtrr.c
index 185014e..84d844a 100644
--- a/src/cpu/x86/mtrr/mtrr.c
+++ b/src/cpu/x86/mtrr/mtrr.c
@@ -41,11 +41,7 @@
static void detect_var_mtrrs(void)
{
- msr_t msr;
-
- msr = rdmsr(MTRR_CAP_MSR);
-
- total_mtrrs = msr.lo & 0xff;
+ total_mtrrs = get_var_mtrr_count();
if (total_mtrrs > NUM_MTRR_STATIC_STORAGE) {
printk(BIOS_WARNING,
diff --git a/src/cpu/x86/mtrr/xip_cache.c b/src/cpu/x86/mtrr/xip_cache.c
index cd82e4f..6ed96af 100644
--- a/src/cpu/x86/mtrr/xip_cache.c
+++ b/src/cpu/x86/mtrr/xip_cache.c
@@ -14,8 +14,7 @@
the MTRR, no matter the caching type, are filled and not overlapping. */
static uint32_t max_cache_used(void)
{
- msr_t msr = rdmsr(MTRR_CAP_MSR);
- int i, total_mtrrs = msr.lo & MTRR_CAP_VCNT;
+ int i, total_mtrrs = get_var_mtrr_count();
uint32_t total_cache = 0;
for (i = 0; i < total_mtrrs; i++) {
diff --git a/src/drivers/amd/agesa/mtrr_fixme.c b/src/drivers/amd/agesa/mtrr_fixme.c
index c589553..1313b5d 100644
--- a/src/drivers/amd/agesa/mtrr_fixme.c
+++ b/src/drivers/amd/agesa/mtrr_fixme.c
@@ -14,8 +14,7 @@
{
int i, max_var_mtrrs;
msr_t msr;
- msr = rdmsr(MTRR_CAP_MSR);
- max_var_mtrrs = msr.lo & MTRR_CAP_VCNT;
+ max_var_mtrrs = get_var_mtrr_count();
for (i = 0; i < max_var_mtrrs; i++) {
msr = rdmsr(MTRR_PHYS_MASK(i));
--
To view, visit https://review.coreboot.org/c/coreboot/+/63219
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-Change-Id: I4751add9c45374e60b7a425df87d06f52e6fcb8c
Gerrit-Change-Number: 63219
Gerrit-PatchSet: 3
Gerrit-Owner: Subrata Banik <subratabanik(a)google.com>
Gerrit-Reviewer: Angel Pons <th3fanbus(a)gmail.com>
Gerrit-Reviewer: Arthur Heymans <arthur(a)aheymans.xyz>
Gerrit-Reviewer: Eric Lai <eric_lai(a)quanta.corp-partner.google.com>
Gerrit-Reviewer: Felix Held <felix-coreboot(a)felixheld.de>
Gerrit-Reviewer: Kane Chen <kane.chen(a)intel.com>
Gerrit-Reviewer: Nick Vaccaro <nvaccaro(a)google.com>
Gerrit-Reviewer: Tim Wawrzynczak <twawrzynczak(a)chromium.org>
Gerrit-Reviewer: Werner Zeh <werner.zeh(a)siemens.com>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-CC: Amanda Hwang <amanda_hwang(a)compal.corp-partner.google.com>
Gerrit-CC: Dtrain Hsu <dtrain_hsu(a)compal.corp-partner.google.com>
Gerrit-CC: Frank Wu <frank_wu(a)compal.corp-partner.google.com>
Gerrit-CC: Ian Feng <ian_feng(a)compal.corp-partner.google.com>
Gerrit-CC: John Su <john_su(a)compal.corp-partner.google.com>
Gerrit-CC: Paul Menzel <paulepanter(a)mailbox.org>
Gerrit-MessageType: merged
Attention is currently required from: Subrata Banik, Angel Pons, Nick Vaccaro, Kane Chen, Werner Zeh.
Felix Held has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/63219 )
Change subject: {cpu/x86, drivers/amd}: Use `get_var_mtrr_count()` to get MTRR count
......................................................................
Patch Set 2: Code-Review+2
--
To view, visit https://review.coreboot.org/c/coreboot/+/63219
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-Change-Id: I4751add9c45374e60b7a425df87d06f52e6fcb8c
Gerrit-Change-Number: 63219
Gerrit-PatchSet: 2
Gerrit-Owner: Subrata Banik <subratabanik(a)google.com>
Gerrit-Reviewer: Angel Pons <th3fanbus(a)gmail.com>
Gerrit-Reviewer: Arthur Heymans <arthur(a)aheymans.xyz>
Gerrit-Reviewer: Eric Lai <eric_lai(a)quanta.corp-partner.google.com>
Gerrit-Reviewer: Felix Held <felix-coreboot(a)felixheld.de>
Gerrit-Reviewer: Kane Chen <kane.chen(a)intel.com>
Gerrit-Reviewer: Nick Vaccaro <nvaccaro(a)google.com>
Gerrit-Reviewer: Tim Wawrzynczak <twawrzynczak(a)chromium.org>
Gerrit-Reviewer: Werner Zeh <werner.zeh(a)siemens.com>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-CC: Amanda Hwang <amanda_hwang(a)compal.corp-partner.google.com>
Gerrit-CC: Dtrain Hsu <dtrain_hsu(a)compal.corp-partner.google.com>
Gerrit-CC: Frank Wu <frank_wu(a)compal.corp-partner.google.com>
Gerrit-CC: Ian Feng <ian_feng(a)compal.corp-partner.google.com>
Gerrit-CC: John Su <john_su(a)compal.corp-partner.google.com>
Gerrit-CC: Paul Menzel <paulepanter(a)mailbox.org>
Gerrit-Attention: Subrata Banik <subratabanik(a)google.com>
Gerrit-Attention: Angel Pons <th3fanbus(a)gmail.com>
Gerrit-Attention: Nick Vaccaro <nvaccaro(a)google.com>
Gerrit-Attention: Kane Chen <kane.chen(a)intel.com>
Gerrit-Attention: Werner Zeh <werner.zeh(a)siemens.com>
Gerrit-Comment-Date: Sat, 02 Apr 2022 14:55:21 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment
Felix Held has submitted this change. ( https://review.coreboot.org/c/coreboot/+/63218 )
Change subject: cpu/x86/mtrr: Make useful MTRR functions available for all boot stages
......................................................................
cpu/x86/mtrr: Make useful MTRR functions available for all boot stages
This patch migrates a few useful MTRR functions as below from
`earlymtrr.c` file to newly created common stage file `mtrrlib.c`.
1. get_free_var_mtrr
2. set_var_mtrr
3. clear_all_var_mtrr
These functions can be used to perform the MTRR programming from IA
common code SPI driver as `fast_spi.c` without requiring two separate
implementations for early boot stage (till romstage) and for ramstage
onwards.
BUG=b:225766934
TEST=Able to build and boot google/redrix board to ChromeOS.
Signed-off-by: Subrata Banik <subratabanik(a)google.com>
Change-Id: I2c62a04a36d3169545c3128b4231992ad9b3699d
Reviewed-on: https://review.coreboot.org/c/coreboot/+/63218
Tested-by: build bot (Jenkins) <no-reply(a)coreboot.org>
Reviewed-by: Arthur Heymans <arthur(a)aheymans.xyz>
Reviewed-by: Eric Lai <eric_lai(a)quanta.corp-partner.google.com>
Reviewed-by: Tim Wawrzynczak <twawrzynczak(a)chromium.org>
---
M src/cpu/x86/mtrr/Makefile.inc
M src/cpu/x86/mtrr/earlymtrr.c
A src/cpu/x86/mtrr/mtrrlib.c
3 files changed, 70 insertions(+), 60 deletions(-)
Approvals:
build bot (Jenkins): Verified
Arthur Heymans: Looks good to me, approved
Tim Wawrzynczak: Looks good to me, approved
Eric Lai: Looks good to me, but someone else must approve
diff --git a/src/cpu/x86/mtrr/Makefile.inc b/src/cpu/x86/mtrr/Makefile.inc
index 3f33e31..ac65026 100644
--- a/src/cpu/x86/mtrr/Makefile.inc
+++ b/src/cpu/x86/mtrr/Makefile.inc
@@ -1,5 +1,10 @@
ramstage-y += mtrr.c
+ramstage-y += mtrrlib.c
+romstage-y += mtrrlib.c
+bootblock-y += mtrrlib.c
+verstage_x86-y += mtrrlib.c
+
romstage-y += earlymtrr.c
bootblock-y += earlymtrr.c
verstage_x86-y += earlymtrr.c
diff --git a/src/cpu/x86/mtrr/earlymtrr.c b/src/cpu/x86/mtrr/earlymtrr.c
index aa301d0..a2d6e11 100644
--- a/src/cpu/x86/mtrr/earlymtrr.c
+++ b/src/cpu/x86/mtrr/earlymtrr.c
@@ -6,66 +6,6 @@
#include <console/console.h>
#include <commonlib/bsd/helpers.h>
-/* Get first available variable MTRR.
- * Returns var# if available, else returns -1.
- */
-int get_free_var_mtrr(void)
-{
- msr_t maskm;
- int vcnt;
- int i;
-
- vcnt = get_var_mtrr_count();
-
- /* Identify the first var mtrr which is not valid. */
- for (i = 0; i < vcnt; i++) {
- maskm = rdmsr(MTRR_PHYS_MASK(i));
- if ((maskm.lo & MTRR_PHYS_MASK_VALID) == 0)
- return i;
- }
-
- /* No free var mtrr. */
- return -1;
-}
-
-void set_var_mtrr(
- unsigned int reg, unsigned int base, unsigned int size,
- unsigned int type)
-{
- /* Bit 32-35 of MTRRphysMask should be set to 1 */
- /* FIXME: It only support 4G less range */
- msr_t basem, maskm;
-
- if (!IS_POWER_OF_2(size))
- printk(BIOS_ERR, "MTRR Error: size %#x is not a power of two\n", size);
- if (size < 4 * KiB)
- printk(BIOS_ERR, "MTRR Error: size %#x smaller than 4KiB\n", size);
- if (base % size != 0)
- printk(BIOS_ERR, "MTRR Error: base %#x must be aligned to size %#x\n", base,
- size);
-
- basem.lo = base | type;
- basem.hi = 0;
- wrmsr(MTRR_PHYS_BASE(reg), basem);
- maskm.lo = ~(size - 1) | MTRR_PHYS_MASK_VALID;
- maskm.hi = (1 << (cpu_phys_address_size() - 32)) - 1;
- wrmsr(MTRR_PHYS_MASK(reg), maskm);
-}
-
-void clear_all_var_mtrr(void)
-{
- msr_t mtrr = {0, 0};
- int vcnt;
- int i;
-
- vcnt = get_var_mtrr_count();
-
- for (i = 0; i < vcnt; i++) {
- wrmsr(MTRR_PHYS_MASK(i), mtrr);
- wrmsr(MTRR_PHYS_BASE(i), mtrr);
- }
-}
-
void var_mtrr_context_init(struct var_mtrr_context *ctx, void *arg)
{
ctx->upper_mask = (1U << (cpu_phys_address_size() - 32)) - 1;
diff --git a/src/cpu/x86/mtrr/mtrrlib.c b/src/cpu/x86/mtrr/mtrrlib.c
new file mode 100644
index 0000000..71921de
--- /dev/null
+++ b/src/cpu/x86/mtrr/mtrrlib.c
@@ -0,0 +1,65 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+
+#include <cpu/cpu.h>
+#include <cpu/x86/mtrr.h>
+#include <cpu/x86/msr.h>
+#include <console/console.h>
+
+/* Get first available variable MTRR.
+ * Returns var# if available, else returns -1.
+ */
+int get_free_var_mtrr(void)
+{
+ msr_t maskm;
+ int vcnt;
+ int i;
+
+ vcnt = get_var_mtrr_count();
+
+ /* Identify the first var mtrr which is not valid. */
+ for (i = 0; i < vcnt; i++) {
+ maskm = rdmsr(MTRR_PHYS_MASK(i));
+ if ((maskm.lo & MTRR_PHYS_MASK_VALID) == 0)
+ return i;
+ }
+
+ /* No free var mtrr. */
+ return -1;
+}
+
+void set_var_mtrr(
+ unsigned int reg, unsigned int base, unsigned int size, unsigned int type)
+{
+ /* Bit 32-35 of MTRRphysMask should be set to 1 */
+ /* FIXME: It only support 4G less range */
+ msr_t basem, maskm;
+
+ if (!IS_POWER_OF_2(size))
+ printk(BIOS_ERR, "MTRR Error: size %#x is not a power of two\n", size);
+ if (size < 4 * KiB)
+ printk(BIOS_ERR, "MTRR Error: size %#x smaller than 4KiB\n", size);
+ if (base % size != 0)
+ printk(BIOS_ERR, "MTRR Error: base %#x must be aligned to size %#x\n", base,
+ size);
+
+ basem.lo = base | type;
+ basem.hi = 0;
+ wrmsr(MTRR_PHYS_BASE(reg), basem);
+ maskm.lo = ~(size - 1) | MTRR_PHYS_MASK_VALID;
+ maskm.hi = (1 << (cpu_phys_address_size() - 32)) - 1;
+ wrmsr(MTRR_PHYS_MASK(reg), maskm);
+}
+
+void clear_all_var_mtrr(void)
+{
+ msr_t mtrr = {0, 0};
+ int vcnt;
+ int i;
+
+ vcnt = get_var_mtrr_count();
+
+ for (i = 0; i < vcnt; i++) {
+ wrmsr(MTRR_PHYS_MASK(i), mtrr);
+ wrmsr(MTRR_PHYS_BASE(i), mtrr);
+ }
+}
1 is the latest approved patch-set.
No files were changed between the latest approved patch-set and the submitted one.
--
To view, visit https://review.coreboot.org/c/coreboot/+/63218
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-Change-Id: I2c62a04a36d3169545c3128b4231992ad9b3699d
Gerrit-Change-Number: 63218
Gerrit-PatchSet: 3
Gerrit-Owner: Subrata Banik <subratabanik(a)google.com>
Gerrit-Reviewer: Angel Pons <th3fanbus(a)gmail.com>
Gerrit-Reviewer: Arthur Heymans <arthur(a)aheymans.xyz>
Gerrit-Reviewer: Eric Lai <eric_lai(a)quanta.corp-partner.google.com>
Gerrit-Reviewer: Felix Held <felix-coreboot(a)felixheld.de>
Gerrit-Reviewer: Kane Chen <kane.chen(a)intel.com>
Gerrit-Reviewer: Nick Vaccaro <nvaccaro(a)google.com>
Gerrit-Reviewer: Tim Wawrzynczak <twawrzynczak(a)chromium.org>
Gerrit-Reviewer: Werner Zeh <werner.zeh(a)siemens.com>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-CC: Amanda Hwang <amanda_hwang(a)compal.corp-partner.google.com>
Gerrit-CC: Dtrain Hsu <dtrain_hsu(a)compal.corp-partner.google.com>
Gerrit-CC: Frank Wu <frank_wu(a)compal.corp-partner.google.com>
Gerrit-CC: Ian Feng <ian_feng(a)compal.corp-partner.google.com>
Gerrit-CC: John Su <john_su(a)compal.corp-partner.google.com>
Gerrit-CC: Paul Menzel <paulepanter(a)mailbox.org>
Gerrit-MessageType: merged
Felix Held has submitted this change. ( https://review.coreboot.org/c/coreboot/+/63286 )
Change subject: mb/google/skyrim: Fix ESPI communication issues
......................................................................
mb/google/skyrim: Fix ESPI communication issues
* Use dedicated ALERT pin to resolve NO_RESPONSE error/status while
getting target configuration.
* Configure the ESPI to operate at 16 MHZ since operating at 33 MHz
causes boot stall.
BUG=b:226635441
TEST=Build and Boot to OS in Skyrim. Ensure that EC <-> AP communication
is working fine through Host Command debug logs in EC console, ectool
version command.
Signed-off-by: Karthikeyan Ramasubramanian <kramasub(a)google.com>
Change-Id: I951afdada8ee4f917cdeba8e287e5a2ae77c97ee
Reviewed-on: https://review.coreboot.org/c/coreboot/+/63286
Reviewed-by: Jon Murphy <jpmurphy(a)google.com>
Reviewed-by: Raul Rangel <rrangel(a)chromium.org>
Reviewed-by: Felix Held <felix-coreboot(a)felixheld.de>
Tested-by: build bot (Jenkins) <no-reply(a)coreboot.org>
---
M src/mainboard/google/skyrim/variants/baseboard/devicetree.cb
1 file changed, 2 insertions(+), 2 deletions(-)
Approvals:
build bot (Jenkins): Verified
Felix Held: Looks good to me, approved
Raul Rangel: Looks good to me, approved
Jon Murphy: Looks good to me, but someone else must approve
diff --git a/src/mainboard/google/skyrim/variants/baseboard/devicetree.cb b/src/mainboard/google/skyrim/variants/baseboard/devicetree.cb
index 8fa6ba5..7f74d6d 100644
--- a/src/mainboard/google/skyrim/variants/baseboard/devicetree.cb
+++ b/src/mainboard/google/skyrim/variants/baseboard/devicetree.cb
@@ -27,9 +27,9 @@
},
.io_mode = ESPI_IO_MODE_QUAD,
- .op_freq_mhz = ESPI_OP_FREQ_33_MHZ,
+ .op_freq_mhz = ESPI_OP_FREQ_16_MHZ,
.crc_check_enable = 1,
- .alert_pin = ESPI_ALERT_PIN_IN_BAND,
+ .alert_pin = ESPI_ALERT_PIN_OPEN_DRAIN,
.periph_ch_en = 1,
.vw_ch_en = 1,
.oob_ch_en = 0,
--
To view, visit https://review.coreboot.org/c/coreboot/+/63286
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-Change-Id: I951afdada8ee4f917cdeba8e287e5a2ae77c97ee
Gerrit-Change-Number: 63286
Gerrit-PatchSet: 2
Gerrit-Owner: Karthik Ramasubramanian <kramasub(a)google.com>
Gerrit-Reviewer: Felix Held <felix-coreboot(a)felixheld.de>
Gerrit-Reviewer: Jon Murphy <jpmurphy(a)google.com>
Gerrit-Reviewer: Raul Rangel <rrangel(a)chromium.org>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-MessageType: merged
Attention is currently required from: Reka Norman, Paul Fagerburg.
Rob Barnes has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/63317 )
Change subject: util/cbmem: add type cast
......................................................................
Patch Set 2: Code-Review+2
--
To view, visit https://review.coreboot.org/c/coreboot/+/63317
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-Change-Id: I87a83758b7f122b77f9631c669c7cd8df66f8d1b
Gerrit-Change-Number: 63317
Gerrit-PatchSet: 2
Gerrit-Owner: Paul Fagerburg <pfagerburg(a)chromium.org>
Gerrit-Reviewer: Reka Norman <rekanorman(a)chromium.org>
Gerrit-Reviewer: Rob Barnes <robbarnes(a)google.com>
Gerrit-CC: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-Attention: Reka Norman <rekanorman(a)chromium.org>
Gerrit-Attention: Paul Fagerburg <pfagerburg(a)chromium.org>
Gerrit-Comment-Date: Sat, 02 Apr 2022 14:42:58 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment