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