Changeset 26183 in vbox for trunk/src/VBox/Devices/PC/ACPI
- Timestamp:
- Feb 3, 2010 12:46:34 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/PC/ACPI/VBoxAcpi.cpp
r26172 r26183 42 42 /* Statically compiled AML */ 43 43 # include <vboxaml.hex> 44 # include <vboxssdt-standard.hex> 45 # include <vboxssdt-cpuhotplug.hex> 44 46 #endif 45 47 … … 178 180 */ 179 181 if ( RT_FAILURE(rc) 180 || strncmp((const char *)pbAmlCode, "DSDT", 4))182 || strncmp((const char *)pbAmlCode, pcszSignature, 4)) 181 183 { 182 184 RTMemFree(pbAmlCode); … … 186 188 if (RT_SUCCESS(rc)) 187 189 rc = VERR_PARSE_ERROR; 190 } 191 else 192 { 193 *ppbAmlCode = pbAmlCode; 194 *pcbAmlCode = cbAmlCode; 195 rc = VINF_SUCCESS; 188 196 } 189 197 } … … 196 204 MMR3HeapFree(pszAmlFilePath); 197 205 } 198 else if (rc == VERR_CFGM_VALUE_NOT_FOUND) 206 207 return rc; 208 } 209 210 /* Two only public functions */ 211 int acpiPrepareDsdt(PPDMDEVINS pDevIns, void * *ppPtr, size_t *puDsdtLen) 212 { 213 #ifdef VBOX_WITH_DYNAMIC_DSDT 214 return prepareDynamicDsdt(pDevIns, ppPtr, puDsdtLen); 215 #else 216 uint8_t *pbAmlCodeDsdt = NULL; 217 size_t cbAmlCodeDsdt = 0; 218 int rc = acpiAmlLoadExternal(pDevIns, "DsdtFilePath", "DSDT", &pbAmlCodeDsdt, &cbAmlCodeDsdt); 219 220 if (rc == VERR_CFGM_VALUE_NOT_FOUND) 199 221 { 200 222 rc = VINF_SUCCESS; 201 223 202 224 /* Use the compiled in AML code */ 203 cbAmlCode = sizeof(AmlCode);204 pbAmlCode = (uint8_t *)RTMemAllocZ(cbAmlCode);205 if (pbAmlCode )206 memcpy(pbAmlCode , AmlCode, cbAmlCode);225 cbAmlCodeDsdt = sizeof(AmlCode); 226 pbAmlCodeDsdt = (uint8_t *)RTMemAllocZ(cbAmlCodeDsdt); 227 if (pbAmlCodeDsdt) 228 memcpy(pbAmlCodeDsdt, AmlCode, cbAmlCodeDsdt); 207 229 else 208 230 rc = VERR_NO_MEMORY; … … 210 232 else if (RT_FAILURE(rc)) 211 233 return PDMDEV_SET_ERROR(pDevIns, rc, 212 N_("Configuration error: Failed to read \" AmlFilePath\""));234 N_("Configuration error: Failed to read \"DsdtFilePath\"")); 213 235 214 236 if (RT_SUCCESS(rc)) 215 237 { 216 patchAml(pDevIns, pbAmlCode , cbAmlCode);217 *ppPtr = pbAmlCode ;218 *puDsdtLen = cbAmlCode ;238 patchAml(pDevIns, pbAmlCodeDsdt, cbAmlCodeDsdt); 239 *ppPtr = pbAmlCodeDsdt; 240 *puDsdtLen = cbAmlCodeDsdt; 219 241 } 220 242 return rc; … … 233 255 } 234 256 257 int acpiPrepareSsdt(PPDMDEVINS pDevIns, void* *ppPtr, size_t *puSsdtLen) 258 { 259 uint8_t *pbAmlCodeSsdt = NULL; 260 size_t cbAmlCodeSsdt = 0; 261 int rc = acpiAmlLoadExternal(pDevIns, "SsdtFilePath", "SSDT", &pbAmlCodeSsdt, &cbAmlCodeSsdt); 262 263 if (rc == VERR_CFGM_VALUE_NOT_FOUND) 264 { 265 bool fCpuHotPlug = false; 266 uint8_t *pbAmlCode = NULL; 267 rc = CFGMR3QueryBoolDef(pDevIns->pCfgHandle, "CpuHotPlug", &fCpuHotPlug, false); 268 269 if (RT_FAILURE(rc)) 270 return rc; 271 272 if (fCpuHotPlug) 273 { 274 pbAmlCode = AmlCodeSsdtCpuHotPlug; 275 cbAmlCodeSsdt = sizeof(AmlCodeSsdtCpuHotPlug); 276 } 277 else 278 { 279 pbAmlCode = AmlCodeSsdtStandard; 280 cbAmlCodeSsdt = sizeof(AmlCodeSsdtStandard); 281 } 282 283 pbAmlCodeSsdt = (uint8_t *)RTMemAllocZ(cbAmlCodeSsdt); 284 if (pbAmlCodeSsdt) 285 memcpy(pbAmlCodeSsdt, pbAmlCode, cbAmlCodeSsdt); 286 else 287 rc = VERR_NO_MEMORY; 288 } 289 else if (RT_FAILURE(rc)) 290 return PDMDEV_SET_ERROR(pDevIns, rc, 291 N_("Configuration error: Failed to read \"SsdtFilePath\"")); 292 293 if (RT_SUCCESS(rc)) 294 { 295 patchAml(pDevIns, pbAmlCodeSsdt, cbAmlCodeSsdt); 296 *ppPtr = pbAmlCodeSsdt; 297 *puSsdtLen = cbAmlCodeSsdt; 298 } 299 300 return VINF_SUCCESS; 301 } 302 303 int acpiCleanupSsdt(PPDMDEVINS pDevIns, void* pPtr) 304 { 305 if (pPtr) 306 RTMemFree(pPtr); 307 return VINF_SUCCESS; 308 } 309
Note:
See TracChangeset
for help on using the changeset viewer.