Changeset 101597 in vbox for trunk/src/VBox/Devices
- Timestamp:
- Oct 26, 2023 9:09:48 AM (17 months ago)
- svn:sync-xref-src-repo-rev:
- 159681
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/PC/DevACPI.cpp
r98103 r101597 571 571 /** ACPI port interface. */ 572 572 PDMIACPIPORT IACPIPort; 573 /** The button event interface for power button events. */ 574 PDMIEVENTBUTTONPORT IButtonEventPort; 573 575 /** Pointer to the device instance so we can get our bearings from 574 576 * interface functions. */ … … 1161 1163 1162 1164 /** 1163 * @interface_method_impl{PDMIACPIPORT,pfnPowerButtonPress} 1164 */ 1165 static DECLCALLBACK(int) acpiR3Port_PowerButtonPress(PPDMIACPIPORT pInterface) 1165 * @interface_method_impl{PDMIACPIPORT,pfnGetGuestEnteredACPIMode, Check if the 1166 * Guest entered into G0 (working) or G1 (sleeping)} 1167 */ 1168 static DECLCALLBACK(int) acpiR3Port_GetGuestEnteredACPIMode(PPDMIACPIPORT pInterface, bool *pfEntered) 1166 1169 { 1167 1170 PACPISTATER3 pThisCC = RT_FROM_MEMBER(pInterface, ACPISTATER3, IACPIPort); … … 1170 1173 DEVACPI_LOCK_R3(pDevIns, pThis); 1171 1174 1172 Log(("acpiR3Port_PowerButtonPress: handled=%d status=%x\n", pThis->fPowerButtonHandled, pThis->pm1a_sts)); 1173 pThis->fPowerButtonHandled = false; 1174 acpiUpdatePm1a(pDevIns, pThis, pThis->pm1a_sts | PWRBTN_STS, pThis->pm1a_en); 1175 *pfEntered = (pThis->pm1a_ctl & SCI_EN) != 0; 1175 1176 1176 1177 DEVACPI_UNLOCK(pDevIns, pThis); … … 1179 1180 1180 1181 /** 1181 * @interface_method_impl{PDMIACPIPORT,pfnGet PowerButtonHandled}1182 */ 1183 static DECLCALLBACK(int) acpiR3Port_Get PowerButtonHandled(PPDMIACPIPORT pInterface, bool *pfHandled)1182 * @interface_method_impl{PDMIACPIPORT,pfnGetCpuStatus} 1183 */ 1184 static DECLCALLBACK(int) acpiR3Port_GetCpuStatus(PPDMIACPIPORT pInterface, unsigned uCpu, bool *pfLocked) 1184 1185 { 1185 1186 PACPISTATER3 pThisCC = RT_FROM_MEMBER(pInterface, ACPISTATER3, IACPIPort); … … 1188 1189 DEVACPI_LOCK_R3(pDevIns, pThis); 1189 1190 1190 *pf Handled = pThis->fPowerButtonHandled;1191 *pfLocked = VMCPUSET_IS_PRESENT(&pThis->CpuSetLocked, uCpu); 1191 1192 1192 1193 DEVACPI_UNLOCK(pDevIns, pThis); … … 1194 1195 } 1195 1196 1196 /**1197 * @interface_method_impl{PDMIACPIPORT,pfnGetGuestEnteredACPIMode, Check if the1198 * Guest entered into G0 (working) or G1 (sleeping)}1199 */1200 static DECLCALLBACK(int) acpiR3Port_GetGuestEnteredACPIMode(PPDMIACPIPORT pInterface, bool *pfEntered)1201 {1202 PACPISTATER3 pThisCC = RT_FROM_MEMBER(pInterface, ACPISTATER3, IACPIPort);1203 PPDMDEVINS pDevIns = pThisCC->pDevIns;1204 PACPISTATE pThis = PDMDEVINS_2_DATA(pDevIns, PACPISTATE);1205 DEVACPI_LOCK_R3(pDevIns, pThis);1206 1207 *pfEntered = (pThis->pm1a_ctl & SCI_EN) != 0;1208 1209 DEVACPI_UNLOCK(pDevIns, pThis);1210 return VINF_SUCCESS;1211 }1212 1213 /**1214 * @interface_method_impl{PDMIACPIPORT,pfnGetCpuStatus}1215 */1216 static DECLCALLBACK(int) acpiR3Port_GetCpuStatus(PPDMIACPIPORT pInterface, unsigned uCpu, bool *pfLocked)1217 {1218 PACPISTATER3 pThisCC = RT_FROM_MEMBER(pInterface, ACPISTATER3, IACPIPort);1219 PPDMDEVINS pDevIns = pThisCC->pDevIns;1220 PACPISTATE pThis = PDMDEVINS_2_DATA(pDevIns, PACPISTATE);1221 DEVACPI_LOCK_R3(pDevIns, pThis);1222 1223 *pfLocked = VMCPUSET_IS_PRESENT(&pThis->CpuSetLocked, uCpu);1224 1225 DEVACPI_UNLOCK(pDevIns, pThis);1226 return VINF_SUCCESS;1227 }1228 1229 /**1230 * Send an ACPI sleep button event.1231 *1232 * @returns VBox status code1233 * @param pInterface Pointer to the interface structure containing the called function pointer.1234 */1235 static DECLCALLBACK(int) acpiR3Port_SleepButtonPress(PPDMIACPIPORT pInterface)1236 {1237 PACPISTATER3 pThisCC = RT_FROM_MEMBER(pInterface, ACPISTATER3, IACPIPort);1238 PPDMDEVINS pDevIns = pThisCC->pDevIns;1239 PACPISTATE pThis = PDMDEVINS_2_DATA(pDevIns, PACPISTATE);1240 DEVACPI_LOCK_R3(pDevIns, pThis);1241 1242 acpiUpdatePm1a(pDevIns, pThis, pThis->pm1a_sts | SLPBTN_STS, pThis->pm1a_en);1243 1244 DEVACPI_UNLOCK(pDevIns, pThis);1245 return VINF_SUCCESS;1246 }1247 1197 1248 1198 /** … … 1285 1235 return VINF_SUCCESS; 1286 1236 } 1237 1238 1239 /** 1240 * @interface_method_impl{PDMIACPIPORT,pfnQueryGuestCanHandleButtonEvents} 1241 */ 1242 static DECLCALLBACK(int) acpiR3Port_QueryGuestCanHandleButtonEvents(PPDMIEVENTBUTTONPORT pInterface, bool *pfCanHandleButtonEvents) 1243 { 1244 PACPISTATER3 pThisCC = RT_FROM_MEMBER(pInterface, ACPISTATER3, IButtonEventPort); 1245 PPDMDEVINS pDevIns = pThisCC->pDevIns; 1246 PACPISTATE pThis = PDMDEVINS_2_DATA(pDevIns, PACPISTATE); 1247 DEVACPI_LOCK_R3(pDevIns, pThis); 1248 1249 /* Just checks whether the guest has entered ACPI mode. */ 1250 *pfCanHandleButtonEvents = (pThis->pm1a_ctl & SCI_EN) != 0; 1251 1252 DEVACPI_UNLOCK(pDevIns, pThis); 1253 return VINF_SUCCESS; 1254 } 1255 1256 1257 /** 1258 * @interface_method_impl{PDMIEVENTBUTTONPORT,pfnPowerButtonPress} 1259 */ 1260 static DECLCALLBACK(int) acpiR3Port_PowerButtonPress(PPDMIEVENTBUTTONPORT pInterface) 1261 { 1262 PACPISTATER3 pThisCC = RT_FROM_MEMBER(pInterface, ACPISTATER3, IButtonEventPort); 1263 PPDMDEVINS pDevIns = pThisCC->pDevIns; 1264 PACPISTATE pThis = PDMDEVINS_2_DATA(pDevIns, PACPISTATE); 1265 DEVACPI_LOCK_R3(pDevIns, pThis); 1266 1267 Log(("acpiR3Port_PowerButtonPress: handled=%d status=%x\n", pThis->fPowerButtonHandled, pThis->pm1a_sts)); 1268 pThis->fPowerButtonHandled = false; 1269 acpiUpdatePm1a(pDevIns, pThis, pThis->pm1a_sts | PWRBTN_STS, pThis->pm1a_en); 1270 1271 DEVACPI_UNLOCK(pDevIns, pThis); 1272 return VINF_SUCCESS; 1273 } 1274 1275 1276 /** 1277 * @interface_method_impl{PDMIEVENTBUTTONPORT,pfnSleepButtonPress} 1278 */ 1279 static DECLCALLBACK(int) acpiR3Port_SleepButtonPress(PPDMIEVENTBUTTONPORT pInterface) 1280 { 1281 PACPISTATER3 pThisCC = RT_FROM_MEMBER(pInterface, ACPISTATER3, IButtonEventPort); 1282 PPDMDEVINS pDevIns = pThisCC->pDevIns; 1283 PACPISTATE pThis = PDMDEVINS_2_DATA(pDevIns, PACPISTATE); 1284 DEVACPI_LOCK_R3(pDevIns, pThis); 1285 1286 acpiUpdatePm1a(pDevIns, pThis, pThis->pm1a_sts | SLPBTN_STS, pThis->pm1a_en); 1287 1288 DEVACPI_UNLOCK(pDevIns, pThis); 1289 return VINF_SUCCESS; 1290 } 1291 1292 1293 /** 1294 * @interface_method_impl{PDMIEVENTBUTTONPORT,pfnQueryPowerButtonHandled} 1295 */ 1296 static DECLCALLBACK(int) acpiR3Port_QueryPowerButtonHandled(PPDMIEVENTBUTTONPORT pInterface, bool *pfHandled) 1297 { 1298 PACPISTATER3 pThisCC = RT_FROM_MEMBER(pInterface, ACPISTATER3, IButtonEventPort); 1299 PPDMDEVINS pDevIns = pThisCC->pDevIns; 1300 PACPISTATE pThis = PDMDEVINS_2_DATA(pDevIns, PACPISTATE); 1301 DEVACPI_LOCK_R3(pDevIns, pThis); 1302 1303 *pfHandled = pThis->fPowerButtonHandled; 1304 1305 DEVACPI_UNLOCK(pDevIns, pThis); 1306 return VINF_SUCCESS; 1307 } 1308 1287 1309 1288 1310 /** … … 2848 2870 PDMIBASE_RETURN_INTERFACE(pszIID, PDMIBASE, &pThisCC->IBase); 2849 2871 PDMIBASE_RETURN_INTERFACE(pszIID, PDMIACPIPORT, &pThisCC->IACPIPort); 2872 PDMIBASE_RETURN_INTERFACE(pszIID, PDMIEVENTBUTTONPORT, &pThisCC->IButtonEventPort); 2850 2873 return NULL; 2851 2874 } … … 4265 4288 4266 4289 /* IBase */ 4267 pThisCC->IBase.pfnQueryInterface = acpiR3QueryInterface;4290 pThisCC->IBase.pfnQueryInterface = acpiR3QueryInterface; 4268 4291 /* IACPIPort */ 4269 pThisCC->IACPIPort.pfnSleepButtonPress = acpiR3Port_SleepButtonPress; 4270 pThisCC->IACPIPort.pfnPowerButtonPress = acpiR3Port_PowerButtonPress; 4271 pThisCC->IACPIPort.pfnGetPowerButtonHandled = acpiR3Port_GetPowerButtonHandled; 4272 pThisCC->IACPIPort.pfnGetGuestEnteredACPIMode = acpiR3Port_GetGuestEnteredACPIMode; 4273 pThisCC->IACPIPort.pfnGetCpuStatus = acpiR3Port_GetCpuStatus; 4274 pThisCC->IACPIPort.pfnMonitorHotPlugEvent = acpiR3Port_MonitorHotPlugEvent; 4275 pThisCC->IACPIPort.pfnBatteryStatusChangeEvent = acpiR3Port_BatteryStatusChangeEvent; 4292 pThisCC->IACPIPort.pfnGetGuestEnteredACPIMode = acpiR3Port_GetGuestEnteredACPIMode; 4293 pThisCC->IACPIPort.pfnGetCpuStatus = acpiR3Port_GetCpuStatus; 4294 pThisCC->IACPIPort.pfnMonitorHotPlugEvent = acpiR3Port_MonitorHotPlugEvent; 4295 pThisCC->IACPIPort.pfnBatteryStatusChangeEvent = acpiR3Port_BatteryStatusChangeEvent; 4296 /* IButtonEventPort */ 4297 pThisCC->IButtonEventPort.pfnSleepButtonPress = acpiR3Port_SleepButtonPress; 4298 pThisCC->IButtonEventPort.pfnPowerButtonPress = acpiR3Port_PowerButtonPress; 4299 pThisCC->IButtonEventPort.pfnQueryPowerButtonHandled = acpiR3Port_QueryPowerButtonHandled; 4300 pThisCC->IButtonEventPort.pfnQueryGuestCanHandleButtonEvents = acpiR3Port_QueryGuestCanHandleButtonEvents; 4276 4301 4277 4302 /*
Note:
See TracChangeset
for help on using the changeset viewer.