| 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
| 2 | #ifndef __UM_VIRT_PCI_H |
| 3 | #define __UM_VIRT_PCI_H |
| 4 | |
| 5 | #include <linux/pci.h> |
| 6 | |
| 7 | struct um_pci_device { |
| 8 | const struct um_pci_ops *ops; |
| 9 | |
| 10 | /* for now just standard BARs */ |
| 11 | u8 resptr[PCI_STD_NUM_BARS]; |
| 12 | |
| 13 | int irq; |
| 14 | }; |
| 15 | |
| 16 | struct um_pci_ops { |
| 17 | unsigned long (*cfgspace_read)(struct um_pci_device *dev, |
| 18 | unsigned int offset, int size); |
| 19 | void (*cfgspace_write)(struct um_pci_device *dev, unsigned int offset, |
| 20 | int size, unsigned long val); |
| 21 | |
| 22 | unsigned long (*bar_read)(struct um_pci_device *dev, int bar, |
| 23 | unsigned int offset, int size); |
| 24 | void (*bar_write)(struct um_pci_device *dev, int bar, |
| 25 | unsigned int offset, int size, unsigned long val); |
| 26 | |
| 27 | void (*bar_copy_from)(struct um_pci_device *dev, int bar, void *buffer, |
| 28 | unsigned int offset, int size); |
| 29 | void (*bar_copy_to)(struct um_pci_device *dev, int bar, |
| 30 | unsigned int offset, const void *buffer, int size); |
| 31 | void (*bar_set)(struct um_pci_device *dev, int bar, |
| 32 | unsigned int offset, u8 value, int size); |
| 33 | }; |
| 34 | |
| 35 | int um_pci_device_register(struct um_pci_device *dev); |
| 36 | void um_pci_device_unregister(struct um_pci_device *dev); |
| 37 | |
| 38 | int um_pci_platform_device_register(struct um_pci_device *dev); |
| 39 | void um_pci_platform_device_unregister(struct um_pci_device *dev); |
| 40 | |
| 41 | #endif /* __UM_VIRT_PCI_H */ |
| 42 | |