ia64/xen-unstable

changeset 11325:a1cff03ac7d7

[qemu] Fix PCI config header space writes and set Subsystem-Vendor ID fields.
Fix failure in Windows HCT's PCI-Compliance-Test by invalidating the
writing to read-only/reserved fields in PCI configuration space header
and giving Subsystem-Vendor-ID field a valid value via copying Vendor-ID
field into it.

Signed-off-by: Dexuan Cui <dexuan.cui@intel.com>
author Christian Limpach <Christian.Limpach@xensource.com>
date Mon Aug 28 22:43:09 2006 +0100 (2006-08-28)
parents 7210b62802be
children 20bb80e54f21
files tools/ioemu/hw/pci.c tools/ioemu/hw/rtl8139.c tools/ioemu/hw/usb-uhci.c
line diff
     1.1 --- a/tools/ioemu/hw/pci.c	Mon Aug 28 21:57:34 2006 +0100
     1.2 +++ b/tools/ioemu/hw/pci.c	Mon Aug 28 22:43:09 2006 +0100
     1.3 @@ -286,6 +286,7 @@ void pci_default_write_config(PCIDevice 
     1.4              case 0x0b:
     1.5              case 0x0e:
     1.6              case 0x10 ... 0x27: /* base */
     1.7 +            case 0x2c ... 0x2f: /* subsystem vendor id, subsystem id */
     1.8              case 0x30 ... 0x33: /* rom */
     1.9              case 0x3d:
    1.10                  can_write = 0;
    1.11 @@ -318,6 +319,18 @@ void pci_default_write_config(PCIDevice 
    1.12              break;
    1.13          }
    1.14          if (can_write) {
    1.15 +            if( addr == 0x05 ) {
    1.16 +                /* In Command Register, bits 15:11 are reserved */
    1.17 +                val &= 0x07; 
    1.18 +            } else if ( addr == 0x06 ) {
    1.19 +                /* In Status Register, bits 6, 2:0 are reserved, */
    1.20 +                /* and bits 7,5,4,3 are read only */
    1.21 +                val = d->config[addr];
    1.22 +            } else if ( addr == 0x07 ) {
    1.23 +                /* In Status Register, bits 10,9 are reserved, */
    1.24 +                val = (val & ~0x06) | (d->config[addr] & 0x06);
    1.25 +            }
    1.26 +
    1.27              d->config[addr] = val;
    1.28          }
    1.29          addr++;
     2.1 --- a/tools/ioemu/hw/rtl8139.c	Mon Aug 28 21:57:34 2006 +0100
     2.2 +++ b/tools/ioemu/hw/rtl8139.c	Mon Aug 28 22:43:09 2006 +0100
     2.3 @@ -3423,6 +3423,8 @@ void pci_rtl8139_init(PCIBus *bus, NICIn
     2.4      pci_conf[0x0e] = 0x00; /* header_type */
     2.5      pci_conf[0x3d] = 1;    /* interrupt pin 0 */
     2.6      pci_conf[0x34] = 0xdc;
     2.7 +    pci_conf[0x2c] = pci_conf[0x00]; // same as Vendor ID
     2.8 +    pci_conf[0x2d] = pci_conf[0x01];
     2.9  
    2.10      s = &d->rtl8139;
    2.11  
     3.1 --- a/tools/ioemu/hw/usb-uhci.c	Mon Aug 28 21:57:34 2006 +0100
     3.2 +++ b/tools/ioemu/hw/usb-uhci.c	Mon Aug 28 22:43:09 2006 +0100
     3.3 @@ -659,6 +659,8 @@ void usb_uhci_init(PCIBus *bus, int devf
     3.4      pci_conf[0x0e] = 0x00; // header_type
     3.5      pci_conf[0x3d] = 4; // interrupt pin 3
     3.6      pci_conf[0x60] = 0x10; // release number
     3.7 +    pci_conf[0x2c] = pci_conf[0x00]; // same as Vendor ID
     3.8 +    pci_conf[0x2d] = pci_conf[0x01];
     3.9      
    3.10      for(i = 0; i < NB_PORTS; i++) {
    3.11          qemu_register_usb_port(&s->ports[i].port, s, i, uhci_attach);