Kernel: Increase i8042 IO attempt counts, again

This is very similar to the change that was done in 32053e8, except it
turned out that the new limit of 50 iterations was not enough when
testing on bare metal - most IO operations would succeed in the first or
second iteration, but two of them took 140 and 150 iterations
respectively.
Increase the limit from 50 to 250 to account for this, and have some
additional headroom.
This commit is contained in:
Linus Groh 2022-02-18 23:57:26 +00:00
parent 37a04b739a
commit eca8208a34
Notes: sideshowbarker 2024-07-18 00:34:07 +09:00

View file

@ -268,7 +268,7 @@ ErrorOr<void> I8042Controller::prepare_for_input(HIDDevice::Type device)
{
VERIFY(m_lock.is_locked());
u8 const second_port_flag = device == HIDDevice::Type::Keyboard ? 0 : I8042StatusFlag::SecondPS2PortOutputBuffer;
for (int attempt = 0; attempt < 50; attempt++) {
for (int attempt = 0; attempt < 250; attempt++) {
u8 status = IO::in8(I8042Port::Status);
if (!(status & I8042StatusFlag::OutputBuffer)) {
IO::delay(1000);
@ -286,7 +286,7 @@ ErrorOr<void> I8042Controller::prepare_for_input(HIDDevice::Type device)
ErrorOr<void> I8042Controller::prepare_for_output()
{
VERIFY(m_lock.is_locked());
for (int attempt = 0; attempt < 50; attempt++) {
for (int attempt = 0; attempt < 250; attempt++) {
u8 status = IO::in8(I8042Port::Status);
if (!(status & I8042StatusFlag::InputBuffer))
return {};