Commit a770dc7ea6423020d95a0420f57aa5e7c4c96888

Authored by aliguori
1 parent b8c18e4c

Add and use remaining #defines for PCI device IDs (Stuart Brady)

This patch adds and uses #defines for the remaining hardcoded PCI
device IDs.  It also moves definitions taken from linux/pci_ids.h
into a separate header (hw/pci_ids.h), removes the 'RTL' from
PCI_DEVICE_ID_REALTEK_RTL8029, and renames PCI_DEVICE_ID_FSL_E500
to PCI_DEVICE_ID_MPC8533E to match Linux's definition.

Changes in v2:
 * Don't use C99-style comments
 * Move definitions from linux/pci_ids.h into a separate header
 * Rename PCI_DEVICE_ID_FSL_E500 to PCI_DEVICE_ID_MPC8533E

Signed-off-by: Stuart Brady <stuart.brady@gmail.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6841 c046a42c-6fe2-441c-8c8c-71466251a162
hw/eepro100.c
@@ -424,7 +424,7 @@ static void pci_reset(EEPRO100State * s) @@ -424,7 +424,7 @@ static void pci_reset(EEPRO100State * s)
424 /* PCI Vendor ID */ 424 /* PCI Vendor ID */
425 pci_config_set_vendor_id(pci_conf, PCI_VENDOR_ID_INTEL); 425 pci_config_set_vendor_id(pci_conf, PCI_VENDOR_ID_INTEL);
426 /* PCI Device ID */ 426 /* PCI Device ID */
427 - pci_config_set_device_id(pci_conf, 0x1209); 427 + pci_config_set_device_id(pci_conf, PCI_DEVICE_ID_INTEL_82551IT);
428 /* PCI Command */ 428 /* PCI Command */
429 PCI_CONFIG_16(PCI_COMMAND, 0x0000); 429 PCI_CONFIG_16(PCI_COMMAND, 0x0000);
430 /* PCI Status */ 430 /* PCI Status */
hw/gt64xxx.c
@@ -1137,7 +1137,7 @@ PCIBus *pci_gt64120_init(qemu_irq *pic) @@ -1137,7 +1137,7 @@ PCIBus *pci_gt64120_init(qemu_irq *pic)
1137 /* FIXME: Malta specific hw assumptions ahead */ 1137 /* FIXME: Malta specific hw assumptions ahead */
1138 1138
1139 pci_config_set_vendor_id(d->config, PCI_VENDOR_ID_MARVELL); 1139 pci_config_set_vendor_id(d->config, PCI_VENDOR_ID_MARVELL);
1140 - pci_config_set_device_id(d->config, 0x4620); /* device_id */ 1140 + pci_config_set_device_id(d->config, PCI_DEVICE_ID_MARVELL_GT6412X);
1141 1141
1142 d->config[0x04] = 0x00; 1142 d->config[0x04] = 0x00;
1143 d->config[0x05] = 0x00; 1143 d->config[0x05] = 0x00;
hw/ne2000.c
@@ -789,7 +789,7 @@ PCIDevice *pci_ne2000_init(PCIBus *bus, NICInfo *nd, int devfn) @@ -789,7 +789,7 @@ PCIDevice *pci_ne2000_init(PCIBus *bus, NICInfo *nd, int devfn)
789 NULL, NULL); 789 NULL, NULL);
790 pci_conf = d->dev.config; 790 pci_conf = d->dev.config;
791 pci_config_set_vendor_id(pci_conf, PCI_VENDOR_ID_REALTEK); 791 pci_config_set_vendor_id(pci_conf, PCI_VENDOR_ID_REALTEK);
792 - pci_config_set_device_id(pci_conf, PCI_DEVICE_ID_REALTEK_RTL8029); 792 + pci_config_set_device_id(pci_conf, PCI_DEVICE_ID_REALTEK_8029);
793 pci_config_set_class(pci_conf, PCI_CLASS_NETWORK_ETHERNET); 793 pci_config_set_class(pci_conf, PCI_CLASS_NETWORK_ETHERNET);
794 pci_conf[0x0e] = 0x00; // header_type 794 pci_conf[0x0e] = 0x00; // header_type
795 pci_conf[0x3d] = 1; // interrupt pin 0 795 pci_conf[0x3d] = 1; // interrupt pin 0
hw/pci.h
@@ -14,89 +14,40 @@ extern target_phys_addr_t pci_mem_base; @@ -14,89 +14,40 @@ extern target_phys_addr_t pci_mem_base;
14 #define PCI_SLOT(devfn) (((devfn) >> 3) & 0x1f) 14 #define PCI_SLOT(devfn) (((devfn) >> 3) & 0x1f)
15 #define PCI_FUNC(devfn) ((devfn) & 0x07) 15 #define PCI_FUNC(devfn) ((devfn) & 0x07)
16 16
17 -/* Device classes and subclasses */ 17 +/* Class, Vendor and Device IDs from Linux's pci_ids.h */
  18 +#include "pci_ids.h"
