Blame view
include/asm-generic/iomap.h
4 KB
b24413180
|
1 |
/* SPDX-License-Identifier: GPL-2.0 */ |
1da177e4c
|
2 3 4 5 |
#ifndef __GENERIC_IO_H #define __GENERIC_IO_H #include <linux/linkage.h> |
dae409a27
|
6 |
#include <asm/byteorder.h> |
1da177e4c
|
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
/* * These are the "generic" interfaces for doing new-style * memory-mapped or PIO accesses. Architectures may do * their own arch-optimized versions, these just act as * wrappers around the old-style IO register access functions: * read[bwl]/write[bwl]/in[bwl]/out[bwl] * * Don't include this directly, include it from <asm/io.h>. */ /* * Read/write from/to an (offsettable) iomem cookie. It might be a PIO * access or a MMIO access, these functions don't care. The info is * encoded in the hardware mapping set up by the mapping functions * (or the cookie itself, depending on implementation and hw). * * The generic routines just encode the PIO/MMIO as part of the * cookie, and coldly assume that the MMIO IO mappings are not * in the low address range. Architectures for which this is not * true can't use this generic implementation. */ |
8f28ca6bd
|
29 30 31 32 33 |
extern unsigned int ioread8(const void __iomem *); extern unsigned int ioread16(const void __iomem *); extern unsigned int ioread16be(const void __iomem *); extern unsigned int ioread32(const void __iomem *); extern unsigned int ioread32be(const void __iomem *); |
9e44fb181
|
34 |
#ifdef CONFIG_64BIT |
8f28ca6bd
|
35 36 |
extern u64 ioread64(const void __iomem *); extern u64 ioread64be(const void __iomem *); |
9e44fb181
|
37 |
#endif |
1da177e4c
|
38 |
|
79bf0cbd8
|
39 40 41 42 43 |
#ifdef readq #define ioread64_lo_hi ioread64_lo_hi #define ioread64_hi_lo ioread64_hi_lo #define ioread64be_lo_hi ioread64be_lo_hi #define ioread64be_hi_lo ioread64be_hi_lo |
8f28ca6bd
|
44 45 46 47 |
extern u64 ioread64_lo_hi(const void __iomem *addr); extern u64 ioread64_hi_lo(const void __iomem *addr); extern u64 ioread64be_lo_hi(const void __iomem *addr); extern u64 ioread64be_hi_lo(const void __iomem *addr); |
79bf0cbd8
|
48 |
#endif |
144b2a914
|
49 50 51 52 53 |
extern void iowrite8(u8, void __iomem *); extern void iowrite16(u16, void __iomem *); extern void iowrite16be(u16, void __iomem *); extern void iowrite32(u32, void __iomem *); extern void iowrite32be(u32, void __iomem *); |
9e44fb181
|
54 55 56 57 |
#ifdef CONFIG_64BIT extern void iowrite64(u64, void __iomem *); extern void iowrite64be(u64, void __iomem *); #endif |
1da177e4c
|
58 |
|
79bf0cbd8
|
59 60 61 62 63 64 65 66 67 68 |
#ifdef writeq #define iowrite64_lo_hi iowrite64_lo_hi #define iowrite64_hi_lo iowrite64_hi_lo #define iowrite64be_lo_hi iowrite64be_lo_hi #define iowrite64be_hi_lo iowrite64be_hi_lo extern void iowrite64_lo_hi(u64 val, void __iomem *addr); extern void iowrite64_hi_lo(u64 val, void __iomem *addr); extern void iowrite64be_lo_hi(u64 val, void __iomem *addr); extern void iowrite64be_hi_lo(u64 val, void __iomem *addr); #endif |
1da177e4c
|
69 70 71 72 73 74 75 76 77 78 79 |
/* * "string" versions of the above. Note that they * use native byte ordering for the accesses (on * the assumption that IO and memory agree on a * byte order, and CPU byteorder is irrelevant). * * They do _not_ update the port address. If you * want MMIO that copies stuff laid out in MMIO * memory across multiple ports, use "memcpy_toio()" * and friends. */ |
8f28ca6bd
|
80 81 82 |
extern void ioread8_rep(const void __iomem *port, void *buf, unsigned long count); extern void ioread16_rep(const void __iomem *port, void *buf, unsigned long count); extern void ioread32_rep(const void __iomem *port, void *buf, unsigned long count); |
1da177e4c
|
83 |
|
144b2a914
|
84 85 86 |
extern void iowrite8_rep(void __iomem *port, const void *buf, unsigned long count); extern void iowrite16_rep(void __iomem *port, const void *buf, unsigned long count); extern void iowrite32_rep(void __iomem *port, const void *buf, unsigned long count); |
1da177e4c
|
87 |
|
ce816fa88
|
88 |
#ifdef CONFIG_HAS_IOPORT_MAP |
1da177e4c
|
89 90 91 |
/* Create a virtual mapping cookie for an IO port range */ extern void __iomem *ioport_map(unsigned long port, unsigned int nr); extern void ioport_unmap(void __iomem *); |
82ed223c2
|
92 |
#endif |
1da177e4c
|
93 |
|
1526a756f
|
94 |
#ifndef ARCH_HAS_IOREMAP_WC |
4bdc0d676
|
95 |
#define ioremap_wc ioremap |
1526a756f
|
96 |
#endif |
d838270e2
|
97 |
#ifndef ARCH_HAS_IOREMAP_WT |
4bdc0d676
|
98 |
#define ioremap_wt ioremap |
d838270e2
|
99 |
#endif |
82ed223c2
|
100 |
#ifdef CONFIG_PCI |
66eab4df2
|
101 |
/* Destroy a virtual mapping cookie for a PCI BAR (memory or IO) */ |
1da177e4c
|
102 |
struct pci_dev; |
1da177e4c
|
103 |
extern void pci_iounmap(struct pci_dev *dev, void __iomem *); |
97a29d59f
|
104 |
#elif defined(CONFIG_GENERIC_IOMAP) |
fea80311a
|
105 |
struct pci_dev; |
fea80311a
|
106 107 |
static inline void pci_iounmap(struct pci_dev *dev, void __iomem *addr) { } |
82ed223c2
|
108 |
#endif |
1da177e4c
|
109 |
|
66eab4df2
|
110 |
#include <asm-generic/pci_iomap.h> |
1da177e4c
|
111 |
#endif |