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