xref: /aosp_15_r20/external/coreboot/src/soc/intel/alderlake/include/soc/pci_devs.h (revision b9411a12aaaa7e1e6a6fb7c5e057f44ee179a49c)
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 
3 #ifndef _SOC_ALDERLAKE_PCI_DEVS_H_
4 #define _SOC_ALDERLAKE_PCI_DEVS_H_
5 
6 #include <device/pci_def.h>
7 
8 #define _SA_DEVFN(slot)		PCI_DEVFN(SA_DEV_SLOT_ ## slot, 0)
9 #define _PCH_DEVFN(slot, func)	PCI_DEVFN(PCH_DEV_SLOT_ ## slot, func)
10 
11 #if !defined(__SIMPLE_DEVICE__)
12 #include <device/device.h>
13 #define _SA_DEV(slot)		pcidev_path_on_root(_SA_DEVFN(slot))
14 #define _PCH_DEV(slot, func)	pcidev_path_on_root_debug(_PCH_DEVFN(slot, func), __func__)
15 #else
16 #define _SA_DEV(slot)		PCI_DEV(0, SA_DEV_SLOT_ ## slot, 0)
17 #define _PCH_DEV(slot, func)	PCI_DEV(0, PCH_DEV_SLOT_ ## slot, func)
18 #endif
19 
20 /* System Agent Devices */
21 
22 #define SA_DEV_SLOT_ROOT	0x00
23 #define  SA_DEVFN_ROOT		PCI_DEVFN(SA_DEV_SLOT_ROOT, 0)
24 #if defined(__SIMPLE_DEVICE__)
25 #define  SA_DEV_ROOT		PCI_DEV(0, SA_DEV_SLOT_ROOT, 0)
26 #endif
27 
28 #define SA_DEV_SLOT_CPU_1	0x01
29 #define  SA_DEVFN_CPU_PCIE1_0	PCI_DEVFN(SA_DEV_SLOT_CPU_1, 0)
30 #define  SA_DEVFN_CPU_PCIE1_1	PCI_DEVFN(SA_DEV_SLOT_CPU_1, 1)
31 
32 #define SA_DEV_SLOT_IGD		0x02
33 #define  SA_DEVFN_IGD		PCI_DEVFN(SA_DEV_SLOT_IGD, 0)
34 #define  SA_DEV_IGD		PCI_DEV(0, SA_DEV_SLOT_IGD, 0)
35 
36 #define SA_DEV_SLOT_DPTF	0x04
37 #define  SA_DEVFN_DPTF		PCI_DEVFN(SA_DEV_SLOT_DPTF, 0)
38 #define  SA_DEV_DPTF		PCI_DEV(0, SA_DEV_SLOT_DPTF, 0)
39 
40 #define SA_DEV_SLOT_IPU		0x05
41 #define  SA_DEVFN_IPU		PCI_DEVFN(SA_DEV_SLOT_IPU, 0)
42 #define  SA_DEV_IPU		PCI_DEV(0, SA_DEV_SLOT_IPU, 0)
43 
44 #define SA_DEV_SLOT_CPU_6	0x06
45 #define  SA_DEVFN_CPU_PCIE6_0	PCI_DEVFN(SA_DEV_SLOT_CPU_6, 0)
46 #define  SA_DEVFN_CPU_PCIE6_2	PCI_DEVFN(SA_DEV_SLOT_CPU_6, 2)
47 
48 #define SA_DEV_SLOT_TBT		0x07
49 #define SA_DEVFN_TBT(x)		PCI_DEVFN(SA_DEV_SLOT_TBT, (x))
50 #define NUM_TBT_FUNCTIONS	4
51 #define  SA_DEVFN_TBT0		PCI_DEVFN(SA_DEV_SLOT_TBT, 0)
52 #define  SA_DEVFN_TBT1		PCI_DEVFN(SA_DEV_SLOT_TBT, 1)
53 #define  SA_DEVFN_TBT2		PCI_DEVFN(SA_DEV_SLOT_TBT, 2)
54 #define  SA_DEVFN_TBT3		PCI_DEVFN(SA_DEV_SLOT_TBT, 3)
55 #define  SA_DEV_TBT0		PCI_DEV(0, SA_DEV_SLOT_TBT, 0)
56 #define  SA_DEV_TBT1		PCI_DEV(0, SA_DEV_SLOT_TBT, 1)
57 #define  SA_DEV_TBT2		PCI_DEV(0, SA_DEV_SLOT_TBT, 2)
58 #define  SA_DEV_TBT3		PCI_DEV(0, SA_DEV_SLOT_TBT, 3)
59 
60 #define SA_DEV_SLOT_GNA		0x08
61 #define  SA_DEVFN_GNA		PCI_DEVFN(SA_DEV_SLOT_GNA, 0)
62 #define  SA_DEV_GNA		PCI_DEV(0, SA_DEV_SLOT_GNA, 0)
63 
64 #define SA_DEV_SLOT_TMT		0x0A
65 #define SA_DEVFN_TMT		_SA_DEVFN(TMT)
66 #define SA_DEV_TMT		_SA_DEV(TMT)
67 
68 #define SA_DEV_SLOT_TCSS	0x0d
69 #define NUM_TCSS_DMA_FUNCTIONS	2
70 #define SA_DEVFN_TCSS_DMA(x)	PCI_DEVFN(SA_DEV_SLOT_TCSS, ((x) + 2))
71 #define  SA_DEVFN_TCSS_XHCI	PCI_DEVFN(SA_DEV_SLOT_TCSS, 0)
72 #define  SA_DEVFN_TCSS_XDCI	PCI_DEVFN(SA_DEV_SLOT_TCSS, 1)
73 #define  SA_DEVFN_TCSS_DMA0	PCI_DEVFN(SA_DEV_SLOT_TCSS, 2)
74 #define  SA_DEVFN_TCSS_DMA1	PCI_DEVFN(SA_DEV_SLOT_TCSS, 3)
75 #define  SA_DEV_TCSS_XHCI	PCI_DEV(0, SA_DEV_SLOT_TCSS, 0)
76 #define  SA_DEV_TCSS_XDCI	PCI_DEV(0, SA_DEV_SLOT_TCSS, 1)
77 #define  SA_DEV_TCSS_DMA0	PCI_DEV(0, SA_DEV_SLOT_TCSS, 2)
78 #define  SA_DEV_TCSS_DMA1	PCI_DEV(0, SA_DEV_SLOT_TCSS, 3)
79 
80 #define SA_DEV_SLOT_VMD		0x0e
81 #define  SA_DEVFN_VMD		PCI_DEVFN(SA_DEV_SLOT_VMD, 0)
82 #define  SA_DEV_VMD		PCI_DEV(0, SA_DEV_SLOT_VMD, 0)
83 
84 /* PCH Devices */
85 #define MIN_PCH_SLOT		PCH_DEV_SLOT_SIO0
86 #define PCH_DEV_SLOT_SIO0	0x10
87 #define  PCH_DEVFN_I2C6		_PCH_DEVFN(SIO0, 0)
88 #define  PCH_DEVFN_I2C7		_PCH_DEVFN(SIO0, 1)
89 #define  PCH_DEVFN_THC0		_PCH_DEVFN(SIO0, 6)
90 #define  PCH_DEVFN_THC1		_PCH_DEVFN(SIO0, 7)
91 #define  PCH_DEV_I2C6		_PCH_DEV(SIO0, 0)
92 #define  PCH_DEV_I2C7		_PCH_DEV(SIO0, 1)
93 #define  PCH_DEV_THC0		_PCH_DEV(SIO0, 6)
94 #define  PCH_DEV_THC1		_PCH_DEV(SIO0, 7)
95 
96 #define PCH_DEV_SLOT_SIO6	0x11
97 #define  PCH_DEVFN_UART3	_PCH_DEVFN(SIO6, 0)
98 #define  PCH_DEVFN_UART4	_PCH_DEVFN(SIO6, 1)
99 #define  PCH_DEVFN_UART5	_PCH_DEVFN(SIO6, 2)
100 #define  PCH_DEVFN_UART6	_PCH_DEVFN(SIO6, 3)
101 #define  PCH_DEV_UART3		_PCH_DEV(SIO6, 0)
102 #define  PCH_DEV_UART4		_PCH_DEV(SIO6, 1)
103 #define  PCH_DEV_UART5		_PCH_DEV(SIO6, 2)
104 #define  PCH_DEV_UART6		_PCH_DEV(SIO6, 3)
105 
106 #define PCH_DEV_SLOT_ISH	0x12
107 #define  PCH_DEVFN_ISH		_PCH_DEVFN(ISH, 0)
108 #define  PCH_DEVFN_GSPI2	_PCH_DEVFN(ISH, 6)
109 #define  PCH_DEVFN_UFS		_PCH_DEVFN(ISH, 7)
110 #define  PCH_DEV_ISH		_PCH_DEV(ISH, 0)
111 #define  PCH_DEV_GSPI2		_PCH_DEV(ISH, 6)
112 #define  PCH_DEV_UFS		_PCH_DEV(ISH, 7)
113 
114 #define PCH_DEV_SLOT_SIO2	0x13
115 #define  PCH_DEVFN_GSPI3	_PCH_DEVFN(SIO2, 0)
116 #define  PCH_DEVFN_GSPI4	_PCH_DEVFN(SIO2, 1)
117 #define  PCH_DEVFN_GSPI5	_PCH_DEVFN(SIO2, 2)
118 #define  PCH_DEVFN_GSPI6	_PCH_DEVFN(SIO2, 3)
119 #define  PCH_DEV_GSPI3		_PCH_DEV(SIO2, 0)
120 #define  PCH_DEV_GSPI4		_PCH_DEV(SIO2, 1)
121 #define  PCH_DEV_GSPI5		_PCH_DEV(SIO2, 2)
122 #define  PCH_DEV_GSPI6		_PCH_DEV(SIO2, 3)
123 
124 #define PCH_DEV_SLOT_XHCI	0x14
125 #define  PCH_DEVFN_XHCI		_PCH_DEVFN(XHCI, 0)
126 #define  PCH_DEVFN_USBOTG	_PCH_DEVFN(XHCI, 1)
127 #define  PCH_DEVFN_SRAM		_PCH_DEVFN(XHCI, 2)
128 #define  PCH_DEVFN_CNVI_WIFI	_PCH_DEVFN(XHCI, 3)
129 #define  PCH_DEV_XHCI		_PCH_DEV(XHCI, 0)
130 #define  PCH_DEV_USBOTG		_PCH_DEV(XHCI, 1)
131 #define  PCH_DEV_SRAM		_PCH_DEV(XHCI, 2)
132 #define  PCH_DEV_CNVI_WIFI	_PCH_DEV(XHCI, 3)
133 
134 #define PCH_DEV_SLOT_SIO3	0x15
135 #define  PCH_DEVFN_I2C0		_PCH_DEVFN(SIO3, 0)
136 #define  PCH_DEVFN_I2C1		_PCH_DEVFN(SIO3, 1)
137 #define  PCH_DEVFN_I2C2		_PCH_DEVFN(SIO3, 2)
138 #define  PCH_DEVFN_I2C3		_PCH_DEVFN(SIO3, 3)
139 #define  PCH_DEV_I2C0		_PCH_DEV(SIO3, 0)
140 #define  PCH_DEV_I2C1		_PCH_DEV(SIO3, 1)
141 #define  PCH_DEV_I2C2		_PCH_DEV(SIO3, 2)
142 #define  PCH_DEV_I2C3		_PCH_DEV(SIO3, 3)
143 
144 #define PCH_DEV_SLOT_CSE	0x16
145 #define  PCH_DEVFN_CSE		_PCH_DEVFN(CSE, 0)
146 #define  PCH_DEVFN_CSE_2	_PCH_DEVFN(CSE, 1)
147 #define  PCH_DEVFN_CSE_IDER	_PCH_DEVFN(CSE, 2)
148 #define  PCH_DEVFN_CSE_KT	_PCH_DEVFN(CSE, 3)
149 #define  PCH_DEVFN_CSE_3	_PCH_DEVFN(CSE, 4)
150 #define  PCH_DEVFN_CSE_4	_PCH_DEVFN(CSE, 5)
151 #define  PCH_DEV_CSE		_PCH_DEV(CSE, 0)
152 #define  PCH_DEV_CSE_2		_PCH_DEV(CSE, 1)
153 #define  PCH_DEV_CSE_IDER	_PCH_DEV(CSE, 2)
154 #define  PCH_DEV_CSE_KT		_PCH_DEV(CSE, 3)
155 #define  PCH_DEV_CSE_3		_PCH_DEV(CSE, 4)
156 #define  PCH_DEV_CSE_4		_PCH_DEV(CSE, 5)
157 
158 #define PCH_DEV_SLOT_SATA	0x17
159 #define  PCH_DEVFN_SATA		_PCH_DEVFN(SATA, 0)
160 #define  PCH_DEV_SATA		_PCH_DEV(SATA, 0)
161 
162 #define PCH_DEV_SLOT_SIO4	0x19
163 #define  PCH_DEVFN_I2C4		_PCH_DEVFN(SIO4, 0)
164 #define  PCH_DEVFN_I2C5		_PCH_DEVFN(SIO4, 1)
165 #define  PCH_DEVFN_UART2	_PCH_DEVFN(SIO4, 2)
166 #define  PCH_DEV_I2C4		_PCH_DEV(SIO4, 0)
167 #define  PCH_DEV_I2C5		_PCH_DEV(SIO4, 1)
168 #define  PCH_DEV_UART2		_PCH_DEV(SIO4, 2)
169 
170 #if CONFIG(SOC_INTEL_ALDERLAKE_PCH_N)
171 #define PCH_DEV_SLOT_EMMC	0x1a
172 #define  PCH_DEVFN_EMMC		_PCH_DEVFN(EMMC, 0)
173 #define  PCH_DEV_EMMC		_PCH_DEV(EMMC, 0)
174 #endif
175 
176 #define PCH_DEV_SLOT_PCIE	0x1c
177 #define  PCH_DEVFN_PCIE1	_PCH_DEVFN(PCIE, 0)
178 #define  PCH_DEVFN_PCIE2	_PCH_DEVFN(PCIE, 1)
179 #define  PCH_DEVFN_PCIE3	_PCH_DEVFN(PCIE, 2)
180 #define  PCH_DEVFN_PCIE4	_PCH_DEVFN(PCIE, 3)
181 #define  PCH_DEVFN_PCIE5	_PCH_DEVFN(PCIE, 4)
182 #define  PCH_DEVFN_PCIE6	_PCH_DEVFN(PCIE, 5)
183 #define  PCH_DEVFN_PCIE7	_PCH_DEVFN(PCIE, 6)
184 #define  PCH_DEVFN_PCIE8	_PCH_DEVFN(PCIE, 7)
185 #define  PCH_DEV_PCIE1		_PCH_DEV(PCIE, 0)
186 #define  PCH_DEV_PCIE2		_PCH_DEV(PCIE, 1)
187 #define  PCH_DEV_PCIE3		_PCH_DEV(PCIE, 2)
188 #define  PCH_DEV_PCIE4		_PCH_DEV(PCIE, 3)
189 #define  PCH_DEV_PCIE5		_PCH_DEV(PCIE, 4)
190 #define  PCH_DEV_PCIE6		_PCH_DEV(PCIE, 5)
191 #define  PCH_DEV_PCIE7		_PCH_DEV(PCIE, 6)
192 #define  PCH_DEV_PCIE8		_PCH_DEV(PCIE, 7)
193 
194 #define PCH_DEV_SLOT_PCIE_1	0x1d
195 #define  PCH_DEVFN_PCIE9	_PCH_DEVFN(PCIE_1, 0)
196 #define  PCH_DEVFN_PCIE10	_PCH_DEVFN(PCIE_1, 1)
197 #define  PCH_DEVFN_PCIE11	_PCH_DEVFN(PCIE_1, 2)
198 #define  PCH_DEVFN_PCIE12	_PCH_DEVFN(PCIE_1, 3)
199 #define  PCH_DEVFN_PCIE13	_PCH_DEVFN(PCIE_1, 4)
200 #define  PCH_DEVFN_PCIE14	_PCH_DEVFN(PCIE_1, 5)
201 #define  PCH_DEVFN_PCIE15	_PCH_DEVFN(PCIE_1, 6)
202 #define  PCH_DEVFN_PCIE16	_PCH_DEVFN(PCIE_1, 7)
203 #define  PCH_DEV_PCIE9		_PCH_DEV(PCIE_1, 0)
204 #define  PCH_DEV_PCIE10		_PCH_DEV(PCIE_1, 1)
205 #define  PCH_DEV_PCIE11		_PCH_DEV(PCIE_1, 2)
206 #define  PCH_DEV_PCIE12		_PCH_DEV(PCIE_1, 3)
207 #define  PCH_DEV_PCIE13		_PCH_DEV(PCIE_1, 4)
208 #define  PCH_DEV_PCIE14		_PCH_DEV(PCIE_1, 5)
209 #define  PCH_DEV_PCIE15		_PCH_DEV(PCIE_1, 6)
210 #define  PCH_DEV_PCIE16		_PCH_DEV(PCIE_1, 7)
211 
212 #define PCH_DEV_SLOT_PCIE_2	0x1b
213 #define  PCH_DEVFN_PCIE17	_PCH_DEVFN(PCIE_2, 0)
214 #define  PCH_DEVFN_PCIE18	_PCH_DEVFN(PCIE_2, 1)
215 #define  PCH_DEVFN_PCIE19	_PCH_DEVFN(PCIE_2, 2)
216 #define  PCH_DEVFN_PCIE20	_PCH_DEVFN(PCIE_2, 3)
217 #define  PCH_DEVFN_PCIE21	_PCH_DEVFN(PCIE_2, 4)
218 #define  PCH_DEVFN_PCIE22	_PCH_DEVFN(PCIE_2, 5)
219 #define  PCH_DEVFN_PCIE23	_PCH_DEVFN(PCIE_2, 6)
220 #define  PCH_DEVFN_PCIE24	_PCH_DEVFN(PCIE_2, 7)
221 #define  PCH_DEV_PCIE17		_PCH_DEV(PCIE_2, 0)
222 #define  PCH_DEV_PCIE18		_PCH_DEV(PCIE_2, 1)
223 #define  PCH_DEV_PCIE19		_PCH_DEV(PCIE_2, 2)
224 #define  PCH_DEV_PCIE20		_PCH_DEV(PCIE_2, 3)
225 #define  PCH_DEV_PCIE21		_PCH_DEV(PCIE_2, 4)
226 #define  PCH_DEV_PCIE22		_PCH_DEV(PCIE_2, 5)
227 #define  PCH_DEV_PCIE23		_PCH_DEV(PCIE_2, 6)
228 #define  PCH_DEV_PCIE24		_PCH_DEV(PCIE_2, 7)
229 
230 #define PCH_DEV_SLOT_PCIE_3	0x1a
231 #define  PCH_DEVFN_PCIE25	_PCH_DEVFN(PCIE_3, 0)
232 #define  PCH_DEVFN_PCIE26	_PCH_DEVFN(PCIE_3, 1)
233 #define  PCH_DEVFN_PCIE27	_PCH_DEVFN(PCIE_3, 2)
234 #define  PCH_DEVFN_PCIE28	_PCH_DEVFN(PCIE_3, 3)
235 #define  PCH_DEV_PCIE25		_PCH_DEV(PCIE_3, 0)
236 #define  PCH_DEV_PCIE26		_PCH_DEV(PCIE_3, 1)
237 #define  PCH_DEV_PCIE27		_PCH_DEV(PCIE_3, 2)
238 #define  PCH_DEV_PCIE28		_PCH_DEV(PCIE_3, 3)
239 
240 #define PCH_DEV_SLOT_SIO5	0x1e
241 #define  PCH_DEVFN_UART0	_PCH_DEVFN(SIO5, 0)
242 #define  PCH_DEVFN_UART1	_PCH_DEVFN(SIO5, 1)
243 #define  PCH_DEVFN_GSPI0	_PCH_DEVFN(SIO5, 2)
244 #define  PCH_DEVFN_GSPI1	_PCH_DEVFN(SIO5, 3)
245 #define  PCH_DEV_UART0		_PCH_DEV(SIO5, 0)
246 #define  PCH_DEV_UART1		_PCH_DEV(SIO5, 1)
247 #define  PCH_DEV_GSPI0		_PCH_DEV(SIO5, 2)
248 #define  PCH_DEV_GSPI1		_PCH_DEV(SIO5, 3)
249 
250 #define PCH_DEV_SLOT_ESPI	0x1f
251 #define  PCH_DEVFN_ESPI		_PCH_DEVFN(ESPI, 0)
252 #define  PCH_DEVFN_P2SB		_PCH_DEVFN(ESPI, 1)
253 #define  PCH_DEVFN_PMC		_PCH_DEVFN(ESPI, 2)
254 #define  PCH_DEVFN_HDA		_PCH_DEVFN(ESPI, 3)
255 #define  PCH_DEVFN_SMBUS	_PCH_DEVFN(ESPI, 4)
256 #define  PCH_DEVFN_SPI		_PCH_DEVFN(ESPI, 5)
257 #define  PCH_DEVFN_GBE		_PCH_DEVFN(ESPI, 6)
258 #define  PCH_DEVFN_TRACEHUB	_PCH_DEVFN(ESPI, 7)
259 #define  PCH_DEV_ESPI		_PCH_DEV(ESPI, 0)
260 #define  PCH_DEV_LPC		PCH_DEV_ESPI
261 #define  PCH_DEV_P2SB		_PCH_DEV(ESPI, 1)
262 
263 #if !ENV_RAMSTAGE
264 /*
265  * PCH_DEV_PMC is intentionally not defined in RAMSTAGE since PMC device gets
266  * hidden from PCI bus after call to FSP-S. This leads to resource allocator
267  * dropping it from the root bus as unused device. All references to PCH_DEV_PMC
268  * would then return NULL and can go unnoticed if not handled properly. Since,
269  * this device does not have any special chip config associated with it, it is
270  * okay to not provide the definition for it in ramstage.
271  */
272 #define  PCH_DEV_PMC		_PCH_DEV(ESPI, 2)
273 #endif
274 
275 #define  PCH_DEV_HDA		_PCH_DEV(ESPI, 3)
276 #define  PCH_DEV_SMBUS		_PCH_DEV(ESPI, 4)
277 #define  PCH_DEV_SPI		_PCH_DEV(ESPI, 5)
278 #define  PCH_DEV_GBE		_PCH_DEV(ESPI, 6)
279 #define  PCH_DEV_TRACEHUB	_PCH_DEV(ESPI, 7)
280 
281 #endif
282