]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commit
lib: Add generic PIO mapping method
authorZhichang Yuan <yuanzhichang@hisilicon.com>
Wed, 14 Mar 2018 18:15:50 +0000 (02:15 +0800)
committerSeth Forshee <seth.forshee@canonical.com>
Tue, 10 Apr 2018 17:36:38 +0000 (12:36 -0500)
commitb31ee35b3a7da350022aaaedc4ada7fe6c714530
treea481894243309e145deb81ee79940de263355163
parent22541fd2efba8b256d9d5edf095381b29975f3e9
lib: Add generic PIO mapping method

BugLink: https://bugs.launchpad.net/bugs/1762758
41f8bba7f555 ("of/pci: Add pci_register_io_range() and
pci_pio_to_address()") added support for PCI I/O space mapped into CPU
physical memory space.  With that support, the I/O ranges configured for
PCI/PCIe hosts on some architectures can be mapped to logical PIO and
converted easily between CPU address and the corresponding logical PIO.
Based on this, PCI I/O port space can be accessed via in/out accessors that
use memory read/write.

But on some platforms, there are bus hosts that access I/O port space with
host-local I/O port addresses rather than memory addresses.

Add a more generic I/O mapping method to support those devices.  With this
patch, both the CPU addresses and the host-local port can be mapped into
the logical PIO space with different logical/fake PIOs.  After this, all
the I/O accesses to either PCI MMIO devices or host-local I/O peripherals
can be unified into the existing I/O accessors defined in asm-generic/io.h
and be redirected to the right device-specific hooks based on the input
logical PIO.

Tested-by: dann frazier <dann.frazier@canonical.com>
Signed-off-by: Zhichang Yuan <yuanzhichang@hisilicon.com>
Signed-off-by: Gabriele Paoloni <gabriele.paoloni@huawei.com>
Signed-off-by: John Garry <john.garry@huawei.com>
[bhelgaas: remove -EFAULT return from logic_pio_register_range() per
https://lkml.kernel.org/r/20180403143909.GA21171@ulmo, fix NULL pointer
checking per https://lkml.kernel.org/r/20180403211505.GA29612@embeddedor.com]
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
(cherry picked from commit 031e3601869c815582ca1d49d1ff73de58e446b0)
Signed-off-by: dann frazier <dann.frazier@canonical.com>
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
include/asm-generic/io.h
include/linux/logic_pio.h [new file with mode: 0644]
lib/Kconfig
lib/Makefile
lib/logic_pio.c [new file with mode: 0644]