mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Ivan Kokshaysky <ink@jurassic.park.msu.ru>
To: John Rose <johnrose@austin.ibm.com>
Cc: Ivan Kokshaysky <ink@jurassic.park.msu.ru>,
	lkml <linux-kernel@vger.kernel.org>
Subject: Re: pci_size() error condition
Date: Fri, 15 Jul 2005 02:33:23 +0400	[thread overview]
Message-ID: <20050715023323.C613@den.park.msu.ru> (raw)
In-Reply-To: <1121357040.9265.1.camel@sinatra.austin.ibm.com>; from johnrose@austin.ibm.com on Thu, Jul 14, 2005 at 11:04:00AM -0500

On Thu, Jul 14, 2005 at 11:04:00AM -0500, John Rose wrote:
> Okay, point taken :)  So for cases of base == maxbase, why would we ever
> want to return a nonzero value?  What is the intended purpose of the
> second part of that conditional?

Well, just two examples (both for PCI IO limited to 16 bits for simplicity,
but still from real life):
1. Consider some BAR that defines 16 bytes of IO space. It's
   perfectly valid for the PCI firmware to program this BAR to
   its max value, so after writing all 1s during the probe and proper
   masking we have base == maxbase == 0xfff0. But, since all high
   order bits are all 1s, (((base | size) & mask) != mask) is false,
   and we return correct value of 16.
2. Another BAR of some broken PCI device (typically, IDE controller)
   has *read-only* value of 0x1f0, for instance. After writing 0xffff
   we still read back the same 0x1f0, so base == maxbase == 0x1f0.
   But the second part of that "if" clause is now true, so we return 0,
   which means that the BAR is invalid and must be ignored.

Ivan.

      reply	other threads:[~2005-07-14 22:36 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-07-13 22:53 John Rose
2005-07-13 23:40 ` Ivan Kokshaysky
2005-07-14 16:04   ` John Rose
2005-07-14 22:33     ` Ivan Kokshaysky [this message]

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=20050715023323.C613@den.park.msu.ru \
    --to=ink@jurassic.park.msu.ru \
    --cc=johnrose@austin.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    /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

all inboxes | Powered by JetHome®