backend.h 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. /*
  2. * CXL Flash Device Driver
  3. *
  4. * Written by: Matthew R. Ochs <mrochs@linux.vnet.ibm.com>, IBM Corporation
  5. * Uma Krishnan <ukrishn@linux.vnet.ibm.com>, IBM Corporation
  6. *
  7. * Copyright (C) 2018 IBM Corporation
  8. *
  9. * This program is free software; you can redistribute it and/or
  10. * modify it under the terms of the GNU General Public License
  11. * as published by the Free Software Foundation; either version
  12. * 2 of the License, or (at your option) any later version.
  13. */
  14. #ifndef _CXLFLASH_BACKEND_H
  15. #define _CXLFLASH_BACKEND_H
  16. extern const struct cxlflash_backend_ops cxlflash_cxl_ops;
  17. extern const struct cxlflash_backend_ops cxlflash_ocxl_ops;
  18. struct cxlflash_backend_ops {
  19. struct module *module;
  20. void __iomem * (*psa_map)(void *ctx_cookie);
  21. void (*psa_unmap)(void __iomem *addr);
  22. int (*process_element)(void *ctx_cookie);
  23. int (*map_afu_irq)(void *ctx_cookie, int num, irq_handler_t handler,
  24. void *cookie, char *name);
  25. void (*unmap_afu_irq)(void *ctx_cookie, int num, void *cookie);
  26. u64 (*get_irq_objhndl)(void *ctx_cookie, int irq);
  27. int (*start_context)(void *ctx_cookie);
  28. int (*stop_context)(void *ctx_cookie);
  29. int (*afu_reset)(void *ctx_cookie);
  30. void (*set_master)(void *ctx_cookie);
  31. void * (*get_context)(struct pci_dev *dev, void *afu_cookie);
  32. void * (*dev_context_init)(struct pci_dev *dev, void *afu_cookie);
  33. int (*release_context)(void *ctx_cookie);
  34. void (*perst_reloads_same_image)(void *afu_cookie, bool image);
  35. ssize_t (*read_adapter_vpd)(struct pci_dev *dev, void *buf,
  36. size_t count);
  37. int (*allocate_afu_irqs)(void *ctx_cookie, int num);
  38. void (*free_afu_irqs)(void *ctx_cookie);
  39. void * (*create_afu)(struct pci_dev *dev);
  40. void (*destroy_afu)(void *afu_cookie);
  41. struct file * (*get_fd)(void *ctx_cookie, struct file_operations *fops,
  42. int *fd);
  43. void * (*fops_get_context)(struct file *file);
  44. int (*start_work)(void *ctx_cookie, u64 irqs);
  45. int (*fd_mmap)(struct file *file, struct vm_area_struct *vm);
  46. int (*fd_release)(struct inode *inode, struct file *file);
  47. };
  48. #endif /* _CXLFLASH_BACKEND_H */