Changeset 33472 in vbox for trunk/src/VBox
- Timestamp:
- Oct 26, 2010 3:56:09 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Bus/DevPciIch9.cpp
r33419 r33472 93 93 #endif 94 94 95 /** PCI bus which is attached to the host-to-PCI bridge. */ 96 PCIBUS aPciBus; 97 98 95 99 /** I/O APIC irq levels */ 96 100 volatile uint32_t uaPciApicIrqLevels[PCI_APIC_IRQ_PINS]; … … 105 109 #endif 106 110 /* Physical address of PCI config space MMIO region */ 107 111 uint64_t u64PciConfigMMioAddress; 108 112 /* Length of PCI config space MMIO region */ 109 uint64_t 113 uint64_t u64PciConfigMMioLength; 110 114 111 115 112 116 /** Config register. */ 113 117 uint32_t uConfigReg; 114 115 /** PCI bus which is attached to the host-to-PCI bridge. */116 PCIBUS aPciBus;117 118 118 } PCIGLOBALS, *PPCIGLOBALS; 119 119 … … 189 189 DECLINLINE(void) ich9pciPhysToPciAddr(PPCIGLOBALS pGlobals, RTGCPHYS GCPhysAddr, PciAddress* pPciAddr) 190 190 { 191 GCPhysAddr = GCPhysAddr - pGlobals->u64PciConfigMMioAddress; 192 pPciAddr->iBus = (GCPhysAddr >> 20) & ((1<<8) - 1); 191 pPciAddr->iBus = (GCPhysAddr >> 20) & ((1<<6) - 1); 193 192 pPciAddr->iDeviceFunc = (GCPhysAddr >> 12) & ((1<<(5+3)) - 1); // 5 bits - device, 3 bits - function 194 193 pPciAddr->iRegister = (GCPhysAddr >> 0) & ((1<<(6+4+2)) - 1); // 6 bits - register, 4 bits - extended register, 2 bits -Byte Enable … … 290 289 } 291 290 292 static int ich9pciDataWriteAddr(PPCIGLOBALS pGlobals, PciAddress* pAddr, uint32_t val, int len) 291 static int ich9pciDataWriteAddr(PPCIGLOBALS pGlobals, PciAddress* pAddr, 292 uint32_t val, int len, int rcReschedule) 293 293 { 294 294 … … 296 296 { 297 297 LogRel(("PCI: attempt to write extended register: %x (%d) <- val\n", pAddr->iRegister, len, val)); 298 return 0;298 return VINF_SUCCESS; 299 299 } 300 300 … … 311 311 } 312 312 #else 313 return VINF_IOM_HC_IOPORT_WRITE;313 return rcReschedule; 314 314 #endif 315 315 } … … 324 324 aDev->Int.s.pfnConfigWrite(aDev, pAddr->iRegister, val, len); 325 325 #else 326 return VINF_IOM_HC_IOPORT_WRITE;326 return rcReschedule; 327 327 #endif 328 328 } … … 346 346 ich9pciStateToPciAddr(pGlobals, addr, &aPciAddr); 347 347 348 return ich9pciDataWriteAddr(pGlobals, &aPciAddr, val, len );348 return ich9pciDataWriteAddr(pGlobals, &aPciAddr, val, len, VINF_IOM_HC_IOPORT_WRITE); 349 349 } 350 350 … … 376 376 } 377 377 378 static int ich9pciDataReadAddr(PPCIGLOBALS pGlobals, PciAddress* pPciAddr, int len, uint32_t *pu32) 378 static int ich9pciDataReadAddr(PPCIGLOBALS pGlobals, PciAddress* pPciAddr, int len, 379 uint32_t *pu32, int rcReschedule) 379 380 { 380 381 if (pPciAddr->iRegister > 0xff) … … 398 399 } 399 400 #else 400 return VINF_IOM_HC_IOPORT_READ;401 return rcReschedule; 401 402 #endif 402 403 } … … 411 412 Log(("ich9pciDataReadAddr: %s: addr=%02x val=%08x len=%d\n", aDev->name, pPciAddr->iRegister, *pu32, len)); 412 413 #else 413 return VINF_IOM_HC_IOPORT_READ;414 return rcReschedule; 414 415 #endif 415 416 } … … 434 435 ich9pciStateToPciAddr(pGlobals, addr, &aPciAddr); 435 436 436 return ich9pciDataReadAddr(pGlobals, &aPciAddr, len, pu32 );437 return ich9pciDataReadAddr(pGlobals, &aPciAddr, len, pu32, VINF_IOM_HC_IOPORT_READ); 437 438 } 438 439 … … 571 572 uint32_t u32 = 0; 572 573 573 Log2(("ich9pciMcfgMMIOWrite: % p(%d) \n", GCPhysAddr, cb));574 575 PCI_LOCK(pDevIns, VINF_IOM_HC_ IOPORT_WRITE);574 Log2(("ich9pciMcfgMMIOWrite: %RGp(%d) \n", GCPhysAddr, cb)); 575 576 PCI_LOCK(pDevIns, VINF_IOM_HC_MMIO_WRITE); 576 577 577 578 ich9pciPhysToPciAddr(pGlobals, GCPhysAddr, &aDest); … … 592 593 break; 593 594 } 594 int rc = ich9pciDataWriteAddr(pGlobals, &aDest, u32, cb );595 int rc = ich9pciDataWriteAddr(pGlobals, &aDest, u32, cb, VINF_IOM_HC_MMIO_WRITE); 595 596 PCI_UNLOCK(pDevIns); 596 597 … … 604 605 uint32_t rv = 0xffffffff; 605 606 606 Log 2(("ich9pciMcfgMMIORead: %p(%d) \n", GCPhysAddr, cb));607 608 PCI_LOCK(pDevIns, VINF_IOM_HC_ IOPORT_READ);607 LogFlow(("ich9pciMcfgMMIORead: %RGp(%d) \n", GCPhysAddr, cb)); 608 609 PCI_LOCK(pDevIns, VINF_IOM_HC_MMIO_READ); 609 610 610 611 ich9pciPhysToPciAddr(pGlobals, GCPhysAddr, &aDest); 611 612 612 int rc = ich9pciDataReadAddr(pGlobals, &aDest, cb, &rv); 613 614 switch (cb) 615 { 616 case 1: 617 *(uint8_t*)pv = (uint8_t)rv; 618 break; 619 case 2: 620 *(uint16_t*)pv = (uint16_t)rv; 621 break; 622 case 4: 623 *(uint32_t*)pv = (uint32_t)rv; 624 break; 625 default: 626 Assert(false); 627 break; 613 int rc = ich9pciDataReadAddr(pGlobals, &aDest, cb, &rv, VINF_IOM_HC_MMIO_READ); 614 615 Log2(("ich9pciMcfgMMIORead: %02x:%02x:%02x reg %x(%d) gave %x %Rrc\n", 616 aDest.iBus, aDest.iDeviceFunc >> 3, aDest.iDeviceFunc & 0x7, aDest.iRegister, 617 cb, rv, rc)); 618 619 if (RT_SUCCESS(rc)) 620 { 621 switch (cb) 622 { 623 case 1: 624 *(uint8_t*)pv = (uint8_t)rv; 625 break; 626 case 2: 627 *(uint16_t*)pv = (uint16_t)rv; 628 break; 629 case 4: 630 *(uint32_t*)pv = (uint32_t)rv; 631 break; 632 default: 633 Assert(false); 634 break; 635 } 628 636 } 629 637 PCI_UNLOCK(pDevIns); … … 1404 1412 aPciAddr.iRegister = addr; 1405 1413 1406 int rc = ich9pciDataReadAddr(pGlobals, &aPciAddr, len, &u32Val); 1414 /* cannot be rescheduled, as already in R3 */ 1415 int rc = ich9pciDataReadAddr(pGlobals, &aPciAddr, len, &u32Val, VERR_INTERNAL_ERROR); 1407 1416 AssertRC(rc); 1408 1417 switch (len) … … 1426 1435 aPciAddr.iRegister = addr; 1427 1436 1428 ich9pciDataWriteAddr(pGlobals, &aPciAddr, val, len); 1437 /* cannot be rescheduled, as already in R3 */ 1438 int rc = ich9pciDataWriteAddr(pGlobals, &aPciAddr, val, len, VERR_INTERNAL_ERROR); 1439 AssertRC(rc); 1429 1440 } 1430 1441 … … 2300 2311 } 2301 2312 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2313 if (fGCEnabled) 2314 { 2315 2316 rc = PDMDevHlpMMIORegisterRC(pDevIns, 2317 pGlobals->u64PciConfigMMioAddress, 2318 pGlobals->u64PciConfigMMioLength, 2319 0, 2320 "ich9pciMcfgMMIOWrite", 2321 "ich9pciMcfgMMIORead", 2322 NULL /* fill */); 2323 if (RT_FAILURE(rc)) 2324 { 2325 AssertMsgRC(rc, ("Cannot register MCFG MMIO (GC): %Rrc\n", rc)); 2326 return rc; 2327 } 2328 } 2329 2330 2331 if (fR0Enabled) 2332 { 2333 2334 rc = PDMDevHlpMMIORegisterR0(pDevIns, 2335 pGlobals->u64PciConfigMMioAddress, 2336 pGlobals->u64PciConfigMMioLength, 2337 0, 2338 "ich9pciMcfgMMIOWrite", 2339 "ich9pciMcfgMMIORead", 2340 NULL /* fill */); 2341 if (RT_FAILURE(rc)) 2342 { 2343 AssertMsgRC(rc, ("Cannot register MCFG MMIO (R0): %Rrc\n", rc)); 2344 return rc; 2345 } 2346 } 2336 2347 } 2337 2348 … … 2399 2410 { 2400 2411 if (pBus->apDevices[i]) 2412 { 2401 2413 pBus->apDevices[i]->Int.s.pBusRC += offDelta; 2414 if (pBus->apDevices[i]->Int.s.pMsixPageRC) 2415 pBus->apDevices[i]->Int.s.pMsixPageRC += offDelta; 2416 } 2402 2417 } 2403 2418
Note:
See TracChangeset
for help on using the changeset viewer.