MdeModulePkg/Bus/Isa/Ps2KeyboardDxe/Ps2KbdCtrller.c | 6 +----- MdeModulePkg/Bus/Isa/Ps2KeyboardDxe/Ps2Keyboard.h | 2 +- 2 files changed, 2 insertions(+), 6 deletions(-)
From: Matt DeVillier <matt.devillier@gmail.com>
Recent model Chromebooks only return ACK, but not
BAT_SUCCESS, which causes hanging and failed ps2k init.
To mitigate this, make the absence of BAT_SUCCESS reply
non-fatal, and reduce the no-reply timeout from 4s to 1s.
Tested on google/dracia and purism/librem_14
Cc: Hao A Wu <hao.a.wu@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Signed-off-by: Matt DeVillier <matt.devillier@gmail.com>
Signed-off-by: Sean Rhodes <sean@starlabs.systems>
---
MdeModulePkg/Bus/Isa/Ps2KeyboardDxe/Ps2KbdCtrller.c | 6 +-----
MdeModulePkg/Bus/Isa/Ps2KeyboardDxe/Ps2Keyboard.h | 2 +-
2 files changed, 2 insertions(+), 6 deletions(-)
diff --git a/MdeModulePkg/Bus/Isa/Ps2KeyboardDxe/Ps2KbdCtrller.c b/MdeModulePkg/Bus/Isa/Ps2KeyboardDxe/Ps2KbdCtrller.c
index 77dc226222..6c71355edd 100644
--- a/MdeModulePkg/Bus/Isa/Ps2KeyboardDxe/Ps2KbdCtrller.c
+++ b/MdeModulePkg/Bus/Isa/Ps2KeyboardDxe/Ps2KbdCtrller.c
@@ -1733,11 +1733,7 @@ InitKeyboard (
//
mWaitForValueTimeOut = KEYBOARD_BAT_TIMEOUT;
- Status = KeyboardWaitForValue (ConsoleIn, KEYBOARD_8048_RETURN_8042_BAT_SUCCESS);
- if (EFI_ERROR (Status)) {
- KeyboardError (ConsoleIn, L"Keyboard self test failed!\n\r");
- goto Done;
- }
+ KeyboardWaitForValue (ConsoleIn, KEYBOARD_8048_RETURN_8042_BAT_SUCCESS);
mWaitForValueTimeOut = KEYBOARD_WAITFORVALUE_TIMEOUT;
diff --git a/MdeModulePkg/Bus/Isa/Ps2KeyboardDxe/Ps2Keyboard.h b/MdeModulePkg/Bus/Isa/Ps2KeyboardDxe/Ps2Keyboard.h
index ca1dd9b2c2..38df3e092d 100644
--- a/MdeModulePkg/Bus/Isa/Ps2KeyboardDxe/Ps2Keyboard.h
+++ b/MdeModulePkg/Bus/Isa/Ps2KeyboardDxe/Ps2Keyboard.h
@@ -157,7 +157,7 @@ InstallPs2KeyboardDriver (
#define KEYBOARD_MAX_TRY 256 // 256
#define KEYBOARD_TIMEOUT 65536 // 0.07s
#define KEYBOARD_WAITFORVALUE_TIMEOUT 1000000 // 1s
-#define KEYBOARD_BAT_TIMEOUT 4000000 // 4s
+#define KEYBOARD_BAT_TIMEOUT 1000000 // 1s
#define KEYBOARD_TIMER_INTERVAL 200000 // 0.02s
#define SCANCODE_EXTENDED0 0xE0
#define SCANCODE_EXTENDED1 0xE1
--
2.32.0
-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#86611): https://edk2.groups.io/g/devel/message/86611
Mute This Topic: https://groups.io/mt/89066601/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-
Reviewed-by: Ray Ni <ray.ni@intel.com>
> -----Original Message-----
> From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Sean
> Rhodes
> Sent: Friday, February 11, 2022 4:05 PM
> To: devel@edk2.groups.io
> Cc: Dong, Guo <guo.dong@intel.com>; Matt DeVillier
> <matt.devillier@gmail.com>; Wu, Hao A <hao.a.wu@intel.com>; Ni, Ray
> <ray.ni@intel.com>; Rhodes, Sean <sean@starlabs.systems>
> Subject: [edk2-devel] [PATCH] Ps2KbdCtrller: Make wait for SUCCESS after
> BAT non-fatal
>
> From: Matt DeVillier <matt.devillier@gmail.com>
>
> Recent model Chromebooks only return ACK, but not
> BAT_SUCCESS, which causes hanging and failed ps2k init.
> To mitigate this, make the absence of BAT_SUCCESS reply
> non-fatal, and reduce the no-reply timeout from 4s to 1s.
>
> Tested on google/dracia and purism/librem_14
>
> Cc: Hao A Wu <hao.a.wu@intel.com>
> Cc: Ray Ni <ray.ni@intel.com>
> Signed-off-by: Matt DeVillier <matt.devillier@gmail.com>
> Signed-off-by: Sean Rhodes <sean@starlabs.systems>
> ---
> MdeModulePkg/Bus/Isa/Ps2KeyboardDxe/Ps2KbdCtrller.c | 6 +-----
> MdeModulePkg/Bus/Isa/Ps2KeyboardDxe/Ps2Keyboard.h | 2 +-
> 2 files changed, 2 insertions(+), 6 deletions(-)
>
> diff --git a/MdeModulePkg/Bus/Isa/Ps2KeyboardDxe/Ps2KbdCtrller.c
> b/MdeModulePkg/Bus/Isa/Ps2KeyboardDxe/Ps2KbdCtrller.c
> index 77dc226222..6c71355edd 100644
> --- a/MdeModulePkg/Bus/Isa/Ps2KeyboardDxe/Ps2KbdCtrller.c
> +++ b/MdeModulePkg/Bus/Isa/Ps2KeyboardDxe/Ps2KbdCtrller.c
> @@ -1733,11 +1733,7 @@ InitKeyboard (
> //
>
> mWaitForValueTimeOut = KEYBOARD_BAT_TIMEOUT;
>
>
>
> - Status = KeyboardWaitForValue (ConsoleIn,
> KEYBOARD_8048_RETURN_8042_BAT_SUCCESS);
>
> - if (EFI_ERROR (Status)) {
>
> - KeyboardError (ConsoleIn, L"Keyboard self test failed!\n\r");
>
> - goto Done;
>
> - }
>
> + KeyboardWaitForValue (ConsoleIn,
> KEYBOARD_8048_RETURN_8042_BAT_SUCCESS);
>
>
>
> mWaitForValueTimeOut = KEYBOARD_WAITFORVALUE_TIMEOUT;
>
>
>
> diff --git a/MdeModulePkg/Bus/Isa/Ps2KeyboardDxe/Ps2Keyboard.h
> b/MdeModulePkg/Bus/Isa/Ps2KeyboardDxe/Ps2Keyboard.h
> index ca1dd9b2c2..38df3e092d 100644
> --- a/MdeModulePkg/Bus/Isa/Ps2KeyboardDxe/Ps2Keyboard.h
> +++ b/MdeModulePkg/Bus/Isa/Ps2KeyboardDxe/Ps2Keyboard.h
> @@ -157,7 +157,7 @@ InstallPs2KeyboardDriver (
> #define KEYBOARD_MAX_TRY 256 // 256
>
> #define KEYBOARD_TIMEOUT 65536 // 0.07s
>
> #define KEYBOARD_WAITFORVALUE_TIMEOUT 1000000 // 1s
>
> -#define KEYBOARD_BAT_TIMEOUT 4000000 // 4s
>
> +#define KEYBOARD_BAT_TIMEOUT 1000000 // 1s
>
> #define KEYBOARD_TIMER_INTERVAL 200000 // 0.02s
>
> #define SCANCODE_EXTENDED0 0xE0
>
> #define SCANCODE_EXTENDED1 0xE1
>
> --
> 2.32.0
>
>
>
> -=-=-=-=-=-=
> Groups.io Links: You receive all messages sent to this group.
> View/Reply Online (#86611): https://edk2.groups.io/g/devel/message/86611
> Mute This Topic: https://groups.io/mt/89066601/1712937
> Group Owner: devel+owner@edk2.groups.io
> Unsubscribe: https://edk2.groups.io/g/devel/unsub [ray.ni@intel.com]
> -=-=-=-=-=-=
>
-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#94877): https://edk2.groups.io/g/devel/message/94877
Mute This Topic: https://groups.io/mt/89066601/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-
Acked-by: Hao A Wu <hao.a.wu@intel.com>
I recommend to get Ray's input for this patch before merging.
Best Regards,
Hao Wu
> -----Original Message-----
> From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Sean
> Rhodes
> Sent: Friday, February 11, 2022 4:05 PM
> To: devel@edk2.groups.io
> Cc: Dong, Guo <guo.dong@intel.com>; Matt DeVillier
> <matt.devillier@gmail.com>; Wu, Hao A <hao.a.wu@intel.com>; Ni, Ray
> <ray.ni@intel.com>; Rhodes, Sean <sean@starlabs.systems>
> Subject: [edk2-devel] [PATCH] Ps2KbdCtrller: Make wait for SUCCESS after
> BAT non-fatal
>
> From: Matt DeVillier <matt.devillier@gmail.com>
>
> Recent model Chromebooks only return ACK, but not
> BAT_SUCCESS, which causes hanging and failed ps2k init.
> To mitigate this, make the absence of BAT_SUCCESS reply
> non-fatal, and reduce the no-reply timeout from 4s to 1s.
>
> Tested on google/dracia and purism/librem_14
>
> Cc: Hao A Wu <hao.a.wu@intel.com>
> Cc: Ray Ni <ray.ni@intel.com>
> Signed-off-by: Matt DeVillier <matt.devillier@gmail.com>
> Signed-off-by: Sean Rhodes <sean@starlabs.systems>
> ---
> MdeModulePkg/Bus/Isa/Ps2KeyboardDxe/Ps2KbdCtrller.c | 6 +-----
> MdeModulePkg/Bus/Isa/Ps2KeyboardDxe/Ps2Keyboard.h | 2 +-
> 2 files changed, 2 insertions(+), 6 deletions(-)
>
> diff --git a/MdeModulePkg/Bus/Isa/Ps2KeyboardDxe/Ps2KbdCtrller.c
> b/MdeModulePkg/Bus/Isa/Ps2KeyboardDxe/Ps2KbdCtrller.c
> index 77dc226222..6c71355edd 100644
> --- a/MdeModulePkg/Bus/Isa/Ps2KeyboardDxe/Ps2KbdCtrller.c
> +++ b/MdeModulePkg/Bus/Isa/Ps2KeyboardDxe/Ps2KbdCtrller.c
> @@ -1733,11 +1733,7 @@ InitKeyboard (
> //
>
> mWaitForValueTimeOut = KEYBOARD_BAT_TIMEOUT;
>
>
>
> - Status = KeyboardWaitForValue (ConsoleIn,
> KEYBOARD_8048_RETURN_8042_BAT_SUCCESS);
>
> - if (EFI_ERROR (Status)) {
>
> - KeyboardError (ConsoleIn, L"Keyboard self test failed!\n\r");
>
> - goto Done;
>
> - }
>
> + KeyboardWaitForValue (ConsoleIn,
> KEYBOARD_8048_RETURN_8042_BAT_SUCCESS);
>
>
>
> mWaitForValueTimeOut = KEYBOARD_WAITFORVALUE_TIMEOUT;
>
>
>
> diff --git a/MdeModulePkg/Bus/Isa/Ps2KeyboardDxe/Ps2Keyboard.h
> b/MdeModulePkg/Bus/Isa/Ps2KeyboardDxe/Ps2Keyboard.h
> index ca1dd9b2c2..38df3e092d 100644
> --- a/MdeModulePkg/Bus/Isa/Ps2KeyboardDxe/Ps2Keyboard.h
> +++ b/MdeModulePkg/Bus/Isa/Ps2KeyboardDxe/Ps2Keyboard.h
> @@ -157,7 +157,7 @@ InstallPs2KeyboardDriver (
> #define KEYBOARD_MAX_TRY 256 // 256
>
> #define KEYBOARD_TIMEOUT 65536 // 0.07s
>
> #define KEYBOARD_WAITFORVALUE_TIMEOUT 1000000 // 1s
>
> -#define KEYBOARD_BAT_TIMEOUT 4000000 // 4s
>
> +#define KEYBOARD_BAT_TIMEOUT 1000000 // 1s
>
> #define KEYBOARD_TIMER_INTERVAL 200000 // 0.02s
>
> #define SCANCODE_EXTENDED0 0xE0
>
> #define SCANCODE_EXTENDED1 0xE1
>
> --
> 2.32.0
>
>
>
> -=-=-=-=-=-=
> Groups.io Links: You receive all messages sent to this group.
> View/Reply Online (#86611): https://edk2.groups.io/g/devel/message/86611
> Mute This Topic: https://groups.io/mt/89066601/1768737
> Group Owner: devel+owner@edk2.groups.io
> Unsubscribe: https://edk2.groups.io/g/devel/unsub [hao.a.wu@intel.com]
> -=-=-=-=-=-=
>
-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#86744): https://edk2.groups.io/g/devel/message/86744
Mute This Topic: https://groups.io/mt/89066601/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-
Hi Ray
Would you be able to review please? :)
Thanks
Sean
On Fri, 18 Feb 2022 at 02:16, Wu, Hao A <hao.a.wu@intel.com> wrote:
> Acked-by: Hao A Wu <hao.a.wu@intel.com>
> I recommend to get Ray's input for this patch before merging.
>
> Best Regards,
> Hao Wu
>
> > -----Original Message-----
> > From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Sean
> > Rhodes
> > Sent: Friday, February 11, 2022 4:05 PM
> > To: devel@edk2.groups.io
> > Cc: Dong, Guo <guo.dong@intel.com>; Matt DeVillier
> > <matt.devillier@gmail.com>; Wu, Hao A <hao.a.wu@intel.com>; Ni, Ray
> > <ray.ni@intel.com>; Rhodes, Sean <sean@starlabs.systems>
> > Subject: [edk2-devel] [PATCH] Ps2KbdCtrller: Make wait for SUCCESS after
> > BAT non-fatal
> >
> > From: Matt DeVillier <matt.devillier@gmail.com>
> >
> > Recent model Chromebooks only return ACK, but not
> > BAT_SUCCESS, which causes hanging and failed ps2k init.
> > To mitigate this, make the absence of BAT_SUCCESS reply
> > non-fatal, and reduce the no-reply timeout from 4s to 1s.
> >
> > Tested on google/dracia and purism/librem_14
> >
> > Cc: Hao A Wu <hao.a.wu@intel.com>
> > Cc: Ray Ni <ray.ni@intel.com>
> > Signed-off-by: Matt DeVillier <matt.devillier@gmail.com>
> > Signed-off-by: Sean Rhodes <sean@starlabs.systems>
> > ---
> > MdeModulePkg/Bus/Isa/Ps2KeyboardDxe/Ps2KbdCtrller.c | 6 +-----
> > MdeModulePkg/Bus/Isa/Ps2KeyboardDxe/Ps2Keyboard.h | 2 +-
> > 2 files changed, 2 insertions(+), 6 deletions(-)
> >
> > diff --git a/MdeModulePkg/Bus/Isa/Ps2KeyboardDxe/Ps2KbdCtrller.c
> > b/MdeModulePkg/Bus/Isa/Ps2KeyboardDxe/Ps2KbdCtrller.c
> > index 77dc226222..6c71355edd 100644
> > --- a/MdeModulePkg/Bus/Isa/Ps2KeyboardDxe/Ps2KbdCtrller.c
> > +++ b/MdeModulePkg/Bus/Isa/Ps2KeyboardDxe/Ps2KbdCtrller.c
> > @@ -1733,11 +1733,7 @@ InitKeyboard (
> > //
> >
> > mWaitForValueTimeOut = KEYBOARD_BAT_TIMEOUT;
> >
> >
> >
> > - Status = KeyboardWaitForValue (ConsoleIn,
> > KEYBOARD_8048_RETURN_8042_BAT_SUCCESS);
> >
> > - if (EFI_ERROR (Status)) {
> >
> > - KeyboardError (ConsoleIn, L"Keyboard self test failed!\n\r");
> >
> > - goto Done;
> >
> > - }
> >
> > + KeyboardWaitForValue (ConsoleIn,
> > KEYBOARD_8048_RETURN_8042_BAT_SUCCESS);
> >
> >
> >
> > mWaitForValueTimeOut = KEYBOARD_WAITFORVALUE_TIMEOUT;
> >
> >
> >
> > diff --git a/MdeModulePkg/Bus/Isa/Ps2KeyboardDxe/Ps2Keyboard.h
> > b/MdeModulePkg/Bus/Isa/Ps2KeyboardDxe/Ps2Keyboard.h
> > index ca1dd9b2c2..38df3e092d 100644
> > --- a/MdeModulePkg/Bus/Isa/Ps2KeyboardDxe/Ps2Keyboard.h
> > +++ b/MdeModulePkg/Bus/Isa/Ps2KeyboardDxe/Ps2Keyboard.h
> > @@ -157,7 +157,7 @@ InstallPs2KeyboardDriver (
> > #define KEYBOARD_MAX_TRY 256 // 256
> >
> > #define KEYBOARD_TIMEOUT 65536 // 0.07s
> >
> > #define KEYBOARD_WAITFORVALUE_TIMEOUT 1000000 // 1s
> >
> > -#define KEYBOARD_BAT_TIMEOUT 4000000 // 4s
> >
> > +#define KEYBOARD_BAT_TIMEOUT 1000000 // 1s
> >
> > #define KEYBOARD_TIMER_INTERVAL 200000 // 0.02s
> >
> > #define SCANCODE_EXTENDED0 0xE0
> >
> > #define SCANCODE_EXTENDED1 0xE1
> >
> > --
> > 2.32.0
> >
> >
> >
> > -=-=-=-=-=-=
> > Groups.io Links: You receive all messages sent to this group.
> > View/Reply Online (#86611): https://edk2.groups.io/g/devel/message/86611
> > Mute This Topic: https://groups.io/mt/89066601/1768737
> > Group Owner: devel+owner@edk2.groups.io
> > Unsubscribe: https://edk2.groups.io/g/devel/unsub [hao.a.wu@intel.com]
> > -=-=-=-=-=-=
> >
>
>
-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#87640): https://edk2.groups.io/g/devel/message/87640
Mute This Topic: https://groups.io/mt/89066601/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-
© 2016 - 2025 Red Hat, Inc.