VirtualBox

Changeset 68090 in vbox for trunk/src/VBox/Devices


Ignore:
Timestamp:
Jul 24, 2017 10:47:15 AM (7 years ago)
Author:
vboxsync
Message:

PCI/ICH9: Implement CFGM key to change the port type of a PCI express bridge

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Bus/DevPciIch9.cpp

    r67709 r68090  
    31823182}
    31833183
     3184/**
     3185 * Returns the PCI express encoding for the given PCI Express Device/Port type string.
     3186 *
     3187 * @returns PCI express encoding.
     3188 * @param   pszExpressPortType    The string identifier for the port/device type.
     3189 */
     3190static uint8_t ich9pcibridgeR3GetExpressPortTypeFromString(const char *pszExpressPortType)
     3191{
     3192    if (!RTStrCmp(pszExpressPortType, "EndPtDev"))
     3193        return VBOX_PCI_EXP_TYPE_ENDPOINT;
     3194    else if (!RTStrCmp(pszExpressPortType, "LegEndPtDev"))
     3195        return VBOX_PCI_EXP_TYPE_LEG_END;
     3196    else if (!RTStrCmp(pszExpressPortType, "RootCmplxRootPort"))
     3197        return VBOX_PCI_EXP_TYPE_ROOT_PORT;
     3198    else if (!RTStrCmp(pszExpressPortType, "ExpressSwUpstream"))
     3199        return VBOX_PCI_EXP_TYPE_UPSTREAM;
     3200    else if (!RTStrCmp(pszExpressPortType, "ExpressSwDownstream"))
     3201        return VBOX_PCI_EXP_TYPE_DOWNSTREAM;
     3202    else if (!RTStrCmp(pszExpressPortType, "Express2PciBridge"))
     3203        return VBOX_PCI_EXP_TYPE_PCI_BRIDGE;
     3204    else if (!RTStrCmp(pszExpressPortType, "Pci2ExpressBridge"))
     3205        return VBOX_PCI_EXP_TYPE_PCIE_BRIDGE;
     3206    else if (!RTStrCmp(pszExpressPortType, "RootCmplxIntEp"))
     3207        return VBOX_PCI_EXP_TYPE_ROOT_INT_EP;
     3208    else if (!RTStrCmp(pszExpressPortType, "RootCmplxEc"))
     3209        return VBOX_PCI_EXP_TYPE_ROOT_EC;
     3210
     3211    AssertLogRelMsgFailedReturn(("Unknown express port type specified"), VBOX_PCI_EXP_TYPE_ROOT_INT_EP);
     3212}
    31843213
    31853214/**
     
    32913320     * Validate and read configuration.
    32923321     */
    3293     if (!CFGMR3AreValuesValid(pCfg, "GCEnabled\0" "R0Enabled\0" "ExpressEnabled\0"))
     3322    if (!CFGMR3AreValuesValid(pCfg, "GCEnabled\0" "R0Enabled\0" "ExpressEnabled\0" "ExpressPortType\0"))
    32943323        return VERR_PDM_DEVINS_UNKNOWN_CFG_VALUES;
    32953324
     
    33153344        return PDMDEV_SET_ERROR(pDevIns, rc,
    33163345                                N_("Configuration error: Failed to query boolean value \"ExpressEnabled\""));
     3346
     3347    char *pszExpressPortType;
     3348    rc = CFGMR3QueryStringAllocDef(pCfg, "ExpressPortType",
     3349                                   &pszExpressPortType, "RootCmplxIntEp");
     3350    if (RT_FAILURE(rc))
     3351        return PDMDEV_SET_ERROR(pDevIns, rc,
     3352                                N_("LsiLogic configuration error: failed to read \"ExpressPortType\" as string"));
     3353
     3354    uint8_t uExpressPortType = ich9pcibridgeR3GetExpressPortTypeFromString(pszExpressPortType);
     3355    MMR3HeapFree(pszExpressPortType);
    33173356
    33183357    pDevIns->IBase.pfnQueryInterface = ich9pcibridgeQueryInterface;
     
    33973436        PDMPciDevSetWord(&pBus->PciDev, 0xa0 + 2,
    33983437                        /* version */ 0x2
    3399                       | /* Root Complex Integrated Endpoint */ (VBOX_PCI_EXP_TYPE_ROOT_INT_EP << 4));
     3438                      | (uExpressPortType << 4));
    34003439        PDMPciDevSetDWord(&pBus->PciDev, 0xa0 + 4, VBOX_PCI_EXP_DEVCAP_RBE); /* Device capabilities. */
    34013440        PDMPciDevSetWord(&pBus->PciDev, 0xa0 + 8, 0x0000); /* Device control. */
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette