/** Issue command to set mouse's scaling. @param Scaling value of scaling @return Status of command issuing. **/ EFI_STATUS PS2MouseSetScaling ( IN MOUSE_SF Scaling ) { // // Send auxiliary command to set mouse scaling data // return Out8042AuxCommand (Scaling == Scaling1 ? SETSF1_CMD : SETSF2_CMD, FALSE); }
/** Issue command to enable Ps2 mouse. @return Status of command issuing. **/ EFI_STATUS PS2MouseEnable ( VOID ) { // // Send auxiliary command to enable mouse // return Out8042AuxCommand (ENABLE_CMD, FALSE); }
/** Issue command to enable Ps2 mouse. @param IsaIo Pointer to instance of EFI_ISA_IO_PROTOCOL @return Status of command issuing. **/ EFI_STATUS PS2MouseEnable ( IN EFI_ISA_IO_PROTOCOL *IsaIo ) { // // Send auxiliary command to enable mouse // return Out8042AuxCommand (IsaIo, ENABLE_CMD, FALSE); }
/** Issue command to set mouse's scaling. @param IsaIo Pointer to instance of EFI_ISA_IO_PROTOCOL @param Scaling value of scaling @return Status of command issuing. **/ EFI_STATUS PS2MouseSetScaling ( IN EFI_ISA_IO_PROTOCOL *IsaIo, IN MOUSE_SF Scaling ) { UINT8 Command; Command = (UINT8) (Scaling == Scaling1 ? SETSF1_CMD : SETSF2_CMD); // // Send auxiliary command to set mouse scaling data // return Out8042AuxCommand (IsaIo, Command, FALSE); }
/** Issue command to set mouse's resolution. @param Resolution value of resolution @return Status of command issuing. **/ EFI_STATUS PS2MouseSetResolution ( IN MOUSE_RE Resolution ) { EFI_STATUS Status; // // Send auxiliary command to set mouse resolution // Status = Out8042AuxCommand (SETRE_CMD, FALSE); if (EFI_ERROR (Status)) { return Status; } Status = Out8042AuxData (ResolutionTbl[Resolution]); return Status; }
/** Issue command to set mouse's sample rate @param SampleRate value of sample rate @return Status of command issuing. **/ EFI_STATUS PS2MouseSetSampleRate ( IN MOUSE_SR SampleRate ) { EFI_STATUS Status; // // Send auxiliary command to set mouse sample rate // Status = Out8042AuxCommand (SETSR_CMD, FALSE); if (EFI_ERROR (Status)) { return Status; } Status = Out8042AuxData (SampleRateTbl[SampleRate]); return Status; }
/** Issue command to reset keyboard. @return Status of command issuing. **/ EFI_STATUS PS2MouseReset ( VOID ) { EFI_STATUS Status; UINT8 Data; Status = Out8042AuxCommand (RESET_CMD, FALSE); if (EFI_ERROR (Status)) { return Status; } Status = In8042AuxData (&Data); if (EFI_ERROR (Status)) { return Status; } // // Check BAT Complete Code // if (Data != PS2MOUSE_BAT1) { return EFI_DEVICE_ERROR; } Status = In8042AuxData (&Data); if (EFI_ERROR (Status)) { return Status; } // // Check BAT Complete Code // if (Data != PS2MOUSE_BAT2) { return EFI_DEVICE_ERROR; } return EFI_SUCCESS; }
/** I/O work flow of outing 8042 Aux command. @param Command Aux I/O command @param Resend Whether need resend the Aux command. @retval EFI_SUCCESS Success to excute I/O work flow @retval EFI_TIMEOUT Keyboard controller time out. **/ EFI_STATUS Out8042AuxCommand ( IN UINT8 Command, IN BOOLEAN Resend ) { EFI_STATUS Status; UINT8 Data; // // Wait keyboard controller input buffer empty // Status = WaitInputEmpty (TIMEOUT); if (EFI_ERROR (Status)) { return Status; } // // Send write to auxiliary device command // IoWrite8 (KBC_CMD_STS_PORT, WRITE_AUX_DEV); Status = WaitInputEmpty (TIMEOUT); if (EFI_ERROR (Status)) { return Status; } // // Send auxiliary device command // IoWrite8 (KBC_DATA_PORT, Command); // // Read return code // Status = In8042AuxData (&Data); if (EFI_ERROR (Status)) { return Status; } if (Data == PS2_ACK) { // // Receive mouse acknowledge, command send success // return EFI_SUCCESS; } else if (Resend) { // // Resend fail // return EFI_DEVICE_ERROR; } else if (Data == PS2_RESEND) { // // Resend command // Status = Out8042AuxCommand (Command, TRUE); if (EFI_ERROR (Status)) { return Status; } } else { // // Invalid return code // return EFI_DEVICE_ERROR; } return EFI_SUCCESS; }