- Timestamp:
- Oct 14, 2010 11:15:16 AM (14 years ago)
- Location:
- trunk/src/VBox
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Bus/DevPciIch9.cpp
r32960 r33127 69 69 70 70 71 /** @def PCI_IRQ_PINS72 * Number of pins for interrupts (PIRQ#0...PIRQ#3)73 */74 #define PCI_IRQ_PINS 475 76 71 /** @def PCI_APIC_IRQ_PINS 77 72 * Number of pins for interrupts if the APIC is used. … … 467 462 468 463 /* Compute mapping of PCI slot and IRQ number to APIC interrupt line */ 469 static inline intich9pciSlot2ApicIrq(uint8_t uSlot, int irq_num)464 DECLINLINE(int) ich9pciSlot2ApicIrq(uint8_t uSlot, int irq_num) 470 465 { 471 466 return (irq_num + uSlot) & 7; … … 473 468 474 469 /* Add one more level up request on APIC input line */ 475 static inline voidich9pciApicLevelUp(PPCIGLOBALS pGlobals, int irq_num)470 DECLINLINE(void) ich9pciApicLevelUp(PPCIGLOBALS pGlobals, int irq_num) 476 471 { 477 472 ASMAtomicIncU32(&pGlobals->uaPciApicIrqLevels[irq_num]); … … 479 474 480 475 /* Remove one level up request on APIC input line */ 481 static inline voidich9pciApicLevelDown(PPCIGLOBALS pGlobals, int irq_num)476 DECLINLINE(void) ich9pciApicLevelDown(PPCIGLOBALS pGlobals, int irq_num) 482 477 { 483 478 ASMAtomicDecU32(&pGlobals->uaPciApicIrqLevels[irq_num]); … … 649 644 ("Device is not a PCI bridge but on the list of PCI bridges\n")); 650 645 651 if ( iBus >= pBridgeTemp->config[VBOX_PCI_SECONDARY_BUS]652 && iBus <= pBridgeTemp->config[VBOX_PCI_SUBORDINATE_BUS])646 if ( iBus >= PCIDevGetByte(pBridgeTemp, VBOX_PCI_SECONDARY_BUS) 647 && iBus <= PCIDevGetByte(pBridgeTemp, VBOX_PCI_SUBORDINATE_BUS)) 653 648 return pBridgeTemp; 654 649 } … … 658 653 } 659 654 660 static inline uint32_tich9pciGetRegionReg(int iRegion)655 DECLINLINE(uint32_t) ich9pciGetRegionReg(int iRegion) 661 656 { 662 657 return (iRegion == PCI_ROM_SLOT) ? … … 728 723 { 729 724 /* Port IO */ 730 int devclass; 731 /* NOTE: specific hack for IDE in PC case: 732 only one byte must be mapped. */ 733 /// @todo: do we need it? 734 devclass = pDev->config[0x0a] | (pDev->config[0x0b] << 8); 735 if (devclass == 0x0101 && iRegionSize == 4) 736 { 737 rc = PDMDevHlpIOPortDeregister(pDev->pDevIns, pRegion->addr + 2, 1); 738 AssertRC(rc); 739 } 740 else 741 { 742 rc = PDMDevHlpIOPortDeregister(pDev->pDevIns, pRegion->addr, pRegion->size); 743 AssertRC(rc); 744 } 725 rc = PDMDevHlpIOPortDeregister(pDev->pDevIns, pRegion->addr, pRegion->size); 726 AssertRC(rc); 745 727 } 746 728 else … … 855 837 uint32_t u32Value = (enmType == PCI_ADDRESS_SPACE_MEM_PREFETCH ? (1 << 3) : 0) 856 838 | (enmType == PCI_ADDRESS_SPACE_IO ? 1 : 0); 857 *(uint32_t *)(pPciDev->config + u32Address) = RT_H2LE_U32(u32Value);839 PCIDevSetDWord(pPciDev, u32Address, u32Value); 858 840 859 841 return VINF_SUCCESS; … … 1301 1283 1302 1284 /* match the vendor id assuming that this will never be changed. */ 1303 if ( DevTmp.config[0] != pDev->config[0] 1304 || DevTmp.config[1] != pDev->config[1]) 1285 if ( PCIDevGetVendorId(&DevTmp) != PCIDevGetVendorId(pDev)) 1305 1286 return SSMR3SetCfgError(pSSM, RT_SRC_POS, N_("Device in slot %#x (%s) vendor id mismatch! saved=%.4Rhxs current=%.4Rhxs"), 1306 i, pDev->name, DevTmp.config, pDev->config);1287 i, pDev->name, PCIDevGetVendorId(&DevTmp), PCIDevGetVendorId(pDev)); 1307 1288 1308 1289 /* commit the loaded device config. */ … … 1372 1353 static uint32_t ich9pciConfigRead(PPCIGLOBALS pGlobals, uint8_t uBus, uint8_t uDevFn, uint32_t addr, uint32_t len) 1373 1354 { 1374 /* Set destination address */1375 /// @todo: device locking?1376 pGlobals->uConfigReg = 0x80000000 | (uBus << 16) |1377 (uDevFn << 8) | (addr & ~3);1378 1355 uint32_t u32Val; 1379 int rc = ich9pciDataRead(pGlobals, addr & 3, len, &u32Val); 1356 PciAddress aPciAddr; 1357 1358 aPciAddr.iBus = uBus; 1359 aPciAddr.iDeviceFunc = uDevFn; 1360 aPciAddr.iRegister = addr; 1361 1362 int rc = ich9pciDataReadAddr(pGlobals, &aPciAddr, len, &u32Val); 1380 1363 AssertRC(rc); 1381 1364 switch (len) … … 1393 1376 static void ich9pciConfigWrite(PPCIGLOBALS pGlobals, uint8_t uBus, uint8_t uDevFn, uint32_t addr, uint32_t val, uint32_t len) 1394 1377 { 1395 /* Set destination address */ 1396 /// @todo: device locking? 1397 pGlobals->uConfigReg = 0x80000000 | (uBus << 16) | 1398 (uDevFn << 8) | addr; 1399 ich9pciDataWrite(pGlobals, 0, val, len); 1378 PciAddress aPciAddr; 1379 1380 aPciAddr.iBus = uBus; 1381 aPciAddr.iDeviceFunc = uDevFn; 1382 aPciAddr.iRegister = addr; 1383 1384 ich9pciDataWriteAddr(pGlobals, &aPciAddr, val, len); 1400 1385 } 1401 1386 … … 1624 1609 cBridgeDepth--; 1625 1610 } 1626 #if 01627 uPin = pci_slot_get_pirq(uDevFn, pin);1628 pic_irq = pci_irqs[pin];1629 ich9pciConfigWrite(pGlobals, uBus, uDevFn, PCI_INTERRUPT_LINE, pic_irq);1630 #endif1631 1611 } 1632 1612 } … … 1814 1794 break; 1815 1795 default: 1816 case 0x01: /* bridge */1796 case 0x01: /* PCI-PCI bridge */ 1817 1797 switch (addr) 1818 1798 { … … 1842 1822 case VBOX_PCI_COMMAND: /* Command register, bits 0-7. */ 1843 1823 fUpdateMappings = true; 1844 aDev->config[addr] = u8Val;1824 PCIDevSetByte(aDev, addr, u8Val); 1845 1825 break; 1846 1826 case VBOX_PCI_COMMAND+1: /* Command register, bits 8-15. */ … … 1848 1828 u8Val &= UINT32_C(~0xf8); 1849 1829 fUpdateMappings = true; 1850 aDev->config[addr] = u8Val;1830 PCIDevSetByte(aDev, addr, u8Val); 1851 1831 break; 1852 1832 case VBOX_PCI_STATUS: /* Status register, bits 0-7. */ … … 1864 1844 default: 1865 1845 if (fWritable) 1866 aDev->config[addr] = u8Val;1846 PCIDevSetByte(aDev, addr, u8Val); 1867 1847 } 1868 1848 addr++; … … 1921 1901 /* Otherwise when assigning a slot, we need to make sure all its functions are available */ 1922 1902 for (int iPos = 0; iPos < (int)RT_ELEMENTS(pBus->apDevices); iPos += 8) 1903 { 1923 1904 if ( !pBus->apDevices[iPos] 1924 1905 && !pBus->apDevices[iPos + 1] … … 1933 1914 return iPos; 1934 1915 } 1916 } 1935 1917 1936 1918 return -1; … … 1975 1957 PCIIsRequestedDevfunc(pBus->apDevices[iDev])) 1976 1958 { 1977 /*1978 * Smth like hasHardAssignedDevsInSlot(pBus, iDev >> 3) shall be use to make1979 * it compatible with DevPCI.cpp version, but this way we cannot assign1980 * in accordance with the chipset spec.1981 */1982 1959 AssertReleaseMsgFailed(("Configuration error:'%s' and '%s' are both configured as device %d\n", 1983 1960 pszName, pBus->apDevices[iDev]->name, iDev)); … … 2284 2261 if (!PCIIsPci2PciBridge(pDev)) 2285 2262 { 2286 pDev->config[VBOX_PCI_CACHE_LINE_SIZE] = 0x0;2287 pDev->config[VBOX_PCI_INTERRUPT_LINE] = 0x0;2263 PCIDevSetByte(pDev, VBOX_PCI_CACHE_LINE_SIZE, 0x0); 2264 PCIDevSetByte(pDev, VBOX_PCI_INTERRUPT_LINE, 0x0); 2288 2265 } 2289 2266 /* Regions ? */ … … 2460 2437 2461 2438 /* Reset config space to default values. */ 2462 pBus->aPciDev.config[VBOX_PCI_PRIMARY_BUS] = 0;2463 pBus->aPciDev.config[VBOX_PCI_SECONDARY_BUS] = 0;2464 pBus->aPciDev.config[VBOX_PCI_SUBORDINATE_BUS] = 0;2439 PCIDevSetByte(&pBus->aPciDev, VBOX_PCI_PRIMARY_BUS, 0); 2440 PCIDevSetByte(&pBus->aPciDev, VBOX_PCI_SECONDARY_BUS, 0); 2441 PCIDevSetByte(&pBus->aPciDev, VBOX_PCI_SUBORDINATE_BUS, 0); 2465 2442 } 2466 2443 -
trunk/src/VBox/Main/ConsoleImpl2.cpp
r32910 r33127 855 855 case ChipsetType_PIIX3: 856 856 InsertConfigNode(pDevices, "pci", &pDev); 857 u32HbcPciAddress = 0;857 u32HbcPciAddress = (0x0 << 16) | 0; 858 858 u32IocPciAddress = (0x1 << 16) | 0; // ISA controller 859 859 break;
Note:
See TracChangeset
for help on using the changeset viewer.