pciback.h (0513fe9e5b54e47e37217ea078dd870e3825e02d) | pciback.h (a92336a1176b2119eaa990a1e8bf3109665fdbc6) |
---|---|
1/* 2 * PCI Backend Common Data Structures & Function Declarations 3 * 4 * Author: Ryan Wilson <hap9@epoch.ncsc.mil> 5 */ 6#ifndef __XEN_PCIBACK_H__ 7#define __XEN_PCIBACK_H__ 8 --- 11 unchanged lines hidden (view full) --- 20 struct pci_dev *dev; 21}; 22 23#define _PDEVF_op_active (0) 24#define PDEVF_op_active (1<<(_PDEVF_op_active)) 25#define _PCIB_op_pending (1) 26#define PCIB_op_pending (1<<(_PCIB_op_pending)) 27 | 1/* 2 * PCI Backend Common Data Structures & Function Declarations 3 * 4 * Author: Ryan Wilson <hap9@epoch.ncsc.mil> 5 */ 6#ifndef __XEN_PCIBACK_H__ 7#define __XEN_PCIBACK_H__ 8 --- 11 unchanged lines hidden (view full) --- 20 struct pci_dev *dev; 21}; 22 23#define _PDEVF_op_active (0) 24#define PDEVF_op_active (1<<(_PDEVF_op_active)) 25#define _PCIB_op_pending (1) 26#define PCIB_op_pending (1<<(_PCIB_op_pending)) 27 |
28struct pciback_device { | 28struct xen_pcibk_device { |
29 void *pci_dev_data; 30 spinlock_t dev_lock; | 29 void *pci_dev_data; 30 spinlock_t dev_lock; |
31 | |
32 struct xenbus_device *xdev; | 31 struct xenbus_device *xdev; |
33 | |
34 struct xenbus_watch be_watch; 35 u8 be_watching; | 32 struct xenbus_watch be_watch; 33 u8 be_watching; |
36 | |
37 int evtchn_irq; | 34 int evtchn_irq; |
38 | |
39 struct xen_pci_sharedinfo *sh_info; | 35 struct xen_pci_sharedinfo *sh_info; |
40 | |
41 unsigned long flags; | 36 unsigned long flags; |
42 | |
43 struct work_struct op_work; 44}; 45 | 37 struct work_struct op_work; 38}; 39 |
46struct pciback_dev_data { | 40struct xen_pcibk_dev_data { |
47 struct list_head config_fields; 48 unsigned int permissive:1; 49 unsigned int warned_on_write:1; 50 unsigned int enable_intx:1; 51 unsigned int isr_on:1; /* Whether the IRQ handler is installed. */ 52 unsigned int ack_intr:1; /* .. and ACK-ing */ 53 unsigned long handled; 54 unsigned int irq; /* Saved in case device transitions to MSI/MSI-X */ | 41 struct list_head config_fields; 42 unsigned int permissive:1; 43 unsigned int warned_on_write:1; 44 unsigned int enable_intx:1; 45 unsigned int isr_on:1; /* Whether the IRQ handler is installed. */ 46 unsigned int ack_intr:1; /* .. and ACK-ing */ 47 unsigned long handled; 48 unsigned int irq; /* Saved in case device transitions to MSI/MSI-X */ |
55 char irq_name[0]; /* pciback[000:04:00.0] */ | 49 char irq_name[0]; /* xen-pcibk[000:04:00.0] */ |
56}; 57 | 50}; 51 |
58/* Used by XenBus and pciback_ops.c */ 59extern wait_queue_head_t aer_wait_queue; 60extern struct workqueue_struct *pciback_wq; | 52/* Used by XenBus and xen_pcibk_ops.c */ 53extern wait_queue_head_t xen_pcibk_aer_wait_queue; 54extern struct workqueue_struct *xen_pcibk_wq; |
61/* Used by pcistub.c and conf_space_quirks.c */ | 55/* Used by pcistub.c and conf_space_quirks.c */ |
62extern struct list_head pciback_quirks; | 56extern struct list_head xen_pcibk_quirks; |
63 64/* Get/Put PCI Devices that are hidden from the PCI Backend Domain */ | 57 58/* Get/Put PCI Devices that are hidden from the PCI Backend Domain */ |
65struct pci_dev *pcistub_get_pci_dev_by_slot(struct pciback_device *pdev, | 59struct pci_dev *pcistub_get_pci_dev_by_slot(struct xen_pcibk_device *pdev, |
66 int domain, int bus, 67 int slot, int func); | 60 int domain, int bus, 61 int slot, int func); |
68struct pci_dev *pcistub_get_pci_dev(struct pciback_device *pdev, | 62struct pci_dev *pcistub_get_pci_dev(struct xen_pcibk_device *pdev, |
69 struct pci_dev *dev); 70void pcistub_put_pci_dev(struct pci_dev *dev); 71 72/* Ensure a device is turned off or reset */ | 63 struct pci_dev *dev); 64void pcistub_put_pci_dev(struct pci_dev *dev); 65 66/* Ensure a device is turned off or reset */ |
73void pciback_reset_device(struct pci_dev *pdev); | 67void xen_pcibk_reset_device(struct pci_dev *pdev); |
74 75/* Access a virtual configuration space for a PCI device */ | 68 69/* Access a virtual configuration space for a PCI device */ |
76int pciback_config_init(void); 77int pciback_config_init_dev(struct pci_dev *dev); 78void pciback_config_free_dyn_fields(struct pci_dev *dev); 79void pciback_config_reset_dev(struct pci_dev *dev); 80void pciback_config_free_dev(struct pci_dev *dev); 81int pciback_config_read(struct pci_dev *dev, int offset, int size, 82 u32 *ret_val); 83int pciback_config_write(struct pci_dev *dev, int offset, int size, u32 value); | 70int xen_pcibk_config_init(void); 71int xen_pcibk_config_init_dev(struct pci_dev *dev); 72void xen_pcibk_config_free_dyn_fields(struct pci_dev *dev); 73void xen_pcibk_config_reset_dev(struct pci_dev *dev); 74void xen_pcibk_config_free_dev(struct pci_dev *dev); 75int xen_pcibk_config_read(struct pci_dev *dev, int offset, int size, 76 u32 *ret_val); 77int xen_pcibk_config_write(struct pci_dev *dev, int offset, int size, 78 u32 value); |
84 85/* Handle requests for specific devices from the frontend */ | 79 80/* Handle requests for specific devices from the frontend */ |
86typedef int (*publish_pci_dev_cb) (struct pciback_device *pdev, | 81typedef int (*publish_pci_dev_cb) (struct xen_pcibk_device *pdev, |
87 unsigned int domain, unsigned int bus, 88 unsigned int devfn, unsigned int devid); | 82 unsigned int domain, unsigned int bus, 83 unsigned int devfn, unsigned int devid); |
89typedef int (*publish_pci_root_cb) (struct pciback_device *pdev, | 84typedef int (*publish_pci_root_cb) (struct xen_pcibk_device *pdev, |
90 unsigned int domain, unsigned int bus); | 85 unsigned int domain, unsigned int bus); |
91int pciback_add_pci_dev(struct pciback_device *pdev, struct pci_dev *dev, 92 int devid, publish_pci_dev_cb publish_cb); 93void pciback_release_pci_dev(struct pciback_device *pdev, struct pci_dev *dev); 94struct pci_dev *pciback_get_pci_dev(struct pciback_device *pdev, 95 unsigned int domain, unsigned int bus, 96 unsigned int devfn); | 86int xen_pcibk_add_pci_dev(struct xen_pcibk_device *pdev, struct pci_dev *dev, 87 int devid, publish_pci_dev_cb publish_cb); 88void xen_pcibk_release_pci_dev(struct xen_pcibk_device *pdev, 89 struct pci_dev *dev); 90struct pci_dev *xen_pcibk_get_pci_dev(struct xen_pcibk_device *pdev, 91 unsigned int domain, unsigned int bus, 92 unsigned int devfn); |
97 98/** | 93 94/** |
99* Add for domain0 PCIE-AER handling. Get guest domain/bus/devfn in pciback | 95* Add for domain0 PCIE-AER handling. Get guest domain/bus/devfn in xen_pcibk |
100* before sending aer request to pcifront, so that guest could identify | 96* before sending aer request to pcifront, so that guest could identify |
101* device, coopearte with pciback to finish aer recovery job if device driver | 97* device, coopearte with xen_pcibk to finish aer recovery job if device driver |
102* has the capability 103*/ 104 | 98* has the capability 99*/ 100 |
105int pciback_get_pcifront_dev(struct pci_dev *pcidev, 106 struct pciback_device *pdev, 107 unsigned int *domain, unsigned int *bus, 108 unsigned int *devfn); 109int pciback_init_devices(struct pciback_device *pdev); 110int pciback_publish_pci_roots(struct pciback_device *pdev, 111 publish_pci_root_cb cb); 112void pciback_release_devices(struct pciback_device *pdev); | 101int xen_pcibk_get_pcifront_dev(struct pci_dev *pcidev, 102 struct xen_pcibk_device *pdev, 103 unsigned int *domain, unsigned int *bus, 104 unsigned int *devfn); 105int xen_pcibk_init_devices(struct xen_pcibk_device *pdev); 106int xen_pcibk_publish_pci_roots(struct xen_pcibk_device *pdev, 107 publish_pci_root_cb cb); 108void xen_pcibk_release_devices(struct xen_pcibk_device *pdev); |
113 114/* Handles events from front-end */ | 109 110/* Handles events from front-end */ |
115irqreturn_t pciback_handle_event(int irq, void *dev_id); 116void pciback_do_op(struct work_struct *data); | 111irqreturn_t xen_pcibk_handle_event(int irq, void *dev_id); 112void xen_pcibk_do_op(struct work_struct *data); |
117 | 113 |
118int pciback_xenbus_register(void); 119void pciback_xenbus_unregister(void); | 114int xen_pcibk_xenbus_register(void); 115void xen_pcibk_xenbus_unregister(void); |
120 | 116 |
121#ifdef CONFIG_PCI_MSI 122int pciback_enable_msi(struct pciback_device *pdev, 123 struct pci_dev *dev, struct xen_pci_op *op); 124 125int pciback_disable_msi(struct pciback_device *pdev, 126 struct pci_dev *dev, struct xen_pci_op *op); 127 128 129int pciback_enable_msix(struct pciback_device *pdev, 130 struct pci_dev *dev, struct xen_pci_op *op); 131 132int pciback_disable_msix(struct pciback_device *pdev, 133 struct pci_dev *dev, struct xen_pci_op *op); 134#endif | |
135extern int verbose_request; 136 | 117extern int verbose_request; 118 |
137void test_and_schedule_op(struct pciback_device *pdev); | 119void xen_pcibk_test_and_schedule_op(struct xen_pcibk_device *pdev); |
138#endif 139 140/* Handles shared IRQs that can to device domain and control domain. */ | 120#endif 121 122/* Handles shared IRQs that can to device domain and control domain. */ |
141void pciback_irq_handler(struct pci_dev *dev, int reset); 142irqreturn_t pciback_guest_interrupt(int irq, void *dev_id); | 123void xen_pcibk_irq_handler(struct pci_dev *dev, int reset); |