linux/arch/unicore32/include/asm/io.h
Mauro Carvalho Chehab 7d3d3254ad docs: fix pointers to io-mapping.rst and io_ordering.rst files
Those files got moved, but cross-references still point to the
wrong places.

Fixes: fcd6807271 ("Documentation: Add io-mapping.rst to driver-api manual")
Fixes: d1ce350015 ("Documentation: Add io_ordering.rst to driver-api manual")
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Reviewed-by: Alex Shi <alex.shi@linux.alibaba.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/c0205119db4fef536272cb0a183b6c14c2c8bf4c.1583927470.git.mchehab+huawei@kernel.org
Signed-off-by: Jonathan Corbet <corbet@lwn.net>
2020-03-11 14:15:20 -06:00

70 lines
1.6 KiB
C

/* SPDX-License-Identifier: GPL-2.0-only */
/*
* linux/arch/unicore32/include/asm/io.h
*
* Code specific to PKUnity SoC and UniCore ISA
*
* Copyright (C) 2001-2010 GUAN Xue-tao
*/
#ifndef __UNICORE_IO_H__
#define __UNICORE_IO_H__
#ifdef __KERNEL__
#include <asm/byteorder.h>
#include <asm/memory.h>
#define PCI_IOBASE PKUNITY_PCILIO_BASE
#include <asm-generic/io.h>
/*
* __uc32_ioremap takes CPU physical address.
*/
extern void __iomem *__uc32_ioremap(unsigned long, size_t);
extern void __uc32_iounmap(volatile void __iomem *addr);
/*
* ioremap and friends.
*
* ioremap takes a PCI memory address, as specified in
* Documentation/driver-api/io-mapping.rst.
*
*/
#define ioremap(cookie, size) __uc32_ioremap(cookie, size)
#define iounmap(cookie) __uc32_iounmap(cookie)
#define readb_relaxed readb
#define readw_relaxed readw
#define readl_relaxed readl
#define HAVE_ARCH_PIO_SIZE
#define PIO_OFFSET (unsigned int)(PCI_IOBASE)
#define PIO_MASK (unsigned int)(IO_SPACE_LIMIT)
#define PIO_RESERVED (PIO_OFFSET + PIO_MASK + 1)
#ifdef CONFIG_STRICT_DEVMEM
#include <linux/ioport.h>
#include <linux/mm.h>
/*
* devmem_is_allowed() checks to see if /dev/mem access to a certain
* address is valid. The argument is a physical page number.
* We mimic x86 here by disallowing access to system RAM as well as
* device-exclusive MMIO regions. This effectively disable read()/write()
* on /dev/mem.
*/
static inline int devmem_is_allowed(unsigned long pfn)
{
if (iomem_is_exclusive(pfn << PAGE_SHIFT))
return 0;
if (!page_is_ram(pfn))
return 1;
return 0;
}
#endif /* CONFIG_STRICT_DEVMEM */
#endif /* __KERNEL__ */
#endif /* __UNICORE_IO_H__ */