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