Changeset 35390 in vbox for trunk/src/VBox/Devices/Bus
- Timestamp:
- Jan 3, 2011 4:15:42 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Bus/DevPciIch9.cpp
r35358 r35390 717 717 718 718 #define INVALID_PCI_ADDRESS ~0U 719 720 static int ich9pciUnmapRegion(PPCIDEVICE pDev, int iRegion) 721 { 722 PCIIORegion* pRegion = &pDev->Int.s.aIORegions[iRegion]; 723 int rc = VINF_SUCCESS; 724 PPCIBUS pBus = pDev->Int.s.CTX_SUFF(pBus); 725 726 Assert (pRegion->size != 0); 727 728 if (pRegion->addr != INVALID_PCI_ADDRESS) 729 { 730 if (pRegion->type & PCI_ADDRESS_SPACE_IO) 731 { 732 /* Port IO */ 733 rc = PDMDevHlpIOPortDeregister(pDev->pDevIns, pRegion->addr, pRegion->size); 734 AssertRC(rc); 735 } 736 else 737 { 738 RTGCPHYS GCPhysBase = pRegion->addr; 739 if (pBus->pPciHlpR3->pfnIsMMIO2Base(pBus->pDevInsR3, pDev->pDevIns, GCPhysBase)) 740 { 741 /* unmap it. */ 742 rc = pRegion->map_func(pDev, iRegion, NIL_RTGCPHYS, pRegion->size, (PCIADDRESSSPACE)(pRegion->type)); 743 AssertRC(rc); 744 rc = PDMDevHlpMMIO2Unmap(pDev->pDevIns, iRegion, GCPhysBase); 745 } 746 else 747 rc = PDMDevHlpMMIODeregister(pDev->pDevIns, GCPhysBase, pRegion->size); 748 } 749 } 750 751 return rc; 752 } 719 753 720 754 static void ich9pciUpdateMappings(PCIDevice* pDev) … … 778 812 { 779 813 if (pRegion->addr != INVALID_PCI_ADDRESS) 780 { 781 if (pRegion->type & PCI_ADDRESS_SPACE_IO) 782 { 783 /* Port IO */ 784 rc = PDMDevHlpIOPortDeregister(pDev->pDevIns, pRegion->addr, pRegion->size); 785 AssertRC(rc); 786 } 787 else 788 { 789 RTGCPHYS GCPhysBase = pRegion->addr; 790 if (pBus->pPciHlpR3->pfnIsMMIO2Base(pBus->pDevInsR3, pDev->pDevIns, GCPhysBase)) 791 { 792 /* unmap it. */ 793 rc = pRegion->map_func(pDev, iRegion, NIL_RTGCPHYS, pRegion->size, (PCIADDRESSSPACE)(pRegion->type)); 794 AssertRC(rc); 795 rc = PDMDevHlpMMIO2Unmap(pDev->pDevIns, iRegion, GCPhysBase); 796 } 797 else 798 rc = PDMDevHlpMMIODeregister(pDev->pDevIns, GCPhysBase, pRegion->size); 799 AssertMsgRC(rc, ("rc=%Rrc d=%s i=%d GCPhysBase=%RGp size=%#x\n", rc, pDev->name, iRegion, GCPhysBase, pRegion->size)); 800 } 801 } 814 ich9pciUnmapRegion(pDev, iRegion); 815 802 816 pRegion->addr = uNew; 803 817 if (pRegion->addr != INVALID_PCI_ADDRESS) … … 2462 2476 static void ich9pciResetDevice(PPCIDEVICE pDev) 2463 2477 { 2478 PPCIBUS pBus = pDev->Int.s.CTX_SUFF(pBus); 2479 int rc; 2480 2464 2481 /* Clear regions */ 2465 memset(&pDev->Int.s.aIORegions, 0, sizeof(pDev->Int.s.aIORegions)); 2482 for (int iRegion = 0; iRegion < PCI_NUM_REGIONS; iRegion++) 2483 { 2484 PCIIORegion* pRegion = &pDev->Int.s.aIORegions[iRegion]; 2485 if (pRegion->size == 0) 2486 continue; 2487 2488 ich9pciUnmapRegion(pDev, iRegion); 2489 } 2466 2490 2467 2491 PCIDevSetCommand(pDev,
Note:
See TracChangeset
for help on using the changeset viewer.