18 19
19 -#define PCI_BASE_CLASS_STORAGE 0x01  
20 -#define PCI_BASE_CLASS_NETWORK 0x02 20 +/* QEMU-specific Vendor and Device ID definitions */
21 21
22 -#define PCI_CLASS_STORAGE_SCSI 0x0100  
23 -#define PCI_CLASS_STORAGE_IDE 0x0101  
24 -#define PCI_CLASS_STORAGE_OTHER 0x0180  
25 -  
26 -#define PCI_CLASS_NETWORK_ETHERNET 0x0200  
27 -  
28 -#define PCI_CLASS_DISPLAY_VGA 0x0300  
29 -#define PCI_CLASS_DISPLAY_OTHER 0x0380  
30 -  
31 -#define PCI_CLASS_MULTIMEDIA_AUDIO 0x0401  
32 -  
33 -#define PCI_CLASS_MEMORY_RAM 0x0500  
34 -  
35 -#define PCI_CLASS_SYSTEM_OTHER 0x0880  
36 -  
37 -#define PCI_CLASS_SERIAL_USB 0x0c03  
38 -  
39 -#define PCI_CLASS_BRIDGE_HOST 0x0600  
40 -#define PCI_CLASS_BRIDGE_ISA 0x0601  
41 -#define PCI_CLASS_BRIDGE_PCI 0x0604  
42 -#define PCI_CLASS_BRIDGE_OTHER 0x0680  
43 -  
44 -#define PCI_CLASS_PROCESSOR_CO 0x0b40  
45 -#define PCI_CLASS_PROCESSOR_POWERPC 0x0b20  
46 -  
47 -#define PCI_CLASS_OTHERS 0xff  
48 -  
49 -/* Vendors and devices. */  
50 -  
51 -#define PCI_VENDOR_ID_LSI_LOGIC 0x1000  
52 -#define PCI_DEVICE_ID_LSI_53C895A 0x0012  
53 -  
54 -#define PCI_VENDOR_ID_DEC 0x1011  
55 -#define PCI_DEVICE_ID_DEC_21154 0x0026  
56 -  
57 -#define PCI_VENDOR_ID_CIRRUS 0x1013  
58 -  
59 -#define PCI_VENDOR_ID_IBM 0x1014 22 +/* IBM (0x1014) */
  23 +#define PCI_DEVICE_ID_IBM_440GX 0x027f
60 #define PCI_DEVICE_ID_IBM_OPENPIC2 0xffff 24 #define PCI_DEVICE_ID_IBM_OPENPIC2 0xffff
61 25
62 -#define PCI_VENDOR_ID_AMD 0x1022  
63 -#define PCI_DEVICE_ID_AMD_LANCE 0x2000  
64 - 26 +/* Hitachi (0x1054) */
65 #define PCI_VENDOR_ID_HITACHI 0x1054 27 #define PCI_VENDOR_ID_HITACHI 0x1054
  28 +#define PCI_DEVICE_ID_HITACHI_SH7751R 0x350e
