[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20100125232801.GD30307@core.coreip.homeip.net>
Date: Mon, 25 Jan 2010 15:28:01 -0800
From: Dmitry Torokhov <dmitry.torokhov@...il.com>
To: "H. Peter Anvin" <hpa@...or.com>
Cc: Vojtech Pavlik <vojtech@...e.cz>,
Robert Hancock <hancockrwd@...il.com>,
Bastien Nocera <hadess@...ess.net>,
linux-kernel <linux-kernel@...r.kernel.org>, pjones@...hat.com
Subject: Re: [PATCH] Disable i8042 checks on Intel Apple Macs
On Mon, Jan 25, 2010 at 03:05:31PM -0800, H. Peter Anvin wrote:
> On 01/25/2010 02:30 PM, Dmitry Torokhov wrote:
> >>
> >> We should never read from port 0x60 unless bit 1 in port 0x64 is set.
> >> Do we do that?
> >
> > No, we don't read of OBF is 0. Incidentially 0xff has it set ;) so we do
> > try reading data port.
> >
>
> What do you do after reading the data port? In the case of the A20
> code, we do dummy reads and loop until the data port drains (0xff of
> course means it never drains...)
>
/*
* i8042_flush() flushes all data that may be in the keyboard and mouse
* buffers
* of the i8042 down the toilet.
*/
static int i8042_flush(void)
{
unsigned long flags;
unsigned char data, str;
int i = 0;
spin_lock_irqsave(&i8042_lock, flags);
while (((str = i8042_read_status()) & I8042_STR_OBF) && (i < I8042_BUFFER_SIZE)) {
udelay(50);
data = i8042_read_data();
i++;
dbg("%02x <- i8042 (flush, %s)", data,
str & I8042_STR_AUXDATA ? "aux" : "kbd");
}
spin_unlock_irqrestore(&i8042_lock, flags);
return i;
}
...
static int i8042_controller_check(void)
{
if (i8042_flush() == I8042_BUFFER_SIZE) {
printk(KERN_ERR "i8042.c: No controller found.\n");
return -ENODEV;
}
return 0;
}
--
Dmitry
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists