From: Tejun Heo <htejun@gmail.com>
To: Jan Beulich <jbeulich@novell.com>
Cc: jgarzik@pobox.com, linux-ide@vger.kernel.org
Subject: Re: AHCI driver preferring nr_ports over port map
Date: Tue, 05 Feb 2008 22:17:46 +0900 [thread overview]
Message-ID: <47A861FA.1070001@gmail.com> (raw)
In-Reply-To: <47A86734.76E4.0078.0@novell.com>
Jan Beulich wrote:
> It does, in the description for bits 4:0 of the host capabilities register:
> "Number of Ports (NPS)" RO. Hardwired to 5h to indicate support for 6
> ports. Note that the number of ports indicated in this field may be more
> than the number of ports indicated in the PI (ABAR + 0Ch) register."
Oops, you're right, NP can go over PI. Somehow I've been believing it
should match PI. Oh well, that's me being delusional again. :-(
>From ahci 1.1.
Number of Ports (NP): 0's based value indicating the maximum number
of ports supported by the HBA silicon. A maximum of 32 ports can be
supported. A value of Impl. '0h', indicating one port, is the
minimum requirement. Note that the number of ports Spec. indicated
in this field may be more than the number of ports indicated in the
GHC.PI register.
Does the following patch fix the problem?
diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c
index e75966b..39627c7 100644
--- a/drivers/ata/ahci.c
+++ b/drivers/ata/ahci.c
@@ -679,24 +679,20 @@ static void ahci_save_initial_config(struct pci_dev *pdev,
/* cross check port_map and cap.n_ports */
if (port_map) {
- u32 tmp_port_map = port_map;
- int n_ports = ahci_nr_ports(cap);
+ int map_ports = 0;
- for (i = 0; i < AHCI_MAX_PORTS && n_ports; i++) {
- if (tmp_port_map & (1 << i)) {
- n_ports--;
- tmp_port_map &= ~(1 << i);
- }
- }
+ for (i = 0; i < AHCI_MAX_PORTS; i++)
+ if (port_map & (1 << i))
+ map_ports++;
- /* If n_ports and port_map are inconsistent, whine and
- * clear port_map and let it be generated from n_ports.
+ /* If PI has more ports than n_ports, whine and clear
+ * port_map and let it be generated from n_ports.
*/
- if (n_ports || tmp_port_map) {
+ if (map_ports > ahci_nr_ports(cap)) {
dev_printk(KERN_WARNING, &pdev->dev,
- "nr_ports (%u) and implemented port map "
- "(0x%x) don't match, using nr_ports\n",
- ahci_nr_ports(cap), port_map);
+ "implemented port map (0x%x) contains more "
+ "ports than nr_ports (%u), using nr_ports\n",
+ port_map, ahci_nr_ports(cap));
port_map = 0;
}
}
next prev parent reply other threads:[~2008-02-05 13:17 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-02-04 13:24 AHCI driver preferring nr_ports over port map Jan Beulich
2008-02-04 13:38 ` Tejun Heo
2008-02-05 7:47 ` Jan Beulich
2008-02-05 12:21 ` Tejun Heo
2008-02-05 12:40 ` Jan Beulich
2008-02-05 13:17 ` Tejun Heo [this message]
2008-02-05 14:51 ` Jan Beulich
-- strict thread matches above, loose matches on Subject: below --
2008-02-04 13:10 Jan Beulich
2008-02-04 13:16 ` Tejun Heo
2008-02-01 15:12 Jan Beulich
2008-02-02 8:16 ` Tejun Heo
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=47A861FA.1070001@gmail.com \
--to=htejun@gmail.com \
--cc=jbeulich@novell.com \
--cc=jgarzik@pobox.com \
--cc=linux-ide@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.