| 
									
										
										
										
											2012-06-21 15:34:24 +00:00
										 |  |  | #ifndef XEN_HOST_PCI_DEVICE_H
 | 
					
						
							|  |  |  | #define XEN_HOST_PCI_DEVICE_H
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-02-04 15:40:22 +01:00
										 |  |  | #include "hw/pci/pci.h"
 | 
					
						
							| 
									
										
										
										
											2012-06-21 15:34:24 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | enum { | 
					
						
							|  |  |  |     XEN_HOST_PCI_REGION_TYPE_IO = 1 << 1, | 
					
						
							|  |  |  |     XEN_HOST_PCI_REGION_TYPE_MEM = 1 << 2, | 
					
						
							|  |  |  |     XEN_HOST_PCI_REGION_TYPE_PREFETCH = 1 << 3, | 
					
						
							|  |  |  |     XEN_HOST_PCI_REGION_TYPE_MEM_64 = 1 << 4, | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | typedef struct XenHostPCIIORegion { | 
					
						
							|  |  |  |     pcibus_t base_addr; | 
					
						
							|  |  |  |     pcibus_t size; | 
					
						
							|  |  |  |     uint8_t type; | 
					
						
							|  |  |  |     uint8_t bus_flags; /* Bus-specific bits */ | 
					
						
							|  |  |  | } XenHostPCIIORegion; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | typedef struct XenHostPCIDevice { | 
					
						
							|  |  |  |     uint16_t domain; | 
					
						
							|  |  |  |     uint8_t bus; | 
					
						
							|  |  |  |     uint8_t dev; | 
					
						
							|  |  |  |     uint8_t func; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     uint16_t vendor_id; | 
					
						
							|  |  |  |     uint16_t device_id; | 
					
						
							| 
									
										
										
										
											2015-07-15 13:37:45 +08:00
										 |  |  |     uint32_t class_code; | 
					
						
							| 
									
										
										
										
											2012-06-21 15:34:24 +00:00
										 |  |  |     int irq; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     XenHostPCIIORegion io_regions[PCI_NUM_REGIONS - 1]; | 
					
						
							|  |  |  |     XenHostPCIIORegion rom; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     bool is_virtfn; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     int config_fd; | 
					
						
							|  |  |  | } XenHostPCIDevice; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-01-17 20:13:12 +08:00
										 |  |  | void xen_host_pci_device_get(XenHostPCIDevice *d, uint16_t domain, | 
					
						
							|  |  |  |                              uint8_t bus, uint8_t dev, uint8_t func, | 
					
						
							|  |  |  |                              Error **errp); | 
					
						
							| 
									
										
										
										
											2012-06-21 15:34:24 +00:00
										 |  |  | void xen_host_pci_device_put(XenHostPCIDevice *pci_dev); | 
					
						
							| 
									
										
										
										
											2015-09-08 16:21:29 -04:00
										 |  |  | bool xen_host_pci_device_closed(XenHostPCIDevice *d); | 
					
						
							| 
									
										
										
										
											2012-06-21 15:34:24 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | int xen_host_pci_get_byte(XenHostPCIDevice *d, int pos, uint8_t *p); | 
					
						
							|  |  |  | int xen_host_pci_get_word(XenHostPCIDevice *d, int pos, uint16_t *p); | 
					
						
							|  |  |  | int xen_host_pci_get_long(XenHostPCIDevice *d, int pos, uint32_t *p); | 
					
						
							|  |  |  | int xen_host_pci_get_block(XenHostPCIDevice *d, int pos, uint8_t *buf, | 
					
						
							|  |  |  |                            int len); | 
					
						
							|  |  |  | int xen_host_pci_set_byte(XenHostPCIDevice *d, int pos, uint8_t data); | 
					
						
							|  |  |  | int xen_host_pci_set_word(XenHostPCIDevice *d, int pos, uint16_t data); | 
					
						
							|  |  |  | int xen_host_pci_set_long(XenHostPCIDevice *d, int pos, uint32_t data); | 
					
						
							|  |  |  | int xen_host_pci_set_block(XenHostPCIDevice *d, int pos, uint8_t *buf, | 
					
						
							|  |  |  |                            int len); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | int xen_host_pci_find_ext_cap_offset(XenHostPCIDevice *s, uint32_t cap); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-06-29 15:29:06 +02:00
										 |  |  | #endif /* XEN_HOST_PCI_DEVICE_H */
 |