xref: /openbmc/linux/drivers/scsi/cxlflash/backend.h (revision 98ddec80)
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 
15 #ifndef _CXLFLASH_BACKEND_H
16 #define _CXLFLASH_BACKEND_H
17 
18 extern const struct cxlflash_backend_ops cxlflash_cxl_ops;
19 extern const struct cxlflash_backend_ops cxlflash_ocxl_ops;
20 
21 struct cxlflash_backend_ops {
22 	struct module *module;
23 	void __iomem * (*psa_map)(void *ctx_cookie);
24 	void (*psa_unmap)(void __iomem *addr);
25 	int (*process_element)(void *ctx_cookie);
26 	int (*map_afu_irq)(void *ctx_cookie, int num, irq_handler_t handler,
27 			   void *cookie, char *name);
28 	void (*unmap_afu_irq)(void *ctx_cookie, int num, void *cookie);
29 	u64 (*get_irq_objhndl)(void *ctx_cookie, int irq);
30 	int (*start_context)(void *ctx_cookie);
31 	int (*stop_context)(void *ctx_cookie);
32 	int (*afu_reset)(void *ctx_cookie);
33 	void (*set_master)(void *ctx_cookie);
34 	void * (*get_context)(struct pci_dev *dev, void *afu_cookie);
35 	void * (*dev_context_init)(struct pci_dev *dev, void *afu_cookie);
36 	int (*release_context)(void *ctx_cookie);
37 	void (*perst_reloads_same_image)(void *afu_cookie, bool image);
38 	ssize_t (*read_adapter_vpd)(struct pci_dev *dev, void *buf,
39 				    size_t count);
40 	int (*allocate_afu_irqs)(void *ctx_cookie, int num);
41 	void (*free_afu_irqs)(void *ctx_cookie);
42 	void * (*create_afu)(struct pci_dev *dev);
43 	void (*destroy_afu)(void *afu_cookie);
44 	struct file * (*get_fd)(void *ctx_cookie, struct file_operations *fops,
45 				int *fd);
46 	void * (*fops_get_context)(struct file *file);
47 	int (*start_work)(void *ctx_cookie, u64 irqs);
48 	int (*fd_mmap)(struct file *file, struct vm_area_struct *vm);
49 	int (*fd_release)(struct inode *inode, struct file *file);
50 };
51 
52 #endif /* _CXLFLASH_BACKEND_H */
53