Commit | Line | Data |
---|---|---|
efebc711 DJ |
1 | /* |
2 | * Copyright(c) 2016 Intel Corporation. All rights reserved. | |
3 | * | |
4 | * This program is free software; you can redistribute it and/or modify | |
5 | * it under the terms of version 2 of the GNU General Public License as | |
6 | * published by the Free Software Foundation. | |
7 | * | |
8 | * This program is distributed in the hope that it will be useful, but | |
9 | * WITHOUT ANY WARRANTY; without even the implied warranty of | |
10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
11 | * General Public License for more details. | |
12 | */ | |
13 | #ifndef __DAX_PRIVATE_H__ | |
14 | #define __DAX_PRIVATE_H__ | |
15 | ||
16 | #include <linux/device.h> | |
17 | #include <linux/cdev.h> | |
18 | ||
51cf784c DW |
19 | /* private routines between core files */ |
20 | struct dax_device; | |
21 | struct dax_device *inode_dax(struct inode *inode); | |
22 | struct inode *dax_inode(struct dax_device *dax_dev); | |
9567da0b DW |
23 | int dax_bus_init(void); |
24 | void dax_bus_exit(void); | |
51cf784c | 25 | |
efebc711 DJ |
26 | /** |
27 | * struct dax_region - mapping infrastructure for dax devices | |
28 | * @id: kernel-wide unique region for a memory range | |
efebc711 DJ |
29 | * @kref: to pin while other agents have a need to do lookups |
30 | * @dev: parent device backing this region | |
31 | * @align: allocation and mapping alignment for child dax devices | |
32 | * @res: physical address range of the region | |
33 | * @pfn_flags: identify whether the pfns are paged back or not | |
34 | */ | |
35 | struct dax_region { | |
36 | int id; | |
efebc711 DJ |
37 | struct kref kref; |
38 | struct device *dev; | |
39 | unsigned int align; | |
40 | struct resource res; | |
41 | unsigned long pfn_flags; | |
42 | }; | |
43 | ||
44 | /** | |
73616367 | 45 | * struct dev_dax - instance data for a subdivision of a dax region |
efebc711 | 46 | * @region - parent region |
73616367 DW |
47 | * @dax_dev - core dax functionality |
48 | * @dev - device core | |
efebc711 | 49 | */ |
73616367 | 50 | struct dev_dax { |
efebc711 | 51 | struct dax_region *region; |
73616367 | 52 | struct dax_device *dax_dev; |
efebc711 | 53 | struct device dev; |
efebc711 | 54 | }; |
51cf784c DW |
55 | |
56 | static inline struct dev_dax *to_dev_dax(struct device *dev) | |
57 | { | |
58 | return container_of(dev, struct dev_dax, dev); | |
59 | } | |
efebc711 | 60 | #endif |