[coreboot-gerrit] New patch to review for coreboot: soc/intel/common/block: Add car teardown
Subrata Banik (subrata.banik@intel.com)
gerrit at coreboot.org
Wed Mar 15 13:03:30 CET 2017
Subrata Banik (subrata.banik at intel.com) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/18825
-gerrit
commit 7f46ad5cdb3357605837fc0e46894838b91b569d
Author: Subrata Banik <subrata.banik at intel.com>
Date: Wed Mar 15 17:25:00 2017 +0530
soc/intel/common/block: Add car teardown
TEST=APL Booted till OS and ensure to have CAR teardown is successful .
Change-Id: I4eff86ec6361a0fdc7a35bbc7841dec001217727
Signed-off-by: Subrata Banik <subrata.banik at intel.com>
---
src/soc/intel/common/block/cpu/Makefile.inc | 2 +
src/soc/intel/common/block/cpu/car/exit_car.S | 96 +++++++++++++++++++++++++++
2 files changed, 98 insertions(+)
diff --git a/src/soc/intel/common/block/cpu/Makefile.inc b/src/soc/intel/common/block/cpu/Makefile.inc
index 48f7990..8c21161 100644
--- a/src/soc/intel/common/block/cpu/Makefile.inc
+++ b/src/soc/intel/common/block/cpu/Makefile.inc
@@ -1,2 +1,4 @@
bootblock-$(CONFIG_SOC_INTEL_COMMON_BLOCK_CAR) += car/cache_as_ram.S
+postcar-$(CONFIG_SOC_INTEL_COMMON_BLOCK_CAR) += car/exit_car.S
+romstage-$(CONFIG_SOC_INTEL_COMMON_BLOCK_CAR) += car/exit_car.S
diff --git a/src/soc/intel/common/block/cpu/car/exit_car.S b/src/soc/intel/common/block/cpu/car/exit_car.S
new file mode 100644
index 0000000..15e7f17
--- /dev/null
+++ b/src/soc/intel/common/block/cpu/car/exit_car.S
@@ -0,0 +1,96 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright 2017 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 <cpu/x86/mtrr.h>
+#include <cpu/x86/cr.h>
+#include <intelblocks/msr.h>
+
+.text
+.global chipset_teardown_car
+chipset_teardown_car:
+
+ /*
+ * Retrieve return address from stack as it will get trashed below if
+ * execution is utilizing the cache-as-ram stack.
+ */
+ pop %ebx
+
+ /* Disable MTRRs. */
+ mov $(MTRR_DEF_TYPE_MSR), %ecx
+ rdmsr
+ and $(~(MTRR_DEF_TYPE_EN | MTRR_DEF_TYPE_FIX_EN)), %eax
+ wrmsr
+
+#if IS_ENABLED(CONFIG_INTEL_CAR_NEM)
+.global car_nem_teardown
+car_nem_teardown:
+
+ /* invalidate cache contents. */
+ invd
+
+ /* Knock down bit 1 then bit 0 of NEM control not combining steps. */
+ mov $(MSR_EVICT_CTL), %ecx
+ rdmsr
+ and $(~(1 << 1)), %eax
+ wrmsr
+ and $(~(1 << 0)), %eax
+ wrmsr
+
+#elif IS_ENABLED(CONFIG_INTEL_CAR_CQOS)
+.global car_cqos_teardown
+car_cqos_teardown:
+
+ /* Go back to all-evicting mode, set both masks to all-1s */
+ mov $MSR_L2_QOS_MASK(0), %ecx
+ rdmsr
+ mov $~0, %al
+ wrmsr
+
+ mov $MSR_L2_QOS_MASK(1), %ecx
+ rdmsr
+ mov $~0, %al
+ wrmsr
+
+ /* Reset CLOS selector to 0 */
+ mov $MSR_IA32_PQR_ASSOC, %ecx
+ rdmsr
+ and $~IA32_PQR_ASSOC_MASK, %edx
+ wrmsr
+
+#elif IS_ENABLED(CONFIG_INTEL_CAR_NEM_ENHANCED)
+.global car_nem_enhanced_teardown
+car_nem_enhanced_teardown:
+
+ /* invalidate cache contents. */
+ invd
+
+ /* Knock down bit 1 then bit 0 of NEM control not combining steps. */
+ mov $(MSR_EVICT_CTL), %ecx
+ rdmsr
+ and $(~(1 << 1)), %eax
+ wrmsr
+ and $(~(1 << 0)), %eax
+ wrmsr
+
+ /* Reset CLOS selector to 0 */
+ mov $MSR_IA32_PQR_ASSOC, %ecx
+ rdmsr
+ and $~IA32_PQR_ASSOC_MASK, %edx
+ wrmsr
+#endif
+
+ /* Return to caller. */
+ jmp *%ebx
More information about the coreboot-gerrit
mailing list