of_reserved_mem.h 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. #ifndef __OF_RESERVED_MEM_H
  2. #define __OF_RESERVED_MEM_H
  3. struct device;
  4. struct of_phandle_args;
  5. struct reserved_mem_ops;
  6. struct reserved_mem {
  7. const char *name;
  8. unsigned long fdt_node;
  9. unsigned long phandle;
  10. const struct reserved_mem_ops *ops;
  11. phys_addr_t base;
  12. phys_addr_t size;
  13. void *priv;
  14. };
  15. struct reserved_mem_ops {
  16. int (*device_init)(struct reserved_mem *rmem,
  17. struct device *dev);
  18. void (*device_release)(struct reserved_mem *rmem,
  19. struct device *dev);
  20. };
  21. typedef int (*reservedmem_of_init_fn)(struct reserved_mem *rmem);
  22. #define RESERVEDMEM_OF_DECLARE(name, compat, init) \
  23. _OF_DECLARE(reservedmem, name, compat, init, reservedmem_of_init_fn)
  24. #ifdef CONFIG_OF_RESERVED_MEM
  25. int of_reserved_mem_device_init(struct device *dev);
  26. void of_reserved_mem_device_release(struct device *dev);
  27. void fdt_init_reserved_mem(void);
  28. void fdt_reserved_mem_save_node(unsigned long node, const char *uname,
  29. phys_addr_t base, phys_addr_t size);
  30. #else
  31. static inline int of_reserved_mem_device_init(struct device *dev)
  32. {
  33. return -ENOSYS;
  34. }
  35. static inline void of_reserved_mem_device_release(struct device *pdev) { }
  36. static inline void fdt_init_reserved_mem(void) { }
  37. static inline void fdt_reserved_mem_save_node(unsigned long node,
  38. const char *uname, phys_addr_t base, phys_addr_t size) { }
  39. #endif
  40. #endif /* __OF_RESERVED_MEM_H */