blob: 395ab812367c8804615f900c8817f283a5c51665 [file] [log] [blame]
Dan Williams51cf7842017-07-12 17:58:21 -07001// 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__
5struct device;
6struct dev_dax;
7struct resource;
8struct dax_device;
9struct dax_region;
10void dax_region_put(struct dax_region *dax_region);
11struct dax_region *alloc_dax_region(struct device *parent, int region_id,
12 struct resource *res, unsigned int align, unsigned long flags);
Dan Williams89ec9f22018-10-29 15:52:42 -070013struct dev_dax *devm_create_dev_dax(struct dax_region *dax_region, int id,
14 struct dev_pagemap *pgmap);
Dan Williamsd2007812018-11-07 15:31:23 -080015
16struct dax_device_driver {
17 struct device_driver drv;
18 struct list_head ids;
19 int match_always;
20};
21
22int __dax_driver_register(struct dax_device_driver *dax_drv,
Dan Williams9567da02017-07-12 17:58:21 -070023 struct module *module, const char *mod_name);
24#define dax_driver_register(driver) \
25 __dax_driver_register(driver, THIS_MODULE, KBUILD_MODNAME)
Dan Williamsd2007812018-11-07 15:31:23 -080026void dax_driver_unregister(struct dax_device_driver *dax_drv);
Dan Williams51cf7842017-07-12 17:58:21 -070027void kill_dev_dax(struct dev_dax *dev_dax);
Dan Williams9567da02017-07-12 17:58:21 -070028
29/*
30 * While run_dax() is potentially a generic operation that could be
31 * defined in include/linux/dax.h we don't want to grow any users
32 * outside of drivers/dax/
33 */
34void run_dax(struct dax_device *dax_dev);
35
36#define MODULE_ALIAS_DAX_DEVICE(type) \
37 MODULE_ALIAS("dax:t" __stringify(type) "*")
38#define DAX_DEVICE_MODALIAS_FMT "dax:t%d"
39
Dan Williams51cf7842017-07-12 17:58:21 -070040#endif /* __DAX_BUS_H__ */