dax-private.h 1.7 KB

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