coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
pmc.c
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 
3 #include <stdint.h>
4 #include <device/pci_ops.h>
5 #include <console/console.h>
6 #include <device/device.h>
7 #include <device/pci_def.h>
8 #include <soc/iomap.h>
9 #include <soc/iosf.h>
10 #include <soc/lpc.h>
11 #include <soc/pci_devs.h>
12 #include <soc/pm.h>
13 #include <soc/romstage.h>
14 #include "../chip.h"
15 
16 /* This sequence signals the PUNIT to start running. */
17 void punit_init(void)
18 {
19  uint32_t reg;
20  uint8_t rid;
21  const struct soc_intel_baytrail_config *cfg = NULL;
22 
24 
25  cfg = config_of_soc();
26 
28  /* Write bits 17:16 of SB_BIOS_CONFIG in the PUNIT. */
30  /* Configure VR low power mode for C0 and above. */
31  if (rid >= RID_C_STEPPING_START && cfg != NULL &&
32  (cfg->vnn_ps2_enable || cfg->vcc_ps2_enable)) {
33  printk(BIOS_DEBUG, "Enabling VR PS2 mode:");
34  if (cfg->vnn_ps2_enable) {
36  printk(BIOS_DEBUG, " VNN");
37  }
38  if (cfg->vcc_ps2_enable) {
40  printk(BIOS_DEBUG, " VCC");
41  }
42  printk(BIOS_DEBUG, "\n");
43  }
45 
46  /* Write bits 1:0 of BIOS_RESET_CPL in the PUNIT. */
52 }
#define IOSF_REG(x)
Definition: iosf.h:23
#define SB_BIOS_CONFIG_PS2_EN_VCC
Definition: iosf.h:230
#define BIOS_RESET_CPL_ALL_DONE
Definition: iosf.h:234
#define IOSF_PORT_PMC
Definition: iosf.h:93
#define BIOS_RESET_CPL_RESET_DONE
Definition: iosf.h:235
#define IOSF_PORT(x)
Definition: iosf.h:22
#define SB_BIOS_CONFIG_PS2_EN_VNN
Definition: iosf.h:229
#define IOSF_OPCODE(x)
Definition: iosf.h:21
void iosf_punit_write(int reg, uint32_t val)
Definition: iosf.c:86
uint32_t iosf_punit_read(int reg)
Definition: iosf.c:81
#define SB_BIOS_CONFIG
Definition: iosf.h:220
#define IOSF_BYTE_EN_0
Definition: iosf.h:26
#define IOSF_PCI_DEV
Definition: iosf.h:19
#define MDR_REG
Definition: iosf.h:34
#define SB_BIOS_CONFIG_PERF_MODE
Definition: iosf.h:225
#define MCR_REG
Definition: iosf.h:33
#define IOSF_OP_WRITE_PMC
Definition: iosf.h:130
#define SB_BIOS_CONFIG_PDM_MODE
Definition: iosf.h:226
void punit_init(void)
Definition: pmc.c:17
#define printk(level,...)
Definition: stdlib.h:16
#define BIOS_RESET_CPL
Definition: mchbar.h:62
#define config_of_soc()
Definition: device.h:394
static __always_inline void pci_write_config32(const struct device *dev, u16 reg, u32 val)
Definition: pci_ops.h:76
static __always_inline u8 pci_read_config8(const struct device *dev, u16 reg)
Definition: pci_ops.h:46
#define BIOS_DEBUG
BIOS_DEBUG - Verbose output.
Definition: loglevel.h:128
#define REVID
Definition: lpc.h:7
#define RID_C_STEPPING_START
Definition: lpc.h:21
#define NULL
Definition: stddef.h:19
unsigned int uint32_t
Definition: stdint.h:14
unsigned char uint8_t
Definition: stdint.h:8