blob: b6422f53a8bb40cb2e64cd6f765347ae4e595731 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
|
/* SPDX-License-Identifier: GPL-2.0-only */
#include <chip.h>
#include <cpu/intel/turbo.h>
#include <device/device.h>
#include <device/pci_def.h>
#include <option.h>
#include <static.h>
#include <types.h>
#include <variants.h>
void devtree_update(void)
{
config_t *cfg = config_of_soc();
struct soc_power_limits_config *soc_conf_2core =
&cfg->power_limits_config[POWER_LIMITS_U_2_CORE];
struct soc_power_limits_config *soc_conf_4core =
&cfg->power_limits_config[POWER_LIMITS_U_4_CORE];
struct device *nic_dev = pcidev_on_root(0x14, 3);
struct device *tbt_pci_dev = pcidev_on_root(0x07, 0);
struct device *tbt_dma_dev = pcidev_on_root(0x0d, 2);
uint8_t performance_scale = 100;
/* Update PL1 & PL2 based on CMOS settings */
switch (get_power_profile(PP_POWER_SAVER)) {
case PP_POWER_SAVER:
performance_scale -= 25;
cfg->tcc_offset = 30;
break;
case PP_BALANCED:
/* Use the Intel defaults */
cfg->tcc_offset = 25;
break;
case PP_PERFORMANCE:
performance_scale += 25;
cfg->tcc_offset = 20;
break;
}
soc_conf_2core->tdp_pl1_override = (soc_conf_2core->tdp_pl1_override * performance_scale) / 100;
soc_conf_4core->tdp_pl1_override = (soc_conf_4core->tdp_pl2_override * performance_scale) / 100;
soc_conf_2core->tdp_pl2_override = (soc_conf_2core->tdp_pl1_override * performance_scale) / 100;
soc_conf_4core->tdp_pl2_override = (soc_conf_4core->tdp_pl2_override * performance_scale) / 100;
/* Set PL4 to 1.0C */
soc_conf_2core->tdp_pl4 = 65;
soc_conf_4core->tdp_pl4 = 65;
/* Enable/Disable Wireless based on CMOS settings */
if (get_uint_option("wireless", 1) == 0)
nic_dev->enabled = 0;
/* Enable/Disable Webcam based on CMOS settings */
cfg->usb2_ports[CONFIG_CCD_PORT].enable = get_uint_option("webcam", 1);
/* Enable/Disable Card Reader based on CMOS Settings */
if (get_uint_option("card_reader", 1) == 0)
cfg->usb2_ports[5].enable = 0;
/* Enable/Disable Thunderbolt based on CMOS settings */
if (get_uint_option("thunderbolt", 1) == 0) {
cfg->UsbTcPortEn = 0;
cfg->TcssXhciEn = 0;
tbt_pci_dev->enabled = 0;
tbt_dma_dev->enabled = 0;
}
}
|