From 0e88231b6bcf7b9c475f8a61bdb7794267ffe833 Mon Sep 17 00:00:00 2001 From: Young Xiao <92siuyang@gmail.com> Date: Thu, 16 May 2019 20:29:51 +0800 Subject: [PATCH] Avoid an infinite loop in empty_aux_buffers() by adding a timeout. This helps systems that don't actually have atkbd controllers, such as the Intel SBX82 blade, boot without device.hints hacks. See commit 3631541670c8 ("Avoid an infinite loop in empty_both_buffers() by adding a timeout.") for details. Signed-off-by: Young Xiao <92siuyang@gmail.com> --- sys/dev/atkbdc/atkbdc.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/sys/dev/atkbdc/atkbdc.c b/sys/dev/atkbdc/atkbdc.c index adf55ec..81520bf 100644 --- a/sys/dev/atkbdc/atkbdc.c +++ b/sys/dev/atkbdc/atkbdc.c @@ -907,6 +907,7 @@ empty_aux_buffer(KBDC p, int wait) int t; int b; int f; + int waited = 0; #if KBDIO_DEBUG >= 2 int c1 = 0; int c2 = 0; @@ -929,6 +930,16 @@ empty_aux_buffer(KBDC p, int wait) } else { t -= delta; } + + /* + * Some systems (Intel/IBM blades) do not have keyboard devices and + * will thus hang in this procedure. Time out after delta seconds to + * avoid this hang -- the keyboard attach will fail later on. + */ + waited += (delta * 1000); + if (waited == (delta * 1000000)) + return; + DELAY(delta*1000); } #if KBDIO_DEBUG >= 2 -- 2.7.4