Add and use remaining #defines for PCI device IDs
PATCH 1/1 Add and use remaining #defines for PCI device IDs
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.
sh_pci.c +1 -1
@@ -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 ;
usb-ohci.c +2 -1
@@ -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 */
pci.h +23 -15
@@ -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
eepro100.c +1 -1
@@ -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 */
ne2000.c +1 -1
@@ -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
versatile_pci.c +1 -1
@@ -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 ;
ppc4xx_pci.c +1 -1
@@ -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 */
gt64xxx.c +1 -1
@@ -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 ;
Signature · 1 line
Stuart Brady
Quoted 1 line · Stuart Brady
// *
Please do not use C++ style comments.
Paul
Quoted 39 lines · Stuart Brady
This patch adds and uses #defines for the remaining hardcoded PCI device IDs. It also marks in
hw/pci.hthose IDs that have not been taken fromlinux/pci_ids.h, and removes the 'RTL' fromPCI_DEVICE_ID_REALTEK_RTL8029.Signed-off-by Stuart Brady <[email protected]>Index:
hw/sh_pci.c
===================================================================sh_pci.c +1
-1@@ -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
===================================================================usb-ohci.c +2
-1@@ -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
===================================================================
pci.h line 59
Quoted 7 lines
pci.h +2
-1@@ -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
Quoted 140 lines
pci.h +21
-14#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 0x1af4Index:
hw/eepro100.c
===================================================================eepro100.c +1
-1@@ -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
===================================================================ne2000.c +1
-1@@ -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
===================================================================versatile_pci.c +1
-1@@ -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
===================================================================ppc4xx_pci.c +1
-1@@ -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
===================================================================gt64xxx.c +1
-1@@ -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 ;
Quoted 2 lines · Anthony Liguori
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,
Signature · 1 line
Stuart Brady