2014-02-28 21:42:48 +08:00
|
|
|
#ifndef __OF_RESERVED_MEM_H
|
|
|
|
#define __OF_RESERVED_MEM_H
|
|
|
|
|
2014-02-28 21:42:49 +08:00
|
|
|
struct device;
|
|
|
|
struct of_phandle_args;
|
|
|
|
struct reserved_mem_ops;
|
|
|
|
|
2014-02-28 21:42:48 +08:00
|
|
|
struct reserved_mem {
|
|
|
|
const char *name;
|
|
|
|
unsigned long fdt_node;
|
2014-07-14 16:28:04 +08:00
|
|
|
unsigned long phandle;
|
2014-02-28 21:42:49 +08:00
|
|
|
const struct reserved_mem_ops *ops;
|
2014-02-28 21:42:48 +08:00
|
|
|
phys_addr_t base;
|
|
|
|
phys_addr_t size;
|
2014-02-28 21:42:49 +08:00
|
|
|
void *priv;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct reserved_mem_ops {
|
2014-10-30 05:50:29 +08:00
|
|
|
int (*device_init)(struct reserved_mem *rmem,
|
2014-02-28 21:42:49 +08:00
|
|
|
struct device *dev);
|
|
|
|
void (*device_release)(struct reserved_mem *rmem,
|
|
|
|
struct device *dev);
|
2014-02-28 21:42:48 +08:00
|
|
|
};
|
|
|
|
|
2014-05-09 05:06:17 +08:00
|
|
|
typedef int (*reservedmem_of_init_fn)(struct reserved_mem *rmem);
|
|
|
|
|
2014-05-09 05:09:24 +08:00
|
|
|
#define RESERVEDMEM_OF_DECLARE(name, compat, init) \
|
|
|
|
_OF_DECLARE(reservedmem, name, compat, init, reservedmem_of_init_fn)
|
2014-02-28 21:42:49 +08:00
|
|
|
|
2014-02-28 21:42:48 +08:00
|
|
|
#ifdef CONFIG_OF_RESERVED_MEM
|
2014-10-30 05:50:29 +08:00
|
|
|
int of_reserved_mem_device_init(struct device *dev);
|
2014-07-14 16:28:04 +08:00
|
|
|
void of_reserved_mem_device_release(struct device *dev);
|
|
|
|
|
2014-02-28 21:42:48 +08:00
|
|
|
void fdt_init_reserved_mem(void);
|
|
|
|
void fdt_reserved_mem_save_node(unsigned long node, const char *uname,
|
|
|
|
phys_addr_t base, phys_addr_t size);
|
|
|
|
#else
|
2014-10-30 05:50:29 +08:00
|
|
|
static inline int of_reserved_mem_device_init(struct device *dev)
|
|
|
|
{
|
|
|
|
return -ENOSYS;
|
|
|
|
}
|
2014-07-14 16:28:04 +08:00
|
|
|
static inline void of_reserved_mem_device_release(struct device *pdev) { }
|
|
|
|
|
2014-02-28 21:42:48 +08:00
|
|
|
static inline void fdt_init_reserved_mem(void) { }
|
|
|
|
static inline void fdt_reserved_mem_save_node(unsigned long node,
|
|
|
|
const char *uname, phys_addr_t base, phys_addr_t size) { }
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif /* __OF_RESERVED_MEM_H */
|