All of lore.kernel.org
 help / color / mirror / Atom feed
From: Zhiqiang Hou <Zhiqiang.Hou@nxp.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 2/2] pci: Change the first CFG read to Vendor ID in enumeration
Date: Mon,  8 Oct 2018 16:35:48 +0800	[thread overview]
Message-ID: <20181008083548.44471-2-Zhiqiang.Hou@nxp.com> (raw)
In-Reply-To: <20181008083548.44471-1-Zhiqiang.Hou@nxp.com>

From: Hou Zhiqiang <Zhiqiang.Hou@nxp.com>

As the PCIe specification recommend reading the Vendor ID register
to determine if a Function is present, read the Vendor ID of a
non-existent Function must not result in system error, so we'd better
make the first CFG read to Vendor ID instead of Header Type register
in the PCIe enumeration.

Signed-off-by: Hou Zhiqiang <Zhiqiang.Hou@nxp.com>
---
 drivers/pci/pci.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index 221054593e..590f7b123a 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -361,13 +361,13 @@ int pci_hose_scan_bus(struct pci_controller *hose, int bus)
 		if (PCI_FUNC(dev) && !found_multi)
 			continue;
 
-		pci_hose_read_config_byte(hose, dev, PCI_HEADER_TYPE, &header_type);
-
 		pci_hose_read_config_word(hose, dev, PCI_VENDOR_ID, &vendor);
 
 		if (vendor == 0xffff || vendor == 0x0000)
 			continue;
 
+		pci_hose_read_config_byte(hose, dev, PCI_HEADER_TYPE, &header_type);
+
 		if (!PCI_FUNC(dev))
 			found_multi = header_type & 0x80;
 
-- 
2.17.1

  reply	other threads:[~2018-10-08  8:35 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-08  8:35 [U-Boot] [PATCH 1/2] dm/pci: Change the first CFG read to Vendor ID in enumeration Zhiqiang Hou
2018-10-08  8:35 ` Zhiqiang Hou [this message]
2018-10-08  8:54   ` [U-Boot] [PATCH 2/2] pci: " Bin Meng
2018-10-09  3:40     ` Simon Glass
2018-10-09  5:15       ` Bin Meng
2018-10-09  8:07       ` Z.q. Hou
2018-10-19  3:27         ` Simon Glass
2018-10-08  8:53 ` [U-Boot] [PATCH 1/2] dm/pci: " Bin Meng
2018-10-08  9:20   ` Z.q. Hou
2018-11-22 20:22   ` sjg at google.com

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=20181008083548.44471-2-Zhiqiang.Hou@nxp.com \
    --to=zhiqiang.hou@nxp.com \
    --cc=u-boot@lists.denx.de \
    /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.