Stefan Reinauer (stefan.reinauer(a)coreboot.org) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/1348
-gerrit
commit 4c11d714adf9a09677a358bea44e86f753b3d45f
Author: Duncan Laurie <dlaurie(a)chromium.org>
Date: Wed Jul 18 15:33:45 2012 -0700
CTDP: Only do TDP down/nominal change from TNP0
Otherwise there is a flurry of TDP changes with suspend/resume
as the kernel powers devices off on suspend and brings them
back online in resume.
This also adds a mutex around the TDP operations since it is
split across two methods and can't just rely on being Serialized.
Change-Id: I7757d3ddad34ac985a9c8ce2fc202e2b2dcb2527
Signed-off-by: Duncan Laurie <dlaurie(a)chromium.org>
---
.../intel/sandybridge/acpi/hostbridge.asl | 30 ++++++++++++++++----
1 files changed, 24 insertions(+), 6 deletions(-)
diff --git a/src/northbridge/intel/sandybridge/acpi/hostbridge.asl b/src/northbridge/intel/sandybridge/acpi/hostbridge.asl
index 8dd1de6..93db98d 100644
--- a/src/northbridge/intel/sandybridge/acpi/hostbridge.asl
+++ b/src/northbridge/intel/sandybridge/acpi/hostbridge.asl
@@ -101,6 +101,8 @@ Device (MCHC)
TLUD, 32,
}
+ Mutex (CTCM, 1) /* CTDP Switch Mutex (sync level 1) */
+ Name (CTCC, 0) /* CTDP Current Selection */
Name (CTCN, 0) /* CTDP Nominal Select */
Name (CTCD, 1) /* CTDP Down Select */
Name (CTCU, 2) /* CTDP Up Select */
@@ -167,12 +169,16 @@ Device (MCHC)
/* Set TDP Down */
Method (STND, 0, Serialized)
{
- Store ("Set TDP Down", Debug)
-
- If (LEqual (CTCD, CTCS)) {
+ If (Acquire (CTCM, 100)) {
+ Return (0)
+ }
+ If (LEqual (CTCD, CTCC)) {
+ Release (CTCM)
Return (0)
}
+ Store ("Set TDP Down", Debug)
+
/* Set CTC */
Store (CTCD, CTCS)
@@ -189,18 +195,26 @@ Device (MCHC)
/* Set PL1 */
Store (CTDD, PL1V)
+ /* Store the new TDP Down setting */
+ Store (CTCD, CTCC)
+
+ Release (CTCM)
Return (1)
}
/* Set TDP Nominal from Down */
Method (STDN, 0, Serialized)
{
- Store ("Set TDP Nominal", Debug)
-
- If (LEqual (CTCN, CTCS)) {
+ If (Acquire (CTCM, 100)) {
+ Return (0)
+ }
+ If (LEqual (CTCN, CTCC)) {
+ Release (CTCM)
Return (0)
}
+ Store ("Set TDP Nominal", Debug)
+
/* Set PL1 */
Store (CTDN, PL1V)
@@ -217,6 +231,10 @@ Device (MCHC)
/* Set CTC */
Store (CTCN, CTCS)
+ /* Store the new TDP Nominal setting */
+ Store (CTCN, CTCC)
+
+ Release (CTCM)
Return (1)
}
}
Stefan Reinauer (stefan.reinauer(a)coreboot.org) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/1346
-gerrit
commit a8d447a324ef126fab9dce1d1f8268fb97d24b72
Author: Duncan Laurie <dlaurie(a)chromium.org>
Date: Mon Jul 16 12:47:45 2012 -0700
ELOG: Fix reporting of developer/recovery modes
Recent changes in EC/Vboot/U-boot have completely broken
the logging of developer and recovery modes.
Recovery mode may not be in VBNV, so if that is zero and
yet we are in recovery mode then assume it is there because
the button/key was pressed.
Since there may not be any actual developer mode switch
we look if option rom is loaded and the system is not
in recovery mode and consider that as developer mode.
Change-Id: I70104877b24de477217e1ff5b3a019aef22343ec
Signed-off-by: Duncan Laurie <dlaurie(a)chromium.org>
---
src/include/elog.h | 1 +
src/vendorcode/google/chromeos/gnvs.c | 9 ++++++---
2 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/src/include/elog.h b/src/include/elog.h
index 5a84c75..488549e 100644
--- a/src/include/elog.h
+++ b/src/include/elog.h
@@ -104,6 +104,7 @@ struct elog_event_data_wake {
/* Chrome OS related events */
#define ELOG_TYPE_CROS_DEVELOPER_MODE 0xa0
#define ELOG_TYPE_CROS_RECOVERY_MODE 0xa1
+#define ELOG_CROS_RECOVERY_MODE_BUTTON 0x02
/* Management Engine Events */
#define ELOG_TYPE_MANAGEMENT_ENGINE 0xa2
diff --git a/src/vendorcode/google/chromeos/gnvs.c b/src/vendorcode/google/chromeos/gnvs.c
index c8ccfe4..2e9975c 100644
--- a/src/vendorcode/google/chromeos/gnvs.c
+++ b/src/vendorcode/google/chromeos/gnvs.c
@@ -37,11 +37,14 @@ void chromeos_init_vboot(chromeos_acpi_t *chromeos)
memcpy(vboot_data->mehh, me_hash_saved, sizeof(vboot_data->mehh));
#if CONFIG_ELOG
- if (developer_mode_enabled())
+ if (developer_mode_enabled() ||
+ (vboot_wants_oprom() && !recovery_mode_enabled()))
elog_add_event(ELOG_TYPE_CROS_DEVELOPER_MODE);
- if (recovery_mode_enabled())
+ if (recovery_mode_enabled()) {
+ int reason = get_recovery_mode_from_vbnv();
elog_add_event_byte(ELOG_TYPE_CROS_RECOVERY_MODE,
- get_recovery_mode_from_vbnv());
+ reason ? reason : ELOG_CROS_RECOVERY_MODE_BUTTON);
+ }
#endif
}
Stefan Reinauer (stefan.reinauer(a)coreboot.org) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/1344
-gerrit
commit 8b58555a396576d2ab85e0e724ca8cfd679bddfd
Author: Duncan Laurie <dlaurie(a)chromium.org>
Date: Mon Jul 16 12:27:42 2012 -0700
ACPI: Add support for runtime config TDP down
The required power MSRs are mirrored in MCHBAR so
it is possible to configure TDP at runtime via ASL.
This adds the required fields and a set of methods to
configure "TDP down" and "TDP nominal". It explicitly
does not support "TDP up" at the moment.
PSSS: method is added to assist in searching the _PSS
table for the appropriate entry that corresponds to the
desired max non-turbo ratio.
STND: Set TDP Down from Nominal. This will limit CPU to
the TDP down configuration by sequencing the required
changes in the right order.
STDN: Set TDP Nominal from Down. This will set the CPU
back to nominal configuration by sequencing the required
changes in the correct (reverse) order.
This does not introduce any functional changes and must
be paired with additional changes to be useful.
The current configured TDP can be checked to see that
the transition to/from a desired level is successful.
> mmio_read8 0xfed15f50
0x00 # TDP-Nominal
> mmio_read8 0xfed15f50
0x01 # TDP-Down
Change-Id: I31a2f30cc9d134cc5eee980ae9288ae45e71c6e6
Signed-off-by: Duncan Laurie <dlaurie(a)chromium.org>
---
.../intel/sandybridge/acpi/hostbridge.asl | 119 +++++++++++++++++++-
.../intel/sandybridge/acpi/sandybridge.asl | 2 +-
2 files changed, 119 insertions(+), 2 deletions(-)
diff --git a/src/northbridge/intel/sandybridge/acpi/hostbridge.asl b/src/northbridge/intel/sandybridge/acpi/hostbridge.asl
index 592c4c6..8dd1de6 100644
--- a/src/northbridge/intel/sandybridge/acpi/hostbridge.asl
+++ b/src/northbridge/intel/sandybridge/acpi/hostbridge.asl
@@ -101,8 +101,125 @@ Device (MCHC)
TLUD, 32,
}
-}
+ Name (CTCN, 0) /* CTDP Nominal Select */
+ Name (CTCD, 1) /* CTDP Down Select */
+ Name (CTCU, 2) /* CTDP Up Select */
+
+ OperationRegion (MCHB, SystemMemory, DEFAULT_MCHBAR, 0x8000)
+ Field (MCHB, DWordAcc, Lock, Preserve)
+ {
+ Offset (0x5930),
+ CTDN, 15, /* CTDP Nominal PL1 */
+ Offset (0x59a0),
+ PL1V, 15, /* Power Limit 1 Value */
+ PL1E, 1, /* Power Limit 1 Enable */
+ PL1C, 1, /* Power Limit 1 Clamp */
+ PL1T, 7, /* Power Limit 1 Time */
+ Offset (0x59a4),
+ PL2V, 15, /* Power Limit 2 Value */
+ PL2E, 1, /* Power Limit 2 Enable */
+ PL2C, 1, /* Power Limit 2 Clamp */
+ PL2T, 7, /* Power Limit 2 Time */
+ Offset (0x5f3c),
+ TARN, 8, /* CTDP Nominal Turbo Activation Ratio */
+ Offset (0x5f40),
+ CTDD, 15, /* CTDP Down PL1 */
+ , 1,
+ TARD, 8, /* CTDP Down Turbo Activation Ratio */
+ Offset (0x5f48),
+ CTDU, 15, /* CTDP Up PL1 */
+ , 1,
+ TARU, 8, /* CTDP Up Turbo Activation Ratio */
+ Offset (0x5f50),
+ CTCS, 2, /* CTDP Select */
+ Offset (0x5f54),
+ TARS, 8, /* Turbo Activation Ratio Select */
+ }
+
+ /*
+ * Search CPU0 _PSS looking for control=arg0 and then
+ * return previous P-state entry number for new _PPC
+ *
+ * Format of _PSS:
+ * Name (_PSS, Package () {
+ * Package (6) { freq, power, tlat, blat, control, status }
+ * }
+ */
+ External (\_PR.CPU0._PSS)
+ Method (PSSS, 1, NotSerialized)
+ {
+ Store (One, Local0) /* Start at P1 */
+ Store (SizeOf (\_PR.CPU0._PSS), Local1)
+
+ While (LLess (Local0, Local1)) {
+ /* Store _PSS entry Control value to Local2 */
+ ShiftRight (DeRefOf (Index (DeRefOf (Index
+ (\_PR.CPU0._PSS, Local0)), 4)), 8, Local2)
+ If (LEqual (Local2, Arg0)) {
+ Return (Subtract (Local0, 1))
+ }
+ Increment (Local0)
+ }
+
+ Return (0)
+ }
+
+ /* Set TDP Down */
+ Method (STND, 0, Serialized)
+ {
+ Store ("Set TDP Down", Debug)
+
+ If (LEqual (CTCD, CTCS)) {
+ Return (0)
+ }
+
+ /* Set CTC */
+ Store (CTCD, CTCS)
+
+ /* Set TAR */
+ Store (TARD, TARS)
+
+ /* Set PPC limit and notify OS */
+ Store (PSSS (TARD), PPCM)
+ PPCN ()
+
+ /* Set PL2 to 1.25 * PL1 */
+ Divide (Multiply (CTDD, 125), 100, Local0, PL2V)
+ /* Set PL1 */
+ Store (CTDD, PL1V)
+
+ Return (1)
+ }
+
+ /* Set TDP Nominal from Down */
+ Method (STDN, 0, Serialized)
+ {
+ Store ("Set TDP Nominal", Debug)
+
+ If (LEqual (CTCN, CTCS)) {
+ Return (0)
+ }
+
+ /* Set PL1 */
+ Store (CTDN, PL1V)
+
+ /* Set PL2 to 1.25 * PL1 */
+ Divide (Multiply (CTDN, 125), 100, Local0, PL2V)
+
+ /* Set PPC limit and notify OS */
+ Store (PSSS (TARN), PPCM)
+ PPCN ()
+
+ /* Set TAR */
+ Store (TARN, TARS)
+
+ /* Set CTC */
+ Store (CTCN, CTCS)
+
+ Return (1)
+ }
+}
// Current Resource Settings
diff --git a/src/northbridge/intel/sandybridge/acpi/sandybridge.asl b/src/northbridge/intel/sandybridge/acpi/sandybridge.asl
index 64b5d8f..6708e27 100644
--- a/src/northbridge/intel/sandybridge/acpi/sandybridge.asl
+++ b/src/northbridge/intel/sandybridge/acpi/sandybridge.asl
@@ -19,8 +19,8 @@
* MA 02110-1301 USA
*/
-#include "hostbridge.asl"
#include "../sandybridge.h"
+#include "hostbridge.asl"
/* PCI Device Resource Consumption */
Device (PDRC)
Stefan Reinauer (stefan.reinauer(a)coreboot.org) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/1341
-gerrit
commit 1eb5629e24af2b52941848d57ae251565b5dc207
Author: Duncan Laurie <dlaurie(a)chromium.org>
Date: Mon Jul 16 12:11:53 2012 -0700
ACPI: Add function to write _PPC using NVS
The existing NVS variable for PPCM will be used to
select a dynamic max P-state.
By itself this does not change existing behavior because
the NVS PPCM variable is initialized to zero.
PPCM can be tested by building and booting a modified BIOS
that sets gnvs->ppcm to a value greater than 1 and checking
from the OS that the P-state is limited to that value.
Change-Id: Ia7b3bbc6b84c1aa42349bb236abee5cc92486561
Signed-off-by: Duncan Laurie <dlaurie(a)chromium.org>
---
src/arch/x86/boot/acpigen.c | 26 ++++++++++++++++++++++++++
src/arch/x86/include/arch/acpigen.h | 1 +
src/cpu/intel/model_206ax/acpi.c | 2 +-
3 files changed, 28 insertions(+), 1 deletions(-)
diff --git a/src/arch/x86/boot/acpigen.c b/src/arch/x86/boot/acpigen.c
index 71aa10c..47845a0 100644
--- a/src/arch/x86/boot/acpigen.c
+++ b/src/arch/x86/boot/acpigen.c
@@ -396,6 +396,32 @@ int acpigen_write_PPC(u8 nr)
return len;
}
+/* generates a func with max supported P states */
+int acpigen_write_PPC_NVS(void)
+{
+/*
+ Method (_PPC, 0, NotSerialized)
+ {
+ Return (PPCM)
+ }
+*/
+ int len;
+ /* method op */
+ acpigen_emit_byte(0x14);
+ len = acpigen_write_len_f();
+ len += acpigen_emit_namestring("_PPC");
+ /* no fnarg */
+ acpigen_emit_byte(0x00);
+ /* return */
+ acpigen_emit_byte(0xa4);
+ /* arg */
+ len += acpigen_emit_namestring("PPCM");
+ /* add all single bytes */
+ len += 3;
+ acpigen_patch_len(len - 1);
+ return len;
+}
+
int acpigen_write_TPC(const char *gnvs_tpc_limit)
{
/*
diff --git a/src/arch/x86/include/arch/acpigen.h b/src/arch/x86/include/arch/acpigen.h
index aebf508..5297aff 100644
--- a/src/arch/x86/include/arch/acpigen.h
+++ b/src/arch/x86/include/arch/acpigen.h
@@ -42,6 +42,7 @@ int acpigen_write_name_qword(const char *name, uint64_t val);
int acpigen_write_name_byte(const char *name, uint8_t val);
int acpigen_write_scope(const char *name);
int acpigen_write_PPC(u8 nr);
+int acpigen_write_PPC_NVS(void);
int acpigen_write_empty_PCT(void);
int acpigen_write_empty_PTC(void);
int acpigen_write_TPC(const char *gnvs_tpc_limit);
diff --git a/src/cpu/intel/model_206ax/acpi.c b/src/cpu/intel/model_206ax/acpi.c
index 9784c47..f66df51 100644
--- a/src/cpu/intel/model_206ax/acpi.c
+++ b/src/cpu/intel/model_206ax/acpi.c
@@ -251,7 +251,7 @@ static int generate_P_state_entries(int core, int cores_per_package)
len = acpigen_write_empty_PCT();
/* Write _PPC with no limit on supported P-state */
- len += acpigen_write_PPC(0);
+ len += acpigen_write_PPC_NVS();
/* Write PSD indicating configured coordination type */
len += acpigen_write_PSD_package(core, cores_per_package, coord_type);