linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: "H. Peter Anvin" <hpa@zytor.com>
Cc: Vojtech Pavlik <vojtech@suse.cz>,
	Robert Hancock <hancockrwd@gmail.com>,
	Bastien Nocera <hadess@hadess.net>,
	linux-kernel <linux-kernel@vger.kernel.org>,
	pjones@redhat.com
Subject: Re: [PATCH] Disable i8042 checks on Intel Apple Macs
Date: Mon, 25 Jan 2010 15:28:01 -0800	[thread overview]
Message-ID: <20100125232801.GD30307@core.coreip.homeip.net> (raw)
In-Reply-To: <4B5E23BB.1090806@zytor.com>

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

  reply	other threads:[~2010-01-25 23:28 UTC|newest]

Thread overview: 43+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-01-20 18:23 [PATCH] Disable i8042 checks on Intel Apple Macs Bastien Nocera
2010-01-20 19:14 ` Justin P. Mattock
2010-01-20 19:37   ` Bastien Nocera
2010-01-20 19:54     ` Justin P. Mattock
2010-01-21  0:41 ` Robert Hancock
2010-01-21  1:31   ` Bastien Nocera
2010-01-21  2:19     ` Robert Hancock
2010-01-21 18:55   ` Dmitry Torokhov
2010-01-21 21:39     ` Robert Hancock
2010-01-21 21:42       ` Bastien Nocera
2010-01-21 21:49       ` Justin P. Mattock
2010-01-22  0:29         ` Robert Hancock
2010-01-22  1:20           ` Justin P. Mattock
2010-01-22  2:09             ` Bastien Nocera
2010-01-22  2:30               ` Robert Hancock
2010-01-22  2:53                 ` Bastien Nocera
2010-01-22  2:31               ` Justin P. Mattock
2010-01-21 22:17       ` Dmitry Torokhov
2010-01-22  0:26         ` Robert Hancock
2010-01-22 17:46           ` H. Peter Anvin
2010-01-22 18:15             ` Bastien Nocera
2010-01-22 22:33             ` Robert Hancock
2010-01-22 22:49               ` H. Peter Anvin
2010-01-25 16:34         ` Vojtech Pavlik
2010-01-25 21:32           ` H. Peter Anvin
2010-01-25 22:15             ` Dmitry Torokhov
2010-01-25 22:18               ` H. Peter Anvin
2010-01-25 22:30                 ` Dmitry Torokhov
2010-01-25 23:05                   ` H. Peter Anvin
2010-01-25 23:28                     ` Dmitry Torokhov [this message]
2010-01-25 23:31                       ` H. Peter Anvin
2010-05-04 17:06               ` Bastien Nocera
2010-05-04 17:23                 ` Dmitry Torokhov
2010-05-04 17:37                   ` Bastien Nocera
  -- strict thread matches above, loose matches on Subject: below --
2010-05-04 17:36 Bastien Nocera
2010-05-04 17:55 ` Pekka Enberg
2010-05-04 18:02 ` Dmitry Torokhov
2010-05-05  9:18   ` Bastien Nocera
2010-05-05 21:27 ` Kyle McMartin
2010-05-12  0:11 Bastien Nocera
2010-05-12 10:51 ` Felipe Contreras
2010-05-12 11:00   ` Felipe Contreras
2010-05-12 17:51   ` Dmitry Torokhov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20100125232801.GD30307@core.coreip.homeip.net \
    --to=dmitry.torokhov@gmail.com \
    --cc=hadess@hadess.net \
    --cc=hancockrwd@gmail.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pjones@redhat.com \
    --cc=vojtech@suse.cz \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).