Back to home page

OSCL-LXR

 
 

    


0001 // SPDX-License-Identifier: GPL-2.0
0002 /* Copyright(c) 2016 - 2018 Intel Corporation. All rights reserved. */
0003 #ifndef __DAX_BUS_H__
0004 #define __DAX_BUS_H__
0005 #include <linux/device.h>
0006 #include <linux/range.h>
0007 
0008 struct dev_dax;
0009 struct resource;
0010 struct dax_device;
0011 struct dax_region;
0012 void dax_region_put(struct dax_region *dax_region);
0013 
0014 #define IORESOURCE_DAX_STATIC (1UL << 0)
0015 struct dax_region *alloc_dax_region(struct device *parent, int region_id,
0016         struct range *range, int target_node, unsigned int align,
0017         unsigned long flags);
0018 
0019 struct dev_dax_data {
0020     struct dax_region *dax_region;
0021     struct dev_pagemap *pgmap;
0022     resource_size_t size;
0023     int id;
0024 };
0025 
0026 struct dev_dax *devm_create_dev_dax(struct dev_dax_data *data);
0027 
0028 struct dax_device_driver {
0029     struct device_driver drv;
0030     struct list_head ids;
0031     int match_always;
0032     int (*probe)(struct dev_dax *dev);
0033     void (*remove)(struct dev_dax *dev);
0034 };
0035 
0036 int __dax_driver_register(struct dax_device_driver *dax_drv,
0037         struct module *module, const char *mod_name);
0038 #define dax_driver_register(driver) \
0039     __dax_driver_register(driver, THIS_MODULE, KBUILD_MODNAME)
0040 void dax_driver_unregister(struct dax_device_driver *dax_drv);
0041 void kill_dev_dax(struct dev_dax *dev_dax);
0042 bool static_dev_dax(struct dev_dax *dev_dax);
0043 
0044 /*
0045  * While run_dax() is potentially a generic operation that could be
0046  * defined in include/linux/dax.h we don't want to grow any users
0047  * outside of drivers/dax/
0048  */
0049 void run_dax(struct dax_device *dax_dev);
0050 
0051 #define MODULE_ALIAS_DAX_DEVICE(type) \
0052     MODULE_ALIAS("dax:t" __stringify(type) "*")
0053 #define DAX_DEVICE_MODALIAS_FMT "dax:t%d"
0054 
0055 #endif /* __DAX_BUS_H__ */