blob: dbd077653b5c9a96d766938b85dbfe22014da336 [file] [log] [blame]
Dave Jiangefebc712017-04-07 15:33:36 -07001/*
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
Dave Jiangefebc712017-04-07 15:33:36 -070022 * @kref: to pin while other agents have a need to do lookups
23 * @dev: parent device backing this region
24 * @align: allocation and mapping alignment for child dax devices
25 * @res: physical address range of the region
26 * @pfn_flags: identify whether the pfns are paged back or not
27 */
28struct dax_region {
29 int id;
Dave Jiangefebc712017-04-07 15:33:36 -070030 struct kref kref;
31 struct device *dev;
32 unsigned int align;
33 struct resource res;
34 unsigned long pfn_flags;
35};
36
37/**
Dan Williams73616362017-05-04 23:38:43 -070038 * struct dev_dax - instance data for a subdivision of a dax region
Dave Jiangefebc712017-04-07 15:33:36 -070039 * @region - parent region
Dan Williams73616362017-05-04 23:38:43 -070040 * @dax_dev - core dax functionality
41 * @dev - device core
Dave Jiangefebc712017-04-07 15:33:36 -070042 */
Dan Williams73616362017-05-04 23:38:43 -070043struct dev_dax {
Dave Jiangefebc712017-04-07 15:33:36 -070044 struct dax_region *region;
Dan Williams73616362017-05-04 23:38:43 -070045 struct dax_device *dax_dev;
Dave Jiangefebc712017-04-07 15:33:36 -070046 struct device dev;
Dave Jiangefebc712017-04-07 15:33:36 -070047};
48#endif