- Timestamp:
- Oct 28, 2016 2:14:25 PM (8 years ago)
- svn:sync-xref-src-repo-rev:
- 111595
- Location:
- trunk/src/VBox/Devices/Bus
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Bus/DevPCI.cpp
r64456 r64461 204 204 } 205 205 206 207 static DECLCALLBACK(void) pci_default_write_config(PPDMDEVINS pDevIns, PDMPCIDEV *d, uint32_t address, uint32_t val, unsigned len)208 {209 NOREF(pDevIns);210 int can_write;211 unsigned i;212 uint32_t end, addr;213 214 if (len == 4 && ((address >= 0x10 && address < 0x10 + 4 * 6) ||215 (address >= 0x30 && address < 0x34))) {216 PCIIORegion *r;217 int reg;218 219 if ( address >= 0x30 ) {220 reg = PCI_ROM_SLOT;221 }else{222 reg = (address - 0x10) >> 2;223 }224 r = &d->Int.s.aIORegions[reg];225 if (r->size == 0)226 goto default_config;227 /* compute the stored value */228 if (reg == PCI_ROM_SLOT) {229 /* keep ROM enable bit */230 val &= (~(r->size - 1)) | 1;231 } else {232 val &= ~(r->size - 1);233 val |= r->type;234 }235 *(uint32_t *)(d->abConfig + address) = RT_H2LE_U32(val);236 pci_update_mappings(d);237 return;238 }239 default_config:240 /* not efficient, but simple */241 addr = address;242 for(i = 0; i < len; i++) {243 /* default read/write accesses */244 switch(d->abConfig[0x0e]) {245 case 0x00: /* normal device */246 case 0x80: /* multi-function device */247 switch(addr) {248 case 0x00:249 case 0x01:250 case 0x02:251 case 0x03:252 case 0x08:253 case 0x09:254 case 0x0a:255 case 0x0b:256 case 0x0e:257 case 0x10: case 0x11: case 0x12: case 0x13: case 0x14: case 0x15: case 0x16: case 0x17: /* base */258 case 0x18: case 0x19: case 0x1a: case 0x1b: case 0x1c: case 0x1d: case 0x1e: case 0x1f:259 case 0x20: case 0x21: case 0x22: case 0x23: case 0x24: case 0x25: case 0x26: case 0x27:260 case 0x2c: case 0x2d: /* subsystem ID */261 case 0x2e: case 0x2f: /* vendor ID */262 case 0x30: case 0x31: case 0x32: case 0x33: /* rom */263 case 0x34: /* Capabilities pointer. */264 case 0x3d: /* Interrupt pin. */265 can_write = 0;266 break;267 default:268 can_write = 1;269 break;270 }271 break;272 default:273 case 0x01: /* bridge */274 switch(addr) {275 case 0x00:276 case 0x01:277 case 0x02:278 case 0x03:279 case 0x08:280 case 0x09:281 case 0x0a:282 case 0x0b:283 case 0x0e:284 case 0x38: case 0x39: case 0x3a: case 0x3b: /* rom */285 case 0x3d:286 can_write = 0;287 break;288 default:289 can_write = 1;290 break;291 }292 break;293 }294 #ifdef VBOX295 if (addr == 0x05) /* Command register, bits 8-15. */296 {297 /* don't change reserved bits (11-15) */298 val &= ~UINT32_C(0xf8);299 d->abConfig[addr] = val;300 }301 else if (addr == 0x06) /* Status register, bits 0-7. */302 {303 /* don't change read-only bits => actually all lower bits are read-only */304 val &= ~UINT32_C(0xff);305 /* status register, low part: clear bits by writing a '1' to the corresponding bit */306 d->abConfig[addr] &= ~val;307 }308 else if (addr == 0x07) /* Status register, bits 8-15. */309 {310 /* don't change read-only bits */311 val &= ~UINT32_C(0x06);312 /* status register, high part: clear bits by writing a '1' to the corresponding bit */313 d->abConfig[addr] &= ~val;314 }315 else316 #endif317 if (can_write) {318 d->abConfig[addr] = val;319 }320 addr++;321 val >>= 8;322 }323 324 end = address + len;325 if (end > PCI_COMMAND && address < (PCI_COMMAND + 2)) {326 /* if the command register is modified, we must modify the mappings */327 pci_update_mappings(d);328 }329 }330 331 206 #endif /* IN_RING3 */ 332 207 … … 1086 961 * as a possible file #2 contains external code if there's any left. 1087 962 */ 1088 # define pciR3UnmergedConfigWriteDev pci_default_write_config1089 963 # include "DevPciMerge1.cpp.h" 1090 964 -
trunk/src/VBox/Devices/Bus/DevPciIch9.cpp
r64460 r64461 81 81 static void ich9pcibridgeReset(PPDMDEVINS pDevIns); 82 82 static void ich9pciUpdateMappings(PDMPCIDEV *pDev); 83 static DECLCALLBACK(void) ich9pciConfigWriteDev(PPDMDEVINS pDevIns, PPDMPCIDEV pPciDev, uint32_t u32Address, uint32_t val, unsigned len);84 83 DECLINLINE(PPDMPCIDEV) ich9pciFindBridge(PDEVPCIBUS pBus, uint8_t iBus); 85 84 static void ich9pciBiosInitDevice(PDEVPCIROOT pGlobals, uint8_t uBus, uint8_t uDevFn); … … 1975 1974 * definition of registers and their writability policy. 1976 1975 */ 1977 static DECLCALLBACK(void) ich9pciConfigWriteDev(PPDMDEVINS pDevIns, PPDMPCIDEV pPciDev,1978 uint32_t uAddress, uint32_t u32Value, unsigned cb)1976 DECLCALLBACK(void) devpciR3CommonDefaultConfigWrite(PPDMDEVINS pDevIns, PPDMPCIDEV pPciDev, 1977 uint32_t uAddress, uint32_t u32Value, unsigned cb) 1979 1978 { 1980 1979 NOREF(pDevIns); -
trunk/src/VBox/Devices/Bus/DevPciInternal.h
r64456 r64461 191 191 PFNPCICONFIGWRITE pfnWrite, PPFNPCICONFIGWRITE ppfnWriteOld); 192 192 DECLCALLBACK(uint32_t) devpciR3CommonDefaultConfigRead(PPDMDEVINS pDevIns, PPDMPCIDEV pPciDev, uint32_t uAddress, unsigned cb); 193 DECLCALLBACK(void) devpciR3CommonDefaultConfigWrite(PPDMDEVINS pDevIns, PPDMPCIDEV pPciDev, 194 uint32_t uAddress, uint32_t u32Value, unsigned cb); 193 195 void devpciR3CommonRestoreConfig(PPDMPCIDEV pDev, uint8_t const *pbSrcConfig, bool fIsBridge); 194 196 -
trunk/src/VBox/Devices/Bus/DevPciMerge1.cpp.h
r64456 r64461 224 224 AssertCompileMemberOffset(DEVPCIROOT, PciBus, 0); 225 225 return pciR3MergedRegisterDeviceOnBus(pBus, pPciDev, fFlags, uPciDevNo, uPciFunNo, pszName, 226 devpciR3CommonDefaultConfigRead, pciR3UnmergedConfigWriteDev);226 devpciR3CommonDefaultConfigRead, devpciR3CommonDefaultConfigWrite); 227 227 } 228 228 … … 236 236 PDEVPCIBUS pBus = PDMINS_2_DATA(pDevIns, PDEVPCIBUS); 237 237 return pciR3MergedRegisterDeviceOnBus(pBus, pPciDev, fFlags, uPciDevNo, uPciFunNo, pszName, 238 devpciR3CommonDefaultConfigRead, pciR3UnmergedConfigWriteDev);239 } 240 238 devpciR3CommonDefaultConfigRead, devpciR3CommonDefaultConfigWrite); 239 } 240
Note:
See TracChangeset
for help on using the changeset viewer.