From 9aeef366085e4c9e8065f680c840cef892be40d1 Mon Sep 17 00:00:00 2001 From: Doug White Date: Mon, 4 Sep 2006 00:19:31 +0000 Subject: [PATCH] Avoid an infinite loop in empty_both_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. Hardware for this fix provided by iXsystems. PR: 94822 Submitted by: Devon H. O'Dell MFC After: 3 days --- 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 248ac2fd0231..df1f28e497dd 100644 --- a/sys/dev/atkbdc/atkbdc.c +++ b/sys/dev/atkbdc/atkbdc.c @@ -857,6 +857,7 @@ empty_both_buffers(KBDC p, int wait) { int t; int f; + int waited = 0; #if KBDIO_DEBUG >= 2 int c1 = 0; int c2 = 0; @@ -877,6 +878,16 @@ empty_both_buffers(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