66 29
67 -#define PCI_VENDOR_ID_MOTOROLA 0x1057  
68 -#define PCI_DEVICE_ID_MOTOROLA_MPC106 0x0002  
69 -#define PCI_DEVICE_ID_MOTOROLA_RAVEN 0x4801  
70 -  
71 -#define PCI_VENDOR_ID_APPLE 0x106b 30 +/* Apple (0x106b) */
72 #define PCI_DEVICE_ID_APPLE_343S1201 0x0010 31 #define PCI_DEVICE_ID_APPLE_343S1201 0x0010
73 #define PCI_DEVICE_ID_APPLE_UNI_N_I_PCI 0x001e 32 #define PCI_DEVICE_ID_APPLE_UNI_N_I_PCI 0x001e
74 #define PCI_DEVICE_ID_APPLE_UNI_N_PCI 0x001f 33 #define PCI_DEVICE_ID_APPLE_UNI_N_PCI 0x001f
75 -#define PCI_DEVICE_ID_APPLE_UNI_N_AGP 0x0020  
76 #define PCI_DEVICE_ID_APPLE_UNI_N_KEYL 0x0022 34 #define PCI_DEVICE_ID_APPLE_UNI_N_KEYL 0x0022
  35 +#define PCI_DEVICE_ID_APPLE_IPID_USB 0x003f
77 36
78 -#define PCI_VENDOR_ID_SUN 0x108e  
79 -#define PCI_DEVICE_ID_SUN_EBUS 0x1000  
80 -#define PCI_DEVICE_ID_SUN_SIMBA 0x5000  
81 -#define PCI_DEVICE_ID_SUN_SABRE 0xa000  
82 -  
83 -#define PCI_VENDOR_ID_CMD 0x1095  
84 -#define PCI_DEVICE_ID_CMD_646 0x0646 37 +/* Realtek (0x10ec) */
  38 +#define PCI_DEVICE_ID_REALTEK_8029 0x8029
85 39
86 -#define PCI_VENDOR_ID_REALTEK 0x10ec  
87 -#define PCI_DEVICE_ID_REALTEK_RTL8029 0x8029  
88 -#define PCI_DEVICE_ID_REALTEK_8139 0x8139 40 +/* Xilinx (0x10ee) */
  41 +#define PCI_DEVICE_ID_XILINX_XC2VP30 0x0300
89 42
90 -#define PCI_VENDOR_ID_XILINX 0x10ee  
91 -  
92 -#define PCI_VENDOR_ID_MARVELL 0x11ab 43 +/* Marvell (0x11ab) */
  44 +#define PCI_DEVICE_ID_MARVELL_GT6412X 0x4620
93 45
  46 +/* QEMU/Bochs VGA (0x1234) */
