162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-or-later */
262306a36Sopenharmony_ci/*
362306a36Sopenharmony_ci * CXL Flash Device Driver
462306a36Sopenharmony_ci *
562306a36Sopenharmony_ci * Written by: Matthew R. Ochs <mrochs@linux.vnet.ibm.com>, IBM Corporation
662306a36Sopenharmony_ci *             Uma Krishnan <ukrishn@linux.vnet.ibm.com>, IBM Corporation
762306a36Sopenharmony_ci *
862306a36Sopenharmony_ci * Copyright (C) 2018 IBM Corporation
962306a36Sopenharmony_ci */
1062306a36Sopenharmony_ci
1162306a36Sopenharmony_ci#ifndef _CXLFLASH_BACKEND_H
1262306a36Sopenharmony_ci#define _CXLFLASH_BACKEND_H
1362306a36Sopenharmony_ci
1462306a36Sopenharmony_ciextern const struct cxlflash_backend_ops cxlflash_cxl_ops;
1562306a36Sopenharmony_ciextern const struct cxlflash_backend_ops cxlflash_ocxl_ops;
1662306a36Sopenharmony_ci
1762306a36Sopenharmony_cistruct cxlflash_backend_ops {
1862306a36Sopenharmony_ci	struct module *module;
1962306a36Sopenharmony_ci	void __iomem * (*psa_map)(void *ctx_cookie);
2062306a36Sopenharmony_ci	void (*psa_unmap)(void __iomem *addr);
2162306a36Sopenharmony_ci	int (*process_element)(void *ctx_cookie);
2262306a36Sopenharmony_ci	int (*map_afu_irq)(void *ctx_cookie, int num, irq_handler_t handler,
2362306a36Sopenharmony_ci			   void *cookie, char *name);
2462306a36Sopenharmony_ci	void (*unmap_afu_irq)(void *ctx_cookie, int num, void *cookie);
2562306a36Sopenharmony_ci	u64 (*get_irq_objhndl)(void *ctx_cookie, int irq);
2662306a36Sopenharmony_ci	int (*start_context)(void *ctx_cookie);
2762306a36Sopenharmony_ci	int (*stop_context)(void *ctx_cookie);
2862306a36Sopenharmony_ci	int (*afu_reset)(void *ctx_cookie);
2962306a36Sopenharmony_ci	void (*set_master)(void *ctx_cookie);
3062306a36Sopenharmony_ci	void * (*get_context)(struct pci_dev *dev, void *afu_cookie);
3162306a36Sopenharmony_ci	void * (*dev_context_init)(struct pci_dev *dev, void *afu_cookie);
3262306a36Sopenharmony_ci	int (*release_context)(void *ctx_cookie);
3362306a36Sopenharmony_ci	void (*perst_reloads_same_image)(void *afu_cookie, bool image);
3462306a36Sopenharmony_ci	ssize_t (*read_adapter_vpd)(struct pci_dev *dev, void *buf,
3562306a36Sopenharmony_ci				    size_t count);
3662306a36Sopenharmony_ci	int (*allocate_afu_irqs)(void *ctx_cookie, int num);
3762306a36Sopenharmony_ci	void (*free_afu_irqs)(void *ctx_cookie);
3862306a36Sopenharmony_ci	void * (*create_afu)(struct pci_dev *dev);
3962306a36Sopenharmony_ci	void (*destroy_afu)(void *afu_cookie);
4062306a36Sopenharmony_ci	struct file * (*get_fd)(void *ctx_cookie, struct file_operations *fops,
4162306a36Sopenharmony_ci				int *fd);
4262306a36Sopenharmony_ci	void * (*fops_get_context)(struct file *file);
4362306a36Sopenharmony_ci	int (*start_work)(void *ctx_cookie, u64 irqs);
4462306a36Sopenharmony_ci	int (*fd_mmap)(struct file *file, struct vm_area_struct *vm);
4562306a36Sopenharmony_ci	int (*fd_release)(struct inode *inode, struct file *file);
4662306a36Sopenharmony_ci};
4762306a36Sopenharmony_ci
4862306a36Sopenharmony_ci#endif /* _CXLFLASH_BACKEND_H */
49