- Timestamp:
- Nov 23, 2010 4:52:34 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Bus/DevPciIch9.cpp
r34268 r34299 1626 1626 uint32_t u32Address = ich9pciGetRegionReg(iRegion); 1627 1627 1628 /* Calculate size. */ 1628 /* Calculate size - we write all 1s into the BAR, and then evaluate which bits 1629 are cleared. . */ 1629 1630 uint8_t u8ResourceType = ich9pciConfigRead(pGlobals, uBus, uDevFn, u32Address, 1); 1630 1631 ich9pciConfigWrite(pGlobals, uBus, uDevFn, u32Address, UINT32_C(0xffffffff), 4); … … 1739 1740 int iRegionSize = pRegion->size; 1740 1741 1742 Log3(("ich9pciWriteBarByte: region=%d off=%d val=%x size=%d\n", 1743 iRegion, iOffset, u8Val, iRegionSize)); 1744 1741 1745 /* Region doesn't exist */ 1742 1746 if (iRegionSize == 0) … … 1746 1750 /* Region size must be power of two */ 1747 1751 Assert((iRegionSize & (iRegionSize - 1)) == 0); 1748 uint8_t uMask = (( iRegionSize - 1) >> (iOffset*8)) & 0xff;1752 uint8_t uMask = (((uint32_t)iRegionSize - 1) >> (iOffset*8) ) & 0xff; 1749 1753 1750 1754 if (iOffset == 0) … … 1753 1757 (1 << 2) - 1 /* 2 lowest bits for IO region */ : 1754 1758 (1 << 4) - 1 /* 4 lowest bits for memory region, also ROM enable bit for ROM region */; 1755 } 1756 1757 u8Val = (PCIDevGetByte(aDev, uAddr) & uMask) | (u8Val & ~uMask); 1759 1760 } 1761 1762 uint8_t u8Old = PCIDevGetByte(aDev, uAddr) & uMask; 1763 u8Val = (u8Old & uMask) | (u8Val & ~uMask); 1764 1765 Log3(("ich9pciWriteBarByte: was %x writing %x\n", u8Old, u8Val)); 1766 1758 1767 PCIDevSetByte(aDev, uAddr, u8Val); 1759 1768 } … … 1798 1807 uint32_t addr = u32Address; 1799 1808 bool fUpdateMappings = false; 1809 bool fP2PBridge = false; 1800 1810 for (uint32_t i = 0; i < len; i++) 1801 1811 { … … 1829 1839 } 1830 1840 break; 1831 default:1832 1841 case 0x01: /* PCI-PCI bridge */ 1842 fP2PBridge = true; 1833 1843 switch (addr) 1834 1844 { … … 1848 1858 fWritable = true; 1849 1859 break; 1850 } 1851 break; 1860 } 1861 break; 1862 default: 1863 AssertMsgFailed(("Unknown header type %x\n", PCIDevGetHeaderType(aDev))); 1864 fWritable = false; 1865 break; 1852 1866 } 1853 1867 … … 1886 1900 case VBOX_PCI_BASE_ADDRESS_5: case VBOX_PCI_BASE_ADDRESS_5+1: case VBOX_PCI_BASE_ADDRESS_5+2: case VBOX_PCI_BASE_ADDRESS_5+3: 1887 1901 { 1888 int iRegion = fRom ? VBOX_PCI_ROM_SLOT : (addr - VBOX_PCI_BASE_ADDRESS_0) >> 2; 1889 int iOffset = addr & 0x3; 1890 ich9pciWriteBarByte(aDev, iRegion, iOffset, u8Val); 1891 fUpdateMappings = true; 1902 /* We check that, as same PCI register numbers as BARs may mean different registers for bridges */ 1903 if (fP2PBridge) 1904 goto default_case; 1905 else 1906 { 1907 int iRegion = fRom ? VBOX_PCI_ROM_SLOT : (addr - VBOX_PCI_BASE_ADDRESS_0) >> 2; 1908 int iOffset = addr & 0x3; 1909 ich9pciWriteBarByte(aDev, iRegion, iOffset, u8Val); 1910 fUpdateMappings = true; 1911 } 1892 1912 break; 1893 1913 } 1894 1914 default: 1915 default_case: 1895 1916 if (fWritable) 1896 1917 PCIDevSetByte(aDev, addr, u8Val);
Note:
See TracChangeset
for help on using the changeset viewer.