Changeset 64463 in vbox
- Timestamp:
- Oct 28, 2016 2:21:03 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Bus/DevPciIch9.cpp
r64461 r64463 1930 1930 1931 1931 1932 DECLINLINE(void) ich9pciWriteBarByte(PPDMPCIDEV pPciDev, uint32_t iRegion, uint32_t off, uint8_t bVal) 1932 /** 1933 * Worker for devpciR3CommonDefaultConfigWrite that write a byte to a BAR. 1934 * 1935 * @param pPciDev The PCI device. 1936 * @param iRegion The region. 1937 * @param off The BAR offset. 1938 * @param bVal The byte to write. 1939 */ 1940 DECLINLINE(void) devpciR3WriteBarByte(PPDMPCIDEV pPciDev, uint32_t iRegion, uint32_t off, uint8_t bVal) 1933 1941 { 1934 1942 PCIIORegion *pRegion = &pPciDev->Int.s.aIORegions[iRegion]; 1935 Log3((" ich9pciWriteBarByte: region=%d off=%d val=%#x size=%#llx\n", iRegion, off, bVal, pRegion->size));1943 Log3(("devpciR3WriteBarByte: region=%d off=%d val=%#x size=%#llx\n", iRegion, off, bVal, pRegion->size)); 1936 1944 Assert(off <= 3); 1937 1945 … … 1960 1968 bVal = (bOld & bMask) | (bVal & ~bMask); 1961 1969 1962 Log3((" ich9pciWriteBarByte: %x changed to %x\n", bOld, bVal));1970 Log3(("devpciR3WriteBarByte: %x changed to %x\n", bOld, bVal)); 1963 1971 1964 1972 PCIDevSetByte(pPciDev, uAddr, bVal); 1973 } 1974 } 1975 1976 1977 /** 1978 * Checks if the given configuration byte is writable. 1979 * 1980 * @returns true if writable, false if not 1981 * @param uAddress The config space byte byte. 1982 * @param bHeaderType The device header byte. 1983 */ 1984 DECLINLINE(bool) devpciR3IsConfigByteWritable(uint32_t uAddress, uint8_t bHeaderType) 1985 { 1986 switch (bHeaderType) 1987 { 1988 case 0x00: /* normal device */ 1989 case 0x80: /* multi-function device */ 1990 switch (uAddress) 1991 { 1992 /* Read-only registers. */ 1993 case VBOX_PCI_VENDOR_ID: 1994 case VBOX_PCI_VENDOR_ID+1: 1995 case VBOX_PCI_DEVICE_ID: 1996 case VBOX_PCI_DEVICE_ID+1: 1997 case VBOX_PCI_REVISION_ID: 1998 case VBOX_PCI_CLASS_PROG: 1999 case VBOX_PCI_CLASS_SUB: 2000 case VBOX_PCI_CLASS_BASE: 2001 case VBOX_PCI_HEADER_TYPE: 2002 case VBOX_PCI_SUBSYSTEM_VENDOR_ID: 2003 case VBOX_PCI_SUBSYSTEM_VENDOR_ID+1: 2004 case VBOX_PCI_SUBSYSTEM_ID: 2005 case VBOX_PCI_SUBSYSTEM_ID+1: 2006 case VBOX_PCI_ROM_ADDRESS: 2007 case VBOX_PCI_ROM_ADDRESS+1: 2008 case VBOX_PCI_ROM_ADDRESS+2: 2009 case VBOX_PCI_ROM_ADDRESS+3: 2010 case VBOX_PCI_CAPABILITY_LIST: 2011 case VBOX_PCI_INTERRUPT_PIN: 2012 return false; 2013 /* Other registers can be written. */ 2014 default: 2015 return true; 2016 } 2017 break; 2018 case 0x01: /* PCI-PCI bridge */ 2019 switch (uAddress) 2020 { 2021 /* Read-only registers. */ 2022 case VBOX_PCI_VENDOR_ID: 2023 case VBOX_PCI_VENDOR_ID+1: 2024 case VBOX_PCI_DEVICE_ID: 2025 case VBOX_PCI_DEVICE_ID+1: 2026 case VBOX_PCI_REVISION_ID: 2027 case VBOX_PCI_CLASS_PROG: 2028 case VBOX_PCI_CLASS_SUB: 2029 case VBOX_PCI_CLASS_BASE: 2030 case VBOX_PCI_HEADER_TYPE: 2031 case VBOX_PCI_ROM_ADDRESS_BR: 2032 case VBOX_PCI_ROM_ADDRESS_BR+1: 2033 case VBOX_PCI_ROM_ADDRESS_BR+2: 2034 case VBOX_PCI_ROM_ADDRESS_BR+3: 2035 case VBOX_PCI_INTERRUPT_PIN: 2036 return false; 2037 /* Other registers can be written. */ 2038 default: 2039 return true; 2040 } 2041 break; 2042 default: 2043 AssertMsgFailed(("Unknown header type %#x\n", bHeaderType)); 2044 return false; 1965 2045 } 1966 2046 } … … 2004 2084 * try emulate that. 2005 2085 */ 2006 bool fUpdateMappings = false;2007 bool fP2PBridge = false;2008 uint8_t bHeaderType = ich9pciGetByte(pPciDev, VBOX_PCI_HEADER_TYPE);2086 uint8_t const bHeaderType = ich9pciGetByte(pPciDev, VBOX_PCI_HEADER_TYPE); 2087 bool const fP2PBridge = bHeaderType == 0x01; /* PCI-PCI bridge */ 2088 bool fUpdateMappings = false; 2009 2089 while (cb-- > 0) 2010 2090 { 2011 /* 2012 * Check writability first. 2013 */ 2014 bool fWritable = false; 2015 switch (bHeaderType) 2016 { 2017 case 0x00: /* normal device */ 2018 case 0x80: /* multi-function device */ 2019 switch (uAddress) 2020 { 2021 /* Read-only registers. */ 2022 case VBOX_PCI_VENDOR_ID: 2023 case VBOX_PCI_VENDOR_ID+1: 2024 case VBOX_PCI_DEVICE_ID: 2025 case VBOX_PCI_DEVICE_ID+1: 2026 case VBOX_PCI_REVISION_ID: 2027 case VBOX_PCI_CLASS_PROG: 2028 case VBOX_PCI_CLASS_SUB: 2029 case VBOX_PCI_CLASS_BASE: 2030 case VBOX_PCI_HEADER_TYPE: 2031 case VBOX_PCI_SUBSYSTEM_VENDOR_ID: 2032 case VBOX_PCI_SUBSYSTEM_VENDOR_ID+1: 2033 case VBOX_PCI_SUBSYSTEM_ID: 2034 case VBOX_PCI_SUBSYSTEM_ID+1: 2035 case VBOX_PCI_ROM_ADDRESS: 2036 case VBOX_PCI_ROM_ADDRESS+1: 2037 case VBOX_PCI_ROM_ADDRESS+2: 2038 case VBOX_PCI_ROM_ADDRESS+3: 2039 case VBOX_PCI_CAPABILITY_LIST: 2040 case VBOX_PCI_INTERRUPT_PIN: 2041 fWritable = false; 2042 break; 2043 /* Other registers can be written. */ 2044 default: 2045 fWritable = true; 2046 break; 2047 } 2048 break; 2049 case 0x01: /* PCI-PCI bridge */ 2050 fP2PBridge = true; 2051 switch (uAddress) 2052 { 2053 /* Read-only registers. */ 2054 case VBOX_PCI_VENDOR_ID: 2055 case VBOX_PCI_VENDOR_ID+1: 2056 case VBOX_PCI_DEVICE_ID: 2057 case VBOX_PCI_DEVICE_ID+1: 2058 case VBOX_PCI_REVISION_ID: 2059 case VBOX_PCI_CLASS_PROG: 2060 case VBOX_PCI_CLASS_SUB: 2061 case VBOX_PCI_CLASS_BASE: 2062 case VBOX_PCI_HEADER_TYPE: 2063 case VBOX_PCI_ROM_ADDRESS_BR: 2064 case VBOX_PCI_ROM_ADDRESS_BR+1: 2065 case VBOX_PCI_ROM_ADDRESS_BR+2: 2066 case VBOX_PCI_ROM_ADDRESS_BR+3: 2067 case VBOX_PCI_INTERRUPT_PIN: 2068 fWritable = false; 2069 break; 2070 /* Other registers can be written. */ 2071 default: 2072 fWritable = true; 2073 break; 2074 } 2075 break; 2076 default: 2077 AssertMsgFailed(("Unknown header type %#x\n", bHeaderType)); 2078 fWritable = false; 2079 break; 2080 } 2081 2091 bool fWritable = devpciR3IsConfigByteWritable(uAddress, bHeaderType); 2092 uint8_t bVal = (uint8_t)u32Value; 2082 2093 bool fRom = false; 2083 uint8_t bVal = (uint8_t)u32Value;2084 2094 switch (uAddress) 2085 2095 { … … 2128 2138 { 2129 2139 uint32_t iRegion = fRom ? VBOX_PCI_ROM_SLOT : (uAddress - VBOX_PCI_BASE_ADDRESS_0) >> 2; 2130 ich9pciWriteBarByte(pPciDev, iRegion, uAddress & 0x3, bVal);2140 devpciR3WriteBarByte(pPciDev, iRegion, uAddress & 0x3, bVal); 2131 2141 fUpdateMappings = true; 2132 2142 break;
Note:
See TracChangeset
for help on using the changeset viewer.