coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
devtree.c
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 
3 #include <chip.h>
4 #include <cpu/intel/turbo.h>
5 #include <device/device.h>
6 #include <device/pci_def.h>
7 #include <option.h>
8 #include <types.h>
9 #include <variants.h>
10 
11 void devtree_update(void)
12 {
13  config_t *cfg = config_of_soc();
14 
15  struct soc_power_limits_config *soc_conf = &cfg->power_limits_config;
16 
17  struct device *nic_dev = pcidev_on_root(0x14, 3);
18 
19  /* Update PL1 & PL2 based on CMOS settings */
20  switch (get_uint_option("power_profile", 0)) {
21  case 1:
22  soc_conf->tdp_pl1_override = 17;
23  soc_conf->tdp_pl2_override = 20;
24  break;
25  case 2:
26  soc_conf->tdp_pl1_override = 20;
27  soc_conf->tdp_pl2_override = 25;
28  break;
29  default:
30  disable_turbo();
31  soc_conf->tdp_pl1_override = 15;
32  soc_conf->tdp_pl2_override = 15;
33  break;
34  }
35 
36  /* Enable/Disable Wireless based on CMOS settings */
37  if (get_uint_option("wireless", 1) == 0)
38  nic_dev->enabled = 0;
39 
40  /* Enable/Disable Webcam based on CMOS settings */
41  if (get_uint_option("webcam", 1) == 0)
42  cfg->usb2_ports[3].enable = 0;
43 }
DEVTREE_CONST struct device * pcidev_on_root(uint8_t dev, uint8_t fn)
Definition: device_const.c:260
#define config_of_soc()
Definition: device.h:394
void devtree_update(void)
Definition: devtree.c:11
unsigned int get_uint_option(const char *name, const unsigned int fallback)
Definition: option.c:116
Definition: device.h:107
unsigned int enabled
Definition: device.h:122
void disable_turbo(void)
Definition: turbo.c:108