coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
pch.c
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 
3 #include <device/pci_ops.h>
4 #include <soc/pci_devs.h>
5 #include <soc/pcr_ids.h>
6 #include <intelblocks/pcr.h>
7 #include <intelblocks/rtc.h>
8 #include <intelblocks/p2sb.h>
9 #include <soc/bootblock.h>
10 #include <soc/pch.h>
11 #include <soc/pmc.h>
12 #include <console/console.h>
13 
14 #define PCR_DMI_ACPIBA 0x27B4
15 #define PCR_DMI_ACPIBDID 0x27B8
16 #define PCR_DMI_DMICTL 0x2234
17 #define PCR_DMI_DMICTL_SRLOCK (1 << 31)
18 #define PCR_DMI_PMBASEA 0x27AC
19 #define PCR_DMI_PMBASEC 0x27B0
20 
21 static void soc_config_acpibase(void)
22 {
23  uint32_t reg32;
24 
25  /* Disable ABASE in PMC Device first before changing Base Address */
28 
29  /* Program ACPI Base */
31 
32  /* Enable ACPI in PMC */
34 
36  printk(BIOS_INFO, "%s : pmbase = %x\n", __func__, (int)data);
37  /*
38  * Program "ACPI Base Address" PCR[DMI] + 27B4h[23:18, 15:2, 0]
39  * to [0x3F, PMC PCI Offset 40h bit[15:2], 1]
40  */
41  reg32 = (0x3f << 18) | ACPI_BASE_ADDRESS | 1;
44 }
45 
47 {
48  /*
49  * Enabling ABASE for accessing PM1_STS, PM1_EN, PM1_CNT
50  */
52 }
53 
55 {
56  union p2sb_bdf ioapic_bdf = {
58  .dev = PCH_IOAPIC_DEV_NUM,
59  .fn = PCH_IOAPIC_FUNC_NUM,
60  };
61  union p2sb_bdf hpet_bdf = {
62  .bus = HPET_BUS_NUM,
63  .dev = HPET_DEV_NUM,
64  .fn = HPET0_FUNC_NUM,
65  };
66 
67  p2sb_set_ioapic_bdf(ioapic_bdf);
68  p2sb_set_hpet_bdf(hpet_bdf);
69 }
70 
71 void pch_lock_dmictl(void)
72 {
75 }
#define PID_DMI
Definition: pcr_ids.h:23
void p2sb_set_ioapic_bdf(union p2sb_bdf bdf)
Definition: p2sb.c:73
void p2sb_set_hpet_bdf(union p2sb_bdf bdf)
Definition: p2sb.c:54
void pcr_write32(uint8_t pid, uint16_t offset, uint32_t indata)
Definition: pcr.c:124
uint32_t pcr_read32(uint8_t pid, uint16_t offset)
Definition: pcr.c:89
#define printk(level,...)
Definition: stdlib.h:16
static __always_inline void pci_write_config32(const struct device *dev, u16 reg, u32 val)
Definition: pci_ops.h:76
static __always_inline u32 pci_read_config32(const struct device *dev, u16 reg)
Definition: pci_ops.h:58
#define ACPI_BASE_ADDRESS
Definition: iomap.h:99
#define ACPI_EN
Definition: pmc.h:146
#define ABASE
Definition: pmc.h:11
#define ACTL
Definition: pmc.h:144
#define BIOS_INFO
BIOS_INFO - Expected events.
Definition: loglevel.h:113
#define HPET_DEV_NUM
Definition: pch_pci_devs.h:28
#define PCH_IOAPIC_DEV_NUM
Definition: pch_pci_devs.h:58
#define HPET0_FUNC_NUM
Definition: pch_pci_devs.h:29
#define PCH_IOAPIC_FUNC_NUM
Definition: pch_pci_devs.h:59
#define HPET_BUS_NUM
Definition: pch_pci_devs.h:27
#define PCH_IOAPIC_BUS_NUMBER
Definition: pch_pci_devs.h:57
void bootblock_pch_init(void)
Definition: pch.c:114
#define PCH_DEV_PMC
Definition: pci_devs.h:236
#define PCR_DMI_DMICTL
Definition: pch.c:16
void pch_lock_dmictl(void)
Definition: pch.c:71
#define PCR_DMI_ACPIBDID
Definition: pch.c:15
#define PCR_DMI_ACPIBA
Definition: pch.c:14
void override_hpet_ioapic_bdf(void)
Definition: pch.c:54
static void soc_config_acpibase(void)
Definition: pch.c:21
#define PCR_DMI_DMICTL_SRLOCK
Definition: pch.c:17
unsigned int uint32_t
Definition: stdint.h:14
Definition: p2sb.h:40
uint16_t bus
Definition: p2sb.h:44