coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
romstage.c
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 
3 #include <console/console.h>
5 #include <cpu/x86/msr.h>
6 
7 void set_max_freq(void)
8 {
9  msr_t msr, perf_ctl, platform_info;
10 
11  /* Check for configurable TDP option */
12  platform_info = rdmsr(MSR_PLATFORM_INFO);
13 
14  if ((platform_info.hi >> 1) & 3) {
15  /* Set to nominal TDP ratio */
17  perf_ctl.lo = (msr.lo & 0xff) << 8;
18  } else {
19  /* Platform Info bits 15:8 give max ratio */
20  msr = rdmsr(MSR_PLATFORM_INFO);
21  perf_ctl.lo = msr.lo & 0xff00;
22  }
23 
24  perf_ctl.hi = 0;
25  wrmsr(IA32_PERF_CTL, perf_ctl);
26 
27  printk(BIOS_DEBUG, "CPU: frequency set to %d MHz\n",
28  ((perf_ctl.lo >> 8) & 0xff) * CPU_BCLK);
29 }
#define printk(level,...)
Definition: stdlib.h:16
#define MSR_CONFIG_TDP_NOMINAL
Definition: haswell.h:95
#define CPU_BCLK
Definition: haswell.h:35
void set_max_freq(void)
Definition: romstage.c:7
#define MSR_PLATFORM_INFO
Definition: fsb.c:16
static __always_inline msr_t rdmsr(unsigned int index)
Definition: msr.h:146
#define IA32_PERF_CTL
Definition: msr.h:43
static __always_inline void wrmsr(unsigned int index, msr_t msr)
Definition: msr.h:157
#define BIOS_DEBUG
BIOS_DEBUG - Verbose output.
Definition: loglevel.h:128
unsigned int hi
Definition: msr.h:112
unsigned int lo
Definition: msr.h:111