fixed PCI config default write permissions
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@878 c046a42c-6fe2-441c-8c8c-71466251a162
This commit is contained in:
		
							parent
							
								
									7727994d21
								
							
						
					
					
						commit
						1f62d9383f
					
				
							
								
								
									
										38
									
								
								hw/pci.c
								
								
								
								
							
							
						
						
									
										38
									
								
								hw/pci.c
								
								
								
								
							| 
						 | 
					@ -255,6 +255,9 @@ void pci_default_write_config(PCIDevice *d,
 | 
				
			||||||
    addr = address;
 | 
					    addr = address;
 | 
				
			||||||
    for(i = 0; i < len; i++) {
 | 
					    for(i = 0; i < len; i++) {
 | 
				
			||||||
        /* default read/write accesses */
 | 
					        /* default read/write accesses */
 | 
				
			||||||
 | 
					        switch(d->config[0x0e]) {
 | 
				
			||||||
 | 
					        case 0x00:
 | 
				
			||||||
 | 
					        case 0x80:
 | 
				
			||||||
            switch(addr) {
 | 
					            switch(addr) {
 | 
				
			||||||
            case 0x00:
 | 
					            case 0x00:
 | 
				
			||||||
            case 0x01:
 | 
					            case 0x01:
 | 
				
			||||||
| 
						 | 
					@ -265,6 +268,8 @@ void pci_default_write_config(PCIDevice *d,
 | 
				
			||||||
            case 0x0a:
 | 
					            case 0x0a:
 | 
				
			||||||
            case 0x0b:
 | 
					            case 0x0b:
 | 
				
			||||||
            case 0x0e:
 | 
					            case 0x0e:
 | 
				
			||||||
 | 
					            case 0x10 ... 0x27: /* base */
 | 
				
			||||||
 | 
					            case 0x30 ... 0x33: /* rom */
 | 
				
			||||||
            case 0x3d:
 | 
					            case 0x3d:
 | 
				
			||||||
                can_write = 0;
 | 
					                can_write = 0;
 | 
				
			||||||
                break;
 | 
					                break;
 | 
				
			||||||
| 
						 | 
					@ -272,6 +277,29 @@ void pci_default_write_config(PCIDevice *d,
 | 
				
			||||||
                can_write = 1;
 | 
					                can_write = 1;
 | 
				
			||||||
                break;
 | 
					                break;
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					            break;
 | 
				
			||||||
 | 
					        default:
 | 
				
			||||||
 | 
					        case 0x01:
 | 
				
			||||||
 | 
					            switch(addr) {
 | 
				
			||||||
 | 
					            case 0x00:
 | 
				
			||||||
 | 
					            case 0x01:
 | 
				
			||||||
 | 
					            case 0x02:
 | 
				
			||||||
 | 
					            case 0x03:
 | 
				
			||||||
 | 
					            case 0x08:
 | 
				
			||||||
 | 
					            case 0x09:
 | 
				
			||||||
 | 
					            case 0x0a:
 | 
				
			||||||
 | 
					            case 0x0b:
 | 
				
			||||||
 | 
					            case 0x0e:
 | 
				
			||||||
 | 
					            case 0x38 ... 0x3b: /* rom */
 | 
				
			||||||
 | 
					            case 0x3d:
 | 
				
			||||||
 | 
					                can_write = 0;
 | 
				
			||||||
 | 
					                break;
 | 
				
			||||||
 | 
					            default:
 | 
				
			||||||
 | 
					                can_write = 1;
 | 
				
			||||||
 | 
					                break;
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					            break;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
        if (can_write) {
 | 
					        if (can_write) {
 | 
				
			||||||
            d->config[addr] = val;
 | 
					            d->config[addr] = val;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
| 
						 | 
					@ -986,10 +1014,10 @@ static void pci_bios_init_device(PCIDevice *d)
 | 
				
			||||||
    int i, pin, pic_irq, vendor_id, device_id;
 | 
					    int i, pin, pic_irq, vendor_id, device_id;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    class = pci_config_readw(d, PCI_CLASS_DEVICE);
 | 
					    class = pci_config_readw(d, PCI_CLASS_DEVICE);
 | 
				
			||||||
    switch(class) {
 | 
					 | 
				
			||||||
    case 0x0101:
 | 
					 | 
				
			||||||
    vendor_id = pci_config_readw(d, PCI_VENDOR_ID);
 | 
					    vendor_id = pci_config_readw(d, PCI_VENDOR_ID);
 | 
				
			||||||
    device_id = pci_config_readw(d, PCI_DEVICE_ID);
 | 
					    device_id = pci_config_readw(d, PCI_DEVICE_ID);
 | 
				
			||||||
 | 
					    switch(class) {
 | 
				
			||||||
 | 
					    case 0x0101:
 | 
				
			||||||
        if (vendor_id == 0x8086 && device_id == 0x7010) {
 | 
					        if (vendor_id == 0x8086 && device_id == 0x7010) {
 | 
				
			||||||
            /* PIIX3 IDE */
 | 
					            /* PIIX3 IDE */
 | 
				
			||||||
            pci_config_writew(d, PCI_COMMAND, PCI_COMMAND_IO);
 | 
					            pci_config_writew(d, PCI_COMMAND, PCI_COMMAND_IO);
 | 
				
			||||||
| 
						 | 
					@ -1006,6 +1034,12 @@ static void pci_bios_init_device(PCIDevice *d)
 | 
				
			||||||
        /* VGA: map frame buffer to default Bochs VBE address */
 | 
					        /* VGA: map frame buffer to default Bochs VBE address */
 | 
				
			||||||
        pci_set_io_region_addr(d, 0, 0xE0000000);
 | 
					        pci_set_io_region_addr(d, 0, 0xE0000000);
 | 
				
			||||||
        break;
 | 
					        break;
 | 
				
			||||||
 | 
					    case 0xff00:
 | 
				
			||||||
 | 
					        if (vendor_id == 0x0106b && device_id == 0x0017) {
 | 
				
			||||||
 | 
					            /* macio bridge */
 | 
				
			||||||
 | 
					            pci_set_io_region_addr(d, 0, 0x80800000);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        break;
 | 
				
			||||||
    default:
 | 
					    default:
 | 
				
			||||||
        /* default memory mappings */
 | 
					        /* default memory mappings */
 | 
				
			||||||
        for(i = 0; i < PCI_NUM_REGIONS; i++) {
 | 
					        for(i = 0; i < PCI_NUM_REGIONS; i++) {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue