Changeset 65845 in vbox for trunk/src/VBox
- Timestamp:
- Feb 22, 2017 8:42:48 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Bus/DevPciIch9.cpp
r65844 r65845 474 474 } 475 475 476 /* irqs corresponding to PCI irqs A-D, must match pci_irq_list in rombios.c */ 476 /* irqs corresponding to PCI irqs A-D, must match pci_irq_list in pcibios.inc */ 477 /** @todo r=klaus inconsistent! ich9 doesn't implement PIRQ yet, so both needs to be addressed and tested thoroughly. */ 477 478 static const uint8_t aPciIrqs[4] = { 11, 10, 9, 5 }; 478 479 … … 568 569 { 569 570 pPciDev->Int.s.uIrqPinState = (iLevel & PDM_IRQ_LEVEL_HIGH); 571 572 /** @todo r=klaus: implement PIRQ handling (if APIC isn't active). Needed for legacy OSes which don't use the APIC stuff. */ 570 573 571 574 /* Send interrupt to I/O APIC only now. */ … … 2204 2207 uint64_t const cbAbove4GB = MMR3PhysGetRamSizeAbove4GB(pVM); 2205 2208 2209 /** @todo r=klaus this needs to do the same elcr magic as DevPCI.cpp, as the BIOS can't be trusted to do the right thing. Of course it's more difficult than with the old code, as there are bridges to be handled. The interrupt routing needs to be taken into account. Also I highly suspect that the chipset has 8 interrupt lines which we might be able to use for handling things on the root bus better (by treating them as devices on the mainboard). */ 2210 2206 2211 /* 2207 2212 * Set the start addresses. … … 2339 2344 2340 2345 /** 2341 * Worker for devpciR3 IsConfigByteWritable that updateBAR and ROM mappings.2346 * Worker for devpciR3CommonDefaultConfigWrite that updates BAR and ROM mappings. 2342 2347 * 2343 2348 * @param pPciDev The PCI device to update the mappings for. … … 2346 2351 static void devpciR3UpdateMappings(PPDMPCIDEV pPciDev, bool fP2PBridge) 2347 2352 { 2353 /** @todo r=klaus analyze if it's safe to rely on cached config space data, as that's cheaper to read in the raw pci device and pass-through cases. */ 2348 2354 uint16_t const u16Cmd = ich9pciGetWord(pPciDev, VBOX_PCI_COMMAND); 2349 2355 for (unsigned iRegion = 0; iRegion < VBOX_PCI_NUM_REGIONS; iRegion++) … … 3059 3065 /** @todo Disabled for now because this causes error messages with Linux guests. 3060 3066 * The guest loads the x38_edac device which tries to map a memory region 3061 * using an address given at place 0x48 - 0x4f in the PC iconfig space.3067 * using an address given at place 0x48 - 0x4f in the PCI config space. 3062 3068 * This fails. because we don't register such a region. 3063 3069 */ … … 3302 3308 * Validate and read configuration. 3303 3309 */ 3304 if (!CFGMR3AreValuesValid(pCfg, "GCEnabled\0" "R0Enabled\0" ))3310 if (!CFGMR3AreValuesValid(pCfg, "GCEnabled\0" "R0Enabled\0" "ExpressEnabled\0")) 3305 3311 return VERR_PDM_DEVINS_UNKNOWN_CFG_VALUES; 3306 3312 … … 3319 3325 N_("Configuration error: Failed to query boolean value \"R0Enabled\"")); 3320 3326 Log(("PCI: fGCEnabled=%RTbool fR0Enabled=%RTbool\n", fGCEnabled, fR0Enabled)); 3327 3328 /* check if we're supposed to implement a PCIe bridge. */ 3329 bool fExpress; 3330 rc = CFGMR3QueryBoolDef(pCfg, "ExpressEnabled", &fExpress, false); 3331 if (RT_FAILURE(rc)) 3332 return PDMDEV_SET_ERROR(pDevIns, rc, 3333 N_("Configuration error: Failed to query boolean value \"ExpressEnabled\"")); 3321 3334 3322 3335 pDevIns->IBase.pfnQueryInterface = ich9pcibridgeQueryInterface; … … 3332 3345 pBus->pDevInsR0 = PDMDEVINS_2_R0PTR(pDevIns); 3333 3346 pBus->pDevInsRC = PDMDEVINS_2_RCPTR(pDevIns); 3347 /** @todo r=klaus figure out how to extend this to allow PCIe config space 3348 * extension, which increases the config space frorm 256 bytes to 4K. */ 3334 3349 pBus->papBridgesR3 = (PPDMPCIDEV *)PDMDevHlpMMHeapAllocZ(pDevIns, sizeof(PPDMPCIDEV) * RT_ELEMENTS(pBus->apDevices)); 3335 3350 AssertLogRelReturn(pBus->papBridgesR3, VERR_NO_MEMORY); … … 3373 3388 */ 3374 3389 PDMPciDevSetVendorId( &pBus->PciDev, 0x8086); /* Intel */ 3375 PDMPciDevSetDeviceId( &pBus->PciDev, 0x2448); /* 82801 Mobile PCI bridge. */ 3376 PDMPciDevSetRevisionId(&pBus->PciDev, 0xf2); 3390 if (fExpress) 3391 { 3392 PDMPciDevSetDeviceId(&pBus->PciDev, 0x29e1); /* 82X38/X48 Express Host-Primary PCI Express Bridge. */ 3393 PDMPciDevSetRevisionId(&pBus->PciDev, 0x01); 3394 } 3395 else 3396 { 3397 PDMPciDevSetDeviceId(&pBus->PciDev, 0x2448); /* 82801 Mobile PCI bridge. */ 3398 PDMPciDevSetRevisionId(&pBus->PciDev, 0xf2); 3399 } 3377 3400 PDMPciDevSetClassSub( &pBus->PciDev, 0x04); /* pci2pci */ 3378 3401 PDMPciDevSetClassBase( &pBus->PciDev, 0x06); /* PCI_bridge */ 3379 PDMPciDevSetClassProg( &pBus->PciDev, 0x01); /* Supports subtractive decoding. */ 3402 if (fExpress) 3403 PDMPciDevSetClassProg(&pBus->PciDev, 0x00); /* Normal decoding. */ 3404 else 3405 PDMPciDevSetClassProg(&pBus->PciDev, 0x01); /* Supports subtractive decoding. */ 3380 3406 PDMPciDevSetHeaderType(&pBus->PciDev, 0x01); /* Single function device which adheres to the PCI-to-PCI bridge spec. */ 3381 PDMPciDevSetCommand( &pBus->PciDev, 0x00); 3382 PDMPciDevSetStatus( &pBus->PciDev, 0x20); /* 66MHz Capable. */ 3407 if (fExpress) 3408 { 3409 PDMPciDevSetCommand(&pBus->PciDev, VBOX_PCI_COMMAND_SERR); 3410 PDMPciDevSetStatus(&pBus->PciDev, VBOX_PCI_STATUS_CAP_LIST); /* Has capabilities. */ 3411 PDMPciDevSetByte(&pBus->PciDev, VBOX_PCI_CACHE_LINE_SIZE, 8); /* 32 bytes */ 3412 /* PCI Express */ 3413 PDMPciDevSetByte(&pBus->PciDev, 0xa0 + 0, VBOX_PCI_CAP_ID_EXP); /* PCI_Express */ 3414 PDMPciDevSetByte(&pBus->PciDev, 0xa0 + 1, 0); /* next */ 3415 PDMPciDevSetWord(&pBus->PciDev, 0xa0 + 2, 3416 /* version */ 0x2 3417 | /* Root Complex Integrated Endpoint */ (VBOX_PCI_EXP_TYPE_ROOT_INT_EP << 4)); 3418 PDMPciDevSetDWord(&pBus->PciDev, 0xa0 + 4, VBOX_PCI_EXP_DEVCAP_RBE); /* Device capabilities. */ 3419 PDMPciDevSetWord(&pBus->PciDev, 0xa0 + 8, 0x0000); /* Device control. */ 3420 PDMPciDevSetWord(&pBus->PciDev, 0xa0 + 10, 0x0000); /* Device status. */ 3421 PDMPciDevSetDWord(&pBus->PciDev, 0xa0 + 12, 3422 /* Max Link Speed */ 2 3423 | /* Maximum Link Width */ (16 << 4) 3424 | /* Active State Power Management (ASPM) Sopport */ (0 << 10) 3425 | VBOX_PCI_EXP_LNKCAP_LBNC 3426 | /* Port Number */ ((2 + iInstance) << 24)); /* Link capabilities. */ 3427 PDMPciDevSetWord(&pBus->PciDev, 0xa0 + 16, VBOX_PCI_EXP_LNKCTL_CLOCK); /* Link control. */ 3428 PDMPciDevSetWord(&pBus->PciDev, 0xa0 + 18, 3429 /* Current Link Speed */ 2 3430 | /* Negotiated Link Width */ (16 << 4) 3431 | VBOX_PCI_EXP_LNKSTA_SL_CLK); /* Link status. */ 3432 PDMPciDevSetDWord(&pBus->PciDev, 0xa0 + 20, 3433 /* Slot Power Limit Value */ (75 << 7) 3434 | /* Physical Slot Number */ (0 << 19)); /* Slot capabilities. */ 3435 PDMPciDevSetWord(&pBus->PciDev, 0xa0 + 24, 0x0000); /* Slot control. */ 3436 PDMPciDevSetWord(&pBus->PciDev, 0xa0 + 26, 0x0000); /* Slot status. */ 3437 PDMPciDevSetWord(&pBus->PciDev, 0xa0 + 28, 0x0000); /* Root control. */ 3438 PDMPciDevSetWord(&pBus->PciDev, 0xa0 + 30, 0x0000); /* Root capabilities. */ 3439 PDMPciDevSetDWord(&pBus->PciDev, 0xa0 + 32, 0x00000000); /* Root status. */ 3440 PDMPciDevSetDWord(&pBus->PciDev, 0xa0 + 36, 0x00000000); /* Device capabilities 2. */ 3441 PDMPciDevSetWord(&pBus->PciDev, 0xa0 + 40, 0x0000); /* Device control 2. */ 3442 PDMPciDevSetWord(&pBus->PciDev, 0xa0 + 42, 0x0000); /* Device status 2. */ 3443 PDMPciDevSetDWord(&pBus->PciDev, 0xa0 + 44, 3444 /* Supported Link Speeds Vector */ (2 << 1)); /* Link capabilities 2. */ 3445 PDMPciDevSetWord(&pBus->PciDev, 0xa0 + 48, 3446 /* Target Link Speed */ 2); /* Link control 2. */ 3447 PDMPciDevSetWord(&pBus->PciDev, 0xa0 + 50, 0x0000); /* Link status 2. */ 3448 PDMPciDevSetDWord(&pBus->PciDev, 0xa0 + 52, 0x00000000); /* Slot capabilities 2. */ 3449 PDMPciDevSetWord(&pBus->PciDev, 0xa0 + 56, 0x0000); /* Slot control 2. */ 3450 PDMPciDevSetWord(&pBus->PciDev, 0xa0 + 58, 0x0000); /* Slot status 2. */ 3451 PDMPciDevSetCapabilityList(&pBus->PciDev, 0xa0); 3452 } 3453 else 3454 { 3455 PDMPciDevSetCommand(&pBus->PciDev, 0x00); 3456 PDMPciDevSetStatus(&pBus->PciDev, 0x20); /* 66MHz Capable. */ 3457 } 3383 3458 PDMPciDevSetInterruptLine(&pBus->PciDev, 0x00); /* This device does not assert interrupts. */ 3384 3459 … … 3388 3463 */ 3389 3464 PDMPciDevSetInterruptPin (&pBus->PciDev, 0x00); 3465 3466 if (fExpress) 3467 { 3468 /** @todo r=klaus set up the PCIe config space beyond the old 256 byte 3469 * limit, containing additional capability descriptors. */ 3470 } 3390 3471 3391 3472 /*
Note:
See TracChangeset
for help on using the changeset viewer.