x86: Add support for 0x22/0x23 port I/O configuration space
authorMaciej W. Rozycki <macro@orcam.me.uk>
Tue, 20 Jul 2021 03:27:49 +0000 (05:27 +0200)
committerThomas Gleixner <tglx@linutronix.de>
Tue, 10 Aug 2021 21:31:43 +0000 (23:31 +0200)
commitfb6a0408eac284688d5262519cbb3be0250e4caf
treeb9c22274ad210b8d7b11edd66a805e42ee6848b7
parent36a21d51725af2ce0700c6ebcb6b9594aac658a6
x86: Add support for 0x22/0x23 port I/O configuration space

Define macros and accessors for the configuration space addressed
indirectly with an index register and a data register at the port I/O
locations of 0x22 and 0x23 respectively.

This space is defined by the Intel MultiProcessor Specification for the
IMCR register used to switch between the PIC and the APIC mode[1], by
Cyrix processors for their configuration[2][3], and also some chipsets.

Given the lack of atomicity with the indirect addressing a spinlock is
required to protect accesses, although for Cyrix processors it is enough
if accesses are executed with interrupts locally disabled, because the
registers are local to the accessing CPU, and IMCR is only ever poked at
by the BSP and early enough for interrupts not to have been configured
yet.  Therefore existing code does not have to change or use the new
spinlock and neither it does.

Put the spinlock in a library file then, so that it does not get pulled
unnecessarily for configurations that do not refer it.

Convert Cyrix accessors to wrappers so as to retain the brevity and
clarity of the `getCx86' and `setCx86' calls.

References:

[1] "MultiProcessor Specification", Version 1.4, Intel Corporation,
    Order Number: 242016-006, May 1997, Section 3.6.2.1 "PIC Mode", pp.
    3-7, 3-8

[2] "5x86 Microprocessor", Cyrix Corporation, Order Number: 94192-00,
    July 1995, Section 2.3.2.4 "Configuration Registers", p. 2-23

[3] "6x86 Processor", Cyrix Corporation, Order Number: 94175-01, March
    1996, Section 2.4.4 "6x86 Configuration Registers", p. 2-23

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.2107182353140.9461@angie.orcam.me.uk
arch/x86/include/asm/pc-conf-reg.h [new file with mode: 0644]
arch/x86/include/asm/processor-cyrix.h
arch/x86/kernel/apic/apic.c
arch/x86/lib/Makefile
arch/x86/lib/pc-conf-reg.c [new file with mode: 0644]