backend.h 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. /* SPDX-License-Identifier: GPL-2.0-or-later */
  2. /*
  3. * CXL Flash Device Driver
  4. *
  5. * Written by: Matthew R. Ochs <[email protected]>, IBM Corporation
  6. * Uma Krishnan <[email protected]>, IBM Corporation
  7. *
  8. * Copyright (C) 2018 IBM Corporation
  9. */
  10. #ifndef _CXLFLASH_BACKEND_H
  11. #define _CXLFLASH_BACKEND_H
  12. extern const struct cxlflash_backend_ops cxlflash_cxl_ops;
  13. extern const struct cxlflash_backend_ops cxlflash_ocxl_ops;
  14. struct cxlflash_backend_ops {
  15. struct module *module;
  16. void __iomem * (*psa_map)(void *ctx_cookie);
  17. void (*psa_unmap)(void __iomem *addr);
  18. int (*process_element)(void *ctx_cookie);
  19. int (*map_afu_irq)(void *ctx_cookie, int num, irq_handler_t handler,
  20. void *cookie, char *name);
  21. void (*unmap_afu_irq)(void *ctx_cookie, int num, void *cookie);
  22. u64 (*get_irq_objhndl)(void *ctx_cookie, int irq);
  23. int (*start_context)(void *ctx_cookie);
  24. int (*stop_context)(void *ctx_cookie);
  25. int (*afu_reset)(void *ctx_cookie);
  26. void (*set_master)(void *ctx_cookie);
  27. void * (*get_context)(struct pci_dev *dev, void *afu_cookie);
  28. void * (*dev_context_init)(struct pci_dev *dev, void *afu_cookie);
  29. int (*release_context)(void *ctx_cookie);
  30. void (*perst_reloads_same_image)(void *afu_cookie, bool image);
  31. ssize_t (*read_adapter_vpd)(struct pci_dev *dev, void *buf,
  32. size_t count);
  33. int (*allocate_afu_irqs)(void *ctx_cookie, int num);
  34. void (*free_afu_irqs)(void *ctx_cookie);
  35. void * (*create_afu)(struct pci_dev *dev);
  36. void (*destroy_afu)(void *afu_cookie);
  37. struct file * (*get_fd)(void *ctx_cookie, struct file_operations *fops,
  38. int *fd);
  39. void * (*fops_get_context)(struct file *file);
  40. int (*start_work)(void *ctx_cookie, u64 irqs);
  41. int (*fd_mmap)(struct file *file, struct vm_area_struct *vm);
  42. int (*fd_release)(struct inode *inode, struct file *file);
  43. };
  44. #endif /* _CXLFLASH_BACKEND_H */