linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mason <slash.tmp@free.fr>
To: Bjorn Helgaas <helgaas@kernel.org>
Cc: linux-pci <linux-pci@vger.kernel.org>,
	Rob Herring <robh@kernel.org>,
	Ard Biesheuvel <ard.biesheuvel@linaro.org>,
	Thibaud Cornic <thibaud_cornic@sigmadesigns.com>,
	David Laight <david.laight@aculab.com>,
	Phuong Nguyen <phuong_nguyen@sigmadesigns.com>,
	Shawn Lin <shawn.lin@rock-chips.com>,
	Robin Murphy <robin.murphy@arm.com>,
	Linux ARM <linux-arm-kernel@lists.infradead.org>
Subject: Re: Neophyte questions about PCIe
Date: Tue, 14 Mar 2017 16:54:00 +0100	[thread overview]
Message-ID: <912c26d5-835f-9f39-73ba-db561b5bcffa@free.fr> (raw)
In-Reply-To: <94b3c89c-b116-288f-7530-15cc2611f425@free.fr>

On 14/03/2017 15:00, Mason wrote:

> On 10/03/2017 18:49, Mason wrote:
> 
>> /* Root complex reports incorrect device class */
>> static void tango_pcie_fixup_class(struct pci_dev *dev)
>> {
>> 	dev->class = PCI_CLASS_BRIDGE_PCI << 8;
>> }
> 
> Gen1 controller reports class/rev = 0x04800001
> Gen2 controller reports class/rev = 0x06000001
> 
> #define PCI_CLASS_BRIDGE_HOST		0x0600
> #define PCI_CLASS_BRIDGE_ISA		0x0601
> #define PCI_CLASS_BRIDGE_EISA		0x0602
> #define PCI_CLASS_BRIDGE_MC		0x0603
> #define PCI_CLASS_BRIDGE_PCI		0x0604
> #define PCI_CLASS_BRIDGE_PCMCIA		0x0605
> #define PCI_CLASS_BRIDGE_NUBUS		0x0606
> #define PCI_CLASS_BRIDGE_CARDBUS	0x0607
> #define PCI_CLASS_BRIDGE_RACEWAY	0x0608
> #define PCI_CLASS_BRIDGE_OTHER		0x0680
> 
> My fixup replaces 0x048000 with 0x060400.
> 
> 	0x060400 != 0x060000
> 
> Which is correct:
> PCI_CLASS_BRIDGE_HOST or PCI_CLASS_BRIDGE_PCI?
> 
> Naively, I would expect Host/PCI bridge to be more correct
> for a root complex.

But that's very likely wrong, since the code in Linux does:

	switch (dev->hdr_type) {		    /* header type */
	case PCI_HEADER_TYPE_BRIDGE:		    /* bridge header */
		if (class != PCI_CLASS_BRIDGE_PCI)
			goto bad;
		/* The PCI-to-PCI bridge spec requires that subtractive
		   decoding (i.e. transparent) bridge must have programming
		   interface code of 0x01. */

So a class of PCI_CLASS_BRIDGE_HOST would error out, I think.
Does this mean I need to fixup Gen2 as well?
(Since it reports 0x060000)

Regards.

  reply	other threads:[~2017-03-14 15:54 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-07 22:45 Neophyte questions about PCIe Mason
2017-03-08 13:39 ` Mason
2017-03-08 13:54 ` David Laight
2017-03-08 14:17   ` Mason
2017-03-08 14:38     ` David Laight
2017-03-09 22:01   ` Jeremy Linton
2017-03-08 15:17 ` Bjorn Helgaas
2017-03-09 23:43   ` Mason
2017-03-10 13:15     ` Robin Murphy
2017-03-10 14:06       ` David Laight
2017-03-10 15:05         ` Mason
2017-03-10 15:14           ` David Laight
2017-03-10 15:33             ` Mason
2017-03-10 15:23           ` Robin Murphy
2017-03-10 15:35             ` David Laight
2017-03-10 16:00               ` Robin Murphy
2017-03-13 10:59                 ` Mason
2017-03-13 11:56                   ` Robin Murphy
2017-03-10 18:49           ` Bjorn Helgaas
2017-03-10 14:53       ` Mason
2017-03-10 16:45     ` Mason
2017-03-10 17:49       ` Mason
2017-03-11 10:57         ` Mason
2017-03-13 21:40           ` Bjorn Helgaas
2017-03-13 21:57             ` Mason
2017-03-13 22:46               ` Bjorn Helgaas
2017-03-14 10:23               ` David Laight
2017-03-14 12:05                 ` Mason
2017-03-14 12:24                   ` David Laight
2017-03-13 14:25         ` Mason
2017-03-14 14:00         ` Mason
2017-03-14 15:54           ` Mason [this message]
2017-03-14 21:46             ` Bjorn Helgaas

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=912c26d5-835f-9f39-73ba-db561b5bcffa@free.fr \
    --to=slash.tmp@free.fr \
    --cc=ard.biesheuvel@linaro.org \
    --cc=david.laight@aculab.com \
    --cc=helgaas@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=phuong_nguyen@sigmadesigns.com \
    --cc=robh@kernel.org \
    --cc=robin.murphy@arm.com \
    --cc=shawn.lin@rock-chips.com \
    --cc=thibaud_cornic@sigmadesigns.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).