94 #define PCI_VENDOR_ID_QEMU 0x1234 47 #define PCI_VENDOR_ID_QEMU 0x1234
95 #define PCI_DEVICE_ID_QEMU_VGA 0x1111 48 #define PCI_DEVICE_ID_QEMU_VGA 0x1111
96 49
97 -#define PCI_VENDOR_ID_ENSONIQ 0x1274  
98 -#define PCI_DEVICE_ID_ENSONIQ_ES1370 0x5000  
99 - 50 +/* VMWare (0x15ad) */
100 #define PCI_VENDOR_ID_VMWARE 0x15ad 51 #define PCI_VENDOR_ID_VMWARE 0x15ad
101 #define PCI_DEVICE_ID_VMWARE_SVGA2 0x0405 52 #define PCI_DEVICE_ID_VMWARE_SVGA2 0x0405
102 #define PCI_DEVICE_ID_VMWARE_SVGA 0x0710 53 #define PCI_DEVICE_ID_VMWARE_SVGA 0x0710
@@ -105,18 +56,7 @@ extern target_phys_addr_t pci_mem_base; @@ -105,18 +56,7 @@ extern target_phys_addr_t pci_mem_base;
105 #define PCI_DEVICE_ID_VMWARE_IDE 0x1729 56 #define PCI_DEVICE_ID_VMWARE_IDE 0x1729
106 57
107 #define PCI_VENDOR_ID_INTEL 0x8086 58 #define PCI_VENDOR_ID_INTEL 0x8086
108 -#define PCI_DEVICE_ID_INTEL_82441 0x1237  
109 -#define PCI_DEVICE_ID_INTEL_82801AA_5 0x2415  
110 -#define PCI_DEVICE_ID_INTEL_82371SB_0 0x7000  
111 -#define PCI_DEVICE_ID_INTEL_82371SB_1 0x7010  
112 -#define PCI_DEVICE_ID_INTEL_82371SB_2 0x7020  
113 -#define PCI_DEVICE_ID_INTEL_82371AB_0 0x7110  
114 -#define PCI_DEVICE_ID_INTEL_82371AB 0x7111  
115 -#define PCI_DEVICE_ID_INTEL_82371AB_2 0x7112  
116 -#define PCI_DEVICE_ID_INTEL_82371AB_3 0x7113  
117 -  
118 -#define PCI_VENDOR_ID_FSL 0x1957  
119 -#define PCI_DEVICE_ID_FSL_E500 0x0030 59 +#define PCI_DEVICE_ID_INTEL_82551IT 0x1209
120 60
121 /* Red Hat / Qumranet (for QEMU) -- see pci-ids.txt */ 61 /* Red Hat / Qumranet (for QEMU) -- see pci-ids.txt */
122 #define PCI_VENDOR_ID_REDHAT_QUMRANET 0x1af4 62 #define PCI_VENDOR_ID_REDHAT_QUMRANET 0x1af4
hw/ppc4xx_pci.c
@@ -379,7 +379,7 @@ PCIBus *ppc4xx_pci_init(CPUState *env, qemu_irq pci_irqs[4], @@ -379,7 +379,7 @@ PCIBus *ppc4xx_pci_init(CPUState *env, qemu_irq pci_irqs[4],
379 0, NULL, NULL); 379 0, NULL, NULL);
380 pci_conf = controller->pci_dev->config; 380 pci_conf = controller->pci_dev->config;
381 pci_config_set_vendor_id(pci_conf, PCI_VENDOR_ID_IBM); 381 pci_config_set_vendor_id(pci_conf, PCI_VENDOR_ID_IBM);
382 - pci_config_set_device_id(pci_conf, 0x027f); // device_id 382 + pci_config_set_device_id(pci_conf, PCI_DEVICE_ID_IBM_440GX);
383 pci_config_set_class(pci_conf, PCI_CLASS_BRIDGE_OTHER); 383 pci_config_set_class(pci_conf, PCI_CLASS_BRIDGE_OTHER);
384 384
385 /* CFGADDR */ 385 /* CFGADDR */
hw/ppce500_pci.c
@@ -324,8 +324,8 @@ PCIBus *ppce500_pci_init(qemu_irq pci_irqs[4], target_phys_addr_t registers) @@ -324,8 +324,8 @@ PCIBus *ppce500_pci_init(qemu_irq pci_irqs[4], target_phys_addr_t registers)
324 "host bridge", sizeof(PCIDevice), 324 "host bridge", sizeof(PCIDevice),
325 0, NULL, NULL); 325 0, NULL, NULL);
326 326
327 - pci_config_set_vendor_id(d->config, PCI_VENDOR_ID_FSL);  
328 - pci_config_set_device_id(d->config, PCI_DEVICE_ID_FSL_E500); 327 + pci_config_set_vendor_id(d->config, PCI_VENDOR_ID_FREESCALE);
  328 + pci_config_set_device_id(d->config, PCI_DEVICE_ID_MPC8533E);
