From: John Bradford <john@grabjohn.com>
To: fretre3618@hotmail.com (fretre lewis)
Cc: linux-kernel@vger.kernel.org
Subject: Re: please help me understand a line code about pci
Date: Sat, 4 Jan 2003 12:14:09 +0000 (GMT) [thread overview]
Message-ID: <200301041214.h04CE90f000847@darkstar.example.net> (raw)
In-Reply-To: <F870TlKn4ZHkRQq5xVz0000f680@hotmail.com> from "fretre lewis" at Jan 04, 2003 11:59:11 AM
[-- Attachment #1: Type: text/plain, Size: 1047 bytes --]
> I am reading code about pci, and I can't understand some lines in
> pci_check_direct(), in arch/i386/kernel/pci-pc.c
>
> the PCI spec v2.0 say: ( page32)
>
> "Anytime a host bridge sees a full DWORD I/O write from the host to
> CONFIG_ADDRESS, the bridge must latch the data into its CONFIG_ADDRESS
> register. On full DWORD I/O reads to CONFIG_ADDRESS,the bridge must return
> the
> data in CONFIG_ADDRESS. Any other types of accesses to this
> address(non-DWORD)
> have no effect on CONFIG_ADDRESS and are excuted as normal I/O transaction
> on PCI bus......"
>
> CONFIG_ADDRESS = 0xcf8
> CONFIG_data = 0xcfc
>
> so , I wonder why need "outb (0x01, 0xCFB);" if check configuration type 1 ?
> and why "outb (0x00, 0xCFB);" if check configuration type 2?
It looks to me like a workaround for broken hardware, but I could be
wrong.
Incidently, wouldn't it be worth printing some debugging info, such as
the values read from 0xCF8 and 0xCFA, when neither configuration type
works? I've attached an, (untested), patch to do so.
John.
[-- Attachment #2: ASCII text --]
[-- Type: text/plain, Size: 816 bytes --]
--- pci-pc.c.orig 2003-01-04 12:09:35.000000000 +0000
+++ pci-pc.c 2003-01-04 12:12:37.000000000 +0000
@@ -459,6 +459,8 @@
{
unsigned int tmp;
unsigned long flags;
+ unsigned int foo;
+ unsigned int bar;
__save_flags(flags); __cli();
@@ -493,13 +495,17 @@
outb (0x00, 0xCFB);
outb (0x00, 0xCF8);
outb (0x00, 0xCFA);
- if (inb (0xCF8) == 0x00 && inb (0xCFA) == 0x00 &&
+ foo = inb (0xCF8);
+ bar = inb (0xCFA);
+ if (foo == 0x00 && bar == 0x00 &&
pci_sanity_check(&pci_direct_conf2)) {
__restore_flags(flags);
printk(KERN_INFO "PCI: Using configuration type 2\n");
request_region(0xCF8, 4, "PCI conf2");
return &pci_direct_conf2;
}
+ printk ((KERN_INFO, "PCI: Failed to use configuration type 1 or 2.
+0xCF8:%x 0xCFA:%x\n", foo, bar);
}
__restore_flags(flags);
next prev parent reply other threads:[~2003-01-04 12:05 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-01-04 11:59 please help me understand a line code about pci fretre lewis
2003-01-04 12:14 ` John Bradford [this message]
2003-01-04 20:54 ` Alan Cox
-- strict thread matches above, loose matches on Subject: below --
2003-01-04 7:24 fretre lewis
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=200301041214.h04CE90f000847@darkstar.example.net \
--to=john@grabjohn.com \
--cc=fretre3618@hotmail.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