blob: 49c137aec13f8848d607be0ad7daeb260d98ef16 [file] [log] [blame]
Angel Pons182dbde2020-04-02 23:49:05 +02001/* SPDX-License-Identifier: GPL-2.0-only */
Vladimir Serbinenko33b535f2014-10-19 10:13:14 +02002
Vladimir Serbinenko33b535f2014-10-19 10:13:14 +02003#include "pch.h"
Vladimir Serbinenko33b535f2014-10-19 10:13:14 +02004
Angel Pons6cd6e712020-05-07 00:54:42 +02005void southbridge_configure_default_intmap(void)
Vladimir Serbinenko33b535f2014-10-19 10:13:14 +02006{
7 /*
Nico Huber16a41cc2019-02-14 17:52:25 +01008 * For the PCH internal PCI functions, provide a reasonable
9 * default IRQ mapping that utilizes only PIRQ A to D. Higher
10 * PIRQs are sometimes used for other on-board chips that
11 * require an edge triggered interrupt which is not shareable.
Vladimir Serbinenko33b535f2014-10-19 10:13:14 +020012 */
13
Nico Huber16a41cc2019-02-14 17:52:25 +010014 /*
15 * We use a linear mapping for the pin numbers. They are not
16 * physical pins, and thus, have no relation between the dif-
17 * ferent devices. Only rule we must obey is that a single-
18 * function device has to use pin A.
19 */
20 RCBA32(D31IP) = (INTD << D31IP_TTIP) | (INTC << D31IP_SIP2) |
Vladimir Serbinenko33b535f2014-10-19 10:13:14 +020021 (INTB << D31IP_SMIP) | (INTA << D31IP_SIP);
Vladimir Serbinenko33b535f2014-10-19 10:13:14 +020022 RCBA32(D29IP) = (INTA << D29IP_E1P);
Nico Huber16a41cc2019-02-14 17:52:25 +010023 RCBA32(D28IP) = (INTD << D28IP_P8IP) | (INTC << D28IP_P7IP) |
24 (INTB << D28IP_P6IP) | (INTA << D28IP_P5IP) |
25 (INTD << D28IP_P4IP) | (INTC << D28IP_P3IP) |
26 (INTB << D28IP_P2IP) | (INTA << D28IP_P1IP);
Vladimir Serbinenko33b535f2014-10-19 10:13:14 +020027 RCBA32(D27IP) = (INTA << D27IP_ZIP);
28 RCBA32(D26IP) = (INTA << D26IP_E2P);
Nico Huber16a41cc2019-02-14 17:52:25 +010029 RCBA32(D25IP) = (INTA << D25IP_LIP);
30 RCBA32(D22IP) = (INTA << D22IP_MEI1IP);
31 RCBA32(D20IP) = (INTA << D20IP_XHCIIP);
Vladimir Serbinenko33b535f2014-10-19 10:13:14 +020032
Nico Huber16a41cc2019-02-14 17:52:25 +010033 /*
34 * For the PIRQ allocation the following was taken into
35 * account:
36 * o Interrupts of the PCIe root ports are only about
37 * events at the ports, not downstream devices. So we
38 * don't expect many interrupts there and ignore them.
39 * o We don't expect to talk constantly to the ME either
40 * so ignore that, too. Same for SMBus and the thermal
41 * device.
42 * o Second SATA interface is only used in non-AHCI mode
43 * so unlikely to coexist with modern interfaces (e.g.
44 * xHCI).
45 * o An OS that knows USB3 will likely also know how to
46 * use MSI.
47 *
48 * The functions that might matter first:
49 *
50 * D31IP_SIP SATA 1 -> PIRQ A (MSI capable in AHCI mode)
51 * D31IP_SIP2 SATA 2 -> PIRQ B
52 * D29IP_E1P EHCI 1 -> PIRQ C
53 * D27IP_ZIP HDA -> PIRQ D (MSI capable)
54 * D26IP_E2P EHCI 2 -> PIRQ D
55 * D25IP_LIP GbE -> PIRQ B (MSI capable)
56 * D20IP_XHCIIP xHCI -> PIRQ B (MSI capable)
57 *
58 * D31IP_TTIP Thermal -> PIRQ B
59 * D31IP_SMIP SMBUS -> PIRQ A
60 * D28IP_* PCIe RP -> PIRQ A-D (MSI capable)
61 * D22IP_MEI1IP ME -> PIRQ A (MSI capable)
62 *
63 * Note, CPU-integrated functions seem to always use PIRQ A.
64 */
65#define _none 0
66 DIR_ROUTE(D31IR, PIRQA, PIRQA, PIRQB, PIRQB);
67 DIR_ROUTE(D29IR, PIRQC, _none, _none, _none);
68 DIR_ROUTE(D28IR, PIRQA, PIRQB, PIRQC, PIRQD);
69 DIR_ROUTE(D27IR, PIRQD, _none, _none, _none);
70 DIR_ROUTE(D26IR, PIRQD, _none, _none, _none);
71 DIR_ROUTE(D25IR, PIRQB, _none, _none, _none);
72 DIR_ROUTE(D22IR, PIRQA, _none, _none, _none);
73 DIR_ROUTE(D20IR, PIRQB, _none, _none, _none);
74#undef _none
Vladimir Serbinenko33b535f2014-10-19 10:13:14 +020075
76 /* Enable IOAPIC (generic) */
Arthur Heymans58a89532018-06-12 22:58:19 +020077 RCBA16(OIC) = 0x0100;
Vladimir Serbinenko33b535f2014-10-19 10:13:14 +020078 /* PCH BWG says to read back the IOAPIC enable register */
Arthur Heymans58a89532018-06-12 22:58:19 +020079 (void) RCBA16(OIC);
Vladimir Serbinenko33b535f2014-10-19 10:13:14 +020080}
Nico Huberff4025c2018-01-14 12:34:43 +010081
Angel Pons6cd6e712020-05-07 00:54:42 +020082void southbridge_rcba_config(void)
Nico Huberff4025c2018-01-14 12:34:43 +010083{
84 RCBA32(FD) = PCH_DISABLE_ALWAYS;
85}