Changeset 44806 in vbox
- Timestamp:
- Feb 22, 2013 8:47:57 PM (12 years ago)
- svn:sync-xref-src-repo-rev:
- 83926
- Location:
- trunk/src/VBox/Devices
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Input/DevPS2.cpp
r44528 r44806 165 165 #define MOUSE_EVENT_QUEUE_SIZE 256 166 166 167 typedef struct { 167 typedef struct 168 { 168 169 uint8_t data[MOUSE_EVENT_QUEUE_SIZE]; 169 int rptr, wptr, count; 170 int rptr; 171 int wptr; 172 int count; 170 173 } MouseEventQueue; 171 174 172 typedef struct KBDState { 175 /** 176 * The keyboard controller/device state. 177 * 178 * @note We use the default critical section for serialize data access. 179 */ 180 typedef struct KBDState 181 { 173 182 MouseCmdQueue mouse_command_queue; 174 183 MouseEventQueue mouse_event_queue; … … 204 213 /** Pointer to the device instance. */ 205 214 PPDMDEVINSR0 pDevInsR0; 206 207 /** Critical section protecting the state. */208 PDMCRITSECT CritSect;209 215 210 216 /** Keyboard state (implemented in separate PS2K module). */ … … 543 549 } 544 550 545 PS2K * GetPS2KFromDevIns(PPDMDEVINS pDevIns)551 PS2K *KBDGetPS2KFromDevIns(PPDMDEVINS pDevIns) 546 552 { 547 553 KBDState *pThis = PDMINS_2_DATA(pDevIns, KBDState *); … … 1200 1206 { 1201 1207 KBDState *pThis = PDMINS_2_DATA(pDevIns, KBDState *); 1202 int rc = PDMCritSectEnter(&pThis->CritSect, VINF_IOM_R3_IOPORT_READ); 1203 if (RT_LIKELY(rc == VINF_SUCCESS)) 1204 { 1205 *pu32 = kbd_read_data(pThis, Port); 1206 PDMCritSectLeave(&pThis->CritSect); 1207 Log2(("kbdIOPortDataRead: Port=%#x cb=%d *pu32=%#x\n", Port, cb, *pu32)); 1208 } 1209 return rc; 1208 *pu32 = kbd_read_data(pThis, Port); 1209 Log2(("kbdIOPortDataRead: Port=%#x cb=%d *pu32=%#x\n", Port, cb, *pu32)); 1210 return VINF_SUCCESS; 1210 1211 } 1211 1212 AssertMsgFailed(("Port=%#x cb=%d\n", Port, cb)); … … 1231 1232 { 1232 1233 KBDState *pThis = PDMINS_2_DATA(pDevIns, KBDState *); 1233 rc = PDMCritSectEnter(&pThis->CritSect, VINF_IOM_R3_IOPORT_WRITE); 1234 if (RT_LIKELY(rc == VINF_SUCCESS)) 1235 { 1236 rc = kbd_write_data(pThis, Port, u32); 1237 PDMCritSectLeave(&pThis->CritSect); 1238 Log2(("kbdIOPortDataWrite: Port=%#x cb=%d u32=%#x\n", Port, cb, u32)); 1239 } 1234 rc = kbd_write_data(pThis, Port, u32); 1235 Log2(("kbdIOPortDataWrite: Port=%#x cb=%d u32=%#x\n", Port, cb, u32)); 1240 1236 } 1241 1237 else … … 1261 1257 { 1262 1258 KBDState *pThis = PDMINS_2_DATA(pDevIns, KBDState *); 1263 int rc = PDMCritSectEnter(&pThis->CritSect, VINF_IOM_R3_IOPORT_READ); 1264 if (RT_LIKELY(rc == VINF_SUCCESS)) 1265 { 1266 *pu32 = kbd_read_status(pThis, Port); 1267 PDMCritSectLeave(&pThis->CritSect); 1268 Log2(("kbdIOPortStatusRead: Port=%#x cb=%d -> *pu32=%#x\n", Port, cb, *pu32)); 1269 } 1270 return rc; 1259 *pu32 = kbd_read_status(pThis, Port); 1260 Log2(("kbdIOPortStatusRead: Port=%#x cb=%d -> *pu32=%#x\n", Port, cb, *pu32)); 1261 return VINF_SUCCESS; 1271 1262 } 1272 1263 AssertMsgFailed(("Port=%#x cb=%d\n", Port, cb)); … … 1292 1283 { 1293 1284 KBDState *pThis = PDMINS_2_DATA(pDevIns, KBDState *); 1294 rc = PDMCritSectEnter(&pThis->CritSect, VINF_IOM_R3_IOPORT_WRITE); 1295 if (RT_LIKELY(rc == VINF_SUCCESS)) 1296 { 1297 rc = kbd_write_command(pThis, Port, u32); 1298 PDMCritSectLeave(&pThis->CritSect); 1299 Log2(("kbdIOPortCommandWrite: Port=%#x cb=%d u32=%#x rc=%Rrc\n", Port, cb, u32, rc)); 1300 } 1285 rc = kbd_write_command(pThis, Port, u32); 1286 Log2(("kbdIOPortCommandWrite: Port=%#x cb=%d u32=%#x rc=%Rrc\n", Port, cb, u32, rc)); 1301 1287 } 1302 1288 else … … 1312 1298 * @returns VBox status code. 1313 1299 * @param pDevIns The device instance. 1314 * @param pSSM HandleThe handle to save the state to.1315 */ 1316 static DECLCALLBACK(int) kbdSaveExec(PPDMDEVINS pDevIns, PSSMHANDLE pSSM Handle)1300 * @param pSSM The handle to save the state to. 1301 */ 1302 static DECLCALLBACK(int) kbdSaveExec(PPDMDEVINS pDevIns, PSSMHANDLE pSSM) 1317 1303 { 1318 1304 KBDState *pThis = PDMINS_2_DATA(pDevIns, KBDState *); 1319 kbd_save(pSSM Handle, pThis);1320 PS2KSaveState( pSSMHandle, &pThis->Kbd);1305 kbd_save(pSSM, pThis); 1306 PS2KSaveState(&pThis->Kbd, pSSM); 1321 1307 return VINF_SUCCESS; 1322 1308 } … … 1328 1314 * @returns VBox status code. 1329 1315 * @param pDevIns The device instance. 1330 * @param pSSM HandleThe handle to the saved state.1316 * @param pSSM The handle to the saved state. 1331 1317 * @param uVersion The data unit version number. 1332 1318 * @param uPass The data pass. 1333 1319 */ 1334 static DECLCALLBACK(int) kbdLoadExec(PPDMDEVINS pDevIns, PSSMHANDLE pSSM Handle, uint32_t uVersion, uint32_t uPass)1320 static DECLCALLBACK(int) kbdLoadExec(PPDMDEVINS pDevIns, PSSMHANDLE pSSM, uint32_t uVersion, uint32_t uPass) 1335 1321 { 1336 1322 KBDState *pThis = PDMINS_2_DATA(pDevIns, KBDState *); … … 1338 1324 1339 1325 Assert(uPass == SSM_PASS_FINAL); NOREF(uPass); 1340 rc = kbd_load(pSSM Handle, pThis, uVersion);1326 rc = kbd_load(pSSM, pThis, uVersion); 1341 1327 if (uVersion >= 6) 1342 rc = PS2KLoadState( pSSMHandle, &pThis->Kbd, uVersion);1328 rc = PS2KLoadState(&pThis->Kbd, pSSM, uVersion); 1343 1329 return rc; 1344 1330 } … … 1382 1368 { 1383 1369 KBDState *pThis = RT_FROM_MEMBER(pInterface, KBDState, Mouse.IPort); 1384 int rc = PDMCritSectEnter( &pThis->CritSect, VERR_SEM_BUSY);1370 int rc = PDMCritSectEnter(pThis->pDevInsR3->pCritSectRoR3, VERR_SEM_BUSY); 1385 1371 AssertReleaseRC(rc); 1386 1372 1387 1373 pc_kbd_mouse_event(pThis, iDeltaX, iDeltaY, iDeltaZ, iDeltaW, fButtonStates); 1388 1374 1389 PDMCritSectLeave( &pThis->CritSect);1375 PDMCritSectLeave(pThis->pDevInsR3->pCritSectRoR3); 1390 1376 return VINF_SUCCESS; 1391 1377 } … … 1433 1419 /* LUN #0: keyboard */ 1434 1420 case 0: 1435 rc = PS2KAttach( pDevIns, &pThis->Kbd, iLUN, fFlags);1421 rc = PS2KAttach(&pThis->Kbd, pDevIns, iLUN, fFlags); 1436 1422 if (RT_FAILURE(rc)) 1437 1423 return rc; … … 1521 1507 KBDState *pThis = PDMINS_2_DATA(pDevIns, KBDState *); 1522 1508 pThis->pDevInsRC = PDMDEVINS_2_RCPTR(pDevIns); 1523 PS2KRelocate(&pThis->Kbd, offDelta); 1524 } 1525 1526 1527 /** 1528 * Destruct a device instance for a VM. 1529 * 1530 * @returns VBox status. 1531 * @param pDevIns The device instance data. 1532 */ 1533 static DECLCALLBACK(int) kbdDestruct(PPDMDEVINS pDevIns) 1534 { 1535 KBDState *pThis = PDMINS_2_DATA(pDevIns, KBDState *); 1536 PDMDEV_CHECK_VERSIONS_RETURN_QUIET(pDevIns); 1537 1538 PDMR3CritSectDelete(&pThis->CritSect); 1539 1540 return VINF_SUCCESS; 1509 PS2KRelocate(&pThis->Kbd, offDelta, pDevIns); 1541 1510 } 1542 1511 … … 1576 1545 pThis->pDevInsRC = PDMDEVINS_2_RCPTR(pDevIns); 1577 1546 1578 rc = PS2KConstruct( pDevIns, &pThis->Kbd, pThis, iInstance);1547 rc = PS2KConstruct(&pThis->Kbd, pDevIns, pThis, iInstance); 1579 1548 if (RT_FAILURE(rc)) 1580 1549 return rc; … … 1583 1552 pThis->Mouse.IPort.pfnPutEvent = kbdMousePutEvent; 1584 1553 pThis->Mouse.IPort.pfnPutEventAbs = kbdMousePutEventAbs; 1585 1586 /*1587 * Initialize the critical section.1588 */1589 rc = PDMDevHlpCritSectInit(pDevIns, &pThis->CritSect, RT_SRC_POS, "PS2KM#%u", iInstance);1590 if (RT_FAILURE(rc))1591 return rc;1592 1554 1593 1555 /* … … 1669 1631 kbdConstruct, 1670 1632 /* pfnDestruct */ 1671 kbdDestruct,1633 NULL, 1672 1634 /* pfnRelocate */ 1673 1635 kbdRelocate, -
trunk/src/VBox/Devices/Input/PS2Dev.h
r39972 r44806 18 18 #define PS2DEV_H 19 19 20 /* Must be at least as big as the real struct. */ 21 #define PS2K_STRUCT_FILLER 768 20 /** The size of the PS2K structure filler. 21 * @note Must be at least as big as the real struct. Compile time assert 22 * makes sure this is so. */ 23 #define PS2K_STRUCT_FILLER 512 22 24 23 25 /* Hide the internal structure. */ 24 26 #if !(defined(IN_PS2K) || defined(VBOX_DEVICE_STRUCT_TESTCASE)) 25 typedef struct PS2K { 27 typedef struct PS2K 28 { 26 29 uint8_t abFiller[PS2K_STRUCT_FILLER]; 27 30 } PS2K; … … 33 36 int PS2KByteFromKbd(PPS2K pThis, uint8_t *pVal); 34 37 35 int PS2KConstruct(PP DMDEVINS pDevIns, PPS2K pThis, void *pParent, int iInstance);36 int PS2KAttach(PP DMDEVINS pDevIns, PPS2K pThis, unsigned iLUN, uint32_t fFlags);38 int PS2KConstruct(PPS2K pThis, PPDMDEVINS pDevIns, void *pParent, int iInstance); 39 int PS2KAttach(PPS2K pThis, PPDMDEVINS pDevIns, unsigned iLUN, uint32_t fFlags); 37 40 void PS2KReset(PPS2K pThis); 38 void PS2KRelocate(PPS2K pThis, RTGCINTPTR offDelta );39 void PS2KSaveState(P SSMHANDLE pSSM, PPS2K pThis);40 int PS2KLoadState(P SSMHANDLE pSSM, PPS2K pThis, uint32_t uVersion);41 void PS2KRelocate(PPS2K pThis, RTGCINTPTR offDelta, PPDMDEVINS pDevIns); 42 void PS2KSaveState(PPS2K pThis, PSSMHANDLE pSSM); 43 int PS2KLoadState(PPS2K pThis, PSSMHANDLE pSSM, uint32_t uVersion); 41 44 42 45 void KBCUpdateInterrupts(void *pKbc); 43 46 44 PS2K * GetPS2KFromDevIns(PPDMDEVINS pDevIns);47 PS2K *KBDGetPS2KFromDevIns(PPDMDEVINS pDevIns); 45 48 46 // @todo: This should live with the KBC implementation.49 ///@todo: This should live with the KBC implementation. 47 50 /** AT to PC scancode translator state. */ 48 typedef enum { 51 typedef enum 52 { 49 53 XS_IDLE, /**< Starting state. */ 50 54 XS_BREAK, /**< F0 break byte was received. */ -
trunk/src/VBox/Devices/Input/PS2K.cpp
r44023 r44806 188 188 uint32_t Alignment0; 189 189 #endif 190 /** Critical section protecting the state. */ 191 PDMCRITSECT KbdCritSect; 190 192 191 /** Command delay timer - RC Ptr. */ 193 192 PTMTIMERRC pKbdDelayTimerRC; 194 193 /** Typematic timer - RC Ptr. */ 195 194 PTMTIMERRC pKbdTypematicTimerRC; 195 196 /** The device critical section protecting everything - R3 Ptr */ 197 R3PTRTYPE(PPDMCRITSECT) pCritSectR3; 196 198 /** Command delay timer - R3 Ptr. */ 197 199 PTMTIMERR3 pKbdDelayTimerR3; 198 200 /** Typematic timer - R3 Ptr. */ 199 201 PTMTIMERR3 pKbdTypematicTimerR3; 202 RTR3PTR Alignment2; 203 200 204 /** Command delay timer - R0 Ptr. */ 201 205 PTMTIMERR0 pKbdDelayTimerR0; … … 203 207 PTMTIMERR0 pKbdTypematicTimerR0; 204 208 205 scan_state_t XlatState; // @todo: temporary209 scan_state_t XlatState; ///@todo: temporary 206 210 uint32_t Alignment1; 207 211 … … 561 565 * @param pQ Pointer to the queue. 562 566 */ 563 static void PS2ClearQueue(GeneriQ *pQ)567 static void ps2kClearQueue(GeneriQ *pQ) 564 568 { 565 569 LogFlowFunc(("Clearing queue %p\n", pQ)); … … 575 579 * @param val The byte to store. 576 580 */ 577 static void PS2InsertQueue(GeneriQ *pQ, uint8_t val)581 static void ps2kInsertQueue(GeneriQ *pQ, uint8_t val) 578 582 { 579 583 /* Check if queue is full. */ … … 599 603 * @param pQ Pointer to the queue. 600 604 */ 601 static void PS2SaveQueue(PSSMHANDLE pSSM, GeneriQ *pQ)605 static void ps2kSaveQueue(PSSMHANDLE pSSM, GeneriQ *pQ) 602 606 { 603 607 uint32_t cItems = pQ->cUsed; … … 624 628 * @return int VBox status/error code. 625 629 */ 626 static int PS2LoadQueue(PSSMHANDLE pSSM, GeneriQ *pQ)630 static int ps2kLoadQueue(PSSMHANDLE pSSM, GeneriQ *pQ) 627 631 { 628 632 int rc; … … 647 651 } 648 652 649 #endif 653 #endif /* IN_RING3 */ 650 654 651 655 /** … … 658 662 * VINF_SUCCESS if a byte was read. 659 663 */ 660 int PS2RemoveQueue(GeneriQ *pQ, uint8_t *pVal)664 static int ps2kRemoveQueue(GeneriQ *pQ, uint8_t *pVal) 661 665 { 662 666 int rc = VINF_TRY_AGAIN; … … 679 683 * with +/- 20% accuracy, so there's no need for high precision. 680 684 */ 681 static void PS2KSetupTypematic(PPS2K pThis, uint8_t val)685 static void ps2kSetupTypematic(PPS2K pThis, uint8_t val) 682 686 { 683 687 int A, B; … … 693 697 pThis->uTypematicRepeat = period; 694 698 Log(("Typematic delay %u ms, repeat period %u ms\n", 695 696 } 697 698 static void PS2KSetDefaults(PPS2K pThis)699 pThis->uTypematicDelay, pThis->uTypematicRepeat)); 700 } 701 702 static void ps2kSetDefaults(PPS2K pThis) 699 703 { 700 704 LogFlowFunc(("Set keyboard defaults\n")); 701 PS2ClearQueue((GeneriQ *)&pThis->keyQ);705 ps2kClearQueue((GeneriQ *)&pThis->keyQ); 702 706 /* Set default Scan Set 3 typematic values. */ 703 707 /* Set default typematic rate/delay. */ 704 PS2KSetupTypematic(pThis, KBD_DFL_RATE_DELAY);708 ps2kSetupTypematic(pThis, KBD_DFL_RATE_DELAY); 705 709 /* Clear last typematic key?? */ 706 710 } … … 709 713 * Receive and process a byte sent by the keyboard controller. 710 714 * 711 * @param pThis The keyboard.715 * @param pThis The PS/2 keyboard instance data. 712 716 * @param cmd The command (or data) byte. 713 717 */ … … 718 722 LogFlowFunc(("new cmd=0x%02X, active cmd=0x%02X\n", cmd, pThis->u8CurrCmd)); 719 723 720 switch (cmd) { 721 case KCMD_ECHO: 722 PS2InsertQueue((GeneriQ *)&pThis->cmdQ, KRSP_ECHO); 723 pThis->u8CurrCmd = 0; 724 break; 725 case KCMD_READ_ID: 726 PS2InsertQueue((GeneriQ *)&pThis->cmdQ, KRSP_ACK); 727 PS2InsertQueue((GeneriQ *)&pThis->cmdQ, KRSP_ID1); 728 PS2InsertQueue((GeneriQ *)&pThis->cmdQ, KRSP_ID2); 729 pThis->u8CurrCmd = 0; 730 break; 731 case KCMD_ENABLE: 732 pThis->fScanning = true; 733 PS2ClearQueue((GeneriQ *)&pThis->keyQ); 734 /* Clear last typematic key?? */ 735 PS2InsertQueue((GeneriQ *)&pThis->cmdQ, KRSP_ACK); 736 pThis->u8CurrCmd = 0; 737 break; 738 case KCMD_DFLT_DISABLE: 739 pThis->fScanning = false; 740 PS2KSetDefaults(pThis); 741 PS2InsertQueue((GeneriQ *)&pThis->cmdQ, KRSP_ACK); 742 pThis->u8CurrCmd = 0; 743 break; 744 case KCMD_SET_DEFAULT: 745 PS2KSetDefaults(pThis); 746 PS2InsertQueue((GeneriQ *)&pThis->cmdQ, KRSP_ACK); 747 pThis->u8CurrCmd = 0; 748 break; 749 case KCMD_ALL_TYPEMATIC: 750 case KCMD_ALL_MK_BRK: 751 case KCMD_ALL_MAKE: 752 case KCMD_ALL_TMB: 753 //@todo: Set the key types here. 754 PS2InsertQueue((GeneriQ *)&pThis->cmdQ, KRSP_ACK); 755 pThis->u8CurrCmd = 0; 756 break; 757 case KCMD_RESEND: 758 pThis->u8CurrCmd = 0; 759 break; 760 case KCMD_RESET: 761 pThis->u8ScanSet = 2; 762 PS2KSetDefaults(pThis); 763 //@todo: reset more? 764 PS2InsertQueue((GeneriQ *)&pThis->cmdQ, KRSP_ACK); 765 pThis->u8CurrCmd = cmd; 766 /* Delay BAT completion; the test may take hundreds of ms. */ 767 TMTimerSetMillies(pThis->CTX_SUFF(pKbdDelayTimer), 2); 768 break; 769 /* The following commands need a parameter. */ 770 case KCMD_LEDS: 771 case KCMD_SCANSET: 772 case KCMD_RATE_DELAY: 773 case KCMD_TYPE_MATIC: 774 case KCMD_TYPE_MK_BRK: 775 case KCMD_TYPE_MAKE: 776 PS2InsertQueue((GeneriQ *)&pThis->cmdQ, KRSP_ACK); 777 pThis->u8CurrCmd = cmd; 778 break; 779 default: 780 /* Sending a command instead of a parameter starts the new command. */ 781 switch (pThis->u8CurrCmd) { 782 case KCMD_LEDS: 783 #ifndef IN_RING3 784 return VINF_IOM_R3_IOPORT_WRITE; 785 #else 786 { 787 PDMKEYBLEDS enmLeds = PDMKEYBLEDS_NONE; 788 789 if (cmd & 0x01) 790 enmLeds = (PDMKEYBLEDS)(enmLeds | PDMKEYBLEDS_SCROLLLOCK); 791 if (cmd & 0x02) 792 enmLeds = (PDMKEYBLEDS)(enmLeds | PDMKEYBLEDS_NUMLOCK); 793 if (cmd & 0x04) 794 enmLeds = (PDMKEYBLEDS)(enmLeds | PDMKEYBLEDS_CAPSLOCK); 795 pThis->Keyboard.pDrv->pfnLedStatusChange(pThis->Keyboard.pDrv, enmLeds); 796 pThis->fNumLockOn = !!(cmd & 0x02); /* Sync internal Num Lock state. */ 797 PS2InsertQueue((GeneriQ *)&pThis->cmdQ, KRSP_ACK); 798 pThis->u8LEDs = cmd; 799 pThis->u8CurrCmd = 0; 800 } 801 #endif 802 break; 803 case KCMD_SCANSET: 804 PS2InsertQueue((GeneriQ *)&pThis->cmdQ, KRSP_ACK); 805 if (cmd == 0) 806 PS2InsertQueue((GeneriQ *)&pThis->cmdQ, pThis->u8ScanSet); 807 else if (cmd < 4) 808 { 809 pThis->u8ScanSet = cmd; 810 LogRel(("PS2K: Selected scan set %d.\n", cmd)); 811 } 812 /* Other values are simply ignored. */ 724 switch (cmd) 725 { 726 case KCMD_ECHO: 727 ps2kInsertQueue((GeneriQ *)&pThis->cmdQ, KRSP_ECHO); 813 728 pThis->u8CurrCmd = 0; 814 729 break; 815 case KCMD_RATE_DELAY: 816 PS2KSetupTypematic(pThis, cmd); 817 PS2InsertQueue((GeneriQ *)&pThis->cmdQ, KRSP_ACK); 730 case KCMD_READ_ID: 731 ps2kInsertQueue((GeneriQ *)&pThis->cmdQ, KRSP_ACK); 732 ps2kInsertQueue((GeneriQ *)&pThis->cmdQ, KRSP_ID1); 733 ps2kInsertQueue((GeneriQ *)&pThis->cmdQ, KRSP_ID2); 818 734 pThis->u8CurrCmd = 0; 819 735 break; 736 case KCMD_ENABLE: 737 pThis->fScanning = true; 738 ps2kClearQueue((GeneriQ *)&pThis->keyQ); 739 /* Clear last typematic key?? */ 740 ps2kInsertQueue((GeneriQ *)&pThis->cmdQ, KRSP_ACK); 741 pThis->u8CurrCmd = 0; 742 break; 743 case KCMD_DFLT_DISABLE: 744 pThis->fScanning = false; 745 ps2kSetDefaults(pThis); 746 ps2kInsertQueue((GeneriQ *)&pThis->cmdQ, KRSP_ACK); 747 pThis->u8CurrCmd = 0; 748 break; 749 case KCMD_SET_DEFAULT: 750 ps2kSetDefaults(pThis); 751 ps2kInsertQueue((GeneriQ *)&pThis->cmdQ, KRSP_ACK); 752 pThis->u8CurrCmd = 0; 753 break; 754 case KCMD_ALL_TYPEMATIC: 755 case KCMD_ALL_MK_BRK: 756 case KCMD_ALL_MAKE: 757 case KCMD_ALL_TMB: 758 ///@todo Set the key types here. 759 ps2kInsertQueue((GeneriQ *)&pThis->cmdQ, KRSP_ACK); 760 pThis->u8CurrCmd = 0; 761 break; 762 case KCMD_RESEND: 763 pThis->u8CurrCmd = 0; 764 break; 765 case KCMD_RESET: 766 pThis->u8ScanSet = 2; 767 ps2kSetDefaults(pThis); 768 ///@todo reset more? 769 ps2kInsertQueue((GeneriQ *)&pThis->cmdQ, KRSP_ACK); 770 pThis->u8CurrCmd = cmd; 771 /* Delay BAT completion; the test may take hundreds of ms. */ 772 TMTimerSetMillies(pThis->CTX_SUFF(pKbdDelayTimer), 2); 773 break; 774 /* The following commands need a parameter. */ 775 case KCMD_LEDS: 776 case KCMD_SCANSET: 777 case KCMD_RATE_DELAY: 778 case KCMD_TYPE_MATIC: 779 case KCMD_TYPE_MK_BRK: 780 case KCMD_TYPE_MAKE: 781 ps2kInsertQueue((GeneriQ *)&pThis->cmdQ, KRSP_ACK); 782 pThis->u8CurrCmd = cmd; 783 break; 820 784 default: 821 fHandled = false; 822 } 823 /* Fall through only to handle unrecognized commands. */ 824 if (fHandled) 785 /* Sending a command instead of a parameter starts the new command. */ 786 switch (pThis->u8CurrCmd) 787 { 788 case KCMD_LEDS: 789 #ifndef IN_RING3 790 return VINF_IOM_R3_IOPORT_WRITE; 791 #else 792 { 793 PDMKEYBLEDS enmLeds = PDMKEYBLEDS_NONE; 794 795 if (cmd & 0x01) 796 enmLeds = (PDMKEYBLEDS)(enmLeds | PDMKEYBLEDS_SCROLLLOCK); 797 if (cmd & 0x02) 798 enmLeds = (PDMKEYBLEDS)(enmLeds | PDMKEYBLEDS_NUMLOCK); 799 if (cmd & 0x04) 800 enmLeds = (PDMKEYBLEDS)(enmLeds | PDMKEYBLEDS_CAPSLOCK); 801 pThis->Keyboard.pDrv->pfnLedStatusChange(pThis->Keyboard.pDrv, enmLeds); 802 pThis->fNumLockOn = !!(cmd & 0x02); /* Sync internal Num Lock state. */ 803 ps2kInsertQueue((GeneriQ *)&pThis->cmdQ, KRSP_ACK); 804 pThis->u8LEDs = cmd; 805 pThis->u8CurrCmd = 0; 806 } 807 #endif 808 break; 809 case KCMD_SCANSET: 810 ps2kInsertQueue((GeneriQ *)&pThis->cmdQ, KRSP_ACK); 811 if (cmd == 0) 812 ps2kInsertQueue((GeneriQ *)&pThis->cmdQ, pThis->u8ScanSet); 813 else if (cmd < 4) 814 { 815 pThis->u8ScanSet = cmd; 816 LogRel(("PS2K: Selected scan set %d.\n", cmd)); 817 } 818 /* Other values are simply ignored. */ 819 pThis->u8CurrCmd = 0; 820 break; 821 case KCMD_RATE_DELAY: 822 ps2kSetupTypematic(pThis, cmd); 823 ps2kInsertQueue((GeneriQ *)&pThis->cmdQ, KRSP_ACK); 824 pThis->u8CurrCmd = 0; 825 break; 826 default: 827 fHandled = false; 828 } 829 /* Fall through only to handle unrecognized commands. */ 830 if (fHandled) 831 break; 832 833 case KCMD_INVALID_1: 834 case KCMD_INVALID_2: 835 ps2kInsertQueue((GeneriQ *)&pThis->cmdQ, KRSP_RESEND); 836 pThis->u8CurrCmd = 0; 825 837 break; 826 827 case KCMD_INVALID_1:828 case KCMD_INVALID_2:829 PS2InsertQueue((GeneriQ *)&pThis->cmdQ, KRSP_RESEND);830 pThis->u8CurrCmd = 0;831 break;832 838 } 833 839 LogFlowFunc(("Active cmd now 0x%02X; updating interrupts\n", pThis->u8CurrCmd)); … … 839 845 * Send a byte (keystroke or command response) to the keyboard controller. 840 846 * 841 * @param pThis The keyboard. 842 */ 843 int PS2KByteFromKbd(PPS2K pThis, uint8_t *pVal) 847 * @returns VINF_SUCCESS or VINF_TRY_AGAIN. 848 * @param pThis The PS/2 keyboard instance data. 849 * @param pb Where to return the byte we've read. 850 * @remarks Caller must have entered the device critical section. 851 */ 852 int PS2KByteFromKbd(PPS2K pThis, uint8_t *pb) 844 853 { 845 854 int rc; 846 855 847 Assert (pVal);856 AssertPtr(pb); 848 857 849 858 /* Anything in the command queue has priority over data … … 852 861 * the command queue is empty. 853 862 */ 854 rc = PS2RemoveQueue((GeneriQ *)&pThis->cmdQ, pVal);863 rc = ps2kRemoveQueue((GeneriQ *)&pThis->cmdQ, pb); 855 864 if (rc != VINF_SUCCESS && !pThis->u8CurrCmd && pThis->fScanning) 856 rc = PS2RemoveQueue((GeneriQ *)&pThis->keyQ, pVal);857 858 LogFlowFunc(("keyboard sends 0x%02x (%svalid data)\n", *p Val, rc == VINF_SUCCESS ? "" : "not "));865 rc = ps2kRemoveQueue((GeneriQ *)&pThis->keyQ, pb); 866 867 LogFlowFunc(("keyboard sends 0x%02x (%svalid data)\n", *pb, rc == VINF_SUCCESS ? "" : "not ")); 859 868 return rc; 860 869 } … … 862 871 #ifdef IN_RING3 863 872 864 static int PS2KProcessKeyEvent(PPS2K pThis, uint8_t u8HidCode, bool fKeyDown)873 static int psk2ProcessKeyEvent(PPS2K pThis, uint8_t u8HidCode, bool fKeyDown) 865 874 { 866 875 unsigned int i = 0; … … 939 948 } 940 949 /* Feed the bytes to the queue if there is room. */ 941 // @todo:check empty space!950 ///@todo check empty space! 942 951 while (abCodes[i]) 943 PS2InsertQueue((GeneriQ *)&pThis->keyQ, abCodes[i++]);952 ps2kInsertQueue((GeneriQ *)&pThis->keyQ, abCodes[i++]); 944 953 Assert(i < sizeof(abCodes)); 945 954 … … 948 957 { 949 958 if (pKeyDef->keyFlags & (KF_E0 | KF_GK | KF_NS)) 950 PS2InsertQueue((GeneriQ *)&pThis->keyQ, 0xE0);951 PS2InsertQueue((GeneriQ *)&pThis->keyQ, pKeyDef->makeS2);959 ps2kInsertQueue((GeneriQ *)&pThis->keyQ, 0xE0); 960 ps2kInsertQueue((GeneriQ *)&pThis->keyQ, pKeyDef->makeS2); 952 961 } 953 962 } … … 971 980 /* Process base scan code for less unusual keys. */ 972 981 if (pKeyDef->keyFlags & (KF_E0 | KF_GK | KF_NS)) 973 PS2InsertQueue((GeneriQ *)&pThis->keyQ, 0xE0);974 PS2InsertQueue((GeneriQ *)&pThis->keyQ, 0xF0);975 PS2InsertQueue((GeneriQ *)&pThis->keyQ, pKeyDef->makeS2);982 ps2kInsertQueue((GeneriQ *)&pThis->keyQ, 0xE0); 983 ps2kInsertQueue((GeneriQ *)&pThis->keyQ, 0xF0); 984 ps2kInsertQueue((GeneriQ *)&pThis->keyQ, pKeyDef->makeS2); 976 985 977 986 /* Restore shift state for gray keys. */ … … 994 1003 995 1004 /* Feed any additional bytes to the queue if there is room. */ 996 // @todo:check empty space!1005 ///@todo check empty space! 997 1006 while (abCodes[i]) 998 PS2InsertQueue((GeneriQ *)&pThis->keyQ, abCodes[i++]);1007 ps2kInsertQueue((GeneriQ *)&pThis->keyQ, abCodes[i++]); 999 1008 Assert(i < sizeof(abCodes)); 1000 1009 } … … 1006 1015 { 1007 1016 if (pKeyDef->keyFlags & (KF_E0 | KF_GK | KF_NS | KF_PS)) 1008 PS2InsertQueue((GeneriQ *)&pThis->keyQ, 0xE0);1009 PS2InsertQueue((GeneriQ *)&pThis->keyQ, pKeyDef->makeS1);1017 ps2kInsertQueue((GeneriQ *)&pThis->keyQ, 0xE0); 1018 ps2kInsertQueue((GeneriQ *)&pThis->keyQ, pKeyDef->makeS1); 1010 1019 } 1011 1020 else if (!(pKeyDef->keyFlags & (KF_NB | KF_PB))) { 1012 1021 if (pKeyDef->keyFlags & (KF_E0 | KF_GK | KF_NS | KF_PS)) 1013 PS2InsertQueue((GeneriQ *)&pThis->keyQ, 0xE0);1014 PS2InsertQueue((GeneriQ *)&pThis->keyQ, pKeyDef->makeS1 | 0x80);1022 ps2kInsertQueue((GeneriQ *)&pThis->keyQ, 0xE0); 1023 ps2kInsertQueue((GeneriQ *)&pThis->keyQ, pKeyDef->makeS1 | 0x80); 1015 1024 } 1016 1025 } … … 1020 1029 if (fKeyDown) 1021 1030 { 1022 PS2InsertQueue((GeneriQ *)&pThis->keyQ, pKeyDef->makeS3);1031 ps2kInsertQueue((GeneriQ *)&pThis->keyQ, pKeyDef->makeS3); 1023 1032 } 1024 1033 else 1025 1034 { 1026 1035 /* Send a key release code unless it's a make only key. */ 1027 // @todo:Look up the current typematic setting, not the default!1036 ///@todo Look up the current typematic setting, not the default! 1028 1037 if (pKeyDef->keyMatic != T_M) 1029 1038 { 1030 PS2InsertQueue((GeneriQ *)&pThis->keyQ, 0xF0);1031 PS2InsertQueue((GeneriQ *)&pThis->keyQ, pKeyDef->makeS3);1039 ps2kInsertQueue((GeneriQ *)&pThis->keyQ, 0xF0); 1040 ps2kInsertQueue((GeneriQ *)&pThis->keyQ, pKeyDef->makeS3); 1032 1041 } 1033 1042 } … … 1049 1058 pThis->u8TypematicKey = 0; 1050 1059 pThis->enmTypematicState = KBD_TMS_IDLE; 1051 // @todo:Cancel timer right away?1052 // @todo:Cancel timer before pushing key up code!?1060 ///@todo Cancel timer right away? 1061 ///@todo Cancel timer before pushing key up code!? 1053 1062 } 1054 1063 … … 1062 1071 * held down repeats (if typematic). 1063 1072 */ 1064 static DECLCALLBACK(void) PS2KTypematicTimer(PPDMDEVINS pDevIns, PTMTIMER pTimer, void *pvUser) 1065 { 1066 PPS2K pThis = (PS2K *)pvUser; //PDMINS_2_DATA(pDevIns, PS2K *); 1067 int rc = PDMCritSectEnter(&pThis->KbdCritSect, VERR_SEM_BUSY); 1068 AssertReleaseRC(rc); 1069 1073 static DECLCALLBACK(void) ps2kTypematicTimer(PPDMDEVINS pDevIns, PTMTIMER pTimer, void *pvUser) 1074 { 1075 PPS2K pThis = (PS2K *)pvUser; NOREF(pDevIns); 1070 1076 LogFlowFunc(("Typematic state=%d, key %02X\n", pThis->enmTypematicState, pThis->u8TypematicKey)); 1071 1077 … … 1080 1086 if (pThis->enmTypematicState == KBD_TMS_REPEAT) 1081 1087 { 1082 PS2KProcessKeyEvent(pThis, pThis->u8TypematicKey, true /* Key down */ );1088 psk2ProcessKeyEvent(pThis, pThis->u8TypematicKey, true /* Key down */ ); 1083 1089 TMTimerSetMillies(pThis->CTX_SUFF(pKbdTypematicTimer), pThis->uTypematicRepeat); 1084 1090 } 1085 1091 } 1086 1087 PDMCritSectLeave(&pThis->KbdCritSect);1088 1092 } 1089 1093 … … 1091 1095 * to delay sending the result to the host for at least a tiny little while. 1092 1096 */ 1093 static DECLCALLBACK(void) PS2KDelayTimer(PPDMDEVINS pDevIns, PTMTIMER pTimer, void *pvUser) 1094 { 1095 PPS2K pThis = GetPS2KFromDevIns(pDevIns); 1096 int rc = PDMCritSectEnter(&pThis->KbdCritSect, VERR_SEM_BUSY); 1097 AssertReleaseRC(rc); 1097 static DECLCALLBACK(void) ps2kDelayTimer(PPDMDEVINS pDevIns, PTMTIMER pTimer, void *pvUser) 1098 { 1099 PPS2K pThis = (PS2K *)pvUser; NOREF(pDevIns); 1098 1100 1099 1101 LogFlowFunc(("Delay timer: cmd %02X\n", pThis->u8CurrCmd)); 1100 1102 1101 1103 Assert(pThis->u8CurrCmd == KCMD_RESET); 1102 PS2InsertQueue((GeneriQ *)&pThis->cmdQ, KRSP_BAT_OK);1104 ps2kInsertQueue((GeneriQ *)&pThis->cmdQ, KRSP_BAT_OK); 1103 1105 pThis->fScanning = true; /* BAT completion enables scanning! */ 1104 1106 pThis->u8CurrCmd = 0; 1105 1107 1106 // @todo:Might want a PS2KCompleteCommand() to push last response, clear command, and kick the KBC...1108 ///@todo Might want a PS2KCompleteCommand() to push last response, clear command, and kick the KBC... 1107 1109 /* Give the KBC a kick. */ 1108 1110 KBCUpdateInterrupts(pThis->pParent); 1109 1110 PDMCritSectLeave(&pThis->KbdCritSect);1111 1111 } 1112 1112 … … 1119 1119 * @param pszArgs Argument string. Optional and specific to the handler. 1120 1120 */ 1121 static DECLCALLBACK(void) PS2KInfoState(PPDMDEVINS pDevIns, PCDBGFINFOHLP pHlp, const char *pszArgs)1122 { 1123 PPS2K pThis = GetPS2KFromDevIns(pDevIns);1121 static DECLCALLBACK(void) ps2kInfoState(PPDMDEVINS pDevIns, PCDBGFINFOHLP pHlp, const char *pszArgs) 1122 { 1123 PPS2K pThis = KBDGetPS2KFromDevIns(pDevIns); 1124 1124 NOREF(pszArgs); 1125 1125 … … 1145 1145 * @interface_method_impl{PDMIBASE,pfnQueryInterface} 1146 1146 */ 1147 static DECLCALLBACK(void *) PS2KQueryInterface(PPDMIBASE pInterface, const char *pszIID)1147 static DECLCALLBACK(void *) ps2kQueryInterface(PPDMIBASE pInterface, const char *pszIID) 1148 1148 { 1149 1149 PPS2K pThis = RT_FROM_MEMBER(pInterface, PS2K, Keyboard.IBase); … … 1160 1160 * 1161 1161 * @returns VBox status code. 1162 * @param p Interface Pointer to the keyboard port interface (KBDState::Keyboard.IPort).1162 * @param pThis The PS2 keyboard instance data. 1163 1163 * @param u32Usage USB HID usage code with key 1164 1164 * press/release flag. 1165 1165 */ 1166 static DECLCALLBACK(int) PS2KPutEvent(PPDMIKEYBOARDPORT pInterface, uint32_t u32Usage) 1167 { 1168 PPS2K pThis = RT_FROM_MEMBER(pInterface, PS2K, Keyboard.IPort); 1166 static int ps2kPutEventWorker(PPS2K pThis, uint32_t u32Usage) 1167 { 1169 1168 uint8_t u8HidCode; 1170 1169 bool fKeyDown; … … 1196 1195 if (fHaveEvent) 1197 1196 { 1198 rc = PDMCritSectEnter( &pThis->KbdCritSect, VERR_SEM_BUSY);1197 rc = PDMCritSectEnter(pThis->pCritSectR3, VERR_SEM_BUSY); 1199 1198 AssertReleaseRC(rc); 1200 1199 1201 rc = PS2KProcessKeyEvent(pThis, u8HidCode, fKeyDown);1202 1203 PDMCritSectLeave( &pThis->KbdCritSect);1200 rc = psk2ProcessKeyEvent(pThis, u8HidCode, fKeyDown); 1201 1202 PDMCritSectLeave(pThis->pCritSectR3); 1204 1203 } 1205 1204 … … 1207 1206 } 1208 1207 1209 static DECLCALLBACK(int) PS2KPutEventWrapper(PPDMIKEYBOARDPORT pInterface, uint8_t u8KeyCode)1208 static DECLCALLBACK(int) ps2kPutEventWrapper(PPDMIKEYBOARDPORT pInterface, uint8_t u8KeyCode) 1210 1209 { 1211 1210 PPS2K pThis = RT_FROM_MEMBER(pInterface, PS2K, Keyboard.IPort); … … 1219 1218 /* Stupid Korean key hack: convert a lone break key into a press/release sequence. */ 1220 1219 if (u32Usage == 0x80000090 || u32Usage == 0x80000091) 1221 PS2KPutEvent(pInterface, u32Usage & ~0x80000000);1222 1223 PS2KPutEvent(pInterface, u32Usage);1220 ps2kPutEventWorker(pThis, u32Usage & ~0x80000000); 1221 1222 ps2kPutEventWorker(pThis, u32Usage); 1224 1223 } 1225 1224 … … 1238 1237 * 1239 1238 * @returns VBox status code. 1239 * @param pThis The PS/2 keyboard instance data. 1240 1240 * @param pDevIns The device instance. 1241 1241 * @param iLUN The logical unit which is being detached. 1242 1242 * @param fFlags Flags, combination of the PDMDEVATT_FLAGS_* \#defines. 1243 1243 */ 1244 int PS2KAttach(PP DMDEVINS pDevIns, PPS2K pThis, unsigned iLUN, uint32_t fFlags)1244 int PS2KAttach(PPS2K pThis, PPDMDEVINS pDevIns, unsigned iLUN, uint32_t fFlags) 1245 1245 { 1246 1246 int rc; … … 1275 1275 } 1276 1276 1277 void PS2KSaveState(P SSMHANDLE pSSM, PPS2K pThis)1277 void PS2KSaveState(PPS2K pThis, PSSMHANDLE pSSM) 1278 1278 { 1279 1279 uint32_t cPressed = 0; … … 1294 1294 1295 1295 /* Save the command and keystroke queues. */ 1296 PS2SaveQueue(pSSM, (GeneriQ *)&pThis->cmdQ);1297 PS2SaveQueue(pSSM, (GeneriQ *)&pThis->keyQ);1296 ps2kSaveQueue(pSSM, (GeneriQ *)&pThis->cmdQ); 1297 ps2kSaveQueue(pSSM, (GeneriQ *)&pThis->keyQ); 1298 1298 1299 1299 /* Save the command delay timer. Note that the typematic repeat … … 1320 1320 } 1321 1321 1322 int PS2KLoadState(P SSMHANDLE pSSM, PPS2K pThis, uint32_t uVersion)1322 int PS2KLoadState(PPS2K pThis, PSSMHANDLE pSSM, uint32_t uVersion) 1323 1323 { 1324 1324 uint8_t u8; … … 1342 1342 SSMR3GetBool(pSSM, &pThis->fScanning); 1343 1343 1344 do { 1345 /* Load the command and keystroke queues. */ 1346 rc = PS2LoadQueue(pSSM, (GeneriQ *)&pThis->cmdQ); 1347 if (RT_FAILURE(rc)) break; 1348 rc = PS2LoadQueue(pSSM, (GeneriQ *)&pThis->keyQ); 1349 if (RT_FAILURE(rc)) break; 1350 1351 /* Load the command delay timer, just in case. */ 1352 rc = TMR3TimerLoad(pThis->CTX_SUFF(pKbdDelayTimer), pSSM); 1353 if (RT_FAILURE(rc)) break; 1354 1355 /* Fake key up events for keys that were held down at the time the state was saved. */ 1356 rc = SSMR3GetU32(pSSM, &cPressed); 1357 if (RT_FAILURE(rc)) break; 1358 1359 while (cPressed--) 1360 { 1361 rc = SSMR3GetU8(pSSM, &u8); 1362 if (RT_FAILURE(rc)) break; 1363 PS2KProcessKeyEvent(pThis, u8, false /* key up */); 1364 } 1365 if (RT_FAILURE(rc)) break; 1366 1367 /* Load typematic settings for Scan Set 3. */ 1368 rc = SSMR3GetU32(pSSM, &cbTMSSize); 1369 if (RT_FAILURE(rc)) break; 1370 1371 while (cbTMSSize--) 1372 { 1373 rc = SSMR3GetU8(pSSM, &u8); 1374 if (RT_FAILURE(rc)) break; 1375 } 1376 } while (0); 1344 /* Load the command and keystroke queues. */ 1345 rc = ps2kLoadQueue(pSSM, (GeneriQ *)&pThis->cmdQ); 1346 AssertRCReturn(rc, rc); 1347 rc = ps2kLoadQueue(pSSM, (GeneriQ *)&pThis->keyQ); 1348 AssertRCReturn(rc, rc); 1349 1350 /* Load the command delay timer, just in case. */ 1351 rc = TMR3TimerLoad(pThis->CTX_SUFF(pKbdDelayTimer), pSSM); 1352 AssertRCReturn(rc, rc); 1353 1354 /* Fake key up events for keys that were held down at the time the state was saved. */ 1355 rc = SSMR3GetU32(pSSM, &cPressed); 1356 AssertRCReturn(rc, rc); 1357 1358 while (cPressed--) 1359 { 1360 rc = SSMR3GetU8(pSSM, &u8); 1361 AssertRCReturn(rc, rc); 1362 psk2ProcessKeyEvent(pThis, u8, false /* key up */); 1363 } 1364 1365 /* Load typematic settings for Scan Set 3. */ 1366 rc = SSMR3GetU32(pSSM, &cbTMSSize); 1367 AssertRCReturn(rc, rc); 1368 1369 while (cbTMSSize--) 1370 { 1371 rc = SSMR3GetU8(pSSM, &u8); 1372 AssertRCReturn(rc, rc); 1373 } 1377 1374 1378 1375 return rc; … … 1392 1389 /* Clear queues and any pressed keys. */ 1393 1390 memset(pThis->abDepressedKeys, 0, sizeof(pThis->abDepressedKeys)); 1394 PS2ClearQueue((GeneriQ *)&pThis->cmdQ);1395 PS2KSetDefaults(pThis); /* Also clears keystroke queue. */1391 ps2kClearQueue((GeneriQ *)&pThis->cmdQ); 1392 ps2kSetDefaults(pThis); /* Also clears keystroke queue. */ 1396 1393 1397 1394 /* Activate the PS/2 keyboard by default. */ … … 1400 1397 } 1401 1398 1402 void PS2KRelocate(PPS2K pThis, RTGCINTPTR offDelta )1399 void PS2KRelocate(PPS2K pThis, RTGCINTPTR offDelta, PPDMDEVINS pDevIns) 1403 1400 { 1404 1401 LogFlowFunc(("Relocating PS2K\n")); … … 1408 1405 } 1409 1406 1410 int PS2KConstruct(PP DMDEVINS pDevIns, PPS2K pThis, void *pParent, int iInstance)1407 int PS2KConstruct(PPS2K pThis, PPDMDEVINS pDevIns, void *pParent, int iInstance) 1411 1408 { 1412 1409 int rc; … … 1420 1417 pThis->cmdQ.cSize = KBD_CMD_QUEUE_SIZE; 1421 1418 1422 pThis->Keyboard.IBase.pfnQueryInterface = PS2KQueryInterface;1423 pThis->Keyboard.IPort.pfnPutEvent = PS2KPutEventWrapper;1419 pThis->Keyboard.IBase.pfnQueryInterface = ps2kQueryInterface; 1420 pThis->Keyboard.IPort.pfnPutEvent = ps2kPutEventWrapper; 1424 1421 1425 1422 /* 1426 * Initialize the critical section .1423 * Initialize the critical section pointer(s). 1427 1424 */ 1428 rc = PDMDevHlpCritSectInit(pDevIns, &pThis->KbdCritSect, RT_SRC_POS, "PS2K#%u", iInstance); 1429 if (RT_FAILURE(rc)) 1430 return rc; 1425 pThis->pCritSectR3 = pDevIns->pCritSectRoR3; 1431 1426 1432 1427 /* … … 1434 1429 */ 1435 1430 PTMTIMER pTimer; 1436 rc = PDMDevHlpTMTimerCreate(pDevIns, TMCLOCK_REAL, PS2KTypematicTimer, pThis,1431 rc = PDMDevHlpTMTimerCreate(pDevIns, TMCLOCK_REAL, ps2kTypematicTimer, pThis, 1437 1432 TMTIMER_FLAGS_NO_CRIT_SECT, "PS2K Typematic Timer", &pTimer); 1438 if (RT_FAILURE 1433 if (RT_FAILURE(rc)) 1439 1434 return rc; 1440 1435 … … 1446 1441 * Create the command delay timer. 1447 1442 */ 1448 rc = PDMDevHlpTMTimerCreate(pDevIns, TMCLOCK_VIRTUAL, PS2KDelayTimer, pThis,1443 rc = PDMDevHlpTMTimerCreate(pDevIns, TMCLOCK_VIRTUAL, ps2kDelayTimer, pThis, 1449 1444 TMTIMER_FLAGS_NO_CRIT_SECT, "PS2K Delay Timer", &pTimer); 1450 if (RT_FAILURE 1445 if (RT_FAILURE(rc)) 1451 1446 return rc; 1452 1447 … … 1458 1453 * Register debugger info callbacks. 1459 1454 */ 1460 PDMDevHlpDBGFInfoRegister(pDevIns, "ps2k", "Display PS/2 keyboard state.", PS2KInfoState);1455 PDMDevHlpDBGFInfoRegister(pDevIns, "ps2k", "Display PS/2 keyboard state.", ps2kInfoState); 1461 1456 1462 1457 return rc; … … 1465 1460 #endif 1466 1461 1467 // @todo:The following should live with the KBC implementation.1462 ///@todo The following should live with the KBC implementation. 1468 1463 1469 1464 /* Table used by the keyboard controller to optionally translate the incoming -
trunk/src/VBox/Devices/testcase/tstDeviceStructSize.cpp
r44804 r44806 296 296 CHECK_MEMBER_ALIGNMENT(IOAPIC, StatMMIOReadGC, 8); 297 297 #endif 298 CHECK_MEMBER_ALIGNMENT(KBDState, CritSect, 8);299 CHECK_MEMBER_ALIGNMENT(PS2K, KbdCritSect, 8);300 298 CHECK_MEMBER_ALIGNMENT(LSILOGISCSI, ReplyPostQueueCritSect, 8); 301 299 CHECK_MEMBER_ALIGNMENT(LSILOGISCSI, ReplyFreeQueueCritSect, 8); -
trunk/src/VBox/Devices/testcase/tstDeviceStructSizeRC.cpp
r44804 r44806 392 392 GEN_CHECK_OFF(KBDState, pDevInsR0); 393 393 GEN_CHECK_OFF(KBDState, pDevInsRC); 394 GEN_CHECK_OFF(KBDState, CritSect);395 394 GEN_CHECK_SIZE(KbdKeyQ); 396 395 GEN_CHECK_OFF(KbdCmdQ, rpos); … … 414 413 GEN_CHECK_OFF(PS2K, pKbdTypematicTimerR3); 415 414 GEN_CHECK_OFF(PS2K, pKbdTypematicTimerR0); 415 GEN_CHECK_OFF(PS2K, pCritSectR3); 416 416 GEN_CHECK_OFF(PS2K, Keyboard.IBase); 417 417 GEN_CHECK_OFF(PS2K, Keyboard.IPort);
Note:
See TracChangeset
for help on using the changeset viewer.