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 | ||
19 | /** | |
20 | * struct dax_region - mapping infrastructure for dax devices | |
21 | * @id: kernel-wide unique region for a memory range | |
22 | * @base: linear address corresponding to @res | |
23 | * @kref: to pin while other agents have a need to do lookups | |
24 | * @dev: parent device backing this region | |
25 | * @align: allocation and mapping alignment for child dax devices | |
26 | * @res: physical address range of the region | |
27 | * @pfn_flags: identify whether the pfns are paged back or not | |
28 | */ | |
29 | struct dax_region { | |
30 | int id; | |
31 | struct ida ida; | |
32 | void *base; | |
33 | struct kref kref; | |
34 | struct device *dev; | |
35 | unsigned int align; | |
36 | struct resource res; | |
37 | unsigned long pfn_flags; | |
38 | }; | |
39 | ||
40 | /** | |
73616367 | 41 | * struct dev_dax - instance data for a subdivision of a dax region |
efebc711 | 42 | * @region - parent region |
73616367 DW |
43 | * @dax_dev - core dax functionality |
44 | * @dev - device core | |
efebc711 DJ |
45 | * @id - child id in the region |
46 | * @num_resources - number of physical address extents in this device | |
47 | * @res - array of physical address ranges | |
48 | */ | |
73616367 | 49 | struct dev_dax { |
efebc711 | 50 | struct dax_region *region; |
73616367 | 51 | struct dax_device *dax_dev; |
efebc711 | 52 | struct device dev; |
efebc711 DJ |
53 | int id; |
54 | int num_resources; | |
55 | struct resource res[0]; | |
56 | }; | |
57 | #endif |