329 pci_config_set_class(d->config, PCI_CLASS_PROCESSOR_POWERPC); 329 pci_config_set_class(d->config, PCI_CLASS_PROCESSOR_POWERPC);
330 330
331 controller->pci_dev = d; 331 controller->pci_dev = d;
hw/sh_pci.c
@@ -189,7 +189,7 @@ PCIBus *sh_pci_register_bus(pci_set_irq_fn set_irq, pci_map_irq_fn map_irq, @@ -189,7 +189,7 @@ PCIBus *sh_pci_register_bus(pci_set_irq_fn set_irq, pci_map_irq_fn map_irq,
189 cpu_register_physical_memory(0xfd000000, 0x1000000, mem); 189 cpu_register_physical_memory(0xfd000000, 0x1000000, mem);
190 190
191 pci_config_set_vendor_id(p->dev->config, PCI_VENDOR_ID_HITACHI); 191 pci_config_set_vendor_id(p->dev->config, PCI_VENDOR_ID_HITACHI);
192 - pci_config_set_device_id(p->dev->config, 0x350e); // SH7751R 192 + pci_config_set_device_id(p->dev->config, PCI_DEVICE_ID_HITACHI_SH7751R);
193 p->dev->config[0x04] = 0x80; 193 p->dev->config[0x04] = 0x80;
194 p->dev->config[0x05] = 0x00; 194 p->dev->config[0x05] = 0x00;
195 p->dev->config[0x06] = 0x90; 195 p->dev->config[0x06] = 0x90;
hw/usb-ohci.c
@@ -1680,7 +1680,8 @@ void usb_ohci_init_pci(struct PCIBus *bus, int num_ports, int devfn) @@ -1680,7 +1680,8 @@ void usb_ohci_init_pci(struct PCIBus *bus, int num_ports, int devfn)
1680 } 1680 }
1681 1681
1682 pci_config_set_vendor_id(ohci->pci_dev.config, PCI_VENDOR_ID_APPLE); 1682 pci_config_set_vendor_id(ohci->pci_dev.config, PCI_VENDOR_ID_APPLE);
1683 - pci_config_set_device_id(ohci->pci_dev.config, 0x003f); // device_id 1683 + pci_config_set_device_id(ohci->pci_dev.config,
  1684 + PCI_DEVICE_ID_APPLE_IPID_USB);
1684 ohci->pci_dev.config[0x09] = 0x10; /* OHCI */ 1685 ohci->pci_dev.config[0x09] = 0x10; /* OHCI */
1685 pci_config_set_class(ohci->pci_dev.config, PCI_CLASS_SERIAL_USB); 1686 pci_config_set_class(ohci->pci_dev.config, PCI_CLASS_SERIAL_USB);
1686 ohci->pci_dev.config[0x3d] = 0x01; /* interrupt pin 1 */ 1687 ohci->pci_dev.config[0x3d] = 0x01; /* interrupt pin 1 */
hw/versatile_pci.c
@@ -126,7 +126,7 @@ PCIBus *pci_vpb_init(qemu_irq *pic, int irq, int realview) @@ -126,7 +126,7 @@ PCIBus *pci_vpb_init(qemu_irq *pic, int irq, int realview)
126 126
127 pci_config_set_vendor_id(d->config, PCI_VENDOR_ID_XILINX); 127 pci_config_set_vendor_id(d->config, PCI_VENDOR_ID_XILINX);
128 /* Both boards have the same device ID. Oh well. */ 128 /* Both boards have the same device ID. Oh well. */
129 - pci_config_set_device_id(d->config, 0x0300); // device_id 129 + pci_config_set_device_id(d->config, PCI_DEVICE_ID_XILINX_XC2VP30);
130 d->config[0x04] = 0x00; 130 d->config[0x04] = 0x00;
131 d->config[0x05] = 0x00; 131 d->config[0x05] = 0x00;
132 d->config[0x06] = 0x20; 132 d->config[0x06] = 0x20;