coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
pci_devs.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 
3 #ifndef _SOC_PCI_DEVS_H_
4 #define _SOC_PCI_DEVS_H_
5 
6 #include <console/console.h>
7 #include <device/device.h>
8 #include <device/pci_def.h>
9 #include <hob_iiouds.h>
10 #include <soc/pch_pci_devs.h>
11 
12 #define dump_csr(fmt, dev, reg) \
13  printk(BIOS_SPEW, "%s%x:%x:%x reg: %s (0x%x), data: 0x%x\n", \
14  fmt, ((uint32_t)dev >> 20) & 0xfff, ((uint32_t)dev >> 15) & 0x1f, \
15  ((uint32_t)dev >> 12) & 0x07, \
16  #reg, reg, pci_s_read_config32(dev, reg))
17 
18 #define dump_csr64(fmt, dev, reg) \
19  printk(BIOS_SPEW, "%s%x:%x:%x reg: %s (0x%x), data: 0x%x%x\n", \
20  fmt, ((uint32_t)dev >> 20) & 0xfff, ((uint32_t)dev >> 15) & 0x1f, \
21  ((uint32_t)dev >> 12) & 0x07, #reg, reg, \
22  pci_s_read_config32(dev, reg+4), pci_s_read_config32(dev, reg))
23 
24 #define SAD_ALL_DEV 29
25 #define SAD_ALL_FUNC 0
26 #define SAD_ALL_PAM0123_CSR 0x40
27 #define PAM_LOCK BIT(0)
28 #define SAD_ALL_PAM456_CSR 0x44
29 
30 #if !defined(__SIMPLE_DEVICE__)
31 #define _PCU_DEV(bus, func) pcidev_path_on_bus(bus, PCI_DEVFN(PCU_DEV, func))
32 #else
33 #define _PCU_DEV(bus, func) PCI_DEV(bus, PCU_DEV, func)
34 #endif
35 
36 #define PCU_IIO_STACK 1
37 #define PCU_DEV 30
38 #define PCU_CR1_FUN 1
39 
40 #define PCU_CR0_FUN 0
41 #define PCU_DEV_CR0(bus) _PCU_DEV(bus, PCU_CR0_FUN)
42 #define PCU_CR0_PLATFORM_INFO 0xa8
43 #define PCU_CR0_P_STATE_LIMITS 0xd8
44 #define P_STATE_LIMITS_LOCK_SHIFT 31
45 #define P_STATE_LIMITS_LOCK (1 << P_STATE_LIMITS_LOCK_SHIFT)
46 #define PCU_CR0_TEMPERATURE_TARGET 0xe4
47 #define PCU_CR0_PACKAGE_RAPL_LIMIT 0xe8
48 #define PCU_CR0_CURRENT_CONFIG 0xf8
49 #define MAX_NON_TURBO_LIM_RATIO_SHIFT 8 /* 8:15 */
50 #define MAX_NON_TURBO_LIM_RATIO_MASK (0xff << MAX_NON_TURBO_LIM_RATIO_SHIFT)
51 #define PCU_CR0_PMAX 0xf0
52 #define PMAX_LOCK BIT(31)
53 
54 #define PCU_CR1_BIOS_MB_DATA_REG 0x8c
55 
56 #define PCU_CR1_BIOS_MB_INTERFACE_REG 0x90
57 #define BIOS_MB_RUN_BUSY_MASK BIT(31)
58 #define BIOS_MB_CMD_MASK 0xff
59 #define BIOS_CMD_READ_PCU_MISC_CFG 0x5
60 #define BIOS_CMD_WRITE_PCU_MISC_CFG 0x6
61 #define BIOS_ERR_INVALID_CMD 0x01
62 
63 #define PCU_CR1_BIOS_RESET_CPL_REG 0x94
64 #define RST_CPL1_MASK BIT(1)
65 #define RST_CPL2_MASK BIT(2)
66 #define RST_CPL3_MASK BIT(3)
67 #define RST_CPL4_MASK BIT(4)
68 #define PCODE_INIT_DONE1_MASK BIT(9)
69 #define PCODE_INIT_DONE2_MASK BIT(10)
70 #define PCODE_INIT_DONE3_MASK BIT(11)
71 #define PCODE_INIT_DONE4_MASK BIT(12)
72 
73 #define PCU_CR1_DESIRED_CORES_CFG2_REG 0xa0
74 #define PCU_CR1_DESIRED_CORES_CFG2_REG_LOCK_MASK BIT(31)
75 
76 #if !defined(__SIMPLE_DEVICE__)
77 #define _UBOX_DEV(func) pcidev_path_on_root_debug(PCI_DEVFN(UBOX_DEV, func), __func__)
78 #else
79 #define _UBOX_DEV(func) PCI_DEV(0, UBOX_DEV, func)
80 #endif
81 
82 #define UBOX_DEV 8
83 
84 #define UBOX_PMON_BUS 0
85 #define UBOX_PMON_DEV 8
86 #define UBOX_PMON_FUNC 1
87 #define UBOX_DEV_PMON _UBOX_DEV(UBOX_PMON_FUNC)
88 #define SMM_FEATURE_CONTROL 0x7c
89 #define SMM_CODE_CHK_EN BIT(2)
90 #define SMM_FEATURE_CONTROL_LOCK BIT(0)
91 
92 #define UBOX_DECS_BUS 0
93 #define UBOX_DECS_DEV 8
94 #define UBOX_DECS_FUNC 2
95 #define UBOX_DECS_CPUBUSNO_CSR 0xcc
96 #define UBOX_DECS_CPUBUSNO1_CSR 0xd0
97 
98 #define VTD_TOLM_CSR 0xd0
99 #define VTD_TSEG_BASE_CSR 0xa8
100 #define VTD_TSEG_LIMIT_CSR 0xac
101 #define VTD_EXT_CAP_LOW 0x10
102 #define VTD_MMCFG_BASE_CSR 0x90
103 #define VTD_MMCFG_LIMIT_CSR 0x98
104 #define VTD_TOHM_CSR 0xd4
105 #define VTD_MMIOL_CSR 0xdc
106 #define VTD_ME_BASE_CSR 0xf0
107 #define VTD_ME_LIMIT_CSR 0xf8
108 #define VTD_VERSION 0x00
109 #define VTD_CAP 0x08
110 #define VTD_CAP_LOW 0x08
111 #define VTD_CAP_HIGH 0x0C
112 #define VTD_EXT_CAP_HIGH 0x14
113 #define VTD_LTDPR 0x290
114 
115 #define PCU_CR1_C2C3TT_REG 0xdc
116 #define PCU_CR1_PCIE_ILTR_OVRD 0xfc
117 #define PCU_CR1_SAPMCTL 0xb0
118 #define SAPMCTL_LOCK_SHIFT 31
119 #define SAPMCTL_LOCK_MASK (1 << SAPMCTL_LOCK_SHIFT)
120 #define PCU_CR1_MC_BIOS_REQ 0x98
121 
122 #define PCU_CR2_FUN 2
123 #define PCU_CR2_PKG_CST_ENTRY_CRITERIA_MASK 0x8c
124 #define PCIE_IN_PKGCSTATE_L1_MASK 0xFFFFFF /* 23:0 bits */
125 #define PCU_CR2_PKG_CST_ENTRY_CRITERIA_MASK2 0x90
126 #define KTI_IN_PKGCSTATE_L1_MASK 0x7 /* 2:0 bits */
127 #define PCU_CR2_DYNAMIC_PERF_POWER_CTL 0xdc
128 #define UNCORE_PLIMIT_OVERRIDE_BIT 20
129 #define UNOCRE_PLIMIT_OVERRIDE_SHIFT (1 << UNCORE_PLIMIT_OVERRIDE_BIT)
130 #define PCU_CR2_PROCHOT_RESPONSE_RATIO_REG 0xb0
131 #define PROCHOT_RATIO 0xa /* bits 0:7 */
132 
133 #define CHA_UTIL_ALL_DEV 29
134 #define CHA_UTIL_ALL_FUNC 1
135 #define CHA_UTIL_ALL_MMCFG_CSR 0xc0
136 
137 #define MMAP_VTD_CFG_REG_DEVID 0x2024
138 #define MMAP_VTD_STACK_CFG_REG_DEVID 0x2034
139 #define VTD_DEV_NUM 0x5
140 #define VTD_FUNC_NUM 0x0
141 
142 #if !defined(__SIMPLE_DEVICE__)
143 #define VTD_DEV(bus) pcidev_path_on_bus((bus), PCI_DEVFN(VTD_DEV_NUM, VTD_FUNC_NUM))
144 #else
145 #define VTD_DEV(bus) PCI_DEV((bus), VTD_DEV_NUM, VTD_FUNC_NUM)
146 #endif
147 
148 #define CBDMA_DEV_NUM 0x04
149 #define IIO_CBDMA_MMIO_SIZE 0x10000 //64kB for one CBDMA function
150 #define IIO_CBDMA_MMIO_ALIGNMENT 14 //2^14 - 16kB
151 
152 #define VMD_DEV_NUM 0x05
153 #define VMD_FUNC_NUM 0x05
154 
155 #define APIC_DEV_NUM 0x05
156 #define APIC_FUNC_NUM 0x00
157 
158 // DMI3 B0D0F0 registers
159 #define DMI3_DEVID 0x2020
160 #define DMIRCBAR 0x50
161 #define ERRINJCON 0x1d8
162 
163 // IIO DFX Global D7F7 registers
164 #define IIO_DFX_TSWCTL0 0x30c
165 #define IIO_DFX_LCK_CTL 0x504
166 
167 #endif /* _SOC_PCI_DEVS_H_ */