Changeset 50779 in vbox for trunk/src/VBox/HostDrivers/VBoxPci/linux/VBoxPci-linux.c
- Timestamp:
- Mar 13, 2014 10:54:47 PM (11 years ago)
- svn:sync-xref-src-repo-rev:
- 92799
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/HostDrivers/VBoxPci/linux/VBoxPci-linux.c
r49137 r50779 652 652 if (pPciDev) 653 653 { 654 int iRegion; 655 for (iRegion = 0; iRegion < 7; ++iRegion) 656 { 657 if (pIns->aRegionR0Mapping[iRegion]) 658 { 659 iounmap(pIns->aRegionR0Mapping[iRegion]); 660 pIns->aRegionR0Mapping[iRegion] = 0; 661 pci_release_region(pPciDev, iRegion); 662 } 663 } 664 654 665 vboxPciOsDevUnregisterWithIommu(pIns); 655 666 … … 738 749 { 739 750 struct pci_dev *pPciDev = pIns->pPciDev; 740 struct resource *pRegion;741 751 RTR0PTR result = 0; 752 int error; 742 753 743 754 printk(KERN_DEBUG "linux vboxPciOsDevMapRegion: reg=%d start=%llx size=%lld\n", iRegion, RegionStart, u64RegionSize); 744 755 745 756 if (!pPciDev) 746 return 0;757 return VERR_INVALID_PARAMETER; 747 758 748 759 if (iRegion < 0 || iRegion > 6) … … 752 763 } 753 764 754 pRegion = request_mem_region(RegionStart, u64RegionSize, "vboxpci"); 755 if (!pRegion) 756 { 757 /** @todo: need to make sure if thise error indeed can be ignored. */ 758 printk(KERN_DEBUG "request_mem_region() failed, don't care\n"); 759 } 765 if (pci_resource_flags(pPciDev, iRegion) & IORESOURCE_IO) 766 return VERR_INVALID_PARAMETER; 767 768 if (RegionStart != pci_resource_start(pPciDev, iRegion)) 769 return VERR_INVALID_PARAMETER; 770 771 if (u64RegionSize != pci_resource_len(pPciDev, iRegion)) 772 return VERR_INVALID_PARAMETER; 773 774 /* 775 * XXX: Current code never calls unmap. To avoid leaking mappings 776 * only request and map resources once. 777 */ 778 if (pIns->aRegionR0Mapping[iRegion]) 779 { 780 *pRegionBase = pIns->aRegionR0Mapping[iRegion]; 781 return VINF_SUCCESS; 782 } 783 784 785 error = pci_request_region(pPciDev, iRegion, "vboxpci"); 786 if (error) 787 return VERR_RESOURCE_BUSY; 760 788 761 789 /* For now no caching, try to optimize later. */ 762 result = ioremap_nocache(RegionStart, u64RegionSize); 790 result = ioremap_nocache(pci_resource_start(pPciDev, iRegion), 791 pci_resource_len(pPciDev, iRegion)); 763 792 764 793 if (!result) 765 794 { 766 795 printk(KERN_DEBUG "cannot ioremap_nocache\n"); 767 if (pRegion) 768 release_mem_region(RegionStart, u64RegionSize); 769 return 0; 770 } 771 772 *pRegionBase = result; 773 774 return 0; 796 pci_release_region(pPciDev, iRegion); 797 return VERR_MAP_FAILED; 798 } 799 800 *pRegionBase = pIns->aRegionR0Mapping[iRegion] = result; 801 802 return VINF_SUCCESS; 775 803 } 776 804 … … 781 809 RTR0PTR RegionBase) 782 810 { 783 784 iounmap(RegionBase); 785 release_mem_region(RegionStart, u64RegionSize); 786 787 return VINF_SUCCESS; 811 /* XXX: Current code never calls unmap. */ 812 return VERR_NOT_IMPLEMENTED; 788 813 } 789 814
Note:
See TracChangeset
for help on using the changeset viewer.