Commit | Line | Data |
---|---|---|
51cf784c DW |
1 | // SPDX-License-Identifier: GPL-2.0 |
2 | /* Copyright(c) 2016 - 2018 Intel Corporation. All rights reserved. */ | |
3 | #ifndef __DAX_BUS_H__ | |
4 | #define __DAX_BUS_H__ | |
730926c3 | 5 | #include <linux/device.h> |
f5516ec5 | 6 | #include <linux/range.h> |
730926c3 | 7 | |
51cf784c DW |
8 | struct dev_dax; |
9 | struct resource; | |
10 | struct dax_device; | |
11 | struct dax_region; | |
c2f3011e | 12 | |
e9ee9fe3 DW |
13 | /* dax bus specific ioresource flags */ |
14 | #define IORESOURCE_DAX_STATIC BIT(0) | |
15 | #define IORESOURCE_DAX_KMEM BIT(1) | |
16 | ||
51cf784c | 17 | struct dax_region *alloc_dax_region(struct device *parent, int region_id, |
a4574f63 | 18 | struct range *range, int target_node, unsigned int align, |
c2f3011e | 19 | unsigned long flags); |
730926c3 | 20 | |
174ebece DW |
21 | struct dev_dax_data { |
22 | struct dax_region *dax_region; | |
23 | struct dev_pagemap *pgmap; | |
c2f3011e | 24 | resource_size_t size; |
174ebece | 25 | int id; |
4eca0ef4 | 26 | bool memmap_on_memory; |
174ebece | 27 | }; |
730926c3 | 28 | |
174ebece | 29 | struct dev_dax *devm_create_dev_dax(struct dev_dax_data *data); |
730926c3 | 30 | |
e9ee9fe3 DW |
31 | enum dax_driver_type { |
32 | DAXDRV_KMEM_TYPE, | |
33 | DAXDRV_DEVICE_TYPE, | |
34 | }; | |
35 | ||
d200781e DW |
36 | struct dax_device_driver { |
37 | struct device_driver drv; | |
38 | struct list_head ids; | |
e9ee9fe3 | 39 | enum dax_driver_type type; |
f11cf813 | 40 | int (*probe)(struct dev_dax *dev); |
0d519e0d | 41 | void (*remove)(struct dev_dax *dev); |
d200781e DW |
42 | }; |
43 | ||
44 | int __dax_driver_register(struct dax_device_driver *dax_drv, | |
9567da0b DW |
45 | struct module *module, const char *mod_name); |
46 | #define dax_driver_register(driver) \ | |
47 | __dax_driver_register(driver, THIS_MODULE, KBUILD_MODNAME) | |
d200781e | 48 | void dax_driver_unregister(struct dax_device_driver *dax_drv); |
51cf784c | 49 | void kill_dev_dax(struct dev_dax *dev_dax); |
fc65c4eb | 50 | bool static_dev_dax(struct dev_dax *dev_dax); |
9567da0b | 51 | |
9567da0b DW |
52 | #define MODULE_ALIAS_DAX_DEVICE(type) \ |
53 | MODULE_ALIAS("dax:t" __stringify(type) "*") | |
54 | #define DAX_DEVICE_MODALIAS_FMT "dax:t%d" | |
55 | ||
51cf784c | 56 | #endif /* __DAX_BUS_H__ */ |