Changeset 64475 in vbox
- Timestamp:
- Oct 28, 2016 3:33:27 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Bus/DevPciIch9.cpp
r64474 r64475 79 79 *********************************************************************************************************************************/ 80 80 /* Prototypes */ 81 static void ich9pciSetIrqInternal(PDEVPCIROOT p Globals, uint8_t uDevFn, PPDMPCIDEV pPciDev,81 static void ich9pciSetIrqInternal(PDEVPCIROOT pPciRoot, uint8_t uDevFn, PPDMPCIDEV pPciDev, 82 82 int iIrq, int iLevel, uint32_t uTagSrc); 83 83 #ifdef IN_RING3 84 84 static void ich9pcibridgeReset(PPDMDEVINS pDevIns); 85 85 DECLINLINE(PPDMPCIDEV) ich9pciFindBridge(PDEVPCIBUS pBus, uint8_t iBus); 86 static void ich9pciBiosInitDevice(PDEVPCIROOT p Globals, uint8_t uBus, uint8_t uDevFn);86 static void ich9pciBiosInitDevice(PDEVPCIROOT pPciRoot, uint8_t uBus, uint8_t uDevFn); 87 87 #endif 88 88 … … 90 90 // See 7.2.2. PCI Express Enhanced Configuration Mechanism for details of address 91 91 // mapping, we take n=6 approach 92 DECLINLINE(void) ich9pciPhysToPciAddr(PDEVPCIROOT p Globals, RTGCPHYS GCPhysAddr, PciAddress* pPciAddr)93 { 94 NOREF(p Globals);92 DECLINLINE(void) ich9pciPhysToPciAddr(PDEVPCIROOT pPciRoot, RTGCPHYS GCPhysAddr, PciAddress* pPciAddr) 93 { 94 NOREF(pPciRoot); 95 95 pPciAddr->iBus = (GCPhysAddr >> 20) & ((1<<6) - 1); 96 96 pPciAddr->iDeviceFunc = (GCPhysAddr >> 12) & ((1<<(5+3)) - 1); // 5 bits - device, 3 bits - function … … 98 98 } 99 99 100 DECLINLINE(void) ich9pciStateToPciAddr(PDEVPCIROOT p Globals, RTGCPHYS addr, PciAddress* pPciAddr)101 { 102 pPciAddr->iBus = (p Globals->uConfigReg >> 16) & 0xff;103 pPciAddr->iDeviceFunc = (p Globals->uConfigReg >> 8) & 0xff;104 pPciAddr->iRegister = (p Globals->uConfigReg & 0xfc) | (addr & 3);100 DECLINLINE(void) ich9pciStateToPciAddr(PDEVPCIROOT pPciRoot, RTGCPHYS addr, PciAddress* pPciAddr) 101 { 102 pPciAddr->iBus = (pPciRoot->uConfigReg >> 16) & 0xff; 103 pPciAddr->iDeviceFunc = (pPciRoot->uConfigReg >> 8) & 0xff; 104 pPciAddr->iRegister = (pPciRoot->uConfigReg & 0xfc) | (addr & 3); 105 105 } 106 106 … … 215 215 * Perform configuration space write. 216 216 */ 217 static int ich9pciDataWriteAddr(PDEVPCIROOT p Globals, PciAddress* pAddr,217 static int ich9pciDataWriteAddr(PDEVPCIROOT pPciRoot, PciAddress* pAddr, 218 218 uint32_t val, int cb, int rcReschedule) 219 219 { … … 227 227 if (pAddr->iBus != 0) /* forward to subordinate bus */ 228 228 { 229 if (p Globals->PciBus.cBridges)229 if (pPciRoot->PciBus.cBridges) 230 230 { 231 231 #ifdef IN_RING3 /** @todo do lookup in R0/RC too! */ 232 PPDMPCIDEV pBridgeDevice = ich9pciFindBridge(&p Globals->PciBus, pAddr->iBus);232 PPDMPCIDEV pBridgeDevice = ich9pciFindBridge(&pPciRoot->PciBus, pAddr->iBus); 233 233 if (pBridgeDevice) 234 234 { … … 244 244 else /* forward to directly connected device */ 245 245 { 246 R3PTRTYPE(PDMPCIDEV *) pPciDev = p Globals->PciBus.apDevices[pAddr->iDeviceFunc];246 R3PTRTYPE(PDMPCIDEV *) pPciDev = pPciRoot->PciBus.apDevices[pAddr->iDeviceFunc]; 247 247 if (pPciDev) 248 248 { … … 270 270 * similarly named functions. 271 271 */ 272 static int ich9pciDataWrite(PDEVPCIROOT p Globals, uint32_t addr, uint32_t val, int len)273 { 274 LogFlow(("ich9pciDataWrite: config=%08x val=%08x len=%d\n", p Globals->uConfigReg, val, len));272 static int ich9pciDataWrite(PDEVPCIROOT pPciRoot, uint32_t addr, uint32_t val, int len) 273 { 274 LogFlow(("ich9pciDataWrite: config=%08x val=%08x len=%d\n", pPciRoot->uConfigReg, val, len)); 275 275 276 276 /* Configuration space mapping enabled? */ 277 if (!(p Globals->uConfigReg & (1 << 31)))277 if (!(pPciRoot->uConfigReg & (1 << 31))) 278 278 return VINF_SUCCESS; 279 279 280 280 /* Decode target device and configuration space register */ 281 281 PciAddress aPciAddr; 282 ich9pciStateToPciAddr(p Globals, addr, &aPciAddr);282 ich9pciStateToPciAddr(pPciRoot, addr, &aPciAddr); 283 283 284 284 /* Perform configuration space write */ 285 return ich9pciDataWriteAddr(p Globals, &aPciAddr, val, len, VINF_IOM_R3_IOPORT_WRITE);285 return ich9pciDataWriteAddr(pPciRoot, &aPciAddr, val, len, VINF_IOM_R3_IOPORT_WRITE); 286 286 } 287 287 … … 330 330 * Perform configuration space read. 331 331 */ 332 static int ich9pciDataReadAddr(PDEVPCIROOT p Globals, PciAddress* pPciAddr, int cb,332 static int ich9pciDataReadAddr(PDEVPCIROOT pPciRoot, PciAddress* pPciAddr, int cb, 333 333 uint32_t *pu32, int rcReschedule) 334 334 { … … 340 340 if (pPciAddr->iBus != 0) /* forward to subordinate bus */ 341 341 { 342 if (p Globals->PciBus.cBridges)342 if (pPciRoot->PciBus.cBridges) 343 343 { 344 344 #ifdef IN_RING3 /** @todo do lookup in R0/RC too! */ 345 PPDMPCIDEV pBridgeDevice = ich9pciFindBridge(&p Globals->PciBus, pPciAddr->iBus);345 PPDMPCIDEV pBridgeDevice = ich9pciFindBridge(&pPciRoot->PciBus, pPciAddr->iBus); 346 346 if (pBridgeDevice) 347 347 { … … 361 361 else /* forward to directly connected device */ 362 362 { 363 R3PTRTYPE(PDMPCIDEV *) pPciDev = p Globals->PciBus.apDevices[pPciAddr->iDeviceFunc];363 R3PTRTYPE(PDMPCIDEV *) pPciDev = pPciRoot->PciBus.apDevices[pPciAddr->iDeviceFunc]; 364 364 if (pPciDev) 365 365 { … … 389 389 * similarly named functions. 390 390 */ 391 static int ich9pciDataRead(PDEVPCIROOT p Globals, uint32_t addr, int cb, uint32_t *pu32)392 { 393 LogFlow(("ich9pciDataRead: config=%x cb=%d\n", p Globals->uConfigReg, cb));391 static int ich9pciDataRead(PDEVPCIROOT pPciRoot, uint32_t addr, int cb, uint32_t *pu32) 392 { 393 LogFlow(("ich9pciDataRead: config=%x cb=%d\n", pPciRoot->uConfigReg, cb)); 394 394 395 395 *pu32 = 0xffffffff; 396 396 397 397 /* Configuration space mapping enabled? */ 398 if (!(p Globals->uConfigReg & (1 << 31)))398 if (!(pPciRoot->uConfigReg & (1 << 31))) 399 399 return VINF_SUCCESS; 400 400 401 401 /* Decode target device and configuration space register */ 402 402 PciAddress aPciAddr; 403 ich9pciStateToPciAddr(p Globals, addr, &aPciAddr);403 ich9pciStateToPciAddr(pPciRoot, addr, &aPciAddr); 404 404 405 405 /* Perform configuration space read */ 406 return ich9pciDataReadAddr(p Globals, &aPciAddr, cb, pu32, VINF_IOM_R3_IOPORT_READ);406 return ich9pciDataReadAddr(pPciRoot, &aPciAddr, cb, pu32, VINF_IOM_R3_IOPORT_READ); 407 407 } 408 408 … … 465 465 466 466 /* Add one more level up request on APIC input line */ 467 DECLINLINE(void) ich9pciApicLevelUp(PDEVPCIROOT p Globals, int irq_num)468 { 469 ASMAtomicIncU32(&p Globals->auPciApicIrqLevels[irq_num]);467 DECLINLINE(void) ich9pciApicLevelUp(PDEVPCIROOT pPciRoot, int irq_num) 468 { 469 ASMAtomicIncU32(&pPciRoot->auPciApicIrqLevels[irq_num]); 470 470 } 471 471 472 472 /* Remove one level up request on APIC input line */ 473 DECLINLINE(void) ich9pciApicLevelDown(PDEVPCIROOT p Globals, int irq_num)474 { 475 ASMAtomicDecU32(&p Globals->auPciApicIrqLevels[irq_num]);473 DECLINLINE(void) ich9pciApicLevelDown(PDEVPCIROOT pPciRoot, int irq_num) 474 { 475 ASMAtomicDecU32(&pPciRoot->auPciApicIrqLevels[irq_num]); 476 476 } 477 477 … … 485 485 { 486 486 int apic_irq, apic_level; 487 PDEVPCIROOT p Globals= DEVPCIBUS_2_DEVPCIROOT(pBus);487 PDEVPCIROOT pPciRoot = DEVPCIBUS_2_DEVPCIROOT(pBus); 488 488 int irq_num = ich9pciSlot2ApicIrq(uDevFn >> 3, irq_num1); 489 489 490 490 if ((iLevel & PDM_IRQ_LEVEL_HIGH) == PDM_IRQ_LEVEL_HIGH) 491 ich9pciApicLevelUp(p Globals, irq_num);491 ich9pciApicLevelUp(pPciRoot, irq_num); 492 492 else if ((iLevel & PDM_IRQ_LEVEL_HIGH) == PDM_IRQ_LEVEL_LOW) 493 ich9pciApicLevelDown(p Globals, irq_num);493 ich9pciApicLevelDown(pPciRoot, irq_num); 494 494 495 495 apic_irq = irq_num + 0x10; 496 apic_level = p Globals->auPciApicIrqLevels[irq_num] != 0;496 apic_level = pPciRoot->auPciApicIrqLevels[irq_num] != 0; 497 497 Log3(("ich9pciApicSetIrq: %s: irq_num1=%d level=%d apic_irq=%d apic_level=%d irq_num1=%d uTagSrc=%#x\n", 498 498 R3STRING(pPciDev->pszNameR3), irq_num1, iLevel, apic_irq, apic_level, irq_num, uTagSrc)); … … 505 505 * PDM_IRQ_LEVEL_HIGH bit set 506 506 */ 507 ich9pciApicLevelDown(p Globals, irq_num);507 ich9pciApicLevelDown(pPciRoot, irq_num); 508 508 pPciDev->Int.s.uIrqPinState = PDM_IRQ_LEVEL_LOW; 509 apic_level = p Globals->auPciApicIrqLevels[irq_num] != 0;509 apic_level = pPciRoot->auPciApicIrqLevels[irq_num] != 0; 510 510 Log3(("ich9pciApicSetIrq: %s: irq_num1=%d level=%d apic_irq=%d apic_level=%d irq_num1=%d uTagSrc=%#x (flop)\n", 511 511 R3STRING(pPciDev->pszNameR3), irq_num1, iLevel, apic_irq, apic_level, irq_num, uTagSrc)); … … 519 519 } 520 520 521 static void ich9pciSetIrqInternal(PDEVPCIROOT p Globals, uint8_t uDevFn, PPDMPCIDEV pPciDev,521 static void ich9pciSetIrqInternal(PDEVPCIROOT pPciRoot, uint8_t uDevFn, PPDMPCIDEV pPciDev, 522 522 int iIrq, int iLevel, uint32_t uTagSrc) 523 523 { … … 531 531 Assert(!MsixIsEnabled(pPciDev)); /* Not allowed -- see note above. */ 532 532 LogFlowFunc(("PCI Dev %p : MSI\n", pPciDev)); 533 PPDMDEVINS pDevIns = p Globals->PciBus.CTX_SUFF(pDevIns);534 MsiNotify(pDevIns, p Globals->PciBus.CTX_SUFF(pPciHlp), pPciDev, iIrq, iLevel, uTagSrc);533 PPDMDEVINS pDevIns = pPciRoot->PciBus.CTX_SUFF(pDevIns); 534 MsiNotify(pDevIns, pPciRoot->PciBus.CTX_SUFF(pPciHlp), pPciDev, iIrq, iLevel, uTagSrc); 535 535 return; 536 536 } … … 539 539 { 540 540 LogFlowFunc(("PCI Dev %p : MSI-X\n", pPciDev)); 541 PPDMDEVINS pDevIns = p Globals->PciBus.CTX_SUFF(pDevIns);542 MsixNotify(pDevIns, p Globals->PciBus.CTX_SUFF(pPciHlp), pPciDev, iIrq, iLevel, uTagSrc);541 PPDMDEVINS pDevIns = pPciRoot->PciBus.CTX_SUFF(pDevIns); 542 MsixNotify(pDevIns, pPciRoot->PciBus.CTX_SUFF(pPciHlp), pPciDev, iIrq, iLevel, uTagSrc); 543 543 return; 544 544 } 545 545 546 PDEVPCIBUS pBus = &p Globals->PciBus;546 PDEVPCIBUS pBus = &pPciRoot->PciBus; 547 547 const bool fIsAcpiDevice = PCIDevGetDeviceId(pPciDev) == 0x7113; 548 548 … … 585 585 PDMBOTHCBDECL(int) ich9pciMcfgMMIOWrite(PPDMDEVINS pDevIns, void *pvUser, RTGCPHYS GCPhysAddr, void const *pv, unsigned cb) 586 586 { 587 PDEVPCIROOT p Globals= PDMINS_2_DATA(pDevIns, PDEVPCIROOT);587 PDEVPCIROOT pPciRoot = PDMINS_2_DATA(pDevIns, PDEVPCIROOT); 588 588 uint32_t u32 = 0; 589 589 NOREF(pvUser); … … 595 595 /* Decode target device and configuration space register */ 596 596 PciAddress aDest; 597 ich9pciPhysToPciAddr(p Globals, GCPhysAddr, &aDest);597 ich9pciPhysToPciAddr(pPciRoot, GCPhysAddr, &aDest); 598 598 599 599 switch (cb) … … 614 614 615 615 /* Perform configuration space write */ 616 int rc = ich9pciDataWriteAddr(p Globals, &aDest, u32, cb, VINF_IOM_R3_MMIO_WRITE);616 int rc = ich9pciDataWriteAddr(pPciRoot, &aDest, u32, cb, VINF_IOM_R3_MMIO_WRITE); 617 617 PCI_UNLOCK(pDevIns); 618 618 … … 637 637 PDMBOTHCBDECL(int) ich9pciMcfgMMIORead (PPDMDEVINS pDevIns, void *pvUser, RTGCPHYS GCPhysAddr, void *pv, unsigned cb) 638 638 { 639 PDEVPCIROOT p Globals= PDMINS_2_DATA(pDevIns, PDEVPCIROOT);639 PDEVPCIROOT pPciRoot = PDMINS_2_DATA(pDevIns, PDEVPCIROOT); 640 640 uint32_t rv; 641 641 NOREF(pvUser); … … 647 647 /* Decode target device and configuration space register */ 648 648 PciAddress aDest; 649 ich9pciPhysToPciAddr(p Globals, GCPhysAddr, &aDest);649 ich9pciPhysToPciAddr(pPciRoot, GCPhysAddr, &aDest); 650 650 651 651 /* Perform configuration space read */ 652 int rc = ich9pciDataReadAddr(p Globals, &aDest, cb, &rv, VINF_IOM_R3_MMIO_READ);652 int rc = ich9pciDataReadAddr(pPciRoot, &aDest, cb, &rv, VINF_IOM_R3_MMIO_READ); 653 653 654 654 if (RT_SUCCESS(rc)) … … 1358 1358 * Cannot be rescheduled, as already in R3. 1359 1359 */ 1360 static uint32_t ich9pciBiosInitReadConfig(PDEVPCIROOT p Globals, uint8_t uBus, uint8_t uDevFn, uint32_t addr, uint32_t len)1360 static uint32_t ich9pciBiosInitReadConfig(PDEVPCIROOT pPciRoot, uint8_t uBus, uint8_t uDevFn, uint32_t addr, uint32_t len) 1361 1361 { 1362 1362 PciAddress aPciAddr; … … 1366 1366 1367 1367 uint32_t u32Val = 0; 1368 int rc = ich9pciDataReadAddr(p Globals, &aPciAddr, len, &u32Val, VERR_INTERNAL_ERROR);1368 int rc = ich9pciDataReadAddr(pPciRoot, &aPciAddr, len, &u32Val, VERR_INTERNAL_ERROR); 1369 1369 AssertRC(rc); 1370 1370 … … 1377 1377 * Cannot be rescheduled, as already in R3. 1378 1378 */ 1379 static void ich9pciBiosInitWriteConfig(PDEVPCIROOT p Globals, uint8_t uBus, uint8_t uDevFn, uint32_t addr, uint32_t val, uint32_t len)1379 static void ich9pciBiosInitWriteConfig(PDEVPCIROOT pPciRoot, uint8_t uBus, uint8_t uDevFn, uint32_t addr, uint32_t val, uint32_t len) 1380 1380 { 1381 1381 PciAddress aPciAddr; … … 1384 1384 aPciAddr.iRegister = addr; 1385 1385 1386 int rc = ich9pciDataWriteAddr(p Globals, &aPciAddr, val, len, VERR_INTERNAL_ERROR);1386 int rc = ich9pciDataWriteAddr(pPciRoot, &aPciAddr, val, len, VERR_INTERNAL_ERROR); 1387 1387 AssertRC(rc); 1388 1388 } 1389 1389 1390 1390 1391 static void ich9pciBiosInitSetRegionAddress(PDEVPCIROOT p Globals, uint8_t uBus, uint8_t uDevFn, int iRegion, uint64_t addr)1391 static void ich9pciBiosInitSetRegionAddress(PDEVPCIROOT pPciRoot, uint8_t uBus, uint8_t uDevFn, int iRegion, uint64_t addr) 1392 1392 { 1393 1393 uint32_t uReg = ich9pciGetRegionReg(iRegion); 1394 1394 1395 1395 /* Read memory type first. */ 1396 uint8_t uResourceType = ich9pciBiosInitReadConfig(p Globals, uBus, uDevFn, uReg, 1);1396 uint8_t uResourceType = ich9pciBiosInitReadConfig(pPciRoot, uBus, uDevFn, uReg, 1); 1397 1397 bool f64Bit = (uResourceType & ((uint8_t)(PCI_ADDRESS_SPACE_BAR64 | PCI_ADDRESS_SPACE_IO))) 1398 1398 == PCI_ADDRESS_SPACE_BAR64; … … 1402 1402 1403 1403 /* Write address of the device. */ 1404 ich9pciBiosInitWriteConfig(p Globals, uBus, uDevFn, uReg, (uint32_t)addr, 4);1404 ich9pciBiosInitWriteConfig(pPciRoot, uBus, uDevFn, uReg, (uint32_t)addr, 4); 1405 1405 if (f64Bit) 1406 ich9pciBiosInitWriteConfig(p Globals, uBus, uDevFn, uReg + 4, (uint32_t)(addr >> 32), 4);1407 } 1408 1409 1410 static void ich9pciBiosInitBridge(PDEVPCIROOT p Globals, uint8_t uBus, uint8_t uDevFn)1406 ich9pciBiosInitWriteConfig(pPciRoot, uBus, uDevFn, uReg + 4, (uint32_t)(addr >> 32), 4); 1407 } 1408 1409 1410 static void ich9pciBiosInitBridge(PDEVPCIROOT pPciRoot, uint8_t uBus, uint8_t uDevFn) 1411 1411 { 1412 1412 Log(("BIOS init bridge: %02x::%02x.%d\n", uBus, uDevFn >> 3, uDevFn & 7)); … … 1417 1417 * through the bridge but we want to be compliant to the spec. 1418 1418 */ 1419 if ((p Globals->uPciBiosIo % 4096) != 0)1420 { 1421 p Globals->uPciBiosIo = RT_ALIGN_32(pGlobals->uPciBiosIo, 4*1024);1422 Log(("%s: Aligned I/O start address. New address %#x\n", __FUNCTION__, p Globals->uPciBiosIo));1423 } 1424 ich9pciBiosInitWriteConfig(p Globals, uBus, uDevFn, VBOX_PCI_IO_BASE, (pGlobals->uPciBiosIo >> 8) & 0xf0, 1);1419 if ((pPciRoot->uPciBiosIo % 4096) != 0) 1420 { 1421 pPciRoot->uPciBiosIo = RT_ALIGN_32(pPciRoot->uPciBiosIo, 4*1024); 1422 Log(("%s: Aligned I/O start address. New address %#x\n", __FUNCTION__, pPciRoot->uPciBiosIo)); 1423 } 1424 ich9pciBiosInitWriteConfig(pPciRoot, uBus, uDevFn, VBOX_PCI_IO_BASE, (pPciRoot->uPciBiosIo >> 8) & 0xf0, 1); 1425 1425 1426 1426 /* The MMIO range for the bridge must be aligned to a 1MB boundary. */ 1427 if ((p Globals->uPciBiosMmio % (1024 * 1024)) != 0)1428 { 1429 p Globals->uPciBiosMmio = RT_ALIGN_32(pGlobals->uPciBiosMmio, 1024*1024);1430 Log(("%s: Aligned MMIO start address. New address %#x\n", __FUNCTION__, p Globals->uPciBiosMmio));1431 } 1432 ich9pciBiosInitWriteConfig(p Globals, uBus, uDevFn, VBOX_PCI_MEMORY_BASE, (pGlobals->uPciBiosMmio >> 16) & UINT32_C(0xffff0), 2);1427 if ((pPciRoot->uPciBiosMmio % (1024 * 1024)) != 0) 1428 { 1429 pPciRoot->uPciBiosMmio = RT_ALIGN_32(pPciRoot->uPciBiosMmio, 1024*1024); 1430 Log(("%s: Aligned MMIO start address. New address %#x\n", __FUNCTION__, pPciRoot->uPciBiosMmio)); 1431 } 1432 ich9pciBiosInitWriteConfig(pPciRoot, uBus, uDevFn, VBOX_PCI_MEMORY_BASE, (pPciRoot->uPciBiosMmio >> 16) & UINT32_C(0xffff0), 2); 1433 1433 1434 1434 /* Save values to compare later to. */ 1435 uint32_t u32IoAddressBase = p Globals->uPciBiosIo;1436 uint32_t u32MMIOAddressBase = p Globals->uPciBiosMmio;1437 uint8_t uBridgeBus = ich9pciBiosInitReadConfig(p Globals, uBus, uDevFn, VBOX_PCI_SECONDARY_BUS, 1);1435 uint32_t u32IoAddressBase = pPciRoot->uPciBiosIo; 1436 uint32_t u32MMIOAddressBase = pPciRoot->uPciBiosMmio; 1437 uint8_t uBridgeBus = ich9pciBiosInitReadConfig(pPciRoot, uBus, uDevFn, VBOX_PCI_SECONDARY_BUS, 1); 1438 1438 1439 1439 /* Init devices behind the bridge and possibly other bridges as well. */ 1440 1440 for (int iDev = 0; iDev <= 255; iDev++) 1441 ich9pciBiosInitDevice(p Globals, uBridgeBus, iDev);1441 ich9pciBiosInitDevice(pPciRoot, uBridgeBus, iDev); 1442 1442 1443 1443 /* … … 1447 1447 * interface. Again this doesn't really matter here but we want to be compliant to the spec. 1448 1448 */ 1449 if ((u32IoAddressBase != p Globals->uPciBiosIo) && ((pGlobals->uPciBiosIo % 4096) != 0))1449 if ((u32IoAddressBase != pPciRoot->uPciBiosIo) && ((pPciRoot->uPciBiosIo % 4096) != 0)) 1450 1450 { 1451 1451 /* The upper boundary must be one byte less than a 4KB boundary. */ 1452 p Globals->uPciBiosIo = RT_ALIGN_32(pGlobals->uPciBiosIo, 4*1024);1453 } 1454 1455 ich9pciBiosInitWriteConfig(p Globals, uBus, uDevFn, VBOX_PCI_IO_LIMIT, ((pGlobals->uPciBiosIo >> 8) & 0xf0) - 1, 1);1452 pPciRoot->uPciBiosIo = RT_ALIGN_32(pPciRoot->uPciBiosIo, 4*1024); 1453 } 1454 1455 ich9pciBiosInitWriteConfig(pPciRoot, uBus, uDevFn, VBOX_PCI_IO_LIMIT, ((pPciRoot->uPciBiosIo >> 8) & 0xf0) - 1, 1); 1456 1456 1457 1457 /* Same with the MMIO limit register but with 1MB boundary here. */ 1458 if ((u32MMIOAddressBase != p Globals->uPciBiosMmio) && ((pGlobals->uPciBiosMmio % (1024 * 1024)) != 0))1458 if ((u32MMIOAddressBase != pPciRoot->uPciBiosMmio) && ((pPciRoot->uPciBiosMmio % (1024 * 1024)) != 0)) 1459 1459 { 1460 1460 /* The upper boundary must be one byte less than a 1MB boundary. */ 1461 p Globals->uPciBiosMmio = RT_ALIGN_32(pGlobals->uPciBiosMmio, 1024*1024);1462 } 1463 ich9pciBiosInitWriteConfig(p Globals, uBus, uDevFn, VBOX_PCI_MEMORY_LIMIT, ((pGlobals->uPciBiosMmio >> 16) & UINT32_C(0xfff0)) - 1, 2);1461 pPciRoot->uPciBiosMmio = RT_ALIGN_32(pPciRoot->uPciBiosMmio, 1024*1024); 1462 } 1463 ich9pciBiosInitWriteConfig(pPciRoot, uBus, uDevFn, VBOX_PCI_MEMORY_LIMIT, ((pPciRoot->uPciBiosMmio >> 16) & UINT32_C(0xfff0)) - 1, 2); 1464 1464 1465 1465 /* … … 1468 1468 * the base register than in the limit register. 1469 1469 */ 1470 ich9pciBiosInitWriteConfig(p Globals, uBus, uDevFn, VBOX_PCI_PREF_MEMORY_BASE, 0xfff0, 2);1471 ich9pciBiosInitWriteConfig(p Globals, uBus, uDevFn, VBOX_PCI_PREF_MEMORY_LIMIT, 0x0, 2);1472 ich9pciBiosInitWriteConfig(p Globals, uBus, uDevFn, VBOX_PCI_PREF_BASE_UPPER32, 0x00, 4);1473 ich9pciBiosInitWriteConfig(p Globals, uBus, uDevFn, VBOX_PCI_PREF_LIMIT_UPPER32, 0x00, 4);1474 } 1475 1476 static void ich9pciBiosInitDevice(PDEVPCIROOT p Globals, uint8_t uBus, uint8_t uDevFn)1470 ich9pciBiosInitWriteConfig(pPciRoot, uBus, uDevFn, VBOX_PCI_PREF_MEMORY_BASE, 0xfff0, 2); 1471 ich9pciBiosInitWriteConfig(pPciRoot, uBus, uDevFn, VBOX_PCI_PREF_MEMORY_LIMIT, 0x0, 2); 1472 ich9pciBiosInitWriteConfig(pPciRoot, uBus, uDevFn, VBOX_PCI_PREF_BASE_UPPER32, 0x00, 4); 1473 ich9pciBiosInitWriteConfig(pPciRoot, uBus, uDevFn, VBOX_PCI_PREF_LIMIT_UPPER32, 0x00, 4); 1474 } 1475 1476 static void ich9pciBiosInitDevice(PDEVPCIROOT pPciRoot, uint8_t uBus, uint8_t uDevFn) 1477 1477 { 1478 1478 uint16_t uDevClass, uVendor, uDevice; 1479 1479 uint8_t uCmd; 1480 1480 1481 uDevClass = ich9pciBiosInitReadConfig(p Globals, uBus, uDevFn, VBOX_PCI_CLASS_DEVICE, 2);1482 uVendor = ich9pciBiosInitReadConfig(p Globals, uBus, uDevFn, VBOX_PCI_VENDOR_ID, 2);1483 uDevice = ich9pciBiosInitReadConfig(p Globals, uBus, uDevFn, VBOX_PCI_DEVICE_ID, 2);1481 uDevClass = ich9pciBiosInitReadConfig(pPciRoot, uBus, uDevFn, VBOX_PCI_CLASS_DEVICE, 2); 1482 uVendor = ich9pciBiosInitReadConfig(pPciRoot, uBus, uDevFn, VBOX_PCI_VENDOR_ID, 2); 1483 uDevice = ich9pciBiosInitReadConfig(pPciRoot, uBus, uDevFn, VBOX_PCI_DEVICE_ID, 2); 1484 1484 1485 1485 /* If device is present */ … … 1493 1493 case 0x0101: 1494 1494 /* IDE controller */ 1495 ich9pciBiosInitWriteConfig(p Globals, uBus, uDevFn, 0x40, 0x8000, 2); /* enable IDE0 */1496 ich9pciBiosInitWriteConfig(p Globals, uBus, uDevFn, 0x42, 0x8000, 2); /* enable IDE1 */1495 ich9pciBiosInitWriteConfig(pPciRoot, uBus, uDevFn, 0x40, 0x8000, 2); /* enable IDE0 */ 1496 ich9pciBiosInitWriteConfig(pPciRoot, uBus, uDevFn, 0x42, 0x8000, 2); /* enable IDE1 */ 1497 1497 goto default_map; 1498 1498 break; … … 1509 1509 * ich9pciSetRegionAddress, so don't forget to enable I/O decoding. 1510 1510 */ 1511 uCmd = ich9pciBiosInitReadConfig(p Globals, uBus, uDevFn, VBOX_PCI_COMMAND, 1);1512 ich9pciBiosInitWriteConfig(p Globals, uBus, uDevFn, VBOX_PCI_COMMAND,1511 uCmd = ich9pciBiosInitReadConfig(pPciRoot, uBus, uDevFn, VBOX_PCI_COMMAND, 1); 1512 ich9pciBiosInitWriteConfig(pPciRoot, uBus, uDevFn, VBOX_PCI_COMMAND, 1513 1513 uCmd | PCI_COMMAND_IOACCESS, 1514 1514 1); … … 1517 1517 case 0x0604: 1518 1518 /* PCI-to-PCI bridge. */ 1519 AssertMsg(p Globals->uPciBiosBus < 255, ("Too many bridges on the bus\n"));1520 ich9pciBiosInitBridge(p Globals, uBus, uDevFn);1519 AssertMsg(pPciRoot->uPciBiosBus < 255, ("Too many bridges on the bus\n")); 1520 ich9pciBiosInitBridge(pPciRoot, uBus, uDevFn); 1521 1521 break; 1522 1522 default: … … 1535 1535 /* Calculate size - we write all 1s into the BAR, and then evaluate which bits 1536 1536 are cleared. */ 1537 uint8_t u8ResourceType = ich9pciBiosInitReadConfig(p Globals, uBus, uDevFn, u32Address, 1);1537 uint8_t u8ResourceType = ich9pciBiosInitReadConfig(pPciRoot, uBus, uDevFn, u32Address, 1); 1538 1538 1539 1539 bool f64Bit = (u8ResourceType & ((uint8_t)(PCI_ADDRESS_SPACE_BAR64 | PCI_ADDRESS_SPACE_IO))) … … 1544 1544 if (f64Bit) 1545 1545 { 1546 ich9pciBiosInitWriteConfig(p Globals, uBus, uDevFn, u32Address, UINT32_C(0xffffffff), 4);1547 ich9pciBiosInitWriteConfig(p Globals, uBus, uDevFn, u32Address+4, UINT32_C(0xffffffff), 4);1548 cbRegSize64 = ich9pciBiosInitReadConfig(p Globals, uBus, uDevFn, u32Address, 4);1549 cbRegSize64 |= ((uint64_t)ich9pciBiosInitReadConfig(p Globals, uBus, uDevFn, u32Address+4, 4) << 32);1546 ich9pciBiosInitWriteConfig(pPciRoot, uBus, uDevFn, u32Address, UINT32_C(0xffffffff), 4); 1547 ich9pciBiosInitWriteConfig(pPciRoot, uBus, uDevFn, u32Address+4, UINT32_C(0xffffffff), 4); 1548 cbRegSize64 = ich9pciBiosInitReadConfig(pPciRoot, uBus, uDevFn, u32Address, 4); 1549 cbRegSize64 |= ((uint64_t)ich9pciBiosInitReadConfig(pPciRoot, uBus, uDevFn, u32Address+4, 4) << 32); 1550 1550 cbRegSize64 &= ~UINT64_C(0x0f); 1551 1551 cbRegSize64 = (~cbRegSize64) + 1; … … 1559 1559 { 1560 1560 uint32_t cbRegSize32; 1561 ich9pciBiosInitWriteConfig(p Globals, uBus, uDevFn, u32Address, UINT32_C(0xffffffff), 4);1562 cbRegSize32 = ich9pciBiosInitReadConfig(p Globals, uBus, uDevFn, u32Address, 4);1561 ich9pciBiosInitWriteConfig(pPciRoot, uBus, uDevFn, u32Address, UINT32_C(0xffffffff), 4); 1562 cbRegSize32 = ich9pciBiosInitReadConfig(pPciRoot, uBus, uDevFn, u32Address, 4); 1563 1563 1564 1564 /* Clear resource information depending on resource type. */ … … 1584 1584 { 1585 1585 /* Try 32-bit base first. */ 1586 uint32_t* paddr = fIsPio ? &p Globals->uPciBiosIo : &pGlobals->uPciBiosMmio;1586 uint32_t* paddr = fIsPio ? &pPciRoot->uPciBiosIo : &pPciRoot->uPciBiosMmio; 1587 1587 uint64_t uNew = *paddr; 1588 1588 /* Align starting address to region size. */ … … 1599 1599 /* Map a 64-bit region above 4GB. */ 1600 1600 Assert(!fIsPio); 1601 uNew = p Globals->uPciBiosMmio64;1601 uNew = pPciRoot->uPciBiosMmio64; 1602 1602 /* Align starting address to region size. */ 1603 1603 uNew = (uNew + cbRegSize64 - 1) & ~(cbRegSize64 - 1); 1604 1604 LogFunc(("Start address of 64-bit MMIO region %u/%u is %#llx\n", iRegion, iRegion + 1, uNew)); 1605 ich9pciBiosInitSetRegionAddress(p Globals, uBus, uDevFn, iRegion, uNew);1605 ich9pciBiosInitSetRegionAddress(pPciRoot, uBus, uDevFn, iRegion, uNew); 1606 1606 fActiveMemRegion = true; 1607 p Globals->uPciBiosMmio64 = uNew + cbRegSize64;1608 Log2Func(("New 64-bit address is %#llx\n", p Globals->uPciBiosMmio64));1607 pPciRoot->uPciBiosMmio64 = uNew + cbRegSize64; 1608 Log2Func(("New 64-bit address is %#llx\n", pPciRoot->uPciBiosMmio64)); 1609 1609 } 1610 1610 else … … 1613 1613 iRegion, uBus, uDevFn >> 3, uDevFn & 7, uVendor, uDevice)); /** @todo make this a VM start failure later. */ 1614 1614 /* Undo the mapping mess caused by the size probing. */ 1615 ich9pciBiosInitWriteConfig(p Globals, uBus, uDevFn, u32Address, UINT32_C(0), 4);1615 ich9pciBiosInitWriteConfig(pPciRoot, uBus, uDevFn, u32Address, UINT32_C(0), 4); 1616 1616 } 1617 1617 } … … 1619 1619 { 1620 1620 LogFunc(("Start address of %s region %u is %#x\n", (fIsPio ? "I/O" : "MMIO"), iRegion, uNew)); 1621 ich9pciBiosInitSetRegionAddress(p Globals, uBus, uDevFn, iRegion, uNew);1621 ich9pciBiosInitSetRegionAddress(pPciRoot, uBus, uDevFn, iRegion, uNew); 1622 1622 if (fIsPio) 1623 1623 fActiveIORegion = true; … … 1634 1634 1635 1635 /* Update the command word appropriately. */ 1636 uCmd = ich9pciBiosInitReadConfig(p Globals, uBus, uDevFn, VBOX_PCI_COMMAND, 2);1636 uCmd = ich9pciBiosInitReadConfig(pPciRoot, uBus, uDevFn, VBOX_PCI_COMMAND, 2); 1637 1637 if (fActiveMemRegion) 1638 1638 uCmd |= PCI_COMMAND_MEMACCESS; /* Enable MMIO access. */ 1639 1639 if (fActiveIORegion) 1640 1640 uCmd |= PCI_COMMAND_IOACCESS; /* Enable I/O space access. */ 1641 ich9pciBiosInitWriteConfig(p Globals, uBus, uDevFn, VBOX_PCI_COMMAND, uCmd, 2);1641 ich9pciBiosInitWriteConfig(pPciRoot, uBus, uDevFn, VBOX_PCI_COMMAND, uCmd, 2); 1642 1642 break; 1643 1643 } … … 1645 1645 1646 1646 /* map the interrupt */ 1647 uint32_t iPin = ich9pciBiosInitReadConfig(p Globals, uBus, uDevFn, VBOX_PCI_INTERRUPT_PIN, 1);1647 uint32_t iPin = ich9pciBiosInitReadConfig(pPciRoot, uBus, uDevFn, VBOX_PCI_INTERRUPT_PIN, 1); 1648 1648 if (iPin != 0) 1649 1649 { … … 1653 1653 { 1654 1654 /* Find bus this device attached to. */ 1655 PDEVPCIBUS pBus = &p Globals->PciBus;1655 PDEVPCIBUS pBus = &pPciRoot->PciBus; 1656 1656 while (1) 1657 1657 { … … 1684 1684 Log(("Using pin %d and IRQ %d for device %02x:%02x.%d\n", 1685 1685 iPin, iIrq, uBus, uDevFn>>3, uDevFn&7)); 1686 ich9pciBiosInitWriteConfig(p Globals, uBus, uDevFn, VBOX_PCI_INTERRUPT_LINE, iIrq, 1);1686 ich9pciBiosInitWriteConfig(pPciRoot, uBus, uDevFn, VBOX_PCI_INTERRUPT_LINE, iIrq, 1); 1687 1687 } 1688 1688 } … … 1692 1692 * 1693 1693 * @returns nothing. 1694 * @param p GlobalsGlobal device instance data used to generate unique bus numbers.1694 * @param pPciRoot Global device instance data used to generate unique bus numbers. 1695 1695 * @param pBus The PCI bus to initialize. 1696 1696 * @param uBusPrimary The primary bus number the bus is connected to. 1697 1697 * @param uBusSecondary The secondary bus number, i.e. the bus number behind the bridge. 1698 1698 */ 1699 static void ich9pciInitBridgeTopology(PDEVPCIROOT p Globals, PDEVPCIBUS pBus, unsigned uBusPrimary,1699 static void ich9pciInitBridgeTopology(PDEVPCIROOT pPciRoot, PDEVPCIBUS pBus, unsigned uBusPrimary, 1700 1700 unsigned uBusSecondary) 1701 1701 { … … 1715 1715 ("Device is not a PCI bridge but on the list of PCI bridges\n")); 1716 1716 PDEVPCIBUS pChildBus = PDMINS_2_DATA(pBridge->Int.s.CTX_SUFF(pDevIns), PDEVPCIBUS); 1717 p Globals->uPciBiosBus++;1718 ich9pciInitBridgeTopology(p Globals, pChildBus, uBusSecondary, pGlobals->uPciBiosBus);1719 } 1720 PCIDevSetByte(pBridgeDev, VBOX_PCI_SUBORDINATE_BUS, p Globals->uPciBiosBus);1717 pPciRoot->uPciBiosBus++; 1718 ich9pciInitBridgeTopology(pPciRoot, pChildBus, uBusSecondary, pPciRoot->uPciBiosBus); 1719 } 1720 PCIDevSetByte(pBridgeDev, VBOX_PCI_SUBORDINATE_BUS, pPciRoot->uPciBiosBus); 1721 1721 Log2(("ich9pciInitBridgeTopology: for bus %p: primary=%d secondary=%d subordinate=%d\n", 1722 1722 pBus, … … 1730 1730 static DECLCALLBACK(int) ich9pciFakePCIBIOS(PPDMDEVINS pDevIns) 1731 1731 { 1732 PDEVPCIROOT p Globals= PDMINS_2_DATA(pDevIns, PDEVPCIROOT);1732 PDEVPCIROOT pPciRoot = PDMINS_2_DATA(pDevIns, PDEVPCIROOT); 1733 1733 PVM pVM = PDMDevHlpGetVM(pDevIns); 1734 1734 uint32_t const cbBelow4GB = MMR3PhysGetRamSizeBelow4GB(pVM); … … 1738 1738 * Set the start addresses. 1739 1739 */ 1740 p Globals->uPciBiosBus = 0;1741 p Globals->uPciBiosIo = 0xd000;1742 p Globals->uPciBiosMmio = cbBelow4GB;1743 p Globals->uPciBiosMmio64 = cbAbove4GB + _4G;1740 pPciRoot->uPciBiosBus = 0; 1741 pPciRoot->uPciBiosIo = 0xd000; 1742 pPciRoot->uPciBiosMmio = cbBelow4GB; 1743 pPciRoot->uPciBiosMmio64 = cbAbove4GB + _4G; 1744 1744 1745 1745 /* NB: Assume that if MMIO range is enabled, it is at the bottom of the memory hole. */ 1746 if (p Globals->u64PciConfigMMioAddress)1747 { 1748 AssertRelease(p Globals->u64PciConfigMMioAddress >= cbBelow4GB);1749 p Globals->uPciBiosMmio = pGlobals->u64PciConfigMMioAddress + pGlobals->u64PciConfigMMioLength;1750 } 1751 Log(("cbBelow4GB: %lX, uPciBiosMmio: %lX, cbAbove4GB: %llX\n", cbBelow4GB, p Globals->uPciBiosMmio, cbAbove4GB));1746 if (pPciRoot->u64PciConfigMMioAddress) 1747 { 1748 AssertRelease(pPciRoot->u64PciConfigMMioAddress >= cbBelow4GB); 1749 pPciRoot->uPciBiosMmio = pPciRoot->u64PciConfigMMioAddress + pPciRoot->u64PciConfigMMioLength; 1750 } 1751 Log(("cbBelow4GB: %lX, uPciBiosMmio: %lX, cbAbove4GB: %llX\n", cbBelow4GB, pPciRoot->uPciBiosMmio, cbAbove4GB)); 1752 1752 1753 1753 /* 1754 1754 * Assign bridge topology, for further routing to work. 1755 1755 */ 1756 PDEVPCIBUS pBus = &p Globals->PciBus;1757 ich9pciInitBridgeTopology(p Globals, pBus, 0, 0);1756 PDEVPCIBUS pBus = &pPciRoot->PciBus; 1757 ich9pciInitBridgeTopology(pPciRoot, pBus, 0, 0); 1758 1758 1759 1759 /* … … 1761 1761 */ 1762 1762 for (int i = 0; i < 256; i++) 1763 ich9pciBiosInitDevice(p Globals, 0, i);1763 ich9pciBiosInitDevice(pPciRoot, 0, i); 1764 1764 1765 1765 return VINF_SUCCESS; … … 2362 2362 DECLCALLBACK(void) devpciR3InfoPciIrq(PPDMDEVINS pDevIns, PCDBGFINFOHLP pHlp, const char *pszArgs) 2363 2363 { 2364 PDEVPCIROOT p Globals= PDMINS_2_DATA(pDevIns, PDEVPCIROOT);2364 PDEVPCIROOT pPciRoot = PDMINS_2_DATA(pDevIns, PDEVPCIROOT); 2365 2365 NOREF(pszArgs); 2366 2366 2367 2367 pHlp->pfnPrintf(pHlp, "PCI I/O APIC IRQ levels:\n"); 2368 2368 for (int i = 0; i < DEVPCI_APIC_IRQ_PINS; ++i) 2369 pHlp->pfnPrintf(pHlp, " IRQ%02d: %u\n", 0x10 + i, p Globals->auPciApicIrqLevels[i]);2369 pHlp->pfnPrintf(pHlp, " IRQ%02d: %u\n", 0x10 + i, pPciRoot->auPciApicIrqLevels[i]); 2370 2370 } 2371 2371 … … 2415 2415 * Init data. 2416 2416 */ 2417 PDEVPCIROOT p Globals= PDMINS_2_DATA(pDevIns, PDEVPCIROOT);2418 PDEVPCIBUS pBus = &p Globals->PciBus;2417 PDEVPCIROOT pPciRoot = PDMINS_2_DATA(pDevIns, PDEVPCIROOT); 2418 PDEVPCIBUS pBus = &pPciRoot->PciBus; 2419 2419 /* Zero out everything */ 2420 memset(p Globals, 0, sizeof(*pGlobals));2420 memset(pPciRoot, 0, sizeof(*pPciRoot)); 2421 2421 /* And fill values */ 2422 2422 if (!fUseIoApic) 2423 2423 return PDMDEV_SET_ERROR(pDevIns, rc, 2424 2424 N_("Must use IO-APIC with ICH9 chipset")); 2425 rc = CFGMR3QueryU64Def(pCfg, "McfgBase", &p Globals->u64PciConfigMMioAddress, 0);2425 rc = CFGMR3QueryU64Def(pCfg, "McfgBase", &pPciRoot->u64PciConfigMMioAddress, 0); 2426 2426 if (RT_FAILURE(rc)) 2427 2427 return PDMDEV_SET_ERROR(pDevIns, rc, 2428 2428 N_("Configuration error: Failed to read \"McfgBase\"")); 2429 rc = CFGMR3QueryU64Def(pCfg, "McfgLength", &p Globals->u64PciConfigMMioLength, 0);2429 rc = CFGMR3QueryU64Def(pCfg, "McfgLength", &pPciRoot->u64PciConfigMMioLength, 0); 2430 2430 if (RT_FAILURE(rc)) 2431 2431 return PDMDEV_SET_ERROR(pDevIns, rc, 2432 2432 N_("Configuration error: Failed to read \"McfgLength\"")); 2433 2433 2434 p Globals->fUseIoApic = fUseIoApic;2435 p Globals->pDevInsR3 = pDevIns;2436 p Globals->pDevInsR0 = PDMDEVINS_2_R0PTR(pDevIns);2437 p Globals->pDevInsRC = PDMDEVINS_2_RCPTR(pDevIns);2438 2439 p Globals->PciBus.fTypePiix3 = false;2440 p Globals->PciBus.fTypeIch9 = true;2441 p Globals->PciBus.fPureBridge = false;2442 p Globals->PciBus.pDevInsR3 = pDevIns;2443 p Globals->PciBus.pDevInsR0 = PDMDEVINS_2_R0PTR(pDevIns);2444 p Globals->PciBus.pDevInsRC = PDMDEVINS_2_RCPTR(pDevIns);2445 p Globals->PciBus.papBridgesR3 = (PPDMPCIDEV *)PDMDevHlpMMHeapAllocZ(pDevIns, sizeof(PPDMPCIDEV) * RT_ELEMENTS(pGlobals->PciBus.apDevices));2446 AssertLogRelReturn(p Globals->PciBus.papBridgesR3, VERR_NO_MEMORY);2434 pPciRoot->fUseIoApic = fUseIoApic; 2435 pPciRoot->pDevInsR3 = pDevIns; 2436 pPciRoot->pDevInsR0 = PDMDEVINS_2_R0PTR(pDevIns); 2437 pPciRoot->pDevInsRC = PDMDEVINS_2_RCPTR(pDevIns); 2438 2439 pPciRoot->PciBus.fTypePiix3 = false; 2440 pPciRoot->PciBus.fTypeIch9 = true; 2441 pPciRoot->PciBus.fPureBridge = false; 2442 pPciRoot->PciBus.pDevInsR3 = pDevIns; 2443 pPciRoot->PciBus.pDevInsR0 = PDMDEVINS_2_R0PTR(pDevIns); 2444 pPciRoot->PciBus.pDevInsRC = PDMDEVINS_2_RCPTR(pDevIns); 2445 pPciRoot->PciBus.papBridgesR3 = (PPDMPCIDEV *)PDMDevHlpMMHeapAllocZ(pDevIns, sizeof(PPDMPCIDEV) * RT_ELEMENTS(pPciRoot->PciBus.apDevices)); 2446 AssertLogRelReturn(pPciRoot->PciBus.papBridgesR3, VERR_NO_MEMORY); 2447 2447 2448 2448 /* … … 2523 2523 } 2524 2524 2525 if (p Globals->u64PciConfigMMioAddress != 0)2526 { 2527 rc = PDMDevHlpMMIORegister(pDevIns, p Globals->u64PciConfigMMioAddress, pGlobals->u64PciConfigMMioLength, NULL /*pvUser*/,2525 if (pPciRoot->u64PciConfigMMioAddress != 0) 2526 { 2527 rc = PDMDevHlpMMIORegister(pDevIns, pPciRoot->u64PciConfigMMioAddress, pPciRoot->u64PciConfigMMioLength, NULL /*pvUser*/, 2528 2528 IOMMMIO_FLAGS_READ_PASSTHRU | IOMMMIO_FLAGS_WRITE_PASSTHRU, 2529 2529 ich9pciMcfgMMIOWrite, ich9pciMcfgMMIORead, "MCFG ranges"); 2530 AssertMsgRCReturn(rc, ("rc=%Rrc %#llx/%#llx\n", rc, p Globals->u64PciConfigMMioAddress, pGlobals->u64PciConfigMMioLength), rc);2530 AssertMsgRCReturn(rc, ("rc=%Rrc %#llx/%#llx\n", rc, pPciRoot->u64PciConfigMMioAddress, pPciRoot->u64PciConfigMMioLength), rc); 2531 2531 2532 2532 if (fGCEnabled) 2533 2533 { 2534 rc = PDMDevHlpMMIORegisterRC(pDevIns, p Globals->u64PciConfigMMioAddress, pGlobals->u64PciConfigMMioLength,2534 rc = PDMDevHlpMMIORegisterRC(pDevIns, pPciRoot->u64PciConfigMMioAddress, pPciRoot->u64PciConfigMMioLength, 2535 2535 NIL_RTRCPTR /*pvUser*/, "ich9pciMcfgMMIOWrite", "ich9pciMcfgMMIORead"); 2536 2536 AssertRCReturn(rc, rc); … … 2540 2540 if (fR0Enabled) 2541 2541 { 2542 rc = PDMDevHlpMMIORegisterR0(pDevIns, p Globals->u64PciConfigMMioAddress, pGlobals->u64PciConfigMMioLength,2542 rc = PDMDevHlpMMIORegisterR0(pDevIns, pPciRoot->u64PciConfigMMioAddress, pPciRoot->u64PciConfigMMioLength, 2543 2543 NIL_RTR0PTR /*pvUser*/, "ich9pciMcfgMMIOWrite", "ich9pciMcfgMMIORead"); 2544 2544 AssertRCReturn(rc, rc); … … 2621 2621 static DECLCALLBACK(void) ich9pciReset(PPDMDEVINS pDevIns) 2622 2622 { 2623 PDEVPCIROOT p Globals= PDMINS_2_DATA(pDevIns, PDEVPCIROOT);2624 PDEVPCIBUS pBus = &p Globals->PciBus;2623 PDEVPCIROOT pPciRoot = PDMINS_2_DATA(pDevIns, PDEVPCIROOT); 2624 PDEVPCIBUS pBus = &pPciRoot->PciBus; 2625 2625 2626 2626 /* PCI-specific reset for each device. */ … … 2670 2670 DECLCALLBACK(void) devpciR3RootRelocate(PPDMDEVINS pDevIns, RTGCINTPTR offDelta) 2671 2671 { 2672 PDEVPCIROOT p Globals= PDMINS_2_DATA(pDevIns, PDEVPCIROOT);2673 p Globals->pDevInsRC = PDMDEVINS_2_RCPTR(pDevIns);2672 PDEVPCIROOT pPciRoot = PDMINS_2_DATA(pDevIns, PDEVPCIROOT); 2673 pPciRoot->pDevInsRC = PDMDEVINS_2_RCPTR(pDevIns); 2674 2674 2675 2675 AssertCompileMemberOffset(DEVPCIROOT, PciBus, 0);
Note:
See TracChangeset
for help on using the changeset viewer.