aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/platform
diff options
context:
space:
mode:
authorJesse Barnes <jbarnes@virtuousgeek.org>2010-09-23 17:49:29 -0400
committerMatthew Garrett <mjg@redhat.com>2010-10-05 14:59:14 -0400
commiteceab272fb895148f6293b5c0644fc2dd36d3aff (patch)
tree45150765669f0230cac28904c126d4c891ddd190 /drivers/platform
parent354aeeb1ca8f82ea133ede21987034addc75057a (diff)
IPS driver: verify BIOS provided limits
They're optional. If not present or sane, we should use the CPU defaults. Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org> Signed-off-by: Matthew Garrett <mjg@redhat.com>
Diffstat (limited to 'drivers/platform')
-rw-r--r--drivers/platform/x86/intel_ips.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/drivers/platform/x86/intel_ips.c b/drivers/platform/x86/intel_ips.c
index 71d04ef47b8..c402cc41710 100644
--- a/drivers/platform/x86/intel_ips.c
+++ b/drivers/platform/x86/intel_ips.c
@@ -665,6 +665,27 @@ static bool mch_exceeded(struct ips_driver *ips)
665} 665}
666 666
667/** 667/**
668 * verify_limits - verify BIOS provided limits
669 * @ips: IPS structure
670 *
671 * BIOS can optionally provide non-default limits for power and temp. Check
672 * them here and use the defaults if the BIOS values are not provided or
673 * are otherwise unusable.
674 */
675static void verify_limits(struct ips_driver *ips)
676{
677 if (ips->mcp_power_limit < ips->limits->mcp_power_limit ||
678 ips->mcp_power_limit > 35000)
679 ips->mcp_power_limit = ips->limits->mcp_power_limit;
680
681 if (ips->mcp_temp_limit < ips->limits->core_temp_limit ||
682 ips->mcp_temp_limit < ips->limits->mch_temp_limit ||
683 ips->mcp_temp_limit > 150)
684 ips->mcp_temp_limit = min(ips->limits->core_temp_limit,
685 ips->limits->mch_temp_limit);
686}
687
688/**
668 * update_turbo_limits - get various limits & settings from regs 689 * update_turbo_limits - get various limits & settings from regs
669 * @ips: IPS driver struct 690 * @ips: IPS driver struct
670 * 691 *
@@ -688,6 +709,7 @@ static void update_turbo_limits(struct ips_driver *ips)
688 ips->mcp_temp_limit = thm_readw(THM_PTL); 709 ips->mcp_temp_limit = thm_readw(THM_PTL);
689 ips->mcp_power_limit = thm_readw(THM_MPPC); 710 ips->mcp_power_limit = thm_readw(THM_MPPC);
690 711
712 verify_limits(ips);
691 /* Ignore BIOS CPU vs GPU pref */ 713 /* Ignore BIOS CPU vs GPU pref */
692} 714}
693 715
@@ -1156,6 +1178,7 @@ static irqreturn_t ips_irq_handler(int irq, void *arg)
1156 STS_PTL_SHIFT; 1178 STS_PTL_SHIFT;
1157 ips->mcp_power_limit = (tc1 & STS_PPL_MASK) >> 1179 ips->mcp_power_limit = (tc1 & STS_PPL_MASK) >>
1158 STS_PPL_SHIFT; 1180 STS_PPL_SHIFT;
1181 verify_limits(ips);
1159 spin_unlock(&ips->turbo_status_lock); 1182 spin_unlock(&ips->turbo_status_lock);
1160 1183
1161 thm_writeb(THM_SEC, SEC_ACK); 1184 thm_writeb(THM_SEC, SEC_ACK);