Changeset 48214 in vbox for trunk/src/VBox
- Timestamp:
- Aug 31, 2013 4:16:58 PM (11 years ago)
- Location:
- trunk/src/VBox/Devices
- Files:
-
- 1 added
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Input/DevPS2.cpp
r48033 r48214 54 54 #include "PS2Dev.h" 55 55 56 #define PCKBD_SAVED_STATE_VERSION 656 #define PCKBD_SAVED_STATE_VERSION 7 57 57 58 58 … … 119 119 #define KBD_MODE_RFU 0x80 120 120 121 #ifndef VBOX_WITH_NEW_PS2M 121 122 /* Mouse Commands */ 122 123 #define AUX_SET_SCALE11 0xE6 /* Set 1:1 scaling */ … … 173 174 int count; 174 175 } MouseEventQueue; 176 #endif 175 177 176 178 /** … … 181 183 typedef struct KBDState 182 184 { 185 #ifndef VBOX_WITH_NEW_PS2M 183 186 MouseCmdQueue mouse_command_queue; 184 187 MouseEventQueue mouse_event_queue; 188 #endif 185 189 uint8_t write_cmd; /* if non zero, write data to port 60 is expected */ 186 190 uint8_t status; … … 190 194 int32_t translate; 191 195 int32_t xlat_state; 196 #ifndef VBOX_WITH_NEW_PS2M 192 197 /* mouse state */ 193 198 int32_t mouse_write_cmd; … … 205 210 uint8_t mouse_buttons; 206 211 uint8_t mouse_buttons_reported; 212 #endif 207 213 208 214 uint32_t Alignment0; … … 222 228 #endif 223 229 230 #ifdef VBOX_WITH_NEW_PS2M 231 /** Mouse state (implemented in separate PS2M module). */ 232 #ifdef VBOX_DEVICE_STRUCT_TESTCASE 233 uint8_t AuxFiller[PS2M_STRUCT_FILLER]; 234 #else 235 PS2M Aux; 236 #endif 237 #else 224 238 /** 225 239 * Mouse port - LUN#1. … … 240 254 R3PTRTYPE(PPDMIMOUSECONNECTOR) pDrv; 241 255 } Mouse; 256 #endif 242 257 } KBDState; 243 258 … … 247 262 static void kbd_update_irq(KBDState *s) 248 263 { 264 #ifndef VBOX_WITH_NEW_PS2M 249 265 MouseCmdQueue *mcq = &s->mouse_command_queue; 250 266 MouseEventQueue *meq = &s->mouse_event_queue; 267 #endif 251 268 int irq12_level, irq1_level; 252 269 uint8_t val; … … 292 309 } 293 310 } 311 #ifdef VBOX_WITH_NEW_PS2M 312 else if (!(s->mode & KBD_MODE_DISABLE_MOUSE) && PS2MByteFromAux(&s->Aux, &val) == VINF_SUCCESS) 313 { 314 s->dbbout = val; 315 s->status |= KBD_STAT_OBF | KBD_STAT_MOUSE_OBF; 316 } 317 #else 294 318 else if ((mcq->count || meq->count) && !(s->mode & KBD_MODE_DISABLE_MOUSE)) 295 319 { … … 310 334 } 311 335 } 336 #endif 312 337 } 313 338 /* Determine new IRQ state. */ … … 334 359 } 335 360 361 #ifndef VBOX_WITH_NEW_PS2M 336 362 static void kbd_queue(KBDState *s, int b, int aux) 337 363 { … … 375 401 kbd_update_irq(s); 376 402 } 403 #endif 377 404 378 405 static void kbc_dbb_out(void *opaque, uint8_t val) … … 385 412 if (s->mode & KBD_MODE_KBD_INT) 386 413 PDMDevHlpISASetIrq(s->CTX_SUFF(pDevIns), 1, 1); 414 } 415 416 static void kbc_dbb_out_aux(void *opaque, uint8_t val) 417 { 418 KBDState *s = (KBDState*)opaque; 419 420 s->dbbout = val; 421 /* Set the aux OBF and raise IRQ. */ 422 s->status |= KBD_STAT_OBF | KBD_STAT_MOUSE_OBF; 423 if (s->mode & KBD_MODE_MOUSE_INT) 424 PDMDevHlpISASetIrq(s->CTX_SUFF(pDevIns), 12, PDM_IRQ_LEVEL_HIGH); 387 425 } 388 426 … … 557 595 } 558 596 597 PS2M *KBDGetPS2MFromDevIns(PPDMDEVINS pDevIns) 598 { 599 KBDState *pThis = PDMINS_2_DATA(pDevIns, KBDState *); 600 #ifdef VBOX_WITH_NEW_PS2M 601 return &pThis->Aux; 602 #else 603 return NULL; 604 #endif 605 } 606 607 #ifndef VBOX_WITH_NEW_PS2M 559 608 static void kbd_mouse_set_reported_buttons(KBDState *s, unsigned fButtons, unsigned fButtonMask) 560 609 { … … 914 963 return rc; 915 964 } 965 #endif 916 966 917 967 static int kbd_write_data(void *opaque, uint32_t addr, uint32_t val) … … 942 992 break; 943 993 case KBD_CCMD_WRITE_AUX_OBUF: 944 kb d_queue(s, val, 1);994 kbc_dbb_out_aux(s, val); 945 995 break; 946 996 case KBD_CCMD_WRITE_OUTPORT: … … 964 1014 /* Automatically enables aux interface. */ 965 1015 s->mode &= ~KBD_MODE_DISABLE_MOUSE; 1016 #ifdef VBOX_WITH_NEW_PS2M 1017 rc = PS2MByteToAux(&s->Aux, val); 1018 if (rc == VINF_SUCCESS) 1019 kbd_update_irq(s); 1020 #else 966 1021 rc = kbd_write_mouse(s, val); 1022 #endif 967 1023 break; 968 1024 default: … … 979 1035 { 980 1036 KBDState *s = (KBDState*)opaque; 1037 #ifndef VBOX_WITH_NEW_PS2M 981 1038 MouseCmdQueue *mcq; 982 1039 MouseEventQueue *meq; 983 1040 984 1041 s->mouse_write_cmd = -1; 1042 #endif 985 1043 s->mode = KBD_MODE_KBD_INT | KBD_MODE_MOUSE_INT; 986 1044 s->status = KBD_STAT_CMD | KBD_STAT_UNLOCKED; … … 988 1046 s->write_cmd = 0; 989 1047 s->translate = 0; 1048 #ifndef VBOX_WITH_NEW_PS2M 990 1049 if (s->mouse_status) 991 1050 { … … 1013 1072 meq->wptr = 0; 1014 1073 meq->count = 0; 1074 #endif 1015 1075 } 1016 1076 1017 1077 static void kbd_save(QEMUFile* f, void* opaque) 1018 1078 { 1079 #ifndef VBOX_WITH_NEW_PS2M 1019 1080 uint32_t cItems; 1020 1081 int i; 1082 #endif 1021 1083 KBDState *s = (KBDState*)opaque; 1022 1084 … … 1025 1087 qemu_put_8s(f, &s->mode); 1026 1088 qemu_put_8s(f, &s->dbbout); 1089 #ifndef VBOX_WITH_NEW_PS2M 1027 1090 qemu_put_be32s(f, &s->mouse_write_cmd); 1028 1091 qemu_put_8s(f, &s->mouse_status); … … 1051 1114 SSMR3PutU8(f, s->mouse_event_queue.data[i]); 1052 1115 Log(("kbd_save: %d mouse event queue items stored\n", s->mouse_event_queue.count)); 1116 #endif 1053 1117 1054 1118 /* terminator */ … … 1084 1148 qemu_get_8s(f, &s->dbbout); 1085 1149 } 1150 #ifndef VBOX_WITH_NEW_PS2M 1086 1151 qemu_get_be32s(f, (uint32_t *)&s->mouse_write_cmd); 1087 1152 qemu_get_8s(f, &s->mouse_status); … … 1115 1180 s->mouse_event_queue.rptr = 0; 1116 1181 s->mouse_event_queue.wptr = 0; 1182 #endif 1117 1183 1118 1184 /* Determine the translation state. */ … … 1136 1202 } 1137 1203 1204 #ifndef VBOX_WITH_NEW_PS2M 1138 1205 rc = SSMR3GetU32(f, &u32); 1139 1206 if (RT_FAILURE(rc)) … … 1171 1238 s->mouse_event_queue.count = u32; 1172 1239 Log(("kbd_load: %d mouse event queue items loaded\n", u32)); 1240 #else 1241 if (version_id <= 6) 1242 { 1243 rc = SSMR3GetU32(f, &u32); 1244 if (RT_FAILURE(rc)) 1245 return rc; 1246 for (i = 0; i < u32; i++) 1247 { 1248 rc = SSMR3GetU8(f, &u8Dummy); 1249 if (RT_FAILURE(rc)) 1250 return rc; 1251 } 1252 Log(("kbd_load: %d mouse event queue items discarded from old saved state\n", u32)); 1253 } 1254 #endif 1173 1255 1174 1256 /* terminator */ … … 1181 1263 return VERR_SSM_DATA_UNIT_FORMAT_CHANGED; 1182 1264 } 1265 #ifndef VBOX_WITH_NEW_PS2M 1183 1266 /* Resend a notification to Main if the device is active */ 1184 1267 kbd_mouse_update_downstream_status(s); 1268 #endif 1185 1269 return 0; 1186 1270 } … … 1308 1392 kbd_save(pSSM, pThis); 1309 1393 PS2KSaveState(&pThis->Kbd, pSSM); 1394 #ifdef VBOX_WITH_NEW_PS2M 1395 PS2MSaveState(&pThis->Aux, pSSM); 1396 #endif 1310 1397 return VINF_SUCCESS; 1311 1398 } … … 1330 1417 if (uVersion >= 6) 1331 1418 rc = PS2KLoadState(&pThis->Kbd, pSSM, uVersion); 1419 #ifdef VBOX_WITH_NEW_PS2M 1420 if (uVersion >= 7) 1421 rc = PS2MLoadState(&pThis->Aux, pSSM, uVersion); 1422 #endif 1332 1423 return rc; 1333 1424 } … … 1345 1436 kbd_reset(pThis); 1346 1437 PS2KReset(&pThis->Kbd); 1347 } 1348 1349 1438 #ifdef VBOX_WITH_NEW_PS2M 1439 PS2MReset(&pThis->Aux); 1440 #endif 1441 } 1442 1443 1444 #ifndef VBOX_WITH_NEW_PS2M 1350 1445 /* -=-=-=-=-=- Mouse: IBase -=-=-=-=-=- */ 1351 1446 … … 1403 1498 NOREF(pInterface); NOREF(cContacts); NOREF(pau64Contacts); NOREF(u32ScanTime); 1404 1499 } 1405 1500 #endif 1406 1501 1407 1502 /* -=-=-=-=-=- real code -=-=-=-=-=- */ … … 1444 1539 /* LUN #1: aux/mouse */ 1445 1540 case 1: 1541 #ifdef VBOX_WITH_NEW_PS2M 1542 rc = PS2MAttach(&pThis->Aux, pDevIns, iLUN, fFlags); 1543 #else 1446 1544 rc = PDMDevHlpDriverAttach(pDevIns, iLUN, &pThis->Mouse.IBase, &pThis->Mouse.pDrvBase, "Aux (Mouse) Port"); 1447 1545 if (RT_SUCCESS(rc)) … … 1461 1559 else 1462 1560 AssertLogRelMsgFailed(("Failed to attach LUN #1! rc=%Rrc\n", rc)); 1561 #endif 1463 1562 break; 1464 1563 … … 1526 1625 pThis->pDevInsRC = PDMDEVINS_2_RCPTR(pDevIns); 1527 1626 PS2KRelocate(&pThis->Kbd, offDelta, pDevIns); 1627 #ifdef VBOX_WITH_NEW_PS2M 1628 PS2MRelocate(&pThis->Aux, offDelta, pDevIns); 1629 #endif 1528 1630 } 1529 1631 … … 1553 1655 if (RT_FAILURE(rc)) 1554 1656 return PDMDEV_SET_ERROR(pDevIns, rc, N_("Failed to query \"R0Enabled\" from the config")); 1657 fGCEnabled = fR0Enabled = false; 1555 1658 Log(("pckbd: fGCEnabled=%RTbool fR0Enabled=%RTbool\n", fGCEnabled, fR0Enabled)); 1556 1659 … … 1567 1670 return rc; 1568 1671 1672 #ifdef VBOX_WITH_NEW_PS2M 1673 rc = PS2MConstruct(&pThis->Aux, pDevIns, pThis, iInstance); 1674 if (RT_FAILURE(rc)) 1675 return rc; 1676 #else 1569 1677 pThis->Mouse.IBase.pfnQueryInterface = kbdMouseQueryInterface; 1570 1678 pThis->Mouse.IPort.pfnPutEvent = kbdMousePutEvent; 1571 1679 pThis->Mouse.IPort.pfnPutEventAbs = kbdMousePutEventAbs; 1572 1680 pThis->Mouse.IPort.pfnPutEventMultiTouch = kbdMousePutEventMultiTouch; 1681 #endif 1573 1682 1574 1683 /* -
trunk/src/VBox/Devices/Input/PS2Dev.h
r44806 r48214 18 18 #define PS2DEV_H 19 19 20 /** The size of the PS2K structure filler.20 /** The size of the PS2K/PS2M structure fillers. 21 21 * @note Must be at least as big as the real struct. Compile time assert 22 22 * makes sure this is so. */ 23 23 #define PS2K_STRUCT_FILLER 512 24 #define PS2M_STRUCT_FILLER 512 24 25 25 26 /* Hide the internal structure. */ … … 31 32 #endif 32 33 34 #if !(defined(IN_PS2M) || defined(VBOX_DEVICE_STRUCT_TESTCASE)) 35 typedef struct PS2M 36 { 37 uint8_t abFiller[PS2M_STRUCT_FILLER]; 38 } PS2M; 39 #endif 40 41 /* Internal PS/2 Keyboard interface. */ 33 42 typedef struct PS2K *PPS2K; 34 43 … … 43 52 int PS2KLoadState(PPS2K pThis, PSSMHANDLE pSSM, uint32_t uVersion); 44 53 54 PS2K *KBDGetPS2KFromDevIns(PPDMDEVINS pDevIns); 55 56 57 /* Internal PS/2 Auxiliary device interface. */ 58 typedef struct PS2M *PPS2M; 59 60 int PS2MByteToAux(PPS2M pThis, uint8_t cmd); 61 int PS2MByteFromAux(PPS2M pThis, uint8_t *pVal); 62 63 int PS2MConstruct(PPS2M pThis, PPDMDEVINS pDevIns, void *pParent, int iInstance); 64 int PS2MAttach(PPS2M pThis, PPDMDEVINS pDevIns, unsigned iLUN, uint32_t fFlags); 65 void PS2MReset(PPS2M pThis); 66 void PS2MRelocate(PPS2M pThis, RTGCINTPTR offDelta, PPDMDEVINS pDevIns); 67 void PS2MSaveState(PPS2M pThis, PSSMHANDLE pSSM); 68 int PS2MLoadState(PPS2M pThis, PSSMHANDLE pSSM, uint32_t uVersion); 69 70 PS2M *KBDGetPS2MFromDevIns(PPDMDEVINS pDevIns); 71 72 73 /* Shared keyboard/aux internal interface. */ 45 74 void KBCUpdateInterrupts(void *pKbc); 46 75 47 PS2K *KBDGetPS2KFromDevIns(PPDMDEVINS pDevIns);48 76 49 77 ///@todo: This should live with the KBC implementation. -
trunk/src/VBox/Devices/Makefile.kmk
r48179 r48214 129 129 Input/DevPS2.cpp \ 130 130 Input/PS2K.cpp \ 131 Input/PS2M.cpp \ 131 132 Input/UsbKbd.cpp \ 132 133 Input/UsbMouse.cpp \ … … 453 454 454 455 456 # --- Input bits. --- 457 458 ifdef VBOX_WITH_NEW_PS2M 459 VBoxDD_DEFS += VBOX_WITH_NEW_PS2M 460 endif 461 462 455 463 # --- Audio bits. --- 456 464 … … 757 765 Input/DevPS2.cpp \ 758 766 Input/PS2K.cpp \ 767 Input/PS2M.cpp \ 759 768 PC/DevACPI.cpp \ 760 769 PC/DevPit-i8254.cpp \ … … 836 845 VBoxDDGC_SOURCES += \ 837 846 Storage/DevLsiLogicSCSI.cpp 847 endif 848 849 ifdef VBOX_WITH_NEW_PS2M 850 VBoxDDGC_DEFS += VBOX_WITH_NEW_PS2M 838 851 endif 839 852 … … 894 907 Input/DevPS2.cpp \ 895 908 Input/PS2K.cpp \ 909 Input/PS2M.cpp \ 896 910 PC/DevACPI.cpp \ 897 911 PC/DevPit-i8254.cpp \ … … 984 998 VBoxDDR0_SOURCES += \ 985 999 Storage/DevLsiLogicSCSI.cpp 1000 endif 1001 1002 ifdef VBOX_WITH_NEW_PS2M 1003 VBoxDDR0_DEFS += VBOX_WITH_NEW_PS2M 986 1004 endif 987 1005 -
trunk/src/VBox/Devices/testcase/Makefile.kmk
r41477 r48214 36 36 $(if $(VBOX_WITH_BUSLOGIC),VBOX_WITH_BUSLOGIC,) \ 37 37 $(if $(VBOX_WITH_LSILOGIC),VBOX_WITH_LSILOGIC,) \ 38 $(if $(VBOX_WITH_NEW_PS2M),VBOX_WITH_NEW_PS2M,) \ 38 39 $(if $(VBOX_WITH_HGSMI),VBOX_WITH_HGSMI,) \ 39 40 $(if $(VBOX_WITH_CRHGSMI),VBOX_WITH_CRHGSMI,) \ -
trunk/src/VBox/Devices/testcase/tstDeviceStructSize.cpp
r47466 r48214 37 37 #undef LOG_GROUP 38 38 #include "../Input/PS2K.cpp" 39 #undef LOG_GROUP 40 #include "../Input/PS2M.cpp" 39 41 #ifdef VBOX_WITH_E1000 40 42 # undef LOG_GROUP -
trunk/src/VBox/Devices/testcase/tstDeviceStructSizeRC.cpp
r47829 r48214 46 46 #undef LOG_GROUP 47 47 #include "../Input/PS2K.cpp" 48 #undef LOG_GROUP 49 #include "../Input/PS2M.cpp" 48 50 #undef LOG_GROUP 49 51 #include "../Network/DevPCNet.cpp" … … 362 364 363 365 /* Input/pckbd.c */ 366 #ifndef VBOX_WITH_NEW_PS2M 364 367 GEN_CHECK_SIZE(MouseCmdQueue); 365 368 GEN_CHECK_OFF(MouseCmdQueue, data); … … 372 375 GEN_CHECK_OFF(MouseEventQueue, wptr); 373 376 GEN_CHECK_OFF(MouseEventQueue, count); 377 #endif 374 378 GEN_CHECK_SIZE(KBDState); 375 GEN_CHECK_OFF(KBDState, mouse_command_queue);376 GEN_CHECK_OFF(KBDState, mouse_event_queue);377 379 GEN_CHECK_OFF(KBDState, write_cmd); 378 380 GEN_CHECK_OFF(KBDState, status); 379 381 GEN_CHECK_OFF(KBDState, mode); 382 #ifndef VBOX_WITH_NEW_PS2M 383 GEN_CHECK_OFF(KBDState, mouse_command_queue); 384 GEN_CHECK_OFF(KBDState, mouse_event_queue); 380 385 GEN_CHECK_OFF(KBDState, mouse_write_cmd); 381 386 GEN_CHECK_OFF(KBDState, mouse_status); … … 390 395 GEN_CHECK_OFF(KBDState, mouse_dw); 391 396 GEN_CHECK_OFF(KBDState, mouse_buttons); 397 #endif 392 398 GEN_CHECK_OFF(KBDState, pDevInsR3); 393 399 GEN_CHECK_OFF(KBDState, pDevInsR0); … … 400 406 GEN_CHECK_OFF(KbdCmdQ, abQueue); 401 407 GEN_CHECK_SIZE(KbdCmdQ); 408 /* Input/PS2K.c */ 409 GEN_CHECK_SIZE(PS2K); 402 410 GEN_CHECK_OFF(PS2K, fScanning); 403 411 GEN_CHECK_OFF(PS2K, fNumLockOn); … … 419 427 GEN_CHECK_OFF(PS2K, Keyboard.pDrvBase); 420 428 GEN_CHECK_OFF(PS2K, Keyboard.pDrv); 429 #ifdef VBOX_WITH_NEW_PS2M 430 /* Input/PS2M.c */ 431 GEN_CHECK_SIZE(PS2M); 432 GEN_CHECK_OFF(PS2M, u8State); 433 GEN_CHECK_OFF(PS2M, u8SampleRate); 434 GEN_CHECK_OFF(PS2M, u8CurrCmd); 435 GEN_CHECK_OFF(PS2M, fThrottleActive); 436 GEN_CHECK_OFF(PS2M, enmMode); 437 GEN_CHECK_OFF(PS2M, enmKnockState); 438 GEN_CHECK_OFF(PS2M, iAccumX); 439 GEN_CHECK_OFF(PS2M, fAccumB); 440 GEN_CHECK_OFF(PS2M, uThrottleDelay); 441 GEN_CHECK_OFF(PS2M, evtQ); 442 GEN_CHECK_OFF(PS2M, cmdQ); 443 GEN_CHECK_OFF(PS2M, pDelayTimerRC); 444 GEN_CHECK_OFF(PS2M, pDelayTimerR3); 445 GEN_CHECK_OFF(PS2M, pDelayTimerR0); 446 GEN_CHECK_OFF(PS2M, pThrottleTimerRC); 447 GEN_CHECK_OFF(PS2M, pThrottleTimerR3); 448 GEN_CHECK_OFF(PS2M, pThrottleTimerR0); 449 GEN_CHECK_OFF(PS2M, pCritSectR3); 450 GEN_CHECK_OFF(PS2M, Mouse.IBase); 451 GEN_CHECK_OFF(PS2M, Mouse.IPort); 452 GEN_CHECK_OFF(PS2M, Mouse.pDrvBase); 453 GEN_CHECK_OFF(PS2M, Mouse.pDrv); 454 #else 421 455 GEN_CHECK_OFF(KBDState, Mouse.IBase); 422 456 GEN_CHECK_OFF(KBDState, Mouse.IPort); 423 457 GEN_CHECK_OFF(KBDState, Mouse.pDrvBase); 424 458 GEN_CHECK_OFF(KBDState, Mouse.pDrv); 459 #endif 425 460 426 461 /* Network/DevPCNet.cpp */
Note:
See TracChangeset
for help on using the changeset viewer.