From: Sergei Shtylyov <sshtylyov@ru.mvista.com>
To: petkovbb@gmail.com
Cc: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>,
Alan Cox <alan@lxorguk.ukuu.org.uk>,
linux-kernel@vger.kernel.org, linux-ide@vger.kernel.org
Subject: Re: [PATCH 1/2] pata_legacy: export functionality to ide
Date: Thu, 07 Aug 2008 00:04:19 +0400 [thread overview]
Message-ID: <489A03C3.5070607@ru.mvista.com> (raw)
In-Reply-To: <20080806194754.GC31312@gollum.tnic>
Borislav Petkov wrote:
>>>>>From: Borislav Petkov <petkovbb@gmail.com>
>>>>>Date: Sun, 3 Aug 2008 18:46:35 +0200
>>>>>Subject: [PATCH] ide-generic: handle probing of legacy io-ports v4
>>>>>Avoid probing the io-ports in case an IDE PCI controller is present and it uses
>>>>>the legacy iobases. If we still want to enforce the probing, we do
>>>>>ide_generic.probe_mask=0x3f
>>>>>on the kernel command line. The iobase checking code is adapted from
>>>>>drivers/ata/pata_legacy.c after converting hex pci ids into their
>>>>>corresponding
>>>>>macros in <linux/pci_ids.h>.
>>>>>CC: Sergei Shtylyov <sshtylyov@ru.mvista.com>
>>>>>Signed-off-by: Borislav Petkov <petkovbb@gmail.com>
>>>>Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
>>>>>diff --git a/drivers/ide/ide-generic.c b/drivers/ide/ide-generic.c
>>>>>index 8fe8b5b..efce159 100644
>>>>>--- a/drivers/ide/ide-generic.c
>>>>>+++ b/drivers/ide/ide-generic.c
>>>>[...]
>>>>>@@ -100,19 +101,69 @@ static const u16 legacy_bases[] = { 0x1f0, 0x170,
>>>>>0x1e8, 0x168, 0x1e0, 0x160 };
>>>>>static const int legacy_irqs[] = { 14, 15, 11, 10, 8, 12 };
>>>>>#endif
>>>>>+static void ide_generic_check_pci_legacy_iobases(int *primary, int
>>>>>*secondary)
>>>>>+{
>>>>>+ struct pci_dev *p = NULL;
>>>>>+ u16 val;
>>>>>+
>>>>>+ for_each_pci_dev(p) {
>>>>>+ int r;
>>>>>+
>>>>>+ for (r = 0; r < 6; r++) {
>>>>>+ if (pci_resource_start(p, r) == 0x1f0)
>>>>>+ *primary = 1;
>>>>>+ if (pci_resource_start(p, r) == 0x170)
>>>>>+ *secondary = 1;
>>>>>+ }
>>>>Would have been probably enough to test only BAR0/2, don't you think?
>>>I assume you're referring to the legacy ioports fixup in
>>>drivers/pci/probe.c:pci_setup_device().
>> And to the fact that the value 0x1f0 should only be ever seen in BAR0
>>and 0x170 in BAR2 even if they would have been read off the chips (some
>>chips have these values reading back even in legacy mode, and even could
>>malfunction if other values are written there), not fixed up there, and
>>certainly not in BAR1 or BAR3, so it's quite pointless to look in these
>>BARs too.
> So the comment in there saying that in some cases BAR0-3 could contain junk is a
> bogus?
Don't know. The PCI IDE spec. said that those should be 0 in compatibility
mode but I know that some controllers require the standard values of 0x1[f7]0
to be in BAR0/2 in compatibility mode. If my memory serves, NatSemi PC8741x
were ones of those...
> In other words, can we assume that one will always read 0x1f0 from BAR0
> and 0x170 from BAR2 in compatibility mode.
Certainly not. We can only rely on the workaround putting 0x1[f7]0 in the
resources 0/2.
> If so, the check is even simpler:
> if (pci_resource_start(p, 0) == 0x1f0)
> *primary = 1;
> if (pci_resource_start(p, 2) == 0x170)
> *secondary = 1;
Yes, I think that should be enough...
WBR, Sergei
next prev parent reply other threads:[~2008-08-06 20:04 UTC|newest]
Thread overview: 44+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-07-15 5:33 [PATCH] ide-floppy fix Borislav Petkov
2008-07-15 5:40 ` Borislav Petkov
2008-07-16 15:59 ` Bartlomiej Zolnierkiewicz
2008-07-15 20:39 ` Borislav Petkov
2008-07-15 20:58 ` Bartlomiej Zolnierkiewicz
2008-07-16 5:20 ` Borislav Petkov
2008-07-16 17:56 ` Bartlomiej Zolnierkiewicz
2008-07-20 12:06 ` Borislav Petkov
2008-07-21 19:03 ` Bartlomiej Zolnierkiewicz
2008-07-22 5:27 ` Borislav Petkov
2008-07-22 19:49 ` Bartlomiej Zolnierkiewicz
2008-07-23 6:32 ` Borislav Petkov
2008-07-23 18:51 ` Bartlomiej Zolnierkiewicz
2008-08-01 5:48 ` [PATCH] ide-generic: skip automatic probing of legacy iobases (was: Re: [PATCH] ide-floppy fix) Borislav Petkov
2008-08-02 17:02 ` Bartlomiej Zolnierkiewicz
2008-08-02 18:32 ` Borislav Petkov
2008-08-02 18:46 ` Bartlomiej Zolnierkiewicz
2008-08-03 7:37 ` [PATCH 1/2] pata_legacy: export functionality to ide Borislav Petkov
2008-08-03 11:59 ` Alan Cox
2008-08-03 13:37 ` Bartlomiej Zolnierkiewicz
2008-08-03 13:39 ` Alan Cox
2008-08-03 23:43 ` Jeff Garzik
2008-08-03 14:38 ` Borislav Petkov
2008-08-03 15:22 ` Alan Cox
2008-08-03 16:51 ` Borislav Petkov
2008-08-05 14:26 ` Sergei Shtylyov
2008-08-05 14:32 ` Boris Petkov
2008-08-05 14:41 ` Bartlomiej Zolnierkiewicz
2008-08-06 6:10 ` Borislav Petkov
2008-08-06 11:34 ` Sergei Shtylyov
2008-08-06 14:03 ` Boris Petkov
2008-08-06 15:57 ` Sergei Shtylyov
2008-08-06 19:47 ` Borislav Petkov
2008-08-06 19:46 ` Alan Cox
2008-08-06 20:04 ` Sergei Shtylyov [this message]
2008-08-07 4:36 ` [PATCH] ide-generic: handle probing of legacy io-ports v5 (was: Re: [PATCH 1/2] pata_legacy: export functionality to ide) Borislav Petkov
2008-08-07 17:06 ` Bartlomiej Zolnierkiewicz
2008-08-08 10:04 ` [PATCH] ide-generic: handle probing of legacy io-ports v5 Sergei Shtylyov
2008-08-03 7:38 ` [PATCH 2/2] ide-generic: handle probing of legacy io-ports Borislav Petkov
2008-08-03 14:11 ` Bartlomiej Zolnierkiewicz
2008-08-03 14:45 ` Borislav Petkov
2008-08-03 14:54 ` Borislav Petkov
2008-08-03 14:59 ` Bartlomiej Zolnierkiewicz
2008-08-03 15:08 ` Borislav Petkov
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=489A03C3.5070607@ru.mvista.com \
--to=sshtylyov@ru.mvista.com \
--cc=alan@lxorguk.ukuu.org.uk \
--cc=bzolnier@gmail.com \
--cc=linux-ide@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=petkovbb@gmail.com \
/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).