x86/PCI: Add support for the ALi M1487 (IBC) PIRQ router
authorMaciej W. Rozycki <macro@orcam.me.uk>
Tue, 20 Jul 2021 03:27:54 +0000 (05:27 +0200)
committerThomas Gleixner <tglx@linutronix.de>
Tue, 10 Aug 2021 21:31:43 +0000 (23:31 +0200)
commit1ce849c755342b236fc6236dfe39dbbf536b64b6
treeb9a0c5c7332439f59986bebfc54c9247684c51ca
parentfb6a0408eac284688d5262519cbb3be0250e4caf
x86/PCI: Add support for the ALi M1487 (IBC) PIRQ router

The ALi M1487 ISA Bus Controller (IBC), a part of the ALi FinALi 486
chipset, implements PCI interrupt steering with a PIRQ router[1] in the
form of four 4-bit mappings, spread across two PCI INTx Routing Table
Mapping Registers, available in the port I/O space accessible indirectly
via the index/data register pair at 0x22/0x23, located at indices 0x42
and 0x43 for the INT1/INT2 and INT3/INT4 lines respectively.

Additionally there is a separate PCI INTx Sensitivity Register at index
0x44 in the same port I/O space, whose bits 3:0 select the trigger mode
for INT[4:1] lines respectively[2].  Manufacturer's documentation says
that this register has to be set consistently with the relevant ELCR
register[3].  Add a router-specific hook then and use it to handle this
register.

Accesses to the port I/O space concerned here need to be unlocked by
writing the value of 0xc5 to the Lock Register at index 0x03
beforehand[4].  Do so then and then lock access after use for safety.

The IBC is implemented as a peer bridge on the host bus rather than a
southbridge on PCI and therefore it does not itself appear in the PCI
configuration space.  It is complemented by the M1489 Cache-Memory PCI
Controller (CMP) host-to-PCI bridge, so use that device's identification
for determining the presence of the IBC.

References:

[1] "M1489/M1487: 486 PCI Chip Set", Version 1.2, Acer Laboratories
    Inc., July 1997, Section 4: "Configuration Registers", pp. 76-77

[2] same, p. 77

[3] same, Section 5: "M1489/M1487 Software Programming Guide", pp.
    99-100

[4] same, Section 4: "Configuration Registers", p. 37

Signed-off-by: Maciej W. Rozycki <macro@orcam.me.uk>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Link: https://lore.kernel.org/r/alpine.DEB.2.21.2107191702020.9461@angie.orcam.me.uk
arch/x86/pci/irq.c
include/linux/pci_ids.h