Changeset 31963 in vbox
- Timestamp:
- Aug 25, 2010 3:12:50 PM (15 years ago)
- svn:sync-xref-src-repo-rev:
- 65196
- Location:
- trunk/src/VBox/Devices/PC
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/PC/DevACPI.cpp
r31519 r31963 162 162 SYSTEM_INFO_INDEX_NIC_ADDRESS = 15, /**< NIC PCI address, or 0 */ 163 163 SYSTEM_INFO_INDEX_AUDIO_ADDRESS = 16, /**< Audio card PCI address, or 0 */ 164 SYSTEM_INFO_INDEX_END = 17, 164 SYSTEM_INFO_INDEX_POWER_STATES = 17, 165 SYSTEM_INFO_INDEX_END = 18, 165 166 SYSTEM_INFO_INDEX_INVALID = 0x80, 166 167 SYSTEM_INFO_INDEX_VALID = 0x200 … … 259 260 /** Primary audio card PCI address */ 260 261 uint32_t u32AudioPciAddress; 261 uint32_t u32Pad0; 262 /** Flag whether S1 power state is enabled */ 263 bool fS1Enabled; 264 /** Flag whether S4 power state is enabled */ 265 bool fS4Enabled; 266 /** Flag whether S1 triggers a state save */ 267 bool fSuspendToDisk; 268 // uint32_t u32Pad0; 262 269 263 270 /** ACPI port base interface. */ … … 1045 1052 } 1046 1053 1054 static int acpiSleep(ACPIState *s) 1055 { 1056 int rc; 1057 /* First pause the VM to stop it executing. Note that failures aren't fatal, we can 1058 * just continue the guest as if it was immediately resumed. 1059 */ 1060 rc = PDMDevHlpVMSuspend(s->pDevIns); /* This is VM pause, not really ACPI suspend. */ 1061 1062 /* The guest was probably reading the PMSTS register in a loop. The resume flag must 1063 * be set before continuing in any way - needs to be part of saved state. 1064 */ 1065 s->pm1a_sts |= WAK_STS; 1066 1067 if (RT_FAILURE(rc)) 1068 AssertMsgFailed(("Could not pause the VM. rc = %Rrc\n", rc)); 1069 1070 if (s->fSuspendToDisk) { 1071 // rc = PDMDevHlpVMSuspendToDisk(s->pDevIns); 1072 if (RT_FAILURE(rc)) 1073 AssertMsgFailed(("Could not save VM state. rc = %Rrc\n", rc)); 1074 } 1075 return rc; 1076 } 1077 1047 1078 /** Converts a ACPI port interface pointer to an ACPI state pointer. */ 1048 1079 #define IACPIPORT_2_ACPISTATE(pInterface) ( (ACPIState*)((uintptr_t)pInterface - RT_OFFSETOF(ACPIState, IACPIPort)) ) … … 1165 1196 case 0x00: /* S0 */ 1166 1197 break; 1198 case 0x01: /* S1 */ 1199 LogRel(("Entering S1 power state (powered-on suspend)\n")); 1200 return acpiSleep(s); 1201 case 0x04: /* S4 */ 1202 LogRel(("Entering S4 power state (suspend to disk)\n")); 1203 return acpiPowerDown(s);/* Same behavior as S5 */ 1167 1204 case 0x05: /* S5 */ 1168 LogRel(("Entering S5 (power down)\n"));1205 LogRel(("Entering S5 power state (power down)\n")); 1169 1206 return acpiPowerDown(s); 1170 1207 default: … … 1512 1549 case SYSTEM_INFO_INDEX_AUDIO_ADDRESS: 1513 1550 *pu32 = s->u32AudioPciAddress; 1551 break; 1552 1553 case SYSTEM_INFO_INDEX_POWER_STATES: 1554 *pu32 = RT_BIT(0) | RT_BIT(5); /* S1 and S5 always exposed */ 1555 if (s->fS1Enabled) /* Optionally expose S1 and S4 */ 1556 *pu32 |= RT_BIT(1); 1557 if (s->fS4Enabled) 1558 *pu32 |= RT_BIT(4); 1514 1559 break; 1515 1560 … … 2360 2405 "NicPciAddress\0" 2361 2406 "AudioPciAddress\0" 2407 "EnableSuspendToDisk\0" 2408 "PowerS1Enabled\0" 2409 "PowerS4Enabled\0" 2362 2410 "CpuHotPlug\0" 2363 2411 "AmlFilePath\0" … … 2419 2467 return PDMDEV_SET_ERROR(pDevIns, rc, 2420 2468 N_("Configuration error: Failed to read \"AudioPciAddress\"")); 2469 2470 /* query whether S1 power state should be exposed */ 2471 rc = CFGMR3QueryBoolDef(pCfg, "PowerS1Enabled", &s->fS1Enabled, true); 2472 if (RT_FAILURE(rc)) 2473 return PDMDEV_SET_ERROR(pDevIns, rc, 2474 N_("Configuration error: Failed to read \"PowerS1Enabled\"")); 2475 2476 /* query whether S4 power state should be exposed */ 2477 rc = CFGMR3QueryBoolDef(pCfg, "PowerS4Enabled", &s->fS4Enabled, true); 2478 if (RT_FAILURE(rc)) 2479 return PDMDEV_SET_ERROR(pDevIns, rc, 2480 N_("Configuration error: Failed to read \"PowerS1Enabled\"")); 2481 2482 /* query whether S1 power state should save the VM state */ 2483 rc = CFGMR3QueryBoolDef(pCfg, "EnableSuspendToDisk", &s->fSuspendToDisk, false); 2484 if (RT_FAILURE(rc)) 2485 return PDMDEV_SET_ERROR(pDevIns, rc, 2486 N_("Configuration error: Failed to read \"EnableSuspendToDisk\"")); 2421 2487 2422 2488 /* query whether we are allow CPU hot plugging */ -
trunk/src/VBox/Devices/PC/vbox.dsl
r31519 r31963 117 117 } 118 118 119 // Declare indexed registers used for reading configuration information 120 OperationRegion (SYSI, SystemIO, 0x4048, 0x08) 121 Field (SYSI, DwordAcc, NoLock, Preserve) 122 { 123 IDX0, 32, 124 DAT0, 32, 125 } 126 127 IndexField (IDX0, DAT0, DwordAcc, NoLock, Preserve) 128 { 129 MEML, 32, 130 UIOA, 32, 131 UHPT, 32, 132 USMC, 32, 133 UFDC, 32, 134 // UCP0-UCP3 no longer used and only kept here for saved state compatibilty 135 UCP0, 32, 136 UCP1, 32, 137 UCP2, 32, 138 UCP3, 32, 139 MEMH, 32, 140 URTC, 32, 141 CPUL, 32, 142 CPUC, 32, 143 CPET, 32, 144 CPEV, 32, 145 NICA, 32, 146 HDAA, 32, 147 PWRS, 32, 148 Offset (0x80), 149 ININ, 32, 150 Offset (0x200), 151 VAIN, 32, 152 } 153 119 154 Scope (\_SB) 120 155 { 121 OperationRegion (SYSI, SystemIO, 0x4048, 0x08)122 Field (SYSI, DwordAcc, NoLock, Preserve)123 {124 IDX0, 32,125 DAT0, 32,126 }127 128 IndexField (IDX0, DAT0, DwordAcc, NoLock, Preserve)129 {130 MEML, 32,131 UIOA, 32,132 UHPT, 32,133 USMC, 32,134 UFDC, 32,135 // UCP0-UCP3 no longer used and only kept here for saved state compatibilty136 UCP0, 32,137 UCP1, 32,138 UCP2, 32,139 UCP3, 32,140 MEMH, 32,141 URTC, 32,142 CPUL, 32,143 CPUC, 32,144 CPET, 32,145 CPEV, 32,146 NICA, 32,147 HDAA, 32,148 Offset (0x80),149 ININ, 32,150 Offset (0x200),151 VAIN, 32,152 }153 154 156 Method (_INI, 0, NotSerialized) 155 157 { … … 1305 1307 }) 1306 1308 1309 // Shift one by the power state number 1310 // If (And(PWRS, ShiftLeft(One,1))) { 1311 Name (_S1, Package (2) { 1312 0x01, 1313 0x01, 1314 }) 1315 // } 1316 1317 // If (And(PWRS, ShiftLeft(One,4))) { 1318 Name (_S4, Package (2) { 1319 0x05, 1320 0x05, 1321 }) 1322 // } 1323 1307 1324 Name (_S5, Package (2) { 1308 1325 0x05,
Note:
See TracChangeset
for help on using the changeset viewer.