coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
thermal_pmc.c
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 
3 #include <device/mmio.h>
4 #include <intelblocks/pmclib.h>
5 #include <intelblocks/thermal.h>
6 
7 /*
8  * Thermal configuration has evolved over time. With older platform the
9  * thermal device is sitting over PCI and allow to configure its configuration
10  * register by accessing the PCI configuration space or MMIO space.
11  *
12  * Since Tiger Lake, thermal registers are being moved behind the PMC PCI device
13  * hence, accessing thermal configuration registers would need making access
14  * to PWRMBASE. In this case SoC Kconfig to select
15  * SOC_INTEL_COMMON_BLOCK_THERMAL_BEHIND_PMC to allow thermal configuration.
16  */
18 {
19  uintptr_t pmc_bar = soc_read_pmc_base();
20 
21  struct pmc_thermal_config {
23  uint32_t mask;
25  } config[] = {
26  {
27  .offset = PMC_PWRM_THERMAL_CTEN,
29  },
30  {
31  .offset = PMC_PWRM_THERMAL_ECRPTEN,
34  },
35  {
36  .offset = PMC_PWRM_THERMAL_TL,
37  .mask = ~0,
40  },
41  {
42  .offset = PMC_PWRM_THERMAL_PHLC,
44  },
45  {
46  .offset = PMC_PWRM_THERMAL_TLEN,
48  },
49  };
50 
51  for (int i = 0; i < ARRAY_SIZE(config); i++)
52  clrsetbits32((void *)(pmc_bar + config[i].offset), config[i].mask,
53  config[i].value);
54 }
pte_t value
Definition: mmu.c:91
#define ARRAY_SIZE(a)
Definition: helpers.h:12
static size_t offset
Definition: flashconsole.c:16
#define clrsetbits32(addr, clear, set)
Definition: mmio.h:16
enum board_config config
Definition: memory.c:448
uintptr_t soc_read_pmc_base(void)
Definition: pmutil.c:147
static const int mask[4]
Definition: gpio.c:308
#define PMC_PWRM_THERMAL_TL_TLLOCK
Definition: thermal.h:40
#define PMC_PWRM_THERMAL_CTEN_CPDEN
Definition: thermal.h:30
#define PMC_PWRM_THERMAL_ECRPTEN_EN_RPT
Definition: thermal.h:36
#define PMC_PWRM_THERMAL_TL
Definition: thermal.h:38
#define PMC_PWRM_THERMAL_TLEN_TLENLOCK
Definition: thermal.h:46
#define PMC_PWRM_THERMAL_PHLC_PHLCLOCK
Definition: thermal.h:50
#define PMC_PWRM_THERMAL_TL_TTEN
Definition: thermal.h:42
#define PMC_PWRM_THERMAL_CTEN_CTENLOCK
Definition: thermal.h:28
#define PMC_PWRM_THERMAL_ECRPTEN
Definition: thermal.h:32
uint32_t pch_get_ltt_value(void)
#define PMC_PWRM_THERMAL_ECRPTEN_ECRPTENLOCK
Definition: thermal.h:34
#define PMC_PWRM_THERMAL_CTEN
Definition: thermal.h:26
#define PMC_PWRM_THERMAL_TLEN
Definition: thermal.h:44
#define PMC_PWRM_THERMAL_PHLC
Definition: thermal.h:48
unsigned short uint16_t
Definition: stdint.h:11
unsigned int uint32_t
Definition: stdint.h:14
unsigned long uintptr_t
Definition: stdint.h:21
void pch_thermal_configuration(void)
Definition: thermal_pmc.c:17