bus.h 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. // 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__
  5. #include <linux/device.h>
  6. #include <linux/range.h>
  7. struct dev_dax;
  8. struct resource;
  9. struct dax_device;
  10. struct dax_region;
  11. void dax_region_put(struct dax_region *dax_region);
  12. #define IORESOURCE_DAX_STATIC (1UL << 0)
  13. struct dax_region *alloc_dax_region(struct device *parent, int region_id,
  14. struct range *range, int target_node, unsigned int align,
  15. unsigned long flags);
  16. struct dev_dax_data {
  17. struct dax_region *dax_region;
  18. struct dev_pagemap *pgmap;
  19. resource_size_t size;
  20. int id;
  21. };
  22. struct dev_dax *devm_create_dev_dax(struct dev_dax_data *data);
  23. struct dax_device_driver {
  24. struct device_driver drv;
  25. struct list_head ids;
  26. int match_always;
  27. int (*probe)(struct dev_dax *dev);
  28. void (*remove)(struct dev_dax *dev);
  29. };
  30. int __dax_driver_register(struct dax_device_driver *dax_drv,
  31. struct module *module, const char *mod_name);
  32. #define dax_driver_register(driver) \
  33. __dax_driver_register(driver, THIS_MODULE, KBUILD_MODNAME)
  34. void dax_driver_unregister(struct dax_device_driver *dax_drv);
  35. void kill_dev_dax(struct dev_dax *dev_dax);
  36. bool static_dev_dax(struct dev_dax *dev_dax);
  37. /*
  38. * While run_dax() is potentially a generic operation that could be
  39. * defined in include/linux/dax.h we don't want to grow any users
  40. * outside of drivers/dax/
  41. */
  42. void run_dax(struct dax_device *dax_dev);
  43. #define MODULE_ALIAS_DAX_DEVICE(type) \
  44. MODULE_ALIAS("dax:t" __stringify(type) "*")
  45. #define DAX_DEVICE_MODALIAS_FMT "dax:t%d"
  46. #endif /* __DAX_BUS_H__ */