pci: introduce constant PCI_NUM_PINS for the number of interrupt pins, 4.
introduce constant PCI_NUM_PINS for the number of interrupt pins, 4. and use it. Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp> Acked-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
This commit is contained in:
		
							parent
							
								
									2e49d64ac7
								
							
						
					
					
						commit
						e369cad7cd
					
				
							
								
								
									
										4
									
								
								hw/pci.c
									
									
									
									
									
								
							
							
						
						
									
										4
									
								
								hw/pci.c
									
									
									
									
									
								
							@ -229,7 +229,7 @@ const VMStateDescription vmstate_pci_device = {
 | 
				
			|||||||
        VMSTATE_INT32_LE(version_id, PCIDevice),
 | 
					        VMSTATE_INT32_LE(version_id, PCIDevice),
 | 
				
			||||||
        VMSTATE_SINGLE(config, PCIDevice, 0, vmstate_info_pci_config,
 | 
					        VMSTATE_SINGLE(config, PCIDevice, 0, vmstate_info_pci_config,
 | 
				
			||||||
                       typeof_field(PCIDevice,config)),
 | 
					                       typeof_field(PCIDevice,config)),
 | 
				
			||||||
        VMSTATE_INT32_ARRAY_V(irq_state, PCIDevice, 4, 2),
 | 
					        VMSTATE_INT32_ARRAY_V(irq_state, PCIDevice, PCI_NUM_PINS, 2),
 | 
				
			||||||
        VMSTATE_END_OF_LIST()
 | 
					        VMSTATE_END_OF_LIST()
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
@ -389,7 +389,7 @@ static PCIDevice *do_pci_register_device(PCIDevice *pci_dev, PCIBus *bus,
 | 
				
			|||||||
    pci_dev->config_read = config_read;
 | 
					    pci_dev->config_read = config_read;
 | 
				
			||||||
    pci_dev->config_write = config_write;
 | 
					    pci_dev->config_write = config_write;
 | 
				
			||||||
    bus->devices[devfn] = pci_dev;
 | 
					    bus->devices[devfn] = pci_dev;
 | 
				
			||||||
    pci_dev->irq = qemu_allocate_irqs(pci_set_irq, pci_dev, 4);
 | 
					    pci_dev->irq = qemu_allocate_irqs(pci_set_irq, pci_dev, PCI_NUM_PINS);
 | 
				
			||||||
    pci_dev->version_id = 2; /* Current pci device vmstate version */
 | 
					    pci_dev->version_id = 2; /* Current pci device vmstate version */
 | 
				
			||||||
    return pci_dev;
 | 
					    return pci_dev;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										4
									
								
								hw/pci.h
									
									
									
									
									
								
							
							
						
						
									
										4
									
								
								hw/pci.h
									
									
									
									
									
								
							@ -158,6 +158,8 @@ typedef struct PCIIORegion {
 | 
				
			|||||||
/* Size of the standard PCI config space */
 | 
					/* Size of the standard PCI config space */
 | 
				
			||||||
#define PCI_CONFIG_SPACE_SIZE 0x100
 | 
					#define PCI_CONFIG_SPACE_SIZE 0x100
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#define PCI_NUM_PINS 4 /* A-D */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* Bits in cap_present field. */
 | 
					/* Bits in cap_present field. */
 | 
				
			||||||
enum {
 | 
					enum {
 | 
				
			||||||
    QEMU_PCI_CAP_MSIX = 0x1,
 | 
					    QEMU_PCI_CAP_MSIX = 0x1,
 | 
				
			||||||
@ -192,7 +194,7 @@ struct PCIDevice {
 | 
				
			|||||||
    qemu_irq *irq;
 | 
					    qemu_irq *irq;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /* Current IRQ levels.  Used internally by the generic PCI code.  */
 | 
					    /* Current IRQ levels.  Used internally by the generic PCI code.  */
 | 
				
			||||||
    int irq_state[4];
 | 
					    int irq_state[PCI_NUM_PINS];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /* Capability bits */
 | 
					    /* Capability bits */
 | 
				
			||||||
    uint32_t cap_present;
 | 
					    uint32_t cap_present;
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user