@@ -369,7 +369,7 @@ IOReturn ApplePS2Controller::setProperties(OSObject* props)
369369
370370// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
371371
372- void ApplePS2Controller::resetController (bool wakeup )
372+ void ApplePS2Controller::resetController ()
373373{
374374 _suppressTimeout = true ;
375375 UInt8 commandByte;
@@ -415,30 +415,6 @@ void ApplePS2Controller::resetController(bool wakeup)
415415 writeCommandPort (kCP_SetCommandByte );
416416 writeDataPort (commandByte);
417417 DEBUG_LOG (" %s: new commandByte = %02x\n " , getName (), commandByte);
418-
419- if (wakeup && _muxPresent)
420- {
421- setMuxMode (true );
422- }
423- else if (!wakeup)
424- {
425- if (!_kbdOnly){
426- _muxPresent = setMuxMode (true );
427- _nubsCount = _muxPresent ? kPS2MuxMaxIdx : kPS2AuxMaxIdx ;
428- }else {
429- _muxPresent = false ;
430- _nubsCount = 1 ;
431- }
432- }
433-
434- resetDevices ();
435-
436- //
437- // Clear out garbage in the controller's input streams, before starting up
438- // the work loop.
439- //
440-
441- flushDataPort ();
442418}
443419
444420// -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@@ -548,9 +524,32 @@ bool ApplePS2Controller::start(IOService * provider)
548524
549525 PE_parse_boot_argn (" ps2rst" , &_resetControllerFlag, sizeof (_resetControllerFlag));
550526 if (_resetControllerFlag & RESET_CONTROLLER_ON_BOOT) {
551- resetController (false );
527+ resetController ();
552528 }
553529
530+ //
531+ // Enable "Active PS/2 Multiplexing" if it exists.
532+ // This creates 4 Aux ports which pointing devices may connect to.
533+ //
534+
535+ if (_kbdOnly) {
536+ _muxPresent = false ;
537+ _nubsCount = 1 ;
538+ } else {
539+ _muxPresent = setMuxMode (true );
540+ _nubsCount = _muxPresent ? kPS2MuxMaxIdx : kPS2AuxMaxIdx ;
541+ }
542+
543+ //
544+ // Reset attached devices and clear out garbage in the controller's input streams,
545+ // before starting up the work loop.
546+ //
547+
548+ if (_resetControllerFlag & RESET_CONTROLLER_ON_BOOT) {
549+ resetDevices ();
550+ flushDataPort ();
551+ }
552+
554553 //
555554 // Use a spin lock to protect the client async request queue.
556555 //
@@ -1875,12 +1874,23 @@ void ApplePS2Controller::setPowerStateGated( UInt32 powerState )
18751874
18761875 if (_resetControllerFlag & RESET_CONTROLLER_ON_WAKEUP)
18771876 {
1878- resetController (true );
1877+ resetController ();
18791878 }
18801879
18811880#endif // FULL_INIT_AFTER_WAKE
18821881
1883-
1882+ if (_muxPresent) {
1883+ setMuxMode (true );
1884+ }
1885+
1886+ #if FULL_INIT_AFTER_WAKE
1887+ if (_resetControllerFlag & RESET_CONTROLLER_ON_WAKEUP)
1888+ {
1889+ resetDevices ();
1890+ flushDataPort ();
1891+ }
1892+ #endif // FULL_INIT_AFTER_WAKE
1893+
18841894 //
18851895 // Transition from Sleep state to Working state in 4 stages.
18861896 //
0 commit comments