* [Qemu-devel] [PATCH] Add and use remaining #defines for PCI device IDs
@ 2009-03-01 17:01 Stuart Brady
2009-03-01 20:28 ` Paul Brook
2009-03-06 20:38 ` Anthony Liguori
0 siblings, 2 replies; 4+ messages in thread
From: Stuart Brady @ 2009-03-01 17:01 UTC (permalink / raw)
To: qemu-devel
This patch adds and uses #defines for the remaining hardcoded PCI
device IDs. It also marks in hw/pci.h those IDs that have not been
taken from linux/pci_ids.h, and removes the 'RTL' from
PCI_DEVICE_ID_REALTEK_RTL8029.
Signed-off-by: Stuart Brady <stuart.brady@gmail.com>
Index: hw/sh_pci.c
===================================================================
--- hw/sh_pci.c (revision 6657)
+++ hw/sh_pci.c (working copy)
@@ -189,7 +189,7 @@
cpu_register_physical_memory(0xfd000000, 0x1000000, mem);
pci_config_set_vendor_id(p->dev->config, PCI_VENDOR_ID_HITACHI);
- pci_config_set_device_id(p->dev->config, 0x350e); // SH7751R
+ pci_config_set_device_id(p->dev->config, PCI_DEVICE_ID_HITACHI_SH7751R);
p->dev->config[0x04] = 0x80;
p->dev->config[0x05] = 0x00;
p->dev->config[0x06] = 0x90;
Index: hw/usb-ohci.c
===================================================================
--- hw/usb-ohci.c (revision 6657)
+++ hw/usb-ohci.c (working copy)
@@ -1680,7 +1680,8 @@
}
pci_config_set_vendor_id(ohci->pci_dev.config, PCI_VENDOR_ID_APPLE);
- pci_config_set_device_id(ohci->pci_dev.config, 0x003f); // device_id
+ pci_config_set_device_id(ohci->pci_dev.config,
+ PCI_DEVICE_ID_APPLE_IPID_USB);
ohci->pci_dev.config[0x09] = 0x10; /* OHCI */
pci_config_set_class(ohci->pci_dev.config, PCI_CLASS_SERIAL_USB);
ohci->pci_dev.config[0x3d] = 0x01; /* interrupt pin 1 */
Index: hw/pci.h
===================================================================
--- hw/pci.h (revision 6657)
+++ hw/pci.h (working copy)
@@ -54,23 +54,26 @@
#define PCI_VENDOR_ID_CIRRUS 0x1013
#define PCI_VENDOR_ID_IBM 0x1014
-#define PCI_DEVICE_ID_IBM_OPENPIC2 0xffff
+#define PCI_DEVICE_ID_IBM_440GX 0x027f // *
+#define PCI_DEVICE_ID_IBM_OPENPIC2 0xffff // *
#define PCI_VENDOR_ID_AMD 0x1022
#define PCI_DEVICE_ID_AMD_LANCE 0x2000
-#define PCI_VENDOR_ID_HITACHI 0x1054
+#define PCI_VENDOR_ID_HITACHI 0x1054 // *
+#define PCI_DEVICE_ID_HITACHI_SH7751R 0x350e // *
#define PCI_VENDOR_ID_MOTOROLA 0x1057
#define PCI_DEVICE_ID_MOTOROLA_MPC106 0x0002
#define PCI_DEVICE_ID_MOTOROLA_RAVEN 0x4801
#define PCI_VENDOR_ID_APPLE 0x106b
-#define PCI_DEVICE_ID_APPLE_343S1201 0x0010
-#define PCI_DEVICE_ID_APPLE_UNI_N_I_PCI 0x001e
-#define PCI_DEVICE_ID_APPLE_UNI_N_PCI 0x001f
+#define PCI_DEVICE_ID_APPLE_343S1201 0x0010 // *
+#define PCI_DEVICE_ID_APPLE_UNI_N_I_PCI 0x001e // *
+#define PCI_DEVICE_ID_APPLE_UNI_N_PCI 0x001f // *
#define PCI_DEVICE_ID_APPLE_UNI_N_AGP 0x0020
-#define PCI_DEVICE_ID_APPLE_UNI_N_KEYL 0x0022
+#define PCI_DEVICE_ID_APPLE_UNI_N_KEYL 0x0022 // *
+#define PCI_DEVICE_ID_APPLE_IPID_USB 0x003f // *
#define PCI_VENDOR_ID_SUN 0x108e
#define PCI_DEVICE_ID_SUN_EBUS 0x1000
@@ -81,27 +84,30 @@
#define PCI_DEVICE_ID_CMD_646 0x0646
#define PCI_VENDOR_ID_REALTEK 0x10ec
-#define PCI_DEVICE_ID_REALTEK_RTL8029 0x8029
+#define PCI_DEVICE_ID_REALTEK_8029 0x8029 // *
#define PCI_DEVICE_ID_REALTEK_8139 0x8139
#define PCI_VENDOR_ID_XILINX 0x10ee
+#define PCI_DEVICE_ID_XILINX_XC2VP30 0x0300 // *
#define PCI_VENDOR_ID_MARVELL 0x11ab
+#define PCI_DEVICE_ID_MARVELL_GT6412X 0x4620 // *
-#define PCI_VENDOR_ID_QEMU 0x1234
-#define PCI_DEVICE_ID_QEMU_VGA 0x1111
+#define PCI_VENDOR_ID_QEMU 0x1234 // *
+#define PCI_DEVICE_ID_QEMU_VGA 0x1111 // *
#define PCI_VENDOR_ID_ENSONIQ 0x1274
#define PCI_DEVICE_ID_ENSONIQ_ES1370 0x5000
-#define PCI_VENDOR_ID_VMWARE 0x15ad
-#define PCI_DEVICE_ID_VMWARE_SVGA2 0x0405
-#define PCI_DEVICE_ID_VMWARE_SVGA 0x0710
-#define PCI_DEVICE_ID_VMWARE_NET 0x0720
-#define PCI_DEVICE_ID_VMWARE_SCSI 0x0730
-#define PCI_DEVICE_ID_VMWARE_IDE 0x1729
+#define PCI_VENDOR_ID_VMWARE 0x15ad // *
+#define PCI_DEVICE_ID_VMWARE_SVGA2 0x0405 // *
+#define PCI_DEVICE_ID_VMWARE_SVGA 0x0710 // *
+#define PCI_DEVICE_ID_VMWARE_NET 0x0720 // *
+#define PCI_DEVICE_ID_VMWARE_SCSI 0x0730 // *
+#define PCI_DEVICE_ID_VMWARE_IDE 0x1729 // *
#define PCI_VENDOR_ID_INTEL 0x8086
+#define PCI_DEVICE_ID_INTEL_82551IT 0x1209 // *
#define PCI_DEVICE_ID_INTEL_82441 0x1237
#define PCI_DEVICE_ID_INTEL_82801AA_5 0x2415
#define PCI_DEVICE_ID_INTEL_82371SB_0 0x7000
@@ -112,6 +118,8 @@
#define PCI_DEVICE_ID_INTEL_82371AB_2 0x7112
#define PCI_DEVICE_ID_INTEL_82371AB_3 0x7113
+// * = not in linux/pci_ids.h
+
/* Red Hat / Qumranet (for QEMU) -- see pci-ids.txt */
#define PCI_VENDOR_ID_REDHAT_QUMRANET 0x1af4
#define PCI_SUBVENDOR_ID_REDHAT_QUMRANET 0x1af4
Index: hw/eepro100.c
===================================================================
--- hw/eepro100.c (revision 6657)
+++ hw/eepro100.c (working copy)
@@ -424,7 +424,7 @@
/* PCI Vendor ID */
pci_config_set_vendor_id(pci_conf, PCI_VENDOR_ID_INTEL);
/* PCI Device ID */
- pci_config_set_device_id(pci_conf, 0x1209);
+ pci_config_set_device_id(pci_conf, PCI_DEVICE_ID_INTEL_82551IT);
/* PCI Command */
PCI_CONFIG_16(PCI_COMMAND, 0x0000);
/* PCI Status */
Index: hw/ne2000.c
===================================================================
--- hw/ne2000.c (revision 6657)
+++ hw/ne2000.c (working copy)
@@ -789,7 +789,7 @@
NULL, NULL);
pci_conf = d->dev.config;
pci_config_set_vendor_id(pci_conf, PCI_VENDOR_ID_REALTEK);
- pci_config_set_device_id(pci_conf, PCI_DEVICE_ID_REALTEK_RTL8029);
+ pci_config_set_device_id(pci_conf, PCI_DEVICE_ID_REALTEK_8029);
pci_config_set_class(pci_conf, PCI_CLASS_NETWORK_ETHERNET);
pci_conf[0x0e] = 0x00; // header_type
pci_conf[0x3d] = 1; // interrupt pin 0
Index: hw/versatile_pci.c
===================================================================
--- hw/versatile_pci.c (revision 6657)
+++ hw/versatile_pci.c (working copy)
@@ -126,7 +126,7 @@
pci_config_set_vendor_id(d->config, PCI_VENDOR_ID_XILINX);
/* Both boards have the same device ID. Oh well. */
- pci_config_set_device_id(d->config, 0x0300); // device_id
+ pci_config_set_device_id(d->config, PCI_DEVICE_ID_XILINX_XC2VP30);
d->config[0x04] = 0x00;
d->config[0x05] = 0x00;
d->config[0x06] = 0x20;
Index: hw/ppc4xx_pci.c
===================================================================
--- hw/ppc4xx_pci.c (revision 6657)
+++ hw/ppc4xx_pci.c (working copy)
@@ -379,7 +379,7 @@
0, NULL, NULL);
pci_conf = controller->pci_dev->config;
pci_config_set_vendor_id(pci_conf, PCI_VENDOR_ID_IBM);
- pci_config_set_device_id(pci_conf, 0x027f); // device_id
+ pci_config_set_device_id(pci_conf, PCI_DEVICE_ID_IBM_440GX);
pci_config_set_class(pci_conf, PCI_CLASS_BRIDGE_OTHER);
/* CFGADDR */
Index: hw/gt64xxx.c
===================================================================
--- hw/gt64xxx.c (revision 6657)
+++ hw/gt64xxx.c (working copy)
@@ -1137,7 +1137,7 @@
/* FIXME: Malta specific hw assumptions ahead */
pci_config_set_vendor_id(d->config, PCI_VENDOR_ID_MARVELL);
- pci_config_set_device_id(d->config, 0x4620); /* device_id */
+ pci_config_set_device_id(d->config, PCI_DEVICE_ID_MARVELL_GT6412X);
d->config[0x04] = 0x00;
d->config[0x05] = 0x00;
--
Stuart Brady
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] [PATCH] Add and use remaining #defines for PCI device IDs
2009-03-01 17:01 [Qemu-devel] [PATCH] Add and use remaining #defines for PCI device IDs Stuart Brady
@ 2009-03-01 20:28 ` Paul Brook
2009-03-06 20:38 ` Anthony Liguori
1 sibling, 0 replies; 4+ messages in thread
From: Paul Brook @ 2009-03-01 20:28 UTC (permalink / raw)
To: qemu-devel
On Sunday 01 March 2009, Stuart Brady wrote:
> // *
Please do not use C++ style comments.
Paul
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] [PATCH] Add and use remaining #defines for PCI device IDs
2009-03-01 17:01 [Qemu-devel] [PATCH] Add and use remaining #defines for PCI device IDs Stuart Brady
2009-03-01 20:28 ` Paul Brook
@ 2009-03-06 20:38 ` Anthony Liguori
2009-03-07 13:39 ` Stuart Brady
1 sibling, 1 reply; 4+ messages in thread
From: Anthony Liguori @ 2009-03-06 20:38 UTC (permalink / raw)
To: qemu-devel
Stuart Brady wrote:
> This patch adds and uses #defines for the remaining hardcoded PCI
> device IDs. It also marks in hw/pci.h those IDs that have not been
> taken from linux/pci_ids.h, and removes the 'RTL' from
> PCI_DEVICE_ID_REALTEK_RTL8029.
>
> Signed-off-by: Stuart Brady <stuart.brady@gmail.com>
>
> Index: hw/sh_pci.c
> ===================================================================
> --- hw/sh_pci.c (revision 6657)
> +++ hw/sh_pci.c (working copy)
> @@ -189,7 +189,7 @@
> cpu_register_physical_memory(0xfd000000, 0x1000000, mem);
>
> pci_config_set_vendor_id(p->dev->config, PCI_VENDOR_ID_HITACHI);
> - pci_config_set_device_id(p->dev->config, 0x350e); // SH7751R
> + pci_config_set_device_id(p->dev->config, PCI_DEVICE_ID_HITACHI_SH7751R);
> p->dev->config[0x04] = 0x80;
> p->dev->config[0x05] = 0x00;
> p->dev->config[0x06] = 0x90;
> Index: hw/usb-ohci.c
> ===================================================================
> --- hw/usb-ohci.c (revision 6657)
> +++ hw/usb-ohci.c (working copy)
> @@ -1680,7 +1680,8 @@
> }
>
> pci_config_set_vendor_id(ohci->pci_dev.config, PCI_VENDOR_ID_APPLE);
> - pci_config_set_device_id(ohci->pci_dev.config, 0x003f); // device_id
> + pci_config_set_device_id(ohci->pci_dev.config,
> + PCI_DEVICE_ID_APPLE_IPID_USB);
> ohci->pci_dev.config[0x09] = 0x10; /* OHCI */
> pci_config_set_class(ohci->pci_dev.config, PCI_CLASS_SERIAL_USB);
> ohci->pci_dev.config[0x3d] = 0x01; /* interrupt pin 1 */
> Index: hw/pci.h
> ===================================================================
> --- hw/pci.h (revision 6657)
> +++ hw/pci.h (working copy)
> @@ -54,23 +54,26 @@
> #define PCI_VENDOR_ID_CIRRUS 0x1013
>
> #define PCI_VENDOR_ID_IBM 0x1014
> -#define PCI_DEVICE_ID_IBM_OPENPIC2 0xffff
> +#define PCI_DEVICE_ID_IBM_440GX 0x027f // *
> +#define PCI_DEVICE_ID_IBM_OPENPIC2 0xffff // *
>
Can you just move the ones that aren't from Linux into a separate header
file? The C99 comment makes no sense on it's own.
Regards,
Anthony Liguori
> #define PCI_VENDOR_ID_AMD 0x1022
> #define PCI_DEVICE_ID_AMD_LANCE 0x2000
>
> -#define PCI_VENDOR_ID_HITACHI 0x1054
> +#define PCI_VENDOR_ID_HITACHI 0x1054 // *
> +#define PCI_DEVICE_ID_HITACHI_SH7751R 0x350e // *
>
> #define PCI_VENDOR_ID_MOTOROLA 0x1057
> #define PCI_DEVICE_ID_MOTOROLA_MPC106 0x0002
> #define PCI_DEVICE_ID_MOTOROLA_RAVEN 0x4801
>
> #define PCI_VENDOR_ID_APPLE 0x106b
> -#define PCI_DEVICE_ID_APPLE_343S1201 0x0010
> -#define PCI_DEVICE_ID_APPLE_UNI_N_I_PCI 0x001e
> -#define PCI_DEVICE_ID_APPLE_UNI_N_PCI 0x001f
> +#define PCI_DEVICE_ID_APPLE_343S1201 0x0010 // *
> +#define PCI_DEVICE_ID_APPLE_UNI_N_I_PCI 0x001e // *
> +#define PCI_DEVICE_ID_APPLE_UNI_N_PCI 0x001f // *
> #define PCI_DEVICE_ID_APPLE_UNI_N_AGP 0x0020
> -#define PCI_DEVICE_ID_APPLE_UNI_N_KEYL 0x0022
> +#define PCI_DEVICE_ID_APPLE_UNI_N_KEYL 0x0022 // *
> +#define PCI_DEVICE_ID_APPLE_IPID_USB 0x003f // *
>
> #define PCI_VENDOR_ID_SUN 0x108e
> #define PCI_DEVICE_ID_SUN_EBUS 0x1000
> @@ -81,27 +84,30 @@
> #define PCI_DEVICE_ID_CMD_646 0x0646
>
> #define PCI_VENDOR_ID_REALTEK 0x10ec
> -#define PCI_DEVICE_ID_REALTEK_RTL8029 0x8029
> +#define PCI_DEVICE_ID_REALTEK_8029 0x8029 // *
> #define PCI_DEVICE_ID_REALTEK_8139 0x8139
>
> #define PCI_VENDOR_ID_XILINX 0x10ee
> +#define PCI_DEVICE_ID_XILINX_XC2VP30 0x0300 // *
>
> #define PCI_VENDOR_ID_MARVELL 0x11ab
> +#define PCI_DEVICE_ID_MARVELL_GT6412X 0x4620 // *
>
> -#define PCI_VENDOR_ID_QEMU 0x1234
> -#define PCI_DEVICE_ID_QEMU_VGA 0x1111
> +#define PCI_VENDOR_ID_QEMU 0x1234 // *
> +#define PCI_DEVICE_ID_QEMU_VGA 0x1111 // *
>
> #define PCI_VENDOR_ID_ENSONIQ 0x1274
> #define PCI_DEVICE_ID_ENSONIQ_ES1370 0x5000
>
> -#define PCI_VENDOR_ID_VMWARE 0x15ad
> -#define PCI_DEVICE_ID_VMWARE_SVGA2 0x0405
> -#define PCI_DEVICE_ID_VMWARE_SVGA 0x0710
> -#define PCI_DEVICE_ID_VMWARE_NET 0x0720
> -#define PCI_DEVICE_ID_VMWARE_SCSI 0x0730
> -#define PCI_DEVICE_ID_VMWARE_IDE 0x1729
> +#define PCI_VENDOR_ID_VMWARE 0x15ad // *
> +#define PCI_DEVICE_ID_VMWARE_SVGA2 0x0405 // *
> +#define PCI_DEVICE_ID_VMWARE_SVGA 0x0710 // *
> +#define PCI_DEVICE_ID_VMWARE_NET 0x0720 // *
> +#define PCI_DEVICE_ID_VMWARE_SCSI 0x0730 // *
> +#define PCI_DEVICE_ID_VMWARE_IDE 0x1729 // *
>
> #define PCI_VENDOR_ID_INTEL 0x8086
> +#define PCI_DEVICE_ID_INTEL_82551IT 0x1209 // *
> #define PCI_DEVICE_ID_INTEL_82441 0x1237
> #define PCI_DEVICE_ID_INTEL_82801AA_5 0x2415
> #define PCI_DEVICE_ID_INTEL_82371SB_0 0x7000
> @@ -112,6 +118,8 @@
> #define PCI_DEVICE_ID_INTEL_82371AB_2 0x7112
> #define PCI_DEVICE_ID_INTEL_82371AB_3 0x7113
>
> +// * = not in linux/pci_ids.h
> +
> /* Red Hat / Qumranet (for QEMU) -- see pci-ids.txt */
> #define PCI_VENDOR_ID_REDHAT_QUMRANET 0x1af4
> #define PCI_SUBVENDOR_ID_REDHAT_QUMRANET 0x1af4
> Index: hw/eepro100.c
> ===================================================================
> --- hw/eepro100.c (revision 6657)
> +++ hw/eepro100.c (working copy)
> @@ -424,7 +424,7 @@
> /* PCI Vendor ID */
> pci_config_set_vendor_id(pci_conf, PCI_VENDOR_ID_INTEL);
> /* PCI Device ID */
> - pci_config_set_device_id(pci_conf, 0x1209);
> + pci_config_set_device_id(pci_conf, PCI_DEVICE_ID_INTEL_82551IT);
> /* PCI Command */
> PCI_CONFIG_16(PCI_COMMAND, 0x0000);
> /* PCI Status */
> Index: hw/ne2000.c
> ===================================================================
> --- hw/ne2000.c (revision 6657)
> +++ hw/ne2000.c (working copy)
> @@ -789,7 +789,7 @@
> NULL, NULL);
> pci_conf = d->dev.config;
> pci_config_set_vendor_id(pci_conf, PCI_VENDOR_ID_REALTEK);
> - pci_config_set_device_id(pci_conf, PCI_DEVICE_ID_REALTEK_RTL8029);
> + pci_config_set_device_id(pci_conf, PCI_DEVICE_ID_REALTEK_8029);
> pci_config_set_class(pci_conf, PCI_CLASS_NETWORK_ETHERNET);
> pci_conf[0x0e] = 0x00; // header_type
> pci_conf[0x3d] = 1; // interrupt pin 0
> Index: hw/versatile_pci.c
> ===================================================================
> --- hw/versatile_pci.c (revision 6657)
> +++ hw/versatile_pci.c (working copy)
> @@ -126,7 +126,7 @@
>
> pci_config_set_vendor_id(d->config, PCI_VENDOR_ID_XILINX);
> /* Both boards have the same device ID. Oh well. */
> - pci_config_set_device_id(d->config, 0x0300); // device_id
> + pci_config_set_device_id(d->config, PCI_DEVICE_ID_XILINX_XC2VP30);
> d->config[0x04] = 0x00;
> d->config[0x05] = 0x00;
> d->config[0x06] = 0x20;
> Index: hw/ppc4xx_pci.c
> ===================================================================
> --- hw/ppc4xx_pci.c (revision 6657)
> +++ hw/ppc4xx_pci.c (working copy)
> @@ -379,7 +379,7 @@
> 0, NULL, NULL);
> pci_conf = controller->pci_dev->config;
> pci_config_set_vendor_id(pci_conf, PCI_VENDOR_ID_IBM);
> - pci_config_set_device_id(pci_conf, 0x027f); // device_id
> + pci_config_set_device_id(pci_conf, PCI_DEVICE_ID_IBM_440GX);
> pci_config_set_class(pci_conf, PCI_CLASS_BRIDGE_OTHER);
>
> /* CFGADDR */
> Index: hw/gt64xxx.c
> ===================================================================
> --- hw/gt64xxx.c (revision 6657)
> +++ hw/gt64xxx.c (working copy)
> @@ -1137,7 +1137,7 @@
> /* FIXME: Malta specific hw assumptions ahead */
>
> pci_config_set_vendor_id(d->config, PCI_VENDOR_ID_MARVELL);
> - pci_config_set_device_id(d->config, 0x4620); /* device_id */
> + pci_config_set_device_id(d->config, PCI_DEVICE_ID_MARVELL_GT6412X);
>
> d->config[0x04] = 0x00;
> d->config[0x05] = 0x00;
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] [PATCH] Add and use remaining #defines for PCI device IDs
2009-03-06 20:38 ` Anthony Liguori
@ 2009-03-07 13:39 ` Stuart Brady
0 siblings, 0 replies; 4+ messages in thread
From: Stuart Brady @ 2009-03-07 13:39 UTC (permalink / raw)
To: qemu-devel
On Fri, Mar 06, 2009 at 02:38:46PM -0600, Anthony Liguori wrote:
> Can you just move the ones that aren't from Linux into a separate header
> file? The C99 comment makes no sense on it's own.
Good idea. Or maybe move the Linux ones into a separate header?
Either way, it solves the "how do I make this not look ugly" problem
which caused me to resort to C99 comments in the first place...
I'll submit a patch later.
Cheers,
--
Stuart Brady
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2009-03-07 13:40 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-03-01 17:01 [Qemu-devel] [PATCH] Add and use remaining #defines for PCI device IDs Stuart Brady
2009-03-01 20:28 ` Paul Brook
2009-03-06 20:38 ` Anthony Liguori
2009-03-07 13:39 ` Stuart Brady
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).