18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-or-later */
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * CXL Flash Device Driver
48c2ecf20Sopenharmony_ci *
58c2ecf20Sopenharmony_ci * Written by: Matthew R. Ochs <mrochs@linux.vnet.ibm.com>, IBM Corporation
68c2ecf20Sopenharmony_ci *             Uma Krishnan <ukrishn@linux.vnet.ibm.com>, IBM Corporation
78c2ecf20Sopenharmony_ci *
88c2ecf20Sopenharmony_ci * Copyright (C) 2018 IBM Corporation
98c2ecf20Sopenharmony_ci */
108c2ecf20Sopenharmony_ci
118c2ecf20Sopenharmony_ci#ifndef _CXLFLASH_BACKEND_H
128c2ecf20Sopenharmony_ci#define _CXLFLASH_BACKEND_H
138c2ecf20Sopenharmony_ci
148c2ecf20Sopenharmony_ciextern const struct cxlflash_backend_ops cxlflash_cxl_ops;
158c2ecf20Sopenharmony_ciextern const struct cxlflash_backend_ops cxlflash_ocxl_ops;
168c2ecf20Sopenharmony_ci
178c2ecf20Sopenharmony_cistruct cxlflash_backend_ops {
188c2ecf20Sopenharmony_ci	struct module *module;
198c2ecf20Sopenharmony_ci	void __iomem * (*psa_map)(void *ctx_cookie);
208c2ecf20Sopenharmony_ci	void (*psa_unmap)(void __iomem *addr);
218c2ecf20Sopenharmony_ci	int (*process_element)(void *ctx_cookie);
228c2ecf20Sopenharmony_ci	int (*map_afu_irq)(void *ctx_cookie, int num, irq_handler_t handler,
238c2ecf20Sopenharmony_ci			   void *cookie, char *name);
248c2ecf20Sopenharmony_ci	void (*unmap_afu_irq)(void *ctx_cookie, int num, void *cookie);
258c2ecf20Sopenharmony_ci	u64 (*get_irq_objhndl)(void *ctx_cookie, int irq);
268c2ecf20Sopenharmony_ci	int (*start_context)(void *ctx_cookie);
278c2ecf20Sopenharmony_ci	int (*stop_context)(void *ctx_cookie);
288c2ecf20Sopenharmony_ci	int (*afu_reset)(void *ctx_cookie);
298c2ecf20Sopenharmony_ci	void (*set_master)(void *ctx_cookie);
308c2ecf20Sopenharmony_ci	void * (*get_context)(struct pci_dev *dev, void *afu_cookie);
318c2ecf20Sopenharmony_ci	void * (*dev_context_init)(struct pci_dev *dev, void *afu_cookie);
328c2ecf20Sopenharmony_ci	int (*release_context)(void *ctx_cookie);
338c2ecf20Sopenharmony_ci	void (*perst_reloads_same_image)(void *afu_cookie, bool image);
348c2ecf20Sopenharmony_ci	ssize_t (*read_adapter_vpd)(struct pci_dev *dev, void *buf,
358c2ecf20Sopenharmony_ci				    size_t count);
368c2ecf20Sopenharmony_ci	int (*allocate_afu_irqs)(void *ctx_cookie, int num);
378c2ecf20Sopenharmony_ci	void (*free_afu_irqs)(void *ctx_cookie);
388c2ecf20Sopenharmony_ci	void * (*create_afu)(struct pci_dev *dev);
398c2ecf20Sopenharmony_ci	void (*destroy_afu)(void *afu_cookie);
408c2ecf20Sopenharmony_ci	struct file * (*get_fd)(void *ctx_cookie, struct file_operations *fops,
418c2ecf20Sopenharmony_ci				int *fd);
428c2ecf20Sopenharmony_ci	void * (*fops_get_context)(struct file *file);
438c2ecf20Sopenharmony_ci	int (*start_work)(void *ctx_cookie, u64 irqs);
448c2ecf20Sopenharmony_ci	int (*fd_mmap)(struct file *file, struct vm_area_struct *vm);
458c2ecf20Sopenharmony_ci	int (*fd_release)(struct inode *inode, struct file *file);
468c2ecf20Sopenharmony_ci};
478c2ecf20Sopenharmony_ci
488c2ecf20Sopenharmony_ci#endif /* _CXLFLASH_BACKEND_H */
49