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

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

Version: ~ [ linux-6.11-rc3 ] ~ [ linux-6.10.4 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.45 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.104 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.164 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.223 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.281 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.319 ] ~ [ 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 #ifndef __OF_RESERVED_MEM_H
  3 #define __OF_RESERVED_MEM_H
  4 
  5 #include <linux/device.h>
  6 #include <linux/of.h>
  7 
  8 struct of_phandle_args;
  9 struct reserved_mem_ops;
 10 
 11 struct reserved_mem {
 12         const char                      *name;
 13         unsigned long                   fdt_node;
 14         const struct reserved_mem_ops   *ops;
 15         phys_addr_t                     base;
 16         phys_addr_t                     size;
 17         void                            *priv;
 18 };
 19 
 20 struct reserved_mem_ops {
 21         int     (*device_init)(struct reserved_mem *rmem,
 22                                struct device *dev);
 23         void    (*device_release)(struct reserved_mem *rmem,
 24                                   struct device *dev);
 25 };
 26 
 27 typedef int (*reservedmem_of_init_fn)(struct reserved_mem *rmem);
 28 
 29 #ifdef CONFIG_OF_RESERVED_MEM
 30 
 31 #define RESERVEDMEM_OF_DECLARE(name, compat, init)                      \
 32         _OF_DECLARE(reservedmem, name, compat, init, reservedmem_of_init_fn)
 33 
 34 int of_reserved_mem_device_init_by_idx(struct device *dev,
 35                                        struct device_node *np, int idx);
 36 int of_reserved_mem_device_init_by_name(struct device *dev,
 37                                         struct device_node *np,
 38                                         const char *name);
 39 void of_reserved_mem_device_release(struct device *dev);
 40 
 41 struct reserved_mem *of_reserved_mem_lookup(struct device_node *np);
 42 #else
 43 
 44 #define RESERVEDMEM_OF_DECLARE(name, compat, init)                      \
 45         _OF_DECLARE_STUB(reservedmem, name, compat, init, reservedmem_of_init_fn)
 46 
 47 static inline int of_reserved_mem_device_init_by_idx(struct device *dev,
 48                                         struct device_node *np, int idx)
 49 {
 50         return -ENOSYS;
 51 }
 52 
 53 static inline int of_reserved_mem_device_init_by_name(struct device *dev,
 54                                                       struct device_node *np,
 55                                                       const char *name)
 56 {
 57         return -ENOSYS;
 58 }
 59 
 60 static inline void of_reserved_mem_device_release(struct device *pdev) { }
 61 
 62 static inline struct reserved_mem *of_reserved_mem_lookup(struct device_node *np)
 63 {
 64         return NULL;
 65 }
 66 #endif
 67 
 68 /**
 69  * of_reserved_mem_device_init() - assign reserved memory region to given device
 70  * @dev:        Pointer to the device to configure
 71  *
 72  * This function assigns respective DMA-mapping operations based on the first
 73  * reserved memory region specified by 'memory-region' property in device tree
 74  * node of the given device.
 75  *
 76  * Returns error code or zero on success.
 77  */
 78 static inline int of_reserved_mem_device_init(struct device *dev)
 79 {
 80         return of_reserved_mem_device_init_by_idx(dev, dev->of_node, 0);
 81 }
 82 
 83 #endif /* __OF_RESERVED_MEM_H */
 84 

~ [ 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