VirtualBox

Changeset 17077 in vbox for trunk


Ignore:
Timestamp:
Feb 24, 2009 4:58:15 PM (16 years ago)
Author:
vboxsync
Message:

pass IDE controller type as string in config

Location:
trunk/src/VBox
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Storage/DevATA.cpp

    r17075 r17077  
    60866086}
    60876087
     6088/**
     6089 * Convert config value to DEVPCBIOSBOOT.
     6090 *
     6091 * @returns VBox status code.
     6092 * @param   pDevIns     The device instance data.
     6093 * @param   pCfgHandle  Configuration handle.
     6094 * @param   penmChipset Where to store the chipset type.
     6095 */
     6096static int ataControllerFromCfg(PPDMDEVINS pDevIns, PCFGMNODE pCfgHandle, CHIPSET *penmChipset)
     6097{
     6098    char szType[20];
     6099
     6100    int rc = CFGMR3QueryString(pCfgHandle, "Type", &szType[0], sizeof(szType));
     6101    if (RT_FAILURE(rc))
     6102        return PDMDevHlpVMSetError(pDevIns, rc, RT_SRC_POS,
     6103                                   N_("Configuration error: Querying \"Type\" as a string failed"));
     6104    if (!strcmp(szType, "PIIX3"))
     6105        *penmChipset = CHIPSET_PIIX3;
     6106    else if (!strcmp(szType, "PIIX4"))
     6107        *penmChipset = CHIPSET_PIIX4;
     6108    else if (!strcmp(szType, "ICH6"))
     6109        *penmChipset = CHIPSET_ICH6;
     6110    else
     6111    {
     6112        PDMDevHlpVMSetError(pDevIns, rc, RT_SRC_POS,
     6113                            N_("Configuration error: The \"Type\" value \"%s\" is unknown"),
     6114                            szType);
     6115        rc = VERR_INTERNAL_ERROR;
     6116    }
     6117    return rc;
     6118}
     6119
    60886120
    60896121/**
     
    61476179    Assert(DelayIRQMillies < 50);
    61486180
    6149     pThis->u8Type = CHIPSET_PIIX3;
    6150     uint32_t type;
    6151     rc = CFGMR3QueryU32Def(pCfgHandle, "Type", &type, 0);
     6181    CHIPSET enmChipset = CHIPSET_PIIX3;
     6182    rc = ataControllerFromCfg(pDevIns, pCfgHandle, &enmChipset);
    61526183    if (RT_FAILURE(rc))
    6153         return PDMDEV_SET_ERROR(pDevIns, rc,
    6154                                 N_("PIIX3 configuration error: failed to read Type as integer"));
    6155     Log(("%s: type=%d\n", __FUNCTION__, type));
    6156     /** See IDEControllerType in VirtualBox.xidl */
    6157     switch (type)
    6158     {
    6159         case 0:
    6160             /** @todo: what is right here? */
    6161             AssertMsgFailed(("What do we do here: type Null\n"));
    6162             break;
    6163         case 1:
    6164             pThis->u8Type = CHIPSET_PIIX3;
    6165             break;
    6166         case 2:
    6167             pThis->u8Type = CHIPSET_PIIX4;
    6168             break;
    6169         case 3:
    6170             pThis->u8Type = CHIPSET_ICH6;
    6171             break;
    6172         default:
    6173             AssertMsgFailed(("Unknown IDE type: %d\n", type));
    6174     }
    6175 
     6184        return rc;
     6185    pThis->u8Type = (uint8_t)enmChipset;
     6186   
    61766187    /*
    61776188     * Initialize data (most of it anyway).
  • trunk/src/VBox/Main/ConsoleImpl2.cpp

    r17075 r17077  
    8080#endif
    8181
    82 
     82/**
     83 * Translate IDEControllerType_T to string representation.
     84 */
     85const char* controllerString(IDEControllerType_T enmType)
     86{
     87    switch (enmType)
     88    {
     89        case IDEControllerType_PIIX3:
     90            return "PIIX3";
     91        case IDEControllerType_PIIX4:
     92            return "PIIX4";
     93        case IDEControllerType_ICH6:
     94            return "ICH6";
     95        default:
     96            return "Unknown";
     97    }
     98}
    8399/*
    84100 * VC++ 8 / amd64 has some serious trouble with this function.
     
    780796    rc = CFGMR3InsertInteger(pIdeInst, "PCIFunctionNo",        1);                  RC_CHECK();
    781797    rc = CFGMR3InsertNode(pIdeInst,    "Config", &pCfg);                            RC_CHECK();
    782     rc = CFGMR3InsertInteger(pCfg,  "Type", (uint32_t)controllerType);              RC_CHECK();
     798    rc = CFGMR3InsertString(pCfg,  "Type", controllerString(controllerType));       RC_CHECK();
    783799
    784800    /* Attach the status driver */
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