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 <acpi/acpi.h>
4 #include <device/pci_ops.h>
5 #include <console/console.h>
6 #include <cpu/x86/smm.h>
7 #include <device/device.h>
8 #include <device/mmio.h>
9 #include <device/pci.h>
10 #include <device/pci_ids.h>
11 #include <intelblocks/pmc.h>
12 #include <soc/iomap.h>
13 #include <soc/pm.h>
14 #include <soc/pmc.h>
15 #include <soc/pci_devs.h>
16 #include <soc/ramstage.h>
17 
18 static void pch_power_options(struct device *dev) { /* TODO */ }
19 
20 /* Fill up PMC resource structure */
22 {
29 
30  return 0;
31 }
32 
33 static void pch_set_acpi_mode(void)
34 {
35  if (!acpi_is_wakeup_s3()) {
37  }
38 }
39 
40 void pmc_soc_init(struct device *dev)
41 {
43 
44  printk(BIOS_DEBUG, "pch: %s\n", __func__);
45 
46  /* Set the value for PCI command register. */
50 
51  /* Setup power options. */
52  pch_power_options(dev);
53 
54  /* Configure ACPI mode. */
56 
57  /*
58  * Disable ACPI PM timer based on Kconfig
59  *
60  * Disabling ACPI PM timer is necessary for XTAL OSC shutdown.
61  * Disabling ACPI PM timer also switches off TCO.
62  */
63  if (!CONFIG(USE_PM_ACPI_TIMER))
64  setbits8((volatile void *)(uintptr_t)(pwrm_base + PCH_PWRM_ACPI_TMR_CTL),
65  ACPI_TIM_DIS);
66 }
int pmc_soc_get_resources(struct pmc_resource_config *cfg)
Definition: pmc.c:15
void pmc_soc_init(struct device *dev)
Definition: pmc.c:80
static int acpi_is_wakeup_s3(void)
Definition: acpi.h:9
#define printk(level,...)
Definition: stdlib.h:16
static void pch_power_options(struct device *dev)
Definition: pmc.c:18
static void pch_set_acpi_mode(void)
Definition: pmc.c:33
@ CONFIG
Definition: dsi_common.h:201
#define APM_CNT_ACPI_DISABLE
Definition: smm.h:21
#define setbits8(addr, set)
Definition: mmio.h:19
static __always_inline u32 pci_read_config32(const struct device *dev, u16 reg)
Definition: pci_ops.h:58
static __always_inline void pci_write_config16(const struct device *dev, u16 reg, u16 val)
Definition: pci_ops.h:70
#define ACPI_TIM_DIS
Definition: pmc.h:108
#define PCH_PWRM_ACPI_TMR_CTL
Definition: pmc.h:107
#define DEFAULT_PWRM_SIZE
Definition: iomap.h:22
#define DEFAULT_PMBASE_SIZE
Definition: iomap.h:15
#define DEFAULT_PWRM_BASE
Definition: iomap.h:21
#define DEFAULT_PMBASE
Definition: iomap.h:14
#define MASK_PMC_PWRM_BASE
Definition: pmc.h:34
#define PMC_PWRM_BASE
Definition: pmc.h:33
#define PMC_ACPI_BASE
Definition: pmc.h:7
#define BIOS_DEBUG
BIOS_DEBUG - Verbose output.
Definition: loglevel.h:128
#define PCI_COMMAND_IO
Definition: pci_def.h:11
#define PCI_COMMAND_MASTER
Definition: pci_def.h:13
#define PCI_COMMAND_MEMORY
Definition: pci_def.h:12
#define PCI_COMMAND
Definition: pci_def.h:10
int apm_control(u8 cmd)
Definition: smi_trigger.c:31
unsigned int uint32_t
Definition: stdint.h:14
unsigned long uintptr_t
Definition: stdint.h:21
Definition: device.h:107
uint8_t abase_offset
Definition: pmc.h:18
size_t abase_size
Definition: pmc.h:22
uintptr_t pwrmbase_addr
Definition: pmc.h:14
uintptr_t abase_addr
Definition: pmc.h:20
size_t pwrmbase_size
Definition: pmc.h:16
uint8_t pwrmbase_offset
Definition: pmc.h:12