~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/include/linux/logic_pio.h

Version: ~ [ linux-6.11.5 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.58 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.114 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.169 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.228 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.284 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.322 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 // SPDX-License-Identifier: GPL-2.0+
  2 /*
  3  * Copyright (C) 2017 HiSilicon Limited, All Rights Reserved.
  4  * Author: Gabriele Paoloni <gabriele.paoloni@huawei.com>
  5  * Author: Zhichang Yuan <yuanzhichang@hisilicon.com>
  6  */
  7 
  8 #ifndef __LINUX_LOGIC_PIO_H
  9 #define __LINUX_LOGIC_PIO_H
 10 
 11 #include <linux/fwnode.h>
 12 
 13 enum {
 14         LOGIC_PIO_INDIRECT,             /* Indirect IO flag */
 15         LOGIC_PIO_CPU_MMIO,             /* Memory-mapped IO flag */
 16 };
 17 
 18 struct logic_pio_hwaddr {
 19         struct list_head list;
 20         struct fwnode_handle *fwnode;
 21         resource_size_t hw_start;
 22         resource_size_t io_start;
 23         resource_size_t size; /* range size populated */
 24         unsigned long flags;
 25 
 26         void *hostdata;
 27         const struct logic_pio_host_ops *ops;
 28 };
 29 
 30 struct logic_pio_host_ops {
 31         u32 (*in)(void *hostdata, unsigned long addr, size_t dwidth);
 32         void (*out)(void *hostdata, unsigned long addr, u32 val,
 33                     size_t dwidth);
 34         u32 (*ins)(void *hostdata, unsigned long addr, void *buffer,
 35                    size_t dwidth, unsigned int count);
 36         void (*outs)(void *hostdata, unsigned long addr, const void *buffer,
 37                      size_t dwidth, unsigned int count);
 38 };
 39 
 40 #ifdef CONFIG_INDIRECT_PIO
 41 u8 logic_inb(unsigned long addr);
 42 u16 logic_inw(unsigned long addr);
 43 u32 logic_inl(unsigned long addr);
 44 void logic_outb(u8 value, unsigned long addr);
 45 void logic_outw(u16 value, unsigned long addr);
 46 void logic_outl(u32 value, unsigned long addr);
 47 void logic_insb(unsigned long addr, void *buffer, unsigned int count);
 48 void logic_insl(unsigned long addr, void *buffer, unsigned int count);
 49 void logic_insw(unsigned long addr, void *buffer, unsigned int count);
 50 void logic_outsb(unsigned long addr, const void *buffer, unsigned int count);
 51 void logic_outsw(unsigned long addr, const void *buffer, unsigned int count);
 52 void logic_outsl(unsigned long addr, const void *buffer, unsigned int count);
 53 
 54 #ifndef inb
 55 #define inb logic_inb
 56 #endif
 57 
 58 #ifndef inw
 59 #define inw logic_inw
 60 #endif
 61 
 62 #ifndef inl
 63 #define inl logic_inl
 64 #endif
 65 
 66 #ifndef outb
 67 #define outb logic_outb
 68 #endif
 69 
 70 #ifndef outw
 71 #define outw logic_outw
 72 #endif
 73 
 74 #ifndef outl
 75 #define outl logic_outl
 76 #endif
 77 
 78 #ifndef insb
 79 #define insb logic_insb
 80 #endif
 81 
 82 #ifndef insw
 83 #define insw logic_insw
 84 #endif
 85 
 86 #ifndef insl
 87 #define insl logic_insl
 88 #endif
 89 
 90 #ifndef outsb
 91 #define outsb logic_outsb
 92 #endif
 93 
 94 #ifndef outsw
 95 #define outsw logic_outsw
 96 #endif
 97 
 98 #ifndef outsl
 99 #define outsl logic_outsl
100 #endif
101 
102 /*
103  * We reserve 0x4000 bytes for Indirect IO as so far this library is only
104  * used by the HiSilicon LPC Host. If needed, we can reserve a wider IO
105  * area by redefining the macro below.
106  */
107 #define PIO_INDIRECT_SIZE 0x4000
108 #else
109 #define PIO_INDIRECT_SIZE 0
110 #endif /* CONFIG_INDIRECT_PIO */
111 #define MMIO_UPPER_LIMIT (IO_SPACE_LIMIT - PIO_INDIRECT_SIZE)
112 
113 struct logic_pio_hwaddr *find_io_range_by_fwnode(struct fwnode_handle *fwnode);
114 unsigned long logic_pio_trans_hwaddr(struct fwnode_handle *fwnode,
115                         resource_size_t hw_addr, resource_size_t size);
116 int logic_pio_register_range(struct logic_pio_hwaddr *newrange);
117 void logic_pio_unregister_range(struct logic_pio_hwaddr *range);
118 resource_size_t logic_pio_to_hwaddr(unsigned long pio);
119 unsigned long logic_pio_trans_cpuaddr(resource_size_t hw_addr);
120 
121 #endif /* __LINUX_LOGIC_PIO_H */
122 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php