[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH 1 of 5] rombios/keyboard: Don't needlessly poll the status register



At 16:41 +0000 on 26 Nov (1353948092), Andrew Cooper wrote:
> Repeated polling of the status register is not going to change its value, so
> don't needlessly take 8192 traps to Qemu when 1 will do.

AFAICS the purpose of this loop is to handle the case where someone's
actually typing at the time.  The 0x2000 is intended to make us wait
long enough for the next keypress or autorepeat.

Reducing the loop to _2_ outb(0x80)s seems strange -- is there some case
in qemu where another character will be presented after 2 delays but not
immediately?

If not, can we dispense with 'max' altogether and just have 
    while ( (inb(0x64) & 0x01) ) { inb(0x60); outb(0x80, 0x00); }
or even
    while ( (inb(0x64) & 0x01) ) inb(0x60);
?

Tim.

> Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
> 
> diff -r 0049de3827bc -r 1728fb789940 tools/firmware/rombios/rombios.c
> --- a/tools/firmware/rombios/rombios.c
> +++ b/tools/firmware/rombios/rombios.c
> @@ -1805,12 +1805,12 @@ keyboard_init()
>      while ( (inb(0x64) & 0x02) && (--max>0)) outb(0x80, 0x00);
>  
>      /* flush incoming keys */
> -    max=0x2000;
> +    max=2;
>      while (--max > 0) {
>          outb(0x80, 0x00);
>          if (inb(0x64) & 0x01) {
>              inb(0x60);
> -            max = 0x2000;
> +            max = 2;
>              }
>          }
>  
> 
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@xxxxxxxxxxxxx
> http://lists.xen.org/xen-devel

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.