Changeset 26115 in vbox for trunk/src/VBox/Devices/PC
- Timestamp:
- Feb 1, 2010 11:19:57 AM (15 years ago)
- svn:sync-xref-src-repo-rev:
- 57104
- Location:
- trunk/src/VBox/Devices/PC
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/PC/ACPI/VBoxAcpi.cpp
r26095 r26115 42 42 /* Statically compiled AML */ 43 43 # include <vboxaml.hex> 44 # include <vboxssdt-standard.hex>45 # include <vboxssdt-cpuhotplug.hex>46 44 #endif 47 45 … … 139 137 #endif 140 138 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 */ 140 int acpiPrepareDsdt(PPDMDEVINS pDevIns, void * *ppPtr, size_t *puDsdtLen) 141 { 142 #ifdef VBOX_WITH_DYNAMIC_DSDT 143 return prepareDynamicDsdt(pDevIns, ppPtr, puDsdtLen); 144 #else 153 145 uint8_t *pbAmlCode = NULL; 154 146 size_t cbAmlCode = 0; 155 147 char *pszAmlFilePath = NULL; 156 int rc = CFGMR3QueryStringAlloc(pDevIns->pCfgHandle, pcszCfgName, &pszAmlFilePath); 157 148 int rc = CFGMR3QueryStringAlloc(pDevIns->pCfgHandle, "AmlFilePath", &pszAmlFilePath); 158 149 if (RT_SUCCESS(rc)) 159 150 { … … 187 178 */ 188 179 if ( RT_FAILURE(rc) 189 || strncmp((const char *)pbAmlCode, pcszSignature, 4))180 || strncmp((const char *)pbAmlCode, "DSDT", 4)) 190 181 { 191 182 RTMemFree(pbAmlCode); … … 195 186 if (RT_SUCCESS(rc)) 196 187 rc = VERR_PARSE_ERROR; 197 }198 else199 {200 *ppbAmlCode = pbAmlCode;201 *pcbAmlCode = cbAmlCode;202 rc = VINF_SUCCESS;203 188 } 204 189 } … … 211 196 MMR3HeapFree(pszAmlFilePath); 212 197 } 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) 228 199 { 229 200 rc = VINF_SUCCESS; 230 201 231 202 /* Use the compiled in AML code */ 232 cbAmlCode Dsdt= sizeof(AmlCode);233 pbAmlCode Dsdt = (uint8_t *)RTMemAllocZ(cbAmlCodeDsdt);234 if (pbAmlCode Dsdt)235 memcpy(pbAmlCode Dsdt, AmlCode, cbAmlCodeDsdt);203 cbAmlCode = sizeof(AmlCode); 204 pbAmlCode = (uint8_t *)RTMemAllocZ(cbAmlCode); 205 if (pbAmlCode) 206 memcpy(pbAmlCode, AmlCode, cbAmlCode); 236 207 else 237 208 rc = VERR_NO_MEMORY; … … 239 210 else if (RT_FAILURE(rc)) 240 211 return PDMDEV_SET_ERROR(pDevIns, rc, 241 N_("Configuration error: Failed to read \" DsdtFilePath\""));212 N_("Configuration error: Failed to read \"AmlFilePath\"")); 242 213 243 214 if (RT_SUCCESS(rc)) 244 215 { 245 patchAml(pDevIns, pbAmlCode Dsdt, cbAmlCodeDsdt);246 *ppPtr = pbAmlCode Dsdt;247 *puDsdtLen = cbAmlCode Dsdt;216 patchAml(pDevIns, pbAmlCode, cbAmlCode); 217 *ppPtr = pbAmlCode; 218 *puDsdtLen = cbAmlCode; 248 219 } 249 220 return rc; … … 262 233 } 263 234 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 else285 {286 pbAmlCode = AmlCodeSsdtStandard;287 cbAmlCodeSsdt = sizeof(AmlCodeSsdtStandard);288 }289 290 pbAmlCodeSsdt = (uint8_t *)RTMemAllocZ(cbAmlCodeSsdt);291 if (pbAmlCodeSsdt)292 memcpy(pbAmlCodeSsdt, pbAmlCode, cbAmlCodeSsdt);293 else294 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 -
trunk/src/VBox/Devices/PC/DevACPI.cpp
r26095 r26115 45 45 int acpiPrepareDsdt(PPDMDEVINS pDevIns, void* *ppPtr, size_t *puDsdtLen); 46 46 int acpiCleanupDsdt(PPDMDEVINS pDevIns, void* pPtr); 47 48 int acpiPrepareSsdt(PPDMDEVINS pDevIns, void* *ppPtr, size_t *puSsdtLen);49 int acpiCleanupSsdt(PPDMDEVINS pDevIns, void* pPtr);50 47 #endif /* !IN_RING3 */ 51 48 … … 685 682 } 686 683 687 /** Secondary System Description Table (SSDT) */688 689 static void acpiSetupSSDT(ACPIState *s, RTGCPHYS32 addr,690 void* pPtr, size_t uSsdtLen)691 {692 acpiPhyscpy(s, addr, pPtr, uSsdtLen);693 }694 695 684 /** Firmware ACPI Control Structure (FACS) */ 696 685 static void acpiSetupFACS(ACPIState *s, RTGCPHYS32 addr) … … 1951 1940 int rc; 1952 1941 RTGCPHYS32 GCPhysCur, GCPhysRsdt, GCPhysXsdt, GCPhysFadtAcpi1, GCPhysFadtAcpi2, GCPhysFacs, GCPhysDsdt; 1953 RTGCPHYS32 GCPhysHpet = 0, GCPhysApic = 0 , GCPhysSsdt = 0;1942 RTGCPHYS32 GCPhysHpet = 0, GCPhysApic = 0; 1954 1943 uint32_t addend = 0; 1955 1944 RTGCPHYS32 aGCPhysRsdt[4]; 1956 1945 RTGCPHYS32 aGCPhysXsdt[4]; 1957 uint32_t cAddr, iMadt = 0, iHpet = 0 , iSsdt = 0;1946 uint32_t cAddr, iMadt = 0, iHpet = 0; 1958 1947 size_t cbRsdt = sizeof(ACPITBLHEADER); 1959 1948 size_t cbXsdt = sizeof(ACPITBLHEADER); … … 1965 1954 if (s->fUseHpet) 1966 1955 iHpet = cAddr++; /* HPET */ 1967 1968 iSsdt = cAddr++; /* SSDT */1969 1956 1970 1957 cbRsdt += cAddr*sizeof(uint32_t); /* each entry: 32 bits phys. address. */ … … 2022 2009 GCPhysCur = RT_ALIGN_32(GCPhysCur + sizeof(ACPITBLHPET), 16); 2023 2010 } 2024 2025 void* pSsdtCode = NULL;2026 size_t cbSsdtSize = 0;2027 rc = acpiPrepareSsdt(s->pDevIns, &pSsdtCode, &cbSsdtSize);2028 if (RT_FAILURE(rc))2029 return rc;2030 2031 GCPhysSsdt = GCPhysCur;2032 GCPhysCur = RT_ALIGN_32(GCPhysCur + cbSsdtSize, 16);2033 2034 2011 GCPhysDsdt = GCPhysCur; 2035 2012 … … 2041 2018 2042 2019 GCPhysCur = RT_ALIGN_32(GCPhysCur + cbDsdtSize, 16); 2043 2044 2020 if (GCPhysCur > 0x10000) 2045 2021 return PDMDEV_SET_ERROR(s->pDevIns, VERR_TOO_MUCH_DATA, … … 2055 2031 if (s->fUseHpet) 2056 2032 Log((" HPET 0x%08X", GCPhysHpet + addend)); 2057 Log((" SSDT 0x%08X", GCPhysSsdt + addend));2058 2033 Log(("\n")); 2059 2034 … … 2078 2053 aGCPhysXsdt[iHpet] = GCPhysHpet + addend; 2079 2054 } 2080 acpiSetupSSDT(s, GCPhysSsdt + addend, pSsdtCode, cbSsdtSize);2081 acpiCleanupSsdt(s->pDevIns, pSsdtCode);2082 aGCPhysRsdt[iSsdt] = GCPhysSsdt + addend;2083 aGCPhysXsdt[iSsdt] = GCPhysSsdt + addend;2084 2055 2085 2056 rc = acpiSetupRSDT(s, GCPhysRsdt + addend, cAddr, aGCPhysRsdt); -
trunk/src/VBox/Devices/PC/vbox.dsl
r26095 r26115 121 121 } 122 122 123 // Processor object 124 // #1463: Showing the CPU can make the guest do bad things on it like SpeedStep. 125 // In this case, XP SP2 contains this buggy Intelppm.sys driver which wants to mess 126 // with SpeedStep if it finds a CPU object and when it finds out that it can't, it 127 // tries to unload and crashes (MS probably never tested this code path). 128 // So we enable this ACPI object only for certain guests, which do need it, 129 // if by accident Windows guest seen enabled CPU object, just boot from latest 130 // known good configuration, as it remembers state, even if ACPI object gets disabled. 131 Scope (\_PR) 132 { 133 Processor (CPU0, /* Name */ 134 0x00, /* Id */ 135 0x0, /* Processor IO ports range start */ 136 0x0 /* Processor IO ports range length */ 137 ) 138 { 139 } 140 Processor (CPU1, /* Name */ 141 0x01, /* Id */ 142 0x0, /* Processor IO ports range start */ 143 0x0 /* Processor IO ports range length */ 144 ) 145 { 146 } 147 Processor (CPU2, /* Name */ 148 0x02, /* Id */ 149 0x0, /* Processor IO ports range start */ 150 0x0 /* Processor IO ports range length */ 151 ) 152 { 153 } 154 Processor (CPU3, /* Name */ 155 0x03, /* Id */ 156 0x0, /* Processor IO ports range start */ 157 0x0 /* Processor IO ports range length */ 158 ) 159 { 160 } 161 Processor (CPU4, /* Name */ 162 0x04, /* Id */ 163 0x0, /* Processor IO ports range start */ 164 0x0 /* Processor IO ports range length */ 165 ) 166 { 167 } 168 Processor (CPU5, /* Name */ 169 0x05, /* Id */ 170 0x0, /* Processor IO ports range start */ 171 0x0 /* Processor IO ports range length */ 172 ) 173 { 174 } 175 Processor (CPU6, /* Name */ 176 0x06, /* Id */ 177 0x0, /* Processor IO ports range start */ 178 0x0 /* Processor IO ports range length */ 179 ) 180 { 181 } 182 Processor (CPU7, /* Name */ 183 0x07, /* Id */ 184 0x0, /* Processor IO ports range start */ 185 0x0 /* Processor IO ports range length */ 186 ) 187 { 188 } 189 Processor (CPU8, /* Name */ 190 0x08, /* Id */ 191 0x0, /* Processor IO ports range start */ 192 0x0 /* Processor IO ports range length */ 193 ) 194 { 195 } 196 Processor (CPU9, /* Name */ 197 0x09, /* Id */ 198 0x0, /* Processor IO ports range start */ 199 0x0 /* Processor IO ports range length */ 200 ) 201 { 202 } 203 Processor (CPUA, /* Name */ 204 0x0a, /* Id */ 205 0x0, /* Processor IO ports range start */ 206 0x0 /* Processor IO ports range length */ 207 ) 208 { 209 } 210 Processor (CPUB, /* Name */ 211 0x0b, /* Id */ 212 0x0, /* Processor IO ports range start */ 213 0x0 /* Processor IO ports range length */ 214 ) 215 { 216 } 217 Processor (CPUC, /* Name */ 218 0x0c, /* Id */ 219 0x0, /* Processor IO ports range start */ 220 0x0 /* Processor IO ports range length */ 221 ) 222 { 223 } 224 Processor (CPUD, /* Name */ 225 0x0d, /* Id */ 226 0x0, /* Processor IO ports range start */ 227 0x0 /* Processor IO ports range length */ 228 ) 229 { 230 } 231 Processor (CPUE, /* Name */ 232 0x0e, /* Id */ 233 0x0, /* Processor IO ports range start */ 234 0x0 /* Processor IO ports range length */ 235 ) 236 { 237 } 238 Processor (CPUF, /* Name */ 239 0x0f, /* Id */ 240 0x0, /* Processor IO ports range start */ 241 0x0 /* Processor IO ports range length */ 242 ) 243 { 244 } 245 Processor (CPUG, /* Name */ 246 0x10, /* Id */ 247 0x0, /* Processor IO ports range start */ 248 0x0 /* Processor IO ports range length */ 249 ) 250 { 251 } 252 Processor (CPUH, /* Name */ 253 0x11, /* Id */ 254 0x0, /* Processor IO ports range start */ 255 0x0 /* Processor IO ports range length */ 256 ) 257 { 258 } 259 Processor (CPUI, /* Name */ 260 0x12, /* Id */ 261 0x0, /* Processor IO ports range start */ 262 0x0 /* Processor IO ports range length */ 263 ) 264 { 265 } 266 Processor (CPUJ, /* Name */ 267 0x13, /* Id */ 268 0x0, /* Processor IO ports range start */ 269 0x0 /* Processor IO ports range length */ 270 ) 271 { 272 } 273 Processor (CPUK, /* Name */ 274 0x14, /* Id */ 275 0x0, /* Processor IO ports range start */ 276 0x0 /* Processor IO ports range length */ 277 ) 278 { 279 } 280 Processor (CPUL, /* Name */ 281 0x15, /* Id */ 282 0x0, /* Processor IO ports range start */ 283 0x0 /* Processor IO ports range length */ 284 ) 285 { 286 } 287 Processor (CPUM, /* Name */ 288 0x16, /* Id */ 289 0x0, /* Processor IO ports range start */ 290 0x0 /* Processor IO ports range length */ 291 ) 292 { 293 } 294 Processor (CPUN, /* Name */ 295 0x17, /* Id */ 296 0x0, /* Processor IO ports range start */ 297 0x0 /* Processor IO ports range length */ 298 ) 299 { 300 } 301 Processor (CPUO, /* Name */ 302 0x18, /* Id */ 303 0x0, /* Processor IO ports range start */ 304 0x0 /* Processor IO ports range length */ 305 ) 306 { 307 } 308 Processor (CPUP, /* Name */ 309 0x19, /* Id */ 310 0x0, /* Processor IO ports range start */ 311 0x0 /* Processor IO ports range length */ 312 ) 313 { 314 } 315 Processor (CPUQ, /* Name */ 316 0x1a, /* Id */ 317 0x0, /* Processor IO ports range start */ 318 0x0 /* Processor IO ports range length */ 319 ) 320 { 321 } 322 Processor (CPUR, /* Name */ 323 0x1b, /* Id */ 324 0x0, /* Processor IO ports range start */ 325 0x0 /* Processor IO ports range length */ 326 ) 327 { 328 } 329 Processor (CPUS, /* Name */ 330 0x1c, /* Id */ 331 0x0, /* Processor IO ports range start */ 332 0x0 /* Processor IO ports range length */ 333 ) 334 { 335 } 336 Processor (CPUT, /* Name */ 337 0x1d, /* Id */ 338 0x0, /* Processor IO ports range start */ 339 0x0 /* Processor IO ports range length */ 340 ) 341 { 342 } 343 Processor (CPUU, /* Name */ 344 0x1e, /* Id */ 345 0x0, /* Processor IO ports range start */ 346 0x0 /* Processor IO ports range length */ 347 ) 348 { 349 } 350 Processor (CPUV, /* Name */ 351 0x1f, /* Id */ 352 0x0, /* Processor IO ports range start */ 353 0x0 /* Processor IO ports range length */ 354 ) 355 { 356 } 357 358 } 359 123 360 Scope (\_SB) 124 361 { … … 139 376 // @todo: maybe make it bitmask instead? 140 377 UCP0, 32, 141 UCP1, 32, 142 UCP2, 32, 143 UCP3, 32, 378 UCP1, 32, 379 UCP2, 32, 380 UCP3, 32, 144 381 MEMH, 32, 145 382 URTC, 32, 146 CPUL, 32,147 CPUC, 32,148 383 Offset (0x80), 149 384 ININ, 32,
Note:
See TracChangeset
for help on using the changeset viewer.