Commit | Line | Data |
---|---|---|
9476df7d DW |
1 | #ifndef _LINUX_MEMREMAP_H_ |
2 | #define _LINUX_MEMREMAP_H_ | |
3 | #include <linux/mm.h> | |
4 | ||
5 | struct resource; | |
6 | struct device; | |
7 | /** | |
8 | * struct dev_pagemap - metadata for ZONE_DEVICE mappings | |
9 | * @dev: host device of the mapping for debug | |
10 | */ | |
11 | struct dev_pagemap { | |
12 | /* TODO: vmem_altmap and percpu_ref count */ | |
13 | struct device *dev; | |
14 | }; | |
15 | ||
16 | #ifdef CONFIG_ZONE_DEVICE | |
17 | void *devm_memremap_pages(struct device *dev, struct resource *res); | |
18 | struct dev_pagemap *find_dev_pagemap(resource_size_t phys); | |
19 | #else | |
20 | static inline void *devm_memremap_pages(struct device *dev, | |
21 | struct resource *res) | |
22 | { | |
23 | /* | |
24 | * Fail attempts to call devm_memremap_pages() without | |
25 | * ZONE_DEVICE support enabled, this requires callers to fall | |
26 | * back to plain devm_memremap() based on config | |
27 | */ | |
28 | WARN_ON_ONCE(1); | |
29 | return ERR_PTR(-ENXIO); | |
30 | } | |
31 | ||
32 | static inline struct dev_pagemap *find_dev_pagemap(resource_size_t phys) | |
33 | { | |
34 | return NULL; | |
35 | } | |
36 | #endif | |
37 | ||
38 | #endif /* _LINUX_MEMREMAP_H_ */ |