coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
irq.c
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 
3 #include <device/device.h>
4 #include <device/pci.h>
5 #include <device/pci_ops.h>
6 #include <intelblocks/lpc_lib.h>
7 #include <intelblocks/itss.h>
8 #include <soc/ramstage.h>
9 #include <soc/interrupt.h>
10 #include <soc/irq.h>
11 #include <string.h>
12 
13 static const SI_PCH_DEVICE_INTERRUPT_CONFIG devintconfig[] = {
14  /*
15  * cAVS(Audio, Voice, Speech), INTA is default, programmed in
16  * PciCfgSpace 3Dh
17  */
19  /*
20  * SMBus Controller, no default value, programmed in
21  * PciCfgSpace 3Dh
22  */
24  /* GbE Controller, INTA is default, programmed in PciCfgSpace 3Dh */
26  /* TraceHub, INTA is default, RO register */
28  /*
29  * SerialIo: UART #0, INTA is default,
30  * programmed in PCR[SERIALIO] + PCICFGCTRL[7]
31  */
33  /*
34  * SerialIo: UART #1, INTA is default,
35  * programmed in PCR[SERIALIO] + PCICFGCTRL[8]
36  */
38  /*
39  * SerialIo: SPI #0, INTA is default,
40  * programmed in PCR[SERIALIO] + PCICFGCTRL[10]
41  */
43  /*
44  * SerialIo: SPI #1, INTA is default,
45  * programmed in PCR[SERIALIO] + PCICFGCTRL[11]
46  */
48  /* SCS: eMMC (SKL PCH-LP Only) */
50  /* SCS: SDIO (SKL PCH-LP Only) */
52  /* SCS: SDCard (SKL PCH-LP Only) */
54  /* PCI Express Port, INT is default,
55  * programmed in PciCfgSpace + FCh
56  */
61  /*
62  * PCI Express Port 1, INT is default,
63  * programmed in PciCfgSpace + FCh
64  */
66  /*
67  * PCI Express Port 2, INT is default,
68  * programmed in PciCfgSpace + FCh
69  */
71  /*
72  * PCI Express Port 3, INT is default,
73  * programmed in PciCfgSpace + FCh
74  */
76  /*
77  * PCI Express Port 4, INT is default,
78  * programmed in PciCfgSpace + FCh
79  */
81  /*
82  * PCI Express Port 5, INT is default,
83  * programmed in PciCfgSpace + FCh
84  */
86  /*
87  * PCI Express Port 6, INT is default,
88  * programmed in PciCfgSpace + FCh
89  */
91  /*
92  * PCI Express Port 7, INT is default,
93  * programmed in PciCfgSpace + FCh
94  */
96  /*
97  * PCI Express Port 8, INT is default,
98  * programmed in PciCfgSpace + FCh
99  */
101  /*
102  * SerialIo UART Controller #2, INTA is default,
103  * programmed in PCR[SERIALIO] + PCICFGCTRL[9]
104  */
106  /*
107  * SerialIo UART Controller #5, INTA is default,
108  * programmed in PCR[SERIALIO] + PCICFGCTRL[6]
109  */
111  /*
112  * SerialIo UART Controller #4, INTA is default,
113  * programmed in PCR[SERIALIO] + PCICFGCTRL[5]
114  */
116  /*
117  * SATA Controller, INTA is default,
118  * programmed in PciCfgSpace + 3Dh
119  */
121  /* CSME: HECI #1 */
123  /* CSME: HECI #2 */
125  /* CSME: IDE-Redirection (IDE-R) */
127  /* CSME: Keyboard and Text (KT) Redirection */
129  /* CSME: HECI #3 */
131  /*
132  * SerialIo I2C Controller #0, INTA is default,
133  * programmed in PCR[SERIALIO] + PCICFGCTRL[1]
134  */
136  /*
137  * SerialIo I2C Controller #1, INTA is default,
138  * programmed in PCR[SERIALIO] + PCICFGCTRL[2]
139  */
141  /*
142  * SerialIo I2C Controller #2, INTA is default,
143  * programmed in PCR[SERIALIO] + PCICFGCTRL[3]
144  */
146  /*
147  * SerialIo I2C Controller #3, INTA is default,
148  * programmed in PCR[SERIALIO] + PCICFGCTRL[4]
149  */
151  /*
152  * USB 3.0 xHCI Controller, no default value,
153  * programmed in PciCfgSpace 3Dh
154  */
156  /* USB Device Controller (OTG) */
158  /* Thermal Subsystem */
160  /* Camera IO Host Controller */
162  /* Integrated Sensor Hub */
164 };
165 
167 {
168 
169  uint32_t i, intdeventry;
170  u8 irq_config[PCH_MAX_IRQ_CONFIG];
171  const struct device *dev = pcidev_path_on_root(PCH_DEVFN_LPC);
172  const struct soc_intel_skylake_config *config = config_of(dev);
173 
174  /* Get Device Int Count */
175  intdeventry = ARRAY_SIZE(devintconfig);
176  /* update irq table */
177  memcpy((SI_PCH_DEVICE_INTERRUPT_CONFIG *)
178  (uintptr_t)(params->DevIntConfigPtr), devintconfig, intdeventry *
179  sizeof(SI_PCH_DEVICE_INTERRUPT_CONFIG));
180 
181  params->NumOfDevIntConfig = intdeventry;
182  /* PxRC to IRQ programming */
183  for (i = 0; i < PCH_MAX_IRQ_CONFIG; i++) {
184  switch (i) {
185  case PCH_PARC:
186  case PCH_PCRC:
187  case PCH_PDRC:
188  case PCH_PERC:
189  case PCH_PFRC:
190  case PCH_PGRC:
191  case PCH_PHRC:
192  irq_config[i] = PCH_IRQ11;
193  break;
194  case PCH_PBRC:
195  irq_config[i] = PCH_IRQ10;
196  break;
197  }
198  }
199  memcpy(params->PxRcConfig, irq_config, PCH_MAX_IRQ_CONFIG);
200  /* GPIO IRQ Route The valid values is 14 or 15 */
201  if (config->GpioIrqSelect == 0)
202  params->GpioIrqRoute = GPIO_IRQ14;
203  else
204  params->GpioIrqRoute = config->GpioIrqSelect;
205  /* SCI IRQ Select The valid values is 9, 10, 11 and 20 21, 22, 23 */
206  if (config->SciIrqSelect == 0)
207  params->SciIrqSelect = SCI_IRQ9;
208  else
209  params->SciIrqSelect = config->SciIrqSelect;
210  /* TCO IRQ Select The valid values is 9, 10, 11, 20 21, 22, 23 */
211  if (config->TcoIrqSelect == 0)
212  params->TcoIrqSelect = TCO_IRQ9;
213  else
214  params->TcoIrqSelect = config->TcoIrqSelect;
215  /* TCO Irq enable/disable */
216  params->TcoIrqEnable = config->TcoIrqEnable;
217 }
#define PCH_IRQ10
Definition: irq.h:9
#define PCH_IRQ11
Definition: irq.h:10
#define GPIO_IRQ14
Definition: irq.h:6
#define LPSS_UART2_IRQ
Definition: irq.h:9
#define LPSS_UART1_IRQ
Definition: irq.h:8
#define LPSS_UART0_IRQ
Definition: irq.h:7
void * memcpy(void *dest, const void *src, size_t n)
Definition: memcpy.c:7
static struct sdram_info params
Definition: sdram_configs.c:83
#define LPSS_I2C5_IRQ
Definition: irq.h:26
#define LPSS_I2C3_IRQ
Definition: irq.h:24
#define LPSS_I2C1_IRQ
Definition: irq.h:22
#define LPSS_I2C4_IRQ
Definition: irq.h:25
#define LPSS_I2C2_IRQ
Definition: irq.h:23
#define ARRAY_SIZE(a)
Definition: helpers.h:12
DEVTREE_CONST struct device * pcidev_path_on_root(pci_devfn_t devfn)
Definition: device_const.c:255
#define HECI_2_IRQ
Definition: irq.h:69
#define SATA_IRQ
Definition: irq.h:66
#define IDER_IRQ
Definition: irq.h:70
#define eMMC_IRQ
Definition: irq.h:50
#define PCIE_6_IRQ
Definition: irq.h:58
#define PCIE_5_IRQ
Definition: irq.h:57
#define SD_IRQ
Definition: irq.h:51
#define PCIE_1_IRQ
Definition: irq.h:53
#define HECI_1_IRQ
Definition: irq.h:68
#define THERMAL_IRQ
Definition: irq.h:77
#define LPSS_I2C0_IRQ
Definition: irq.h:28
#define SCI_IRQ9
Definition: irq.h:12
#define OTG_IRQ
Definition: irq.h:75
#define TCO_IRQ9
Definition: irq.h:20
#define TRACE_HUB_INTA_IRQ
Definition: irq.h:47
#define LPSS_SPI1_IRQ
Definition: irq.h:35
#define PCIE_11_IRQ
Definition: irq.h:63
#define CIO_INTA_IRQ
Definition: irq.h:80
#define PCIE_9_IRQ
Definition: irq.h:61
#define PCIE_2_IRQ
Definition: irq.h:54
#define HECI_3_IRQ
Definition: irq.h:72
#define PCIE_8_IRQ
Definition: irq.h:60
#define PCIE_4_IRQ
Definition: irq.h:56
#define LPSS_SPI0_IRQ
Definition: irq.h:34
#define XHCI_IRQ
Definition: irq.h:74
#define PCIE_3_IRQ
Definition: irq.h:55
#define PCIE_12_IRQ
Definition: irq.h:64
#define PCIE_7_IRQ
Definition: irq.h:59
#define PCIE_10_IRQ
Definition: irq.h:62
#define SDIO_IRQ
Definition: irq.h:40
#define cAVS_INTA_IRQ
Definition: irq.h:42
#define KT_IRQ
Definition: irq.h:71
#define SMBUS_INTA_IRQ
Definition: irq.h:43
#define ISH_IRQ
Definition: irq.h:82
#define GbE_INTA_IRQ
Definition: irq.h:45
static DEVTREE_CONST void * config_of(const struct device *dev)
Definition: device.h:382
enum board_config config
Definition: memory.c:448
static const SI_PCH_DEVICE_INTERRUPT_CONFIG devintconfig[]
Definition: irq.c:13
void soc_irq_settings(FSP_SIL_UPD *params)
Definition: irq.c:166
#define PCH_DEVFN_CSE_IDER
Definition: pci_devs.h:146
#define PCH_DEVFN_I2C5
Definition: pci_devs.h:163
#define PCH_DEVFN_CSE_3
Definition: pci_devs.h:148
#define PCH_DEVFN_GSPI0
Definition: pci_devs.h:206
#define PCH_DEVFN_CSE_2
Definition: pci_devs.h:145
#define PCH_DEVFN_CSE_KT
Definition: pci_devs.h:147
#define PCH_DEVFN_PCIE12
Definition: pci_devs.h:197
#define PCH_DEVFN_TRACEHUB
Definition: pci_devs.h:222
#define PCH_DEVFN_I2C0
Definition: pci_devs.h:134
#define PCH_DEVFN_PCIE2
Definition: pci_devs.h:177
#define PCH_DEVFN_PCIE11
Definition: pci_devs.h:196
#define PCH_DEVFN_UART0
Definition: pci_devs.h:204
#define PCH_DEVFN_PCIE5
Definition: pci_devs.h:180
#define PCH_DEVFN_I2C3
Definition: pci_devs.h:137
#define PCH_DEVFN_I2C4
Definition: pci_devs.h:162
#define PCH_DEVFN_I2C2
Definition: pci_devs.h:136
#define PCH_DEVFN_PCIE9
Definition: pci_devs.h:194
#define PCH_DEVFN_USBOTG
Definition: pci_devs.h:125
#define PCH_DEVFN_SATA
Definition: pci_devs.h:158
#define PCH_DEVFN_UART1
Definition: pci_devs.h:205
#define PCH_DEVFN_GBE
Definition: pci_devs.h:221
#define PCH_DEVFN_XHCI
Definition: pci_devs.h:124
#define PCH_DEVFN_HDA
Definition: pci_devs.h:218
#define PCH_DEVFN_SMBUS
Definition: pci_devs.h:219
#define PCH_DEVFN_I2C1
Definition: pci_devs.h:135
#define PCH_DEVFN_PCIE6
Definition: pci_devs.h:181
#define PCH_DEVFN_PCIE3
Definition: pci_devs.h:178
#define PCH_DEVFN_ISH
Definition: pci_devs.h:106
#define PCH_DEVFN_UART2
Definition: pci_devs.h:164
#define PCH_DEVFN_PCIE7
Definition: pci_devs.h:182
#define PCH_DEVFN_PCIE4
Definition: pci_devs.h:179
#define PCH_DEVFN_PCIE10
Definition: pci_devs.h:195
#define PCH_DEVFN_PCIE8
Definition: pci_devs.h:183
#define PCH_DEVFN_GSPI1
Definition: pci_devs.h:207
#define PCH_DEVFN_PCIE1
Definition: pci_devs.h:176
#define PCH_DEVFN_CSE
Definition: pci_devs.h:144
#define PCH_DEVFN_LPC
Definition: pci_devs.h:156
#define PCH_DEVFN_SDCARD
Definition: pci_devs.h:144
#define PCH_DEVFN_SDIO
Definition: pci_devs.h:152
#define PCH_DEVFN_EMMC
Definition: pci_devs.h:148
#define PCH_DEVFN_THERMAL
Definition: pci_devs.h:77
#define PCH_PARC
Definition: interrupt.h:10
#define PCH_PDRC
Definition: interrupt.h:13
#define int_D
Definition: interrupt.h:30
#define DEVICE_INT_CONFIG(devfn, line, irqno)
Definition: interrupt.h:20
#define int_B
Definition: interrupt.h:28
#define PCH_PGRC
Definition: interrupt.h:16
#define PCH_PFRC
Definition: interrupt.h:15
#define int_A
Definition: interrupt.h:27
#define PCH_PHRC
Definition: interrupt.h:17
#define PCH_PCRC
Definition: interrupt.h:12
#define PCH_MAX_IRQ_CONFIG
Definition: interrupt.h:18
#define PCH_PBRC
Definition: interrupt.h:11
#define PCH_PERC
Definition: interrupt.h:14
#define int_C
Definition: interrupt.h:29
#define PCH_DEVFN_CIO
Definition: pci_devs.h:62
#define FSP_SIL_UPD
Definition: ramstage.h:12
unsigned int uint32_t
Definition: stdint.h:14
unsigned long uintptr_t
Definition: stdint.h:21
uint8_t u8
Definition: stdint.h:45
Definition: device.h:107