Revision d350d97d
b/hw/pci.c | ||
---|---|---|
50 | 50 |
static void pci_set_irq(void *opaque, int irq_num, int level); |
51 | 51 |
|
52 | 52 |
target_phys_addr_t pci_mem_base; |
53 |
static uint16_t pci_default_sub_vendor_id = PCI_SUBVENDOR_ID_REDHAT_QUMRANET; |
|
54 |
static uint16_t pci_default_sub_device_id = PCI_SUBDEVICE_ID_QEMU; |
|
53 | 55 |
static int pci_irq_index; |
54 | 56 |
static PCIBus *first_bus; |
55 | 57 |
|
... | ... | |
145 | 147 |
return 0; |
146 | 148 |
} |
147 | 149 |
|
150 |
static int pci_set_default_subsystem_id(PCIDevice *pci_dev) |
|
151 |
{ |
|
152 |
uint16_t *id; |
|
153 |
|
|
154 |
id = (void*)(&pci_dev->config[PCI_SUBVENDOR_ID]); |
|
155 |
id[0] = cpu_to_le16(pci_default_sub_vendor_id); |
|
156 |
id[1] = cpu_to_le16(pci_default_sub_device_id); |
|
157 |
return 0; |
|
158 |
} |
|
159 |
|
|
148 | 160 |
/* -1 for devfn means auto assign */ |
149 | 161 |
PCIDevice *pci_register_device(PCIBus *bus, const char *name, |
150 | 162 |
int instance_size, int devfn, |
... | ... | |
171 | 183 |
pci_dev->devfn = devfn; |
172 | 184 |
pstrcpy(pci_dev->name, sizeof(pci_dev->name), name); |
173 | 185 |
memset(pci_dev->irq_state, 0, sizeof(pci_dev->irq_state)); |
186 |
pci_set_default_subsystem_id(pci_dev); |
|
174 | 187 |
|
175 | 188 |
if (!config_read) |
176 | 189 |
config_read = pci_default_read_config; |
b/hw/pci.h | ||
---|---|---|
8 | 8 |
|
9 | 9 |
extern target_phys_addr_t pci_mem_base; |
10 | 10 |
|
11 |
/* see pci-ids.txt */ |
|
12 |
#define PCI_VENDOR_ID_REDHAT_QUMRANET 0x1af4 |
|
13 |
#define PCI_SUBVENDOR_ID_REDHAT_QUMRANET 0x1af4 |
|
14 |
#define PCI_SUBDEVICE_ID_QEMU 0x1100 |
|
15 |
|
|
16 |
#define PCI_DEVICE_ID_VIRTIO_NET 0x1000 |
|
17 |
#define PCI_DEVICE_ID_VIRTIO_BLOCK 0x1001 |
|
18 |
#define PCI_DEVICE_ID_VIRTIO_BALLOON 0x1002 |
|
19 |
|
|
11 | 20 |
typedef void PCIConfigWriteFunc(PCIDevice *pci_dev, |
12 | 21 |
uint32_t address, uint32_t data, int len); |
13 | 22 |
typedef uint32_t PCIConfigReadFunc(PCIDevice *pci_dev, |
... | ... | |
36 | 45 |
#define PCI_COMMAND 0x04 /* 16 bits */ |
37 | 46 |
#define PCI_COMMAND_IO 0x1 /* Enable response in I/O space */ |
38 | 47 |
#define PCI_COMMAND_MEMORY 0x2 /* Enable response in Memory space */ |
48 |
#define PCI_REVISION 0x08 |
|
39 | 49 |
#define PCI_CLASS_DEVICE 0x0a /* Device class */ |
50 |
#define PCI_SUBVENDOR_ID 0x2c /* 16 bits */ |
|
51 |
#define PCI_SUBDEVICE_ID 0x2e /* 16 bits */ |
|
40 | 52 |
#define PCI_INTERRUPT_LINE 0x3c /* 8 bits */ |
41 | 53 |
#define PCI_INTERRUPT_PIN 0x3d /* 8 bits */ |
42 | 54 |
#define PCI_MIN_GNT 0x3e /* 8 bits */ |
Also available in: Unified diff