VirtualBox

Changeset 26115 in vbox for trunk/src/VBox/Devices/PC/ACPI


Ignore:
Timestamp:
Feb 1, 2010 11:19:57 AM (15 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
57104
Message:

ACPI: reverted hotplug changes until they get fixed (r57068, r57069, r57071)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/PC/ACPI/VBoxAcpi.cpp

    r26095 r26115  
    4242/* Statically compiled AML */
    4343# include <vboxaml.hex>
    44 # include <vboxssdt-standard.hex>
    45 # include <vboxssdt-cpuhotplug.hex>
    4644#endif
    4745
     
    139137#endif
    140138
    141 /**
    142  * Loads an AML file if present in CFGM
    143  *
    144  * @returns VBox status code
    145  * @param   pDevIns        The device instance
    146  * @param   pcszCfgName    The configuration key holding the file path
    147  * @param   pcszSignature  The signature to check for
    148  * @param   ppbAmlCode     Where to store the pointer to the AML code on success.
    149  * @param   pcbAmlCode     Where to store the number of bytes of the AML code on success.
    150  */
    151 static int acpiAmlLoadExternal(PPDMDEVINS pDevIns, const char *pcszCfgName, const char *pcszSignature, uint8_t **ppbAmlCode, size_t *pcbAmlCode)
    152 {
     139/* Two only public functions */
     140int acpiPrepareDsdt(PPDMDEVINS pDevIns,  void * *ppPtr, size_t *puDsdtLen)
     141{
     142#ifdef VBOX_WITH_DYNAMIC_DSDT
     143    return prepareDynamicDsdt(pDevIns, ppPtr, puDsdtLen);
     144#else
    153145    uint8_t *pbAmlCode = NULL;
    154146    size_t cbAmlCode = 0;
    155147    char *pszAmlFilePath = NULL;
    156     int rc = CFGMR3QueryStringAlloc(pDevIns->pCfgHandle, pcszCfgName, &pszAmlFilePath);
    157 
     148    int rc = CFGMR3QueryStringAlloc(pDevIns->pCfgHandle, "AmlFilePath", &pszAmlFilePath);
    158149    if (RT_SUCCESS(rc))
    159150    {
     
    187178                     */
    188179                    if (   RT_FAILURE(rc)
    189                         || strncmp((const char *)pbAmlCode, pcszSignature, 4))
     180                        || strncmp((const char *)pbAmlCode, "DSDT", 4))
    190181                    {
    191182                        RTMemFree(pbAmlCode);
     
    195186                        if (RT_SUCCESS(rc))
    196187                            rc = VERR_PARSE_ERROR;
    197                     }
    198                     else
    199                     {
    200                         *ppbAmlCode = pbAmlCode;
    201                         *pcbAmlCode = cbAmlCode;
    202                         rc = VINF_SUCCESS;
    203188                    }
    204189                }
     
    211196        MMR3HeapFree(pszAmlFilePath);
    212197    }
    213 
    214     return rc;
    215 }
    216 
    217 /* Two only public functions */
    218 int acpiPrepareDsdt(PPDMDEVINS pDevIns,  void * *ppPtr, size_t *puDsdtLen)
    219 {
    220 #ifdef VBOX_WITH_DYNAMIC_DSDT
    221     return prepareDynamicDsdt(pDevIns, ppPtr, puDsdtLen);
    222 #else
    223     uint8_t *pbAmlCodeDsdt = NULL;
    224     size_t cbAmlCodeDsdt = 0;
    225     int rc = acpiAmlLoadExternal(pDevIns, "DsdtFilePath", "DSDT", &pbAmlCodeDsdt, &cbAmlCodeDsdt);
    226 
    227     if (rc == VERR_CFGM_VALUE_NOT_FOUND)
     198    else if (rc == VERR_CFGM_VALUE_NOT_FOUND)
    228199    {
    229200        rc = VINF_SUCCESS;
    230201
    231202        /* Use the compiled in AML code */
    232         cbAmlCodeDsdt = sizeof(AmlCode);
    233         pbAmlCodeDsdt = (uint8_t *)RTMemAllocZ(cbAmlCodeDsdt);
    234         if (pbAmlCodeDsdt)
    235             memcpy(pbAmlCodeDsdt, AmlCode, cbAmlCodeDsdt);
     203        cbAmlCode = sizeof(AmlCode);
     204        pbAmlCode = (uint8_t *)RTMemAllocZ(cbAmlCode);
     205        if (pbAmlCode)
     206            memcpy(pbAmlCode, AmlCode, cbAmlCode);
    236207        else
    237208            rc = VERR_NO_MEMORY;
     
    239210    else if (RT_FAILURE(rc))
    240211        return PDMDEV_SET_ERROR(pDevIns, rc,
    241                                 N_("Configuration error: Failed to read \"DsdtFilePath\""));
     212                                N_("Configuration error: Failed to read \"AmlFilePath\""));
    242213
    243214    if (RT_SUCCESS(rc))
    244215    {
    245         patchAml(pDevIns, pbAmlCodeDsdt, cbAmlCodeDsdt);
    246         *ppPtr = pbAmlCodeDsdt;
    247         *puDsdtLen = cbAmlCodeDsdt;
     216        patchAml(pDevIns, pbAmlCode, cbAmlCode);
     217        *ppPtr = pbAmlCode;
     218        *puDsdtLen = cbAmlCode;
    248219    }
    249220    return rc;
     
    262233}
    263234
    264 int acpiPrepareSsdt(PPDMDEVINS pDevIns, void* *ppPtr, size_t *puSsdtLen)
    265 {
    266     uint8_t *pbAmlCodeSsdt = NULL;
    267     size_t   cbAmlCodeSsdt = 0;
    268     int rc = acpiAmlLoadExternal(pDevIns, "SsdtFilePath", "SSDT", &pbAmlCodeSsdt, &cbAmlCodeSsdt);
    269 
    270     if (rc == VERR_CFGM_VALUE_NOT_FOUND)
    271     {
    272         bool fCpuHotPlug = false;
    273         uint8_t *pbAmlCode = NULL;
    274         rc = CFGMR3QueryBoolDef(pDevIns->pCfgHandle, "CpuHotPlug", &fCpuHotPlug, false);
    275 
    276         if (RT_FAILURE(rc))
    277             return rc;
    278 
    279         if (fCpuHotPlug)
    280         {
    281             pbAmlCode     = AmlCodeSsdtCpuHotPlug;
    282             cbAmlCodeSsdt = sizeof(AmlCodeSsdtCpuHotPlug);
    283         }
    284         else
    285         {
    286             pbAmlCode     = AmlCodeSsdtStandard;
    287             cbAmlCodeSsdt = sizeof(AmlCodeSsdtStandard);
    288         }
    289 
    290         pbAmlCodeSsdt = (uint8_t *)RTMemAllocZ(cbAmlCodeSsdt);
    291         if (pbAmlCodeSsdt)
    292             memcpy(pbAmlCodeSsdt, pbAmlCode, cbAmlCodeSsdt);
    293         else
    294             rc = VERR_NO_MEMORY;
    295     }
    296     else if (RT_FAILURE(rc))
    297         return PDMDEV_SET_ERROR(pDevIns, rc,
    298                                 N_("Configuration error: Failed to read \"SsdtFilePath\""));
    299 
    300     if (RT_SUCCESS(rc))
    301     {
    302         patchAml(pDevIns, pbAmlCodeSsdt, cbAmlCodeSsdt);
    303         *ppPtr = pbAmlCodeSsdt;
    304         *puSsdtLen = cbAmlCodeSsdt;
    305     }
    306 
    307     return VINF_SUCCESS;
    308 }
    309 
    310 int acpiCleanupSsdt(PPDMDEVINS pDevIns, void* pPtr)
    311 {
    312     if (pPtr)
    313         RTMemFree(pPtr);
    314     return VINF_SUCCESS;
    315 }
    316 
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