|
[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
On 27/11/12 16:33, Tim Deegan wrote:
> 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?
The reduction to 2 instead of 1 is because the while loop uses a
pre-decrement on max.
The patch was chosen at the time to have minimal change to the code.
~Andrew
>
> 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
--
Andrew Cooper - Dom0 Kernel Engineer, Citrix XenServer
T: +44 (0)1223 225 900, http://www.citrix.com
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |